Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
da5ee34
fix: prevent runtime error by using optional chaining for walletInfo.…
sdqede Jun 23, 2025
6f16e0b
chain-registry 2.0
sdqede Jun 23, 2025
59b6207
modify packageManager from yarn 4.1 to 4.3
sdqede Jun 23, 2025
47e6f77
upgrade chain-registry to 2.0
sdqede Jun 23, 2025
6282a84
fix bugs of building failure
sdqede Jun 23, 2025
3f6e72d
fix Type error: 'Component' cannot be used as a JSX component
sdqede Jun 23, 2025
63d8db3
replaced @chain-registry/v2 with chain-registry v2.0
sdqede Jun 26, 2025
e5e42a0
upgraded interchain-kit
sdqede Jun 26, 2025
34f16a8
fix interchain-kit issue in chain-admin
sdqede Jun 26, 2025
a29efb7
upgraded interchain-kit for hyperweb ui
sdqede Jun 26, 2025
f7d17a0
regenerate lock file
sdqede Jun 26, 2025
e6ff975
solved building issue of chain-admin
sdqede Jun 26, 2025
ad0fc7b
add lock file for templates
sdqede Jun 26, 2025
01ff89f
interchain-kit addChain async
sdqede Jun 30, 2025
c53b8a4
renew prettier config
sdqede Jun 30, 2025
ecfe06a
apply prettier to all modified files
sdqede Jun 30, 2025
5953ba3
fixed some bugs about reading attributes from undefined
sdqede Jun 30, 2025
639ca5c
use the same version of @interchainjs/cosmos and @interchainjs/react
sdqede Jun 30, 2025
bee56c3
removed as any inside createInstantiateContract
sdqede Jun 30, 2025
c65aa78
install packages and regenerate lock file
sdqede Jul 2, 2025
a02c2e8
upgrade interchainjs
sdqede Jul 2, 2025
c548008
fixed some path issue of new interchianjs in the chain-admin
sdqede Jul 2, 2025
2650084
fixed some issue related to building
sdqede Jul 2, 2025
e0843c8
keep using @chain-registry/v2 because @interchainjs/utils peer deppen…
sdqede Jul 2, 2025
a19dbee
fixed issue that asset list show no assets
sdqede Jul 2, 2025
8ec71c6
show icon of hyper token
sdqede Jul 2, 2025
063d99c
Add special handling for Hyperweb chain's native token throughout ass…
sdqede Jul 2, 2025
1b2a0dd
fixed some issue of building
sdqede Jul 2, 2025
5cabe45
fixed signer issue on contract deploying
sdqede Jul 3, 2025
4fa5e69
deploy contract success
sdqede Jul 8, 2025
b9c729f
execute contract success
sdqede Jul 14, 2025
132976e
contract query success
sdqede Jul 14, 2025
bc867db
fixed building issue
sdqede Jul 14, 2025
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@
"type": "git",
"url": "https://github.com/hyperweb-io/create-hyperweb-app"
},
"packageManager": "yarn@4.1.0"
"packageManager": "yarn@4.3.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const ConnectButton = () => {
const walletLogo =
typeof walletInfo?.logo === 'string'
? walletInfo.logo
: walletInfo.logo.major || walletInfo.logo.minor;
: walletInfo?.logo?.major || walletInfo?.logo?.minor;

