From 1b66f598ab99f20a76ebaa559f589c4bd35cf6a1 Mon Sep 17 00:00:00 2001 From: dogemos <42988601+dogemos@users.noreply.github.com> Date: Wed, 21 Dec 2022 01:46:52 +0900 Subject: [PATCH 1/4] Make error message clearer --- constants/error-message.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/constants/error-message.ts b/constants/error-message.ts index aacdbf4..39b9f11 100644 --- a/constants/error-message.ts +++ b/constants/error-message.ts @@ -30,4 +30,4 @@ export const TOO_MANY_CHAINS_IN_LEDGER_MESSAGE = 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."; From 1536977473a0077a084b32134fb5ba57c609bafe Mon Sep 17 00:00:00 2001 From: Thunnini Date: Wed, 21 Dec 2022 01:55:40 +0900 Subject: [PATCH 2/4] Fix a bug related to evm chain and ledger --- pages/verification/index.tsx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pages/verification/index.tsx b/pages/verification/index.tsx index 8f9bda7..5031fba 100644 --- a/pages/verification/index.tsx +++ b/pages/verification/index.tsx @@ -127,6 +127,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 && @@ -214,6 +220,8 @@ export default function VerificationPage() { ); setRegisteredChainList(addressesQueryResponse.data.addresses); + } else { + setRegisteredChainList([]); } } catch (error) { if (error instanceof Error) { From d69cedd105ca8ca3f9086f4ec5d86a238bfd0f9b Mon Sep 17 00:00:00 2001 From: Thunnini Date: Wed, 21 Dec 2022 02:12:10 +0900 Subject: [PATCH 3/4] Pooling tx response by interval --- pages/complete/index.tsx | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) 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); From 8c2d4903c8090fca561bccbfe83266e662839ff3 Mon Sep 17 00:00:00 2001 From: HeesungB Date: Wed, 21 Dec 2022 03:34:07 +0900 Subject: [PATCH 4/4] Fix ledger chain count error message --- constants/error-message.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/constants/error-message.ts b/constants/error-message.ts index 39b9f11..3e06c04 100644 --- a/constants/error-message.ts +++ b/constants/error-message.ts @@ -26,7 +26,7 @@ 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 =