Skip to content

Commit

Permalink
fix: token list
Browse files Browse the repository at this point in the history
  • Loading branch information
quangdz1704 committed Jul 19, 2024
1 parent 7117186 commit aac4f6c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
42 changes: 23 additions & 19 deletions components/page/bridge/hooks/useGetFee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,34 @@ const useGetFee = ({ token }: { token: TokenType }) => {

useEffect(() => {
(async () => {
if (token) {
const tokenInTon = TonTokenList(TonNetwork.Mainnet).find(
(tk) => tk.coingeckoId === token.coingeckoId
);
if (!tokenInTon) {
return;
}
try {
if (token) {
const tokenInTon = TonTokenList(TonNetwork.Mainnet).find(
(tk) => tk.coingeckoId === token.coingeckoId
);
if (!tokenInTon) {
return;
}

const tonBridgeClient = new TonbridgeBridgeClient(
window.client,
oraiAddress,
network.CW_TON_BRIDGE
);
const tonBridgeClient = new TonbridgeBridgeClient(
window.client,
oraiAddress,
network.CW_TON_BRIDGE
);

const tokenFeeConfig = await tonBridgeClient.tokenFee({
remoteTokenDenom: tokenInTon?.contractAddress,
});
const tokenFeeConfig = await tonBridgeClient.tokenFee({
remoteTokenDenom: tokenInTon?.contractAddress,
});

if (tokenFeeConfig) {
const { nominator, denominator } = tokenFeeConfig;
const fee = new BigDecimal(nominator).div(denominator).toNumber();
if (tokenFeeConfig) {
const { nominator, denominator } = tokenFeeConfig;
const fee = new BigDecimal(nominator).div(denominator).toNumber();

setTokenFee(fee);
setTokenFee(fee);
}
}
} catch (error) {
console.log("error", error);
}
})();
}, [token, oraiAddress]);
Expand Down
2 changes: 1 addition & 1 deletion constants/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ export const network = {
multicall: MULTICALL_CONTRACT,
explorer: "https://scan.orai.io",
CW_TON_BRIDGE:
"orai18lppnh7nwfnstpsewe70aql2qnmnm6kwkdcfe3j84ujtwzn89afqjp4pyr",
"orai159l8l9c5ckhqpuwdfgs9p4v599nqt3cjlfahalmtrhfuncnec2ms5mz60e",
};
2 changes: 1 addition & 1 deletion constants/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const OraichainTokenList: TokenType[] = [
export const TonTokenList = (network: TonNetwork): TokenType[] => [
{
name: "Tether",
symbol: "USDT",
symbol: "jUSDT",
Icon: UsdtIcon,
contractAddress: TonTokensContract[network].usdt,
denom: "ton20_usdt",
Expand Down

0 comments on commit aac4f6c

Please sign in to comment.