Skip to content

Commit

Permalink
rebase main
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentine1898 committed Apr 26, 2024
1 parent 41c5fb0 commit 0d6eca9
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 19 deletions.
28 changes: 18 additions & 10 deletions apps/minifront/src/fetchers/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,25 @@ export const useRegistry = () => {
};

export const getStakingTokenMetadata = async () => {
const chainId = await getChainId();
if (!chainId) {
throw new Error('Could not fetch chain id');
}
const chainId = await getChainId();
if (!chainId) {
throw new Error('Could not fetch chain id');
}

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

if (!stakingAssetsMetadata) {
throw new Error('Could not fetch staking asset metadata');
}
return stakingAssetsMetadata;
if (!stakingAssetsMetadata) {
throw new Error('Could not fetch staking asset metadata');
}
return stakingAssetsMetadata;
};

export const getIbcConnections = async () => {
const chainId = await getChainId();
if (!chainId) throw new Error('Could not fetch chain id');

const registryClient = new ChainRegistryClient();
const { ibcConnections } = await registryClient.get(chainId);
return ibcConnections;
};
6 changes: 1 addition & 5 deletions apps/minifront/src/state/ibc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@ import { toBaseUnit } from '@penumbra-zone/types/src/lo-hi';
import { planBuildBroadcast } from './helpers';
import { amountMoreThanBalance } from './send';
import { getAssetId } from '@penumbra-zone/getters/src/metadata';
import {
assetPatterns,
localAssets,
STAKING_TOKEN_METADATA,
} from '@penumbra-zone/constants/src/assets';
import { assetPatterns } from '@penumbra-zone/constants/src/assets';
import { bech32, bech32m } from 'bech32';
import { errorToast } from '@penumbra-zone/ui/lib/toast/presets';
import { Chain } from '@penumbra-labs/registry';
Expand Down
2 changes: 1 addition & 1 deletion packages/storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"./indexed-db/*": "./src/indexed-db/*.ts"
},
"dependencies": {
"@penumbra-zone/bech32m": "workspace:*",
"@penumbra-labs/registry": "^5.1.0",
"@penumbra-zone/bech32m": "workspace:*",
"@penumbra-zone/constants": "workspace:*",
"@penumbra-zone/crypto-web": "workspace:*",
"@penumbra-zone/getters": "workspace:*",
Expand Down
2 changes: 1 addition & 1 deletion packages/storage/src/indexed-db/indexed-db.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ describe('IndexedDb', () => {
chainId: 'test',
dbVersion: 2,
walletId: new WalletId({
inner: Uint8Array.from({ length: 8 }, () => Math.floor(Math.random() * 256)),
inner: Uint8Array.from({ length: 32 }, () => Math.floor(Math.random() * 256)),
}),
registryAssets: [metadataA, metadataB],
};
Expand Down
12 changes: 10 additions & 2 deletions pnpm-lock.yaml

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

0 comments on commit 0d6eca9

Please sign in to comment.