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 1 commit
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.

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

## 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.3.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
7 changes: 7 additions & 0 deletions apps/node-status/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# node-status

## 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.0.3",
"private": true,
"license": "(MIT OR Apache-2.0)",
"type": "module",
Expand Down
7 changes: 7 additions & 0 deletions packages/services/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @penumbra-zone/router

## 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": "8.0.0",
"license": "(MIT OR Apache-2.0)",
"type": "module",
"engine": {
Expand Down
6 changes: 6 additions & 0 deletions packages/storage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @penumbra-zone/storage

## 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": "7.1.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
20 changes: 10 additions & 10 deletions packages/storage/src/indexed-db/index.ts
Original file line number Diff line number Diff line change
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 @@ -812,11 +816,7 @@ export class IndexedDb implements IndexedDbInterface {
}

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

return stakingToken;
return this.stakingTokenAssetId;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably fetch is the wrong name for this. Why don't we just make this a public variable so folks can grab it from the instance: https://github.com/penumbra-zone/web/pull/1367/files#diff-8298d111bc94531ec943d5f024a9ab57657ad28670caea51e3aa9eda88bf3954R83

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, if this is done, we should make storage a major version bump given we change the API in a breaking way

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@grod220 will you be able to publish packages to npm?

}

async hasStakingAssetBalance(assetId: AssetId): Promise<boolean> {
Expand Down
6 changes: 6 additions & 0 deletions packages/ui/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @penumbra-zone/ui

## 6.1.0

### Minor Changes

- Bump registry

## 6.0.0

### Major Changes
Expand Down
26 changes: 18 additions & 8 deletions packages/ui/components/ui/tx/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { TransactionView } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbr
import { MemoViewComponent } from './memo-view';
import { ActionViewComponent } from './action-view';
import { ViewBox, ViewSection } from './viewbox';
import { getStakingTokenMetaData } from './registry';
import { getFeeAssetMetadataOrDefault } from './registry';
import { ValueView } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/asset/v1/asset_pb';
import { ValueViewComponent } from '../value';

Expand All @@ -13,13 +13,23 @@ export const TransactionViewComponent = ({ txv }: { txv: TransactionView }) => {
// Request the fee 'Metadata' and construct a 'ValueView' object
const chainId = txv.bodyView.transactionParameters.chainId;
const assetId = txv.bodyView.transactionParameters.fee.assetId;
const feeAssetMetadata = getStakingTokenMetaData(chainId, assetId);
const feeValueView = new ValueView({
valueView: {
case: 'knownAssetId',
value: { amount: txv.bodyView.transactionParameters.fee.amount, metadata: feeAssetMetadata },
},
});
const feeAssetMetadata = getFeeAssetMetadataOrDefault(chainId, assetId);
const feeValueView = feeAssetMetadata
? new ValueView({
valueView: {
case: 'knownAssetId',
value: {
amount: txv.bodyView.transactionParameters.fee.amount,
metadata: feeAssetMetadata,
},
},
})
: new ValueView({
valueView: {
case: 'unknownAssetId',
value: { amount: txv.bodyView.transactionParameters.fee.amount },
},
});

return (
<div className='flex flex-col gap-8'>
Expand Down
12 changes: 4 additions & 8 deletions packages/ui/components/ui/tx/registry.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ import {
Metadata,
} from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/asset/v1/asset_pb';

export function getStakingTokenMetaData(
export function getFeeAssetMetadataOrDefault(
chainId: string,
assetId: AssetId | undefined,
assetId?: AssetId,
): Metadata | undefined {
const registryClient = new ChainRegistryClient();
const registry = registryClient.get(chainId);

if (assetId === undefined) {
assetId = registry.stakingAssetId;
}
const StakingTokenMetadata = registry.getMetadata(assetId);

return StakingTokenMetadata;
const feeAssetId = assetId ?? registryClient.globals().stakingAssetId;
return registry.getMetadata(feeAssetId);
}
4 changes: 2 additions & 2 deletions packages/ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@repo/ui",
"version": "6.0.0",
"version": "6.1.0",
"private": true,
"license": "(MIT OR Apache-2.0)",
"type": "module",
Expand Down Expand Up @@ -59,7 +59,7 @@
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@mui/material": "^5.15.18",
"@penumbra-labs/registry": "8.0.1",
"@penumbra-labs/registry": "9.1.0",
"@penumbra-zone/bech32m": "workspace:*",
"@penumbra-zone/types": "workspace:*",
"@radix-ui/react-avatar": "^1.0.4",
Expand Down
18 changes: 9 additions & 9 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading