Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump registry #1367

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .changeset/tasty-pugs-develop.md

This file was deleted.

26 changes: 26 additions & 0 deletions apps/minifront/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# minifront

## 6.4.0

### Minor Changes

- bump registry

### Patch Changes

- Updated dependencies
- @penumbra-zone/[email protected]
- @repo/[email protected]
- @penumbra-zone/[email protected]
- @penumbra-zone/[email protected]

## 6.3.0

### Minor Changes

- Bump registry

### Patch Changes

- bce49fe: Update revision number parsing logic
- Updated dependencies
- @repo/[email protected]

## 6.2.1

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions apps/minifront/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "minifront",
"version": "6.2.1",
"version": "6.4.0",
"private": true,
"license": "(MIT OR Apache-2.0)",
"type": "module",
Expand All @@ -19,7 +19,7 @@
"@cosmos-kit/core": "^2.12.0",
"@cosmos-kit/react": "^2.15.0",
"@interchain-ui/react": "^1.23.16",
"@penumbra-labs/registry": "8.0.1",
"@penumbra-labs/registry": "9.1.0",
"@penumbra-zone/bech32m": "workspace:*",
"@penumbra-zone/client": "workspace:*",
"@penumbra-zone/crypto-web": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion apps/minifront/src/fetchers/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const getStakingTokenMetadata = async () => {
throw new Error('Could not fetch chain id');
}

const { stakingAssetId } = chainRegistryClient.get(chainId);
const stakingAssetId = chainRegistryClient.globals().stakingAssetId;
const stakingAssetsMetadata = await getAssetMetadataById(stakingAssetId);

