From a63bda05de777f7e253fe1581306f20f1308d1f8 Mon Sep 17 00:00:00 2001 From: Griko Nibras Date: Mon, 5 Feb 2024 12:38:25 +0700 Subject: [PATCH] feat: handle stride account parsing Signed-off-by: Griko Nibras --- src/utils/clients.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/utils/clients.ts b/src/utils/clients.ts index 0398fb06..bda31a4b 100644 --- a/src/utils/clients.ts +++ b/src/utils/clients.ts @@ -1,5 +1,6 @@ import { CosmWasmClient } from "@cosmjs/cosmwasm-stargate"; -import { StargateClient } from "@cosmjs/stargate"; +import { AccountParser, StargateClient } from "@cosmjs/stargate"; +import { strideAccountParser } from "stridejs"; import { ChainId, chainIdToName } from "@/chains/types"; @@ -20,7 +21,14 @@ export async function getStargateClientForChainID(chainID: ChainId) { const preferredEndpoint = getNodeProxyEndpoint(chainID); - const client = await StargateClient.connect(preferredEndpoint, {}); + let accountParser: AccountParser | undefined; + if (chainID.includes("stride")) { + accountParser = strideAccountParser; + } + + const client = await StargateClient.connect(preferredEndpoint, { + accountParser, + }); STARGATE_CLIENTS[chainID] = client;