return (
<>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useEffect, useMemo, useState } from 'react';
import { Box } from '@interchain-ui/react';
import { Asset } from '@chain-registry/v2-types';
import { Asset } from '@chain-registry/types';
import BigNumber from 'bignumber.js';
import { TbCurrencyDollarOff } from 'react-icons/tb';
import { LuListPlus } from 'react-icons/lu';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Dispatch, SetStateAction, useMemo } from 'react';
import { assetLists } from '@chain-registry/v2';
import { assetLists } from 'chain-registry';
import { LuPlus } from 'react-icons/lu';

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Dispatch, SetStateAction, useState } from 'react';
import { HiOutlineTrash } from 'react-icons/hi';
import { Asset } from '@chain-registry/v2-types';
import { Asset } from '@chain-registry/types';
import {
Avatar,
Box,
Expand Down Expand Up @@ -95,7 +95,7 @@ export const SelectAssetItem = ({
>
<PopoverTrigger>
<SelectButton
onClick={() => {}}
onClick={() => { }}
Copy link
Contributor

Choose a reason for hiding this comment

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

fix format

placeholder={selectedAssetWithAmount?.asset?.symbol ?? 'Select'}
_css={{ width: isMobile ? '100px' : '140px' }}
/>
Expand All @@ -108,9 +108,8 @@ export const SelectAssetItem = ({
py="10px"
bg="$background"
borderRadius="4px"
boxShadow={`0px 4px 20px 0px rgba(${
theme === 'light' ? '0,0,0' : '128,128,128'
}, 0.1)`}
boxShadow={`0px 4px 20px 0px rgba(${theme === 'light' ? '0,0,0' : '128,128,128'
Copy link
Contributor

Choose a reason for hiding this comment

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

fix format

}, 0.1)`}
maxHeight="220px"
overflowY="auto"
>
Expand Down
84 changes: 42 additions & 42 deletions templates/chain-admin/components/voting/Voting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function Voting({ chainName }: VotingProps) {
const { modal, open: openModal, close: closeModal, setTitle } = useModal('');
const [tallies, setTallies] = useState<{ [key: string]: TallyResult }>({});

const chain = chains.find((c) => c.chain_name === chainName);
const chain = chains.find((c) => c.chainName === chainName);

useEffect(() => {
if (!data.proposals || data.proposals.length === 0) return;
Expand Down Expand Up @@ -86,7 +86,7 @@ export function Voting({ chainName }: VotingProps) {
};
});
break;
} catch (e) {}
} catch (e) { }
Copy link
Contributor

Choose a reason for hiding this comment

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

fix format

}
})();
}
Expand Down Expand Up @@ -119,46 +119,46 @@ export function Voting({ chainName }: VotingProps) {
{data.proposals?.length === 0
? empty
: data.proposals?.map((proposal, index) => {
let tally = proposal.finalTallyResult;
if (
proposal.status === ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD
) {
tally = tallies[proposal.id.toString()];
}
return (
<Box
my="$8"
key={proposal.id?.toString() || index}
position="relative"
attributes={{ onClick: () => onClickProposal(index) }}
>
{data.votes[proposal.id.toString()] ? (
<Box
position="absolute"
px="$4"
py="$2"
top="$4"
right="$6"
borderRadius="$md"
backgroundColor="$green400"
>
<Text color="$white" fontSize="$xs" fontWeight="$bold">
Voted
</Text>
</Box>
) : null}
<GovernanceProposalItem
id={`# ${proposal.id?.toString()}`}
key={proposal.submitTime?.getTime()}
// @ts-ignore
title={proposal.content?.title || proposal.title || ''}
status={status(proposal.status)}
votes={votes(tally!)}
endTime={formatDate(proposal.votingEndTime)!}
/>
</Box>
);
})}
let tally = proposal.finalTallyResult;
Copy link
Contributor

Choose a reason for hiding this comment

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

fix format

if (
proposal.status === ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD
) {
tally = tallies[proposal.id.toString()];
}
return (
<Box
my="$8"
key={proposal.id?.toString() || index}
position="relative"
attributes={{ onClick: () => onClickProposal(index) }}
>
{data.votes[proposal.id.toString()] ? (
<Box
position="absolute"
px="$4"
py="$2"
top="$4"
right="$6"
borderRadius="$md"
backgroundColor="$green400"
>
<Text color="$white" fontSize="$xs" fontWeight="$bold">
Voted
</Text>
</Box>
) : null}
<GovernanceProposalItem
id={`# ${proposal.id?.toString()}`}
key={proposal.submitTime?.getTime()}
// @ts-ignore
title={proposal.content?.title || proposal.title || ''}
status={status(proposal.status)}
votes={votes(tally!)}
endTime={formatDate(proposal.votingEndTime)!}
/>
</Box>
);
})}
</Box>
);

