Skip to content

Commit

Permalink
Merge pull request #15 from oraichain/feat/usdc
Browse files Browse the repository at this point in the history
Feat/usdc
  • Loading branch information
perfogic authored Sep 9, 2024
2 parents 9714b10 + b53cea0 commit a298c73
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions constants/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ export const TonTokenList = (network: Environment): TokenType[] => [
...(TonTokensContract[network as Environment.Mainnet]?.jUSDC
? [
{
name: "USD Coin",
symbol: "USDC",
name: "Jetton USDC",
symbol: "jUSDC",
Icon: UsdcIcon,
contractAddress:
TonTokensContract[network as Environment.Mainnet]?.jUSDC,
Expand Down
16 changes: 11 additions & 5 deletions helper/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import {
TonWallet,
} from "@/stores/authentication/useAuthenticationStore";
import { Environment } from "@/constants/ton";
import { Jersey_10 } from "next/font/google";

export interface Tokens {
denom?: string;
Expand Down Expand Up @@ -640,15 +641,20 @@ export const getAddressByEIP191 = async (isSwitchWallet?: boolean) => {
return accounts[0].address;
};

export const retryOrbs = async (fn, delay = 1000) => {
export const retryOrbs = async (fn, retryTimes = 30, delay = 2000) => {
try {
await fn();
return await fn();
} catch (error) {
let response = error?.response;
let message = response?.data?.error;
if (message.includes("No working liteservers")) {
await sleep(delay);
await retryOrbs(fn, delay);
if (retryTimes <= 0) {
return;
}
if (message?.includes("No working liteservers")) {
await sleep(delay * 2);
return await retryOrbs(fn, retryTimes, delay);
}
await sleep(delay * 5);
return await retryOrbs(fn, retryTimes - 1, delay);
}
};

0 comments on commit a298c73

Please sign in to comment.