diff --git a/package.json b/package.json index 4425fd40589..c87c82b956c 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "@rabby-wallet/rabby-action": "0.1.4", "@rabby-wallet/rabby-api": "0.8.3", "@rabby-wallet/rabby-security-engine": "2.0.7", - "@rabby-wallet/rabby-swap": "0.0.40", + "@rabby-wallet/rabby-swap": "0.0.42", "@rabby-wallet/widgets": "1.0.9", "@rematch/core": "2.2.0", "@rematch/select": "3.1.2", diff --git a/src/constant/index.ts b/src/constant/index.ts index 2a0fe6f872e..eb673d2b050 100644 --- a/src/constant/index.ts +++ b/src/constant/index.ts @@ -1480,6 +1480,12 @@ export const DEX = { name: 'Odos', chains: DEX_SUPPORT_CHAINS[DEX_ENUM.ODOS], }, + [DEX_ENUM.ZEROXAPIV2]: { + id: DEX_ENUM.ZEROXAPIV2, + logo: Logo0X, + name: '0x', + chains: DEX_SUPPORT_CHAINS[DEX_ENUM.ZEROXAPIV2], + }, }; export const DEX_WITH_WRAP = { diff --git a/src/ui/views/Swap/Component/History.tsx b/src/ui/views/Swap/Component/History.tsx index c393ad24798..f9a53597b0b 100644 --- a/src/ui/views/Swap/Component/History.tsx +++ b/src/ui/views/Swap/Component/History.tsx @@ -2,7 +2,6 @@ import { Popup, TokenWithChain } from '@/ui/component'; import React, { forwardRef, useMemo } from 'react'; import { useSwapHistory } from '../hooks'; import { SwapItem, TokenItem } from '@rabby-wallet/rabby-api/dist/types'; -import { CHAINS_LIST } from '@debank/common'; import { formatAmount, formatUsdValue, openInTab, sinceTime } from '@/ui/utils'; import { getTokenSymbol } from '@/ui/utils/token'; import { TooltipWithMagnetArrow } from '@/ui/component/Tooltip/TooltipWithMagnetArrow'; @@ -81,7 +80,10 @@ const Transaction = forwardRef( const isPending = data.status === 'Pending'; const isCompleted = data?.status === 'Completed'; const time = data?.finished_at || data?.create_at; - const targetDex = DEX?.[data?.dex_id]?.name || data?.dex_id || ''; + const targetDex = + data?.dex_id === '0xV2' + ? '0x' + : DEX?.[data?.dex_id]?.name || data?.dex_id || ''; const txId = data?.tx_id; const chainItem = useMemo( () => diff --git a/src/ui/views/Swap/Component/Main.tsx b/src/ui/views/Swap/Component/Main.tsx index 2d7f55a4fe2..e10cac955f9 100644 --- a/src/ui/views/Swap/Component/Main.tsx +++ b/src/ui/views/Swap/Component/Main.tsx @@ -292,7 +292,7 @@ export const Main = () => { .toNumber(), slippage: new BigNumber(slippage).div(100).toNumber(), }, - dex_id: activeProvider?.name.replace('API', '') || 'WrapToken', + dex_id: activeProvider?.name || 'WrapToken', }, }, { @@ -359,7 +359,7 @@ export const Main = () => { .toNumber(), slippage: new BigNumber(slippage).div(100).toNumber(), }, - dex_id: activeProvider?.name.replace('API', '') || 'WrapToken', + dex_id: activeProvider?.name || 'WrapToken', }, }, { diff --git a/src/ui/views/Swap/hooks/quote.tsx b/src/ui/views/Swap/hooks/quote.tsx index bf9ee9420d7..8b9bf6de1ae 100644 --- a/src/ui/views/Swap/hooks/quote.tsx +++ b/src/ui/views/Swap/hooks/quote.tsx @@ -88,8 +88,7 @@ export const useQuoteMethods = () => { .toNumber(), slippage: new BigNumber(slippage).div(100).toNumber(), }, - // 0xAPI => 0x - dex_id: dexId.replace('API', ''), + dex_id: dexId, tx_id: txId, tx, }), diff --git a/yarn.lock b/yarn.lock index 87e6c1ad51b..b3d6cb511c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4808,10 +4808,10 @@ sha256-uint8array "^0.10.3" url-parse "^1.5.1" -"@rabby-wallet/rabby-swap@0.0.40": - version "0.0.40" - resolved "https://registry.yarnpkg.com/@rabby-wallet/rabby-swap/-/rabby-swap-0.0.40.tgz#cabca6192b500789450d53d75b134004c752f022" - integrity sha512-OLBlek+xW6qNJzeU8XVv+6jDkNN2QN89kG66nKS6TtN/IQmdDOSmPfAqNFPpI6UptLG/BUyO8Fcv7LLDLwXvEg== +"@rabby-wallet/rabby-swap@0.0.42": + version "0.0.42" + resolved "https://registry.yarnpkg.com/@rabby-wallet/rabby-swap/-/rabby-swap-0.0.42.tgz#b0fc3c156874e0566df94c892752d01f0e1df1fb" + integrity sha512-k1yhqs+UROMCBseQBrirZ/qwa0iEC7wozDmeOTSJQEKdEXSifhL0W4HLoL1Zh2mZQytv3b86TN8TvoI7Yboh0Q== dependencies: "@ethersproject/abi" "^5.7.0" axios "^0.27.2" @@ -19220,8 +19220,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.2.3: - name string-width-cjs +"string-width-cjs@npm:string-width@^4.2.0": 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== @@ -19248,6 +19247,15 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +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" @@ -19300,8 +19308,7 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.1: - name strip-ansi-cjs +"strip-ansi-cjs@npm: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== @@ -19322,6 +19329,13 @@ strip-ansi@^6.0.0: dependencies: ansi-regex "^5.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.0: version "7.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.0.1.tgz#61740a08ce36b61e50e65653f07060d000975fb2" @@ -21309,8 +21323,7 @@ wildcard@^2.0.0: resolved "https://registry.yarnpkg.com/wildcard/-/wildcard-2.0.0.tgz#a77d20e5200c6faaac979e4b3aadc7b3dd7f8fec" integrity sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw== -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: - name wrap-ansi-cjs +"wrap-ansi-cjs@npm: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== @@ -21327,6 +21340,15 @@ wrap-ansi@^2.0.0: string-width "^1.0.1" strip-ansi "^3.0.1" +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"