Expand Down
2 changes: 1 addition & 1 deletion templates/chain-admin/hooks/asset-list/useAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export const useAssets = (chainName: string) => {
const dollarValue = calcCoinDollarValue(prices, { amount, denom });
return {
symbol,
logoUrl: asset.logo_URIs?.png || asset.logo_URIs?.svg,
logoUrl: asset.logoURIs?.png || asset.logoURIs?.svg,
prettyChainName: getPrettyChainName(denom),
displayAmount: convRawToDispAmount(denom, amount),
dollarValue,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ type CoinGeckoUSD = { usd: number };
type CoinGeckoUSDResponse = Record<CoinGeckoId, CoinGeckoUSD>;

const getAssetsWithGeckoIds = (assets: Asset[]) => {
return assets.filter((asset) => !!asset?.coingecko_id);
return assets.filter((asset) => !!asset?.coingeckoId);
};

const getGeckoIds = (assets: Asset[]) => {
return assets.map((asset) => asset.coingecko_id) as string[];
return assets.map((asset) => asset.coingeckoId) as string[];
};

const formatPrices = (
prices: CoinGeckoUSDResponse,
assets: Asset[]
): Record<string, number> => {
return Object.entries(prices).reduce((priceHash, cur) => {
const denom = assets.find((asset) => asset.coingecko_id === cur[0])!.base;
const denom = assets.find((asset) => asset.coingeckoId === cur[0])!.base;
return { ...priceHash, [denom]: cur[1].usd };
}, {});
};
Expand Down
28 changes: 14 additions & 14 deletions templates/chain-admin/hooks/asset-list/useChainUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useMemo } from 'react';
import { useWalletManager } from '@interchain-kit/react';
import { Asset, AssetList } from '@chain-registry/types';
import { asset_lists as ibcAssetLists } from '@chain-registry/assets';
import { assets as chainAssets, ibc } from 'chain-registry';
import { assetLists as chainAssets, ibcData as ibc } from 'chain-registry';
import { Coin } from '@interchainjs/react/types';
import BigNumber from 'bignumber.js';

Expand All @@ -18,14 +18,14 @@ export const useChainUtils = (chainName: string) => {
starshipData?.v1 ?? {};

const isStarshipChain = starshipChains.some(
(chain) => chain.chain_name === chainName
(chain) => chain.chainName === chainName
);

const filterAssets = (assetList: AssetList[]): Asset[] => {
return (
assetList
.find(({ chain_name }) => chain_name === chainName)
?.assets?.filter(({ type_asset }) => type_asset !== 'ics20') || []
.find(({ chainName }) => chainName === chainName)
?.assets?.filter(({ typeAsset }) => typeAsset !== 'ics20') || []
);
};

Expand Down Expand Up @@ -66,7 +66,7 @@ export const useChainUtils = (chainName: string) => {
(asset) =>
asset.symbol === symbol &&
(!chainName ||
asset.traces?.[0].counterparty.chain_name.toLowerCase() ===
asset.traces?.[0].counterparty.chainName.toLowerCase() ===
chainName.toLowerCase())
);
const base = asset?.base;
Expand All @@ -78,7 +78,7 @@ export const useChainUtils = (chainName: string) => {

const getExponentByDenom = (denom: CoinDenom): Exponent => {
const asset = getAssetByDenom(denom);
const unit = asset.denom_units.find(({ denom }) => denom === asset.display);
const unit = asset.denomUnits.find(({ denom }) => denom === asset.display);
return unit?.exponent || 0;
};

Expand All @@ -102,7 +102,7 @@ export const useChainUtils = (chainName: string) => {
return chainName;
}
const asset = ibcAssets.find((asset) => asset.base === ibcDenom);
const ibcChainName = asset?.traces?.[0].counterparty.chain_name;
const ibcChainName = asset?.traces?.[0].counterparty.chainName;
if (!ibcChainName)
throw Error('chainName not found for ibcDenom: ' + ibcDenom);
return ibcChainName;
Expand Down Expand Up @@ -140,15 +140,15 @@ export const useChainUtils = (chainName: string) => {

let ibcInfo = ibc.find(
(i) =>
i.chain_1.chain_name === fromChainName &&
i.chain_2.chain_name === toChainName
i.chain1.chainName === fromChainName &&
i.chain2.chainName === toChainName
);

if (!ibcInfo) {
ibcInfo = ibc.find(
(i) =>
i.chain_1.chain_name === toChainName &&
i.chain_2.chain_name === fromChainName
i.chain1.chainName === toChainName &&
i.chain2.chainName === fromChainName
);
flipped = true;
}
Expand All @@ -157,9 +157,9 @@ export const useChainUtils = (chainName: string) => {
throw new Error('cannot find IBC info');
}

const key = flipped ? 'chain_2' : 'chain_1';
const sourcePort = ibcInfo.channels[0][key].port_id;
const sourceChannel = ibcInfo.channels[0][key].channel_id;
const key = flipped ? 'chain2' : 'chain1';
const sourcePort = ibcInfo.channels[0][key].portId;
const sourceChannel = ibcInfo.channels[0][key].channelId;

return { sourcePort, sourceChannel };
};
Expand Down
5 changes: 3 additions & 2 deletions templates/chain-admin/hooks/common/useStarshipChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AssetList, Chain } from '@chain-registry/types';
import {
Chain as ChainV2,
AssetList as AssetListV2,
} from '@chain-registry/v2-types';
} from '@chain-registry/types';

import { StarshipConfig } from '@/starship';
import { convertKeysToCamelCase } from '@/utils';
Expand Down Expand Up @@ -33,7 +33,8 @@ export const useStarshipChains = () => {

const assets = (await Promise.all(
chains.map((chain) =>
fetcher<AssetList>(`${baseUrl}/chains/${chain.chain_id}/assets`)
// @ts-ignore
fetcher<AssetList>(`${baseUrl}/chains/${chain.chain_id}/assets`) // if use chainId, got error: Cannot read properties of undefined (reading 'chainName') at const { connect, disconnect, address, wallet } = useChain(selectedChain)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove or simplify comments

)
).then((assetLists) => assetLists.filter(Boolean))) as AssetList[];

Expand Down
8 changes: 4 additions & 4 deletions templates/chain-admin/hooks/staking/useAssetsPrices.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { assets } from 'chain-registry';
import { assetLists as assets } from 'chain-registry';
import { useQuery } from '@tanstack/react-query';
import { AssetList } from '@chain-registry/types';
import { useChainStore } from '@/contexts';
Expand All @@ -17,7 +17,7 @@ const handleError = (resp: Response) => {

const getGeckoIdsFromAssets = (assets: AssetList[]) => {
return assets
.map((asset) => asset.assets[0].coingecko_id)
.map((asset) => asset.assets[0].coingeckoId)
.filter(Boolean) as string[];
};

Expand All @@ -27,7 +27,7 @@ const formatPrices = (
): Prices => {
return Object.entries(prices).reduce((priceHash, cur) => {
const assetList = assets.find(
(asset) => asset.assets[0].coingecko_id === cur[0]
(asset) => asset.assets[0].coingeckoId === cur[0]
)!;
const denom = assetList.assets[0].base;
return { ...priceHash, [denom]: cur[1].usd };
Expand All @@ -53,7 +53,7 @@ export const useAssetsPrices = () => {
starshipData?.v1 ?? {};

const isStarshipChain = starshipChains.some(
(chain) => chain.chain_name === selectedChain
(chain) => chain.chainName === selectedChain
);

return useQuery({
Expand Down
2 changes: 1 addition & 1 deletion templates/chain-admin/hooks/voting/useVotingData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function useVotingData(chainName: string) {
const { data: rpcEndpoint, isFetching } = useRpcEndpoint(chainName);

const getVote = createGetVote(rpcEndpoint);
const chain = chains.find((c) => c.chain_name === chainName);
const chain = chains.find((c) => c.chainName === chainName);
const isReady = !!address && !!rpcEndpoint;

const proposalsQuery = useGetProposals({
Expand Down
14 changes: 7 additions & 7 deletions templates/chain-admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
"resolutions": {
"react": "18.2.0",
"react-dom": "18.2.0",
"@types/react": "18.0.25",
"@types/react-dom": "18.0.9"
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0"
},
"dependencies": {
"@chain-registry/assets": "1.63.5",
"@chain-registry/assets": "1.70.240",
"@interchain-kit/core": "^0.2.1",
"@interchain-kit/keplr-extension": "^0.2.1",
"@interchain-kit/leap-extension": "^0.2.1",
Expand All @@ -31,7 +31,7 @@
"@tanstack/react-query": "4.32.0",
"ace-builds": "1.35.0",
"bignumber.js": "9.1.2",
"chain-registry": "1.62.3",
"chain-registry": "2.0.9",
"dayjs": "1.11.11",
"hyperwebjs": "^0.0.5",
"interchain-kit": "^0.2.1",
Expand All @@ -46,13 +46,13 @@
"zustand": "4.5.2"
},
"devDependencies": {
"@chain-registry/types": "0.44.3",
"@chain-registry/types": "2.0.9",
"@starship-ci/cli": "^2.10.2",
"@tanstack/react-query-devtools": "4.32.0",
"@types/node": "18.11.9",
"@types/node-gzip": "^1",
"@types/react": "18.0.25",
"@types/react-dom": "18.0.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"eslint": "8.28.0",
"eslint-config-next": "13.0.5",
"generate-lockfile": "0.0.12",
Expand Down
2 changes: 1 addition & 1 deletion templates/chain-admin/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import '@interchain-ui/react/styles';

import type { AppProps } from 'next/app';
import { ChainProvider } from '@interchain-kit/react';
import { chains, assetLists } from '@chain-registry/v2';
import { chains, assetLists } from 'chain-registry';
import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
import { Box, Toaster, useTheme } from '@interchain-ui/react';
// import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
Expand Down
Loading
Loading