Skip to content

Commit

Permalink
AccountActivationModal에서 nonce fetch를 여러번 시도하도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
Thunnini committed Oct 8, 2024
1 parent cd367f2 commit bab6c77
Showing 1 changed file with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
import { InExtensionMessageRequester } from "@keplr-wallet/router-extension";
import { BACKGROUND_PORT } from "@keplr-wallet/router";
import { FeeControl } from "../input/fee-control";
import { ExtensionKVStore } from "@keplr-wallet/common";
import { ExtensionKVStore, sleep } from "@keplr-wallet/common";
import { CoinPretty, Dec } from "@keplr-wallet/unit";
import { num } from "starknet";
import { useNotification } from "../../../../hooks/notification";
Expand Down Expand Up @@ -330,11 +330,28 @@ export const AccountActivationModal: FunctionComponent<{
}),
""
);

const starknetQueries =
starknetQueriesStore.get(chainId);
starknetQueries.queryAccountNonce
.getNonce(account.starknetHexAddress)
.fetch();

(async () => {
// tx commit 이후의 state sync 시점이 이싱해서 일단 성공할때까지 2초 쉬면서 refresh 해본다.
const maxRetry = 15;
let retry = 0;
while (retry < maxRetry) {
const res = await starknetQueries.queryAccountNonce
.getNonce(account.starknetHexAddress)
.waitFreshResponse();
if (res?.data) {
break;
}

retry++;

await sleep(2000);
}
})();

if (feeConfig.fee != null) {
starknetQueries.queryStarknetERC20Balance
.getBalance(
Expand Down

0 comments on commit bab6c77

Please sign in to comment.