From 7643ebce55f898c73258a165f016c6e5055eec7d Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Wed, 13 Sep 2023 17:19:59 +0800 Subject: [PATCH] get chain-id --- src/modules/wallet/suggest.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/wallet/suggest.vue b/src/modules/wallet/suggest.vue index 84f6aca5..818262d5 100644 --- a/src/modules/wallet/suggest.vue +++ b/src/modules/wallet/suggest.vue @@ -95,8 +95,14 @@ async function initParamsForKeplr() { async function initSnap() { const chain = selected.value const [token] = chain.assets + + if(!chain.endpoints?.rest?.at(0)) throw new Error("Endpoint does not set"); + const client = CosmosRestClient.newDefault(chain.endpoints.rest?.at(0)?.address || "") + const b = await client.getBaseBlockLatest() + const chainId = b.block.header.chain_id + conf.value = JSON.stringify({ - chainId: chain.chainId, + chainId, chainName: chain.chainName, bech32Config: { bech32PrefixAccAddr: chain.bech32Prefix,