diff --git a/package-lock.json b/package-lock.json index 7f785f4..3dcaf60 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "@types/react": "18.0.31", "@types/react-dom": "18.0.11", "bech32": "^2.0.0", - "cosmjs-types": "^0.7.2", + "cosmjs-types": "^0.9.0", "dayjs": "^1.11.7", "eslint": "8.37.0", "eslint-config-next": "13.2.4", @@ -1444,6 +1444,15 @@ "long": "^4.0.0" } }, + "node_modules/@cosmjs/proto-signing/node_modules/cosmjs-types": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.7.2.tgz", + "integrity": "sha512-vf2uLyktjr/XVAgEq0DjMxeAWh1yYREe7AMHDKd7EiHVqxBPCaBS+qEEQUkXbR9ndnckqr1sUG8BQhazh4X5lA==", + "dependencies": { + "long": "^4.0.0", + "protobufjs": "~6.11.2" + } + }, "node_modules/@cosmjs/socket": { "version": "0.30.1", "resolved": "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.30.1.tgz", @@ -1474,6 +1483,15 @@ "xstream": "^11.14.0" } }, + "node_modules/@cosmjs/stargate/node_modules/cosmjs-types": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.7.2.tgz", + "integrity": "sha512-vf2uLyktjr/XVAgEq0DjMxeAWh1yYREe7AMHDKd7EiHVqxBPCaBS+qEEQUkXbR9ndnckqr1sUG8BQhazh4X5lA==", + "dependencies": { + "long": "^4.0.0", + "protobufjs": "~6.11.2" + } + }, "node_modules/@cosmjs/stream": { "version": "0.30.1", "resolved": "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.30.1.tgz", @@ -2830,13 +2848,9 @@ } }, "node_modules/cosmjs-types": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.7.2.tgz", - "integrity": "sha512-vf2uLyktjr/XVAgEq0DjMxeAWh1yYREe7AMHDKd7EiHVqxBPCaBS+qEEQUkXbR9ndnckqr1sUG8BQhazh4X5lA==", - "dependencies": { - "long": "^4.0.0", - "protobufjs": "~6.11.2" - } + "version": "0.9.0", + "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.9.0.tgz", + "integrity": "sha512-MN/yUe6mkJwHnCFfsNPeCfXVhyxHYW6c/xDUzrSbBycYzw++XvWDMJArXp2pLdgD6FQ8DW79vkPjeNKVrXaHeQ==" }, "node_modules/cross-spawn": { "version": "7.0.3", diff --git a/package.json b/package.json index bc4a04c..9cc5f78 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@types/react": "18.0.31", "@types/react-dom": "18.0.11", "bech32": "^2.0.0", - "cosmjs-types": "^0.7.2", + "cosmjs-types": "^0.9.0", "dayjs": "^1.11.7", "eslint": "8.37.0", "eslint-config-next": "13.2.4", diff --git a/src/components/Parameters/GovParameters.tsx b/src/components/Parameters/GovParameters.tsx index 8e084f3..4a333ad 100644 --- a/src/components/Parameters/GovParameters.tsx +++ b/src/components/Parameters/GovParameters.tsx @@ -52,14 +52,14 @@ export default function GovParameters() { queryGovParams(tmClient, GOV_PARAMS_TYPE.TALLY), ]) .then((responses) => { - if (responses[0].votingParams) { - dispatch(setGovVotingParams(responses[0].votingParams)) + if (responses[0].params) { + dispatch(setGovVotingParams(responses[0].params)) } - if (responses[1].depositParams) { - dispatch(setGovDepositParams(responses[1].depositParams)) + if (responses[1].params) { + dispatch(setGovDepositParams(responses[1].params)) } - if (responses[2].tallyParams) { - dispatch(setGovTallyParams(responses[2].tallyParams)) + if (responses[2].params) { + dispatch(setGovTallyParams(responses[2].params)) } setIsLoaded(true) }) @@ -118,7 +118,7 @@ export default function GovParameters() { {displayDurationSeconds( - depositParams?.maxDepositPeriod?.seconds.low + Number(depositParams?.maxDepositPeriod?.seconds) )} @@ -129,7 +129,9 @@ export default function GovParameters() { Voting Period - {displayDurationSeconds(votingParams?.votingPeriod?.seconds.low)} + {displayDurationSeconds( + Number(votingParams?.votingPeriod?.seconds) + )} @@ -139,9 +141,7 @@ export default function GovParameters() { Quorum - {convertRateToPercent( - fromUtf8(tallyParams?.quorum ?? new Uint8Array()) - )} + {convertRateToPercent(tallyParams?.quorum)} @@ -151,9 +151,7 @@ export default function GovParameters() { Threshold - {convertRateToPercent( - fromUtf8(tallyParams?.threshold ?? new Uint8Array()) - )} + {convertRateToPercent(tallyParams?.threshold)} @@ -163,9 +161,7 @@ export default function GovParameters() { Veto Threshold - {convertRateToPercent( - fromUtf8(tallyParams?.vetoThreshold ?? new Uint8Array()) - )} + {convertRateToPercent(tallyParams?.vetoThreshold)} diff --git a/src/components/Parameters/MintParameters.tsx b/src/components/Parameters/MintParameters.tsx index 27083d6..718ecd6 100644 --- a/src/components/Parameters/MintParameters.tsx +++ b/src/components/Parameters/MintParameters.tsx @@ -74,7 +74,7 @@ export default function MintParameters() { Blocks per Year - {params?.blocksPerYear.low.toLocaleString() ?? ''} + {params?.blocksPerYear ? Number(params?.blocksPerYear) : ''} diff --git a/src/components/Parameters/SlashingParameters.tsx b/src/components/Parameters/SlashingParameters.tsx index 5f1d1d7..b4efbe2 100644 --- a/src/components/Parameters/SlashingParameters.tsx +++ b/src/components/Parameters/SlashingParameters.tsx @@ -75,7 +75,9 @@ export default function SlashingParameters() { Signed Blocks Window - {params?.signedBlocksWindow.low.toLocaleString() ?? ''} + {params?.signedBlocksWindow + ? Number(params?.signedBlocksWindow) + : ''} @@ -98,7 +100,7 @@ export default function SlashingParameters() { {displayDurationSeconds( - params?.downtimeJailDuration?.seconds.low + Number(params?.downtimeJailDuration?.seconds) )} diff --git a/src/components/Parameters/StakingParameters.tsx b/src/components/Parameters/StakingParameters.tsx index 79e9bde..6b837c4 100644 --- a/src/components/Parameters/StakingParameters.tsx +++ b/src/components/Parameters/StakingParameters.tsx @@ -74,7 +74,7 @@ export default function StakingParameters() { Unbonding Time - {displayDurationSeconds(params?.unbondingTime?.seconds?.low)} + {displayDurationSeconds(Number(params?.unbondingTime?.seconds))} diff --git a/src/pages/proposals/index.tsx b/src/pages/proposals/index.tsx index 47c8c4e..038cb36 100644 --- a/src/pages/proposals/index.tsx +++ b/src/pages/proposals/index.tsx @@ -22,10 +22,9 @@ import DataTable from '@/components/Datatable' import { createColumnHelper } from '@tanstack/react-table' import { getTypeMsg, displayDate } from '@/utils/helper' import { proposalStatus, proposalStatusList } from '@/utils/constant' -import { decodeContentProposal } from '@/encoding' type Proposal = { - id: number + id: bigint title: string types: string status: proposalStatus | undefined @@ -77,19 +76,19 @@ export default function Proposals() { setIsLoading(true) queryProposals(tmClient, page, perPage) .then((response) => { - setTotal(response.pagination?.total.low ?? 0) + setTotal(Number(response.pagination?.total)) const proposalsList: Proposal[] = response.proposals.map((val) => { const votingEnd = val.votingEndTime?.nanos - ? new Date(val.votingEndTime?.seconds.low * 1000).toISOString() + ? new Date( + Number(val.votingEndTime?.seconds) * 1000 + ).toISOString() : null - const content = decodeContentProposal( - val.content?.typeUrl ?? '', - val.content?.value ?? new Uint8Array() - ) return { - id: val.proposalId.low, - title: content.data?.title ?? '', - types: getTypeMsg(val.content?.typeUrl ?? ''), + id: val.id, + title: val.title, + types: getTypeMsg( + val.messages.length ? val.messages[0].typeUrl : '' + ), status: proposalStatusList.find( (item) => item.id === Number(val.status.toString()) ), @@ -99,9 +98,10 @@ export default function Proposals() { setProposals(proposalsList) setIsLoading(false) }) - .catch(() => { + .catch((err) => { + console.error(err) toast({ - title: 'Failed to fetch datatable', + title: 'Failed to fetch proposals', description: '', status: 'error', duration: 5000, diff --git a/src/pages/validators/index.tsx b/src/pages/validators/index.tsx index 069cdf8..74368a8 100644 --- a/src/pages/validators/index.tsx +++ b/src/pages/validators/index.tsx @@ -68,7 +68,7 @@ export default function Validators() { setIsLoading(true) queryActiveValidators(tmClient, page, perPage) .then((response) => { - setTotal(response.pagination?.total.low ?? 0) + setTotal(Number(response.pagination?.total)) const validatorData: ValidatorData[] = response.validators.map( (val) => { return { diff --git a/src/rpc/abci/index.ts b/src/rpc/abci/index.ts index baf37de..e52c7fc 100644 --- a/src/rpc/abci/index.ts +++ b/src/rpc/abci/index.ts @@ -16,7 +16,7 @@ import { QueryProposalsResponse, QueryParamsRequest as QueryGovParamsRequest, QueryParamsResponse as QueryGovParamsResponse, -} from 'cosmjs-types/cosmos/gov/v1beta1/query' +} from 'cosmjs-types/cosmos/gov/v1/query' import { QueryParamsRequest as QueryDistributionParamsRequest, QueryParamsResponse as QueryDistributionParamsResponse, @@ -63,7 +63,7 @@ export async function queryProposals( }) const req = QueryProposalsRequest.encode(proposalsRequest).finish() const { value } = await queryClient.queryAbci( - '/cosmos.gov.v1beta1.Query/Proposals', + '/cosmos.gov.v1.Query/Proposals', req ) return QueryProposalsResponse.decode(value) @@ -102,7 +102,7 @@ export async function queryGovParams( paramsType: paramsType, }).finish() const { value } = await queryClient.queryAbci( - '/cosmos.gov.v1beta1.Query/Params', + '/cosmos.gov.v1.Query/Params', req ) return QueryGovParamsResponse.decode(value) diff --git a/src/store/paramsSlice.ts b/src/store/paramsSlice.ts index 52708ba..73e5d13 100644 --- a/src/store/paramsSlice.ts +++ b/src/store/paramsSlice.ts @@ -9,7 +9,7 @@ import { VotingParams, DepositParams, TallyParams, -} from 'cosmjs-types/cosmos/gov/v1beta1/gov' +} from 'cosmjs-types/cosmos/gov/v1/gov' // Type for our state export interface ParamsState {