if (!stakingAssetsMetadata) {
Expand Down
18 changes: 18 additions & 0 deletions apps/node-status/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# node-status

## 4.1.0

### Minor Changes

- bump registry

### Patch Changes

- Updated dependencies
- @repo/[email protected]

## 4.0.3

### Patch Changes

- Updated dependencies
- @repo/[email protected]

## 4.0.2

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion apps/node-status/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-status",
"version": "4.0.2",
"version": "4.1.0",
"private": true,
"license": "(MIT OR Apache-2.0)",
"type": "module",
Expand Down
7 changes: 7 additions & 0 deletions packages/crypto/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @penumbra-zone/crypto-web

## 7.0.0

### Patch Changes

- Updated dependencies
- @penumbra-zone/[email protected]

## 6.0.0

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/crypto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@penumbra-zone/crypto-web",
"version": "6.0.0",
"version": "7.0.0",
"license": "(MIT OR Apache-2.0)",
"type": "module",
"engine": {
Expand Down
6 changes: 6 additions & 0 deletions packages/perspective/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @penumbra-zone/perspective

## 8.0.0

### Patch Changes

- @penumbra-zone/[email protected]

## 7.0.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/perspective/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@penumbra-zone/perspective",
"version": "7.0.0",
"version": "8.0.0",
"license": "(MIT OR Apache-2.0)",
"description": "Tools for assuming different perspectives of Penumbra transactions",
"type": "module",
Expand Down
9 changes: 9 additions & 0 deletions packages/query/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# @penumbra-zone/query

## 8.0.0

### Patch Changes

- Updated dependencies
- @penumbra-zone/[email protected]
- @penumbra-zone/[email protected]
- @penumbra-zone/[email protected]

## 7.0.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/query/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@penumbra-zone/query",
"version": "7.0.0",
"version": "8.0.0",
"license": "(MIT OR Apache-2.0)",
"type": "module",
"engine": {
Expand Down
23 changes: 23 additions & 0 deletions packages/services/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# @penumbra-zone/router

## 9.0.0

### Minor Changes

- bump registry

### Patch Changes

- Updated dependencies
- @penumbra-zone/[email protected]
- @penumbra-zone/[email protected]
- @penumbra-zone/[email protected]
- @penumbra-zone/[email protected]
- @penumbra-zone/[email protected]
- @penumbra-zone/[email protected]

## 8.0.0

### Patch Changes

- Updated dependencies
- @penumbra-zone/[email protected]

## 7.0.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/services/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@penumbra-zone/services",
"version": "7.0.0",
"version": "9.0.0",
"license": "(MIT OR Apache-2.0)",
"type": "module",
"engine": {
Expand Down
2 changes: 1 addition & 1 deletion packages/services/src/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export interface IndexedDbMock {
getAuction?: Mock;
getAuctionOutstandingReserves?: Mock;
hasStakingAssetBalance?: Mock;
fetchStakingTokenId?: Mock;
stakingTokenAssetId?: Mock;
}

export interface AuctionMock {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('TransactionPlanner request handler', () => {
getAppParams: vi.fn(),
getGasPrices: vi.fn(),
constants: vi.fn(),
fetchStakingTokenId: vi.fn(),
stakingTokenAssetId: vi.fn(),
hasStakingAssetBalance: vi.fn(),
};

Expand Down Expand Up @@ -80,7 +80,7 @@ describe('TransactionPlanner request handler', () => {
}),
);

mockIndexedDb.fetchStakingTokenId?.mockResolvedValueOnce(true);
mockIndexedDb.stakingTokenAssetId?.mockResolvedValueOnce(true);
mockIndexedDb.hasStakingAssetBalance?.mockResolvedValueOnce(true);
await transactionPlanner(req, mockCtx);

Expand Down
10 changes: 2 additions & 8 deletions packages/services/src/view-service/transaction-planner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,17 @@ import { assertSwapAssetsAreNotTheSame } from './assert-swap-assets-are-not-the-
import { TransactionPlannerRequest } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/view/v1/view_pb';
import { fvkCtx } from '../../ctx/full-viewing-key';
import { extractAltFee } from '../fees';
import { AssetId } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/asset/v1/asset_pb';
import { TransactionPlan } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/transaction/v1/transaction_pb';

export const transactionPlanner: Impl['transactionPlanner'] = async (req, ctx) => {
const services = await ctx.values.get(servicesCtx)();
const { indexedDb } = await services.getWalletServices();

// Retrieve the staking token from asset registry
const stakingTokenId = indexedDb.fetchStakingTokenId();

// Query IndexedDB directly to check for the existence of staking token
const nativeToken = await indexedDb.hasStakingAssetBalance(stakingTokenId);
const nativeToken = await indexedDb.hasStakingAssetBalance();

// Initialize the gas fee token using an native staking token's asset ID
let gasFeeToken = new AssetId({
inner: stakingTokenId.inner,
});
let gasFeeToken = indexedDb.stakingTokenAssetId;

// If there is no native token balance, extract and use an alternate gas fee token
if (!nativeToken) {
Expand Down
18 changes: 18 additions & 0 deletions packages/storage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# @penumbra-zone/storage

## 8.0.0

### Major Changes

- bump registry

### Patch Changes

- Updated dependencies
- @penumbra-zone/[email protected]
- @penumbra-zone/[email protected]

## 7.1.0

### Minor Changes

- Bump registry

## 7.0.0

### Major Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/storage/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@penumbra-zone/storage",
"version": "7.0.0",
"version": "8.0.0",
"license": "(MIT OR Apache-2.0)",
"type": "module",
"engine": {
Expand Down Expand Up @@ -28,7 +28,7 @@
}
},
"dependencies": {
"@penumbra-labs/registry": "8.0.1",
"@penumbra-labs/registry": "9.1.0",
"idb": "^8.0.0"
},
"peerDependencies": {
Expand Down
28 changes: 12 additions & 16 deletions packages/storage/src/indexed-db/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class IndexedDb implements IndexedDbInterface {
private readonly u: IbdUpdater,
private readonly c: IdbConstants,
private readonly chainId: string,
private readonly stakingTokenAssetId: AssetId,
readonly stakingTokenAssetId: AssetId,
) {}

static async initialize({
Expand Down Expand Up @@ -142,7 +142,7 @@ export class IndexedDb implements IndexedDbInterface {
new IbdUpdater(db),
constants,
chainId,
registryClient.get(chainId).stakingAssetId,
registryClient.globals().stakingAssetId,
);
await instance.saveRegistryAssets(registryClient, chainId); // Pre-load asset metadata from registry

Expand Down Expand Up @@ -276,10 +276,14 @@ export class IndexedDb implements IndexedDbInterface {
// Registry version already saved
if (lastPosition === commit) return;

const assets = registryClient.get(chainId).getAllAssets();
const saveLocalMetadata = assets.map(m => this.saveAssetsMetadata(m));
await Promise.all(saveLocalMetadata);
await this.u.update({ table: 'REGISTRY_VERSION', key: 'commit', value: commit });
try {
const assets = registryClient.get(chainId).getAllAssets();
const saveLocalMetadata = assets.map(m => this.saveAssetsMetadata(m));
await Promise.all(saveLocalMetadata);
await this.u.update({ table: 'REGISTRY_VERSION', key: 'commit', value: commit });
} catch (error) {
console.error('Failed pre-population of assets from the registry', error);
}
}

async *iterateSpendableNotes() {
Expand Down Expand Up @@ -811,19 +815,11 @@ export class IndexedDb implements IndexedDbInterface {
};
}

fetchStakingTokenId(): AssetId {
const registryClient = new ChainRegistryClient();
const registry = registryClient.get(this.chainId);
const stakingToken = registry.stakingAssetId;

return stakingToken;
}

async hasStakingAssetBalance(assetId: AssetId): Promise<boolean> {
async hasStakingAssetBalance(): Promise<boolean> {
const spendableUMNotes = await this.db.getAllFromIndex(
'SPENDABLE_NOTES',
'assetId',
uint8ArrayToBase64(assetId.inner),
uint8ArrayToBase64(this.stakingTokenAssetId.inner),
);

return spendableUMNotes.some(note => {
Expand Down
6 changes: 6 additions & 0 deletions packages/types/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @penumbra-zone/types

## 11.0.0

### Major Changes

- bump registry

## 10.0.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@penumbra-zone/types",
"version": "10.0.0",
"version": "11.0.0",
"license": "(MIT OR Apache-2.0)",
"type": "module",
"engine": {
Expand Down
6 changes: 3 additions & 3 deletions packages/types/src/indexed-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ export interface IdbUpdate<DBTypes extends PenumbraDb, StoreName extends StoreNa
}

export interface IndexedDbInterface {
stakingTokenAssetId: AssetId;

subscribe<DBTypes extends PenumbraDb, StoreName extends StoreNames<DBTypes>>(
table: StoreName,
): AsyncGenerator<IdbUpdate<DBTypes, StoreName>, void>;
Expand Down Expand Up @@ -144,9 +146,7 @@ export interface IndexedDbInterface {
auctionId: AuctionId,
): Promise<{ input: Value; output: Value } | undefined>;

hasStakingAssetBalance(assetId: AssetId): Promise<boolean>;

fetchStakingTokenId(): AssetId;
hasStakingAssetBalance(): Promise<boolean>;
}

export interface PenumbraDb extends DBSchema {
Expand Down
Loading
Loading