Skip to content

Commit

Permalink
get chain-id
Browse files Browse the repository at this point in the history
  • Loading branch information
liangping committed Sep 13, 2023
1 parent b0ebf40 commit 7643ebc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/modules/wallet/suggest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 7643ebc

Please sign in to comment.