From 703ede0c4ab71e6c8629ded33ec50866614b2a09 Mon Sep 17 00:00:00 2001 From: DMY <147dmy@gmail.com> Date: Wed, 30 Oct 2024 12:26:26 +0800 Subject: [PATCH 1/5] test 0x_v2 --- package.json | 2 +- src/constant/index.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 4425fd40589..660e1b8b91c 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-beta.1", "@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..faa4f820b64 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_v2', + chains: DEX_SUPPORT_CHAINS[DEX_ENUM.ZEROXAPIV2], + }, }; export const DEX_WITH_WRAP = { From 96ce3ee3aa0a26d49475733f376f032bf840a880 Mon Sep 17 00:00:00 2001 From: DMY <147dmy@gmail.com> Date: Thu, 7 Nov 2024 17:40:04 +0800 Subject: [PATCH 2/5] update yarn.locj --- yarn.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/yarn.lock b/yarn.lock index 87e6c1ad51b..246c8258bb2 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-beta.1": + version "0.0.42-beta.1" + resolved "https://registry.yarnpkg.com/@rabby-wallet/rabby-swap/-/rabby-swap-0.0.42-beta.1.tgz#1a03c5087b8599d0b28b8d2d1fefd649e0c04ac8" + integrity sha512-hJc/eJe0+/8uYCRTTjXmaPG/KsHHM60PE8ynNM0tZuPxjWKcv/JZ/XC78YcYA3ZSAxqL8ZTnNi8NKoObA3r1rg== dependencies: "@ethersproject/abi" "^5.7.0" axios "^0.27.2" From e3d591d9bd0a637aca2134f5e56c3fae5bc9f317 Mon Sep 17 00:00:00 2001 From: DMY <147dmy@gmail.com> Date: Fri, 8 Nov 2024 14:28:21 +0800 Subject: [PATCH 3/5] fix --- src/ui/views/Swap/Component/History.tsx | 6 ++++-- src/ui/views/Swap/Component/Main.tsx | 4 ++-- src/ui/views/Swap/hooks/quote.tsx | 3 +-- 3 files changed, 7 insertions(+), 6 deletions(-) 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, }), From 0a3d207790cbdc04eaeb1e76f02cedc019069bac Mon Sep 17 00:00:00 2001 From: DMY <147dmy@gmail.com> Date: Fri, 8 Nov 2024 14:28:49 +0800 Subject: [PATCH 4/5] resume 0x name --- src/constant/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constant/index.ts b/src/constant/index.ts index faa4f820b64..eb673d2b050 100644 --- a/src/constant/index.ts +++ b/src/constant/index.ts @@ -1483,7 +1483,7 @@ export const DEX = { [DEX_ENUM.ZEROXAPIV2]: { id: DEX_ENUM.ZEROXAPIV2, logo: Logo0X, - name: '0x_v2', + name: '0x', chains: DEX_SUPPORT_CHAINS[DEX_ENUM.ZEROXAPIV2], }, }; From a5771c6b33186427f3d50de3efd670288ba3ad36 Mon Sep 17 00:00:00 2001 From: DMY <147dmy@gmail.com> Date: Mon, 11 Nov 2024 15:03:44 +0800 Subject: [PATCH 5/5] chore: @rabby-wallet/rabby-swap 0.0.42 --- package.json | 2 +- yarn.lock | 42 ++++++++++++++++++++++++++++++++---------- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 660e1b8b91c..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.42-beta.1", + "@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/yarn.lock b/yarn.lock index 246c8258bb2..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.42-beta.1": - version "0.0.42-beta.1" - resolved "https://registry.yarnpkg.com/@rabby-wallet/rabby-swap/-/rabby-swap-0.0.42-beta.1.tgz#1a03c5087b8599d0b28b8d2d1fefd649e0c04ac8" - integrity sha512-hJc/eJe0+/8uYCRTTjXmaPG/KsHHM60PE8ynNM0tZuPxjWKcv/JZ/XC78YcYA3ZSAxqL8ZTnNi8NKoObA3r1rg== +"@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"