Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: 0xv2 #2609

Merged
merged 5 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions src/constant/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
6 changes: 4 additions & 2 deletions src/ui/views/Swap/Component/History.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -81,7 +80,10 @@ const Transaction = forwardRef<HTMLDivElement, TransactionProps>(
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(
() =>
Expand Down
4 changes: 2 additions & 2 deletions src/ui/views/Swap/Component/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},
{
Expand Down Expand Up @@ -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',
},
},
{
Expand Down
3 changes: 1 addition & 2 deletions src/ui/views/Swap/hooks/quote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
Expand Down
42 changes: 32 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4808,10 +4808,10 @@
sha256-uint8array "^0.10.3"
url-parse "^1.5.1"

"@rabby-wallet/[email protected].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/[email protected].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"
Expand Down Expand Up @@ -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==
Expand All @@ -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"
Expand Down Expand Up @@ -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==
Expand All @@ -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"
Expand Down Expand Up @@ -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==
Expand All @@ -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"
Expand Down
Loading