diff --git a/constants/error-message.ts b/constants/error-message.ts index aacdbf4..3e06c04 100644 --- a/constants/error-message.ts +++ b/constants/error-message.ts @@ -26,8 +26,8 @@ export const INVALID_REFERRAL_MESSAGE = export const TOO_MANY_CHAINS_IN_LEDGER_ERROR = "Output buffer too small"; export const TOO_MANY_CHAINS_IN_LEDGER_MESSAGE = - "Maximum 20 chains can be linked at a time on Ledger hardware wallet. Unselect some chains and try again."; + "Due to hardware constraints, limited number of chains can be linked at a time(1-2 on Ledger Nano S / 25 on Ledger Nano S+/X). Please select less chains and try again."; export const EVM_CHAIN_IN_LEDGER_ERROR = "Ledger is unsupported for this chain"; export const EVM_CHAIN_IN_LEDGER_MESSAGE = - "Ledger is unsupported for this chain. Remove EVM-based Cosmos SDK chains and try again."; + "ICNS for Cosmos chains using Ethereum/EVM keys are not supported. Remove EVM-based Cosmos SDK chains and try again."; diff --git a/pages/complete/index.tsx b/pages/complete/index.tsx index 33f9c3c..24171f0 100644 --- a/pages/complete/index.tsx +++ b/pages/complete/index.tsx @@ -11,11 +11,10 @@ import AlertCircleOutlineIcon from "../../public/images/svg/alert-circle-outline import { useRouter } from "next/router"; import { useEffect, useState } from "react"; -import { TendermintTxTracer } from "@keplr-wallet/cosmos"; import { queryAddressesFromTwitterName } from "../../queries"; import { RegisteredAddresses } from "../../types"; import { SHARE_URL } from "../../constants/twitter"; -import { RPC_URL } from "../../constants/icns"; +import { REST_URL, RPC_URL } from "../../constants/icns"; export default function CompletePage() { const router = useRouter(); @@ -35,19 +34,33 @@ export default function CompletePage() { }, [router.query]); const initialize = async (txHash: string, twitterUserName: string) => { - const txTracer = new TendermintTxTracer(RPC_URL, "/websocket"); - try { - const result: { code?: number } = await txTracer.traceTx( - Buffer.from(txHash, "hex"), - ); + for (let i = 0; i < 20; i++) { + // Try to fetch tx response per 3sec, 20times. + await new Promise((resolve) => setTimeout(resolve, 3000)); - if (!result.code || result.code === 0) { - amplitude.track("complete registration"); + const res = await fetch(`${REST_URL}/cosmos/tx/v1beta1/txs/${txHash}`); - const addresses = await queryAddressesFromTwitterName(twitterUserName); - setRegisteredAddressed(addresses.data.addresses); - setIsSuccess(true); + if (res.ok && res.status === 200) { + const txRes = await res.json(); + + if (txRes && txRes.tx_response) { + if ( + txRes.tx_response.code == null || + txRes.tx_response.code === 0 + ) { + amplitude.track("complete registration"); + + const addresses = await queryAddressesFromTwitterName( + twitterUserName, + ); + setRegisteredAddressed(addresses.data.addresses); + setIsSuccess(true); + + break; + } + } + } } } catch (e) { console.log("error", e); diff --git a/pages/verification/index.tsx b/pages/verification/index.tsx index 8814a58..9c2bfe7 100644 --- a/pages/verification/index.tsx +++ b/pages/verification/index.tsx @@ -131,6 +131,12 @@ export default function VerificationPage() { return true; } + if (walletKey) { + if (walletKey.isLedgerNano && chain.isEthermintLike) { + return true; + } + } + for (const registeredChain of registeredChainList) { if ( chain.prefix === registeredChain.bech32_prefix && @@ -218,6 +224,8 @@ export default function VerificationPage() { ); setRegisteredChainList(addressesQueryResponse.data.addresses); + } else { + setRegisteredChainList([]); } } catch (error) { if (error instanceof Error) {