From 4d616fd8b0512e81373b3aa262d6f1eb11d21620 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Mon, 18 Dec 2023 16:45:02 +0700 Subject: [PATCH 01/16] feat: minitias devnet --- src/config/chain/initia.ts | 99 ++++++++++++++++++++++++++++++- src/lib/services/block.ts | 2 +- src/lib/services/code.ts | 2 +- src/lib/services/contract.ts | 2 +- src/lib/services/move/module.ts | 4 +- src/lib/services/move/resource.ts | 2 +- src/lib/services/proposal.ts | 2 +- src/lib/services/tx.ts | 4 +- 8 files changed, 107 insertions(+), 10 deletions(-) diff --git a/src/config/chain/initia.ts b/src/config/chain/initia.ts index 520cdbc6c..997eb0285 100644 --- a/src/config/chain/initia.ts +++ b/src/config/chain/initia.ts @@ -2,6 +2,9 @@ import { wallets as keplrWallets } from "@cosmos-kit/keplr"; import type { ChainConfigs } from "./types"; +const INITIA_DECODER = + "https://initia-api-jiod42ec2q-as.a.run.app/decode_module"; + export const INITIA_CHAIN_CONFIGS: ChainConfigs = { "mahalo-1": { chain: "initia", @@ -22,7 +25,7 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { move: { enabled: true, moduleMaxFileSize: 1_048_576, - decodeApi: "https://initia-api-jiod42ec2q-as.a.run.app/decode_module", + decodeApi: INITIA_DECODER, }, pool: { enabled: false, @@ -52,6 +55,100 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { }, extra: {}, }, + "minimove-1": { + chain: "initia", + registryChainName: "minitiamovedevnet1", + prettyName: "Minitia Move Devnet 1", + lcd: "https://lcd.minimove-1.initia.xyz", + rpc: "https://rpc.minimove-1.initia.xyz", + indexer: "https://minimove-1-graphql.alleslabs.dev/v1/graphql", + wallets: [...keplrWallets], + features: { + faucet: { + enabled: false, + }, + wasm: { + enabled: false, + }, + move: { + enabled: true, + moduleMaxFileSize: 1_048_576, + decodeApi: INITIA_DECODER, + }, + pool: { + enabled: false, + }, + publicProject: { + enabled: true, + }, + gov: { + enabled: false, + }, + nft: { + enabled: true, + }, + }, + gas: { + gasPrice: { + tokenPerGas: 0.151, + denom: "umin", + }, + gasAdjustment: 1.5, + maxGasLimit: 25_000_000, + }, + explorerLink: { + validator: "", + proposal: "", + }, + extra: {}, + }, + "miniwasm-1": { + chain: "initia", + registryChainName: "minitiawasmdevnet1", + prettyName: "Minitia Wasm Devnet 1", + lcd: "https://lcd.miniwasm-1.initia.xyz", + rpc: "https://rpc.miniwasm-1.initia.xyz", + indexer: "https://miniwasm-1-graphql.alleslabs.dev/v1/graphql", + wallets: [...keplrWallets], + features: { + faucet: { + enabled: false, + }, + wasm: { + enabled: true, + storeCodeMaxFileSize: 800_000, + clearAdminGas: 50_000, + }, + move: { + enabled: false, + }, + pool: { + enabled: false, + }, + publicProject: { + enabled: true, + }, + gov: { + enabled: false, + }, + nft: { + enabled: true, + }, + }, + gas: { + gasPrice: { + tokenPerGas: 0.151, + denom: "umin", + }, + gasAdjustment: 1.5, + maxGasLimit: 25_000_000, + }, + explorerLink: { + validator: "", + proposal: "", + }, + extra: {}, + }, "stone-12-1": { chain: "initia", registryChainName: "initiatestnet12-1", diff --git a/src/lib/services/block.ts b/src/lib/services/block.ts index 7047a7159..cb27380d9 100644 --- a/src/lib/services/block.ts +++ b/src/lib/services/block.ts @@ -36,7 +36,7 @@ const zBlocksResponseItem = z const zBlocksResponse = z.object({ items: z.array(zBlocksResponseItem), - total: z.number(), + total: z.number().nonnegative(), }); export type BlocksResponse = z.infer; diff --git a/src/lib/services/code.ts b/src/lib/services/code.ts index 653992d9c..248837306 100644 --- a/src/lib/services/code.ts +++ b/src/lib/services/code.ts @@ -54,7 +54,7 @@ const zCodesResponseItem = z const zCodesResponse = z.object({ items: z.array(zCodesResponseItem), - total: z.number(), + total: z.number().nonnegative(), }); export type CodesResponse = z.infer; diff --git a/src/lib/services/contract.ts b/src/lib/services/contract.ts index f5e1b32cc..64290963f 100644 --- a/src/lib/services/contract.ts +++ b/src/lib/services/contract.ts @@ -129,7 +129,7 @@ const zContractsResponseItem = z const zContractsResponse = z.object({ items: z.array(zContractsResponseItem), - total: z.number(), + total: z.number().nonnegative(), }); export type ContractsResponse = z.infer; diff --git a/src/lib/services/move/module.ts b/src/lib/services/move/module.ts index 9df0fba14..839dde26e 100644 --- a/src/lib/services/move/module.ts +++ b/src/lib/services/move/module.ts @@ -40,7 +40,7 @@ const zAccountModulesResponseItem = z const zAccountModulesResponse = z.object({ items: z.array(zAccountModulesResponseItem), - total: z.number(), + total: z.number().nonnegative(), }); type AccountModulesResponse = z.infer; @@ -182,7 +182,7 @@ const zModulesResponseItem = z const zModulesResponse = z.object({ items: z.array(zModulesResponseItem), - total: z.number(), + total: z.number().nonnegative(), }); export type ModulesResponse = z.infer; diff --git a/src/lib/services/move/resource.ts b/src/lib/services/move/resource.ts index 40af582ab..8d5e322f9 100644 --- a/src/lib/services/move/resource.ts +++ b/src/lib/services/move/resource.ts @@ -19,7 +19,7 @@ const zResourcesResponseItem = z const zResourcesResponse = z.object({ items: z.array(zResourcesResponseItem), - total: z.number(), + total: z.number().nonnegative(), }); export type ResourceResponse = z.infer; diff --git a/src/lib/services/proposal.ts b/src/lib/services/proposal.ts index 8dfcdd1b0..b8395f06c 100644 --- a/src/lib/services/proposal.ts +++ b/src/lib/services/proposal.ts @@ -90,7 +90,7 @@ const zProposalsResponseItem = z const zProposalResponse = z.object({ items: z.array(zProposalsResponseItem), - total: z.number(), + total: z.number().nonnegative(), }); export type ProposalResponse = z.infer; diff --git a/src/lib/services/tx.ts b/src/lib/services/tx.ts index 949c7defb..ab4af4f96 100644 --- a/src/lib/services/tx.ts +++ b/src/lib/services/tx.ts @@ -157,7 +157,7 @@ const zTxsResponseItem = zBaseTxsResponseItem.transform((val) => ({ const zTxsResponse = z.object({ items: z.array(zTxsResponseItem), - total: z.number(), + total: z.number().nonnegative(), }); export type TxsResponse = z.infer; @@ -264,7 +264,7 @@ export const getTxsByAddress = async ( const zBlockTxsResponse = z.object({ items: z.array(zTxsResponseItem), - total: z.number().positive(), + total: z.number().nonnegative(), }); export type BlockTxsResponse = z.infer; From f2b813f043fc739842dfba15e67acdf2aef1c8b5 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Mon, 18 Dec 2023 16:46:22 +0700 Subject: [PATCH 02/16] fix: changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55c37c072..0423ce6dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Features +- [#677](https://github.com/alleslabs/celatone-frontend/pull/677) Add minimove-1 and miniwasm-1 - [#671](https://github.com/alleslabs/celatone-frontend/pull/671) Add mahalo-1 - [#652](https://github.com/alleslabs/celatone-frontend/pull/652) Add amp publish module and deploy script - [#648](https://github.com/alleslabs/celatone-frontend/pull/648) Support OPInit transaction in initia From 50aecfef54e929205c9b8a6736d52de0434fe703 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Mon, 18 Dec 2023 16:57:22 +0700 Subject: [PATCH 03/16] fix: minitia chain registry --- src/config/chain/initia.ts | 2 +- src/lib/chain-registry/initiatestnet.ts | 93 +++++++++++++++++++++++-- 2 files changed, 90 insertions(+), 5 deletions(-) diff --git a/src/config/chain/initia.ts b/src/config/chain/initia.ts index 997eb0285..2e903a8f7 100644 --- a/src/config/chain/initia.ts +++ b/src/config/chain/initia.ts @@ -168,7 +168,7 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { move: { enabled: true, moduleMaxFileSize: 1_048_576, - decodeApi: "https://initia-api-jiod42ec2q-as.a.run.app/decode_module", + decodeApi: INITIA_DECODER, }, pool: { enabled: false, diff --git a/src/lib/chain-registry/initiatestnet.ts b/src/lib/chain-registry/initiatestnet.ts index 18299127e..dbc8dac69 100644 --- a/src/lib/chain-registry/initiatestnet.ts +++ b/src/lib/chain-registry/initiatestnet.ts @@ -1,8 +1,11 @@ import type { AssetList, Chain } from "@chain-registry/types"; +const CHAIN_SCHEMA = "../chain.schema.json"; +const NODE_HOME = "$HOME/.init"; + export const initiatestnet: Chain[] = [ { - $schema: "../chain.schema.json", + $schema: CHAIN_SCHEMA, chain_name: "initiadevnet1", status: "live", network_type: "devnet", @@ -10,7 +13,7 @@ export const initiatestnet: Chain[] = [ chain_id: "mahalo-1", bech32_prefix: "init", daemon_name: "initiad", - node_home: "$HOME/.init", + node_home: NODE_HOME, key_algos: ["secp256k1"], slip44: 118, fees: { @@ -49,7 +52,89 @@ export const initiatestnet: Chain[] = [ }, }, { - $schema: "../chain.schema.json", + $schema: CHAIN_SCHEMA, + chain_name: "minitiamovedevnet1", + status: "live", + network_type: "devnet", + pretty_name: "Minitia Move Devnet 1", + chain_id: "minimove-1", + bech32_prefix: "init", + daemon_name: "initiad", + node_home: NODE_HOME, + key_algos: ["secp256k1"], + slip44: 118, + fees: { + fee_tokens: [ + { + denom: "umin", + fixed_min_gas_price: 0, + low_gas_price: 0.151, + average_gas_price: 0.151, + high_gas_price: 0.151, + }, + ], + }, + staking: undefined, + logo_URIs: { + png: "", + svg: "", + }, + apis: { + rpc: [ + { + address: "https://rpc.minimove-1.initia.xyz:443", + }, + ], + rest: [ + { + address: "https://lcd.minimove-1.initia.xyz", + }, + ], + }, + }, + { + $schema: CHAIN_SCHEMA, + chain_name: "minitiawasmdevnet1", + status: "live", + network_type: "devnet", + pretty_name: "Minitia Wasm Devnet 1", + chain_id: "miniwasm-1", + bech32_prefix: "init", + daemon_name: "initiad", + node_home: NODE_HOME, + key_algos: ["secp256k1"], + slip44: 118, + fees: { + fee_tokens: [ + { + denom: "umin", + fixed_min_gas_price: 0, + low_gas_price: 0.151, + average_gas_price: 0.151, + high_gas_price: 0.151, + }, + ], + }, + staking: undefined, + logo_URIs: { + png: "", + svg: "", + }, + apis: { + rpc: [ + { + address: "https://rpc.mahalo-1.initia.xyz:443", + }, + ], + rest: [ + { + address: "https://lcd.mahalo-1.initia.xyz", + }, + ], + }, + }, + { + $schema: CHAIN_SCHEMA, chain_name: "initiatestnet12-1", status: "live", network_type: "testnet", @@ -57,7 +142,7 @@ export const initiatestnet: Chain[] = [ chain_id: "stone-12-1", bech32_prefix: "init", daemon_name: "initiad", - node_home: "$HOME/.init", + node_home: NODE_HOME, key_algos: ["secp256k1"], slip44: 118, fees: { From f20c905ddfac01d1affb6a801f072a67615b6a82 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Tue, 19 Dec 2023 10:50:31 +0700 Subject: [PATCH 04/16] fix: move pool info --- src/config/chain/initia.ts | 7 +++++-- src/config/chain/types.ts | 7 ++++++- src/lib/services/move/poolService.ts | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/config/chain/initia.ts b/src/config/chain/initia.ts index 2e903a8f7..a1c5d491d 100644 --- a/src/config/chain/initia.ts +++ b/src/config/chain/initia.ts @@ -24,6 +24,7 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { }, move: { enabled: true, + hasPools: true, moduleMaxFileSize: 1_048_576, decodeApi: INITIA_DECODER, }, @@ -72,6 +73,7 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { }, move: { enabled: true, + hasPools: false, moduleMaxFileSize: 1_048_576, decodeApi: INITIA_DECODER, }, @@ -100,7 +102,7 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { validator: "", proposal: "", }, - extra: {}, + extra: { disableDelegation: true }, }, "miniwasm-1": { chain: "initia", @@ -147,7 +149,7 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { validator: "", proposal: "", }, - extra: {}, + extra: { disableDelegation: true }, }, "stone-12-1": { chain: "initia", @@ -167,6 +169,7 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { }, move: { enabled: true, + hasPools: true, moduleMaxFileSize: 1_048_576, decodeApi: INITIA_DECODER, }, diff --git a/src/config/chain/types.ts b/src/config/chain/types.ts index 5f92ae655..c72e8d53a 100644 --- a/src/config/chain/types.ts +++ b/src/config/chain/types.ts @@ -18,7 +18,12 @@ type WasmConfig = }; type MoveConfig = - | { enabled: true; moduleMaxFileSize: number; decodeApi: string } + | { + enabled: true; + hasPools: boolean; + moduleMaxFileSize: number; + decodeApi: string; + } | { enabled: false }; type PoolConfig = diff --git a/src/lib/services/move/poolService.ts b/src/lib/services/move/poolService.ts index b8c9834fd..8c19943bb 100644 --- a/src/lib/services/move/poolService.ts +++ b/src/lib/services/move/poolService.ts @@ -54,7 +54,7 @@ export const useMovePoolInfos = () => { [CELATONE_QUERY_KEYS.MOVE_POOL_INFOS, moveEndpoint], async () => getMovePoolInfos(moveEndpoint), { - enabled: moveConfig.enabled, + enabled: moveConfig.enabled && moveConfig.hasPools, refetchOnWindowFocus: false, } ); From 5e6667b499ce7c32d2685e8cf7fb6535c7a38824 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Tue, 19 Dec 2023 11:30:13 +0700 Subject: [PATCH 05/16] fix: endpoint --- src/config/chain/initia.ts | 7 ++----- src/config/chain/types.ts | 1 - src/lib/chain-registry/initiatestnet.ts | 4 ++-- src/lib/services/move/poolService.ts | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/config/chain/initia.ts b/src/config/chain/initia.ts index a1c5d491d..19ee55913 100644 --- a/src/config/chain/initia.ts +++ b/src/config/chain/initia.ts @@ -24,7 +24,6 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { }, move: { enabled: true, - hasPools: true, moduleMaxFileSize: 1_048_576, decodeApi: INITIA_DECODER, }, @@ -61,7 +60,7 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { registryChainName: "minitiamovedevnet1", prettyName: "Minitia Move Devnet 1", lcd: "https://lcd.minimove-1.initia.xyz", - rpc: "https://rpc.minimove-1.initia.xyz", + rpc: "https://rpc.minimove-1.initia.xyz:443", indexer: "https://minimove-1-graphql.alleslabs.dev/v1/graphql", wallets: [...keplrWallets], features: { @@ -73,7 +72,6 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { }, move: { enabled: true, - hasPools: false, moduleMaxFileSize: 1_048_576, decodeApi: INITIA_DECODER, }, @@ -109,7 +107,7 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { registryChainName: "minitiawasmdevnet1", prettyName: "Minitia Wasm Devnet 1", lcd: "https://lcd.miniwasm-1.initia.xyz", - rpc: "https://rpc.miniwasm-1.initia.xyz", + rpc: "https://rpc.miniwasm-1.initia.xyz:443", indexer: "https://miniwasm-1-graphql.alleslabs.dev/v1/graphql", wallets: [...keplrWallets], features: { @@ -169,7 +167,6 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { }, move: { enabled: true, - hasPools: true, moduleMaxFileSize: 1_048_576, decodeApi: INITIA_DECODER, }, diff --git a/src/config/chain/types.ts b/src/config/chain/types.ts index c72e8d53a..aecafcb09 100644 --- a/src/config/chain/types.ts +++ b/src/config/chain/types.ts @@ -20,7 +20,6 @@ type WasmConfig = type MoveConfig = | { enabled: true; - hasPools: boolean; moduleMaxFileSize: number; decodeApi: string; } diff --git a/src/lib/chain-registry/initiatestnet.ts b/src/lib/chain-registry/initiatestnet.ts index ad93ccfe4..74c8421de 100644 --- a/src/lib/chain-registry/initiatestnet.ts +++ b/src/lib/chain-registry/initiatestnet.ts @@ -123,12 +123,12 @@ export const initiatestnet: Chain[] = [ apis: { rpc: [ { - address: "https://rpc.mahalo-1.initia.xyz:443", + address: "https://rpc.miniwasm-1.initia.xyz:443", }, ], rest: [ { - address: "https://lcd.mahalo-1.initia.xyz", + address: "https://lcd.miniwasm-1.initia.xyz", }, ], }, diff --git a/src/lib/services/move/poolService.ts b/src/lib/services/move/poolService.ts index 8c19943bb..b8c9834fd 100644 --- a/src/lib/services/move/poolService.ts +++ b/src/lib/services/move/poolService.ts @@ -54,7 +54,7 @@ export const useMovePoolInfos = () => { [CELATONE_QUERY_KEYS.MOVE_POOL_INFOS, moveEndpoint], async () => getMovePoolInfos(moveEndpoint), { - enabled: moveConfig.enabled && moveConfig.hasPools, + enabled: moveConfig.enabled, refetchOnWindowFocus: false, } ); From 4c226449026d4173fc575881295def6bd1e1b012 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Tue, 19 Dec 2023 13:35:50 +0700 Subject: [PATCH 06/16] fix: selected resources --- .../components/resources/ResourceLeftPanel.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/pages/account-details/components/resources/ResourceLeftPanel.tsx b/src/lib/pages/account-details/components/resources/ResourceLeftPanel.tsx index 5cb252a18..a0ab9b878 100644 --- a/src/lib/pages/account-details/components/resources/ResourceLeftPanel.tsx +++ b/src/lib/pages/account-details/components/resources/ResourceLeftPanel.tsx @@ -126,7 +126,10 @@ export const ResourceLeftPanel = ({ key={subitem.displayName} name={subitem.group} amount={subitem.items.length} - isSelected={selectedResources?.group === subitem.group} + isSelected={ + selectedResources?.account === subitem.account && + selectedResources?.group === subitem.group + } onClick={() => handleSelectResource(item.owner, subitem.group) } From 19301647739e22a75305efc68849e5e342656709 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Tue, 19 Dec 2023 14:38:46 +0700 Subject: [PATCH 07/16] fix: resource aggregate --- src/lib/services/move/resourceService.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/services/move/resourceService.ts b/src/lib/services/move/resourceService.ts index c0f931efd..c0dec1462 100644 --- a/src/lib/services/move/resourceService.ts +++ b/src/lib/services/move/resourceService.ts @@ -60,13 +60,15 @@ export const useAccountResources = ( Record >((acc, resource) => { const [accountName, groupName] = resource.structTag.split("::"); - const groupResources = acc[groupName] ?? {}; + const resourceKey = `${accountName}::${groupName}`; + + const groupResources = acc[resourceKey] ?? {}; const items = groupResources?.items ?? []; items.push(resource); return { ...acc, - [groupName]: { + [resourceKey]: { displayName: `${truncate(accountName)}::${groupName}`, account: accountName as MoveAccountAddr, group: groupName, From b0549a4042959ad99eed2733a9696f87da696d61 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Tue, 19 Dec 2023 14:51:16 +0700 Subject: [PATCH 08/16] fix: remove view button on mobile card --- .../table/modules/ModulesTableMobileCard.tsx | 30 ++++--------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/src/lib/components/table/modules/ModulesTableMobileCard.tsx b/src/lib/components/table/modules/ModulesTableMobileCard.tsx index 9faf8921b..eb04f7d14 100644 --- a/src/lib/components/table/modules/ModulesTableMobileCard.tsx +++ b/src/lib/components/table/modules/ModulesTableMobileCard.tsx @@ -1,4 +1,4 @@ -import { Box, Button, Flex, Text } from "@chakra-ui/react"; +import { Box, Flex, Text } from "@chakra-ui/react"; import { MobileCardTemplate } from "../MobileCardTemplate"; import { MobileLabel } from "../MobileLabel"; @@ -36,30 +36,10 @@ export const ModulesTableMobileCard = ({ }) } topContent={ - - - - - - - - + + + + } middleContent={ From 12d03442390c09d507d7e6a22cb333058bd54574 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Tue, 19 Dec 2023 16:16:48 +0700 Subject: [PATCH 09/16] fix: disable proposals --- src/lib/gql/gql.ts | 86 +- src/lib/gql/graphql.ts | 1840 ++++------------- .../tables/InstantiatedContractsTable.tsx | 1 + src/lib/pages/account-details/data.ts | 2 +- src/lib/pages/account-details/index.tsx | 18 +- .../components/tables/index.tsx | 4 + src/lib/query/code.ts | 4 +- src/lib/query/contract.ts | 7 +- src/lib/query/module.ts | 4 +- src/lib/query/proposal.ts | 39 + src/lib/services/account.ts | 6 +- src/lib/services/accountService.ts | 6 +- src/lib/services/codeService.ts | 7 +- src/lib/services/contractService.ts | 13 +- src/lib/services/delegationService.ts | 12 +- src/lib/services/move/moduleService.ts | 8 +- src/lib/services/proposalService.ts | 74 + 17 files changed, 620 insertions(+), 1511 deletions(-) diff --git a/src/lib/gql/gql.ts b/src/lib/gql/gql.ts index 3ad01976b..51c8f2df4 100644 --- a/src/lib/gql/gql.ts +++ b/src/lib/gql/gql.ts @@ -13,14 +13,8 @@ import { TypedDocumentNode as DocumentNode } from "@graphql-typed-document-node/ * Therefore it is highly recommended to use the babel-plugin for production. */ const documents = { - "\n query getAccountIdByAddressQueryDocument($address: String!) {\n accounts_by_pk(address: $address) {\n id\n }\n }\n": - types.GetAccountIdByAddressQueryDocumentDocument, "\n query getAccountTypeByAddressQueryDocument($address: String!) {\n accounts_by_pk(address: $address) {\n type\n }\n }\n": types.GetAccountTypeByAddressQueryDocumentDocument, - "\n query getBlockTimestampByHeightQuery($height: Int!) {\n blocks_by_pk(height: $height) {\n timestamp\n }\n }\n": - types.GetBlockTimestampByHeightQueryDocument, - "\n query getBlockListQuery($limit: Int!, $offset: Int!) {\n blocks(limit: $limit, offset: $offset, order_by: { height: desc }) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n count\n }\n }\n validator {\n moniker\n operator_address\n identity\n }\n }\n }\n": - types.GetBlockListQueryDocument, "\n query getBlockDetailsByHeight($height: Int!) {\n blocks_by_pk(height: $height) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n sum {\n gas_used\n gas_limit\n }\n }\n }\n validator {\n moniker\n operator_address\n identity\n }\n }\n }\n": types.GetBlockDetailsByHeightDocument, "\n query getLatestBlockInfo {\n blocks(limit: 1, order_by: { height: desc }) {\n height\n timestamp\n }\n }\n": @@ -33,7 +27,7 @@ const documents = { types.GetCodeListByUserQueryDocument, "\n query getCodeListByIDsQuery($ids: [Int!]!) {\n codes(where: { id: { _in: $ids } }) {\n id\n contracts_aggregate {\n aggregate {\n count\n }\n }\n account {\n uploader: address\n }\n access_config_permission\n access_config_addresses\n cw2_contract\n cw2_version\n }\n }\n": types.GetCodeListByIDsQueryDocument, - "\n query getCodeDataByCodeId($codeId: Int!) {\n codes_by_pk(id: $codeId) {\n id\n account {\n address\n }\n transaction {\n hash\n block {\n height\n timestamp\n }\n }\n # Can only have 1 store code proposal\n code_proposals(limit: 1) {\n proposal_id\n block {\n height\n timestamp\n }\n }\n access_config_permission\n access_config_addresses\n cw2_contract\n cw2_version\n }\n }\n": + "\n query getCodeDataByCodeId($codeId: Int!, $isGov: Boolean!) {\n codes_by_pk(id: $codeId) {\n id\n account {\n address\n }\n transaction {\n hash\n block {\n height\n timestamp\n }\n }\n # Can only have 1 store code proposal\n code_proposals(limit: 1) @include(if: $isGov) {\n proposal_id\n block {\n height\n timestamp\n }\n }\n access_config_permission\n access_config_addresses\n cw2_contract\n cw2_version\n }\n }\n": types.GetCodeDataByCodeIdDocument, "\n query getCodeListByWalletAddressPagination(\n $walletAddress: String!\n $offset: Int!\n $pageSize: Int!\n ) {\n codes(\n where: { account: { address: { _eq: $walletAddress } } }\n limit: $pageSize\n offset: $offset\n order_by: { id: desc }\n ) {\n id\n contracts_aggregate {\n aggregate {\n count\n }\n }\n account {\n uploader: address\n }\n access_config_permission\n access_config_addresses\n cw2_contract\n cw2_version\n }\n }\n": types.GetCodeListByWalletAddressPaginationDocument, @@ -41,7 +35,7 @@ const documents = { types.GetCodeListCountByWalletAddressDocument, "\n query getContractByContractAddressQueryDocument($contractAddress: String!) {\n contracts_by_pk(address: $contractAddress) {\n address\n code_id\n label\n accountByInitBy {\n address\n }\n admin: account {\n address\n }\n }\n }\n": types.GetContractByContractAddressQueryDocumentDocument, - '\n query getInstantiateDetailByContractQueryDocument($contractAddress: String!) {\n contracts_by_pk(address: $contractAddress) {\n init_msg\n transaction {\n hash\n }\n contract_proposals(\n where: {\n proposal: {\n type: {\n _in: [\n "InstantiateContract"\n "InstantiateContract2"\n "SoftwareUpgrade"\n ]\n }\n }\n }\n order_by: { proposal: { id: asc } }\n limit: 1\n ) {\n proposal {\n id\n title\n }\n }\n contract_histories(order_by: { block: { timestamp: asc } }, limit: 1) {\n block {\n height\n timestamp\n }\n }\n }\n }\n': + '\n query getInstantiateDetailByContractQueryDocument(\n $contractAddress: String!\n $isGov: Boolean!\n ) {\n contracts_by_pk(address: $contractAddress) {\n init_msg\n transaction {\n hash\n }\n contract_proposals(\n where: {\n proposal: {\n type: {\n _in: [\n "InstantiateContract"\n "InstantiateContract2"\n "SoftwareUpgrade"\n ]\n }\n }\n }\n order_by: { proposal: { id: asc } }\n limit: 1\n ) @include(if: $isGov) {\n proposal {\n id\n title\n }\n }\n contract_histories(order_by: { block: { timestamp: asc } }, limit: 1) {\n block {\n height\n timestamp\n }\n }\n }\n }\n': types.GetInstantiateDetailByContractQueryDocumentDocument, "\n query getContractListQuery {\n contracts(limit: 100, offset: 0, order_by: { id: desc }) {\n address\n label\n admin: account {\n address\n }\n init_by: contract_histories(\n order_by: { block: { timestamp: asc } }\n limit: 1\n ) {\n block {\n timestamp\n }\n account {\n address\n }\n }\n }\n }\n": types.GetContractListQueryDocument, @@ -73,7 +67,7 @@ const documents = { types.GetModuleHistoriesQueryDocument, "\n query getModuleHistoriesCountQuery($moduleId: Int!) {\n module_histories_aggregate(where: { module_id: { _eq: $moduleId } }) {\n aggregate {\n count\n }\n }\n }\n": types.GetModuleHistoriesCountQueryDocument, - '\n query getModuleInitialPublishInfoQuery($moduleId: Int!) {\n modules(where: { id: { _eq: $moduleId } }) {\n publisher_vm_address: vm_address {\n vm_address\n }\n publish_transaction: transaction {\n hash\n }\n module_proposals(\n where: {\n proposal: { type: { _in: ["/initia.move.v1.MsgGovPublish"] } }\n }\n order_by: { proposal_id: asc }\n limit: 1\n ) {\n proposal {\n id\n title\n }\n }\n module_histories(order_by: { block: { timestamp: asc } }, limit: 1) {\n block {\n height\n timestamp\n }\n }\n }\n }\n': + '\n query getModuleInitialPublishInfoQuery($moduleId: Int!, $isGov: Boolean!) {\n modules(where: { id: { _eq: $moduleId } }) {\n publisher_vm_address: vm_address {\n vm_address\n }\n publish_transaction: transaction {\n hash\n }\n module_proposals(\n where: {\n proposal: { type: { _in: ["/initia.move.v1.MsgGovPublish"] } }\n }\n order_by: { proposal_id: asc }\n limit: 1\n ) @include(if: $isGov) {\n proposal {\n id\n title\n }\n }\n module_histories(order_by: { block: { timestamp: asc } }, limit: 1) {\n block {\n height\n timestamp\n }\n }\n }\n }\n': types.GetModuleInitialPublishInfoQueryDocument, "\n query getPoolList(\n $expression: pools_bool_exp\n $order: order_by\n $offset: Int!\n $pageSize: Int!\n ) {\n pools(\n where: $expression\n order_by: { id: $order }\n offset: $offset\n limit: $pageSize\n ) {\n id\n type\n is_superfluid\n liquidity\n contract_address\n }\n }\n": types.GetPoolListDocument, @@ -95,30 +89,26 @@ const documents = { types.GetProposalsByWalletAddressPaginationDocument, "\n query getProposalsCountByWalletAddress($walletAddress: String!) {\n proposals_aggregate(\n where: { account: { address: { _eq: $walletAddress } } }\n ) {\n aggregate {\n count\n }\n }\n }\n": types.GetProposalsCountByWalletAddressDocument, + "\n query getRelatedProposalsByModuleIdPagination(\n $moduleId: Int!\n $offset: Int!\n $pageSize: Int!\n ) {\n module_proposals(\n where: { module_id: { _eq: $moduleId } }\n order_by: { proposal_id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n proposal {\n title\n status\n voting_end_time\n deposit_end_time\n type\n account {\n address\n }\n is_expedited\n resolved_height\n }\n proposal_id\n }\n }\n": + types.GetRelatedProposalsByModuleIdPaginationDocument, + "\n query getRelatedProposalsCountByModuleId($moduleId: Int!) {\n module_proposals_aggregate(where: { module_id: { _eq: $moduleId } }) {\n aggregate {\n count\n }\n }\n }\n": + types.GetRelatedProposalsCountByModuleIdDocument, "\n query getProposalList(\n $expression: proposals_bool_exp\n $offset: Int!\n $pageSize: Int!\n ) {\n proposals(\n where: $expression\n order_by: { id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n type\n id\n title\n voting_end_time\n deposit_end_time\n resolved_height\n status\n is_expedited\n account {\n address\n }\n }\n }\n": types.GetProposalListDocument, "\n query getProposalListCount($expression: proposals_bool_exp) {\n proposals_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n": types.GetProposalListCountDocument, "\n query getProposalTypes {\n proposals(distinct_on: type) {\n type\n }\n }\n": types.GetProposalTypesDocument, - "\n query getTxsByAddressPagination(\n $expression: account_transactions_bool_exp\n $offset: Int!\n $pageSize: Int!\n $isWasm: Boolean!\n $isMove: Boolean!\n ) {\n account_transactions(\n where: $expression\n order_by: { block_height: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_send\n is_ibc\n is_clear_admin @include(if: $isWasm)\n is_execute @include(if: $isWasm)\n is_instantiate @include(if: $isWasm)\n is_migrate @include(if: $isWasm)\n is_store_code @include(if: $isWasm)\n is_update_admin @include(if: $isWasm)\n is_move_publish @include(if: $isMove)\n is_move_upgrade @include(if: $isMove)\n is_move_execute @include(if: $isMove)\n is_move_script @include(if: $isMove)\n }\n is_signer\n }\n }\n": - types.GetTxsByAddressPaginationDocument, - "\n query getTxsCountByAddress($expression: account_transactions_bool_exp) {\n account_transactions_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n": - types.GetTxsCountByAddressDocument, "\n query getTxsByPoolIdPagination(\n $expression: pool_transactions_bool_exp\n $offset: Int!\n $pageSize: Int!\n ) {\n pool_transactions(\n where: $expression\n order_by: { block_height: desc, transaction_id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_ibc\n }\n }\n }\n": types.GetTxsByPoolIdPaginationDocument, "\n query getTxsCountByPoolId($expression: pool_transactions_bool_exp) {\n pool_transactions_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n": types.GetTxsCountByPoolIdDocument, - "\n query getTxs(\n $offset: Int!\n $pageSize: Int!\n $isWasm: Boolean!\n $isMove: Boolean!\n ) {\n transactions(\n order_by: { block_height: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n account {\n address\n }\n hash\n success\n messages\n is_send\n is_ibc\n is_clear_admin @include(if: $isWasm)\n is_execute @include(if: $isWasm)\n is_instantiate @include(if: $isWasm)\n is_migrate @include(if: $isWasm)\n is_store_code @include(if: $isWasm)\n is_update_admin @include(if: $isWasm)\n is_move_publish @include(if: $isMove)\n is_move_upgrade @include(if: $isMove)\n is_move_execute @include(if: $isMove)\n is_move_script @include(if: $isMove)\n }\n }\n": - types.GetTxsDocument, "\n query getTxsCount {\n transactions(limit: 1, order_by: { id: desc }) {\n id\n }\n }\n": types.GetTxsCountDocument, "\n query getBlockTransactionsByHeightQuery(\n $limit: Int!\n $offset: Int!\n $height: Int!\n $isWasm: Boolean!\n $isMove: Boolean!\n ) {\n transactions(\n limit: $limit\n offset: $offset\n where: { block_height: { _eq: $height } }\n order_by: { id: asc }\n ) {\n block {\n height\n timestamp\n }\n account {\n address\n }\n hash\n success\n messages\n is_send\n is_ibc\n is_clear_admin @include(if: $isWasm)\n is_execute @include(if: $isWasm)\n is_instantiate @include(if: $isWasm)\n is_migrate @include(if: $isWasm)\n is_store_code @include(if: $isWasm)\n is_update_admin @include(if: $isWasm)\n is_move_publish @include(if: $isMove)\n is_move_upgrade @include(if: $isMove)\n is_move_execute @include(if: $isMove)\n is_move_script @include(if: $isMove)\n }\n }\n": types.GetBlockTransactionsByHeightQueryDocument, "\n query getBlockTransactionCountByHeightQuery($height: Int!) {\n transactions_aggregate(where: { block_height: { _eq: $height } }) {\n aggregate {\n count\n }\n }\n }\n": types.GetBlockTransactionCountByHeightQueryDocument, - "\n query getModuleTransactionsQuery(\n $moduleId: Int!\n $pageSize: Int!\n $offset: Int!\n ) {\n module_transactions(\n where: { module_id: { _eq: $moduleId } }\n limit: $pageSize\n offset: $offset\n order_by: { block_height: desc }\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_send\n is_ibc\n is_move_execute\n is_move_execute_event\n is_move_publish\n is_move_script\n is_move_upgrade\n }\n }\n }\n": - types.GetModuleTransactionsQueryDocument, "\n query getModuleTransactionsCountQuery($moduleId: Int!) {\n module_transactions_aggregate(where: { module_id: { _eq: $moduleId } }) {\n aggregate {\n count\n }\n }\n }\n": types.GetModuleTransactionsCountQueryDocument, "\n query getValidators {\n validators {\n commission_max_change\n commission_max_rate\n commission_rate\n consensus_address\n details\n identity\n jailed\n moniker\n operator_address\n website\n }\n }\n": @@ -139,30 +129,12 @@ const documents = { */ export function graphql(source: string): unknown; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql( - source: "\n query getAccountIdByAddressQueryDocument($address: String!) {\n accounts_by_pk(address: $address) {\n id\n }\n }\n" -): (typeof documents)["\n query getAccountIdByAddressQueryDocument($address: String!) {\n accounts_by_pk(address: $address) {\n id\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( source: "\n query getAccountTypeByAddressQueryDocument($address: String!) {\n accounts_by_pk(address: $address) {\n type\n }\n }\n" ): (typeof documents)["\n query getAccountTypeByAddressQueryDocument($address: String!) {\n accounts_by_pk(address: $address) {\n type\n }\n }\n"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql( - source: "\n query getBlockTimestampByHeightQuery($height: Int!) {\n blocks_by_pk(height: $height) {\n timestamp\n }\n }\n" -): (typeof documents)["\n query getBlockTimestampByHeightQuery($height: Int!) {\n blocks_by_pk(height: $height) {\n timestamp\n }\n }\n"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql( - source: "\n query getBlockListQuery($limit: Int!, $offset: Int!) {\n blocks(limit: $limit, offset: $offset, order_by: { height: desc }) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n count\n }\n }\n validator {\n moniker\n operator_address\n identity\n }\n }\n }\n" -): (typeof documents)["\n query getBlockListQuery($limit: Int!, $offset: Int!) {\n blocks(limit: $limit, offset: $offset, order_by: { height: desc }) {\n hash\n height\n timestamp\n transactions_aggregate {\n aggregate {\n count\n }\n }\n validator {\n moniker\n operator_address\n identity\n }\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -203,8 +175,8 @@ export function graphql( * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: "\n query getCodeDataByCodeId($codeId: Int!) {\n codes_by_pk(id: $codeId) {\n id\n account {\n address\n }\n transaction {\n hash\n block {\n height\n timestamp\n }\n }\n # Can only have 1 store code proposal\n code_proposals(limit: 1) {\n proposal_id\n block {\n height\n timestamp\n }\n }\n access_config_permission\n access_config_addresses\n cw2_contract\n cw2_version\n }\n }\n" -): (typeof documents)["\n query getCodeDataByCodeId($codeId: Int!) {\n codes_by_pk(id: $codeId) {\n id\n account {\n address\n }\n transaction {\n hash\n block {\n height\n timestamp\n }\n }\n # Can only have 1 store code proposal\n code_proposals(limit: 1) {\n proposal_id\n block {\n height\n timestamp\n }\n }\n access_config_permission\n access_config_addresses\n cw2_contract\n cw2_version\n }\n }\n"]; + source: "\n query getCodeDataByCodeId($codeId: Int!, $isGov: Boolean!) {\n codes_by_pk(id: $codeId) {\n id\n account {\n address\n }\n transaction {\n hash\n block {\n height\n timestamp\n }\n }\n # Can only have 1 store code proposal\n code_proposals(limit: 1) @include(if: $isGov) {\n proposal_id\n block {\n height\n timestamp\n }\n }\n access_config_permission\n access_config_addresses\n cw2_contract\n cw2_version\n }\n }\n" +): (typeof documents)["\n query getCodeDataByCodeId($codeId: Int!, $isGov: Boolean!) {\n codes_by_pk(id: $codeId) {\n id\n account {\n address\n }\n transaction {\n hash\n block {\n height\n timestamp\n }\n }\n # Can only have 1 store code proposal\n code_proposals(limit: 1) @include(if: $isGov) {\n proposal_id\n block {\n height\n timestamp\n }\n }\n access_config_permission\n access_config_addresses\n cw2_contract\n cw2_version\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -227,8 +199,8 @@ export function graphql( * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: '\n query getInstantiateDetailByContractQueryDocument($contractAddress: String!) {\n contracts_by_pk(address: $contractAddress) {\n init_msg\n transaction {\n hash\n }\n contract_proposals(\n where: {\n proposal: {\n type: {\n _in: [\n "InstantiateContract"\n "InstantiateContract2"\n "SoftwareUpgrade"\n ]\n }\n }\n }\n order_by: { proposal: { id: asc } }\n limit: 1\n ) {\n proposal {\n id\n title\n }\n }\n contract_histories(order_by: { block: { timestamp: asc } }, limit: 1) {\n block {\n height\n timestamp\n }\n }\n }\n }\n' -): (typeof documents)['\n query getInstantiateDetailByContractQueryDocument($contractAddress: String!) {\n contracts_by_pk(address: $contractAddress) {\n init_msg\n transaction {\n hash\n }\n contract_proposals(\n where: {\n proposal: {\n type: {\n _in: [\n "InstantiateContract"\n "InstantiateContract2"\n "SoftwareUpgrade"\n ]\n }\n }\n }\n order_by: { proposal: { id: asc } }\n limit: 1\n ) {\n proposal {\n id\n title\n }\n }\n contract_histories(order_by: { block: { timestamp: asc } }, limit: 1) {\n block {\n height\n timestamp\n }\n }\n }\n }\n']; + source: '\n query getInstantiateDetailByContractQueryDocument(\n $contractAddress: String!\n $isGov: Boolean!\n ) {\n contracts_by_pk(address: $contractAddress) {\n init_msg\n transaction {\n hash\n }\n contract_proposals(\n where: {\n proposal: {\n type: {\n _in: [\n "InstantiateContract"\n "InstantiateContract2"\n "SoftwareUpgrade"\n ]\n }\n }\n }\n order_by: { proposal: { id: asc } }\n limit: 1\n ) @include(if: $isGov) {\n proposal {\n id\n title\n }\n }\n contract_histories(order_by: { block: { timestamp: asc } }, limit: 1) {\n block {\n height\n timestamp\n }\n }\n }\n }\n' +): (typeof documents)['\n query getInstantiateDetailByContractQueryDocument(\n $contractAddress: String!\n $isGov: Boolean!\n ) {\n contracts_by_pk(address: $contractAddress) {\n init_msg\n transaction {\n hash\n }\n contract_proposals(\n where: {\n proposal: {\n type: {\n _in: [\n "InstantiateContract"\n "InstantiateContract2"\n "SoftwareUpgrade"\n ]\n }\n }\n }\n order_by: { proposal: { id: asc } }\n limit: 1\n ) @include(if: $isGov) {\n proposal {\n id\n title\n }\n }\n contract_histories(order_by: { block: { timestamp: asc } }, limit: 1) {\n block {\n height\n timestamp\n }\n }\n }\n }\n']; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -323,8 +295,8 @@ export function graphql( * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: '\n query getModuleInitialPublishInfoQuery($moduleId: Int!) {\n modules(where: { id: { _eq: $moduleId } }) {\n publisher_vm_address: vm_address {\n vm_address\n }\n publish_transaction: transaction {\n hash\n }\n module_proposals(\n where: {\n proposal: { type: { _in: ["/initia.move.v1.MsgGovPublish"] } }\n }\n order_by: { proposal_id: asc }\n limit: 1\n ) {\n proposal {\n id\n title\n }\n }\n module_histories(order_by: { block: { timestamp: asc } }, limit: 1) {\n block {\n height\n timestamp\n }\n }\n }\n }\n' -): (typeof documents)['\n query getModuleInitialPublishInfoQuery($moduleId: Int!) {\n modules(where: { id: { _eq: $moduleId } }) {\n publisher_vm_address: vm_address {\n vm_address\n }\n publish_transaction: transaction {\n hash\n }\n module_proposals(\n where: {\n proposal: { type: { _in: ["/initia.move.v1.MsgGovPublish"] } }\n }\n order_by: { proposal_id: asc }\n limit: 1\n ) {\n proposal {\n id\n title\n }\n }\n module_histories(order_by: { block: { timestamp: asc } }, limit: 1) {\n block {\n height\n timestamp\n }\n }\n }\n }\n']; + source: '\n query getModuleInitialPublishInfoQuery($moduleId: Int!, $isGov: Boolean!) {\n modules(where: { id: { _eq: $moduleId } }) {\n publisher_vm_address: vm_address {\n vm_address\n }\n publish_transaction: transaction {\n hash\n }\n module_proposals(\n where: {\n proposal: { type: { _in: ["/initia.move.v1.MsgGovPublish"] } }\n }\n order_by: { proposal_id: asc }\n limit: 1\n ) @include(if: $isGov) {\n proposal {\n id\n title\n }\n }\n module_histories(order_by: { block: { timestamp: asc } }, limit: 1) {\n block {\n height\n timestamp\n }\n }\n }\n }\n' +): (typeof documents)['\n query getModuleInitialPublishInfoQuery($moduleId: Int!, $isGov: Boolean!) {\n modules(where: { id: { _eq: $moduleId } }) {\n publisher_vm_address: vm_address {\n vm_address\n }\n publish_transaction: transaction {\n hash\n }\n module_proposals(\n where: {\n proposal: { type: { _in: ["/initia.move.v1.MsgGovPublish"] } }\n }\n order_by: { proposal_id: asc }\n limit: 1\n ) @include(if: $isGov) {\n proposal {\n id\n title\n }\n }\n module_histories(order_by: { block: { timestamp: asc } }, limit: 1) {\n block {\n height\n timestamp\n }\n }\n }\n }\n']; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -389,32 +361,32 @@ export function graphql( * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: "\n query getProposalList(\n $expression: proposals_bool_exp\n $offset: Int!\n $pageSize: Int!\n ) {\n proposals(\n where: $expression\n order_by: { id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n type\n id\n title\n voting_end_time\n deposit_end_time\n resolved_height\n status\n is_expedited\n account {\n address\n }\n }\n }\n" -): (typeof documents)["\n query getProposalList(\n $expression: proposals_bool_exp\n $offset: Int!\n $pageSize: Int!\n ) {\n proposals(\n where: $expression\n order_by: { id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n type\n id\n title\n voting_end_time\n deposit_end_time\n resolved_height\n status\n is_expedited\n account {\n address\n }\n }\n }\n"]; + source: "\n query getRelatedProposalsByModuleIdPagination(\n $moduleId: Int!\n $offset: Int!\n $pageSize: Int!\n ) {\n module_proposals(\n where: { module_id: { _eq: $moduleId } }\n order_by: { proposal_id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n proposal {\n title\n status\n voting_end_time\n deposit_end_time\n type\n account {\n address\n }\n is_expedited\n resolved_height\n }\n proposal_id\n }\n }\n" +): (typeof documents)["\n query getRelatedProposalsByModuleIdPagination(\n $moduleId: Int!\n $offset: Int!\n $pageSize: Int!\n ) {\n module_proposals(\n where: { module_id: { _eq: $moduleId } }\n order_by: { proposal_id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n proposal {\n title\n status\n voting_end_time\n deposit_end_time\n type\n account {\n address\n }\n is_expedited\n resolved_height\n }\n proposal_id\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: "\n query getProposalListCount($expression: proposals_bool_exp) {\n proposals_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n" -): (typeof documents)["\n query getProposalListCount($expression: proposals_bool_exp) {\n proposals_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n"]; + source: "\n query getRelatedProposalsCountByModuleId($moduleId: Int!) {\n module_proposals_aggregate(where: { module_id: { _eq: $moduleId } }) {\n aggregate {\n count\n }\n }\n }\n" +): (typeof documents)["\n query getRelatedProposalsCountByModuleId($moduleId: Int!) {\n module_proposals_aggregate(where: { module_id: { _eq: $moduleId } }) {\n aggregate {\n count\n }\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: "\n query getProposalTypes {\n proposals(distinct_on: type) {\n type\n }\n }\n" -): (typeof documents)["\n query getProposalTypes {\n proposals(distinct_on: type) {\n type\n }\n }\n"]; + source: "\n query getProposalList(\n $expression: proposals_bool_exp\n $offset: Int!\n $pageSize: Int!\n ) {\n proposals(\n where: $expression\n order_by: { id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n type\n id\n title\n voting_end_time\n deposit_end_time\n resolved_height\n status\n is_expedited\n account {\n address\n }\n }\n }\n" +): (typeof documents)["\n query getProposalList(\n $expression: proposals_bool_exp\n $offset: Int!\n $pageSize: Int!\n ) {\n proposals(\n where: $expression\n order_by: { id: desc }\n offset: $offset\n limit: $pageSize\n ) {\n type\n id\n title\n voting_end_time\n deposit_end_time\n resolved_height\n status\n is_expedited\n account {\n address\n }\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: "\n query getTxsByAddressPagination(\n $expression: account_transactions_bool_exp\n $offset: Int!\n $pageSize: Int!\n $isWasm: Boolean!\n $isMove: Boolean!\n ) {\n account_transactions(\n where: $expression\n order_by: { block_height: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_send\n is_ibc\n is_clear_admin @include(if: $isWasm)\n is_execute @include(if: $isWasm)\n is_instantiate @include(if: $isWasm)\n is_migrate @include(if: $isWasm)\n is_store_code @include(if: $isWasm)\n is_update_admin @include(if: $isWasm)\n is_move_publish @include(if: $isMove)\n is_move_upgrade @include(if: $isMove)\n is_move_execute @include(if: $isMove)\n is_move_script @include(if: $isMove)\n }\n is_signer\n }\n }\n" -): (typeof documents)["\n query getTxsByAddressPagination(\n $expression: account_transactions_bool_exp\n $offset: Int!\n $pageSize: Int!\n $isWasm: Boolean!\n $isMove: Boolean!\n ) {\n account_transactions(\n where: $expression\n order_by: { block_height: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_send\n is_ibc\n is_clear_admin @include(if: $isWasm)\n is_execute @include(if: $isWasm)\n is_instantiate @include(if: $isWasm)\n is_migrate @include(if: $isWasm)\n is_store_code @include(if: $isWasm)\n is_update_admin @include(if: $isWasm)\n is_move_publish @include(if: $isMove)\n is_move_upgrade @include(if: $isMove)\n is_move_execute @include(if: $isMove)\n is_move_script @include(if: $isMove)\n }\n is_signer\n }\n }\n"]; + source: "\n query getProposalListCount($expression: proposals_bool_exp) {\n proposals_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n" +): (typeof documents)["\n query getProposalListCount($expression: proposals_bool_exp) {\n proposals_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ export function graphql( - source: "\n query getTxsCountByAddress($expression: account_transactions_bool_exp) {\n account_transactions_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n" -): (typeof documents)["\n query getTxsCountByAddress($expression: account_transactions_bool_exp) {\n account_transactions_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n"]; + source: "\n query getProposalTypes {\n proposals(distinct_on: type) {\n type\n }\n }\n" +): (typeof documents)["\n query getProposalTypes {\n proposals(distinct_on: type) {\n type\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -427,12 +399,6 @@ export function graphql( export function graphql( source: "\n query getTxsCountByPoolId($expression: pool_transactions_bool_exp) {\n pool_transactions_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n" ): (typeof documents)["\n query getTxsCountByPoolId($expression: pool_transactions_bool_exp) {\n pool_transactions_aggregate(where: $expression) {\n aggregate {\n count\n }\n }\n }\n"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql( - source: "\n query getTxs(\n $offset: Int!\n $pageSize: Int!\n $isWasm: Boolean!\n $isMove: Boolean!\n ) {\n transactions(\n order_by: { block_height: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n account {\n address\n }\n hash\n success\n messages\n is_send\n is_ibc\n is_clear_admin @include(if: $isWasm)\n is_execute @include(if: $isWasm)\n is_instantiate @include(if: $isWasm)\n is_migrate @include(if: $isWasm)\n is_store_code @include(if: $isWasm)\n is_update_admin @include(if: $isWasm)\n is_move_publish @include(if: $isMove)\n is_move_upgrade @include(if: $isMove)\n is_move_execute @include(if: $isMove)\n is_move_script @include(if: $isMove)\n }\n }\n" -): (typeof documents)["\n query getTxs(\n $offset: Int!\n $pageSize: Int!\n $isWasm: Boolean!\n $isMove: Boolean!\n ) {\n transactions(\n order_by: { block_height: desc }\n offset: $offset\n limit: $pageSize\n ) {\n block {\n height\n timestamp\n }\n account {\n address\n }\n hash\n success\n messages\n is_send\n is_ibc\n is_clear_admin @include(if: $isWasm)\n is_execute @include(if: $isWasm)\n is_instantiate @include(if: $isWasm)\n is_migrate @include(if: $isWasm)\n is_store_code @include(if: $isWasm)\n is_update_admin @include(if: $isWasm)\n is_move_publish @include(if: $isMove)\n is_move_upgrade @include(if: $isMove)\n is_move_execute @include(if: $isMove)\n is_move_script @include(if: $isMove)\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ @@ -451,12 +417,6 @@ export function graphql( export function graphql( source: "\n query getBlockTransactionCountByHeightQuery($height: Int!) {\n transactions_aggregate(where: { block_height: { _eq: $height } }) {\n aggregate {\n count\n }\n }\n }\n" ): (typeof documents)["\n query getBlockTransactionCountByHeightQuery($height: Int!) {\n transactions_aggregate(where: { block_height: { _eq: $height } }) {\n aggregate {\n count\n }\n }\n }\n"]; -/** - * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. - */ -export function graphql( - source: "\n query getModuleTransactionsQuery(\n $moduleId: Int!\n $pageSize: Int!\n $offset: Int!\n ) {\n module_transactions(\n where: { module_id: { _eq: $moduleId } }\n limit: $pageSize\n offset: $offset\n order_by: { block_height: desc }\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_send\n is_ibc\n is_move_execute\n is_move_execute_event\n is_move_publish\n is_move_script\n is_move_upgrade\n }\n }\n }\n" -): (typeof documents)["\n query getModuleTransactionsQuery(\n $moduleId: Int!\n $pageSize: Int!\n $offset: Int!\n ) {\n module_transactions(\n where: { module_id: { _eq: $moduleId } }\n limit: $pageSize\n offset: $offset\n order_by: { block_height: desc }\n ) {\n block {\n height\n timestamp\n }\n transaction {\n account {\n address\n }\n hash\n success\n messages\n is_send\n is_ibc\n is_move_execute\n is_move_execute_event\n is_move_publish\n is_move_script\n is_move_upgrade\n }\n }\n }\n"]; /** * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. */ diff --git a/src/lib/gql/graphql.ts b/src/lib/gql/graphql.ts index f82b77014..256a87a88 100644 --- a/src/lib/gql/graphql.ts +++ b/src/lib/gql/graphql.ts @@ -14825,15 +14825,6 @@ export type Vm_Addresses_Variance_Fields = { id?: Maybe; }; -export type GetAccountIdByAddressQueryDocumentQueryVariables = Exact<{ - address: Scalars["String"]; -}>; - -export type GetAccountIdByAddressQueryDocumentQuery = { - __typename?: "query_root"; - accounts_by_pk?: { __typename?: "accounts"; id: number } | null; -}; - export type GetAccountTypeByAddressQueryDocumentQueryVariables = Exact<{ address: Scalars["String"]; }>; @@ -14843,43 +14834,6 @@ export type GetAccountTypeByAddressQueryDocumentQuery = { accounts_by_pk?: { __typename?: "accounts"; type?: any | null } | null; }; -export type GetBlockTimestampByHeightQueryQueryVariables = Exact<{ - height: Scalars["Int"]; -}>; - -export type GetBlockTimestampByHeightQueryQuery = { - __typename?: "query_root"; - blocks_by_pk?: { __typename?: "blocks"; timestamp: any } | null; -}; - -export type GetBlockListQueryQueryVariables = Exact<{ - limit: Scalars["Int"]; - offset: Scalars["Int"]; -}>; - -export type GetBlockListQueryQuery = { - __typename?: "query_root"; - blocks: Array<{ - __typename?: "blocks"; - hash: any; - height: number; - timestamp: any; - transactions_aggregate: { - __typename?: "transactions_aggregate"; - aggregate?: { - __typename?: "transactions_aggregate_fields"; - count: number; - } | null; - }; - validator?: { - __typename?: "validators"; - moniker: string; - operator_address: string; - identity: string; - } | null; - }>; -}; - export type GetBlockDetailsByHeightQueryVariables = Exact<{ height: Scalars["Int"]; }>; @@ -14998,6 +14952,7 @@ export type GetCodeListByIDsQueryQuery = { export type GetCodeDataByCodeIdQueryVariables = Exact<{ codeId: Scalars["Int"]; + isGov: Scalars["Boolean"]; }>; export type GetCodeDataByCodeIdQuery = { @@ -15015,7 +14970,7 @@ export type GetCodeDataByCodeIdQuery = { hash: any; block: { __typename?: "blocks"; height: number; timestamp: any }; } | null; - code_proposals: Array<{ + code_proposals?: Array<{ __typename?: "code_proposals"; proposal_id: number; block?: { __typename?: "blocks"; height: number; timestamp: any } | null; @@ -15079,6 +15034,7 @@ export type GetContractByContractAddressQueryDocumentQuery = { export type GetInstantiateDetailByContractQueryDocumentQueryVariables = Exact<{ contractAddress: Scalars["String"]; + isGov: Scalars["Boolean"]; }>; export type GetInstantiateDetailByContractQueryDocumentQuery = { @@ -15087,7 +15043,7 @@ export type GetInstantiateDetailByContractQueryDocumentQuery = { __typename?: "contracts"; init_msg?: string | null; transaction?: { __typename?: "transactions"; hash: any } | null; - contract_proposals: Array<{ + contract_proposals?: Array<{ __typename?: "contract_proposals"; proposal: { __typename?: "proposals"; id: number; title: string }; }>; @@ -15362,6 +15318,7 @@ export type GetModuleHistoriesCountQueryQuery = { export type GetModuleInitialPublishInfoQueryQueryVariables = Exact<{ moduleId: Scalars["Int"]; + isGov: Scalars["Boolean"]; }>; export type GetModuleInitialPublishInfoQueryQuery = { @@ -15370,7 +15327,7 @@ export type GetModuleInitialPublishInfoQueryQuery = { __typename?: "modules"; publisher_vm_address: { __typename?: "vm_addresses"; vm_address: string }; publish_transaction?: { __typename?: "transactions"; hash: any } | null; - module_proposals: Array<{ + module_proposals?: Array<{ __typename?: "module_proposals"; proposal: { __typename?: "proposals"; id: number; title: string }; }>; @@ -15560,6 +15517,46 @@ export type GetProposalsCountByWalletAddressQuery = { }; }; +export type GetRelatedProposalsByModuleIdPaginationQueryVariables = Exact<{ + moduleId: Scalars["Int"]; + offset: Scalars["Int"]; + pageSize: Scalars["Int"]; +}>; + +export type GetRelatedProposalsByModuleIdPaginationQuery = { + __typename?: "query_root"; + module_proposals: Array<{ + __typename?: "module_proposals"; + proposal_id: number; + proposal: { + __typename?: "proposals"; + title: string; + status: any; + voting_end_time?: any | null; + deposit_end_time: any; + type: string; + is_expedited: boolean; + resolved_height?: number | null; + account?: { __typename?: "accounts"; address: string } | null; + }; + }>; +}; + +export type GetRelatedProposalsCountByModuleIdQueryVariables = Exact<{ + moduleId: Scalars["Int"]; +}>; + +export type GetRelatedProposalsCountByModuleIdQuery = { + __typename?: "query_root"; + module_proposals_aggregate: { + __typename?: "module_proposals_aggregate"; + aggregate?: { + __typename?: "module_proposals_aggregate_fields"; + count: number; + } | null; + }; +}; + export type GetProposalListQueryVariables = Exact<{ expression?: InputMaybe; offset: Scalars["Int"]; @@ -15604,57 +15601,6 @@ export type GetProposalTypesQuery = { proposals: Array<{ __typename?: "proposals"; type: string }>; }; -export type GetTxsByAddressPaginationQueryVariables = Exact<{ - expression?: InputMaybe; - offset: Scalars["Int"]; - pageSize: Scalars["Int"]; - isWasm: Scalars["Boolean"]; - isMove: Scalars["Boolean"]; -}>; - -export type GetTxsByAddressPaginationQuery = { - __typename?: "query_root"; - account_transactions: Array<{ - __typename?: "account_transactions"; - is_signer: boolean; - block: { __typename?: "blocks"; height: number; timestamp: any }; - transaction: { - __typename?: "transactions"; - hash: any; - success: boolean; - messages: any; - is_send: boolean; - is_ibc: boolean; - is_clear_admin?: boolean; - is_execute?: boolean; - is_instantiate?: boolean; - is_migrate?: boolean; - is_store_code?: boolean; - is_update_admin?: boolean; - is_move_publish?: boolean; - is_move_upgrade?: boolean; - is_move_execute?: boolean; - is_move_script?: boolean; - account: { __typename?: "accounts"; address: string }; - }; - }>; -}; - -export type GetTxsCountByAddressQueryVariables = Exact<{ - expression?: InputMaybe; -}>; - -export type GetTxsCountByAddressQuery = { - __typename?: "query_root"; - account_transactions_aggregate: { - __typename?: "account_transactions_aggregate"; - aggregate?: { - __typename?: "account_transactions_aggregate_fields"; - count: number; - } | null; - }; -}; - export type GetTxsByPoolIdPaginationQueryVariables = Exact<{ expression?: InputMaybe; offset: Scalars["Int"]; @@ -15692,37 +15638,6 @@ export type GetTxsCountByPoolIdQuery = { }; }; -export type GetTxsQueryVariables = Exact<{ - offset: Scalars["Int"]; - pageSize: Scalars["Int"]; - isWasm: Scalars["Boolean"]; - isMove: Scalars["Boolean"]; -}>; - -export type GetTxsQuery = { - __typename?: "query_root"; - transactions: Array<{ - __typename?: "transactions"; - hash: any; - success: boolean; - messages: any; - is_send: boolean; - is_ibc: boolean; - is_clear_admin?: boolean; - is_execute?: boolean; - is_instantiate?: boolean; - is_migrate?: boolean; - is_store_code?: boolean; - is_update_admin?: boolean; - is_move_publish?: boolean; - is_move_upgrade?: boolean; - is_move_execute?: boolean; - is_move_script?: boolean; - block: { __typename?: "blocks"; height: number; timestamp: any }; - account: { __typename?: "accounts"; address: string }; - }>; -}; - export type GetTxsCountQueryVariables = Exact<{ [key: string]: never }>; export type GetTxsCountQuery = { @@ -15777,34 +15692,6 @@ export type GetBlockTransactionCountByHeightQueryQuery = { }; }; -export type GetModuleTransactionsQueryQueryVariables = Exact<{ - moduleId: Scalars["Int"]; - pageSize: Scalars["Int"]; - offset: Scalars["Int"]; -}>; - -export type GetModuleTransactionsQueryQuery = { - __typename?: "query_root"; - module_transactions: Array<{ - __typename?: "module_transactions"; - block: { __typename?: "blocks"; height: number; timestamp: any }; - transaction: { - __typename?: "transactions"; - hash: any; - success: boolean; - messages: any; - is_send: boolean; - is_ibc: boolean; - is_move_execute: boolean; - is_move_execute_event: boolean; - is_move_publish: boolean; - is_move_script: boolean; - is_move_upgrade: boolean; - account: { __typename?: "accounts"; address: string }; - }; - }>; -}; - export type GetModuleTransactionsCountQueryQueryVariables = Exact<{ moduleId: Scalars["Int"]; }>; @@ -15839,60 +15726,6 @@ export type GetValidatorsQuery = { }>; }; -export const GetAccountIdByAddressQueryDocumentDocument = { - kind: "Document", - definitions: [ - { - kind: "OperationDefinition", - operation: "query", - name: { kind: "Name", value: "getAccountIdByAddressQueryDocument" }, - variableDefinitions: [ - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "address" }, - }, - type: { - kind: "NonNullType", - type: { - kind: "NamedType", - name: { kind: "Name", value: "String" }, - }, - }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "accounts_by_pk" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "address" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "address" }, - }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { kind: "Field", name: { kind: "Name", value: "id" } }, - ], - }, - }, - ], - }, - }, - ], -} as unknown as DocumentNode< - GetAccountIdByAddressQueryDocumentQuery, - GetAccountIdByAddressQueryDocumentQueryVariables ->; export const GetAccountTypeByAddressQueryDocumentDocument = { kind: "Document", definitions: [ @@ -15947,13 +15780,13 @@ export const GetAccountTypeByAddressQueryDocumentDocument = { GetAccountTypeByAddressQueryDocumentQuery, GetAccountTypeByAddressQueryDocumentQueryVariables >; -export const GetBlockTimestampByHeightQueryDocument = { +export const GetBlockDetailsByHeightDocument = { kind: "Document", definitions: [ { kind: "OperationDefinition", operation: "query", - name: { kind: "Name", value: "getBlockTimestampByHeightQuery" }, + name: { kind: "Name", value: "getBlockDetailsByHeight" }, variableDefinitions: [ { kind: "VariableDefinition", @@ -15986,7 +15819,65 @@ export const GetBlockTimestampByHeightQueryDocument = { selectionSet: { kind: "SelectionSet", selections: [ + { kind: "Field", name: { kind: "Name", value: "hash" } }, + { kind: "Field", name: { kind: "Name", value: "height" } }, { kind: "Field", name: { kind: "Name", value: "timestamp" } }, + { + kind: "Field", + name: { kind: "Name", value: "transactions_aggregate" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "aggregate" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "sum" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "gas_used" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "gas_limit" }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + { + kind: "Field", + name: { kind: "Name", value: "validator" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "moniker" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "operator_address" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "identity" }, + }, + ], + }, + }, ], }, }, @@ -15995,248 +15886,10 @@ export const GetBlockTimestampByHeightQueryDocument = { }, ], } as unknown as DocumentNode< - GetBlockTimestampByHeightQueryQuery, - GetBlockTimestampByHeightQueryQueryVariables + GetBlockDetailsByHeightQuery, + GetBlockDetailsByHeightQueryVariables >; -export const GetBlockListQueryDocument = { - kind: "Document", - definitions: [ - { - kind: "OperationDefinition", - operation: "query", - name: { kind: "Name", value: "getBlockListQuery" }, - variableDefinitions: [ - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "limit" }, - }, - type: { - kind: "NonNullType", - type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, - }, - }, - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "offset" }, - }, - type: { - kind: "NonNullType", - type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, - }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "blocks" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "limit" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "limit" }, - }, - }, - { - kind: "Argument", - name: { kind: "Name", value: "offset" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "offset" }, - }, - }, - { - kind: "Argument", - name: { kind: "Name", value: "order_by" }, - value: { - kind: "ObjectValue", - fields: [ - { - kind: "ObjectField", - name: { kind: "Name", value: "height" }, - value: { kind: "EnumValue", value: "desc" }, - }, - ], - }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { kind: "Field", name: { kind: "Name", value: "hash" } }, - { kind: "Field", name: { kind: "Name", value: "height" } }, - { kind: "Field", name: { kind: "Name", value: "timestamp" } }, - { - kind: "Field", - name: { kind: "Name", value: "transactions_aggregate" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "aggregate" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "count" }, - }, - ], - }, - }, - ], - }, - }, - { - kind: "Field", - name: { kind: "Name", value: "validator" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "moniker" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "operator_address" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "identity" }, - }, - ], - }, - }, - ], - }, - }, - ], - }, - }, - ], -} as unknown as DocumentNode< - GetBlockListQueryQuery, - GetBlockListQueryQueryVariables ->; -export const GetBlockDetailsByHeightDocument = { - kind: "Document", - definitions: [ - { - kind: "OperationDefinition", - operation: "query", - name: { kind: "Name", value: "getBlockDetailsByHeight" }, - variableDefinitions: [ - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "height" }, - }, - type: { - kind: "NonNullType", - type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, - }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "blocks_by_pk" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "height" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "height" }, - }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { kind: "Field", name: { kind: "Name", value: "hash" } }, - { kind: "Field", name: { kind: "Name", value: "height" } }, - { kind: "Field", name: { kind: "Name", value: "timestamp" } }, - { - kind: "Field", - name: { kind: "Name", value: "transactions_aggregate" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "aggregate" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "sum" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "gas_used" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "gas_limit" }, - }, - ], - }, - }, - ], - }, - }, - ], - }, - }, - { - kind: "Field", - name: { kind: "Name", value: "validator" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "moniker" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "operator_address" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "identity" }, - }, - ], - }, - }, - ], - }, - }, - ], - }, - }, - ], -} as unknown as DocumentNode< - GetBlockDetailsByHeightQuery, - GetBlockDetailsByHeightQueryVariables ->; -export const GetLatestBlockInfoDocument = { +export const GetLatestBlockInfoDocument = { kind: "Document", definitions: [ { @@ -16772,6 +16425,20 @@ export const GetCodeDataByCodeIdDocument = { type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, }, }, + { + kind: "VariableDefinition", + variable: { + kind: "Variable", + name: { kind: "Name", value: "isGov" }, + }, + type: { + kind: "NonNullType", + type: { + kind: "NamedType", + name: { kind: "Name", value: "Boolean" }, + }, + }, + }, ], selectionSet: { kind: "SelectionSet", @@ -16843,15 +16510,31 @@ export const GetCodeDataByCodeIdDocument = { value: { kind: "IntValue", value: "1" }, }, ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "proposal_id" }, - }, - { - kind: "Field", + directives: [ + { + kind: "Directive", + name: { kind: "Name", value: "include" }, + arguments: [ + { + kind: "Argument", + name: { kind: "Name", value: "if" }, + value: { + kind: "Variable", + name: { kind: "Name", value: "isGov" }, + }, + }, + ], + }, + ], + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "proposal_id" }, + }, + { + kind: "Field", name: { kind: "Name", value: "block" }, selectionSet: { kind: "SelectionSet", @@ -17283,6 +16966,20 @@ export const GetInstantiateDetailByContractQueryDocumentDocument = { }, }, }, + { + kind: "VariableDefinition", + variable: { + kind: "Variable", + name: { kind: "Name", value: "isGov" }, + }, + type: { + kind: "NonNullType", + type: { + kind: "NamedType", + name: { kind: "Name", value: "Boolean" }, + }, + }, + }, ], selectionSet: { kind: "SelectionSet", @@ -17398,6 +17095,22 @@ export const GetInstantiateDetailByContractQueryDocumentDocument = { value: { kind: "IntValue", value: "1" }, }, ], + directives: [ + { + kind: "Directive", + name: { kind: "Name", value: "include" }, + arguments: [ + { + kind: "Argument", + name: { kind: "Name", value: "if" }, + value: { + kind: "Variable", + name: { kind: "Name", value: "isGov" }, + }, + }, + ], + }, + ], selectionSet: { kind: "SelectionSet", selections: [ @@ -19763,6 +19476,20 @@ export const GetModuleInitialPublishInfoQueryDocument = { type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, }, }, + { + kind: "VariableDefinition", + variable: { + kind: "Variable", + name: { kind: "Name", value: "isGov" }, + }, + type: { + kind: "NonNullType", + type: { + kind: "NamedType", + name: { kind: "Name", value: "Boolean" }, + }, + }, + }, ], selectionSet: { kind: "SelectionSet", @@ -19892,6 +19619,22 @@ export const GetModuleInitialPublishInfoQueryDocument = { value: { kind: "IntValue", value: "1" }, }, ], + directives: [ + { + kind: "Directive", + name: { kind: "Name", value: "include" }, + arguments: [ + { + kind: "Argument", + name: { kind: "Name", value: "if" }, + value: { + kind: "Variable", + name: { kind: "Name", value: "isGov" }, + }, + }, + ], + }, + ], selectionSet: { kind: "SelectionSet", selections: [ @@ -21136,23 +20879,23 @@ export const GetProposalsCountByWalletAddressDocument = { GetProposalsCountByWalletAddressQuery, GetProposalsCountByWalletAddressQueryVariables >; -export const GetProposalListDocument = { +export const GetRelatedProposalsByModuleIdPaginationDocument = { kind: "Document", definitions: [ { kind: "OperationDefinition", operation: "query", - name: { kind: "Name", value: "getProposalList" }, + name: { kind: "Name", value: "getRelatedProposalsByModuleIdPagination" }, variableDefinitions: [ { kind: "VariableDefinition", variable: { kind: "Variable", - name: { kind: "Name", value: "expression" }, + name: { kind: "Name", value: "moduleId" }, }, type: { - kind: "NamedType", - name: { kind: "Name", value: "proposals_bool_exp" }, + kind: "NonNullType", + type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, }, }, { @@ -21183,14 +20926,32 @@ export const GetProposalListDocument = { selections: [ { kind: "Field", - name: { kind: "Name", value: "proposals" }, + name: { kind: "Name", value: "module_proposals" }, arguments: [ { kind: "Argument", name: { kind: "Name", value: "where" }, value: { - kind: "Variable", - name: { kind: "Name", value: "expression" }, + kind: "ObjectValue", + fields: [ + { + kind: "ObjectField", + name: { kind: "Name", value: "module_id" }, + value: { + kind: "ObjectValue", + fields: [ + { + kind: "ObjectField", + name: { kind: "Name", value: "_eq" }, + value: { + kind: "Variable", + name: { kind: "Name", value: "moduleId" }, + }, + }, + ], + }, + }, + ], }, }, { @@ -21201,7 +20962,7 @@ export const GetProposalListDocument = { fields: [ { kind: "ObjectField", - name: { kind: "Name", value: "id" }, + name: { kind: "Name", value: "proposal_id" }, value: { kind: "EnumValue", value: "desc" }, }, ], @@ -21227,39 +20988,51 @@ export const GetProposalListDocument = { selectionSet: { kind: "SelectionSet", selections: [ - { kind: "Field", name: { kind: "Name", value: "type" } }, - { kind: "Field", name: { kind: "Name", value: "id" } }, - { kind: "Field", name: { kind: "Name", value: "title" } }, - { - kind: "Field", - name: { kind: "Name", value: "voting_end_time" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "deposit_end_time" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "resolved_height" }, - }, - { kind: "Field", name: { kind: "Name", value: "status" } }, - { - kind: "Field", - name: { kind: "Name", value: "is_expedited" }, - }, { kind: "Field", - name: { kind: "Name", value: "account" }, + name: { kind: "Name", value: "proposal" }, selectionSet: { kind: "SelectionSet", selections: [ + { kind: "Field", name: { kind: "Name", value: "title" } }, { kind: "Field", - name: { kind: "Name", value: "address" }, + name: { kind: "Name", value: "status" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "voting_end_time" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "deposit_end_time" }, + }, + { kind: "Field", name: { kind: "Name", value: "type" } }, + { + kind: "Field", + name: { kind: "Name", value: "account" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "address" }, + }, + ], + }, + }, + { + kind: "Field", + name: { kind: "Name", value: "is_expedited" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "resolved_height" }, }, ], }, }, + { kind: "Field", name: { kind: "Name", value: "proposal_id" } }, ], }, }, @@ -21268,26 +21041,26 @@ export const GetProposalListDocument = { }, ], } as unknown as DocumentNode< - GetProposalListQuery, - GetProposalListQueryVariables + GetRelatedProposalsByModuleIdPaginationQuery, + GetRelatedProposalsByModuleIdPaginationQueryVariables >; -export const GetProposalListCountDocument = { +export const GetRelatedProposalsCountByModuleIdDocument = { kind: "Document", definitions: [ { kind: "OperationDefinition", operation: "query", - name: { kind: "Name", value: "getProposalListCount" }, + name: { kind: "Name", value: "getRelatedProposalsCountByModuleId" }, variableDefinitions: [ { kind: "VariableDefinition", variable: { kind: "Variable", - name: { kind: "Name", value: "expression" }, + name: { kind: "Name", value: "moduleId" }, }, type: { - kind: "NamedType", - name: { kind: "Name", value: "proposals_bool_exp" }, + kind: "NonNullType", + type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, }, }, ], @@ -21296,14 +21069,32 @@ export const GetProposalListCountDocument = { selections: [ { kind: "Field", - name: { kind: "Name", value: "proposals_aggregate" }, + name: { kind: "Name", value: "module_proposals_aggregate" }, arguments: [ { kind: "Argument", name: { kind: "Name", value: "where" }, value: { - kind: "Variable", - name: { kind: "Name", value: "expression" }, + kind: "ObjectValue", + fields: [ + { + kind: "ObjectField", + name: { kind: "Name", value: "module_id" }, + value: { + kind: "ObjectValue", + fields: [ + { + kind: "ObjectField", + name: { kind: "Name", value: "_eq" }, + value: { + kind: "Variable", + name: { kind: "Name", value: "moduleId" }, + }, + }, + ], + }, + }, + ], }, }, ], @@ -21328,51 +21119,16 @@ export const GetProposalListCountDocument = { }, ], } as unknown as DocumentNode< - GetProposalListCountQuery, - GetProposalListCountQueryVariables ->; -export const GetProposalTypesDocument = { - kind: "Document", - definitions: [ - { - kind: "OperationDefinition", - operation: "query", - name: { kind: "Name", value: "getProposalTypes" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "proposals" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "distinct_on" }, - value: { kind: "EnumValue", value: "type" }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { kind: "Field", name: { kind: "Name", value: "type" } }, - ], - }, - }, - ], - }, - }, - ], -} as unknown as DocumentNode< - GetProposalTypesQuery, - GetProposalTypesQueryVariables + GetRelatedProposalsCountByModuleIdQuery, + GetRelatedProposalsCountByModuleIdQueryVariables >; -export const GetTxsByAddressPaginationDocument = { +export const GetProposalListDocument = { kind: "Document", definitions: [ { kind: "OperationDefinition", operation: "query", - name: { kind: "Name", value: "getTxsByAddressPagination" }, + name: { kind: "Name", value: "getProposalList" }, variableDefinitions: [ { kind: "VariableDefinition", @@ -21382,7 +21138,7 @@ export const GetTxsByAddressPaginationDocument = { }, type: { kind: "NamedType", - name: { kind: "Name", value: "account_transactions_bool_exp" }, + name: { kind: "Name", value: "proposals_bool_exp" }, }, }, { @@ -21407,41 +21163,13 @@ export const GetTxsByAddressPaginationDocument = { type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, }, }, - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - type: { - kind: "NonNullType", - type: { - kind: "NamedType", - name: { kind: "Name", value: "Boolean" }, - }, - }, - }, - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "isMove" }, - }, - type: { - kind: "NonNullType", - type: { - kind: "NamedType", - name: { kind: "Name", value: "Boolean" }, - }, - }, - }, ], selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", - name: { kind: "Name", value: "account_transactions" }, + name: { kind: "Name", value: "proposals" }, arguments: [ { kind: "Argument", @@ -21459,7 +21187,7 @@ export const GetTxsByAddressPaginationDocument = { fields: [ { kind: "ObjectField", - name: { kind: "Name", value: "block_height" }, + name: { kind: "Name", value: "id" }, value: { kind: "EnumValue", value: "desc" }, }, ], @@ -21485,263 +21213,39 @@ export const GetTxsByAddressPaginationDocument = { selectionSet: { kind: "SelectionSet", selections: [ + { kind: "Field", name: { kind: "Name", value: "type" } }, + { kind: "Field", name: { kind: "Name", value: "id" } }, + { kind: "Field", name: { kind: "Name", value: "title" } }, { kind: "Field", - name: { kind: "Name", value: "block" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "height" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "timestamp" }, - }, - ], - }, + name: { kind: "Name", value: "voting_end_time" }, }, { kind: "Field", - name: { kind: "Name", value: "transaction" }, + name: { kind: "Name", value: "deposit_end_time" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "resolved_height" }, + }, + { kind: "Field", name: { kind: "Name", value: "status" } }, + { + kind: "Field", + name: { kind: "Name", value: "is_expedited" }, + }, + { + kind: "Field", + name: { kind: "Name", value: "account" }, selectionSet: { kind: "SelectionSet", selections: [ { kind: "Field", - name: { kind: "Name", value: "account" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "address" }, - }, - ], - }, - }, - { kind: "Field", name: { kind: "Name", value: "hash" } }, - { - kind: "Field", - name: { kind: "Name", value: "success" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "messages" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "is_send" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "is_ibc" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "is_clear_admin" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_execute" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_instantiate" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_migrate" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_store_code" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_update_admin" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_move_publish" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isMove" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_move_upgrade" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isMove" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_move_execute" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isMove" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_move_script" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isMove" }, - }, - }, - ], - }, - ], + name: { kind: "Name", value: "address" }, }, ], }, }, - { kind: "Field", name: { kind: "Name", value: "is_signer" } }, ], }, }, @@ -21750,16 +21254,16 @@ export const GetTxsByAddressPaginationDocument = { }, ], } as unknown as DocumentNode< - GetTxsByAddressPaginationQuery, - GetTxsByAddressPaginationQueryVariables + GetProposalListQuery, + GetProposalListQueryVariables >; -export const GetTxsCountByAddressDocument = { +export const GetProposalListCountDocument = { kind: "Document", definitions: [ { kind: "OperationDefinition", operation: "query", - name: { kind: "Name", value: "getTxsCountByAddress" }, + name: { kind: "Name", value: "getProposalListCount" }, variableDefinitions: [ { kind: "VariableDefinition", @@ -21769,7 +21273,7 @@ export const GetTxsCountByAddressDocument = { }, type: { kind: "NamedType", - name: { kind: "Name", value: "account_transactions_bool_exp" }, + name: { kind: "Name", value: "proposals_bool_exp" }, }, }, ], @@ -21778,7 +21282,7 @@ export const GetTxsCountByAddressDocument = { selections: [ { kind: "Field", - name: { kind: "Name", value: "account_transactions_aggregate" }, + name: { kind: "Name", value: "proposals_aggregate" }, arguments: [ { kind: "Argument", @@ -21810,8 +21314,43 @@ export const GetTxsCountByAddressDocument = { }, ], } as unknown as DocumentNode< - GetTxsCountByAddressQuery, - GetTxsCountByAddressQueryVariables + GetProposalListCountQuery, + GetProposalListCountQueryVariables +>; +export const GetProposalTypesDocument = { + kind: "Document", + definitions: [ + { + kind: "OperationDefinition", + operation: "query", + name: { kind: "Name", value: "getProposalTypes" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "proposals" }, + arguments: [ + { + kind: "Argument", + name: { kind: "Name", value: "distinct_on" }, + value: { kind: "EnumValue", value: "type" }, + }, + ], + selectionSet: { + kind: "SelectionSet", + selections: [ + { kind: "Field", name: { kind: "Name", value: "type" } }, + ], + }, + }, + ], + }, + }, + ], +} as unknown as DocumentNode< + GetProposalTypesQuery, + GetProposalTypesQueryVariables >; export const GetTxsByPoolIdPaginationDocument = { kind: "Document", @@ -21967,405 +21506,59 @@ export const GetTxsByPoolIdPaginationDocument = { ], }, }, - ], -} as unknown as DocumentNode< - GetTxsByPoolIdPaginationQuery, - GetTxsByPoolIdPaginationQueryVariables ->; -export const GetTxsCountByPoolIdDocument = { - kind: "Document", - definitions: [ - { - kind: "OperationDefinition", - operation: "query", - name: { kind: "Name", value: "getTxsCountByPoolId" }, - variableDefinitions: [ - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "expression" }, - }, - type: { - kind: "NamedType", - name: { kind: "Name", value: "pool_transactions_bool_exp" }, - }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "pool_transactions_aggregate" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "where" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "expression" }, - }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "aggregate" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { kind: "Field", name: { kind: "Name", value: "count" } }, - ], - }, - }, - ], - }, - }, - ], - }, - }, - ], -} as unknown as DocumentNode< - GetTxsCountByPoolIdQuery, - GetTxsCountByPoolIdQueryVariables ->; -export const GetTxsDocument = { - kind: "Document", - definitions: [ - { - kind: "OperationDefinition", - operation: "query", - name: { kind: "Name", value: "getTxs" }, - variableDefinitions: [ - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "offset" }, - }, - type: { - kind: "NonNullType", - type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, - }, - }, - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "pageSize" }, - }, - type: { - kind: "NonNullType", - type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, - }, - }, - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - type: { - kind: "NonNullType", - type: { - kind: "NamedType", - name: { kind: "Name", value: "Boolean" }, - }, - }, - }, - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "isMove" }, - }, - type: { - kind: "NonNullType", - type: { - kind: "NamedType", - name: { kind: "Name", value: "Boolean" }, - }, - }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "transactions" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "order_by" }, - value: { - kind: "ObjectValue", - fields: [ - { - kind: "ObjectField", - name: { kind: "Name", value: "block_height" }, - value: { kind: "EnumValue", value: "desc" }, - }, - ], - }, - }, - { - kind: "Argument", - name: { kind: "Name", value: "offset" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "offset" }, - }, - }, - { - kind: "Argument", - name: { kind: "Name", value: "limit" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "pageSize" }, - }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "block" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "height" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "timestamp" }, - }, - ], - }, - }, - { - kind: "Field", - name: { kind: "Name", value: "account" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "address" }, - }, - ], - }, - }, - { kind: "Field", name: { kind: "Name", value: "hash" } }, - { kind: "Field", name: { kind: "Name", value: "success" } }, - { kind: "Field", name: { kind: "Name", value: "messages" } }, - { kind: "Field", name: { kind: "Name", value: "is_send" } }, - { kind: "Field", name: { kind: "Name", value: "is_ibc" } }, - { - kind: "Field", - name: { kind: "Name", value: "is_clear_admin" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_execute" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_instantiate" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_migrate" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_store_code" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_update_admin" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isWasm" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_move_publish" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isMove" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_move_upgrade" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isMove" }, - }, - }, - ], - }, - ], - }, - { - kind: "Field", - name: { kind: "Name", value: "is_move_execute" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isMove" }, - }, - }, - ], - }, - ], + ], +} as unknown as DocumentNode< + GetTxsByPoolIdPaginationQuery, + GetTxsByPoolIdPaginationQueryVariables +>; +export const GetTxsCountByPoolIdDocument = { + kind: "Document", + definitions: [ + { + kind: "OperationDefinition", + operation: "query", + name: { kind: "Name", value: "getTxsCountByPoolId" }, + variableDefinitions: [ + { + kind: "VariableDefinition", + variable: { + kind: "Variable", + name: { kind: "Name", value: "expression" }, + }, + type: { + kind: "NamedType", + name: { kind: "Name", value: "pool_transactions_bool_exp" }, + }, + }, + ], + selectionSet: { + kind: "SelectionSet", + selections: [ + { + kind: "Field", + name: { kind: "Name", value: "pool_transactions_aggregate" }, + arguments: [ + { + kind: "Argument", + name: { kind: "Name", value: "where" }, + value: { + kind: "Variable", + name: { kind: "Name", value: "expression" }, }, + }, + ], + selectionSet: { + kind: "SelectionSet", + selections: [ { kind: "Field", - name: { kind: "Name", value: "is_move_script" }, - directives: [ - { - kind: "Directive", - name: { kind: "Name", value: "include" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "if" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "isMove" }, - }, - }, - ], - }, - ], + name: { kind: "Name", value: "aggregate" }, + selectionSet: { + kind: "SelectionSet", + selections: [ + { kind: "Field", name: { kind: "Name", value: "count" } }, + ], + }, }, ], }, @@ -22374,7 +21567,10 @@ export const GetTxsDocument = { }, }, ], -} as unknown as DocumentNode; +} as unknown as DocumentNode< + GetTxsCountByPoolIdQuery, + GetTxsCountByPoolIdQueryVariables +>; export const GetTxsCountDocument = { kind: "Document", definitions: [ @@ -22882,202 +22078,6 @@ export const GetBlockTransactionCountByHeightQueryDocument = { GetBlockTransactionCountByHeightQueryQuery, GetBlockTransactionCountByHeightQueryQueryVariables >; -export const GetModuleTransactionsQueryDocument = { - kind: "Document", - definitions: [ - { - kind: "OperationDefinition", - operation: "query", - name: { kind: "Name", value: "getModuleTransactionsQuery" }, - variableDefinitions: [ - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "moduleId" }, - }, - type: { - kind: "NonNullType", - type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, - }, - }, - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "pageSize" }, - }, - type: { - kind: "NonNullType", - type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, - }, - }, - { - kind: "VariableDefinition", - variable: { - kind: "Variable", - name: { kind: "Name", value: "offset" }, - }, - type: { - kind: "NonNullType", - type: { kind: "NamedType", name: { kind: "Name", value: "Int" } }, - }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "module_transactions" }, - arguments: [ - { - kind: "Argument", - name: { kind: "Name", value: "where" }, - value: { - kind: "ObjectValue", - fields: [ - { - kind: "ObjectField", - name: { kind: "Name", value: "module_id" }, - value: { - kind: "ObjectValue", - fields: [ - { - kind: "ObjectField", - name: { kind: "Name", value: "_eq" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "moduleId" }, - }, - }, - ], - }, - }, - ], - }, - }, - { - kind: "Argument", - name: { kind: "Name", value: "limit" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "pageSize" }, - }, - }, - { - kind: "Argument", - name: { kind: "Name", value: "offset" }, - value: { - kind: "Variable", - name: { kind: "Name", value: "offset" }, - }, - }, - { - kind: "Argument", - name: { kind: "Name", value: "order_by" }, - value: { - kind: "ObjectValue", - fields: [ - { - kind: "ObjectField", - name: { kind: "Name", value: "block_height" }, - value: { kind: "EnumValue", value: "desc" }, - }, - ], - }, - }, - ], - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "block" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "height" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "timestamp" }, - }, - ], - }, - }, - { - kind: "Field", - name: { kind: "Name", value: "transaction" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "account" }, - selectionSet: { - kind: "SelectionSet", - selections: [ - { - kind: "Field", - name: { kind: "Name", value: "address" }, - }, - ], - }, - }, - { kind: "Field", name: { kind: "Name", value: "hash" } }, - { - kind: "Field", - name: { kind: "Name", value: "success" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "messages" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "is_send" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "is_ibc" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "is_move_execute" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "is_move_execute_event" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "is_move_publish" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "is_move_script" }, - }, - { - kind: "Field", - name: { kind: "Name", value: "is_move_upgrade" }, - }, - ], - }, - }, - ], - }, - }, - ], - }, - }, - ], -} as unknown as DocumentNode< - GetModuleTransactionsQueryQuery, - GetModuleTransactionsQueryQueryVariables ->; export const GetModuleTransactionsCountQueryDocument = { kind: "Document", definitions: [ diff --git a/src/lib/pages/account-details/components/tables/InstantiatedContractsTable.tsx b/src/lib/pages/account-details/components/tables/InstantiatedContractsTable.tsx index 91b1f0f43..ba6c25cd8 100644 --- a/src/lib/pages/account-details/components/tables/InstantiatedContractsTable.tsx +++ b/src/lib/pages/account-details/components/tables/InstantiatedContractsTable.tsx @@ -97,6 +97,7 @@ export const InstantiatedContractsTable = observer( ) : ( diff --git a/src/lib/pages/account-details/data.ts b/src/lib/pages/account-details/data.ts index 6a4fdf433..f1dbcd761 100644 --- a/src/lib/pages/account-details/data.ts +++ b/src/lib/pages/account-details/data.ts @@ -171,7 +171,7 @@ export const useUserDelegationInfos = (address: Addr) => { }); const { data: lpMap, isLoading: isLpMapLoading } = useMovePoolInfos(); - const { data: accountDelegations, isLoading: isLoadingAccountDelegations } = + const { data: accountDelegations, isFetching: isLoadingAccountDelegations } = useAccountDelegations(address); const isLoading = diff --git a/src/lib/pages/account-details/index.tsx b/src/lib/pages/account-details/index.tsx index f4893c827..b7385cbbf 100644 --- a/src/lib/pages/account-details/index.tsx +++ b/src/lib/pages/account-details/index.tsx @@ -265,7 +265,7 @@ const AccountDetailsBody = ({ onViewMore={handleTabChange(TabIndex.Assets)} /> - {disableDelegation ? null : ( + {!disableDelegation && ( )} - + {gov.enabled && ( + + )} diff --git a/src/lib/pages/contract-details/components/tables/index.tsx b/src/lib/pages/contract-details/components/tables/index.tsx index 1d53a6682..04ea4daf6 100644 --- a/src/lib/pages/contract-details/components/tables/index.tsx +++ b/src/lib/pages/contract-details/components/tables/index.tsx @@ -7,6 +7,7 @@ import { Tabs, } from "@chakra-ui/react"; +import { useGovConfig } from "lib/app-provider"; import { CustomTab } from "lib/components/CustomTab"; import { useContractDetailsTableCounts } from "lib/model/contract"; import type { ContractAddr } from "lib/types"; @@ -21,6 +22,8 @@ interface ContractTablesProps { export const ContractTables = ({ contractAddress }: ContractTablesProps) => { const tableHeaderId = "contractDetailsTableHeader"; + const gov = useGovConfig({ shouldRedirect: false }); + const { tableCounts, refetchMigration, @@ -47,6 +50,7 @@ export const ContractTables = ({ contractAddress }: ContractTablesProps) => { diff --git a/src/lib/query/code.ts b/src/lib/query/code.ts index 742e0525e..f00bea3cf 100644 --- a/src/lib/query/code.ts +++ b/src/lib/query/code.ts @@ -66,7 +66,7 @@ export const getCodeListByIDsQueryDocument = graphql(` `); export const getCodeDataByCodeId = graphql(` - query getCodeDataByCodeId($codeId: Int!) { + query getCodeDataByCodeId($codeId: Int!, $isGov: Boolean!) { codes_by_pk(id: $codeId) { id account { @@ -80,7 +80,7 @@ export const getCodeDataByCodeId = graphql(` } } # Can only have 1 store code proposal - code_proposals(limit: 1) { + code_proposals(limit: 1) @include(if: $isGov) { proposal_id block { height diff --git a/src/lib/query/contract.ts b/src/lib/query/contract.ts index 14e1c221d..899a788af 100644 --- a/src/lib/query/contract.ts +++ b/src/lib/query/contract.ts @@ -17,7 +17,10 @@ export const getContractByContractAddressQueryDocument = graphql(` `); export const getInstantiateDetailByContractQueryDocument = graphql(` - query getInstantiateDetailByContractQueryDocument($contractAddress: String!) { + query getInstantiateDetailByContractQueryDocument( + $contractAddress: String! + $isGov: Boolean! + ) { contracts_by_pk(address: $contractAddress) { init_msg transaction { @@ -37,7 +40,7 @@ export const getInstantiateDetailByContractQueryDocument = graphql(` } order_by: { proposal: { id: asc } } limit: 1 - ) { + ) @include(if: $isGov) { proposal { id title diff --git a/src/lib/query/module.ts b/src/lib/query/module.ts index 0f81c9791..496adb678 100644 --- a/src/lib/query/module.ts +++ b/src/lib/query/module.ts @@ -49,7 +49,7 @@ export const getModuleHistoriesCountQueryDocument = graphql(` `); export const getModuleInitialPublishInfoQueryDocument = graphql(` - query getModuleInitialPublishInfoQuery($moduleId: Int!) { + query getModuleInitialPublishInfoQuery($moduleId: Int!, $isGov: Boolean!) { modules(where: { id: { _eq: $moduleId } }) { publisher_vm_address: vm_address { vm_address @@ -63,7 +63,7 @@ export const getModuleInitialPublishInfoQueryDocument = graphql(` } order_by: { proposal_id: asc } limit: 1 - ) { + ) @include(if: $isGov) { proposal { id title diff --git a/src/lib/query/proposal.ts b/src/lib/query/proposal.ts index c6a8139db..6ea7fd552 100644 --- a/src/lib/query/proposal.ts +++ b/src/lib/query/proposal.ts @@ -77,6 +77,45 @@ export const getProposalsCountByWalletAddress = graphql(` } `); +export const getRelatedProposalsByModuleIdPagination = graphql(` + query getRelatedProposalsByModuleIdPagination( + $moduleId: Int! + $offset: Int! + $pageSize: Int! + ) { + module_proposals( + where: { module_id: { _eq: $moduleId } } + order_by: { proposal_id: desc } + offset: $offset + limit: $pageSize + ) { + proposal { + title + status + voting_end_time + deposit_end_time + type + account { + address + } + is_expedited + resolved_height + } + proposal_id + } + } +`); + +export const getRelatedProposalsCountByModuleId = graphql(` + query getRelatedProposalsCountByModuleId($moduleId: Int!) { + module_proposals_aggregate(where: { module_id: { _eq: $moduleId } }) { + aggregate { + count + } + } + } +`); + export const getProposalList = graphql(` query getProposalList( $expression: proposals_bool_exp diff --git a/src/lib/services/account.ts b/src/lib/services/account.ts index fae7d8119..4847f3823 100644 --- a/src/lib/services/account.ts +++ b/src/lib/services/account.ts @@ -51,10 +51,14 @@ export type AccountTableCounts = z.infer; export const getAccountTableCounts = async ( endpoint: string, address: string, + isGov: boolean, isWasm: boolean ): Promise => axios .get(`${endpoint}/${encodeURIComponent(address)}/table-counts`, { - params: { is_wasm: isWasm }, + params: { + is_gov: isGov, + is_wasm: isWasm, + }, }) .then((res) => zAccountTableCounts.parse(res.data)); diff --git a/src/lib/services/accountService.ts b/src/lib/services/accountService.ts index 197f0c2af..fa8d8d272 100644 --- a/src/lib/services/accountService.ts +++ b/src/lib/services/accountService.ts @@ -7,6 +7,7 @@ import { CELATONE_QUERY_KEYS, useBaseApiRoute, useWasmConfig, + useGovConfig, } from "lib/app-provider"; import { getAccountTypeByAddressQueryDocument } from "lib/query"; import type { AccountType, Addr, Option } from "lib/types"; @@ -67,11 +68,12 @@ export const useAccountTableCounts = ( address: Addr ): UseQueryResult => { const endpoint = useBaseApiRoute("accounts"); + const { enabled: isGov } = useGovConfig({ shouldRedirect: false }); const { enabled: isWasm } = useWasmConfig({ shouldRedirect: false }); return useQuery( - [CELATONE_QUERY_KEYS.TABLE_COUNTS, endpoint, address, isWasm], - async () => getAccountTableCounts(endpoint, address, isWasm), + [CELATONE_QUERY_KEYS.TABLE_COUNTS, endpoint, address, isGov, isWasm], + async () => getAccountTableCounts(endpoint, address, isGov, isWasm), { enabled: !!address, retry: 1, refetchOnWindowFocus: false } ); }; diff --git a/src/lib/services/codeService.ts b/src/lib/services/codeService.ts index 806e9060e..9c5899f78 100644 --- a/src/lib/services/codeService.ts +++ b/src/lib/services/codeService.ts @@ -7,6 +7,7 @@ import { CELATONE_QUERY_KEYS, useBaseApiRoute, useCelatoneApp, + useGovConfig, useWasmConfig, } from "lib/app-provider"; import { @@ -146,6 +147,7 @@ export const useCodeDataByCodeId = ({ Nullable> > => { const { indexerGraphClient } = useCelatoneApp(); + const { enabled: isGov } = useGovConfig({ shouldRedirect: false }); const queryFn = useCallback(async () => { if (!codeId) throw new Error("Code ID not found (useCodeDataByCodeId)"); @@ -153,6 +155,7 @@ export const useCodeDataByCodeId = ({ return indexerGraphClient .request(getCodeDataByCodeId, { codeId: Number(codeId), + isGov, }) .then(({ codes_by_pk }) => { if (!codes_by_pk) return null; @@ -163,7 +166,7 @@ export const useCodeDataByCodeId = ({ hash: parseTxHashOpt(codes_by_pk.transaction?.hash), height: codes_by_pk.transaction?.block.height, created: parseDateOpt(codes_by_pk.transaction?.block?.timestamp), - proposal: codes_by_pk.code_proposals[0] + proposal: codes_by_pk.code_proposals?.[0] ? { proposalId: codes_by_pk.code_proposals[0].proposal_id, height: codes_by_pk.code_proposals[0].block?.height, @@ -179,7 +182,7 @@ export const useCodeDataByCodeId = ({ cw2Version: codes_by_pk.cw2_version, }; }); - }, [codeId, indexerGraphClient]); + }, [codeId, indexerGraphClient, isGov]); return useQuery( [CELATONE_QUERY_KEYS.CODE_DATA_BY_ID, codeId, indexerGraphClient], queryFn, diff --git a/src/lib/services/contractService.ts b/src/lib/services/contractService.ts index 195fe0483..6f334778c 100644 --- a/src/lib/services/contractService.ts +++ b/src/lib/services/contractService.ts @@ -6,6 +6,7 @@ import { CELATONE_QUERY_KEYS, useBaseApiRoute, useCelatoneApp, + useGovConfig, useWasmConfig, } from "lib/app-provider"; import { @@ -111,10 +112,14 @@ export const useInstantiateDetailByContractQuery = ( contractAddress: ContractAddr ): UseQueryResult => { const { indexerGraphClient } = useCelatoneApp(); + const { enabled: isGov } = useGovConfig({ shouldRedirect: false }); const queryFn = useCallback(async () => { return indexerGraphClient - .request(getInstantiateDetailByContractQueryDocument, { contractAddress }) + .request(getInstantiateDetailByContractQueryDocument, { + contractAddress, + isGov, + }) .then(({ contracts_by_pk }) => ({ createdHeight: contracts_by_pk?.contract_histories?.[0]?.block.height, createdTime: parseDateOpt( @@ -122,11 +127,11 @@ export const useInstantiateDetailByContractQuery = ( ), initMsg: contracts_by_pk?.init_msg, initTxHash: parseTxHashOpt(contracts_by_pk?.transaction?.hash), - initProposalId: contracts_by_pk?.contract_proposals[0]?.proposal.id, + initProposalId: contracts_by_pk?.contract_proposals?.[0]?.proposal.id, initProposalTitle: - contracts_by_pk?.contract_proposals[0]?.proposal.title, + contracts_by_pk?.contract_proposals?.[0]?.proposal.title, })); - }, [contractAddress, indexerGraphClient]); + }, [contractAddress, indexerGraphClient, isGov]); return useQuery( [ diff --git a/src/lib/services/delegationService.ts b/src/lib/services/delegationService.ts index e9b08edd5..b053188c6 100644 --- a/src/lib/services/delegationService.ts +++ b/src/lib/services/delegationService.ts @@ -2,7 +2,11 @@ import type { UseQueryResult } from "@tanstack/react-query"; import { useQuery } from "@tanstack/react-query"; import { useCallback } from "react"; -import { CELATONE_QUERY_KEYS, useBaseApiRoute } from "lib/app-provider"; +import { + CELATONE_QUERY_KEYS, + useBaseApiRoute, + useCelatoneApp, +} from "lib/app-provider"; import type { Addr, ValidatorAddr } from "lib/types"; import type { @@ -133,11 +137,17 @@ export const useCommission = ( export const useAccountDelegations = (address: Addr) => { const endpoint = useBaseApiRoute("accounts"); + const { + chainConfig: { + extra: { disableDelegation }, + }, + } = useCelatoneApp(); return useQuery( [CELATONE_QUERY_KEYS.ACCOUNT_DELEGATIONS, endpoint, address], () => getAccountDelegations(endpoint, address), { + enabled: !disableDelegation, refetchOnWindowFocus: false, } ); diff --git a/src/lib/services/move/moduleService.ts b/src/lib/services/move/moduleService.ts index 2b88e65ce..5ec742b2a 100644 --- a/src/lib/services/move/moduleService.ts +++ b/src/lib/services/move/moduleService.ts @@ -10,6 +10,7 @@ import { CELATONE_QUERY_KEYS, useBaseApiRoute, useCelatoneApp, + useGovConfig, useMoveConfig, } from "lib/app-provider"; import { @@ -348,11 +349,12 @@ export const useModuleDetailsQuery = ( moduleId: Option> ): UseQueryResult => { const { indexerGraphClient } = useCelatoneApp(); + const { enabled: isGov } = useGovConfig({ shouldRedirect: false }); const queryFn = async () => { if (!moduleId) throw new Error("Module id not found"); return indexerGraphClient - .request(getModuleInitialPublishInfoQueryDocument, { moduleId }) + .request(getModuleInitialPublishInfoQueryDocument, { moduleId, isGov }) .then(({ modules }) => { const target = modules[0]; if (!target) throw new Error(`Cannot find module with id ${moduleId}`); @@ -363,8 +365,8 @@ export const useModuleDetailsQuery = ( target.module_histories?.[0]?.block.timestamp ), initTxHash: parseTxHashOpt(target.publish_transaction?.hash), - initProposalId: target.module_proposals[0]?.proposal.id, - initProposalTitle: target.module_proposals[0]?.proposal.title, + initProposalId: target.module_proposals?.[0]?.proposal.id, + initProposalTitle: target.module_proposals?.[0]?.proposal.title, }; }); }; diff --git a/src/lib/services/proposalService.ts b/src/lib/services/proposalService.ts index e6bf0777f..1597f9dfb 100644 --- a/src/lib/services/proposalService.ts +++ b/src/lib/services/proposalService.ts @@ -15,7 +15,9 @@ import { getProposalsCountByWalletAddress, getProposalTypes, getRelatedProposalsByContractAddressPagination, + getRelatedProposalsByModuleIdPagination, getRelatedProposalsCountByContractAddress, + getRelatedProposalsCountByModuleId, } from "lib/query"; import { createQueryFnWithTimeout } from "lib/query-utils"; import type { @@ -218,6 +220,78 @@ export const useProposalsCountByWalletAddress = ( ); }; +export const useRelatedProposalsByModuleIdPagination = ( + moduleId: number, + offset: number, + pageSize: number +): UseQueryResult => { + const { indexerGraphClient } = useCelatoneApp(); + const queryFn = useCallback(async () => { + return indexerGraphClient + .request(getRelatedProposalsByModuleIdPagination, { + moduleId, + offset, + pageSize, + }) + .then(({ module_proposals }) => + module_proposals.map((proposal) => ({ + proposalId: proposal.proposal_id, + title: proposal.proposal.title, + status: parseProposalStatus(proposal.proposal.status), + votingEndTime: parseDate(proposal.proposal.voting_end_time), + depositEndTime: parseDate(proposal.proposal.deposit_end_time), + resolvedHeight: proposal.proposal.resolved_height, + type: proposal.proposal.type as ProposalType, + proposer: proposal.proposal.account?.address as Addr, + isExpedited: Boolean(proposal.proposal.is_expedited), + })) + ); + }, [indexerGraphClient, moduleId, offset, pageSize]); + + return useQuery( + [ + CELATONE_QUERY_KEYS.PROPOSALS_BY_WALLET_ADDRESS_PAGINATION, + moduleId, + indexerGraphClient, + offset, + pageSize, + ], + createQueryFnWithTimeout(queryFn), + { + retry: 1, + refetchOnWindowFocus: false, + } + ); +}; + +export const useRelatedProposalsCountByModuleId = ( + moduleId: number +): UseQueryResult> => { + const { indexerGraphClient } = useCelatoneApp(); + const queryFn = useCallback(async () => { + return indexerGraphClient + .request(getRelatedProposalsCountByModuleId, { + moduleId, + }) + .then( + ({ module_proposals_aggregate }) => + module_proposals_aggregate?.aggregate?.count + ); + }, [indexerGraphClient, moduleId]); + + return useQuery( + [ + CELATONE_QUERY_KEYS.PROPOSALS_BY_WALLET_ADDRESS_COUNT, + moduleId, + indexerGraphClient, + ], + queryFn, + { + keepPreviousData: true, + } + ); +}; + export const useProposalList = ( offset: number, pageSize: number, From 0a939b04a4ac234b6ab6b072db4f83d7006ea441 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Tue, 19 Dec 2023 18:43:53 +0700 Subject: [PATCH 10/16] feat: module related proposal --- .../tables/RelatedProposalsTable.tsx | 29 ++- src/lib/pages/contract-details/index.tsx | 6 +- .../tables/ModuleRelatedProposalsTable.tsx | 92 +++++++ .../components/tables/history/index.tsx | 8 +- .../module-details/components/tables/index.ts | 2 - .../components/tables/index.tsx | 150 ++++++++++++ src/lib/pages/module-details/index.tsx | 230 ++++++------------ src/lib/services/proposalService.ts | 7 +- 8 files changed, 343 insertions(+), 181 deletions(-) create mode 100644 src/lib/pages/module-details/components/tables/ModuleRelatedProposalsTable.tsx delete mode 100644 src/lib/pages/module-details/components/tables/index.ts create mode 100644 src/lib/pages/module-details/components/tables/index.tsx diff --git a/src/lib/pages/contract-details/components/tables/RelatedProposalsTable.tsx b/src/lib/pages/contract-details/components/tables/RelatedProposalsTable.tsx index e0e79d3f6..38c44a3dc 100644 --- a/src/lib/pages/contract-details/components/tables/RelatedProposalsTable.tsx +++ b/src/lib/pages/contract-details/components/tables/RelatedProposalsTable.tsx @@ -2,7 +2,7 @@ import type { ChangeEvent } from "react"; import { Pagination } from "lib/components/pagination"; import { usePaginator } from "lib/components/pagination/usePaginator"; -import { EmptyState } from "lib/components/state"; +import { EmptyState, ErrorFetching } from "lib/components/state"; import { ProposalsTable } from "lib/components/table"; import { useRelatedProposalsByContractAddressPagination } from "lib/services/proposalService"; import type { ContractAddr, Option } from "lib/types"; @@ -36,12 +36,15 @@ export const RelatedProposalsTable = ({ }, }); - const { data: relatedProposals, isLoading } = - useRelatedProposalsByContractAddressPagination( - contractAddress, - offset, - pageSize - ); + const { + data: relatedProposals, + isLoading, + error, + } = useRelatedProposalsByContractAddressPagination( + contractAddress, + offset, + pageSize + ); const onPageChange = (nextPage: number) => { refetchCount(); @@ -61,10 +64,14 @@ export const RelatedProposalsTable = ({ proposals={relatedProposals} isLoading={isLoading} emptyState={ - + error ? ( + + ) : ( + + ) } /> {!!totalData && totalData > 10 && ( diff --git a/src/lib/pages/contract-details/index.tsx b/src/lib/pages/contract-details/index.tsx index cf673ba13..1e66b9eeb 100644 --- a/src/lib/pages/contract-details/index.tsx +++ b/src/lib/pages/contract-details/index.tsx @@ -96,7 +96,11 @@ const ContractDetailsBody = observer( return ( <> - + ; + scrollComponentId: string; + relatedProposalsCount: Option; + refetchCount: () => void; + onViewMore?: () => void; +} + +export const ModuleRelatedProposalsTable = ({ + moduleId, + scrollComponentId, + relatedProposalsCount, + refetchCount, + onViewMore, +}: ModuleRelatedProposalsTableProps) => { + const { + pagesQuantity, + currentPage, + setCurrentPage, + pageSize, + setPageSize, + offset, + } = usePaginator({ + total: relatedProposalsCount, + initialState: { + pageSize: 10, + currentPage: 1, + isDisabled: false, + }, + }); + + const { + data: relatedProposals, + isLoading, + error, + } = useRelatedProposalsByModuleIdPagination(moduleId, offset, pageSize); + + const onPageChange = (nextPage: number) => { + refetchCount(); + setCurrentPage(nextPage); + }; + + const onPageSizeChange = (e: ChangeEvent) => { + const size = Number(e.target.value); + refetchCount(); + setPageSize(size); + setCurrentPage(1); + }; + + return ( + <> + + ) : ( + + ) + } + /> + {!!relatedProposalsCount && + (onViewMore + ? relatedProposalsCount > 5 && + : relatedProposalsCount > 10 && ( + + ))} + + ); +}; diff --git a/src/lib/pages/module-details/components/tables/history/index.tsx b/src/lib/pages/module-details/components/tables/history/index.tsx index 7718effb0..13bd319bf 100644 --- a/src/lib/pages/module-details/components/tables/history/index.tsx +++ b/src/lib/pages/module-details/components/tables/history/index.tsx @@ -7,24 +7,24 @@ import { usePaginator } from "lib/components/pagination/usePaginator"; import { EmptyState, ErrorFetching } from "lib/components/state"; import { ViewMore } from "lib/components/table"; import { useModuleHistoriesByPagination } from "lib/services/move/moduleService"; -import type { Nullable, Option } from "lib/types"; +import type { Nullish, Option } from "lib/types"; import { PublishedEventsTable } from "./PublishedEventsTable"; interface ModuleHistoryTableProps { - moduleId: Option>; + moduleId: Nullish; historyCount: Option; scrollComponentId?: string; - onViewMore?: () => void; refetchCount: () => void; + onViewMore?: () => void; } export const ModuleHistoryTable = ({ moduleId, historyCount, - onViewMore, scrollComponentId, refetchCount, + onViewMore, }: ModuleHistoryTableProps) => { const { currentChainId } = useCelatoneApp(); diff --git a/src/lib/pages/module-details/components/tables/index.ts b/src/lib/pages/module-details/components/tables/index.ts deleted file mode 100644 index 56b319d64..000000000 --- a/src/lib/pages/module-details/components/tables/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export * from "./history"; -export * from "./ModuleTxsTable"; diff --git a/src/lib/pages/module-details/components/tables/index.tsx b/src/lib/pages/module-details/components/tables/index.tsx new file mode 100644 index 000000000..801dc7705 --- /dev/null +++ b/src/lib/pages/module-details/components/tables/index.tsx @@ -0,0 +1,150 @@ +import { + Flex, + Heading, + TabList, + TabPanel, + TabPanels, + Tabs, +} from "@chakra-ui/react"; +import { useCallback } from "react"; + +import { AmpEvent, track } from "lib/amplitude"; +import { CustomTab } from "lib/components/CustomTab"; +import type { HexAddr, Nullish, Option } from "lib/types"; + +import { ModuleHistoryTable } from "./history"; +import { ModuleRelatedProposalsTable } from "./ModuleRelatedProposalsTable"; +import { ModuleTxsTable } from "./ModuleTxsTable"; + +export enum ModuleTablesTabIndex { + Transactions = "transactions", + PublishedEvents = "published-events", + RelatedProposals = "related-proposals", +} + +interface ModuleTablesProps { + address: HexAddr; + moduleName: string; + moduleId: Nullish; + txsCount: Option; + historiesCount: Option; + relatedProposalsCount: Option; + refetchCount: () => void; + tab: ModuleTablesTabIndex; + setTab: (nextTab: ModuleTablesTabIndex) => void; + onViewMore?: (nextTab: ModuleTablesTabIndex) => void; +} + +export const ModuleTables = ({ + address, + moduleName, + moduleId, + txsCount, + historiesCount, + relatedProposalsCount, + refetchCount, + tab, + setTab, + onViewMore, +}: ModuleTablesProps) => { + const tableHeaderId = "moduleDetailsTableHeader"; + + const handleOnViewMore = useCallback( + (nextTab: ModuleTablesTabIndex) => + onViewMore + ? () => { + track(AmpEvent.USE_VIEW_MORE, { + table: nextTab, + }); + onViewMore(nextTab); + } + : undefined, + [onViewMore] + ); + const handleTabChange = useCallback( + (nextTab: ModuleTablesTabIndex) => () => { + if (nextTab === tab) return; + track(AmpEvent.USE_SUBTAB, { + isOverview: !!onViewMore, + subtab: nextTab, + }); + setTab(nextTab); + }, + [onViewMore, setTab, tab] + ); + + return ( + + + Transactions & Histories + + + + + Transactions + + + Published Events + + + Related Proposals + + + + + + + + + + + + + + + + ); +}; diff --git a/src/lib/pages/module-details/index.tsx b/src/lib/pages/module-details/index.tsx index 9c082c218..f3355c4bc 100644 --- a/src/lib/pages/module-details/index.tsx +++ b/src/lib/pages/module-details/index.tsx @@ -27,6 +27,7 @@ import { useModuleHistoriesCount, useModuleDetailsQuery, } from "lib/services/move/moduleService"; +import { useRelatedProposalsCountByModuleId } from "lib/services/proposalService"; import { useModuleTxsCount } from "lib/services/txService"; import type { MoveAccountAddr } from "lib/types"; import { getFirstQueryParam } from "lib/utils"; @@ -36,16 +37,14 @@ import { ModuleFunction } from "./components/ModuleFunction"; import { ModuleInfo } from "./components/ModuleInfo"; import { ModuleStruct } from "./components/ModuleStruct"; import { ModuleTop } from "./components/ModuleTop"; -import { ModuleTxsTable, ModuleHistoryTable } from "./components/tables"; +import { ModuleTables, ModuleTablesTabIndex } from "./components/tables"; const mainTabHeaderId = "main-table-header"; -const overviewHistoryHeaderId = "overview-history-header"; -const historyTabHeaderId = "history-tab-header"; -export enum TabIndex { +enum TabIndex { Overview = "overview", Function = "function", - History = "history", + TxsHistories = "txs-histories", Structs = "structs", } @@ -68,9 +67,41 @@ export const ModuleDetailsBody = ({ moduleData }: ModuleDetailsBodyProps) => { const router = useRouter(); const navigate = useInternalNavigate(); + const { data: moduleId } = useModuleId( + moduleData.moduleName, + moduleData.address + ); + + const { data: moduleDetails, isLoading: moduleDetailsLoading } = + useModuleDetailsQuery(moduleId); + + const { data: verificationData, isLoading: verificationLoading } = + useVerifyModule({ + address: moduleData.address, + moduleName: moduleData.moduleName, + }); + + const { data: moduleTxsCount, refetch: refetchTxsCount } = + useModuleTxsCount(moduleId); + const { data: moduleHistoriesCount, refetch: refetchHistoriesCount } = + useModuleHistoriesCount(moduleId); + const { + data: moduleRelatedProposalsCount, + refetch: refetchRelatedProposalsCount, + } = useRelatedProposalsCountByModuleId(moduleId); + const refetchCount = () => { + refetchTxsCount(); + refetchHistoriesCount(); + refetchRelatedProposalsCount(); + }; + const tab = getFirstQueryParam(router.query.tab) as TabIndex; - const [overviewHistoryTabIndex, setOverviewHistoryTabIndex] = useState(0); - const [historyTabIndex, setHistoryTabIndex] = useState(0); + const [overviewTabIndex, setOverviewTabIndex] = useState( + ModuleTablesTabIndex.Transactions + ); + const [tableTabIndex, setTableTabIndex] = useState( + ModuleTablesTabIndex.Transactions + ); const handleTabChange = useCallback( (nextTab: TabIndex, fnType?: FunctionTypeTabs) => () => { @@ -100,25 +131,6 @@ export const ModuleDetailsBody = ({ moduleData }: ModuleDetailsBodyProps) => { [handleTabChange] ); - const { data: moduleId } = useModuleId( - moduleData.moduleName, - moduleData.address - ); - - const { data: moduleDetails, isLoading: moduleDetailsLoading } = - useModuleDetailsQuery(moduleId); - - const { data: verificationData, isLoading: verificationLoading } = - useVerifyModule({ - address: moduleData.address, - moduleName: moduleData.moduleName, - }); - - const { data: moduleTxsCount, refetch: refetchTxsCount } = - useModuleTxsCount(moduleId); - const { data: moduleHistoriesCount, refetch: refetchHistoriesCount } = - useModuleHistoriesCount(moduleId); - const actionList: ActionInfo[] = [ { icon: "query" as IconKeys, @@ -144,7 +156,7 @@ export const ModuleDetailsBody = ({ moduleData }: ModuleDetailsBodyProps) => { iconColor: "gray.600", name: "Transactions", count: Number(moduleTxsCount) + Number(moduleHistoriesCount) || "N/A", - onClick: handleActionNavigate(TabIndex.History), + onClick: handleActionNavigate(TabIndex.TxsHistories), disabled: Number(moduleTxsCount) + Number(moduleHistoriesCount) === 0, }, ]; @@ -181,9 +193,9 @@ export const ModuleDetailsBody = ({ moduleData }: ModuleDetailsBodyProps) => { }, [router.isReady, tab, verificationLoading, verificationData]); useEffect(() => { - if (Number(moduleTxsCount) === 0) { - setOverviewHistoryTabIndex(1); - setHistoryTabIndex(1); + if (moduleTxsCount === 0) { + setOverviewTabIndex(ModuleTablesTabIndex.PublishedEvents); + setTableTabIndex(ModuleTablesTabIndex.PublishedEvents); } }, [moduleTxsCount]); @@ -215,7 +227,7 @@ export const ModuleDetailsBody = ({ moduleData }: ModuleDetailsBodyProps) => { > Function - + History { verificationData={verificationData} isLoading={moduleDetailsLoading} /> - - - History - - { - track(AmpEvent.USE_SUBTAB, { - tab, - subtab: index === 0 ? "Transactions" : "Published", - }); - setOverviewHistoryTabIndex(index); - }} - > - - - Transactions - - - Published Events - - - - - { - // Will remove after revamp AMP structure to provided context for each page - track(AmpEvent.USE_VIEW_MORE, { - table: "Module Transactions", - }); - handleTabChange(TabIndex.History)(); - setHistoryTabIndex(0); - }} - /> - - - { - // Will remove after revamp AMP structure to provided context for each page - track(AmpEvent.USE_VIEW_MORE, { - table: "Module Published Event", - }); - handleTabChange(TabIndex.History)(); - setHistoryTabIndex(1); - }} - /> - - - - + { + handleTabChange(TabIndex.TxsHistories)(); + setTableTabIndex(nextTab); + }} + /> @@ -369,64 +324,17 @@ export const ModuleDetailsBody = ({ moduleData }: ModuleDetailsBodyProps) => { /> - - - History - - { - track(AmpEvent.USE_SUBTAB, { - tab, - subtab: index === 0 ? "Transactions" : "Published", - }); - setHistoryTabIndex(index); - }} - > - - - Transactions - - - Published Events - - - - - - - - - - - - + diff --git a/src/lib/services/proposalService.ts b/src/lib/services/proposalService.ts index 1597f9dfb..ca12c0d18 100644 --- a/src/lib/services/proposalService.ts +++ b/src/lib/services/proposalService.ts @@ -30,6 +30,7 @@ import type { Proposal, U, Token, + Nullish, } from "lib/types"; import { deexponentify, @@ -221,12 +222,13 @@ export const useProposalsCountByWalletAddress = ( }; export const useRelatedProposalsByModuleIdPagination = ( - moduleId: number, + moduleId: Nullish, offset: number, pageSize: number ): UseQueryResult => { const { indexerGraphClient } = useCelatoneApp(); const queryFn = useCallback(async () => { + if (!moduleId) throw new Error("Module id not found"); return indexerGraphClient .request(getRelatedProposalsByModuleIdPagination, { moduleId, @@ -265,10 +267,11 @@ export const useRelatedProposalsByModuleIdPagination = ( }; export const useRelatedProposalsCountByModuleId = ( - moduleId: number + moduleId: Nullish ): UseQueryResult> => { const { indexerGraphClient } = useCelatoneApp(); const queryFn = useCallback(async () => { + if (!moduleId) throw new Error("Module id not found"); return indexerGraphClient .request(getRelatedProposalsCountByModuleId, { moduleId, From 309ade87f909e10758b128ce4de28b48c011cf98 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Tue, 19 Dec 2023 18:46:43 +0700 Subject: [PATCH 11/16] fix: tab tag --- src/lib/pages/module-details/index.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/pages/module-details/index.tsx b/src/lib/pages/module-details/index.tsx index f3355c4bc..2add99339 100644 --- a/src/lib/pages/module-details/index.tsx +++ b/src/lib/pages/module-details/index.tsx @@ -225,10 +225,10 @@ export const ModuleDetailsBody = ({ moduleData }: ModuleDetailsBodyProps) => { onClick={handleTabChange(TabIndex.Function, FunctionTypeTabs.ALL)} isDisabled={!moduleData.parsedAbi.exposed_functions.length} > - Function + Functions - History + Transactions & Histories Date: Tue, 19 Dec 2023 19:10:51 +0700 Subject: [PATCH 12/16] fix: search with module fn --- src/lib/services/searchService.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/services/searchService.ts b/src/lib/services/searchService.ts index ccd63a44d..be5fddd10 100644 --- a/src/lib/services/searchService.ts +++ b/src/lib/services/searchService.ts @@ -170,7 +170,7 @@ export const useSearchHandler = ( return { results: [ addressResult, - moduleName && moduleData && "Module Path", + moduleName && enableModuleFetching && moduleData && "Module Path", txData && "Transaction Hash", codeData && "Code ID", blockData && "Block", From 37f41291c1fef46a573a5495d652d3f4888b0bf5 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Tue, 19 Dec 2023 19:42:48 +0700 Subject: [PATCH 13/16] fix: refactor module detail --- .../components/ModuleActions.tsx | 104 ++++++++++++ .../module-details/components/ModuleInfo.tsx | 4 +- .../{ModuleStruct.tsx => ModuleStructs.tsx} | 5 +- .../pages/module-details/components/index.ts | 6 + .../{ => module-fns}/FunctionTypeSwitch.tsx | 0 .../ModuleFunctions.tsx} | 6 +- .../components/module-fns/index.ts | 2 + .../components/tables/index.tsx | 3 + src/lib/pages/module-details/index.tsx | 156 ++++-------------- src/lib/pages/module-details/types.ts | 6 + 10 files changed, 161 insertions(+), 131 deletions(-) create mode 100644 src/lib/pages/module-details/components/ModuleActions.tsx rename src/lib/pages/module-details/components/{ModuleStruct.tsx => ModuleStructs.tsx} (97%) create mode 100644 src/lib/pages/module-details/components/index.ts rename src/lib/pages/module-details/components/{ => module-fns}/FunctionTypeSwitch.tsx (100%) rename src/lib/pages/module-details/components/{ModuleFunction.tsx => module-fns/ModuleFunctions.tsx} (98%) create mode 100644 src/lib/pages/module-details/components/module-fns/index.ts create mode 100644 src/lib/pages/module-details/types.ts diff --git a/src/lib/pages/module-details/components/ModuleActions.tsx b/src/lib/pages/module-details/components/ModuleActions.tsx new file mode 100644 index 000000000..467207374 --- /dev/null +++ b/src/lib/pages/module-details/components/ModuleActions.tsx @@ -0,0 +1,104 @@ +import { Flex, Heading, Text } from "@chakra-ui/react"; +import type { MouseEventHandler } from "react"; + +import { TabIndex } from "../types"; +import { CustomIcon, type IconKeys } from "lib/components/icon"; +import type { Option } from "lib/types"; + +import { FunctionTypeTabs } from "./module-fns"; + +interface ActionInfo { + icon: IconKeys; + iconColor: string; + name: string; + count: number | string; + onClick: MouseEventHandler; + disabled: boolean; +} + +interface ModuleActionsProps { + viewFns: number; + executeFns: number; + allTxsCount: Option; + onSelectAction: (nextTab: TabIndex, fnType?: FunctionTypeTabs) => void; +} + +export const ModuleActions = ({ + viewFns, + executeFns, + allTxsCount, + onSelectAction, +}: ModuleActionsProps) => { + const actionList: ActionInfo[] = [ + { + icon: "query" as IconKeys, + iconColor: "primary.main", + name: "View Functions", + count: viewFns, + onClick: () => onSelectAction(TabIndex.Function, FunctionTypeTabs.VIEW), + disabled: viewFns === 0, + }, + { + icon: "execute" as IconKeys, + iconColor: "accent.main", + name: "Execute Functions", + count: executeFns, + onClick: () => + onSelectAction(TabIndex.Function, FunctionTypeTabs.EXECUTE), + disabled: executeFns === 0, + }, + { + icon: "list" as IconKeys, + iconColor: "gray.600", + name: "Transactions", + count: allTxsCount ?? "N/A", + onClick: () => onSelectAction(TabIndex.TxsHistories), + disabled: allTxsCount === 0, + }, + ]; + + return ( + + {actionList.map((item) => ( + + + + + + {item.name} + + + {item.count} + + + + + + ))} + + ); +}; diff --git a/src/lib/pages/module-details/components/ModuleInfo.tsx b/src/lib/pages/module-details/components/ModuleInfo.tsx index 218360a9a..372067d3e 100644 --- a/src/lib/pages/module-details/components/ModuleInfo.tsx +++ b/src/lib/pages/module-details/components/ModuleInfo.tsx @@ -85,7 +85,7 @@ const InitRender = ({ ); }; -const ModuleDetailsBody = ({ +const ModuleInfoBody = ({ moduleDetails, isLoading, upgradePolicy, @@ -173,7 +173,7 @@ export const ModuleInfo = ({ )} - + ); diff --git a/src/lib/pages/module-details/components/ModuleStruct.tsx b/src/lib/pages/module-details/components/ModuleStructs.tsx similarity index 97% rename from src/lib/pages/module-details/components/ModuleStruct.tsx rename to src/lib/pages/module-details/components/ModuleStructs.tsx index f4bdbed0f..260ee02de 100644 --- a/src/lib/pages/module-details/components/ModuleStruct.tsx +++ b/src/lib/pages/module-details/components/ModuleStructs.tsx @@ -7,10 +7,11 @@ import InputWithIcon from "lib/components/InputWithIcon"; import { StructCard } from "lib/components/module/StructCard"; import type { IndexedModule } from "lib/services/move/moduleService"; -interface ModuleStructProps { +interface ModuleStructsProps { structs: IndexedModule["parsedAbi"]["structs"]; } -export const ModuleStruct = ({ structs }: ModuleStructProps) => { + +export const ModuleStructs = ({ structs }: ModuleStructsProps) => { const [expandedIndexes, setExpandedIndexes] = useState([]); const [keyword, setKeyword] = useState(""); diff --git a/src/lib/pages/module-details/components/index.ts b/src/lib/pages/module-details/components/index.ts new file mode 100644 index 000000000..2058a7abb --- /dev/null +++ b/src/lib/pages/module-details/components/index.ts @@ -0,0 +1,6 @@ +export * from "./module-fns"; +export * from "./tables"; +export * from "./ModuleActions"; +export * from "./ModuleInfo"; +export * from "./ModuleStructs"; +export * from "./ModuleTop"; diff --git a/src/lib/pages/module-details/components/FunctionTypeSwitch.tsx b/src/lib/pages/module-details/components/module-fns/FunctionTypeSwitch.tsx similarity index 100% rename from src/lib/pages/module-details/components/FunctionTypeSwitch.tsx rename to src/lib/pages/module-details/components/module-fns/FunctionTypeSwitch.tsx diff --git a/src/lib/pages/module-details/components/ModuleFunction.tsx b/src/lib/pages/module-details/components/module-fns/ModuleFunctions.tsx similarity index 98% rename from src/lib/pages/module-details/components/ModuleFunction.tsx rename to src/lib/pages/module-details/components/module-fns/ModuleFunctions.tsx index a5aa1d3ea..b0e144023 100644 --- a/src/lib/pages/module-details/components/ModuleFunction.tsx +++ b/src/lib/pages/module-details/components/module-fns/ModuleFunctions.tsx @@ -18,7 +18,7 @@ import { getFirstQueryParam } from "lib/utils"; import { FunctionTypeSwitch, FunctionTypeTabs } from "./FunctionTypeSwitch"; -interface ModuleFunctionProps { +interface ModuleFunctionsProps { address: IndexedModule["address"]; moduleName: IndexedModule["moduleName"]; fns: IndexedModule["parsedAbi"]["exposed_functions"]; @@ -61,13 +61,13 @@ const FunctionAccordions = ({ ); -export const ModuleFunction = ({ +export const ModuleFunctions = ({ address, moduleName, fns, viewFns, executeFns, -}: ModuleFunctionProps) => { +}: ModuleFunctionsProps) => { const router = useRouter(); const navigate = useInternalNavigate(); diff --git a/src/lib/pages/module-details/components/module-fns/index.ts b/src/lib/pages/module-details/components/module-fns/index.ts new file mode 100644 index 000000000..9f4fb22ca --- /dev/null +++ b/src/lib/pages/module-details/components/module-fns/index.ts @@ -0,0 +1,2 @@ +export * from "./FunctionTypeSwitch"; +export * from "./ModuleFunctions"; diff --git a/src/lib/pages/module-details/components/tables/index.tsx b/src/lib/pages/module-details/components/tables/index.tsx index 801dc7705..eea41922a 100644 --- a/src/lib/pages/module-details/components/tables/index.tsx +++ b/src/lib/pages/module-details/components/tables/index.tsx @@ -9,6 +9,7 @@ import { import { useCallback } from "react"; import { AmpEvent, track } from "lib/amplitude"; +import { useGovConfig } from "lib/app-provider"; import { CustomTab } from "lib/components/CustomTab"; import type { HexAddr, Nullish, Option } from "lib/types"; @@ -48,6 +49,7 @@ export const ModuleTables = ({ onViewMore, }: ModuleTablesProps) => { const tableHeaderId = "moduleDetailsTableHeader"; + const gov = useGovConfig({ shouldRedirect: false }); const handleOnViewMore = useCallback( (nextTab: ModuleTablesTabIndex) => @@ -106,6 +108,7 @@ export const ModuleTables = ({ count={relatedProposalsCount} onClick={handleTabChange(ModuleTablesTabIndex.RelatedProposals)} isDisabled={relatedProposalsCount === 0} + hidden={!gov.enabled} > Related Proposals diff --git a/src/lib/pages/module-details/index.tsx b/src/lib/pages/module-details/index.tsx index 2add99339..a4bf27b2a 100644 --- a/src/lib/pages/module-details/index.tsx +++ b/src/lib/pages/module-details/index.tsx @@ -1,21 +1,10 @@ -import { - Flex, - Text, - Tabs, - TabList, - TabPanel, - TabPanels, - Heading, -} from "@chakra-ui/react"; +import { Flex, Tabs, TabList, TabPanel, TabPanels } from "@chakra-ui/react"; import { useRouter } from "next/router"; -import type { MouseEventHandler } from "react"; import { useState, useCallback, useEffect } from "react"; import { AmpEvent, track, trackUseTab } from "lib/amplitude"; import { useInternalNavigate } from "lib/app-provider"; import { CustomTab } from "lib/components/CustomTab"; -import type { IconKeys } from "lib/components/icon"; -import { CustomIcon } from "lib/components/icon"; import { Loading } from "lib/components/Loading"; import PageContainer from "lib/components/PageContainer"; import { InvalidState } from "lib/components/state"; @@ -32,31 +21,20 @@ import { useModuleTxsCount } from "lib/services/txService"; import type { MoveAccountAddr } from "lib/types"; import { getFirstQueryParam } from "lib/utils"; -import { FunctionTypeTabs } from "./components/FunctionTypeSwitch"; -import { ModuleFunction } from "./components/ModuleFunction"; -import { ModuleInfo } from "./components/ModuleInfo"; -import { ModuleStruct } from "./components/ModuleStruct"; -import { ModuleTop } from "./components/ModuleTop"; -import { ModuleTables, ModuleTablesTabIndex } from "./components/tables"; +import { + FunctionTypeTabs, + ModuleActions, + ModuleFunctions, + ModuleInfo, + ModuleStructs, + ModuleTop, + ModuleTables, + ModuleTablesTabIndex, +} from "./components"; +import { TabIndex } from "./types"; const mainTabHeaderId = "main-table-header"; -enum TabIndex { - Overview = "overview", - Function = "function", - TxsHistories = "txs-histories", - Structs = "structs", -} - -interface ActionInfo { - icon: IconKeys; - iconColor: string; - name: string; - count: number | string; - onClick: MouseEventHandler; - disabled: boolean; -} - interface ModuleDetailsBodyProps { moduleData: IndexedModule; } @@ -123,44 +101,6 @@ export const ModuleDetailsBody = ({ moduleData }: ModuleDetailsBodyProps) => { [moduleData.address, moduleData.moduleName, navigate, tab] ); - const handleActionNavigate = useCallback( - (nextTab: TabIndex, fnType?: FunctionTypeTabs) => () => { - track(AmpEvent.USE_NAVIGATING_BUTTON, { label: fnType ?? "History" }); - handleTabChange(nextTab, fnType)(); - }, - [handleTabChange] - ); - - const actionList: ActionInfo[] = [ - { - icon: "query" as IconKeys, - iconColor: "primary.main", - name: "View Functions", - count: moduleData.viewFunctions.length, - onClick: handleActionNavigate(TabIndex.Function, FunctionTypeTabs.VIEW), - disabled: moduleData.viewFunctions.length === 0, - }, - { - icon: "execute" as IconKeys, - iconColor: "accent.main", - name: "Execute Functions", - count: moduleData.executeFunctions.length, - onClick: handleActionNavigate( - TabIndex.Function, - FunctionTypeTabs.EXECUTE - ), - disabled: moduleData.executeFunctions.length === 0, - }, - { - icon: "list" as IconKeys, - iconColor: "gray.600", - name: "Transactions", - count: Number(moduleTxsCount) + Number(moduleHistoriesCount) || "N/A", - onClick: handleActionNavigate(TabIndex.TxsHistories), - disabled: Number(moduleTxsCount) + Number(moduleHistoriesCount) === 0, - }, - ]; - useEffect(() => { if (router.isReady && (!tab || !Object.values(TabIndex).includes(tab))) { navigate({ @@ -241,56 +181,24 @@ export const ModuleDetailsBody = ({ moduleData }: ModuleDetailsBodyProps) => { - - {actionList.map((item) => ( - - - - - - {item.name} - - - {item.count} - - - - - - ))} - + { + track(AmpEvent.USE_NAVIGATING_BUTTON, { + label: fnType ?? "History", + }); + handleTabChange(nextTab, fnType)(); + }} + /> { - { /> - + diff --git a/src/lib/pages/module-details/types.ts b/src/lib/pages/module-details/types.ts new file mode 100644 index 000000000..e74d21ebc --- /dev/null +++ b/src/lib/pages/module-details/types.ts @@ -0,0 +1,6 @@ +export enum TabIndex { + Overview = "overview", + Function = "function", + TxsHistories = "txs-histories", + Structs = "structs", +} From 69f4be5c1d426dec75c01d139822545c4f034306 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Wed, 20 Dec 2023 13:37:56 +0700 Subject: [PATCH 14/16] fix: comment --- src/lib/chain-registry/initiatestnet.ts | 4 ++-- src/lib/services/codeService.ts | 2 +- src/lib/services/contractService.ts | 1 + 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/chain-registry/initiatestnet.ts b/src/lib/chain-registry/initiatestnet.ts index 74c8421de..cca8aaa83 100644 --- a/src/lib/chain-registry/initiatestnet.ts +++ b/src/lib/chain-registry/initiatestnet.ts @@ -59,7 +59,7 @@ export const initiatestnet: Chain[] = [ pretty_name: "Minitia Move Devnet 1", chain_id: "minimove-1", bech32_prefix: "init", - daemon_name: "initiad", + daemon_name: "minitiad", node_home: NODE_HOME, key_algos: ["secp256k1"], slip44: 118, @@ -100,7 +100,7 @@ export const initiatestnet: Chain[] = [ pretty_name: "Minitia Wasm Devnet 1", chain_id: "miniwasm-1", bech32_prefix: "init", - daemon_name: "initiad", + daemon_name: "minitiad", node_home: NODE_HOME, key_algos: ["secp256k1"], slip44: 118, diff --git a/src/lib/services/codeService.ts b/src/lib/services/codeService.ts index 9c5899f78..841b9aa91 100644 --- a/src/lib/services/codeService.ts +++ b/src/lib/services/codeService.ts @@ -184,7 +184,7 @@ export const useCodeDataByCodeId = ({ }); }, [codeId, indexerGraphClient, isGov]); return useQuery( - [CELATONE_QUERY_KEYS.CODE_DATA_BY_ID, codeId, indexerGraphClient], + [CELATONE_QUERY_KEYS.CODE_DATA_BY_ID, codeId, indexerGraphClient, isGov], queryFn, { enabled: enabled && isCodeId(codeId), diff --git a/src/lib/services/contractService.ts b/src/lib/services/contractService.ts index 6f334778c..2a9b27bb7 100644 --- a/src/lib/services/contractService.ts +++ b/src/lib/services/contractService.ts @@ -138,6 +138,7 @@ export const useInstantiateDetailByContractQuery = ( CELATONE_QUERY_KEYS.CONTRACT_INSTANTIATE_DETAIL, contractAddress, indexerGraphClient, + isGov, ], queryFn, { From 54dc9748a41aee7616e8a56c546edc0935aa1e79 Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Wed, 20 Dec 2023 13:48:02 +0700 Subject: [PATCH 15/16] fix: count type --- src/lib/pages/module-details/components/ModuleActions.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/pages/module-details/components/ModuleActions.tsx b/src/lib/pages/module-details/components/ModuleActions.tsx index 467207374..441d03178 100644 --- a/src/lib/pages/module-details/components/ModuleActions.tsx +++ b/src/lib/pages/module-details/components/ModuleActions.tsx @@ -11,7 +11,7 @@ interface ActionInfo { icon: IconKeys; iconColor: string; name: string; - count: number | string; + count: Option; onClick: MouseEventHandler; disabled: boolean; } @@ -51,7 +51,7 @@ export const ModuleActions = ({ icon: "list" as IconKeys, iconColor: "gray.600", name: "Transactions", - count: allTxsCount ?? "N/A", + count: allTxsCount, onClick: () => onSelectAction(TabIndex.TxsHistories), disabled: allTxsCount === 0, }, @@ -92,7 +92,7 @@ export const ModuleActions = ({ {item.name} - {item.count} + {item.count ?? "N/A"} From 33fd5c3a063cf7bccd27effa5a2bc3f2385e0f9f Mon Sep 17 00:00:00 2001 From: songwongtp <16089160+songwongtp@users.noreply.github.com> Date: Wed, 20 Dec 2023 15:27:14 +0700 Subject: [PATCH 16/16] fix: add validator link for minitias --- src/config/chain/initia.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/config/chain/initia.ts b/src/config/chain/initia.ts index 19ee55913..053a8090d 100644 --- a/src/config/chain/initia.ts +++ b/src/config/chain/initia.ts @@ -97,7 +97,8 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { maxGasLimit: 25_000_000, }, explorerLink: { - validator: "", + validator: + "https://lcd.minimove-1.initia.xyz/opinit/opchild/v1/validator", proposal: "", }, extra: { disableDelegation: true }, @@ -144,7 +145,8 @@ export const INITIA_CHAIN_CONFIGS: ChainConfigs = { maxGasLimit: 25_000_000, }, explorerLink: { - validator: "", + validator: + "https://lcd.miniwasm-1.initia.xyz/opinit/opchild/v1/validator", proposal: "", }, extra: { disableDelegation: true },