diff --git a/components/chainCards.tsx b/components/chainCards.tsx index fe5fd8b..bca6449 100644 --- a/components/chainCards.tsx +++ b/components/chainCards.tsx @@ -358,6 +358,7 @@ export const ClaimInfo = ({ return; } + console.log("chainCards: ", client.walletType); // If walletType is ledger && chain is injective, use helper if (client.walletType === "metamask" && client.chain === "injective") { toast.loading("Processing your request..."); @@ -382,6 +383,7 @@ export const ClaimInfo = ({ toast.error(`Visit our Discord for assistance`); }); } else if (client.walletType === "ledger" && client.chain === "injective") { + console.log("right case"); toast.loading("Processing your request..."); ethLedgerTxHelper({ client, diff --git a/services/ledgerHelpers.ts b/services/ledgerHelpers.ts index f896be9..6e409c7 100644 --- a/services/ledgerHelpers.ts +++ b/services/ledgerHelpers.ts @@ -20,6 +20,7 @@ import { import { EthereumChainId } from "@injectivelabs/ts-types"; import { ChainSigningClient } from "../contexts/userClients"; import { bufferToHex } from 'ethereumjs-util'; +import { getInjectiveAddress } from "@injectivelabs/sdk-ts"; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Ethereum Ledger helpers for Injective @@ -55,8 +56,14 @@ export const ethLedgerTxHelper = async ({ // Get query client, don't really need batch here since creating batch requires 2 trips anyway const queryClient = await CosmWasmClient.connect(chainConfig.rpc); + // check if input address start with 0x + if (client.walletAddress.startsWith("0x")) { + client.walletAddress = getInjectiveAddress(client.walletAddress); + } + // Get account sequence of user const {accountNumber, sequence} = await queryClient.getSequence(client.walletAddress); + console.log('walletAddress: ', client.walletAddress); // Get latest block info const latestBlock = await queryClient.getBlock();