diff --git a/package.json b/package.json index 1eb1cb680..6c6aebca9 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "@oraichain/kawaiiverse-txs": "^0.0.3", "@oraichain/orai-bitcoin": "2.0.0", "@oraichain/oraidex-common": "2.0.6", - "@oraichain/orai-token-inspector": "^0.2.7", + "@oraichain/orai-token-inspector": "^0.2.8", "@oraichain/oraidex-common-ui": "1.0.11", "@oraichain/oraidex-contracts-sdk": "1.0.55", "@oraichain/oraidex-universal-swap": "1.3.1", @@ -170,7 +170,7 @@ "axios": "0.26.1", "@sentry/react": "7.99.0", "@cosmjs/amino": "0.32.4", - "@oraichain/oraidex-common": "2.0.9", + "@oraichain/oraidex-common": "2.0.10", "@oraichain/common": "1.2.8" }, "overrides": { diff --git a/src/helper/index.tsx b/src/helper/index.tsx index 458ef51dc..f213dcf8c 100644 --- a/src/helper/index.tsx +++ b/src/helper/index.tsx @@ -124,7 +124,7 @@ export const getTransactionUrl = (chainId: NetworkChainId, transactionHash: stri case 'kawaii_6886-1': return `${KWT_SCAN}/tx/${transactionHash}`; case 'Oraichain': - return `${network.explorer}/txs/${transactionHash}`; + return `${network.explorer}/tx/${transactionHash}`; } return null; } diff --git a/src/pages/Balance/TransferConvertToken/index.tsx b/src/pages/Balance/TransferConvertToken/index.tsx index 5482a3eb7..6e5645561 100644 --- a/src/pages/Balance/TransferConvertToken/index.tsx +++ b/src/pages/Balance/TransferConvertToken/index.tsx @@ -114,20 +114,8 @@ const TransferConvertToken: FC = ({ if (!isValid) return; setTransferLoading(true); - // if on the same kwt network => we convert between native & erc20 tokens - if (token.chainId === 'kawaii_6886-1') { - // [KWT, MILKY] from Kawaiiverse => [KWT, MILKY] Oraichain - if (toNetworkChainId === 'Oraichain') { - return await onClickTransfer(convertAmount, toNetworkChainId); - } - await convertKwt(convertAmount, token); - return; - } - // [KWT, MILKY] from ORAICHAIN -> KWT_CHAIN || from EVM token -> ORAICHAIN. - if ( - evmChains.find((chain) => chain.chainId === token.chainId) || - (token.chainId === 'Oraichain' && toNetworkChainId === 'kawaii_6886-1') - ) { + // from EVM token -> ORAICHAIN. + if (evmChains.find((chain) => chain.chainId === token.chainId)) { await onClickTransfer(convertAmount, toNetworkChainId); return; } diff --git a/src/pages/Balance/hooks/useGetFeeSol.ts b/src/pages/Balance/hooks/useGetFeeSol.ts index 29dfad5fa..339431920 100644 --- a/src/pages/Balance/hooks/useGetFeeSol.ts +++ b/src/pages/Balance/hooks/useGetFeeSol.ts @@ -1,7 +1,7 @@ import { BigDecimal, solChainId, toAmount, toDisplay, TokenItemType } from '@oraichain/oraidex-common'; import axios from 'axios'; import { useDebounce } from 'hooks/useDebounce'; -import { flattenTokens } from 'initCommon'; +import { flattenTokens, solTokens } from 'initCommon'; import { useEffect, useState } from 'react'; export enum Direction { @@ -11,7 +11,12 @@ export enum Direction { export enum SUPPORT_TOKEN { ORAI = 'orai', - MAX = 'max' + MAX = 'max', + RACKS = 'racks', + GNRT = 'gnrt', + LEE = 'lee', + MOOBS = 'moobs', + CRISIS = 'crisis' } const useGetFeeSol = ({ @@ -38,6 +43,10 @@ const useGetFeeSol = ({ const [solFee, setSolFee] = useState(defaultSolFee); + const getSupportToken = (denom) => { + return denom?.toLowerCase(); + }; + useEffect(() => { (async () => { try { @@ -50,8 +59,9 @@ const useGetFeeSol = ({ const amount: string = toAmount(debouncedAmountToken, originalFromToken.decimals).toString(); const direction: Direction = toChainId === solChainId ? Direction.ORAI_TO_SOLANA : Direction.SOLANA_TO_ORAI; - const supportedToken: SUPPORT_TOKEN = - originalFromToken.coinGeckoId === 'oraichain-token' ? SUPPORT_TOKEN.ORAI : SUPPORT_TOKEN.MAX; + // const supportedToken: SUPPORT_TOKEN = + // originalFromToken.coinGeckoId === 'oraichain-token' ? SUPPORT_TOKEN.ORAI : SUPPORT_TOKEN.MAX; + const supportedToken: SUPPORT_TOKEN = getSupportToken(originalFromToken.name); const baseURL = `https://solana-relayer.orai.io`; const url: string = `${baseURL}/fee?direction=${direction}&amount=${amount}&supportedToken=${supportedToken}`; diff --git a/src/pages/Pools/components/AddLiquidityModal/AddLiquidityModal.tsx b/src/pages/Pools/components/AddLiquidityModal/AddLiquidityModal.tsx index 00969f35c..c9fd4d17f 100644 --- a/src/pages/Pools/components/AddLiquidityModal/AddLiquidityModal.tsx +++ b/src/pages/Pools/components/AddLiquidityModal/AddLiquidityModal.tsx @@ -140,7 +140,7 @@ export const AddLiquidityModal: FC = ({ isOpen, close, onLiquidityCh if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); } }; @@ -225,7 +225,7 @@ export const AddLiquidityModal: FC = ({ isOpen, close, onLiquidityCh if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); const amountUsdt = Number(toAmount(getUsd(baseAmount, token1, prices) * 2)); @@ -294,7 +294,7 @@ export const AddLiquidityModal: FC = ({ isOpen, close, onLiquidityCh if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); const amountUsdt = Number(toAmount(getUsd(baseAmount, token1, prices) * 2)); diff --git a/src/pages/Pools/components/Earning/Earning.tsx b/src/pages/Pools/components/Earning/Earning.tsx index 0d00a3e7c..708893bad 100644 --- a/src/pages/Pools/components/Earning/Earning.tsx +++ b/src/pages/Pools/components/Earning/Earning.tsx @@ -135,7 +135,7 @@ export const Earning = ({ onLiquidityChange }: { onLiquidityChange: () => void } if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); onBondingAction(); } diff --git a/src/pages/Pools/components/Header/Header.tsx b/src/pages/Pools/components/Header/Header.tsx index d2c837265..2974f344b 100644 --- a/src/pages/Pools/components/Header/Header.tsx +++ b/src/pages/Pools/components/Header/Header.tsx @@ -26,11 +26,11 @@ export const useGetOraiPrice = () => { (pool) => pool.firstAssetInfo === JSON.stringify(ORAI_INFO) && pool.secondAssetInfo === - JSON.stringify({ - token: { - contract_addr: USDT_CONTRACT - } - }) + JSON.stringify({ + token: { + contract_addr: USDT_CONTRACT + } + }) ); if (!oraiUsdtPool) return; @@ -99,11 +99,11 @@ export const Header: FC<{ dataSource: PoolInfoResponse[] }> = ({ dataSource }) = .filter((rewardInfo) => rewardInfo.pending_reward !== '0' || rewardInfo.pending_withdraw?.length > 0) .map( (rewardInfo) => - ({ - contractAddress: network.staking, - msg: { withdraw: { staking_token: rewardInfo.staking_token } }, - funds: null - } as ExecuteInstruction) + ({ + contractAddress: network.staking, + msg: { withdraw: { staking_token: rewardInfo.staking_token } }, + funds: null + } as ExecuteInstruction) ); const result = await CosmJs.executeMultiple({ @@ -114,7 +114,7 @@ export const Header: FC<{ dataSource: PoolInfoResponse[] }> = ({ dataSource }) = if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); refetchRewardInfo(); } diff --git a/src/pages/Pools/components/StakeLPModal/StakeLPModal.tsx b/src/pages/Pools/components/StakeLPModal/StakeLPModal.tsx index c86d04f97..be09eb97b 100644 --- a/src/pages/Pools/components/StakeLPModal/StakeLPModal.tsx +++ b/src/pages/Pools/components/StakeLPModal/StakeLPModal.tsx @@ -80,7 +80,7 @@ export const StakeLPModal: FC = ({ isOpen, close, open, myLpBalance, }); if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); onBonedSuccess(); } diff --git a/src/pages/Pools/components/UnstakeLPModal/UnstakeLPModal.tsx b/src/pages/Pools/components/UnstakeLPModal/UnstakeLPModal.tsx index 3c8005f56..78a8a8db0 100644 --- a/src/pages/Pools/components/UnstakeLPModal/UnstakeLPModal.tsx +++ b/src/pages/Pools/components/UnstakeLPModal/UnstakeLPModal.tsx @@ -81,7 +81,7 @@ export const UnstakeLPModal: FC = ({ isOpen, close, open, onLiquidit }); if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); onUnbonedSuccess(); } diff --git a/src/pages/Pools/components/WithdrawLiquidityModal/WithdrawLiquidityModal.tsx b/src/pages/Pools/components/WithdrawLiquidityModal/WithdrawLiquidityModal.tsx index 3c4830567..4f313aaf4 100644 --- a/src/pages/Pools/components/WithdrawLiquidityModal/WithdrawLiquidityModal.tsx +++ b/src/pages/Pools/components/WithdrawLiquidityModal/WithdrawLiquidityModal.tsx @@ -70,7 +70,7 @@ export const WithdrawLiquidityModal: FC = ({ if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); setLpAmountBurn(0n); onLiquidityChange(-lpAmountBurnUsdt); diff --git a/src/pages/Staking/components/StakeInfo/index.tsx b/src/pages/Staking/components/StakeInfo/index.tsx index 0dc2b7751..a557bb28f 100644 --- a/src/pages/Staking/components/StakeInfo/index.tsx +++ b/src/pages/Staking/components/StakeInfo/index.tsx @@ -79,7 +79,7 @@ const StakeInfo = () => { if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); loadOraichainToken(address, [USDC_TOKEN_INFO.contractAddress]); refetchMyStakeRewardInfo(); @@ -150,7 +150,7 @@ const StakeInfo = () => { if (result) { console.log('in correct result'); displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); loadOraichainToken(address, [USDC_TOKEN_INFO.contractAddress, ORAIX_TOKEN_INFO.contractAddress]); diff --git a/src/pages/Staking/components/StakeTab/index.tsx b/src/pages/Staking/components/StakeTab/index.tsx index 4ae80414d..a4bc9102f 100644 --- a/src/pages/Staking/components/StakeTab/index.tsx +++ b/src/pages/Staking/components/StakeTab/index.tsx @@ -51,7 +51,7 @@ const StakeTab = () => { }); if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); refetchMyStakeRewardInfo(); diff --git a/src/pages/Staking/components/UnStakeTab/index.tsx b/src/pages/Staking/components/UnStakeTab/index.tsx index 1ac46dbe7..16705ee05 100644 --- a/src/pages/Staking/components/UnStakeTab/index.tsx +++ b/src/pages/Staking/components/UnStakeTab/index.tsx @@ -68,7 +68,7 @@ const UnStakeTab = () => { if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); refetchStakeInfo(); refetchMyStakeRewardInfo(); @@ -97,7 +97,7 @@ const UnStakeTab = () => { if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); refetchStakeInfo(); @@ -125,7 +125,7 @@ const UnStakeTab = () => { if (result) { displayToast(TToastType.TX_SUCCESSFUL, { - customLink: `${network.explorer}/txs/${result.transactionHash}` + customLink: `${network.explorer}/tx/${result.transactionHash}` }); refetchStakeInfo(); @@ -252,7 +252,7 @@ const UnStakeTab = () => { } Icon={theme === 'light' ? ConfirmIconLight : ConfirmIcon} title="Unstaking confirmation" - // showIcon={false} + // showIcon={false} /> ); diff --git a/src/tests/bridge.spec.ts b/src/tests/bridge.spec.ts index a0b175059..bb82d6543 100644 --- a/src/tests/bridge.spec.ts +++ b/src/tests/bridge.spec.ts @@ -6,7 +6,8 @@ import { ETHEREUM_SCAN, getEncodedExecuteContractMsgs, IBC_WASM_CONTRACT, - ibcInfos, ibcInfosOld, + ibcInfos, + ibcInfosOld, INJECTIVE_ORAICHAIN_DENOM, KWT_BSC_CONTRACT, KWT_DENOM, @@ -180,7 +181,7 @@ describe('bridge', () => { ['0x38', '0x', `${BSC_SCAN}/tx/0x`], ['0x01', '0x', `${ETHEREUM_SCAN}/tx/0x`], ['0x2b6653dc', '0x1234', `${TRON_SCAN}/#/transaction/1234`], - ['Oraichain', '0x', `${network.explorer}/txs/0x`] + ['Oraichain', '0x', `${network.explorer}/tx/0x`] ])( 'bridge-test-get-transaciton-url given chainId %s should give expected URL %s', (chainId: NetworkChainId, transactionHash: any, expectedUrl: string) => { diff --git a/yarn.lock b/yarn.lock index b254be2e0..535cc6805 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3924,10 +3924,10 @@ serialize-error "^8.1.0" varuint-bitcoin "^1.1.2" -"@oraichain/orai-token-inspector@^0.2.7": - version "0.2.7" - resolved "https://registry.yarnpkg.com/@oraichain/orai-token-inspector/-/orai-token-inspector-0.2.7.tgz#df68625065c702a4e6d8e52c91786e8d5cfbf325" - integrity sha512-TAPqrNtu+lj9l8EtWEMGtmNXZ6JYjm/QTa4NhbzjDQtH6UH6PkziRLD+WWnynxq0pnLfXd+Kvsn1Mm7LjyHERQ== +"@oraichain/orai-token-inspector@^0.2.8": + version "0.2.8" + resolved "https://registry.yarnpkg.com/@oraichain/orai-token-inspector/-/orai-token-inspector-0.2.8.tgz#98165d55c99ed3d891c966a49f7d0ab8edb8e135" + integrity sha512-CBTebtuJbjadDMrpqO0iwaXcq3RWWWpmRWNuwfHx2AWI74TbgUScri+k9tB2t7YQoIPtYjGidh5pnsESV5ImMg== dependencies: "@keplr-wallet/types" "0.12.141" "@metaplex-foundation/mpl-token-metadata" "^3.3.0" @@ -3960,10 +3960,10 @@ react-use "^17.4.0" react-use-websocket "^4.5.0" -"@oraichain/oraidex-common@2.0.5", "@oraichain/oraidex-common@2.0.8", "@oraichain/oraidex-common@2.0.9", "@oraichain/oraidex-common@^1.1.6": - version "2.0.9" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-2.0.9.tgz#5edbcd5f74dc3490df95428248ddecbae2a73a70" - integrity sha512-07LeP7E4SFhVG4dv6Nf1TT8s8ECfXe3bSt+dNGa1sLo58gDGcBKNPZjDxPhwwYdaugeq8rXuuyEhrUFCX1PzZA== +"@oraichain/oraidex-common@2.0.10", "@oraichain/oraidex-common@2.0.5", "@oraichain/oraidex-common@2.0.8", "@oraichain/oraidex-common@^1.1.6": + version "2.0.10" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-common/-/oraidex-common-2.0.10.tgz#eb718634bdb88a15ffa0dac241ffd77b06d0911c" + integrity sha512-1JGYuW/A/l0qLL+px1MTXh2zkfvQ877p7rE40zqQh7pddI5xX2WYrUfD/ZgrKuHzgX/RRE4Rv/fSUqRSRj9wbQ== dependencies: "@cosmjs/amino" "^0.32.4" "@cosmjs/cosmwasm-stargate" "^0.32.4" @@ -16836,7 +16836,7 @@ string-env-interpolation@^1.0.1: resolved "https://registry.yarnpkg.com/string-env-interpolation/-/string-env-interpolation-1.0.1.tgz#ad4397ae4ac53fe6c91d1402ad6f6a52862c7152" integrity sha512-78lwMoCcn0nNu8LszbP1UA7g55OeE4v7rCeWnM5B453rnNr4aq+5it3FEYtZrSEiMvHZOZ9Jlqb0OD0M2VInqg== -"string-width-cjs@npm:string-width@^4.2.0": +"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -16854,15 +16854,6 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -16891,7 +16882,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -16912,13 +16903,6 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -18322,7 +18306,7 @@ wordwrapjs@^5.1.0: resolved "https://registry.yarnpkg.com/wordwrapjs/-/wordwrapjs-5.1.0.tgz#4c4d20446dcc670b14fa115ef4f8fd9947af2b3a" integrity sha512-JNjcULU2e4KJwUNv6CHgI46UvDGitb6dGryHajXTDiLgg1/RiGoPSDw4kZfYnwGtEXf2ZMeIewDQgFGzkCB2Sg== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -18349,15 +18333,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"