Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add 0x convert back #49

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions components/chainCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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...");
Expand All @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions services/ledgerHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down