diff --git a/package.json b/package.json index 7eb5d9e18..f1e06b32d 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "@oraichain/orai-bitcoin": "2.0.0", "@oraichain/oraidex-common-ui": "1.0.11", "@oraichain/oraidex-contracts-sdk": "1.0.55", - "@oraichain/oraidex-universal-swap": "1.1.24", + "@oraichain/oraidex-universal-swap": "1.1.25", "@oraichain/ton-bridge-contracts": "^0.15.8", "@oraichain/tonbridge-contracts-sdk": "^1.3.1", "@oraichain/tonbridge-sdk": "^1.3.6", diff --git a/src/helper/index.tsx b/src/helper/index.tsx index 8e3fc2b90..d9a6ac3bc 100644 --- a/src/helper/index.tsx +++ b/src/helper/index.tsx @@ -422,21 +422,18 @@ export const getAddressTransferForEvm = async (walletByNetworks: WalletsByNetwor export const getAddressTransfer = async (network: CustomChainInfo, walletByNetworks: WalletsByNetwork) => { try { let address = ''; - if (network.networkType === 'ton') { + if (network.networkType === 'ton' && walletByNetworks.ton) { address = JSON.parse(JSON.parse(localStorage.getItem('persist:root'))?.config)?.tonAddress || toUserFriendlyAddress(window.Ton?.account?.address); - - console.log('addressTON', address); // address = useTonAddress(); } else if (network.networkType === 'evm') { address = await getAddressTransferForEvm(walletByNetworks, network); - } else if (network.networkType == ('svm' as any)) { + } else if (network.networkType == 'svm' && walletByNetworks.solana) { let provider = window?.solana; if (walletByNetworks.solana === 'owallet') { provider = window?.owalletSolana; } - const { publicKey } = await provider.connect(); address = publicKey.toBase58(); } else if (!['evm', 'svm'].includes(network.networkType) && isConnectSpecificNetwork(walletByNetworks.cosmos)) { diff --git a/src/pages/Balance/index.tsx b/src/pages/Balance/index.tsx index f35ace6aa..7c63ce0e5 100644 --- a/src/pages/Balance/index.tsx +++ b/src/pages/Balance/index.tsx @@ -684,56 +684,6 @@ const Balance: React.FC = () => { ); if (findRelayerFee) relayerFee.relayerAmount = findRelayerFee.amount; - - //------------------------------------------------------- - // FIXME: need remove after fix ibc hooks - if (from.cosmosBased && from.chainId !== 'noble-1' && to.chainId === 'Oraichain') { - const ibcInfo = UniversalSwapHelper.getIbcInfo(from.chainId as CosmosChainId, to.chainId); - if (!ibcInfo) - throw generateError(`Could not find the ibc info given the from token with coingecko id ${from.coinGeckoId}`); - - const offlineSigner = await collectWallet(from.chainId); - const client = await connectWithSigner( - from.rpc, - offlineSigner as any, - from.chainId === 'injective-1' ? 'injective' : 'cosmwasm', - { - gasPrice: GasPrice.fromString( - `${getCosmosGasPrice(from.gasPriceStep)}${from.feeCurrencies[0].coinMinimalDenom}` - ), - broadcastPollIntervalMs: 600 - } - ); - - const receiver = await handleCheckAddress(to.chainId); - const msgTransferObj = { - sourcePort: ibcInfo.source, - receiver, - sourceChannel: ibcInfo.channel, - token: coin(toAmount(fromAmount, from.decimals).toString(), from.denom), - sender: cosmosAddress, - memo: '', - timeoutTimestamp: BigInt(calculateTimeoutTimestamp(ibcInfo.timeout)) - }; - - let msgTransfer: any = MsgTransfer.fromPartial(msgTransferObj); - if (from.chainId === 'injective-1') { - msgTransfer = MsgTransferInjective.fromPartial({ - ...msgTransferObj, - timeoutTimestamp: calculateTimeoutTimestamp(ibcInfo.timeout) - }); - } - - const msgTransferEncodeObj = { - typeUrl: '/ibc.applications.transfer.v1.MsgTransfer', - value: msgTransfer - }; - - result = await client.signAndBroadcast(cosmosAddress, [msgTransferEncodeObj], 'auto'); - return processTxResult(from.rpc, result, getTransactionUrl(from.chainId, result.transactionHash)); - } - //------------------------------------------------------- - const universalSwapHandler = new UniversalSwapHandler( { sender: { cosmos: cosmosAddress, evm: latestEvmAddress, tron: tronAddress }, diff --git a/src/pages/UniversalSwap/Swap/components/SelectToken/SelectToken.tsx b/src/pages/UniversalSwap/Swap/components/SelectToken/SelectToken.tsx index 97f7a6835..99aac8c90 100644 --- a/src/pages/UniversalSwap/Swap/components/SelectToken/SelectToken.tsx +++ b/src/pages/UniversalSwap/Swap/components/SelectToken/SelectToken.tsx @@ -3,7 +3,8 @@ import { TokenItemType, truncDecimals, HMSTR_ORAICHAIN_DENOM, - DOGE_BNB_ORAICHAIN_DENOM + DOGE_BNB_ORAICHAIN_DENOM, + MAX_ORAICHAIN_DENOM } from '@oraichain/oraidex-common'; import IconoirCancel from 'assets/icons/iconoir_cancel.svg?react'; import NoResultDark from 'assets/images/no-result-dark.svg?react'; @@ -84,6 +85,7 @@ export default function SelectToken({ (textSearch ? item.name.toLowerCase().includes(textSearch.toLowerCase()) : true) ); + const prioritizeToken = MAX_ORAICHAIN_DENOM; return ( <>
@@ -156,10 +158,10 @@ export default function SelectToken({ }) .sort((a, b) => { const balanceDelta = Number(b.usd) - Number(a.usd); - if (a.denom === DOGE_BNB_ORAICHAIN_DENOM && b.denom !== DOGE_BNB_ORAICHAIN_DENOM) { - return -1; // Push PepePoolKey elements to the top + if (a.denom === prioritizeToken && b.denom !== prioritizeToken) { + return -1; // Push max elements to the top } - if (a.denom !== DOGE_BNB_ORAICHAIN_DENOM && b.denom === DOGE_BNB_ORAICHAIN_DENOM) { + if (a.denom !== prioritizeToken && b.denom === prioritizeToken) { return 1; // Keep non-'a' elements below 'a' } diff --git a/yarn.lock b/yarn.lock index 9ae670505..3b721cf33 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3895,10 +3895,10 @@ resolved "https://registry.yarnpkg.com/@oraichain/oraidex-contracts-sdk/-/oraidex-contracts-sdk-1.0.45.tgz#42dae0fdd9e005f920ba305b987009f791acc365" integrity sha512-/nYztdxEX5LQM4DMJQmi9HvZrBVoY3nLAmYqSKZGZ0U1h1SxU7O/o22R3/pQwB+sAJdcibaI8ygC0ov7jC8paA== -"@oraichain/oraidex-universal-swap@1.1.24": - version "1.1.24" - resolved "https://registry.yarnpkg.com/@oraichain/oraidex-universal-swap/-/oraidex-universal-swap-1.1.24.tgz#9426b498dbc24493627f47ee9ee102e115841202" - integrity sha512-dhRy5ZC/ieverax4wJBuOBcziFWMgfunrkEo0pI3dMHyDAbcnAQojrUXhJpjXPPXtDhnvl1Jk5xlE+XE3FDzWA== +"@oraichain/oraidex-universal-swap@1.1.25": + version "1.1.25" + resolved "https://registry.yarnpkg.com/@oraichain/oraidex-universal-swap/-/oraidex-universal-swap-1.1.25.tgz#0533d07ec69ded862152d2376d8bd42b08588b7b" + integrity sha512-1XbRS/OvI+I0dx45okOsQAqNiuRaD2n5omO1xvitQFtv6bZ1NW3wJRdgI10Y7pTz6FE7DPlvP6CB4aj24W8fbQ== dependencies: "@oraichain/common" "^1.2.4" "@oraichain/oraidex-common" "^1.1.27"