Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54a520fbf2 |
@@ -6,5 +6,3 @@ VITE_PK_ENCRYPTION_KEY=
|
|||||||
|
|
||||||
VITE_WALLETCONNECT1_BRIDGE=
|
VITE_WALLETCONNECT1_BRIDGE=
|
||||||
VITE_WALLETCONNECT2_PROJECT_ID=
|
VITE_WALLETCONNECT2_PROJECT_ID=
|
||||||
|
|
||||||
VITE_V3_TOKEN_ADDRESS=
|
|
||||||
@@ -33,13 +33,11 @@ jobs:
|
|||||||
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
|
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
|
||||||
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
|
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
|
||||||
STATUS_PAGE_SCRIPT_URI: ${{ secrets.STATUS_PAGE_SCRIPT_URI }}
|
STATUS_PAGE_SCRIPT_URI: ${{ secrets.STATUS_PAGE_SCRIPT_URI }}
|
||||||
IOS_APP_ID: ${{ secrets.IOS_APP_ID }}
|
|
||||||
run: |
|
run: |
|
||||||
pnpm run build
|
pnpm run build
|
||||||
pnpm run build:inject-amplitude
|
pnpm run build:inject-amplitude
|
||||||
pnpm run build:inject-bugsnag
|
pnpm run build:inject-bugsnag
|
||||||
pnpm run build:inject-statuspage
|
pnpm run build:inject-statuspage
|
||||||
sh scripts/inject-app-deeplinks.sh
|
|
||||||
|
|
||||||
- name: Upload to IPFS via web3.storage
|
- name: Upload to IPFS via web3.storage
|
||||||
uses: dydxprotocol/add-to-web3@v1
|
uses: dydxprotocol/add-to-web3@v1
|
||||||
|
|||||||
+4
-5
@@ -10,7 +10,6 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"build:inject-app-deeplinks": "sh scripts/inject-app-deeplinks.sh",
|
|
||||||
"build:inject-amplitude": "node scripts/inject-amplitude.js",
|
"build:inject-amplitude": "node scripts/inject-amplitude.js",
|
||||||
"build:inject-bugsnag": "node scripts/inject-bugsnag.js",
|
"build:inject-bugsnag": "node scripts/inject-bugsnag.js",
|
||||||
"build:inject-statuspage": "node scripts/inject-statuspage.js",
|
"build:inject-statuspage": "node scripts/inject-statuspage.js",
|
||||||
@@ -38,9 +37,9 @@
|
|||||||
"@cosmjs/proto-signing": "^0.31.0",
|
"@cosmjs/proto-signing": "^0.31.0",
|
||||||
"@cosmjs/stargate": "^0.31.0",
|
"@cosmjs/stargate": "^0.31.0",
|
||||||
"@cosmjs/tendermint-rpc": "^0.31.0",
|
"@cosmjs/tendermint-rpc": "^0.31.0",
|
||||||
"@dydxprotocol/v4-abacus": "^0.6.4",
|
"@dydxprotocol/v4-abacus": "^0.4.28",
|
||||||
"@dydxprotocol/v4-client-js": "^0.36.1",
|
"@dydxprotocol/v4-client-js": "^0.35.0",
|
||||||
"@dydxprotocol/v4-localization": "^0.1.24",
|
"@dydxprotocol/v4-localization": "^0.1.5",
|
||||||
"@ethersproject/providers": "^5.7.2",
|
"@ethersproject/providers": "^5.7.2",
|
||||||
"@js-joda/core": "^5.5.3",
|
"@js-joda/core": "^5.5.3",
|
||||||
"@radix-ui/react-collapsible": "^1.0.3",
|
"@radix-ui/react-collapsible": "^1.0.3",
|
||||||
@@ -106,7 +105,7 @@
|
|||||||
"reselect": "^4.1.8",
|
"reselect": "^4.1.8",
|
||||||
"styled-components": "^5.3.11",
|
"styled-components": "^5.3.11",
|
||||||
"use-latest": "^1.2.1",
|
"use-latest": "^1.2.1",
|
||||||
"viem": "^1.12.2",
|
"viem": "^1.1.6",
|
||||||
"wagmi": "^1.3.7"
|
"wagmi": "^1.3.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
Generated
+67
-89
@@ -27,14 +27,14 @@ dependencies:
|
|||||||
specifier: ^0.31.0
|
specifier: ^0.31.0
|
||||||
version: 0.31.0
|
version: 0.31.0
|
||||||
'@dydxprotocol/v4-abacus':
|
'@dydxprotocol/v4-abacus':
|
||||||
specifier: ^0.6.4
|
specifier: ^0.4.28
|
||||||
version: 0.6.4
|
version: 0.4.28
|
||||||
'@dydxprotocol/v4-client-js':
|
'@dydxprotocol/v4-client-js':
|
||||||
specifier: ^0.36.1
|
specifier: ^0.35.0
|
||||||
version: 0.36.1
|
version: 0.35.0
|
||||||
'@dydxprotocol/v4-localization':
|
'@dydxprotocol/v4-localization':
|
||||||
specifier: ^0.1.24
|
specifier: ^0.1.5
|
||||||
version: 0.1.24
|
version: 0.1.5
|
||||||
'@ethersproject/providers':
|
'@ethersproject/providers':
|
||||||
specifier: ^5.7.2
|
specifier: ^5.7.2
|
||||||
version: 5.7.2
|
version: 5.7.2
|
||||||
@@ -231,11 +231,11 @@ dependencies:
|
|||||||
specifier: ^1.2.1
|
specifier: ^1.2.1
|
||||||
version: 1.2.1(@types/react@18.2.14)(react@18.2.0)
|
version: 1.2.1(@types/react@18.2.14)(react@18.2.0)
|
||||||
viem:
|
viem:
|
||||||
specifier: ^1.12.2
|
specifier: ^1.1.6
|
||||||
version: 1.12.2(typescript@5.1.3)
|
version: 1.1.6(typescript@5.1.3)
|
||||||
wagmi:
|
wagmi:
|
||||||
specifier: ^1.3.7
|
specifier: ^1.3.7
|
||||||
version: 1.3.7(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.3)(viem@1.12.2)
|
version: 1.3.7(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.3)(viem@1.1.6)
|
||||||
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
'@babel/core':
|
'@babel/core':
|
||||||
@@ -380,12 +380,12 @@ packages:
|
|||||||
engines: {node: '>=0.10.0'}
|
engines: {node: '>=0.10.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@adraffy/ens-normalize@1.9.2:
|
/@adraffy/ens-normalize@1.9.0:
|
||||||
resolution: {integrity: sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==}
|
resolution: {integrity: sha512-iowxq3U30sghZotgl4s/oJRci6WPBfNO5YYgk2cIOMCHr3LeGPcsZjCEr+33Q4N+oV3OABDAtA+pyvWjbvBifQ==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@adraffy/ens-normalize@1.9.4:
|
/@adraffy/ens-normalize@1.9.2:
|
||||||
resolution: {integrity: sha512-UK0bHA7hh9cR39V+4gl2/NnBBjoXIxkuWAPCaY4X7fbH4L/azIi7ilWOCjMUYfpJgraLUAqkRi2BqrjME8Rynw==}
|
resolution: {integrity: sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@ampproject/remapping@2.2.1:
|
/@ampproject/remapping@2.2.1:
|
||||||
@@ -979,12 +979,12 @@ packages:
|
|||||||
resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==}
|
resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@dydxprotocol/v4-abacus@0.6.4:
|
/@dydxprotocol/v4-abacus@0.4.28:
|
||||||
resolution: {integrity: sha512-eH+/9Q/OnQtwzBwM1BJyXybFPdivGmFQWrxM71MFWGs6uIQGbZX775mpoa8deweSTyQ/QrRLRQ1mP2BPDgBQYg==}
|
resolution: {integrity: sha512-RQGTXI7q4HAXDmlUpDhpJDLN8C0dFMgKHzFITK1Sz3KnLb3mkkpqEU1D8VIn/hB7ngt+equMsLFSkUwzXCzgdA==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@dydxprotocol/v4-client-js@0.36.1:
|
/@dydxprotocol/v4-client-js@0.35.0:
|
||||||
resolution: {integrity: sha512-KJ3MtWI61wmm+xZtXQd7/hYKIoVFG32TRdyyVaXXO8vpW9Oqd0JD8QSM/wuegkciAh5YmP/BrDzYuu77zHO6yg==}
|
resolution: {integrity: sha512-H+0/tOBVqyWx2JQ4jUFdJOlFof0NqN1u9vzKJ2h3Nv5KNteSPd59eiywoz+3J0jlmkREw0Jzg9CS0bLwzYVLvA==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@cosmjs/amino': 0.30.1
|
'@cosmjs/amino': 0.30.1
|
||||||
'@cosmjs/encoding': 0.31.1
|
'@cosmjs/encoding': 0.31.1
|
||||||
@@ -1010,8 +1010,8 @@ packages:
|
|||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@dydxprotocol/v4-localization@0.1.24:
|
/@dydxprotocol/v4-localization@0.1.5:
|
||||||
resolution: {integrity: sha512-zSiu8+/6BWNWZXxe73zUp/UjuLG1Cp5UuhXKtbATqqkeZyVCs01QxbBCTs1MLfgsLh02IrfhXCPHvXnzZyReEw==}
|
resolution: {integrity: sha512-fiSHWrG8E2HuXkCzWsqyekntlI13hBRACrP0vaYudeSulw+ScGeAqZ5xp9/cANF6PP+H3z1yciNCZOH3OwSDwA==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@dydxprotocol/v4-proto@0.2.1:
|
/@dydxprotocol/v4-proto@0.2.1:
|
||||||
@@ -2032,12 +2032,6 @@ packages:
|
|||||||
'@noble/hashes': 1.3.1
|
'@noble/hashes': 1.3.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@noble/curves@1.2.0:
|
|
||||||
resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==}
|
|
||||||
dependencies:
|
|
||||||
'@noble/hashes': 1.3.2
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@noble/ed25519@1.7.3:
|
/@noble/ed25519@1.7.3:
|
||||||
resolution: {integrity: sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==}
|
resolution: {integrity: sha512-iR8GBkDt0Q3GyaVcIu7mSsVIqnFbkbRzGLWlvhwunacoLwt4J3swfKhfaM6rN6WY+TBGoYT1GtT1mIh2/jGbRQ==}
|
||||||
dev: true
|
dev: true
|
||||||
@@ -2055,11 +2049,6 @@ packages:
|
|||||||
engines: {node: '>= 16'}
|
engines: {node: '>= 16'}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@noble/hashes@1.3.2:
|
|
||||||
resolution: {integrity: sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==}
|
|
||||||
engines: {node: '>= 16'}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@noble/secp256k1@1.7.1:
|
/@noble/secp256k1@1.7.1:
|
||||||
resolution: {integrity: sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==}
|
resolution: {integrity: sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==}
|
||||||
|
|
||||||
@@ -4658,7 +4647,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-gYw0ki/EAuV1oSyMxpqandHjnthZjYYy+YWpTAzf8BqfXM3ItcZLpjxfg+3+mXW8HIO+3jw6T9iiqEXsqHaMMw==}
|
resolution: {integrity: sha512-gYw0ki/EAuV1oSyMxpqandHjnthZjYYy+YWpTAzf8BqfXM3ItcZLpjxfg+3+mXW8HIO+3jw6T9iiqEXsqHaMMw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@safe-global/safe-gateway-typescript-sdk': 3.9.0
|
'@safe-global/safe-gateway-typescript-sdk': 3.9.0
|
||||||
viem: 1.12.2(typescript@5.1.3)
|
viem: 1.1.6(typescript@5.1.3)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- bufferutil
|
- bufferutil
|
||||||
- encoding
|
- encoding
|
||||||
@@ -4671,7 +4660,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-XJbEPuaVc7b9n23MqlF6c+ToYIS3f7P2Sel8f3cSBQ9WORE4xrSuvhMpK9fDSFqJ7by/brc+rmJR/5HViRr0/w==}
|
resolution: {integrity: sha512-XJbEPuaVc7b9n23MqlF6c+ToYIS3f7P2Sel8f3cSBQ9WORE4xrSuvhMpK9fDSFqJ7by/brc+rmJR/5HViRr0/w==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@safe-global/safe-gateway-typescript-sdk': 3.9.0
|
'@safe-global/safe-gateway-typescript-sdk': 3.9.0
|
||||||
viem: 1.12.2(typescript@5.1.3)
|
viem: 1.1.6(typescript@5.1.3)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- bufferutil
|
- bufferutil
|
||||||
- encoding
|
- encoding
|
||||||
@@ -4692,10 +4681,6 @@ packages:
|
|||||||
resolution: {integrity: sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==}
|
resolution: {integrity: sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@scure/base@1.1.3:
|
|
||||||
resolution: {integrity: sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q==}
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@scure/bip32@1.3.0:
|
/@scure/bip32@1.3.0:
|
||||||
resolution: {integrity: sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q==}
|
resolution: {integrity: sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -4712,14 +4697,6 @@ packages:
|
|||||||
'@scure/base': 1.1.1
|
'@scure/base': 1.1.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@scure/bip32@1.3.2:
|
|
||||||
resolution: {integrity: sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==}
|
|
||||||
dependencies:
|
|
||||||
'@noble/curves': 1.2.0
|
|
||||||
'@noble/hashes': 1.3.2
|
|
||||||
'@scure/base': 1.1.3
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@scure/bip39@1.2.0:
|
/@scure/bip39@1.2.0:
|
||||||
resolution: {integrity: sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg==}
|
resolution: {integrity: sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg==}
|
||||||
dependencies:
|
dependencies:
|
||||||
@@ -4730,7 +4707,7 @@ packages:
|
|||||||
/@scure/bip39@1.2.1:
|
/@scure/bip39@1.2.1:
|
||||||
resolution: {integrity: sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==}
|
resolution: {integrity: sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@noble/hashes': 1.3.2
|
'@noble/hashes': 1.3.1
|
||||||
'@scure/base': 1.1.1
|
'@scure/base': 1.1.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
@@ -5431,12 +5408,6 @@ packages:
|
|||||||
'@types/node': 20.3.1
|
'@types/node': 20.3.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@types/ws@8.5.6:
|
|
||||||
resolution: {integrity: sha512-8B5EO9jLVCy+B58PLHvLDuOD8DRVMgQzq8d55SjLCOn9kqGyqOvy27exVaTio1q1nX5zLu8/6N0n2ThSxOM6tg==}
|
|
||||||
dependencies:
|
|
||||||
'@types/node': 20.3.1
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/@typescript-eslint/eslint-plugin@5.60.0(@typescript-eslint/parser@5.60.0)(eslint@8.43.0)(typescript@5.1.3):
|
/@typescript-eslint/eslint-plugin@5.60.0(@typescript-eslint/parser@5.60.0)(eslint@8.43.0)(typescript@5.1.3):
|
||||||
resolution: {integrity: sha512-78B+anHLF1TI8Jn/cD0Q00TBYdMgjdOn980JfAVa9yw5sop8nyTfVOQAv6LWywkOGLclDBtv5z3oxN4w7jxyNg==}
|
resolution: {integrity: sha512-78B+anHLF1TI8Jn/cD0Q00TBYdMgjdOn980JfAVa9yw5sop8nyTfVOQAv6LWywkOGLclDBtv5z3oxN4w7jxyNg==}
|
||||||
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
|
||||||
@@ -5933,6 +5904,17 @@ packages:
|
|||||||
pretty-format: 27.5.1
|
pretty-format: 27.5.1
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
/@wagmi/chains@1.2.0(typescript@5.1.3):
|
||||||
|
resolution: {integrity: sha512-dmDRipsE54JfyudOBkuhEexqQWcrZqxn/qiujG8SBzMh/az/AH5xlJSA+j1CPWTx9+QofSMF3B7A4gb6XRmSaQ==}
|
||||||
|
peerDependencies:
|
||||||
|
typescript: '>=5.0.4'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
typescript:
|
||||||
|
optional: true
|
||||||
|
dependencies:
|
||||||
|
typescript: 5.1.3
|
||||||
|
dev: false
|
||||||
|
|
||||||
/@wagmi/chains@1.4.0(typescript@5.1.3):
|
/@wagmi/chains@1.4.0(typescript@5.1.3):
|
||||||
resolution: {integrity: sha512-9HwJrhcZ1TxyrCbE10y7s1eSiSiyfGam7AHIOLYExaOX+vpOZ+MNTt4orFEDbEpz1fxwJDPPI38lanAUix1OSA==}
|
resolution: {integrity: sha512-9HwJrhcZ1TxyrCbE10y7s1eSiSiyfGam7AHIOLYExaOX+vpOZ+MNTt4orFEDbEpz1fxwJDPPI38lanAUix1OSA==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@@ -5944,7 +5926,7 @@ packages:
|
|||||||
typescript: 5.1.3
|
typescript: 5.1.3
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@wagmi/connectors@2.6.5(@wagmi/chains@1.4.0)(react@18.2.0)(typescript@5.1.3)(viem@1.12.2):
|
/@wagmi/connectors@2.6.5(@wagmi/chains@1.4.0)(react@18.2.0)(typescript@5.1.3)(viem@1.1.6):
|
||||||
resolution: {integrity: sha512-klF31togMDd0qQqEcLl5cCGxjMbL0RRXQ8I1vxmEa3KdGzw6Z3ICVzX7/bDfnNEZcOW7BKyAnZDq7rCt5jTOiw==}
|
resolution: {integrity: sha512-klF31togMDd0qQqEcLl5cCGxjMbL0RRXQ8I1vxmEa3KdGzw6Z3ICVzX7/bDfnNEZcOW7BKyAnZDq7rCt5jTOiw==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
'@wagmi/chains': '>=1.3.0'
|
'@wagmi/chains': '>=1.3.0'
|
||||||
@@ -5968,7 +5950,7 @@ packages:
|
|||||||
abitype: 0.8.7(typescript@5.1.3)
|
abitype: 0.8.7(typescript@5.1.3)
|
||||||
eventemitter3: 4.0.7
|
eventemitter3: 4.0.7
|
||||||
typescript: 5.1.3
|
typescript: 5.1.3
|
||||||
viem: 1.12.2(typescript@5.1.3)
|
viem: 1.1.6(typescript@5.1.3)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@react-native-async-storage/async-storage'
|
- '@react-native-async-storage/async-storage'
|
||||||
- bufferutil
|
- bufferutil
|
||||||
@@ -5980,7 +5962,7 @@ packages:
|
|||||||
- zod
|
- zod
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@wagmi/core@1.3.6(@types/react@18.2.14)(react@18.2.0)(typescript@5.1.3)(viem@1.12.2):
|
/@wagmi/core@1.3.6(@types/react@18.2.14)(react@18.2.0)(typescript@5.1.3)(viem@1.1.6):
|
||||||
resolution: {integrity: sha512-TXv9ZlRR5aySfERFuWMuo+lKXC/CoqtxVJZVHPqhK1jY+nldMx3AvrWzzF4CccRaMYcVdvPFepvmxzq2A2VvWg==}
|
resolution: {integrity: sha512-TXv9ZlRR5aySfERFuWMuo+lKXC/CoqtxVJZVHPqhK1jY+nldMx3AvrWzzF4CccRaMYcVdvPFepvmxzq2A2VvWg==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=5.0.4'
|
typescript: '>=5.0.4'
|
||||||
@@ -5990,11 +5972,11 @@ packages:
|
|||||||
optional: true
|
optional: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@wagmi/chains': 1.4.0(typescript@5.1.3)
|
'@wagmi/chains': 1.4.0(typescript@5.1.3)
|
||||||
'@wagmi/connectors': 2.6.5(@wagmi/chains@1.4.0)(react@18.2.0)(typescript@5.1.3)(viem@1.12.2)
|
'@wagmi/connectors': 2.6.5(@wagmi/chains@1.4.0)(react@18.2.0)(typescript@5.1.3)(viem@1.1.6)
|
||||||
abitype: 0.8.7(typescript@5.1.3)
|
abitype: 0.8.7(typescript@5.1.3)
|
||||||
eventemitter3: 4.0.7
|
eventemitter3: 4.0.7
|
||||||
typescript: 5.1.3
|
typescript: 5.1.3
|
||||||
viem: 1.12.2(typescript@5.1.3)
|
viem: 1.1.6(typescript@5.1.3)
|
||||||
zustand: 4.4.1(@types/react@18.2.14)(react@18.2.0)
|
zustand: 4.4.1(@types/react@18.2.14)(react@18.2.0)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@react-native-async-storage/async-storage'
|
- '@react-native-async-storage/async-storage'
|
||||||
@@ -6695,20 +6677,6 @@ packages:
|
|||||||
typescript: 5.1.3
|
typescript: 5.1.3
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/abitype@0.9.8(typescript@5.1.3):
|
|
||||||
resolution: {integrity: sha512-puLifILdm+8sjyss4S+fsUN09obiT1g2YW6CtcQF+QDzxR0euzgEB29MZujC6zMk2a6SVmtttq1fc6+YFA7WYQ==}
|
|
||||||
peerDependencies:
|
|
||||||
typescript: '>=5.0.4'
|
|
||||||
zod: ^3 >=3.19.1
|
|
||||||
peerDependenciesMeta:
|
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
zod:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
|
||||||
typescript: 5.1.3
|
|
||||||
dev: false
|
|
||||||
|
|
||||||
/abort-controller@3.0.0:
|
/abort-controller@3.0.0:
|
||||||
resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==}
|
resolution: {integrity: sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==}
|
||||||
engines: {node: '>=6.5'}
|
engines: {node: '>=6.5'}
|
||||||
@@ -10018,12 +9986,12 @@ packages:
|
|||||||
ws: 7.5.9
|
ws: 7.5.9
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/isomorphic-ws@5.0.0(ws@8.13.0):
|
/isomorphic-ws@5.0.0(ws@8.12.0):
|
||||||
resolution: {integrity: sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==}
|
resolution: {integrity: sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
ws: '*'
|
ws: '*'
|
||||||
dependencies:
|
dependencies:
|
||||||
ws: 8.13.0(bufferutil@4.0.7)(utf-8-validate@5.0.10)
|
ws: 8.12.0
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/it-all@1.0.6:
|
/it-all@1.0.6:
|
||||||
@@ -13552,24 +13520,21 @@ packages:
|
|||||||
vfile-message: 3.1.4
|
vfile-message: 3.1.4
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/viem@1.12.2(typescript@5.1.3):
|
/viem@1.1.6(typescript@5.1.3):
|
||||||
resolution: {integrity: sha512-aCaUCyg72ES+jK4s6tVYOMnOt4if71RwzgiUAUpAuaCgvHFfh9DCnwuEfwkxEZLE2vafOsirgJ3fcn7nsDVQoQ==}
|
resolution: {integrity: sha512-7nK3HMucLr1Yz0QnDXiD6viigKS6QeYD/YhRHpi3Bby/g0hCyZqK8+YJNtp3/Ri64tpl4kaTIeCScJWV2jqXHQ==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
typescript: '>=5.0.4'
|
typescript: '>=5.0.4'
|
||||||
peerDependenciesMeta:
|
|
||||||
typescript:
|
|
||||||
optional: true
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@adraffy/ens-normalize': 1.9.4
|
'@adraffy/ens-normalize': 1.9.0
|
||||||
'@noble/curves': 1.2.0
|
'@noble/curves': 1.0.0
|
||||||
'@noble/hashes': 1.3.2
|
'@noble/hashes': 1.3.0
|
||||||
'@scure/bip32': 1.3.2
|
'@scure/bip32': 1.3.0
|
||||||
'@scure/bip39': 1.2.1
|
'@scure/bip39': 1.2.0
|
||||||
'@types/ws': 8.5.6
|
'@wagmi/chains': 1.2.0(typescript@5.1.3)
|
||||||
abitype: 0.9.8(typescript@5.1.3)
|
abitype: 0.8.7(typescript@5.1.3)
|
||||||
isomorphic-ws: 5.0.0(ws@8.13.0)
|
isomorphic-ws: 5.0.0(ws@8.12.0)
|
||||||
typescript: 5.1.3
|
typescript: 5.1.3
|
||||||
ws: 8.13.0(bufferutil@4.0.7)(utf-8-validate@5.0.10)
|
ws: 8.12.0
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- bufferutil
|
- bufferutil
|
||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
@@ -13737,7 +13702,7 @@ packages:
|
|||||||
- supports-color
|
- supports-color
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/wagmi@1.3.7(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.3)(viem@1.12.2):
|
/wagmi@1.3.7(@types/react@18.2.14)(react-dom@18.2.0)(react@18.2.0)(typescript@5.1.3)(viem@1.1.6):
|
||||||
resolution: {integrity: sha512-n4Qwby0QB8/JSGjc0gGn4MWZ0BT229agEg6saPGS6VswmPjJLdkLq9qxKn1JptXxPREmb/ZvwHxU++3Z+gQJVA==}
|
resolution: {integrity: sha512-n4Qwby0QB8/JSGjc0gGn4MWZ0BT229agEg6saPGS6VswmPjJLdkLq9qxKn1JptXxPREmb/ZvwHxU++3Z+gQJVA==}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
react: '>=17.0.0'
|
react: '>=17.0.0'
|
||||||
@@ -13750,12 +13715,12 @@ packages:
|
|||||||
'@tanstack/query-sync-storage-persister': 4.32.6
|
'@tanstack/query-sync-storage-persister': 4.32.6
|
||||||
'@tanstack/react-query': 4.32.6(react-dom@18.2.0)(react@18.2.0)
|
'@tanstack/react-query': 4.32.6(react-dom@18.2.0)(react@18.2.0)
|
||||||
'@tanstack/react-query-persist-client': 4.32.6(@tanstack/react-query@4.32.6)
|
'@tanstack/react-query-persist-client': 4.32.6(@tanstack/react-query@4.32.6)
|
||||||
'@wagmi/core': 1.3.6(@types/react@18.2.14)(react@18.2.0)(typescript@5.1.3)(viem@1.12.2)
|
'@wagmi/core': 1.3.6(@types/react@18.2.14)(react@18.2.0)(typescript@5.1.3)(viem@1.1.6)
|
||||||
abitype: 0.8.7(typescript@5.1.3)
|
abitype: 0.8.7(typescript@5.1.3)
|
||||||
react: 18.2.0
|
react: 18.2.0
|
||||||
typescript: 5.1.3
|
typescript: 5.1.3
|
||||||
use-sync-external-store: 1.2.0(react@18.2.0)
|
use-sync-external-store: 1.2.0(react@18.2.0)
|
||||||
viem: 1.12.2(typescript@5.1.3)
|
viem: 1.1.6(typescript@5.1.3)
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- '@react-native-async-storage/async-storage'
|
- '@react-native-async-storage/async-storage'
|
||||||
- '@types/react'
|
- '@types/react'
|
||||||
@@ -13980,6 +13945,19 @@ packages:
|
|||||||
optional: true
|
optional: true
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
|
/ws@8.12.0:
|
||||||
|
resolution: {integrity: sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig==}
|
||||||
|
engines: {node: '>=10.0.0'}
|
||||||
|
peerDependencies:
|
||||||
|
bufferutil: ^4.0.1
|
||||||
|
utf-8-validate: '>=5.0.2'
|
||||||
|
peerDependenciesMeta:
|
||||||
|
bufferutil:
|
||||||
|
optional: true
|
||||||
|
utf-8-validate:
|
||||||
|
optional: true
|
||||||
|
dev: false
|
||||||
|
|
||||||
/ws@8.13.0(bufferutil@4.0.7)(utf-8-validate@5.0.10):
|
/ws@8.13.0(bufferutil@4.0.7)(utf-8-validate@5.0.10):
|
||||||
resolution: {integrity: sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==}
|
resolution: {integrity: sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==}
|
||||||
engines: {node: '>=10.0.0'}
|
engines: {node: '>=10.0.0'}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"details": [
|
"details": [
|
||||||
{
|
{
|
||||||
"appIDs": [
|
"appIDs": [
|
||||||
"{PLACE_YOUR_APP_ID_HERE}"
|
"75C6UARB5H.exchangeV4.dydx.trading"
|
||||||
],
|
],
|
||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,834 +0,0 @@
|
|||||||
{
|
|
||||||
"deployments": {
|
|
||||||
"MAINNET": {
|
|
||||||
"environments": [
|
|
||||||
"dydxprotocol-mainnet"
|
|
||||||
],
|
|
||||||
"default": "dydxprotocol-mainnet"
|
|
||||||
},
|
|
||||||
"TESTNET": {
|
|
||||||
"environments": [
|
|
||||||
"dydxprotocol-testnet"
|
|
||||||
],
|
|
||||||
"default": "dydxprotocol-testnet"
|
|
||||||
},
|
|
||||||
"DEV": {
|
|
||||||
"environments": [
|
|
||||||
"dydxprotocol-dev",
|
|
||||||
"dydxprotocol-dev-2",
|
|
||||||
"dydxprotocol-dev-4",
|
|
||||||
"dydxprotocol-dev-5",
|
|
||||||
"dydxprotocol-staging",
|
|
||||||
"dydxprotocol-staging-west",
|
|
||||||
"dydxprotocol-testnet",
|
|
||||||
"dydxprotocol-testnet-dydx",
|
|
||||||
"dydxprotocol-testnet-dsrv",
|
|
||||||
"dydxprotocol-testnet-nodefleet",
|
|
||||||
"dydxprotocol-testnet-kingnodes",
|
|
||||||
"dydxprotocol-testnet-liquify"
|
|
||||||
],
|
|
||||||
"default": "dydxprotocol-testnet"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"environments": {
|
|
||||||
"dydxprotocol-dev": {
|
|
||||||
"name": "v4 Dev",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydxprotocol-testnet",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "http://indexer.v4dev.dydx.exchange",
|
|
||||||
"socket": "wss://indexer.v4dev.dydx.exchange"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validators": [
|
|
||||||
"http://validator.v4dev.dydx.exchange"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.0xsquid.com",
|
|
||||||
"faucet": "http://faucet.v4dev.dydx.exchange"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "dYdX v4",
|
|
||||||
"description": "dYdX v4 App",
|
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "wss://api.stage.dydx.exchange/wc/"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX Chain Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX Chain"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-dev-2": {
|
|
||||||
"name": "v4 Dev 2",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydxprotocol-testnet",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "http://dev2-indexer-apne1-lb-public-2076363889.ap-northeast-1.elb.amazonaws.com",
|
|
||||||
"socket": "ws://dev2-indexer-apne1-lb-public-2076363889.ap-northeast-1.elb.amazonaws.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validators": [
|
|
||||||
"http://35.75.227.118"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.0xsquid.com"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "dYdX v4",
|
|
||||||
"description": "dYdX v4 App",
|
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "wss://api.stage.dydx.exchange/wc/"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX Chain Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX Chain"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-dev-4": {
|
|
||||||
"name": "v4 Dev 4",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydxprotocol-testnet",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "http://indexer.v4dev4.dydx.exchange",
|
|
||||||
"socket": "ws://indexer.v4dev4.dydx.exchange"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validators": [
|
|
||||||
"http://validator.v4dev4.dydx.exchange"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.0xsquid.com"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "dYdX v4",
|
|
||||||
"description": "dYdX v4 App",
|
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "wss://api.stage.dydx.exchange/wc/"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX Chain Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX Chain"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-dev-5": {
|
|
||||||
"name": "v4 Dev 5",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydxprotocol-testnet",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "http://dev5-indexer-apne1-lb-public-1721328151.ap-northeast-1.elb.amazonaws.com",
|
|
||||||
"socket": "ws://dev5-indexer-apne1-lb-public-1721328151.ap-northeast-1.elb.amazonaws.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validators": [
|
|
||||||
"http://18.223.78.50"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.0xsquid.com"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "dYdX v4",
|
|
||||||
"description": "dYdX v4 App",
|
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "wss://api.stage.dydx.exchange/wc/"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX Chain Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX Chain"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-staging": {
|
|
||||||
"name": "v4 Staging",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydxprotocol-testnet",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "https://indexer.v4staging.dydx.exchange",
|
|
||||||
"socket": "wss://indexer.v4staging.dydx.exchange"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"faucet": "https://faucet.v4staging.dydx.exchange",
|
|
||||||
"validators": [
|
|
||||||
"https://validator.v4staging.dydx.exchange"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.squidrouter.com"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
|
||||||
"community": "https://discord.com/invite/dydx",
|
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "dYdX v4",
|
|
||||||
"description": "dYdX v4 App",
|
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "wss://api.stage.dydx.exchange/wc/"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX Chain Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX Chain"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-staging-west": {
|
|
||||||
"name": "v4 Staging West",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydxprotocol-testnet",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "https://indexer.v4staging.dydx.exchange",
|
|
||||||
"socket": "wss://indexer.v4staging.dydx.exchange"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"faucet": "https://faucet.v4staging.dydx.exchange",
|
|
||||||
"validators": [
|
|
||||||
"https://validator-uswest1.v4staging.dydx.exchange"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.squidrouter.com"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
|
||||||
"community": "https://discord.com/invite/dydx",
|
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "dYdX v4",
|
|
||||||
"description": "dYdX v4 App",
|
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "wss://api.stage.dydx.exchange/wc/"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX Chain Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX Chain"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-testnet": {
|
|
||||||
"name": "v4 Public Testnet",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydx-testnet-3",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "https://dydx-testnet.imperator.co",
|
|
||||||
"socket": "wss://dydx-testnet.imperator.co"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validators": [
|
|
||||||
"https://dydx-testnet.nodefleet.org",
|
|
||||||
"https://test-dydx.kingnodes.com",
|
|
||||||
"https://dydx-rpc.liquify.com/api=8878132/dydx"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.squidrouter.com",
|
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
|
||||||
"community": "https://discord.com/invite/dydx",
|
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "dYdX v4",
|
|
||||||
"description": "dYdX v4 App",
|
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "wss://api.stage.dydx.exchange/wc/"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX V4 Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX V4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-testnet-dydx": {
|
|
||||||
"name": "v4 Public Testnet/dYdX",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydx-testnet-3",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "https://indexer.v4testnet.dydx.exchange",
|
|
||||||
"socket": "wss://indexer.v4testnet.dydx.exchange"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validators": [
|
|
||||||
"https://validator.v4testnet.dydx.exchange"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.squidrouter.com",
|
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
|
||||||
"community": "https://discord.com/invite/dydx",
|
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "dYdX v4",
|
|
||||||
"description": "dYdX v4 App",
|
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "wss://api.stage.dydx.exchange/wc/"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX V4 Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX V4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-testnet-dsrv": {
|
|
||||||
"name": "v4 Public Testnet/DSRV",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydx-testnet-3",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "https://dydx-testnet.imperator.co",
|
|
||||||
"socket": "wss://dydx-testnet.imperator.co"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validators": [
|
|
||||||
"https://dydx-testnet-archive.allthatnode.com:26657/XZvMM41hESf8PJrEQiTzbCOMVyFca79R"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.squidrouter.com",
|
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
|
||||||
"community": "https://discord.com/invite/dydx",
|
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "dYdX v4",
|
|
||||||
"description": "dYdX v4 App",
|
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "wss://api.stage.dydx.exchange/wc/"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX V4 Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX V4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-testnet-nodefleet": {
|
|
||||||
"name": "v4 Public Testnet/nodefleet",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydx-testnet-3",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "https://dydx-testnet.imperator.co",
|
|
||||||
"socket": "wss://dydx-testnet.imperator.co"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validators": [
|
|
||||||
"https://dydx-testnet.nodefleet.org"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.squidrouter.com",
|
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
|
||||||
"community": "https://discord.com/invite/dydx",
|
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "dYdX v4",
|
|
||||||
"description": "dYdX v4 App",
|
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "wss://api.stage.dydx.exchange/wc/"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX V4 Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX V4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-testnet-kingnodes": {
|
|
||||||
"name": "v4 Public Testnet/KingNodes",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydx-testnet-3",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "https://dydx-testnet.imperator.co",
|
|
||||||
"socket": "wss://dydx-testnet.imperator.co"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validators": [
|
|
||||||
"https://test-dydx.kingnodes.com"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.squidrouter.com",
|
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
|
||||||
"community": "https://discord.com/invite/dydx",
|
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "dYdX v4",
|
|
||||||
"description": "dYdX v4 App",
|
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "wss://api.stage.dydx.exchange/wc/"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX V4 Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX V4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-testnet-liquify": {
|
|
||||||
"name": "v4 Public Testnet/Liquify",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydx-testnet-3",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "https://dydx-testnet.imperator.co",
|
|
||||||
"socket": "wss://dydx-testnet.imperator.co"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validators": [
|
|
||||||
"https://dydx-rpc.liquify.com/api=8878132/dydx"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.squidrouter.com",
|
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
|
||||||
"community": "https://discord.com/invite/dydx",
|
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "dYdX v4",
|
|
||||||
"description": "dYdX v4 App",
|
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "wss://api.stage.dydx.exchange/wc/"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX V4 Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX V4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-mainet": {
|
|
||||||
"name": "v4",
|
|
||||||
"ethereumChainId": "1",
|
|
||||||
"dydxChainId": "[mainnet chain id]",
|
|
||||||
"isMainNet": true,
|
|
||||||
"tokens": {
|
|
||||||
"comment": "Change according to mainnet release",
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "dv4tnt",
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "[REST endpoint]",
|
|
||||||
"socket": "[Websocket endpoint]"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validators": [
|
|
||||||
"[Validator endpoint 1",
|
|
||||||
"[Validator endpoint n]"
|
|
||||||
],
|
|
||||||
"0xsquid": "[0xSquid endpoint for mainnet]"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "[HTTP link to TOS]",
|
|
||||||
"privacy": "[HTTP link to Privacy Policy]",
|
|
||||||
"mintscan": "[HTTP link to Mintscan, with {tx_hash} placeholder]",
|
|
||||||
"documentation": "[HTTP link to documentation, can be null]",
|
|
||||||
"community": "[HTTP link to community, can be null]",
|
|
||||||
"feedback": "[HTTP link to feedback form, can be null]",
|
|
||||||
"blogs": "[HTTP link to blogs, can be null]"
|
|
||||||
},
|
|
||||||
"wallets": {
|
|
||||||
"walletconnect": {
|
|
||||||
"client": {
|
|
||||||
"name": "[Name of the app]",
|
|
||||||
"description": "[Description of the app]",
|
|
||||||
"iconUrl": "[Relative URL of the icon URL]"
|
|
||||||
},
|
|
||||||
"v1": {
|
|
||||||
"bridgeUrl": "[Bridge URL]"
|
|
||||||
},
|
|
||||||
"v2": {
|
|
||||||
"projectId": "[Project ID]"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "[Relative callback URL for WalletSegue, should match apple-app-site-association]"
|
|
||||||
},
|
|
||||||
"images": "[Relative URL for wallet images]",
|
|
||||||
"signTypedDataAction": "dYdX Chain Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX Chain"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,454 +0,0 @@
|
|||||||
{
|
|
||||||
"1INCH-USD":{
|
|
||||||
"name":"1inch",
|
|
||||||
"tags":[
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://1inch.io/",
|
|
||||||
"whitepaperLink":"https://github.com/1inch",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/1inch/"
|
|
||||||
},
|
|
||||||
"AAVE-USD":{
|
|
||||||
"name":"Aave",
|
|
||||||
"tags":[
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://aave.com/",
|
|
||||||
"whitepaperLink":"https://github.com/aave/protocol-v2/blob/master/aave-v2-whitepaper.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/aave/"
|
|
||||||
},
|
|
||||||
"ADA-USD":{
|
|
||||||
"name":"Cardano",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://cardano.org/",
|
|
||||||
"whitepaperLink":"https://why.cardano.org/en/introduction/motivation/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/cardano/"
|
|
||||||
},
|
|
||||||
"ALGO-USD":{
|
|
||||||
"name":"Algorand",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://algorand.com/",
|
|
||||||
"whitepaperLink":"https://algorand.com/technology/white-papers",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/algorand/"
|
|
||||||
},
|
|
||||||
"APE-USD":{
|
|
||||||
"name":"ApeCoin",
|
|
||||||
"tags":[
|
|
||||||
|
|
||||||
],
|
|
||||||
"websiteLink":"https://apecoin.com/",
|
|
||||||
"whitepaperLink":"https://apecoin.com/about",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/apecoin-ape/"
|
|
||||||
},
|
|
||||||
"APT-USD":{
|
|
||||||
"name":"Aptos",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://aptoslabs.com/",
|
|
||||||
"whitepaperLink":"https://aptos.dev/aptos-white-paper/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/aptos/"
|
|
||||||
},
|
|
||||||
"ARB-USD":{
|
|
||||||
"name":"Arbitrum",
|
|
||||||
"tags":[
|
|
||||||
|
|
||||||
],
|
|
||||||
"websiteLink":"https://arbitrum.io/",
|
|
||||||
"whitepaperLink":"https://github.com/OffchainLabs/nitro",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/arbitrum/"
|
|
||||||
},
|
|
||||||
"ATOM-USD":{
|
|
||||||
"name":"Cosmos",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://cosmos.network/",
|
|
||||||
"whitepaperLink":"https://v1.cosmos.network/resources/whitepaper",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/cosmos/"
|
|
||||||
},
|
|
||||||
"AVAX-USD":{
|
|
||||||
"name":"Avalanche",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://www.avalabs.org/",
|
|
||||||
"whitepaperLink":"https://assets.website-files.com/5d80307810123f5ffbb34d6e/6008d7bbf8b10d1eb01e7e16_Avalanche%20Platform%20Whitepaper.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/avalanche/"
|
|
||||||
},
|
|
||||||
"BCH-USD":{
|
|
||||||
"name":"Bitcoin Cash",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://bitcoincash.org/",
|
|
||||||
"whitepaperLink":"https://bitcoincash.org/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/bitcoin-cash/"
|
|
||||||
},
|
|
||||||
"BLUR-USD":{
|
|
||||||
"name":"Blur",
|
|
||||||
"tags":[
|
|
||||||
|
|
||||||
],
|
|
||||||
"websiteLink":"https://blur.io/",
|
|
||||||
"whitepaperLink":"https://docs.blur.foundation/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/blur-token/"
|
|
||||||
},
|
|
||||||
"CELO-USD":{
|
|
||||||
"name":"Celo",
|
|
||||||
"tags":[
|
|
||||||
|
|
||||||
],
|
|
||||||
"websiteLink":"https://celo.org",
|
|
||||||
"whitepaperLink":"https://docs.celo.org",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/celo/"
|
|
||||||
},
|
|
||||||
"BTC-USD":{
|
|
||||||
"name":"Bitcoin",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://bitcoin.org/",
|
|
||||||
"whitepaperLink":"https://bitcoin.org/bitcoin.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/bitcoin/"
|
|
||||||
},
|
|
||||||
"COMP-USD":{
|
|
||||||
"name":"Compound",
|
|
||||||
"tags":[
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://compound.finance/",
|
|
||||||
"whitepaperLink":"https://compound.finance/documents/Compound.Whitepaper.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/compound/"
|
|
||||||
},
|
|
||||||
"CRV-USD":{
|
|
||||||
"name":"Curve",
|
|
||||||
"tags":[
|
|
||||||
"Governance"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://curve.fi/",
|
|
||||||
"whitepaperLink":"https://curve.fi/whitepaper",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/curve-dao-token/"
|
|
||||||
},
|
|
||||||
"DOGE-USD":{
|
|
||||||
"name":"Dogecoin",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://dogecoin.com/",
|
|
||||||
"whitepaperLink":"https://github.com/dogecoin/dogecoin",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/dogecoin/"
|
|
||||||
},
|
|
||||||
"DOT-USD":{
|
|
||||||
"name":"Polkadot",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://polkadot.network/",
|
|
||||||
"whitepaperLink":"https://polkadot.network/PolkaDotPaper.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/polkadot-new/"
|
|
||||||
},
|
|
||||||
"ENJ-USD":{
|
|
||||||
"name":"Enjin",
|
|
||||||
"tags":[
|
|
||||||
|
|
||||||
],
|
|
||||||
"websiteLink":"https://enjin.io/",
|
|
||||||
"whitepaperLink":"https://cdn.enjin.io/downloads/whitepapers/enjin-coin/en.pdf/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/enjin-coin/"
|
|
||||||
},
|
|
||||||
"EOS-USD":{
|
|
||||||
"name":"EOS",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://eos.io/",
|
|
||||||
"whitepaperLink":"https://github.com/EOSIO/Documentation/blob/master/TechnicalWhitePaper.md",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/eos/"
|
|
||||||
},
|
|
||||||
"ETC-USD":{
|
|
||||||
"name":"Ethereum Classic",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://ethereumclassic.org/",
|
|
||||||
"whitepaperLink":"https://ethereumclassic.org/why-classic",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/ethereum-classic/"
|
|
||||||
},
|
|
||||||
"ETH-USD":{
|
|
||||||
"name":"Ethereum",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://ethereum.org/",
|
|
||||||
"whitepaperLink":"https://ethereum.org/whitepaper/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/ethereum/",
|
|
||||||
"displayStepSize":"0.001",
|
|
||||||
"displayTickSize":"0.1"
|
|
||||||
},
|
|
||||||
"FIL-USD":{
|
|
||||||
"name":"Filecoin",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://filecoin.io/",
|
|
||||||
"whitepaperLink":"https://filecoin.io/filecoin.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/filecoin/"
|
|
||||||
},
|
|
||||||
"HNT-USD":{
|
|
||||||
"name":"Helium",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://www.helium.com",
|
|
||||||
"whitepaperLink":"http://whitepaper.helium.com",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/helium/"
|
|
||||||
},
|
|
||||||
"ICP-USD":{
|
|
||||||
"name":"Internet Computer",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://dfinity.org",
|
|
||||||
"whitepaperLink":"https://dfinity.org/whitepaper.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/internet-computer/"
|
|
||||||
},
|
|
||||||
"LDO-USD":{
|
|
||||||
"name":"Lido DAO",
|
|
||||||
"tags":[
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://lido.fi/",
|
|
||||||
"whitepaperLink":"https://lido.fi/static/Lido:Ethereum-Liquid-Staking.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/lido-dao/"
|
|
||||||
},
|
|
||||||
"LINK-USD":{
|
|
||||||
"name":"Chainlink",
|
|
||||||
"tags":[
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://chain.link/",
|
|
||||||
"whitepaperLink":"https://link.smartcontract.com/whitepaper",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/chainlink/"
|
|
||||||
},
|
|
||||||
"LTC-USD":{
|
|
||||||
"name":"Litecoin",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://litecoin.org/",
|
|
||||||
"whitepaperLink":"https://litecoin.info/index.php/Main_Page",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/litecoin/"
|
|
||||||
},
|
|
||||||
"MATIC-USD":{
|
|
||||||
"name":"Polygon",
|
|
||||||
"tags":[
|
|
||||||
"Layer 2"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://polygon.technology/",
|
|
||||||
"whitepaperLink":"https://polygon.technology/lightpaper-polygon.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/polygon/"
|
|
||||||
},
|
|
||||||
"MKR-USD":{
|
|
||||||
"name":"Maker",
|
|
||||||
"tags":[
|
|
||||||
"Governance"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://makerdao.com",
|
|
||||||
"whitepaperLink":"https://makerdao.com/whitepaper",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/maker/"
|
|
||||||
},
|
|
||||||
"NEAR-USD":{
|
|
||||||
"name":"NEAR Protocol",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://near.org",
|
|
||||||
"whitepaperLink":"https://near.org/papers/the-official-near-white-paper/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/near-protocol/"
|
|
||||||
},
|
|
||||||
"OP-USD":{
|
|
||||||
"name":"Optimism",
|
|
||||||
"tags":[
|
|
||||||
|
|
||||||
],
|
|
||||||
"websiteLink":"https://www.optimism.io/",
|
|
||||||
"whitepaperLink":"https://github.com/ethereum-optimism",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/optimism-ethereum/"
|
|
||||||
},
|
|
||||||
"PEPE-USD":{
|
|
||||||
"name":"Pepe",
|
|
||||||
"tags":[
|
|
||||||
|
|
||||||
],
|
|
||||||
"websiteLink":"https://www.pepe.vip/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/pepe/"
|
|
||||||
},
|
|
||||||
"RUNE-USD":{
|
|
||||||
"name":"THORChain",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://thorchain.org",
|
|
||||||
"whitepaperLink":"https://whitepaper.io/document/709/thorchain-whitepaper",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/thorchain/"
|
|
||||||
},
|
|
||||||
"SEI-USD":{
|
|
||||||
"name":"Sei",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1",
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://www.sei.io/",
|
|
||||||
"whitepaperLink":"https://github.com/sei-protocol/sei-chain/blob/3c9576fee3494ce039df684624f918dd8066ba3f/whitepaper/Sei_Whitepaper.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/sei/"
|
|
||||||
},
|
|
||||||
"SHIB-USD":{
|
|
||||||
"name":"Shiba Inu",
|
|
||||||
"tags":[
|
|
||||||
|
|
||||||
],
|
|
||||||
"websiteLink":"https://shibatoken.com/",
|
|
||||||
"whitepaperLink":"https://docs.shibatoken.com/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/shiba-inu/"
|
|
||||||
},
|
|
||||||
"SNX-USD":{
|
|
||||||
"name":"Synthetix",
|
|
||||||
"tags":[
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://synthetix.io/",
|
|
||||||
"whitepaperLink":"https://docs.synthetix.io/litepaper",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/synthetix-network-token/"
|
|
||||||
},
|
|
||||||
"SOL-USD":{
|
|
||||||
"name":"Solana",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://solana.com/",
|
|
||||||
"whitepaperLink":"https://solana.com/solana-whitepaper.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/solana/"
|
|
||||||
},
|
|
||||||
"SUI-USD":{
|
|
||||||
"name":"Sui",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://sui.io/",
|
|
||||||
"whitepaperLink":"https://github.com/MystenLabs",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/sui/"
|
|
||||||
},
|
|
||||||
"SUSHI-USD":{
|
|
||||||
"name":"Sushi",
|
|
||||||
"tags":[
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://sushi.com/",
|
|
||||||
"whitepaperLink":"https://docs.sushi.com/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/sushiswap/"
|
|
||||||
},
|
|
||||||
"TRX-USD":{
|
|
||||||
"name":"TRON",
|
|
||||||
"tags":[
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://tron.network/",
|
|
||||||
"whitepaperLink":"https://tron.network/static/doc/white_paper_v_2_0.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/tron/"
|
|
||||||
},
|
|
||||||
"UMA-USD":{
|
|
||||||
"name":"UMA",
|
|
||||||
"tags":[
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://umaproject.org/",
|
|
||||||
"whitepaperLink":"https://github.com/UMAprotocol/whitepaper",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/uma/"
|
|
||||||
},
|
|
||||||
"UNI-USD":{
|
|
||||||
"name":"Uniswap",
|
|
||||||
"tags":[
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://uniswap.org/",
|
|
||||||
"whitepaperLink":"https://uniswap.org/whitepaper-v3.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/uniswap/"
|
|
||||||
},
|
|
||||||
"WLD-USD":{
|
|
||||||
"name":"Worldcoin",
|
|
||||||
"tags":[
|
|
||||||
|
|
||||||
],
|
|
||||||
"websiteLink":"https://worldcoin.org/",
|
|
||||||
"whitepaperLink":"https://whitepaper.worldcoin.org/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/worldcoin-org/"
|
|
||||||
},
|
|
||||||
"XLM-USD":{
|
|
||||||
"name":"Stellar",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://www.stellar.org/",
|
|
||||||
"whitepaperLink":"https://www.stellar.org/papers/stellar-consensus-protocol",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/stellar/"
|
|
||||||
},
|
|
||||||
"XMR-USD":{
|
|
||||||
"name":"Monero",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://www.getmonero.org/",
|
|
||||||
"whitepaperLink":"https://www.getmonero.org/resources/research-lab/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/monero/"
|
|
||||||
},
|
|
||||||
"XRP-USD":{
|
|
||||||
"name":"Ripple",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://ripple.com/currency/",
|
|
||||||
"whitepaperLink":"https://github.com/ripple",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/xrp/"
|
|
||||||
},
|
|
||||||
"XTZ-USD":{
|
|
||||||
"name":"Tezos",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://tezos.com",
|
|
||||||
"whitepaperLink":"https://tezos.com/whitepaper.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/tezos/"
|
|
||||||
},
|
|
||||||
"YFI-USD":{
|
|
||||||
"name":"Yearn",
|
|
||||||
"tags":[
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://yearn.finance/",
|
|
||||||
"whitepaperLink":"https://docs.yearn.finance/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/yearn-finance/"
|
|
||||||
},
|
|
||||||
"ZEC-USD":{
|
|
||||||
"name":"Zcash",
|
|
||||||
"tags":[
|
|
||||||
"Layer 1"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://z.cash/",
|
|
||||||
"whitepaperLink":"https://z.cash/technology/",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/zcash/"
|
|
||||||
},
|
|
||||||
"ZRX-USD":{
|
|
||||||
"name":"0x",
|
|
||||||
"tags":[
|
|
||||||
"Defi"
|
|
||||||
],
|
|
||||||
"websiteLink":"https://0x.org/",
|
|
||||||
"whitepaperLink":"https://0x.org/pdfs/0x_white_paper.pdf",
|
|
||||||
"coinMarketCapsLink":"https://coinmarketcap.com/currencies/0x/"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,474 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"id":"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",
|
|
||||||
"name":"MetaMask",
|
|
||||||
"description":"",
|
|
||||||
"homepage":"https://metamask.io/",
|
|
||||||
"chains":[
|
|
||||||
"eip155:1",
|
|
||||||
"eip155:42161",
|
|
||||||
"eip155:43114"
|
|
||||||
],
|
|
||||||
"versions":[
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"app":{
|
|
||||||
"browser":"",
|
|
||||||
"ios":"https://apps.apple.com/us/app/metamask/id1438144202",
|
|
||||||
"android":"https://play.google.com/store/apps/details?id=io.metamask",
|
|
||||||
"mac":"",
|
|
||||||
"windows":"",
|
|
||||||
"linux":""
|
|
||||||
},
|
|
||||||
"mobile":{
|
|
||||||
"native":"metamask:",
|
|
||||||
"universal":"https://metamask.app.link"
|
|
||||||
},
|
|
||||||
"desktop":{
|
|
||||||
"native":"",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"metadata":{
|
|
||||||
"shortName":"MetaMask",
|
|
||||||
"colors":{
|
|
||||||
"primary":"rgb(255, 255, 255)",
|
|
||||||
"secondary":""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config":{
|
|
||||||
"comment":"MetaMask",
|
|
||||||
"iosMinVersion":"0",
|
|
||||||
"imageUrl":"https://v4.testnet.dydx.exchange/wallets/metamask.png",
|
|
||||||
"image":"metamask.png",
|
|
||||||
"encoding":"=\"#%/<>?@\\^`{|}:&",
|
|
||||||
"connections":[
|
|
||||||
{
|
|
||||||
"type":"walletConnectV2",
|
|
||||||
"native":"metamask:",
|
|
||||||
"universal":"https://metamask.app.link"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"userFields":{
|
|
||||||
"analyticEvent":"METAMASK"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":"coinbase-wallet",
|
|
||||||
"name":"Coinbase Wallet",
|
|
||||||
"description":"",
|
|
||||||
"homepage":"https://www.coinbase.com/wallet",
|
|
||||||
"chains":[
|
|
||||||
"eip155:1"
|
|
||||||
],
|
|
||||||
"versions":[
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"app":{
|
|
||||||
"browser":"",
|
|
||||||
"ios":"https://apps.apple.com/us/app/coinbase-wallet-nfts-crypto/id1278383455",
|
|
||||||
"android":"https://play.google.com/store/apps/details?id=org.toshi",
|
|
||||||
"mac":"",
|
|
||||||
"windows":"",
|
|
||||||
"linux":""
|
|
||||||
},
|
|
||||||
"mobile":{
|
|
||||||
"native":"cbwallet:",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"desktop":{
|
|
||||||
"native":"",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"metadata":{
|
|
||||||
"shortName":"Coinbase",
|
|
||||||
"colors":{
|
|
||||||
"primary":"rgb(255, 255, 255)",
|
|
||||||
"secondary":""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config":{
|
|
||||||
"comment":"Coinbase",
|
|
||||||
"iosMinVersion":"1.8.0",
|
|
||||||
"imageUrl":"https://v4.testnet.dydx.exchange/wallets/coinbase-wallet.png",
|
|
||||||
"image":"coinbase-wallet.png",
|
|
||||||
"encoding":"=\"#%/<>?@\\^`{|}:&",
|
|
||||||
"connections":[
|
|
||||||
{
|
|
||||||
"type":"walletSegue",
|
|
||||||
"native":"cbwallet:",
|
|
||||||
"universal":""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"userFields":{
|
|
||||||
"analyticEvent":"COINBASE_WALLET"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":"9d373b43ad4d2cf190fb1a774ec964a1addf406d6fd24af94ab7596e58c291b2",
|
|
||||||
"name":"imToken",
|
|
||||||
"description":"",
|
|
||||||
"homepage":"https://token.im/",
|
|
||||||
"chains":[
|
|
||||||
"eip155:1"
|
|
||||||
],
|
|
||||||
"versions":[
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"app":{
|
|
||||||
"browser":"",
|
|
||||||
"ios":"https://itunes.apple.com/us/app/imtoken2/id1384798940",
|
|
||||||
"android":"https://play.google.com/store/apps/details?id=im.token.app",
|
|
||||||
"mac":"",
|
|
||||||
"windows":"",
|
|
||||||
"linux":""
|
|
||||||
},
|
|
||||||
"mobile":{
|
|
||||||
"native":"imtokenv2:",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"desktop":{
|
|
||||||
"native":"",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"metadata":{
|
|
||||||
"shortName":"imToken",
|
|
||||||
"colors":{
|
|
||||||
"primary":"rgb(255, 255, 255)",
|
|
||||||
"secondary":""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config":{
|
|
||||||
"comment":"imToken",
|
|
||||||
"iosMinVersion":"0",
|
|
||||||
"imageUrl":"https://v4.testnet.dydx.exchange/wallets/imtoken.png",
|
|
||||||
"image":"imtoken.png",
|
|
||||||
"connections":[
|
|
||||||
{
|
|
||||||
"type":"walletConnect",
|
|
||||||
"native":"imtokenv2:",
|
|
||||||
"universal":""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"userFields":{
|
|
||||||
"analyticEvent":"IMTOKEN"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",
|
|
||||||
"name":"Trust Wallet",
|
|
||||||
"description":"",
|
|
||||||
"homepage":"https://trustwallet.com/",
|
|
||||||
"chains":[
|
|
||||||
"eip155:1",
|
|
||||||
"eip155:42161",
|
|
||||||
"eip155:43114"
|
|
||||||
],
|
|
||||||
"versions":[
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"app":{
|
|
||||||
"browser":"",
|
|
||||||
"ios":"https://apps.apple.com/app/apple-store/id1288339409",
|
|
||||||
"android":"https://play.google.com/store/apps/details?id=com.wallet.crypto.trustapp",
|
|
||||||
"mac":"",
|
|
||||||
"windows":"",
|
|
||||||
"linux":""
|
|
||||||
},
|
|
||||||
"mobile":{
|
|
||||||
"native":"trust:",
|
|
||||||
"universal":"https://link.trustwallet.com"
|
|
||||||
},
|
|
||||||
"desktop":{
|
|
||||||
"native":"",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"metadata":{
|
|
||||||
"shortName":"Trust",
|
|
||||||
"colors":{
|
|
||||||
"primary":"rgb(51, 117, 187)",
|
|
||||||
"secondary":""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config":{
|
|
||||||
"comment":"Trust Wallet",
|
|
||||||
"iosMinVersion":"0",
|
|
||||||
"encoding":"=\"#%/<>?@\\^`{|}:&",
|
|
||||||
"imageUrl":"https://v4.testnet.dydx.exchange/wallets/trust-wallet.png",
|
|
||||||
"image":"trust-wallet.png",
|
|
||||||
"connections":[
|
|
||||||
{
|
|
||||||
"type":"walletConnectV2",
|
|
||||||
"native":"trust:",
|
|
||||||
"universal":"https://link.trustwallet.com"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"userFields":{
|
|
||||||
"analyticEvent":"TRUST_WALLET"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":"Zerion",
|
|
||||||
"name":"Zerion",
|
|
||||||
"description":"",
|
|
||||||
"homepage":"https://zerion.io/",
|
|
||||||
"chains":[
|
|
||||||
"eip155:1"
|
|
||||||
],
|
|
||||||
"versions":[
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"app":{
|
|
||||||
"browser":"",
|
|
||||||
"ios":"https://apps.apple.com/app/apple-store/id1456732565",
|
|
||||||
"android":"https://play.google.com/store/apps/details?id=io.zerion.android",
|
|
||||||
"mac":"",
|
|
||||||
"windows":"",
|
|
||||||
"linux":""
|
|
||||||
},
|
|
||||||
"mobile":{
|
|
||||||
"native":"zerion:",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"desktop":{
|
|
||||||
"native":"",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"metadata":{
|
|
||||||
"shortName":"Zerion",
|
|
||||||
"colors":{
|
|
||||||
"primary":"rgb(51, 117, 187)",
|
|
||||||
"secondary":""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config":{
|
|
||||||
"comment":"Zerion Wallet",
|
|
||||||
"iosMinVersion":"0",
|
|
||||||
"encoding":"=\"#%/<>?@\\^`{|}:&",
|
|
||||||
"imageUrl":"https://v4.testnet.dydx.exchange/wallets/zerion.png",
|
|
||||||
"image":"zerion.png",
|
|
||||||
"connections":[
|
|
||||||
{
|
|
||||||
"type":"walletConnectV2",
|
|
||||||
"native":"zerion:",
|
|
||||||
"universal":""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"userFields":{
|
|
||||||
"analyticEvent":"ZERION"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":"20459438007b75f4f4acb98bf29aa3b800550309646d375da5fd4aac6c2a2c66",
|
|
||||||
"name":"TokenPocket",
|
|
||||||
"description":"",
|
|
||||||
"homepage":"https://tokenpocket.pro/",
|
|
||||||
"chains":[
|
|
||||||
"eip155:1"
|
|
||||||
],
|
|
||||||
"versions":[
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"app":{
|
|
||||||
"browser":"",
|
|
||||||
"ios":"https://apps.apple.com/us/app/tokenpocket-trusted-wallet/id1436028697",
|
|
||||||
"android":"https://play.google.com/store/apps/details?id=vip.mytokenpocket",
|
|
||||||
"mac":"",
|
|
||||||
"windows":"",
|
|
||||||
"linux":""
|
|
||||||
},
|
|
||||||
"mobile":{
|
|
||||||
"native":"tpoutside:",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"desktop":{
|
|
||||||
"native":"",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"metadata":{
|
|
||||||
"shortName":"TokenPocket",
|
|
||||||
"colors":{
|
|
||||||
"primary":"rgb(41, 128, 254)",
|
|
||||||
"secondary":""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config":{
|
|
||||||
"comment":"TokenPocket",
|
|
||||||
"iosMinVersion":"0",
|
|
||||||
"imageUrl":"https://v4.testnet.dydx.exchange/wallets/tokenpocket.png",
|
|
||||||
"image":"tokenpocket.png",
|
|
||||||
"connections":[
|
|
||||||
{
|
|
||||||
"type":"walletConnect",
|
|
||||||
"native":"tpoutside:",
|
|
||||||
"universal":""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"userFields":{
|
|
||||||
"analyticEvent":"TOKEN_POCKET"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",
|
|
||||||
"name":"Rainbow",
|
|
||||||
"description":"",
|
|
||||||
"homepage":"https://rainbow.me/",
|
|
||||||
"chains":[
|
|
||||||
"eip155:1"
|
|
||||||
],
|
|
||||||
"versions":[
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"app":{
|
|
||||||
"browser":"",
|
|
||||||
"ios":"https://apps.apple.com/us/app/rainbow-ethereum-wallet/id1457119021",
|
|
||||||
"android":"",
|
|
||||||
"mac":"",
|
|
||||||
"windows":"",
|
|
||||||
"linux":""
|
|
||||||
},
|
|
||||||
"mobile":{
|
|
||||||
"native":"rainbow:",
|
|
||||||
"universal":"https://rnbwapp.com"
|
|
||||||
},
|
|
||||||
"desktop":{
|
|
||||||
"native":"",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"metadata":{
|
|
||||||
"shortName":"Rainbow",
|
|
||||||
"colors":{
|
|
||||||
"primary":"rgb(0, 30, 89)",
|
|
||||||
"secondary":""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config":{
|
|
||||||
"comment":"Rainbow",
|
|
||||||
"iosMinVersion":"0",
|
|
||||||
"encoding":"=\"#%/<>?@\\^`{|}:&",
|
|
||||||
"backlinked":true,
|
|
||||||
"imageUrl":"https://v4.testnet.dydx.exchange/wallets/rainbow-wallet.png",
|
|
||||||
"image":"rainbow-wallet.png",
|
|
||||||
"connections":[
|
|
||||||
{
|
|
||||||
"type":"walletConnectV2",
|
|
||||||
"native":"rainbow:",
|
|
||||||
"universal":"https://rnbwapp.com"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"userFields":{
|
|
||||||
"analyticEvent":"RAINBOW_WALLET"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":"09102e7bbbd3f92001eda104abe23803181629f695e8f1b95af96d88ff7d5890",
|
|
||||||
"name":"1inch Wallet",
|
|
||||||
"description":"",
|
|
||||||
"homepage":"https://1inch.io/wallet/",
|
|
||||||
"chains":[
|
|
||||||
"eip155:1",
|
|
||||||
"eip155:56"
|
|
||||||
],
|
|
||||||
"versions":[
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"app":{
|
|
||||||
"browser":"",
|
|
||||||
"ios":"https://apps.apple.com/us/app/1inch-defi-wallet/id1546049391",
|
|
||||||
"android":"",
|
|
||||||
"mac":"",
|
|
||||||
"windows":"",
|
|
||||||
"linux":""
|
|
||||||
},
|
|
||||||
"mobile":{
|
|
||||||
"native":"oneinch:",
|
|
||||||
"universal":"https://wallet.1inch.io"
|
|
||||||
},
|
|
||||||
"desktop":{
|
|
||||||
"native":"",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"metadata":{
|
|
||||||
"shortName":"1inch",
|
|
||||||
"colors":{
|
|
||||||
"primary":"rgb(31, 36, 46)",
|
|
||||||
"secondary":""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config":{
|
|
||||||
"comment":"1inch",
|
|
||||||
"iosMinVersion":"0",
|
|
||||||
"encoding":"=\"#%/<>?@\\^`{|}:&",
|
|
||||||
"imageUrl":"https://v4.testnet.dydx.exchange/wallets/1inch.png",
|
|
||||||
"image":"1inch.png",
|
|
||||||
"connections":[
|
|
||||||
{
|
|
||||||
"type":"walletConnect",
|
|
||||||
"native":"oneinch:",
|
|
||||||
"universal":"https://wallet.1inch.io"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"userFields":{
|
|
||||||
"analyticEvent":"1INCH"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"id":"bae74827272509a6d63ea25514d9c68ad235c14e45e183518c7ded4572a1b0c4",
|
|
||||||
"name":"Huobi Wallet",
|
|
||||||
"description":"",
|
|
||||||
"homepage":"https://huobiwallet.com/",
|
|
||||||
"chains":[
|
|
||||||
"eip155:1"
|
|
||||||
],
|
|
||||||
"versions":[
|
|
||||||
"1"
|
|
||||||
],
|
|
||||||
"app":{
|
|
||||||
"browser":"",
|
|
||||||
"ios":"https://apps.apple.com/us/app/id1433883012",
|
|
||||||
"android":"https://play.google.com/store/apps/details?id=com.huobionchainwallet.gp",
|
|
||||||
"mac":"",
|
|
||||||
"windows":"",
|
|
||||||
"linux":""
|
|
||||||
},
|
|
||||||
"mobile":{
|
|
||||||
"native":"huobiwallet:",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"desktop":{
|
|
||||||
"native":"",
|
|
||||||
"universal":""
|
|
||||||
},
|
|
||||||
"metadata":{
|
|
||||||
"shortName":"Huobi",
|
|
||||||
"colors":{
|
|
||||||
"primary":"rgb(45,101,248)",
|
|
||||||
"secondary":""
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"config":{
|
|
||||||
"comment":"Huobi",
|
|
||||||
"iosMinVersion":"0",
|
|
||||||
"encoding":"=\"#%/<>?@\\^`{|}:&",
|
|
||||||
"imageUrl":"https://v4.testnet.dydx.exchange/wallets/huobi-wallet.png",
|
|
||||||
"image":"huobi-wallet.png",
|
|
||||||
"connections":[
|
|
||||||
{
|
|
||||||
"type":"walletConnect",
|
|
||||||
"native":"huobiwallet:",
|
|
||||||
"universal":""
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"userFields":{
|
|
||||||
"analyticEvent":"HUOBI_WALLET"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 4.8 KiB |
@@ -1,19 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
source="dist/.well-known/apple-app-site-association"
|
|
||||||
if [ ! -f "$source" ]; then
|
|
||||||
echo "Error: $source file not found"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
app_id=$IOS_APP_ID
|
|
||||||
if [ -z "$app_id" ]; then
|
|
||||||
echo "Error: IOS_APP_ID is empty"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
||||||
sed -i '' "s/{PLACE_YOUR_APP_ID_HERE}/$app_id/g" $source
|
|
||||||
else
|
|
||||||
sed -i "s/{PLACE_YOUR_APP_ID_HERE}/$app_id/g" $source
|
|
||||||
fi
|
|
||||||
+4
-2
@@ -67,7 +67,9 @@ const Content = () => {
|
|||||||
<Route path={AppRoute.Trade} element={<TradePage />} />
|
<Route path={AppRoute.Trade} element={<TradePage />} />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path={AppRoute.Markets} element={<MarketsPage />} />
|
<Route path={AppRoute.Markets} element={<MarketsPage />} />
|
||||||
<Route path={AppRoute.Rewards} element={<RewardsPage />} />
|
{import.meta.env.MODE !== 'production' && (
|
||||||
|
<Route path={AppRoute.Rewards} element={<RewardsPage />} />
|
||||||
|
)}
|
||||||
{isTablet && (
|
{isTablet && (
|
||||||
<>
|
<>
|
||||||
<Route path={AppRoute.Alerts} element={<AlertsPage />} />
|
<Route path={AppRoute.Alerts} element={<AlertsPage />} />
|
||||||
@@ -195,7 +197,7 @@ Styled.NotificationsToastArea = styled(NotificationsToastArea)`
|
|||||||
|
|
||||||
Styled.DialogArea = styled.aside`
|
Styled.DialogArea = styled.aside`
|
||||||
position: fixed;
|
position: fixed;
|
||||||
height: 100%;
|
height: 100vh;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
inset: 0;
|
inset: 0;
|
||||||
overflow: clip;
|
overflow: clip;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ type ElementProps = {
|
|||||||
};
|
};
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
href?: string;
|
href?: string;
|
||||||
onClick?: (e: MouseEvent) => void;
|
onClick?: () => void;
|
||||||
withIcon?: boolean;
|
withIcon?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -37,12 +37,12 @@ export const Link = forwardRef<HTMLAnchorElement, ElementProps & StyleProps>(
|
|||||||
ref={ref}
|
ref={ref}
|
||||||
className={className}
|
className={className}
|
||||||
href={href}
|
href={href}
|
||||||
onClick={(e: MouseEvent) => {
|
onClick={() => {
|
||||||
if (analyticsConfig) {
|
if (analyticsConfig) {
|
||||||
console.log(analyticsConfig);
|
console.log(analyticsConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
onClick?.(e);
|
onClick?.();
|
||||||
}}
|
}}
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
target="_blank"
|
target="_blank"
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ type PanelProps = {
|
|||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
href?: string;
|
href?: string;
|
||||||
onHeaderClick?: () => void;
|
onHeaderClick?: () => void;
|
||||||
onClick?: () => void;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type PanelStyleProps = {
|
type PanelStyleProps = {
|
||||||
@@ -25,11 +24,10 @@ export const Panel = ({
|
|||||||
children,
|
children,
|
||||||
href,
|
href,
|
||||||
onHeaderClick,
|
onHeaderClick,
|
||||||
onClick,
|
|
||||||
hasSeparator,
|
hasSeparator,
|
||||||
className,
|
className,
|
||||||
}: PanelProps & PanelStyleProps) => (
|
}: PanelProps & PanelStyleProps) => (
|
||||||
<Styled.Panel onClick={onClick}>
|
<Styled.Panel>
|
||||||
{href ? (
|
{href ? (
|
||||||
<Link to={href}>
|
<Link to={href}>
|
||||||
{slotHeader ? (
|
{slotHeader ? (
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const MarketTableCell = ({
|
|||||||
slotLeft={
|
slotLeft={
|
||||||
<>
|
<>
|
||||||
{showFavorite && <Icon iconName={IconName.Star} />}
|
{showFavorite && <Icon iconName={IconName.Star} />}
|
||||||
<Styled.AssetIcon symbol={asset?.id} />
|
<Styled.AssetIcon symbol={asset?.symbol} />
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
|
|||||||
+9
-13
@@ -6,7 +6,6 @@ import { STRING_KEYS } from './localization';
|
|||||||
export type Nullable<T> = T | null | undefined;
|
export type Nullable<T> = T | null | undefined;
|
||||||
|
|
||||||
// ------ V4 Protocols ------ //
|
// ------ V4 Protocols ------ //
|
||||||
export const AbacusAppConfig = Abacus.exchange.dydx.abacus.state.manager.AppConfigs;
|
|
||||||
export const IOImplementations = Abacus.exchange.dydx.abacus.utils.IOImplementations;
|
export const IOImplementations = Abacus.exchange.dydx.abacus.utils.IOImplementations;
|
||||||
export const UIImplementations = Abacus.exchange.dydx.abacus.utils.UIImplementations;
|
export const UIImplementations = Abacus.exchange.dydx.abacus.utils.UIImplementations;
|
||||||
export type AbacusDYDXChainTransactionsProtocol = Omit<
|
export type AbacusDYDXChainTransactionsProtocol = Omit<
|
||||||
@@ -41,10 +40,6 @@ export type AbacusFileSystemProtocol = Omit<
|
|||||||
Abacus.exchange.dydx.abacus.protocols.FileSystemProtocol,
|
Abacus.exchange.dydx.abacus.protocols.FileSystemProtocol,
|
||||||
'__doNotUseOrImplementIt'
|
'__doNotUseOrImplementIt'
|
||||||
>;
|
>;
|
||||||
export type AbacusTrackingProtocol = Omit<
|
|
||||||
Abacus.exchange.dydx.abacus.protocols.TrackingProtocol,
|
|
||||||
'__doNotUseOrImplementIt'
|
|
||||||
>;
|
|
||||||
|
|
||||||
export type FileLocation = Abacus.exchange.dydx.abacus.protocols.FileLocation;
|
export type FileLocation = Abacus.exchange.dydx.abacus.protocols.FileLocation;
|
||||||
export type ThreadingType = Abacus.exchange.dydx.abacus.protocols.ThreadingType;
|
export type ThreadingType = Abacus.exchange.dydx.abacus.protocols.ThreadingType;
|
||||||
@@ -70,8 +65,8 @@ export type NetworkConfig = {
|
|||||||
export type ConnectNetworkEvent = CustomEvent<Partial<NetworkConfig>>;
|
export type ConnectNetworkEvent = CustomEvent<Partial<NetworkConfig>>;
|
||||||
|
|
||||||
// ------ State ------
|
// ------ State ------
|
||||||
export type AbacusApiState = Abacus.exchange.dydx.abacus.state.manager.ApiState;
|
export type AbacusApiState = Abacus.exchange.dydx.abacus.state.app.ApiState;
|
||||||
export const AbacusApiStatus = Abacus.exchange.dydx.abacus.state.manager.ApiStatus;
|
export const AbacusApiStatus = Abacus.exchange.dydx.abacus.state.app.ApiStatus;
|
||||||
const abacusApiStatuses = [...AbacusApiStatus.values()];
|
const abacusApiStatuses = [...AbacusApiStatus.values()];
|
||||||
export type AbacusApiStatuses = (typeof abacusApiStatuses)[number];
|
export type AbacusApiStatuses = (typeof abacusApiStatuses)[number];
|
||||||
export const Changes = Abacus.exchange.dydx.abacus.state.changes.Changes;
|
export const Changes = Abacus.exchange.dydx.abacus.state.changes.Changes;
|
||||||
@@ -123,7 +118,6 @@ export const InputSelectionOption = Abacus.exchange.dydx.abacus.output.input.Sel
|
|||||||
|
|
||||||
// ------ Wallet ------ //
|
// ------ Wallet ------ //
|
||||||
export type Wallet = Abacus.exchange.dydx.abacus.output.Wallet;
|
export type Wallet = Abacus.exchange.dydx.abacus.output.Wallet;
|
||||||
export type AccountBalance = Abacus.exchange.dydx.abacus.output.AccountBalance;
|
|
||||||
export type Subaccount = Abacus.exchange.dydx.abacus.output.Subaccount;
|
export type Subaccount = Abacus.exchange.dydx.abacus.output.Subaccount;
|
||||||
export type SubaccountPosition = Abacus.exchange.dydx.abacus.output.SubaccountPosition;
|
export type SubaccountPosition = Abacus.exchange.dydx.abacus.output.SubaccountPosition;
|
||||||
export type SubaccountOrder = Abacus.exchange.dydx.abacus.output.SubaccountOrder;
|
export type SubaccountOrder = Abacus.exchange.dydx.abacus.output.SubaccountOrder;
|
||||||
@@ -140,7 +134,7 @@ export type SubaccountTransfers = Abacus.exchange.dydx.abacus.output.SubaccountT
|
|||||||
// ------ Historical PnL ------ //
|
// ------ Historical PnL ------ //
|
||||||
export type SubAccountHistoricalPNL = Abacus.exchange.dydx.abacus.output.SubaccountHistoricalPNL;
|
export type SubAccountHistoricalPNL = Abacus.exchange.dydx.abacus.output.SubaccountHistoricalPNL;
|
||||||
export type SubAccountHistoricalPNLs = Abacus.exchange.dydx.abacus.output.SubaccountHistoricalPNL[];
|
export type SubAccountHistoricalPNLs = Abacus.exchange.dydx.abacus.output.SubaccountHistoricalPNL[];
|
||||||
export const HistoricalPnlPeriod = Abacus.exchange.dydx.abacus.protocols.HistoricalPnlPeriod;
|
export const HistoricalPnlPeriod = Abacus.exchange.dydx.abacus.state.app.HistoricalPnlPeriod;
|
||||||
const historicalPnlPeriod = [...HistoricalPnlPeriod.values()] as const;
|
const historicalPnlPeriod = [...HistoricalPnlPeriod.values()] as const;
|
||||||
export type HistoricalPnlPeriods = (typeof historicalPnlPeriod)[number];
|
export type HistoricalPnlPeriods = (typeof historicalPnlPeriod)[number];
|
||||||
|
|
||||||
@@ -180,14 +174,16 @@ export const AbacusOrderSide = Abacus.exchange.dydx.abacus.output.input.OrderSid
|
|||||||
export const AbacusPositionSide = Abacus.exchange.dydx.abacus.output.PositionSide;
|
export const AbacusPositionSide = Abacus.exchange.dydx.abacus.output.PositionSide;
|
||||||
export type AbacusPositionSides = Abacus.exchange.dydx.abacus.output.PositionSide;
|
export type AbacusPositionSides = Abacus.exchange.dydx.abacus.output.PositionSide;
|
||||||
|
|
||||||
|
export type SubaccountPlaceOrderPayload =
|
||||||
|
Abacus.exchange.dydx.abacus.state.app.V4SubaccountPlaceOrderPayload2;
|
||||||
|
|
||||||
|
export type SubaccountCancelOrderPayload =
|
||||||
|
Abacus.exchange.dydx.abacus.state.app.V4SubaccountCancelOrderPayload2;
|
||||||
|
|
||||||
export type HumanReadablePlaceOrderPayload =
|
export type HumanReadablePlaceOrderPayload =
|
||||||
Abacus.exchange.dydx.abacus.state.manager.HumanReadablePlaceOrderPayload;
|
Abacus.exchange.dydx.abacus.state.manager.HumanReadablePlaceOrderPayload;
|
||||||
export type HumanReadableCancelOrderPayload =
|
export type HumanReadableCancelOrderPayload =
|
||||||
Abacus.exchange.dydx.abacus.state.manager.HumanReadableCancelOrderPayload;
|
Abacus.exchange.dydx.abacus.state.manager.HumanReadableCancelOrderPayload;
|
||||||
export type HumanReadableWithdrawPayload =
|
|
||||||
Abacus.exchange.dydx.abacus.state.manager.HumanReadableWithdrawPayload;
|
|
||||||
export type HumanReadableTransferPayload =
|
|
||||||
Abacus.exchange.dydx.abacus.state.manager.HumanReadableTransferPayload;
|
|
||||||
|
|
||||||
// ------ Helpers ------ //
|
// ------ Helpers ------ //
|
||||||
export const AbacusHelper = Abacus.exchange.dydx.abacus.utils.AbacusHelper;
|
export const AbacusHelper = Abacus.exchange.dydx.abacus.utils.AbacusHelper;
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ export enum AnalyticsEvent {
|
|||||||
|
|
||||||
// Transfers
|
// Transfers
|
||||||
TransferFaucet = 'TransferFaucet',
|
TransferFaucet = 'TransferFaucet',
|
||||||
TransferFaucetConfirmed = 'TransferFaucetConfirmed',
|
|
||||||
TransferDeposit = 'TransferDeposit',
|
TransferDeposit = 'TransferDeposit',
|
||||||
TransferWithdraw = 'TransferWithdraw',
|
TransferWithdraw = 'TransferWithdraw',
|
||||||
|
|
||||||
@@ -79,7 +78,6 @@ export enum AnalyticsEvent {
|
|||||||
TradeOrderTypeSelected = 'TradeOrderTypeSelected',
|
TradeOrderTypeSelected = 'TradeOrderTypeSelected',
|
||||||
TradePlaceOrder = 'TradePlaceOrder',
|
TradePlaceOrder = 'TradePlaceOrder',
|
||||||
TradePlaceOrderConfirmed = 'TradePlaceOrderConfirmed',
|
TradePlaceOrderConfirmed = 'TradePlaceOrderConfirmed',
|
||||||
TradeCancelOrder = 'TradeCancelOrder',
|
|
||||||
TradeCancelOrderConfirmed = 'TradeCancelOrderConfirmed',
|
TradeCancelOrderConfirmed = 'TradeCancelOrderConfirmed',
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,13 +133,6 @@ export type AnalyticsEventData<T extends AnalyticsEvent> =
|
|||||||
: // Transfers
|
: // Transfers
|
||||||
T extends AnalyticsEvent.TransferFaucet
|
T extends AnalyticsEvent.TransferFaucet
|
||||||
? {}
|
? {}
|
||||||
: T extends AnalyticsEvent.TransferFaucetConfirmed
|
|
||||||
? {
|
|
||||||
/** roundtrip time between user placing an order and confirmation from indexer (client → validator → indexer → client) */
|
|
||||||
roundtripMs: number;
|
|
||||||
/** URL/IP of node the order was sent to */
|
|
||||||
validatorUrl: string;
|
|
||||||
}
|
|
||||||
: T extends AnalyticsEvent.TransferDeposit
|
: T extends AnalyticsEvent.TransferDeposit
|
||||||
? {}
|
? {}
|
||||||
: T extends AnalyticsEvent.TransferWithdraw
|
: T extends AnalyticsEvent.TransferWithdraw
|
||||||
@@ -160,15 +151,13 @@ export type AnalyticsEventData<T extends AnalyticsEvent> =
|
|||||||
/** roundtrip time between user placing an order and confirmation from indexer (client → validator → indexer → client) */
|
/** roundtrip time between user placing an order and confirmation from indexer (client → validator → indexer → client) */
|
||||||
roundtripMs: number;
|
roundtripMs: number;
|
||||||
/** URL/IP of node the order was sent to */
|
/** URL/IP of node the order was sent to */
|
||||||
validatorUrl: string;
|
validator: string;
|
||||||
}
|
}
|
||||||
: T extends AnalyticsEvent.TradeCancelOrder
|
|
||||||
? {}
|
|
||||||
: T extends AnalyticsEvent.TradeCancelOrderConfirmed
|
: T extends AnalyticsEvent.TradeCancelOrderConfirmed
|
||||||
? {
|
? {
|
||||||
/** roundtrip time between user canceling an order and confirmation from indexer (client → validator → indexer → client) */
|
/** roundtrip time between user canceling an order and confirmation from indexer (client → validator → indexer → client) */
|
||||||
roundtripMs: number;
|
roundtripMs: number;
|
||||||
/** URL/IP of node the order was sent to */
|
/** URL/IP of node the order was sent to */
|
||||||
validatorUrl: string;
|
validator: string;
|
||||||
}
|
}
|
||||||
: never;
|
: never;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ export enum DialogTypes {
|
|||||||
ExchangeOffline = 'ExchangeOffline',
|
ExchangeOffline = 'ExchangeOffline',
|
||||||
FillDetails = 'FillDetails',
|
FillDetails = 'FillDetails',
|
||||||
Help = 'Help',
|
Help = 'Help',
|
||||||
ExternalNavKeplr = 'ExternalNavKeplr',
|
|
||||||
MnemonicExport = 'MnemonicExport',
|
MnemonicExport = 'MnemonicExport',
|
||||||
MobileSignIn = 'MobileSignIn',
|
MobileSignIn = 'MobileSignIn',
|
||||||
Onboarding = 'Onboarding',
|
Onboarding = 'Onboarding',
|
||||||
|
|||||||
@@ -88,3 +88,19 @@ export type TooltipStrings = {
|
|||||||
learnMoreLink?: string;
|
learnMoreLink?: string;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const ORDER_ERROR_CODE_MAP: { [key: number]: string } = {
|
||||||
|
2000: STRING_KEYS['2000_FILL_OR_KILL_ORDER_COULD_NOT_BE_FULLY_FILLED'],
|
||||||
|
2001: STRING_KEYS['2001_REDUCE_ONLY_WOULD_INCREASE_POSITION_SIZE'],
|
||||||
|
2002: STRING_KEYS['2002_REDUCE_ONLY_WOULD_CHANGE_POSITION_SIDE'],
|
||||||
|
2003: STRING_KEYS['2003_POST_ONLY_WOULD_CROSS_MAKER_ORDER'],
|
||||||
|
3000: STRING_KEYS['3000_INVALID_ORDER_FLAGS'],
|
||||||
|
3001: STRING_KEYS['3001_INVALID_STATEFUL_ORDER_GOOD_TIL_BLOCK_TIME'],
|
||||||
|
3002: STRING_KEYS['3002_STATEFUL_ORDERS_CANNOT_REQUIRE_IMMEDIATE_EXECUTION'],
|
||||||
|
3003: STRING_KEYS['3003_TIME_EXCEEDS_GOOD_TIL_BLOCK_TIME'],
|
||||||
|
3004: STRING_KEYS['3004_GOOD_TIL_BLOCK_TIME_EXCEEDS_STATEFUL_ORDER_TIME_WINDOW'],
|
||||||
|
3005: STRING_KEYS['3005_STATEFUL_ORDER_ALREADY_EXISTS'],
|
||||||
|
3006: STRING_KEYS['3006_STATEFUL_ORDER_DOES_NOT_EXIST'],
|
||||||
|
3007: STRING_KEYS['3007_STATEFUL_ORDER_COLLATERALIZATION_CHECK_FAILED'],
|
||||||
|
3008: STRING_KEYS['3008_STATEFUL_ORDER_PREVIOUSLY_CANCELLED'],
|
||||||
|
};
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
import environments from '../../public/configs/env.json';
|
|
||||||
|
|
||||||
// TODO: Update for Mainnet deployment
|
|
||||||
export const AVAILABLE_ENVIRONMENTS =
|
|
||||||
import.meta.env.MODE === 'production'
|
|
||||||
? environments.deployments.TESTNET
|
|
||||||
: environments.deployments.DEV;
|
|
||||||
|
|
||||||
export const CURRENT_ABACUS_DEPLOYMENT = import.meta.env.MODE === 'production' ? 'TESTNET' : 'DEV';
|
|
||||||
export const ENVIRONMENT_CONFIG_MAP = environments.environments;
|
|
||||||
export type DydxNetwork = keyof typeof ENVIRONMENT_CONFIG_MAP;
|
|
||||||
export const DEFAULT_APP_ENVIRONMENT = AVAILABLE_ENVIRONMENTS.default as DydxNetwork;
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import { ENDPOINTS, DEV_ENDPOINTS } from '@dydxprotocol/v4-localization';
|
||||||
|
|
||||||
|
export const NETWORK_ENDPOINTS = import.meta.env.MODE === 'production' ? ENDPOINTS : DEV_ENDPOINTS;
|
||||||
|
|
||||||
|
export const CLIENT_NETWORK_CONFIGS: Record<
|
||||||
|
string,
|
||||||
|
(typeof NETWORK_ENDPOINTS.environments)[number]
|
||||||
|
> = Object.fromEntries(
|
||||||
|
NETWORK_ENDPOINTS.environments.map((environment) => [environment.environment, environment])
|
||||||
|
);
|
||||||
|
|
||||||
|
export const DEFAULT_APP_ENVIRONMENT = NETWORK_ENDPOINTS.defaultEnvironment;
|
||||||
|
|
||||||
|
export enum DydxV4Network {
|
||||||
|
V4Mainnet = 'dydxprotocol-mainnet',
|
||||||
|
V4Staging = 'dydxprotocol-staging',
|
||||||
|
V4Testnet2 = 'dydxprotocol-testnet',
|
||||||
|
V4Local = 'dydxprotocol-dev',
|
||||||
|
}
|
||||||
|
|
||||||
|
export type DydxNetwork = keyof typeof CLIENT_NETWORK_CONFIGS;
|
||||||
|
|
||||||
|
export function isDydxV4Network(network: any): boolean {
|
||||||
|
return CLIENT_NETWORK_CONFIGS[network]?.version === 'v4';
|
||||||
|
}
|
||||||
|
|
||||||
|
export function isValidDydxNetwork(network: any): boolean {
|
||||||
|
return Object.keys(CLIENT_NETWORK_CONFIGS).includes(network);
|
||||||
|
}
|
||||||
@@ -94,10 +94,6 @@ export const tradeTooltips: TooltipStrings = {
|
|||||||
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAINTENANCE_MARGIN_FRACTION_TITLE }),
|
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAINTENANCE_MARGIN_FRACTION_TITLE }),
|
||||||
body: stringGetter({ key: TOOLTIP_STRING_KEYS.MAINTENANCE_MARGIN_FRACTION_BODY }),
|
body: stringGetter({ key: TOOLTIP_STRING_KEYS.MAINTENANCE_MARGIN_FRACTION_BODY }),
|
||||||
}),
|
}),
|
||||||
'max-reward': ({ stringGetter }) => ({
|
|
||||||
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAXIMUM_REWARDS_TITLE }),
|
|
||||||
body: stringGetter({ key: TOOLTIP_STRING_KEYS.MAXIMUM_REWARDS_BODY }),
|
|
||||||
}),
|
|
||||||
'max-withdraw': ({ stringGetter }) => ({
|
'max-withdraw': ({ stringGetter }) => ({
|
||||||
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAX_WITHDRAW_TITLE }),
|
title: stringGetter({ key: TOOLTIP_STRING_KEYS.MAX_WITHDRAW_TITLE }),
|
||||||
body: stringGetter({ key: TOOLTIP_STRING_KEYS.MAX_WITHDRAW_BODY }),
|
body: stringGetter({ key: TOOLTIP_STRING_KEYS.MAX_WITHDRAW_BODY }),
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export enum PositionSide {
|
|||||||
Short = 'SHORT',
|
Short = 'SHORT',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const UNCOMMITTED_ORDER_TIMEOUT_MS = 10_000;
|
export const UNCOMMITTED_ORDER_TIMEOUT = 10_000;
|
||||||
|
|
||||||
export const ORDER_SIDE_STRINGS = {
|
export const ORDER_SIDE_STRINGS = {
|
||||||
[OrderSide.BUY]: STRING_KEYS.BUY,
|
[OrderSide.BUY]: STRING_KEYS.BUY,
|
||||||
|
|||||||
+20
-29
@@ -24,8 +24,6 @@ import {
|
|||||||
|
|
||||||
import { isMetaMask } from '@/lib/wallet/providers';
|
import { isMetaMask } from '@/lib/wallet/providers';
|
||||||
|
|
||||||
import { DydxNetwork, ENVIRONMENT_CONFIG_MAP } from './networks';
|
|
||||||
|
|
||||||
// Wallet connection types
|
// Wallet connection types
|
||||||
|
|
||||||
export enum WalletConnectionType {
|
export enum WalletConnectionType {
|
||||||
@@ -268,7 +266,7 @@ export const wallets: Record<WalletType, WalletConfig> = {
|
|||||||
walletconnect2Id: '4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0',
|
walletconnect2Id: '4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0',
|
||||||
},
|
},
|
||||||
[WalletType.WalletConnect2]: {
|
[WalletType.WalletConnect2]: {
|
||||||
type: WalletType.WalletConnect2,
|
type: WalletType.WalletConnect,
|
||||||
stringKey: STRING_KEYS.WALLET_CONNECT_2,
|
stringKey: STRING_KEYS.WALLET_CONNECT_2,
|
||||||
icon: WalletConnectIcon,
|
icon: WalletConnectIcon,
|
||||||
connectionTypes: [WalletConnectionType.WalletConnect2],
|
connectionTypes: [WalletConnectionType.WalletConnect2],
|
||||||
@@ -320,21 +318,20 @@ export type WalletConnection = {
|
|||||||
export const COSMOS_DERIVATION_PATH = "m/44'/118'/0'/0/0";
|
export const COSMOS_DERIVATION_PATH = "m/44'/118'/0'/0/0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description typed data to sign for dYdX Chain onboarding
|
* @description typed data to sign for v4 onboarding
|
||||||
*/
|
*/
|
||||||
export const getSignTypedData = (selectedNetwork: DydxNetwork) =>
|
export const SIGN_TYPED_DATA = {
|
||||||
({
|
primaryType: 'dYdX',
|
||||||
primaryType: 'dYdX',
|
domain: {
|
||||||
domain: {
|
name: 'dYdX V4',
|
||||||
name: ENVIRONMENT_CONFIG_MAP[selectedNetwork].wallets.signTypedDataDomainName,
|
},
|
||||||
},
|
types: {
|
||||||
types: {
|
dYdX: [{ name: 'action', type: 'string' }],
|
||||||
dYdX: [{ name: 'action', type: 'string' }],
|
},
|
||||||
},
|
message: {
|
||||||
message: {
|
action: 'dYdX V4 Onboarding',
|
||||||
action: ENVIRONMENT_CONFIG_MAP[selectedNetwork].wallets.signTypedDataAction,
|
},
|
||||||
},
|
} as const;
|
||||||
} as const);
|
|
||||||
|
|
||||||
export type PrivateInformation = ReturnType<typeof onboarding.deriveHDKeyFromEthereumSignature>;
|
export type PrivateInformation = ReturnType<typeof onboarding.deriveHDKeyFromEthereumSignature>;
|
||||||
|
|
||||||
@@ -342,12 +339,12 @@ export type EvmAddress = `0x${string}`;
|
|||||||
export type DydxAddress = `dydx${string}`;
|
export type DydxAddress = `dydx${string}`;
|
||||||
|
|
||||||
export const DYDX_CHAIN_INFO: Parameters<typeof suggestChain>[0] = {
|
export const DYDX_CHAIN_INFO: Parameters<typeof suggestChain>[0] = {
|
||||||
rpc: 'https://dydx-testnet-archive.allthatnode.com:26657',
|
rpc: '13.59.4.93:26657',
|
||||||
rest: 'https://dydx-testnet-archive.allthatnode.com:1317',
|
rest: '13.59.4.93:1317',
|
||||||
chainId: 'dydx-testnet-3',
|
chainId: 'dydx-testnet-2',
|
||||||
chainName: 'dYdX Public Testnet',
|
chainName: 'dYdX Public Testnet',
|
||||||
chainSymbolImageUrl:
|
chainSymbolImageUrl:
|
||||||
'https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/dydx-testnet-3/chain.png',
|
'https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/dydx-testnet-2/chain.png',
|
||||||
bech32Config: {
|
bech32Config: {
|
||||||
bech32PrefixAccPub: 'dydxpub',
|
bech32PrefixAccPub: 'dydxpub',
|
||||||
bech32PrefixValPub: 'dydxvaloperpub',
|
bech32PrefixValPub: 'dydxvaloperpub',
|
||||||
@@ -386,18 +383,12 @@ export const DYDX_CHAIN_INFO: Parameters<typeof suggestChain>[0] = {
|
|||||||
features: [],
|
features: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: export this type from abacus instead
|
|
||||||
export enum DydxChainAsset {
|
export enum DydxChainAsset {
|
||||||
USDC = 'usdc',
|
USDC = 'USDC',
|
||||||
DYDX = 'dydx',
|
DYDX = 'Dv4TNT',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DYDX_CHAIN_ASSET_COIN_DENOM: Record<DydxChainAsset, string> = {
|
export const DYDX_CHAIN_ASSET_COIN_DENOM: Record<DydxChainAsset, string> = {
|
||||||
[DydxChainAsset.USDC]: USDC_DENOM,
|
[DydxChainAsset.USDC]: USDC_DENOM,
|
||||||
[DydxChainAsset.DYDX]: DYDX_DENOM,
|
[DydxChainAsset.DYDX]: DYDX_DENOM,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const DYDX_CHAIN_ASSET_TAGS: Record<DydxChainAsset, string> = {
|
|
||||||
[DydxChainAsset.USDC]: 'USDC',
|
|
||||||
[DydxChainAsset.DYDX]: 'Dv4TNT',
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,23 +1,22 @@
|
|||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { shallowEqual, useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
import { useBalance } from 'wagmi';
|
import { useBalance } from 'wagmi';
|
||||||
import { StargateClient } from '@cosmjs/stargate';
|
import { StargateClient } from '@cosmjs/stargate';
|
||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
import { formatUnits } from 'viem';
|
import { formatUnits } from 'viem';
|
||||||
|
|
||||||
import { USDC_DENOM, DYDX_DENOM } from '@dydxprotocol/v4-client-js';
|
import { CLIENT_NETWORK_CONFIGS } from '@/constants/networks';
|
||||||
|
|
||||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
|
||||||
import { QUANTUM_MULTIPLIER } from '@/constants/numbers';
|
import { QUANTUM_MULTIPLIER } from '@/constants/numbers';
|
||||||
import { EvmAddress } from '@/constants/wallets';
|
import { EvmAddress } from '@/constants/wallets';
|
||||||
|
|
||||||
import { convertBech32Address } from '@/lib/addressUtils';
|
import { convertBech32Address } from '@/lib/addressUtils';
|
||||||
import { MustBigNumber } from '@/lib/numbers';
|
import { MustBigNumber } from '@/lib/numbers';
|
||||||
|
|
||||||
import { getBalances, getStakingBalances } from '@/state/accountSelectors';
|
|
||||||
import { getSelectedNetwork } from '@/state/appSelectors';
|
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||||
|
|
||||||
import { useAccounts } from './useAccounts';
|
import { useAccounts } from './useAccounts';
|
||||||
|
import { usePollNativeTokenBalance } from './usePollNativeTokenBalance';
|
||||||
|
import { usePollUSDCBalance } from './usePollUSDCBalance';
|
||||||
|
|
||||||
type UseAccountBalanceProps = {
|
type UseAccountBalanceProps = {
|
||||||
// Token Items
|
// Token Items
|
||||||
@@ -37,10 +36,10 @@ type UseAccountBalanceProps = {
|
|||||||
* 0xSquid uses this 0x address as the chain's default token.
|
* 0xSquid uses this 0x address as the chain's default token.
|
||||||
* @todo We will need to add additional logic here if we 'useAccountBalance' on non-Squid related forms.
|
* @todo We will need to add additional logic here if we 'useAccountBalance' on non-Squid related forms.
|
||||||
*/
|
*/
|
||||||
export const CHAIN_DEFAULT_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
const CHAIN_DEFAULT_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
||||||
|
|
||||||
export const useAccountBalance = ({
|
export const useAccountBalance = ({
|
||||||
addressOrDenom,
|
addressOrDenom = CHAIN_DEFAULT_TOKEN_ADDRESS,
|
||||||
assetSymbol,
|
assetSymbol,
|
||||||
bech32AddrPrefix,
|
bech32AddrPrefix,
|
||||||
chainId,
|
chainId,
|
||||||
@@ -51,16 +50,16 @@ export const useAccountBalance = ({
|
|||||||
const { evmAddress, dydxAddress } = useAccounts();
|
const { evmAddress, dydxAddress } = useAccounts();
|
||||||
|
|
||||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||||
const balances = useSelector(getBalances, shallowEqual);
|
const evmChainId = Number(CLIENT_NETWORK_CONFIGS[selectedNetwork].ethereumChainId);
|
||||||
const evmChainId = Number(ENVIRONMENT_CONFIG_MAP[selectedNetwork].ethereumChainId);
|
|
||||||
const stakingBalances = useSelector(getStakingBalances, shallowEqual);
|
|
||||||
|
|
||||||
const evmQuery = useBalance({
|
const evmQuery = useBalance({
|
||||||
enabled: Boolean(!isCosmosChain && addressOrDenom?.startsWith('0x')),
|
enabled: Boolean(!isCosmosChain && addressOrDenom?.startsWith('0x')),
|
||||||
address: evmAddress,
|
address: evmAddress,
|
||||||
chainId: typeof chainId === 'number' ? chainId : Number(evmChainId),
|
chainId: typeof chainId === 'number' ? chainId : Number(evmChainId),
|
||||||
token:
|
token:
|
||||||
addressOrDenom === CHAIN_DEFAULT_TOKEN_ADDRESS ? undefined : (addressOrDenom as EvmAddress),
|
addressOrDenom === CHAIN_DEFAULT_TOKEN_ADDRESS
|
||||||
|
? undefined
|
||||||
|
: (addressOrDenom as EvmAddress),
|
||||||
watch: true,
|
watch: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -93,23 +92,17 @@ export const useAccountBalance = ({
|
|||||||
const { formatted: evmBalance } = evmQuery.data || {};
|
const { formatted: evmBalance } = evmQuery.data || {};
|
||||||
const balance = !assetSymbol ? '0' : isCosmosChain ? cosmosQuery.data : evmBalance;
|
const balance = !assetSymbol ? '0' : isCosmosChain ? cosmosQuery.data : evmBalance;
|
||||||
|
|
||||||
const nativeTokenCoinBalance = balances?.[DYDX_DENOM];
|
const nativeTokenCoinBalance = usePollNativeTokenBalance({ dydxAddress });
|
||||||
const nativeTokenBalance = MustBigNumber(nativeTokenCoinBalance?.amount)
|
const nativeTokenBalance = MustBigNumber(nativeTokenCoinBalance?.amount)
|
||||||
.div(QUANTUM_MULTIPLIER)
|
.div(QUANTUM_MULTIPLIER)
|
||||||
.toNumber();
|
.toNumber();
|
||||||
|
|
||||||
const usdcCoinBalance = balances?.[USDC_DENOM];
|
const usdcCoinBalance = usePollUSDCBalance({ dydxAddress });
|
||||||
const usdcBalance = MustBigNumber(usdcCoinBalance?.amount).div(QUANTUM_MULTIPLIER).toNumber();
|
const usdcBalance = MustBigNumber(usdcCoinBalance?.amount).div(QUANTUM_MULTIPLIER).toNumber();
|
||||||
|
|
||||||
const nativeStakingCoinBalanace = stakingBalances?.[DYDX_DENOM];
|
|
||||||
const nativeStakingBalance = MustBigNumber(nativeStakingCoinBalanace?.amount)
|
|
||||||
.div(QUANTUM_MULTIPLIER)
|
|
||||||
.toNumber();
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
balance,
|
balance,
|
||||||
nativeTokenBalance,
|
nativeTokenBalance,
|
||||||
nativeStakingBalance,
|
|
||||||
usdcBalance,
|
usdcBalance,
|
||||||
queryStatus: isCosmosChain ? cosmosQuery.status : evmQuery.status,
|
queryStatus: isCosmosChain ? cosmosQuery.status : evmQuery.status,
|
||||||
isQueryFetching: isCosmosChain ? cosmosQuery.isFetching : evmQuery.fetchStatus === 'fetching',
|
isQueryFetching: isCosmosChain ? cosmosQuery.isFetching : evmQuery.fetchStatus === 'fetching',
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ import { OnboardingGuard, OnboardingState, type EvmDerivedAddresses } from '@/co
|
|||||||
import { LocalStorageKey, LOCAL_STORAGE_VERSIONS } from '@/constants/localStorage';
|
import { LocalStorageKey, LOCAL_STORAGE_VERSIONS } from '@/constants/localStorage';
|
||||||
import { DydxAddress, EvmAddress, PrivateInformation } from '@/constants/wallets';
|
import { DydxAddress, EvmAddress, PrivateInformation } from '@/constants/wallets';
|
||||||
|
|
||||||
import { setOnboardingState, setOnboardingGuard } from '@/state/account';
|
import {
|
||||||
|
setOnboardingState,
|
||||||
|
setOnboardingGuard,
|
||||||
|
} from '@/state/account';
|
||||||
|
|
||||||
import abacusStateManager from '@/lib/abacus';
|
import abacusStateManager from '@/lib/abacus';
|
||||||
import { log } from '@/lib/telemetry';
|
import { log } from '@/lib/telemetry';
|
||||||
@@ -219,9 +222,9 @@ const useAccountsContext = () => {
|
|||||||
// abacus
|
// abacus
|
||||||
// TODO: useAbacus({ dydxAddress })
|
// TODO: useAbacus({ dydxAddress })
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (dydxAddress) abacusStateManager.setAccount(localDydxWallet);
|
if (dydxAddress) abacusStateManager.setAccount(dydxAddress);
|
||||||
else abacusStateManager.attemptDisconnectAccount();
|
else abacusStateManager.attemptDisconnectAccount();
|
||||||
}, [localDydxWallet]);
|
}, [dydxAddress]);
|
||||||
|
|
||||||
// clear subaccounts when no dydxAddress is set
|
// clear subaccounts when no dydxAddress is set
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { isDydxV4Network } from '@/constants/networks';
|
||||||
import { WalletType } from '@/constants/wallets';
|
import { WalletType } from '@/constants/wallets';
|
||||||
|
|
||||||
import { isTruthy } from '@/lib/isTruthy';
|
import { isTruthy } from '@/lib/isTruthy';
|
||||||
@@ -10,7 +11,7 @@ export const useDisplayedWallets = () => {
|
|||||||
return [
|
return [
|
||||||
WalletType.MetaMask,
|
WalletType.MetaMask,
|
||||||
|
|
||||||
import.meta.env.MODE !== 'production' && WalletType.Keplr,
|
import.meta.env.MODE !== 'production' && isDydxV4Network(selectedNetwork) && WalletType.Keplr,
|
||||||
|
|
||||||
WalletType.WalletConnect2,
|
WalletType.WalletConnect2,
|
||||||
WalletType.WalletConnect,
|
WalletType.WalletConnect,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useDispatch } from 'react-redux';
|
|||||||
|
|
||||||
import { LocalStorageKey } from '@/constants/localStorage';
|
import { LocalStorageKey } from '@/constants/localStorage';
|
||||||
|
|
||||||
import { DEFAULT_APP_ENVIRONMENT, type DydxNetwork } from '@/constants/networks';
|
import { DEFAULT_APP_ENVIRONMENT, DydxNetwork, isValidDydxNetwork } from '@/constants/networks';
|
||||||
|
|
||||||
import { useLocalStorage } from '@/hooks';
|
import { useLocalStorage } from '@/hooks';
|
||||||
|
|
||||||
@@ -18,6 +18,7 @@ export const useInitializePage = () => {
|
|||||||
const [localStorageNetwork] = useLocalStorage<DydxNetwork>({
|
const [localStorageNetwork] = useLocalStorage<DydxNetwork>({
|
||||||
key: LocalStorageKey.SelectedNetwork,
|
key: LocalStorageKey.SelectedNetwork,
|
||||||
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
||||||
|
validateFn: isValidDydxNetwork, // backwards compatibility
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { LocalStorageKey } from '@/constants/localStorage';
|
|||||||
import { type TransferNotifcation } from '@/constants/notifications';
|
import { type TransferNotifcation } from '@/constants/notifications';
|
||||||
|
|
||||||
import { useAccounts } from '@/hooks/useAccounts';
|
import { useAccounts } from '@/hooks/useAccounts';
|
||||||
import { STATUS_ERROR_GRACE_PERIOD, useSquid } from '@/hooks/useSquid';
|
import { useSquid } from '@/hooks/useSquid';
|
||||||
import { useLocalStorage } from './useLocalStorage';
|
import { useLocalStorage } from './useLocalStorage';
|
||||||
|
|
||||||
const LocalNotificationsContext = createContext<
|
const LocalNotificationsContext = createContext<
|
||||||
@@ -62,19 +62,15 @@ const useLocalNotificationsContext = () => {
|
|||||||
txHash,
|
txHash,
|
||||||
toChainId,
|
toChainId,
|
||||||
fromChainId,
|
fromChainId,
|
||||||
triggeredAt,
|
|
||||||
status: currentStatus,
|
status: currentStatus,
|
||||||
} of transferNotifications) {
|
} of transferNotifications) {
|
||||||
try {
|
try {
|
||||||
if (currentStatus && currentStatus?.squidTransactionStatus !== 'ongoing') continue;
|
if (currentStatus && currentStatus?.squidTransactionStatus !== 'ongoing') continue;
|
||||||
|
|
||||||
const status = await squid?.getStatus({ transactionId: txHash, toChainId, fromChainId });
|
const status = await squid?.getStatus({ transactionId: txHash, toChainId, fromChainId });
|
||||||
if (status) statuses[txHash] = status;
|
if (status) statuses[txHash] = status;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// ignore errors for the first 120s since the status might not be available yet
|
console.error(error);
|
||||||
if (!triggeredAt || Date.now() - triggeredAt > STATUS_ERROR_GRACE_PERIOD) {
|
|
||||||
statuses[txHash] = error;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return statuses;
|
return statuses;
|
||||||
|
|||||||
@@ -28,13 +28,15 @@ export const useMarketsData = (
|
|||||||
const allAssets = useSelector(getAssets, shallowEqual) || {};
|
const allAssets = useSelector(getAssets, shallowEqual) || {};
|
||||||
|
|
||||||
const markets = useMemo(() => {
|
const markets = useMemo(() => {
|
||||||
return Object.values(allPerpetualMarkets).map((marketData) => ({
|
return Object.values(allPerpetualMarkets)
|
||||||
asset: allAssets[marketData.assetId],
|
.filter(({ assetId }) => allAssets[assetId]) // Filter out markets with no asset information
|
||||||
tickSizeDecimals: marketData.configs?.tickSizeDecimals,
|
.map((marketData) => ({
|
||||||
...marketData,
|
asset: allAssets[marketData.assetId],
|
||||||
...marketData.perpetual,
|
tickSizeDecimals: marketData.configs?.tickSizeDecimals,
|
||||||
...marketData.configs,
|
...marketData,
|
||||||
})) as MarketData[];
|
...marketData.perpetual,
|
||||||
|
...marketData.configs,
|
||||||
|
})) as MarketData[];
|
||||||
}, [allPerpetualMarkets, allAssets]);
|
}, [allPerpetualMarkets, allAssets]);
|
||||||
|
|
||||||
const filteredMarkets = useMemo(() => {
|
const filteredMarkets = useMemo(() => {
|
||||||
@@ -43,8 +45,8 @@ export const useMarketsData = (
|
|||||||
if (searchFilter) {
|
if (searchFilter) {
|
||||||
return filtered.filter(
|
return filtered.filter(
|
||||||
({ asset }) =>
|
({ asset }) =>
|
||||||
asset?.name?.toLocaleLowerCase().includes(searchFilter.toLowerCase()) ||
|
asset.name?.toLocaleLowerCase().includes(searchFilter.toLowerCase()) ||
|
||||||
asset?.id?.toLocaleLowerCase().includes(searchFilter.toLowerCase())
|
asset.symbol?.toLocaleLowerCase().includes(searchFilter.toLowerCase())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return filtered;
|
return filtered;
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { useCallback, useEffect, useMemo } from 'react';
|
import { useCallback, useEffect, useMemo } from 'react';
|
||||||
import styled, { type AnyStyledComponent } from 'styled-components';
|
|
||||||
import { useSelector, shallowEqual, useDispatch } from 'react-redux';
|
import { useSelector, shallowEqual, useDispatch } from 'react-redux';
|
||||||
import { groupBy } from 'lodash';
|
import { groupBy } from 'lodash';
|
||||||
|
|
||||||
import { AlertType } from '@/constants/alerts';
|
|
||||||
import { AbacusOrderStatus, ORDER_SIDES, ORDER_STATUS_STRINGS } from '@/constants/abacus';
|
import { AbacusOrderStatus, ORDER_SIDES, ORDER_STATUS_STRINGS } from '@/constants/abacus';
|
||||||
import { DialogTypes } from '@/constants/dialogs';
|
import { DialogTypes } from '@/constants/dialogs';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
@@ -12,7 +10,6 @@ import { ORDER_SIDE_STRINGS, TRADE_TYPE_STRINGS, TradeTypes } from '@/constants/
|
|||||||
|
|
||||||
import { useLocalNotifications } from '@/hooks/useLocalNotifications';
|
import { useLocalNotifications } from '@/hooks/useLocalNotifications';
|
||||||
|
|
||||||
import { AlertMessage } from '@/components/AlertMessage';
|
|
||||||
import { Icon, IconName } from '@/components/Icon';
|
import { Icon, IconName } from '@/components/Icon';
|
||||||
import { Output, OutputType } from '@/components/Output';
|
import { Output, OutputType } from '@/components/Output';
|
||||||
import { TransferStatusToast } from '@/views/TransferStatus';
|
import { TransferStatusToast } from '@/views/TransferStatus';
|
||||||
@@ -122,36 +119,19 @@ export const notificationTypes = [
|
|||||||
const { toChainId, status, txHash, toAmount } = transfer;
|
const { toChainId, status, txHash, toAmount } = transfer;
|
||||||
const finished = Boolean(status) && status?.squidTransactionStatus !== 'ongoing';
|
const finished = Boolean(status) && status?.squidTransactionStatus !== 'ongoing';
|
||||||
const type = toChainId === TESTNET_CHAIN_ID ? 'deposit' : 'withdraw';
|
const type = toChainId === TESTNET_CHAIN_ID ? 'deposit' : 'withdraw';
|
||||||
// @ts-ignore status.errors is not in the type definition but can be returned
|
|
||||||
const error = status?.errors?.length ? status?.errors[0] : status?.error;
|
|
||||||
|
|
||||||
// TODO: confirm with design what the description should be
|
|
||||||
const description = (
|
|
||||||
<div>
|
|
||||||
<Styled.TransferText>
|
|
||||||
{type === 'deposit' ? 'Deposit of ' : 'Withdraw of '}
|
|
||||||
<Output type={OutputType.Fiat} value={toAmount} />
|
|
||||||
</Styled.TransferText>
|
|
||||||
|
|
||||||
{error && (
|
|
||||||
<Styled.ErrorMessage type={AlertType.Error}>
|
|
||||||
{stringGetter({
|
|
||||||
key: STRING_KEYS.SOMETHING_WENT_WRONG_WITH_MESSAGE,
|
|
||||||
params: {
|
|
||||||
ERROR_MESSAGE: error.message || stringGetter({ key: STRING_KEYS.UNKNOWN_ERROR }),
|
|
||||||
},
|
|
||||||
})}
|
|
||||||
</Styled.ErrorMessage>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
trigger(
|
trigger(
|
||||||
txHash,
|
txHash,
|
||||||
{
|
{
|
||||||
icon: <Icon iconName={finished ? IconName.Transfer : IconName.Clock} />,
|
icon: <Icon iconName={finished ? IconName.Transfer : IconName.Clock} />,
|
||||||
title: stringGetter({ key: getTitleStringKey(type, finished) }),
|
title: stringGetter({ key: getTitleStringKey(type, finished) }),
|
||||||
description: description,
|
// TODO: confirm with design what the description should be
|
||||||
|
description: (
|
||||||
|
<>
|
||||||
|
<span>{type === 'deposit' ? 'Deposit of ' : 'Withdraw of'}</span>
|
||||||
|
<Output type={OutputType.Fiat} value={toAmount} />
|
||||||
|
</>
|
||||||
|
),
|
||||||
customContent: (
|
customContent: (
|
||||||
<TransferStatusToast
|
<TransferStatusToast
|
||||||
toAmount={transfer.toAmount}
|
toAmount={transfer.toAmount}
|
||||||
@@ -159,12 +139,7 @@ export const notificationTypes = [
|
|||||||
status={transfer.status}
|
status={transfer.status}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
customMenuContent: !finished && (
|
customMenuContent: !finished && <TransferStatusSteps status={transfer.status} />,
|
||||||
<div>
|
|
||||||
{description}
|
|
||||||
<TransferStatusSteps status={transfer.status} />
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
toastSensitivity: 'foreground',
|
toastSensitivity: 'foreground',
|
||||||
},
|
},
|
||||||
[]
|
[]
|
||||||
@@ -174,15 +149,3 @@ export const notificationTypes = [
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
] satisfies NotificationTypeConfig[];
|
] satisfies NotificationTypeConfig[];
|
||||||
|
|
||||||
const Styled: Record<string, AnyStyledComponent> = {};
|
|
||||||
|
|
||||||
Styled.TransferText = styled.span`
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.5ch;
|
|
||||||
`
|
|
||||||
|
|
||||||
Styled.ErrorMessage = styled.div`
|
|
||||||
max-width: 13rem;
|
|
||||||
`;
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
import { useEffect, useState } from 'react';
|
|
||||||
import { useSelector } from 'react-redux';
|
|
||||||
|
|
||||||
import { getLatestOrderClientId } from '@/state/accountSelectors';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @description This hook will fire a callback when the latest order has been updated to a non-pending state from the Indexer.
|
|
||||||
* @param { callback: () => void }
|
|
||||||
*/
|
|
||||||
export const useOnLastOrderIndexed = ({ callback }: { callback: () => void }) => {
|
|
||||||
const [unIndexedClientId, setUnIndexedClientId] = useState<number | undefined>();
|
|
||||||
const latestOrderClientId = useSelector(getLatestOrderClientId);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (unIndexedClientId) {
|
|
||||||
if (unIndexedClientId === latestOrderClientId) {
|
|
||||||
callback();
|
|
||||||
setUnIndexedClientId(undefined);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, [callback, latestOrderClientId, unIndexedClientId]);
|
|
||||||
|
|
||||||
return {
|
|
||||||
setUnIndexedClientId,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
import { useQuery } from 'react-query';
|
||||||
|
|
||||||
|
import { useAccounts } from '@/hooks';
|
||||||
|
|
||||||
|
import { DydxAddress } from '@/constants/wallets';
|
||||||
|
import { DYDX_DENOM } from '@dydxprotocol/v4-client-js';
|
||||||
|
|
||||||
|
const ACCOUNT_BALANCE_POLLING_INTERVAL = 60_000;
|
||||||
|
|
||||||
|
export const usePollNativeTokenBalance = ({
|
||||||
|
dydxAddress,
|
||||||
|
interval = ACCOUNT_BALANCE_POLLING_INTERVAL,
|
||||||
|
}: {
|
||||||
|
dydxAddress?: DydxAddress;
|
||||||
|
interval?: number;
|
||||||
|
}) => {
|
||||||
|
const { getAccountBalance } = useAccounts();
|
||||||
|
|
||||||
|
const { data } = useQuery({
|
||||||
|
enabled: dydxAddress !== undefined,
|
||||||
|
queryKey: ['usePollNativeTokenBalance', { dydxAddress }],
|
||||||
|
queryFn: async () => {
|
||||||
|
if (!dydxAddress) return;
|
||||||
|
return await getAccountBalance({ dydxAddress, denom: DYDX_DENOM });
|
||||||
|
},
|
||||||
|
refetchInterval: interval,
|
||||||
|
staleTime: interval,
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
};
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
import { useQuery } from 'react-query';
|
||||||
|
|
||||||
|
import { useAccounts } from '@/hooks';
|
||||||
|
|
||||||
|
import { DydxAddress } from '@/constants/wallets';
|
||||||
|
|
||||||
|
const ACCOUNT_BALANCE_POLLING_INTERVAL = 60_000;
|
||||||
|
|
||||||
|
export const usePollUSDCBalance = ({
|
||||||
|
dydxAddress,
|
||||||
|
interval = ACCOUNT_BALANCE_POLLING_INTERVAL,
|
||||||
|
}: {
|
||||||
|
dydxAddress?: DydxAddress;
|
||||||
|
interval?: number;
|
||||||
|
}) => {
|
||||||
|
const { getAccountBalance } = useAccounts();
|
||||||
|
|
||||||
|
const { data } = useQuery({
|
||||||
|
enabled: dydxAddress !== undefined,
|
||||||
|
queryKey: ['usePollUSDCBalance', { dydxAddress }],
|
||||||
|
queryFn: async () => {
|
||||||
|
if (!dydxAddress) return;
|
||||||
|
return await getAccountBalance({ dydxAddress });
|
||||||
|
},
|
||||||
|
refetchInterval: interval,
|
||||||
|
staleTime: interval,
|
||||||
|
});
|
||||||
|
|
||||||
|
return data;
|
||||||
|
};
|
||||||
@@ -1,13 +1,15 @@
|
|||||||
import { useCallback } from 'react';
|
import { useCallback, useEffect } from 'react';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
|
||||||
|
import { DialogTypes } from '@/constants/dialogs';
|
||||||
import { LocalStorageKey } from '@/constants/localStorage';
|
import { LocalStorageKey } from '@/constants/localStorage';
|
||||||
import { DEFAULT_APP_ENVIRONMENT, DydxNetwork } from '@/constants/networks';
|
import { CLIENT_NETWORK_CONFIGS, DEFAULT_APP_ENVIRONMENT, DydxNetwork } from '@/constants/networks';
|
||||||
|
|
||||||
import { useAccounts, useLocalStorage } from '@/hooks';
|
import { useAccounts, useLocalStorage } from '@/hooks';
|
||||||
|
|
||||||
import { setSelectedNetwork } from '@/state/app';
|
import { setSelectedNetwork } from '@/state/app';
|
||||||
import { getSelectedNetwork } from '@/state/appSelectors';
|
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||||
|
import { openDialog } from '@/state/dialogs';
|
||||||
|
|
||||||
export const useSelectedNetwork = (): {
|
export const useSelectedNetwork = (): {
|
||||||
switchNetwork: (network: DydxNetwork) => void;
|
switchNetwork: (network: DydxNetwork) => void;
|
||||||
@@ -22,6 +24,17 @@ export const useSelectedNetwork = (): {
|
|||||||
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (
|
||||||
|
import.meta.env.MODE === 'production' &&
|
||||||
|
CLIENT_NETWORK_CONFIGS[selectedNetwork].dydxChainId === 'dydx-testnet-3'
|
||||||
|
) {
|
||||||
|
dispatch(
|
||||||
|
openDialog({ type: DialogTypes.ExchangeOffline, dialogProps: { preventClose: true } })
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, [selectedNetwork]);
|
||||||
|
|
||||||
const switchNetwork = useCallback(
|
const switchNetwork = useCallback(
|
||||||
(network: DydxNetwork) => {
|
(network: DydxNetwork) => {
|
||||||
disconnect();
|
disconnect();
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
import { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
import { createContext, useContext, useEffect, useMemo, useState } from 'react';
|
||||||
import { useSelector } from 'react-redux';
|
import { useSelector } from 'react-redux';
|
||||||
|
import { TESTNET_CHAIN_ID } from '@dydxprotocol/v4-client-js';
|
||||||
import { Squid } from '@0xsquid/sdk';
|
import { Squid } from '@0xsquid/sdk';
|
||||||
|
|
||||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
import { CLIENT_NETWORK_CONFIGS, DydxV4Network, isDydxV4Network } from '@/constants/networks';
|
||||||
|
|
||||||
import { getSelectedNetwork } from '@/state/appSelectors';
|
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||||
|
|
||||||
export const NATIVE_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';
|
export const NATIVE_TOKEN_ADDRESS = "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE";
|
||||||
|
|
||||||
export const STATUS_ERROR_GRACE_PERIOD = 120_000;
|
|
||||||
|
|
||||||
const useSquidContext = () => {
|
const useSquidContext = () => {
|
||||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||||
@@ -22,7 +21,10 @@ const useSquidContext = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const squid = useMemo(
|
const squid = useMemo(
|
||||||
() => new Squid({ baseUrl: ENVIRONMENT_CONFIG_MAP[selectedNetwork]?.endpoints['0xsquid'] }),
|
() =>
|
||||||
|
isDydxV4Network(selectedNetwork)
|
||||||
|
? new Squid({ baseUrl: CLIENT_NETWORK_CONFIGS[selectedNetwork]?.endpoints['0xsquid'] })
|
||||||
|
: undefined,
|
||||||
[selectedNetwork]
|
[selectedNetwork]
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -36,7 +38,7 @@ const useSquidContext = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
type SquidContextType = ReturnType<typeof useSquidContext>;
|
type SquidContextType = ReturnType<typeof useSquidContext>;
|
||||||
const SquidContext = createContext<SquidContextType | undefined>(undefined);
|
const SquidContext = createContext<SquidContextType>(undefined);
|
||||||
SquidContext.displayName = '0xSquid';
|
SquidContext.displayName = '0xSquid';
|
||||||
|
|
||||||
export const SquidProvider = ({ ...props }) => (
|
export const SquidProvider = ({ ...props }) => (
|
||||||
|
|||||||
+331
-56
@@ -1,5 +1,5 @@
|
|||||||
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
||||||
import { shallowEqual, useSelector, useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import type { Nullable } from '@dydxprotocol/v4-abacus';
|
import type { Nullable } from '@dydxprotocol/v4-abacus';
|
||||||
import Long from 'long';
|
import Long from 'long';
|
||||||
import type { IndexedTx } from '@cosmjs/stargate';
|
import type { IndexedTx } from '@cosmjs/stargate';
|
||||||
@@ -7,35 +7,47 @@ import type { EncodeObject, Coin } from '@cosmjs/proto-signing';
|
|||||||
import { Method } from '@cosmjs/tendermint-rpc';
|
import { Method } from '@cosmjs/tendermint-rpc';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type LocalWallet,
|
LocalWallet,
|
||||||
|
OrderExecution,
|
||||||
|
OrderFlags,
|
||||||
|
OrderSide,
|
||||||
|
OrderTimeInForce,
|
||||||
|
OrderType,
|
||||||
SubaccountClient,
|
SubaccountClient,
|
||||||
DYDX_DENOM,
|
DYDX_DENOM,
|
||||||
USDC_DENOM,
|
USDC_DENOM,
|
||||||
|
GAS_PRICE_DYDX_DENOM,
|
||||||
} from '@dydxprotocol/v4-client-js';
|
} from '@dydxprotocol/v4-client-js';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
AccountBalance,
|
HumanReadableCancelOrderPayload,
|
||||||
HumanReadablePlaceOrderPayload,
|
HumanReadablePlaceOrderPayload,
|
||||||
ParsingError,
|
|
||||||
SubAccountHistoricalPNLs,
|
SubAccountHistoricalPNLs,
|
||||||
} from '@/constants/abacus';
|
} from '@/constants/abacus';
|
||||||
|
|
||||||
import { AMOUNT_RESERVED_FOR_GAS_USDC } from '@/constants/account';
|
import { AMOUNT_RESERVED_FOR_GAS_USDC } from '@/constants/account';
|
||||||
import { AnalyticsEvent } from '@/constants/analytics';
|
import { AnalyticsEvent } from '@/constants/analytics';
|
||||||
|
import { ORDER_ERROR_CODE_MAP } from '@/constants/localization';
|
||||||
import { QUANTUM_MULTIPLIER } from '@/constants/numbers';
|
import { QUANTUM_MULTIPLIER } from '@/constants/numbers';
|
||||||
|
import { UNCOMMITTED_ORDER_TIMEOUT } from '@/constants/trade';
|
||||||
import { DydxAddress } from '@/constants/wallets';
|
import { DydxAddress } from '@/constants/wallets';
|
||||||
|
|
||||||
import { setSubaccount, setHistoricalPnl, removeUncommittedOrderClientId } from '@/state/account';
|
import {
|
||||||
import { getBalances } from '@/state/accountSelectors';
|
addUncommittedOrderClientId,
|
||||||
|
removeUncommittedOrderClientId,
|
||||||
|
setSubaccount,
|
||||||
|
setHistoricalPnl,
|
||||||
|
} from '@/state/account';
|
||||||
|
|
||||||
import abacusStateManager from '@/lib/abacus';
|
import abacusStateManager from '@/lib/abacus';
|
||||||
import { track } from '@/lib/analytics';
|
import { track } from '@/lib/analytics';
|
||||||
|
import { StatefulOrderError } from '@/lib/errors';
|
||||||
import { MustBigNumber } from '@/lib/numbers';
|
import { MustBigNumber } from '@/lib/numbers';
|
||||||
import { log } from '@/lib/telemetry';
|
import { log } from '@/lib/telemetry';
|
||||||
|
|
||||||
import { useAccounts } from './useAccounts';
|
import { useAccounts } from './useAccounts';
|
||||||
import { useDydxClient } from './useDydxClient';
|
import { useDydxClient } from './useDydxClient';
|
||||||
|
import { usePollUSDCBalance } from './usePollUSDCBalance';
|
||||||
|
|
||||||
type SubaccountContextType = ReturnType<typeof useSubaccountContext>;
|
type SubaccountContextType = ReturnType<typeof useSubaccountContext>;
|
||||||
const SubaccountContext = createContext<SubaccountContextType>({} as SubaccountContextType);
|
const SubaccountContext = createContext<SubaccountContextType>({} as SubaccountContextType);
|
||||||
@@ -71,8 +83,12 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
const {
|
const {
|
||||||
depositToSubaccount,
|
depositToSubaccount,
|
||||||
withdrawFromSubaccount,
|
withdrawFromSubaccount,
|
||||||
|
simulateWithdrawFromSubaccount,
|
||||||
transferFromSubaccountToAddress,
|
transferFromSubaccountToAddress,
|
||||||
transferNativeToken,
|
transferNativeToken,
|
||||||
|
simulateTransferNativeToken,
|
||||||
|
placeOrderForSubaccount,
|
||||||
|
cancelOrderForSubaccount,
|
||||||
sendSquidWithdrawFromSubaccount,
|
sendSquidWithdrawFromSubaccount,
|
||||||
} = useMemo(
|
} = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
@@ -94,6 +110,31 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
amount: number;
|
amount: number;
|
||||||
}) => await compositeClient?.withdrawFromSubaccount(subaccountClient, amount),
|
}) => await compositeClient?.withdrawFromSubaccount(subaccountClient, amount),
|
||||||
|
|
||||||
|
simulateWithdrawFromSubaccount: async ({
|
||||||
|
subaccountClient,
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
subaccountClient: SubaccountClient;
|
||||||
|
amount: number;
|
||||||
|
recipient?: string;
|
||||||
|
}) => {
|
||||||
|
return await compositeClient?.simulate(
|
||||||
|
subaccountClient?.wallet,
|
||||||
|
() =>
|
||||||
|
new Promise((resolve) => {
|
||||||
|
const msg = compositeClient?.withdrawFromSubaccountMessage(
|
||||||
|
subaccountClient,
|
||||||
|
amount,
|
||||||
|
recipient
|
||||||
|
);
|
||||||
|
|
||||||
|
resolve([msg]);
|
||||||
|
}),
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
transferFromSubaccountToAddress: async ({
|
transferFromSubaccountToAddress: async ({
|
||||||
subaccountClient,
|
subaccountClient,
|
||||||
assetId = 0,
|
assetId = 0,
|
||||||
@@ -144,6 +185,125 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
Method.BroadcastTxCommit
|
Method.BroadcastTxCommit
|
||||||
),
|
),
|
||||||
|
|
||||||
|
simulateTransferNativeToken: async ({
|
||||||
|
subaccountClient,
|
||||||
|
amount,
|
||||||
|
recipient,
|
||||||
|
}: {
|
||||||
|
subaccountClient: SubaccountClient;
|
||||||
|
amount: number;
|
||||||
|
recipient: string;
|
||||||
|
}) =>
|
||||||
|
await compositeClient?.simulate(
|
||||||
|
subaccountClient?.wallet,
|
||||||
|
() =>
|
||||||
|
new Promise((resolve) => {
|
||||||
|
const msg = compositeClient?.validatorClient.post.composer.composeMsgSendToken(
|
||||||
|
subaccountClient.address,
|
||||||
|
recipient,
|
||||||
|
DYDX_DENOM,
|
||||||
|
Long.fromNumber(amount * QUANTUM_MULTIPLIER)
|
||||||
|
);
|
||||||
|
|
||||||
|
resolve([msg]);
|
||||||
|
}),
|
||||||
|
GAS_PRICE_DYDX_DENOM,
|
||||||
|
undefined
|
||||||
|
),
|
||||||
|
|
||||||
|
placeOrderForSubaccount: async ({
|
||||||
|
subaccount,
|
||||||
|
marketId,
|
||||||
|
type,
|
||||||
|
side,
|
||||||
|
price,
|
||||||
|
triggerPrice,
|
||||||
|
size,
|
||||||
|
clientId,
|
||||||
|
timeInForce,
|
||||||
|
goodTilTimeInSeconds,
|
||||||
|
execution,
|
||||||
|
postOnly,
|
||||||
|
reduceOnly,
|
||||||
|
}: {
|
||||||
|
subaccount: SubaccountClient;
|
||||||
|
marketId: string;
|
||||||
|
type: OrderType;
|
||||||
|
side: OrderSide;
|
||||||
|
price: number;
|
||||||
|
triggerPrice: Nullable<number>;
|
||||||
|
size: number;
|
||||||
|
clientId: number;
|
||||||
|
timeInForce: OrderTimeInForce;
|
||||||
|
goodTilTimeInSeconds: number;
|
||||||
|
execution: OrderExecution;
|
||||||
|
postOnly: boolean;
|
||||||
|
reduceOnly: boolean;
|
||||||
|
}) => {
|
||||||
|
const startTimestamp = performance.now();
|
||||||
|
|
||||||
|
const result = await compositeClient?.placeOrder(
|
||||||
|
subaccount,
|
||||||
|
marketId,
|
||||||
|
type,
|
||||||
|
side,
|
||||||
|
price,
|
||||||
|
size,
|
||||||
|
clientId,
|
||||||
|
timeInForce,
|
||||||
|
goodTilTimeInSeconds,
|
||||||
|
execution,
|
||||||
|
postOnly,
|
||||||
|
reduceOnly,
|
||||||
|
triggerPrice ?? undefined
|
||||||
|
);
|
||||||
|
|
||||||
|
const endTimestamp = performance.now();
|
||||||
|
|
||||||
|
track(AnalyticsEvent.TradePlaceOrderConfirmed, {
|
||||||
|
roundtripMs: endTimestamp - startTimestamp,
|
||||||
|
validator: compositeClient!.validatorClient.config.restEndpoint,
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
|
cancelOrderForSubaccount: async ({
|
||||||
|
subaccount,
|
||||||
|
clientId,
|
||||||
|
clobPairId,
|
||||||
|
orderFlags,
|
||||||
|
goodTilBlock,
|
||||||
|
goodTilBlockTime,
|
||||||
|
}: {
|
||||||
|
subaccount: SubaccountClient;
|
||||||
|
clientId: number;
|
||||||
|
orderFlags: OrderFlags;
|
||||||
|
clobPairId: number;
|
||||||
|
goodTilBlock?: number;
|
||||||
|
goodTilBlockTime?: number;
|
||||||
|
}) => {
|
||||||
|
const startTimestamp = performance.now();
|
||||||
|
|
||||||
|
const result = await compositeClient?.cancelOrder(
|
||||||
|
subaccount,
|
||||||
|
clientId,
|
||||||
|
orderFlags,
|
||||||
|
clobPairId,
|
||||||
|
goodTilBlock,
|
||||||
|
goodTilBlockTime
|
||||||
|
);
|
||||||
|
|
||||||
|
const endTimestamp = performance.now();
|
||||||
|
|
||||||
|
track(AnalyticsEvent.TradeCancelOrderConfirmed, {
|
||||||
|
roundtripMs: endTimestamp - startTimestamp,
|
||||||
|
validator: compositeClient!.validatorClient.config.restEndpoint,
|
||||||
|
});
|
||||||
|
|
||||||
|
return result;
|
||||||
|
},
|
||||||
|
|
||||||
sendSquidWithdrawFromSubaccount: async ({
|
sendSquidWithdrawFromSubaccount: async ({
|
||||||
subaccountClient,
|
subaccountClient,
|
||||||
amount,
|
amount,
|
||||||
@@ -193,10 +353,10 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
|
|
||||||
// ------ Deposit/Withdraw Methods ------ //
|
// ------ Deposit/Withdraw Methods ------ //
|
||||||
const depositFunds = useCallback(
|
const depositFunds = useCallback(
|
||||||
async (balance: AccountBalance) => {
|
async (balance?: Coin) => {
|
||||||
if (!localDydxWallet) return;
|
if (!localDydxWallet) return;
|
||||||
|
|
||||||
const amountAfterDust = MustBigNumber(balance.amount)
|
const amountAfterDust = MustBigNumber(balance?.amount)
|
||||||
.minus(AMOUNT_RESERVED_FOR_GAS_USDC) // keep 0.1 USDC in user's wallet for gas
|
.minus(AMOUNT_RESERVED_FOR_GAS_USDC) // keep 0.1 USDC in user's wallet for gas
|
||||||
.toString();
|
.toString();
|
||||||
|
|
||||||
@@ -210,14 +370,11 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
[localDydxWallet, depositToSubaccount]
|
[localDydxWallet, depositToSubaccount]
|
||||||
);
|
);
|
||||||
|
|
||||||
const balances = useSelector(getBalances, shallowEqual);
|
const balance = usePollUSDCBalance({ dydxAddress });
|
||||||
const usdcCoinBalance = balances?.[USDC_DENOM];
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (usdcCoinBalance) {
|
depositFunds(balance);
|
||||||
depositFunds(usdcCoinBalance);
|
}, [balance]);
|
||||||
}
|
|
||||||
}, [usdcCoinBalance]);
|
|
||||||
|
|
||||||
const deposit = useCallback(
|
const deposit = useCallback(
|
||||||
async (amount: Long) => {
|
async (amount: Long) => {
|
||||||
@@ -256,6 +413,30 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
[subaccountClient, transferFromSubaccountToAddress, transferNativeToken]
|
[subaccountClient, transferFromSubaccountToAddress, transferNativeToken]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const simulateTransfer = useCallback(
|
||||||
|
async (amount: number, recipient: string, coinDenom: string) => {
|
||||||
|
if (!subaccountClient) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await (coinDenom === USDC_DENOM
|
||||||
|
? simulateWithdrawFromSubaccount
|
||||||
|
: simulateTransferNativeToken)({ subaccountClient, amount, recipient });
|
||||||
|
},
|
||||||
|
[subaccountClient, simulateWithdrawFromSubaccount, simulateTransferNativeToken]
|
||||||
|
);
|
||||||
|
|
||||||
|
const simulateWithdraw = useCallback(
|
||||||
|
async (amount: number) => {
|
||||||
|
if (!subaccountClient) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return await simulateWithdrawFromSubaccount({ subaccountClient, amount });
|
||||||
|
},
|
||||||
|
[subaccountClient, simulateWithdrawFromSubaccount]
|
||||||
|
);
|
||||||
|
|
||||||
const sendSquidWithdraw = useCallback(
|
const sendSquidWithdraw = useCallback(
|
||||||
async (amount: number, payload: string) => {
|
async (amount: number, payload: string) => {
|
||||||
if (!subaccountClient) {
|
if (!subaccountClient) {
|
||||||
@@ -286,41 +467,101 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
onSuccess,
|
onSuccess,
|
||||||
}: {
|
}: {
|
||||||
isClosePosition?: boolean;
|
isClosePosition?: boolean;
|
||||||
onError?: (onErrorParams?: { errorStringKey?: Nullable<string> }) => void;
|
onError?: (onErrorParams?: { errorStringKey?: string }) => void;
|
||||||
onSuccess?: (placeOrderPayload: Nullable<HumanReadablePlaceOrderPayload>) => void;
|
onSuccess?: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
const callback = (
|
let orderParams: Nullable<HumanReadablePlaceOrderPayload>;
|
||||||
success: boolean,
|
|
||||||
parsingError?: Nullable<ParsingError>,
|
|
||||||
data?: Nullable<HumanReadablePlaceOrderPayload>
|
|
||||||
) => {
|
|
||||||
if (success) {
|
|
||||||
onSuccess?.(data);
|
|
||||||
} else {
|
|
||||||
onError?.({ errorStringKey: parsingError?.stringKey });
|
|
||||||
|
|
||||||
if (data?.clientId !== undefined) {
|
if (!subaccountClient) return;
|
||||||
dispatch(removeUncommittedOrderClientId(data.clientId));
|
|
||||||
}
|
try {
|
||||||
|
orderParams = isClosePosition
|
||||||
|
? abacusStateManager.closePositionPayload()
|
||||||
|
: abacusStateManager.placeOrderPayload();
|
||||||
|
|
||||||
|
if (!orderParams) {
|
||||||
|
throw new Error('Missing order params');
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
let placeOrderParams;
|
const {
|
||||||
|
marketId,
|
||||||
|
type,
|
||||||
|
side,
|
||||||
|
price,
|
||||||
|
triggerPrice,
|
||||||
|
size,
|
||||||
|
clientId,
|
||||||
|
timeInForce,
|
||||||
|
goodTilTimeInSeconds,
|
||||||
|
execution,
|
||||||
|
postOnly,
|
||||||
|
reduceOnly,
|
||||||
|
} = orderParams;
|
||||||
|
|
||||||
if (isClosePosition) {
|
dispatch(addUncommittedOrderClientId(clientId));
|
||||||
placeOrderParams = abacusStateManager.closePosition(callback);
|
|
||||||
} else {
|
// Remove uncommitted order after timeout if it hasn't already been removed
|
||||||
placeOrderParams = abacusStateManager.placeOrder(callback);
|
setTimeout(() => {
|
||||||
|
dispatch(removeUncommittedOrderClientId(clientId));
|
||||||
|
}, UNCOMMITTED_ORDER_TIMEOUT);
|
||||||
|
|
||||||
|
console.log('useSubaccount/placeOrder', {
|
||||||
|
...orderParams,
|
||||||
|
});
|
||||||
|
|
||||||
|
const response = await placeOrderForSubaccount({
|
||||||
|
subaccount: subaccountClient,
|
||||||
|
marketId,
|
||||||
|
type: type as OrderType,
|
||||||
|
side: side as OrderSide,
|
||||||
|
price,
|
||||||
|
triggerPrice,
|
||||||
|
size,
|
||||||
|
clientId,
|
||||||
|
timeInForce: timeInForce as OrderTimeInForce,
|
||||||
|
goodTilTimeInSeconds: goodTilTimeInSeconds ?? 0,
|
||||||
|
execution: execution as OrderExecution,
|
||||||
|
postOnly,
|
||||||
|
reduceOnly,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle Stateful orders
|
||||||
|
if ((response as IndexedTx)?.code !== 0) {
|
||||||
|
throw new StatefulOrderError('Stateful order has failed to commit.', response);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (orderParams?.clientId) {
|
||||||
|
dispatch(removeUncommittedOrderClientId(orderParams.clientId));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response?.hash) {
|
||||||
|
console.log(
|
||||||
|
isClosePosition
|
||||||
|
? 'useSubaccount/closePosition'
|
||||||
|
: 'useSubaccount/placeOrderForSubaccount',
|
||||||
|
{
|
||||||
|
txHash: Buffer.from(response.hash).toString('hex').toUpperCase(),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
track(AnalyticsEvent.TradePlaceOrder, {
|
||||||
|
...orderParams,
|
||||||
|
isClosePosition,
|
||||||
|
} as HumanReadablePlaceOrderPayload & { isClosePosition: boolean });
|
||||||
|
onSuccess?.();
|
||||||
|
} catch (error) {
|
||||||
|
const errorCode: number | undefined = error?.code;
|
||||||
|
const errorStringKey = errorCode ? ORDER_ERROR_CODE_MAP[errorCode] : undefined;
|
||||||
|
onError?.({ errorStringKey });
|
||||||
|
|
||||||
|
log('useSubaccount/placeOrder', error, {
|
||||||
|
orderParams,
|
||||||
|
isClosePosition,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
track(AnalyticsEvent.TradePlaceOrder, {
|
|
||||||
...placeOrderParams,
|
|
||||||
isClosePosition,
|
|
||||||
} as HumanReadablePlaceOrderPayload & { isClosePosition: boolean });
|
|
||||||
|
|
||||||
return placeOrderParams;
|
|
||||||
},
|
},
|
||||||
[subaccountClient]
|
[subaccountClient, placeOrderForSubaccount]
|
||||||
);
|
);
|
||||||
|
|
||||||
const closePosition = useCallback(
|
const closePosition = useCallback(
|
||||||
@@ -328,8 +569,8 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
onError,
|
onError,
|
||||||
onSuccess,
|
onSuccess,
|
||||||
}: {
|
}: {
|
||||||
onError: (onErrorParams?: { errorStringKey?: Nullable<string> }) => void;
|
onError: (onErrorParams?: { errorStringKey?: string }) => void;
|
||||||
onSuccess?: (placeOrderPayload: Nullable<HumanReadablePlaceOrderPayload>) => void;
|
onSuccess?: () => void;
|
||||||
}) => await placeOrder({ isClosePosition: true, onError, onSuccess }),
|
}) => await placeOrder({ isClosePosition: true, onError, onSuccess }),
|
||||||
[placeOrder]
|
[placeOrder]
|
||||||
);
|
);
|
||||||
@@ -341,21 +582,53 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
onSuccess,
|
onSuccess,
|
||||||
}: {
|
}: {
|
||||||
orderId: string;
|
orderId: string;
|
||||||
onError?: ({ errorStringKey }?: { errorStringKey?: Nullable<string> }) => void;
|
onError?: ({ errorMsg }?: { errorMsg?: string }) => void;
|
||||||
onSuccess?: () => void;
|
onSuccess?: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
const callback = (success: boolean, parsingError?: Nullable<ParsingError>) => {
|
let cancelOrderParams: Nullable<HumanReadableCancelOrderPayload>;
|
||||||
if (success) {
|
|
||||||
track(AnalyticsEvent.TradeCancelOrder);
|
|
||||||
onSuccess?.();
|
|
||||||
} else {
|
|
||||||
onError?.({ errorStringKey: parsingError?.stringKey });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
abacusStateManager.cancelOrder(orderId, callback);
|
if (!subaccountClient) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
cancelOrderParams = abacusStateManager.cancelOrderPayload(orderId);
|
||||||
|
|
||||||
|
if (!cancelOrderParams) {
|
||||||
|
throw new Error('Missing cancel order params');
|
||||||
|
}
|
||||||
|
|
||||||
|
const { clientId, clobPairId, goodTilBlock, goodTilBlockTime, orderFlags } =
|
||||||
|
cancelOrderParams;
|
||||||
|
|
||||||
|
// Keep for debugging
|
||||||
|
console.log('useSubaccount/cancelOrder', cancelOrderParams);
|
||||||
|
|
||||||
|
const response = await cancelOrderForSubaccount({
|
||||||
|
subaccount: subaccountClient,
|
||||||
|
clientId,
|
||||||
|
orderFlags,
|
||||||
|
clobPairId,
|
||||||
|
goodTilBlock: goodTilBlock || undefined,
|
||||||
|
goodTilBlockTime: goodTilBlockTime || undefined,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Handle Stateful orders
|
||||||
|
if ((response as IndexedTx)?.code !== 0) {
|
||||||
|
throw new StatefulOrderError('Stateful cancel has failed to commit.', response);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response?.hash) {
|
||||||
|
console.log('useSubaccount/cancelOrderForSubaccount', {
|
||||||
|
txHash: Buffer.from(response.hash).toString('hex').toUpperCase(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onSuccess?.();
|
||||||
|
} catch (error) {
|
||||||
|
onError?.();
|
||||||
|
log('useSubaccount/cancelOrder', error, cancelOrderParams);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
[subaccountClient]
|
[subaccountClient, cancelOrderForSubaccount]
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -365,7 +638,9 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
requestFaucetFunds,
|
requestFaucetFunds,
|
||||||
|
|
||||||
// Transfer Methods
|
// Transfer Methods
|
||||||
|
simulateTransfer,
|
||||||
transfer,
|
transfer,
|
||||||
|
simulateWithdraw,
|
||||||
sendSquidWithdraw,
|
sendSquidWithdraw,
|
||||||
|
|
||||||
// Trading Methods
|
// Trading Methods
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import { DepositDialog } from '@/views/dialogs/DepositDialog';
|
|||||||
import { DisconnectDialog } from '@/views/dialogs/DisconnectDialog';
|
import { DisconnectDialog } from '@/views/dialogs/DisconnectDialog';
|
||||||
import { ExchangeOfflineDialog } from '@/views/dialogs/ExchangeOfflineDialog';
|
import { ExchangeOfflineDialog } from '@/views/dialogs/ExchangeOfflineDialog';
|
||||||
import { HelpDialog } from '@/views/dialogs/HelpDialog';
|
import { HelpDialog } from '@/views/dialogs/HelpDialog';
|
||||||
import { ExternalNavKeplrDialog } from '@/views/dialogs/ExternalNavKeplrDialog';
|
|
||||||
import { MnemonicExportDialog } from '@/views/dialogs/MnemonicExportDialog';
|
import { MnemonicExportDialog } from '@/views/dialogs/MnemonicExportDialog';
|
||||||
import { MobileSignInDialog } from '@/views/dialogs/MobileSignInDialog';
|
import { MobileSignInDialog } from '@/views/dialogs/MobileSignInDialog';
|
||||||
import { OnboardingDialog } from '@/views/dialogs/OnboardingDialog';
|
import { OnboardingDialog } from '@/views/dialogs/OnboardingDialog';
|
||||||
@@ -48,7 +47,6 @@ export const DialogManager = () => {
|
|||||||
[DialogTypes.ExchangeOffline]: <ExchangeOfflineDialog {...modalProps} />,
|
[DialogTypes.ExchangeOffline]: <ExchangeOfflineDialog {...modalProps} />,
|
||||||
[DialogTypes.FillDetails]: <FillDetailsDialog {...modalProps} />,
|
[DialogTypes.FillDetails]: <FillDetailsDialog {...modalProps} />,
|
||||||
[DialogTypes.Help]: <HelpDialog {...modalProps} />,
|
[DialogTypes.Help]: <HelpDialog {...modalProps} />,
|
||||||
[DialogTypes.ExternalNavKeplr]: <ExternalNavKeplrDialog {...modalProps} />,
|
|
||||||
[DialogTypes.MnemonicExport]: <MnemonicExportDialog {...modalProps} />,
|
[DialogTypes.MnemonicExport]: <MnemonicExportDialog {...modalProps} />,
|
||||||
[DialogTypes.MobileSignIn]: <MobileSignInDialog {...modalProps} />,
|
[DialogTypes.MobileSignIn]: <MobileSignInDialog {...modalProps} />,
|
||||||
[DialogTypes.Onboarding]: <OnboardingDialog {...modalProps} />,
|
[DialogTypes.Onboarding]: <OnboardingDialog {...modalProps} />,
|
||||||
|
|||||||
@@ -42,11 +42,6 @@ export const HeaderDesktop = () => {
|
|||||||
label: stringGetter({ key: STRING_KEYS.TRADE }),
|
label: stringGetter({ key: STRING_KEYS.TRADE }),
|
||||||
href: AppRoute.Trade,
|
href: AppRoute.Trade,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
value: 'Dv4TNT',
|
|
||||||
label: 'Dv4TNT',
|
|
||||||
href: AppRoute.Rewards,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
value: 'PORTFOLIO',
|
value: 'PORTFOLIO',
|
||||||
label: stringGetter({ key: STRING_KEYS.PORTFOLIO }),
|
label: stringGetter({ key: STRING_KEYS.PORTFOLIO }),
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
import type { AbacusTrackingProtocol, Nullable } from '@/constants/abacus';
|
|
||||||
import type { AnalyticsEvent } from '@/constants/analytics';
|
|
||||||
|
|
||||||
import { track } from '../analytics';
|
|
||||||
import { log as telemetryLog } from '../telemetry';
|
|
||||||
|
|
||||||
class AbacusAnalytics implements AbacusTrackingProtocol {
|
|
||||||
log(event: string, data: Nullable<string>) {
|
|
||||||
try {
|
|
||||||
const parsedData = data ? JSON.parse(data) : {};
|
|
||||||
track(event as AnalyticsEvent, parsedData);
|
|
||||||
} catch (error) {
|
|
||||||
telemetryLog('AbacusAnalytics/log', error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default AbacusAnalytics;
|
|
||||||
@@ -1,51 +1,30 @@
|
|||||||
import Abacus, { type Nullable } from '@dydxprotocol/v4-abacus';
|
import Abacus, { Nullable } from '@dydxprotocol/v4-abacus';
|
||||||
import Long from 'long';
|
import Long from 'long';
|
||||||
import type { IndexedTx } from '@cosmjs/stargate';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CompositeClient,
|
CompositeClient,
|
||||||
IndexerConfig,
|
IndexerConfig,
|
||||||
type LocalWallet,
|
|
||||||
Network,
|
Network,
|
||||||
NetworkOptimizer,
|
NetworkOptimizer,
|
||||||
SubaccountClient,
|
|
||||||
ValidatorConfig,
|
ValidatorConfig,
|
||||||
OrderType,
|
|
||||||
OrderSide,
|
|
||||||
OrderTimeInForce,
|
|
||||||
OrderExecution,
|
|
||||||
DYDX_DENOM,
|
|
||||||
GAS_PRICE_DYDX_DENOM,
|
|
||||||
} from '@dydxprotocol/v4-client-js';
|
} from '@dydxprotocol/v4-client-js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type AbacusDYDXChainTransactionsProtocol,
|
type AbacusDYDXChainTransactionsProtocol,
|
||||||
QueryType,
|
QueryType,
|
||||||
type QueryTypes,
|
type QueryTypes,
|
||||||
TransactionType,
|
|
||||||
type TransactionTypes,
|
type TransactionTypes,
|
||||||
type HumanReadablePlaceOrderPayload,
|
|
||||||
type HumanReadableCancelOrderPayload,
|
|
||||||
type HumanReadableWithdrawPayload,
|
|
||||||
type HumanReadableTransferPayload,
|
|
||||||
} from '@/constants/abacus';
|
} from '@/constants/abacus';
|
||||||
|
|
||||||
import { DialogTypes } from '@/constants/dialogs';
|
import { DialogTypes } from '@/constants/dialogs';
|
||||||
import { UNCOMMITTED_ORDER_TIMEOUT_MS } from '@/constants/trade';
|
|
||||||
import { QUANTUM_MULTIPLIER } from '@/constants/numbers';
|
|
||||||
|
|
||||||
import { RootStore } from '@/state/_store';
|
import { RootStore } from '@/state/_store';
|
||||||
import { addUncommittedOrderClientId, removeUncommittedOrderClientId } from '@/state/account';
|
|
||||||
import { openDialog } from '@/state/dialogs';
|
import { openDialog } from '@/state/dialogs';
|
||||||
|
|
||||||
import { StatefulOrderError } from '../errors';
|
|
||||||
import { bytesToBigInt } from '../numbers';
|
|
||||||
import { log } from '../telemetry';
|
import { log } from '../telemetry';
|
||||||
|
|
||||||
class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
||||||
private compositeClient: CompositeClient | undefined;
|
private compositeClient: CompositeClient | undefined;
|
||||||
private store: RootStore | undefined;
|
private store: RootStore | undefined;
|
||||||
private localWallet: LocalWallet | undefined;
|
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.compositeClient = undefined;
|
this.compositeClient = undefined;
|
||||||
@@ -56,10 +35,6 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
this.store = store;
|
this.store = store;
|
||||||
}
|
}
|
||||||
|
|
||||||
setLocalWallet(localWallet: LocalWallet) {
|
|
||||||
this.localWallet = localWallet;
|
|
||||||
}
|
|
||||||
|
|
||||||
async connectNetwork(
|
async connectNetwork(
|
||||||
indexerUrl: string,
|
indexerUrl: string,
|
||||||
indexerSocketUrl: string,
|
indexerSocketUrl: string,
|
||||||
@@ -118,10 +93,6 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
return x.toString() as T;
|
return x.toString() as T;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (x instanceof Uint8Array) {
|
|
||||||
return bytesToBigInt(x).toString() as T;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (typeof x === 'object') {
|
if (typeof x === 'object') {
|
||||||
const parsedObj: { [key: string]: any } = {};
|
const parsedObj: { [key: string]: any } = {};
|
||||||
for (const key in x) {
|
for (const key in x) {
|
||||||
@@ -135,218 +106,13 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
throw new Error(`Unsupported data type: ${typeof x}`);
|
throw new Error(`Unsupported data type: ${typeof x}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
async placeOrderTransaction(params: HumanReadablePlaceOrderPayload): Promise<string> {
|
|
||||||
if (!this.compositeClient || !this.localWallet)
|
|
||||||
throw new Error('Missing compositeClient or localWallet');
|
|
||||||
|
|
||||||
try {
|
|
||||||
const {
|
|
||||||
subaccountNumber,
|
|
||||||
marketId,
|
|
||||||
type,
|
|
||||||
side,
|
|
||||||
price,
|
|
||||||
size,
|
|
||||||
clientId,
|
|
||||||
timeInForce,
|
|
||||||
goodTilTimeInSeconds,
|
|
||||||
execution,
|
|
||||||
postOnly,
|
|
||||||
reduceOnly,
|
|
||||||
triggerPrice,
|
|
||||||
} = params || {};
|
|
||||||
|
|
||||||
// Observe uncommitted order
|
|
||||||
this.store?.dispatch(addUncommittedOrderClientId(clientId));
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
this.store?.dispatch(removeUncommittedOrderClientId(clientId));
|
|
||||||
}, UNCOMMITTED_ORDER_TIMEOUT_MS);
|
|
||||||
|
|
||||||
// Place order
|
|
||||||
const tx = await this.compositeClient?.placeOrder(
|
|
||||||
new SubaccountClient(this.localWallet, subaccountNumber),
|
|
||||||
marketId,
|
|
||||||
type as OrderType,
|
|
||||||
side as OrderSide,
|
|
||||||
price,
|
|
||||||
size,
|
|
||||||
clientId,
|
|
||||||
timeInForce as OrderTimeInForce,
|
|
||||||
goodTilTimeInSeconds ?? 0,
|
|
||||||
execution as OrderExecution,
|
|
||||||
postOnly,
|
|
||||||
reduceOnly,
|
|
||||||
triggerPrice ?? undefined
|
|
||||||
);
|
|
||||||
|
|
||||||
// Handle stateful orders
|
|
||||||
if ((tx as IndexedTx)?.code !== 0) {
|
|
||||||
throw new StatefulOrderError('Stateful order has failed to commit.', tx);
|
|
||||||
}
|
|
||||||
|
|
||||||
const parsedTx = this.parseToPrimitives(tx);
|
|
||||||
const hash = parsedTx?.hash;
|
|
||||||
|
|
||||||
if (import.meta.env.MODE === 'production') {
|
|
||||||
console.log(`https://testnet.mintscan.io/dydx-testnet/txs/${hash}`);
|
|
||||||
} else console.log(`txHash: ${hash}`);
|
|
||||||
|
|
||||||
return JSON.stringify(parsedTx);
|
|
||||||
} catch (error) {
|
|
||||||
if (error?.name !== 'BroadcastError') {
|
|
||||||
log('DydxChainTransactions/placeOrderTransaction', error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return JSON.stringify({
|
|
||||||
error,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async cancelOrderTransaction(params: HumanReadableCancelOrderPayload): Promise<string> {
|
|
||||||
if (!this.compositeClient || !this.localWallet) {
|
|
||||||
throw new Error('Missing compositeClient or localWallet');
|
|
||||||
}
|
|
||||||
|
|
||||||
const { subaccountNumber, clientId, orderFlags, clobPairId, goodTilBlock, goodTilBlockTime } =
|
|
||||||
params ?? {};
|
|
||||||
|
|
||||||
try {
|
|
||||||
const tx = await this.compositeClient?.cancelOrder(
|
|
||||||
new SubaccountClient(this.localWallet, subaccountNumber),
|
|
||||||
clientId,
|
|
||||||
orderFlags,
|
|
||||||
clobPairId,
|
|
||||||
goodTilBlock ?? undefined,
|
|
||||||
goodTilBlockTime ?? undefined
|
|
||||||
);
|
|
||||||
|
|
||||||
const parsedTx = this.parseToPrimitives(tx);
|
|
||||||
|
|
||||||
return JSON.stringify(parsedTx);
|
|
||||||
} catch (error) {
|
|
||||||
log('DydxChainTransactions/cancelOrderTransaction', error);
|
|
||||||
|
|
||||||
return JSON.stringify({
|
|
||||||
error,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async simulateWithdrawTransaction(params: HumanReadableWithdrawPayload): Promise<string> {
|
|
||||||
if (!this.compositeClient || !this.localWallet) {
|
|
||||||
throw new Error('Missing compositeClient or localWallet');
|
|
||||||
}
|
|
||||||
|
|
||||||
const { subaccountNumber, amount } = params ?? {};
|
|
||||||
const compositeClient = this.compositeClient;
|
|
||||||
const subaccountClient = new SubaccountClient(this.localWallet, subaccountNumber);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const tx = await compositeClient.simulate(
|
|
||||||
this.localWallet,
|
|
||||||
() =>
|
|
||||||
new Promise((resolve) => {
|
|
||||||
const msg = compositeClient.withdrawFromSubaccountMessage(subaccountClient, amount);
|
|
||||||
|
|
||||||
resolve([msg]);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
const parsedTx = this.parseToPrimitives(tx);
|
|
||||||
|
|
||||||
return JSON.stringify(parsedTx);
|
|
||||||
} catch (error) {
|
|
||||||
log('DydxChainTransactions/simulateWithdrawTransaction', error);
|
|
||||||
|
|
||||||
return JSON.stringify({
|
|
||||||
error,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async simulateTransferNativeTokenTransaction(params: HumanReadableTransferPayload): Promise<string> {
|
|
||||||
if (!this.compositeClient || !this.localWallet) {
|
|
||||||
throw new Error('Missing compositeClient or localWallet');
|
|
||||||
}
|
|
||||||
|
|
||||||
const { subaccountNumber, amount, recipient } = params ?? {};
|
|
||||||
const compositeClient = this.compositeClient;
|
|
||||||
const subaccountClient = new SubaccountClient(this.localWallet, subaccountNumber);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const tx = await compositeClient.simulate(
|
|
||||||
this.localWallet,
|
|
||||||
() =>
|
|
||||||
new Promise((resolve) => {
|
|
||||||
const msg = compositeClient?.validatorClient.post.composer.composeMsgSendToken(
|
|
||||||
subaccountClient.address,
|
|
||||||
recipient,
|
|
||||||
DYDX_DENOM,
|
|
||||||
Long.fromNumber(amount * QUANTUM_MULTIPLIER)
|
|
||||||
);
|
|
||||||
|
|
||||||
resolve([msg]);
|
|
||||||
}),
|
|
||||||
GAS_PRICE_DYDX_DENOM,
|
|
||||||
);
|
|
||||||
|
|
||||||
const parsedTx = this.parseToPrimitives(tx);
|
|
||||||
|
|
||||||
return JSON.stringify(parsedTx);
|
|
||||||
} catch (error) {
|
|
||||||
log('DydxChainTransactions/simulateTransferNativeTokenTransaction', error);
|
|
||||||
|
|
||||||
return JSON.stringify({
|
|
||||||
error,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async transaction(
|
async transaction(
|
||||||
type: TransactionTypes,
|
type: TransactionTypes,
|
||||||
paramsInJson: Abacus.Nullable<string>,
|
paramsInJson: Abacus.Nullable<string>,
|
||||||
callback: (p0: Abacus.Nullable<string>) => void
|
callback: (p0: Abacus.Nullable<string>) => void
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
// To be implemented
|
||||||
const params = paramsInJson ? JSON.parse(paramsInJson) : undefined;
|
return;
|
||||||
|
|
||||||
switch (type) {
|
|
||||||
case TransactionType.PlaceOrder: {
|
|
||||||
const result = await this.placeOrderTransaction(params);
|
|
||||||
callback(result);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TransactionType.CancelOrder: {
|
|
||||||
const result = await this.cancelOrderTransaction(params);
|
|
||||||
callback(result);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TransactionType.simulateWithdraw: {
|
|
||||||
const result = await this.simulateWithdrawTransaction(params);
|
|
||||||
callback(result);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TransactionType.simulateTransferNativeToken: {
|
|
||||||
const result = await this.simulateTransferNativeTokenTransaction(params);
|
|
||||||
callback(result);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
try {
|
|
||||||
const serializedError = JSON.stringify(error);
|
|
||||||
callback(serializedError);
|
|
||||||
} catch (parseError) {
|
|
||||||
log('DydxChainTransactions/transaction', parseError);
|
|
||||||
}
|
|
||||||
|
|
||||||
log('DydxChainTransactions/transaction', error);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async get(
|
async get(
|
||||||
@@ -370,12 +136,6 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
);
|
);
|
||||||
callback(JSON.stringify({ url: optimalNode }));
|
callback(JSON.stringify({ url: optimalNode }));
|
||||||
break;
|
break;
|
||||||
case QueryType.EquityTiers:
|
|
||||||
const equityTiers =
|
|
||||||
await this.compositeClient?.validatorClient.get.getEquityTierLimitConfiguration();
|
|
||||||
const parsedEquityTiers = this.parseToPrimitives(equityTiers);
|
|
||||||
callback(JSON.stringify(parsedEquityTiers));
|
|
||||||
break;
|
|
||||||
case QueryType.FeeTiers:
|
case QueryType.FeeTiers:
|
||||||
const feeTiers = await this.compositeClient?.validatorClient.get.getFeeTiers();
|
const feeTiers = await this.compositeClient?.validatorClient.get.getFeeTiers();
|
||||||
const parsedFeeTiers = this.parseToPrimitives(feeTiers);
|
const parsedFeeTiers = this.parseToPrimitives(feeTiers);
|
||||||
@@ -395,30 +155,6 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
const parsedUserStats = this.parseToPrimitives(userStats);
|
const parsedUserStats = this.parseToPrimitives(userStats);
|
||||||
callback(JSON.stringify(parsedUserStats));
|
callback(JSON.stringify(parsedUserStats));
|
||||||
break;
|
break;
|
||||||
case QueryType.GetAccountBalances:
|
|
||||||
if (!this.localWallet?.address) throw new Error('Missing localWallet');
|
|
||||||
const accountBalances = await this.compositeClient?.validatorClient.get.getAccountBalances(
|
|
||||||
this.localWallet.address
|
|
||||||
);
|
|
||||||
const parsedAccountBalances = this.parseToPrimitives(accountBalances);
|
|
||||||
callback(JSON.stringify(parsedAccountBalances));
|
|
||||||
break;
|
|
||||||
case QueryType.RewardsParams:
|
|
||||||
const rewardsParams = await this.compositeClient?.validatorClient.get.getRewardsParams();
|
|
||||||
const parsedRewardsParams = this.parseToPrimitives(rewardsParams);
|
|
||||||
callback(JSON.stringify(parsedRewardsParams));
|
|
||||||
break;
|
|
||||||
case QueryType.GetMarketPrice:
|
|
||||||
const price = await this.compositeClient?.validatorClient.get.getPrice(params.marketId);
|
|
||||||
const parsedPrice = this.parseToPrimitives(price);
|
|
||||||
callback(JSON.stringify(parsedPrice));
|
|
||||||
break;
|
|
||||||
case QueryType.GetDelegations:
|
|
||||||
const delegations =
|
|
||||||
await this.compositeClient?.validatorClient.get.getDelegatorDelegations(params.address);
|
|
||||||
const parseDelegations = this.parseToPrimitives(delegations);
|
|
||||||
callback(JSON.stringify(parseDelegations));
|
|
||||||
break;
|
|
||||||
// Do not implement Transfers (yet)
|
// Do not implement Transfers (yet)
|
||||||
case QueryType.Transfers:
|
case QueryType.Transfers:
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { AbacusFileSystemProtocol, FileLocation, Nullable } from '@/constants/abacus';
|
import type { AbacusFileSystemProtocol, FileLocation, Nullable } from '@/constants/abacus';
|
||||||
|
import { NETWORK_ENDPOINTS } from '@/constants/networks';
|
||||||
|
|
||||||
export const ENDPOINTS_PATH =
|
export const ENDPOINTS_PATH =
|
||||||
import.meta.env.MODE === 'production'
|
import.meta.env.MODE === 'production'
|
||||||
@@ -7,6 +8,10 @@ export const ENDPOINTS_PATH =
|
|||||||
|
|
||||||
class AbacusFileSystem implements AbacusFileSystemProtocol {
|
class AbacusFileSystem implements AbacusFileSystemProtocol {
|
||||||
readTextFile(location: FileLocation, path: string): Nullable<string> {
|
readTextFile(location: FileLocation, path: string): Nullable<string> {
|
||||||
|
if (path === ENDPOINTS_PATH) {
|
||||||
|
return JSON.stringify(NETWORK_ENDPOINTS);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+19
-48
@@ -1,5 +1,3 @@
|
|||||||
import type { LocalWallet } from '@dydxprotocol/v4-client-js';
|
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
ClosePositionInputFields,
|
ClosePositionInputFields,
|
||||||
Nullable,
|
Nullable,
|
||||||
@@ -8,7 +6,6 @@ import type {
|
|||||||
TradeInputFields,
|
TradeInputFields,
|
||||||
TransferInputFields,
|
TransferInputFields,
|
||||||
HistoricalPnlPeriods,
|
HistoricalPnlPeriods,
|
||||||
ParsingError,
|
|
||||||
} from '@/constants/abacus';
|
} from '@/constants/abacus';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -22,11 +19,10 @@ import {
|
|||||||
UIImplementations,
|
UIImplementations,
|
||||||
CoroutineTimer,
|
CoroutineTimer,
|
||||||
TransferType,
|
TransferType,
|
||||||
AbacusAppConfig,
|
|
||||||
} from '@/constants/abacus';
|
} from '@/constants/abacus';
|
||||||
|
|
||||||
import { DEFAULT_MARKETID } from '@/constants/markets';
|
import { DEFAULT_MARKETID } from '@/constants/markets';
|
||||||
import { CURRENT_ABACUS_DEPLOYMENT, type DydxNetwork } from '@/constants/networks';
|
import { type DydxNetwork } from '@/constants/networks';
|
||||||
|
|
||||||
import type { RootStore } from '@/state/_store';
|
import type { RootStore } from '@/state/_store';
|
||||||
|
|
||||||
@@ -34,7 +30,6 @@ import { getInputTradeOptions } from '@/state/inputsSelectors';
|
|||||||
import { getTransferInputs } from '@/state/inputsSelectors';
|
import { getTransferInputs } from '@/state/inputsSelectors';
|
||||||
|
|
||||||
import AbacusRest from './rest';
|
import AbacusRest from './rest';
|
||||||
import AbacusAnalytics from './analytics';
|
|
||||||
import AbacusWebsocket from './websocket';
|
import AbacusWebsocket from './websocket';
|
||||||
import AbacusChainTransaction from './dydxChainTransactions';
|
import AbacusChainTransaction from './dydxChainTransactions';
|
||||||
import AbacusStateNotifier from './stateNotification';
|
import AbacusStateNotifier from './stateNotification';
|
||||||
@@ -50,25 +45,23 @@ class AbacusStateManager {
|
|||||||
stateManager: InstanceType<typeof AsyncAbacusStateManager>;
|
stateManager: InstanceType<typeof AsyncAbacusStateManager>;
|
||||||
websocket: AbacusWebsocket;
|
websocket: AbacusWebsocket;
|
||||||
stateNotifier: AbacusStateNotifier;
|
stateNotifier: AbacusStateNotifier;
|
||||||
analytics: AbacusAnalytics;
|
|
||||||
abacusFormatter: AbacusFormatter;
|
abacusFormatter: AbacusFormatter;
|
||||||
chainTransactions: AbacusChainTransaction;
|
chainTransactionClient: AbacusChainTransaction;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.store = undefined;
|
this.store = undefined;
|
||||||
this.currentMarket = undefined;
|
this.currentMarket = undefined;
|
||||||
this.stateNotifier = new AbacusStateNotifier();
|
this.stateNotifier = new AbacusStateNotifier();
|
||||||
this.analytics = new AbacusAnalytics();
|
|
||||||
this.websocket = new AbacusWebsocket();
|
this.websocket = new AbacusWebsocket();
|
||||||
this.abacusFormatter = new AbacusFormatter();
|
this.abacusFormatter = new AbacusFormatter();
|
||||||
this.chainTransactions = new AbacusChainTransaction();
|
this.chainTransactionClient = new AbacusChainTransaction();
|
||||||
|
|
||||||
const ioImplementations = new IOImplementations(
|
const ioImplementations = new IOImplementations(
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
new AbacusRest(),
|
new AbacusRest(),
|
||||||
this.websocket,
|
this.websocket,
|
||||||
this.chainTransactions,
|
this.chainTransactionClient,
|
||||||
this.analytics,
|
null,
|
||||||
new AbacusThreading(),
|
new AbacusThreading(),
|
||||||
new CoroutineTimer(),
|
new CoroutineTimer(),
|
||||||
new AbacusFileSystem()
|
new AbacusFileSystem()
|
||||||
@@ -81,9 +74,8 @@ class AbacusStateManager {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.stateManager = new AsyncAbacusStateManager(
|
this.stateManager = new AsyncAbacusStateManager(
|
||||||
'',
|
import.meta.env.SHARED_RESOURCES_URI,
|
||||||
CURRENT_ABACUS_DEPLOYMENT,
|
ENDPOINTS_PATH,
|
||||||
AbacusAppConfig.Companion.forWeb,
|
|
||||||
ioImplementations,
|
ioImplementations,
|
||||||
uiImplementations,
|
uiImplementations,
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@@ -165,14 +157,11 @@ class AbacusStateManager {
|
|||||||
setStore = (store: RootStore) => {
|
setStore = (store: RootStore) => {
|
||||||
this.store = store;
|
this.store = store;
|
||||||
this.stateNotifier.setStore(store);
|
this.stateNotifier.setStore(store);
|
||||||
this.chainTransactions.setStore(store);
|
this.chainTransactionClient.setStore(store);
|
||||||
};
|
};
|
||||||
|
|
||||||
setAccount = (localWallet?: LocalWallet) => {
|
setAccount = (walletAddress: string) => {
|
||||||
if (localWallet) {
|
this.stateManager.accountAddress = walletAddress;
|
||||||
this.stateManager.accountAddress = localWallet.address;
|
|
||||||
this.chainTransactions.setLocalWallet(localWallet);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
setTransfersSourceAddress = (evmAddress: string) => {
|
setTransfersSourceAddress = (evmAddress: string) => {
|
||||||
@@ -230,34 +219,16 @@ class AbacusStateManager {
|
|||||||
this.stateManager.transferStatus(hash, fromChainId, toChainId);
|
this.stateManager.transferStatus(hash, fromChainId, toChainId);
|
||||||
};
|
};
|
||||||
|
|
||||||
// ------ Transactions ------ //
|
|
||||||
|
|
||||||
placeOrder = (
|
|
||||||
callback: (
|
|
||||||
success: boolean,
|
|
||||||
parsingError: Nullable<ParsingError>,
|
|
||||||
data: Nullable<HumanReadablePlaceOrderPayload>
|
|
||||||
) => void
|
|
||||||
): Nullable<HumanReadablePlaceOrderPayload> => this.stateManager.commitPlaceOrder(callback);
|
|
||||||
|
|
||||||
closePosition = (
|
|
||||||
callback: (
|
|
||||||
success: boolean,
|
|
||||||
parsingError: Nullable<ParsingError>,
|
|
||||||
data: Nullable<HumanReadablePlaceOrderPayload>
|
|
||||||
) => void
|
|
||||||
): Nullable<HumanReadablePlaceOrderPayload> => this.stateManager.commitClosePosition(callback);
|
|
||||||
|
|
||||||
cancelOrder = (
|
|
||||||
orderId: string,
|
|
||||||
callback: (
|
|
||||||
success: boolean,
|
|
||||||
parsingError: Nullable<ParsingError>,
|
|
||||||
data: Nullable<HumanReadableCancelOrderPayload>
|
|
||||||
) => void
|
|
||||||
) => this.stateManager.cancelOrder(orderId, callback);
|
|
||||||
|
|
||||||
// ------ Utils ------ //
|
// ------ Utils ------ //
|
||||||
|
placeOrderPayload = (): Nullable<HumanReadablePlaceOrderPayload> =>
|
||||||
|
this.stateManager.placeOrderPayload();
|
||||||
|
|
||||||
|
closePositionPayload = (): Nullable<HumanReadablePlaceOrderPayload> =>
|
||||||
|
this.stateManager.closePositionPayload();
|
||||||
|
|
||||||
|
cancelOrderPayload = (orderId: string): Nullable<HumanReadableCancelOrderPayload> =>
|
||||||
|
this.stateManager.cancelOrderPayload(orderId);
|
||||||
|
|
||||||
getHistoricalPnlPeriod = (): Nullable<HistoricalPnlPeriods> =>
|
getHistoricalPnlPeriod = (): Nullable<HistoricalPnlPeriods> =>
|
||||||
this.stateManager.historicalPnlPeriod;
|
this.stateManager.historicalPnlPeriod;
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { kollections } from '@dydxprotocol/v4-abacus';
|
import { kollections } from '@dydxprotocol/v4-abacus';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
AccountBalance,
|
|
||||||
AbacusApiState,
|
AbacusApiState,
|
||||||
AbacusNotification,
|
AbacusNotification,
|
||||||
AbacusStateNotificationProtocol,
|
AbacusStateNotificationProtocol,
|
||||||
@@ -19,12 +18,9 @@ import { Changes } from '@/constants/abacus';
|
|||||||
import type { RootStore } from '@/state/_store';
|
import type { RootStore } from '@/state/_store';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
setBalances,
|
|
||||||
setStakingBalances,
|
|
||||||
setFills,
|
setFills,
|
||||||
setFundingPayments,
|
setFundingPayments,
|
||||||
setHistoricalPnl,
|
setHistoricalPnl,
|
||||||
setLatestOrder,
|
|
||||||
setSubaccount,
|
setSubaccount,
|
||||||
setTransfers,
|
setTransfers,
|
||||||
setWallet,
|
setWallet,
|
||||||
@@ -35,7 +31,6 @@ import { setAssets } from '@/state/assets';
|
|||||||
import { setConfigs } from '@/state/configs';
|
import { setConfigs } from '@/state/configs';
|
||||||
import { setInputs } from '@/state/inputs';
|
import { setInputs } from '@/state/inputs';
|
||||||
import { setHistoricalFundings, setLiveTrades, setMarkets, setOrderbook } from '@/state/perpetuals';
|
import { setHistoricalFundings, setLiveTrades, setMarkets, setOrderbook } from '@/state/perpetuals';
|
||||||
import { isTruthy } from '../isTruthy';
|
|
||||||
|
|
||||||
class AbacusStateNotifier implements AbacusStateNotificationProtocol {
|
class AbacusStateNotifier implements AbacusStateNotificationProtocol {
|
||||||
private store: RootStore | undefined;
|
private store: RootStore | undefined;
|
||||||
@@ -76,23 +71,6 @@ class AbacusStateNotifier implements AbacusStateNotificationProtocol {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changes.has(Changes.accountBalances)) {
|
|
||||||
if (updatedState.account?.balances) {
|
|
||||||
const balances: Record<string, AccountBalance> = {};
|
|
||||||
for (const { k, v } of updatedState.account.balances.toArray()) {
|
|
||||||
balances[k] = v;
|
|
||||||
}
|
|
||||||
dispatch(setBalances(balances));
|
|
||||||
}
|
|
||||||
if (updatedState.account?.stakingBalances) {
|
|
||||||
const stakingBalances: Record<string, AccountBalance> = {};
|
|
||||||
for (const { k, v } of updatedState.account.stakingBalances.toArray()) {
|
|
||||||
stakingBalances[k] = v;
|
|
||||||
}
|
|
||||||
dispatch(setStakingBalances(stakingBalances));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changes.has(Changes.configs)) {
|
if (changes.has(Changes.configs)) {
|
||||||
dispatch(setConfigs(updatedState.configs));
|
dispatch(setConfigs(updatedState.configs));
|
||||||
}
|
}
|
||||||
@@ -109,12 +87,10 @@ class AbacusStateNotifier implements AbacusStateNotificationProtocol {
|
|||||||
dispatch(
|
dispatch(
|
||||||
setMarkets({
|
setMarkets({
|
||||||
markets: Object.fromEntries(
|
markets: Object.fromEntries(
|
||||||
(marketIds || updatedState.marketIds()?.toArray() || [])
|
(marketIds || updatedState.marketIds()?.toArray() || []).map((marketId: string) => {
|
||||||
.map((marketId: string) => {
|
const marketData = updatedState.market(marketId);
|
||||||
const marketData = updatedState.market(marketId);
|
return [marketId, marketData];
|
||||||
return [marketId, marketData];
|
})
|
||||||
})
|
|
||||||
.filter(isTruthy)
|
|
||||||
) as Record<string, PerpetualMarket>,
|
) as Record<string, PerpetualMarket>,
|
||||||
update: !!marketIds,
|
update: !!marketIds,
|
||||||
})
|
})
|
||||||
@@ -179,9 +155,7 @@ class AbacusStateNotifier implements AbacusStateNotificationProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastOrderChanged(order: SubaccountOrder) {
|
lastOrderChanged(order: SubaccountOrder) {}
|
||||||
this.store?.dispatch(setLatestOrder(order));
|
|
||||||
}
|
|
||||||
|
|
||||||
errorsEmitted(errors: ParsingErrors) {
|
errorsEmitted(errors: ParsingErrors) {
|
||||||
console.error('parse errors', errors.toArray());
|
console.error('parse errors', errors.toArray());
|
||||||
|
|||||||
@@ -5,15 +5,10 @@ import type {
|
|||||||
AnalyticsEventData,
|
AnalyticsEventData,
|
||||||
} from '@/constants/analytics';
|
} from '@/constants/analytics';
|
||||||
|
|
||||||
const DEBUG_ANALYTICS = false;
|
|
||||||
|
|
||||||
export const identify = <T extends AnalyticsUserProperty>(
|
export const identify = <T extends AnalyticsUserProperty>(
|
||||||
property: T,
|
property: T,
|
||||||
propertyValue: AnalyticsUserPropertyValue<T>
|
propertyValue: AnalyticsUserPropertyValue<T>
|
||||||
) => {
|
) => {
|
||||||
if (DEBUG_ANALYTICS) {
|
|
||||||
console.log(`[Analytics:Identify] ${property}`, propertyValue);
|
|
||||||
}
|
|
||||||
const customEvent = new CustomEvent('dydx:identify', {
|
const customEvent = new CustomEvent('dydx:identify', {
|
||||||
detail: { property, propertyValue },
|
detail: { property, propertyValue },
|
||||||
});
|
});
|
||||||
@@ -25,9 +20,6 @@ export const track = <T extends AnalyticsEvent>(
|
|||||||
eventType: T,
|
eventType: T,
|
||||||
eventData?: AnalyticsEventData<T>
|
eventData?: AnalyticsEventData<T>
|
||||||
) => {
|
) => {
|
||||||
if (DEBUG_ANALYTICS) {
|
|
||||||
console.log(`[Analytics] ${eventType}`, eventData);
|
|
||||||
}
|
|
||||||
const customEvent = new CustomEvent('dydx:track', {
|
const customEvent = new CustomEvent('dydx:track', {
|
||||||
detail: { eventType, eventData },
|
detail: { eventType, eventData },
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -66,17 +66,3 @@ export const getSeparator = ({
|
|||||||
Intl.NumberFormat(browserLanguage)
|
Intl.NumberFormat(browserLanguage)
|
||||||
.formatToParts(1000.1)
|
.formatToParts(1000.1)
|
||||||
.find?.((part) => part.type === separatorType)?.value;
|
.find?.((part) => part.type === separatorType)?.value;
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a byte array (representing an arbitrary-size signed integer) into a bigint.
|
|
||||||
* @param u Array of bytes represented as a Uint8Array.
|
|
||||||
*/
|
|
||||||
export function bytesToBigInt(u: Uint8Array): bigint {
|
|
||||||
if (u.length <= 1) {
|
|
||||||
return BigInt(0);
|
|
||||||
}
|
|
||||||
const negated: boolean = (u[0] & 1) === 1;
|
|
||||||
const hex: string = Buffer.from(u.slice(1)).toString('hex');
|
|
||||||
const abs: bigint = BigInt(`0x${hex}`);
|
|
||||||
return negated ? -abs : abs;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -58,12 +58,6 @@ export const getStatusIconInfo = ({
|
|||||||
statusIconColor: `var(--color-negative)`,
|
statusIconColor: `var(--color-negative)`,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case AbacusOrderStatus.untriggered: {
|
|
||||||
return {
|
|
||||||
statusIcon: IconName.OrderUntriggered,
|
|
||||||
statusIconColor: `var(--color-text-2)`,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
case AbacusOrderStatus.pending:
|
case AbacusOrderStatus.pending:
|
||||||
default: {
|
default: {
|
||||||
return {
|
return {
|
||||||
|
|||||||
+2
-34
@@ -10,23 +10,7 @@ import {
|
|||||||
bscTestnet,
|
bscTestnet,
|
||||||
optimism,
|
optimism,
|
||||||
optimismGoerli,
|
optimismGoerli,
|
||||||
base,
|
} from 'wagmi/chains';
|
||||||
baseGoerli,
|
|
||||||
polygon,
|
|
||||||
polygonMumbai,
|
|
||||||
linea,
|
|
||||||
lineaTestnet,
|
|
||||||
mantle,
|
|
||||||
mantleTestnet,
|
|
||||||
moonbeam,
|
|
||||||
moonbaseAlpha,
|
|
||||||
filecoin,
|
|
||||||
filecoinHyperspace,
|
|
||||||
fantom,
|
|
||||||
fantomTestnet,
|
|
||||||
celo,
|
|
||||||
celoAlfajores,
|
|
||||||
} from 'viem/chains';
|
|
||||||
|
|
||||||
import { alchemyProvider } from 'wagmi/providers/alchemy';
|
import { alchemyProvider } from 'wagmi/providers/alchemy';
|
||||||
import { jsonRpcProvider } from 'wagmi/providers/jsonRpc';
|
import { jsonRpcProvider } from 'wagmi/providers/jsonRpc';
|
||||||
@@ -52,26 +36,10 @@ export const WAGMI_SUPPORTED_CHAINS: Chain[] = [
|
|||||||
bscTestnet,
|
bscTestnet,
|
||||||
optimism,
|
optimism,
|
||||||
optimismGoerli,
|
optimismGoerli,
|
||||||
base,
|
|
||||||
baseGoerli,
|
|
||||||
polygon,
|
|
||||||
polygonMumbai,
|
|
||||||
linea,
|
|
||||||
lineaTestnet,
|
|
||||||
mantle,
|
|
||||||
mantleTestnet,
|
|
||||||
moonbeam,
|
|
||||||
moonbaseAlpha,
|
|
||||||
filecoin,
|
|
||||||
filecoinHyperspace,
|
|
||||||
fantom,
|
|
||||||
fantomTestnet,
|
|
||||||
celo,
|
|
||||||
celoAlfajores,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const { chains, publicClient, webSocketPublicClient } = configureChains(WAGMI_SUPPORTED_CHAINS, [
|
const { chains, publicClient, webSocketPublicClient } = configureChains(WAGMI_SUPPORTED_CHAINS, [
|
||||||
// alchemyProvider({ apiKey: import.meta.env.VITE_ALCHEMY_API_KEY }),
|
alchemyProvider({ apiKey: import.meta.env.VITE_ALCHEMY_API_KEY }),
|
||||||
jsonRpcProvider({
|
jsonRpcProvider({
|
||||||
rpc: (chain) => ({ http: chain.rpcUrls.default.http[0] }),
|
rpc: (chain) => ({ http: chain.rpcUrls.default.http[0] }),
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ export const DYDXBalancePanel = () => {
|
|||||||
|
|
||||||
const { walletType } = useAccounts();
|
const { walletType } = useAccounts();
|
||||||
const canAccountTrade = useSelector(calculateCanAccountTrade, shallowEqual);
|
const canAccountTrade = useSelector(calculateCanAccountTrade, shallowEqual);
|
||||||
const { nativeTokenBalance, nativeStakingBalance } = useAccountBalance();
|
const { nativeTokenBalance } = useAccountBalance();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Panel
|
<Styled.TransfersCard
|
||||||
slotHeader={
|
slotHeader={
|
||||||
<Styled.Header>
|
<Styled.Header>
|
||||||
<Styled.Title>
|
<Styled.Title>
|
||||||
@@ -97,7 +97,7 @@ export const DYDXBalancePanel = () => {
|
|||||||
</Styled.Label>
|
</Styled.Label>
|
||||||
),
|
),
|
||||||
|
|
||||||
value: <Output type={OutputType.Asset} value={nativeStakingBalance} />,
|
value: <Output type={OutputType.Asset} value={undefined} />,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
@@ -106,17 +106,21 @@ export const DYDXBalancePanel = () => {
|
|||||||
{
|
{
|
||||||
key: 'totalBalance',
|
key: 'totalBalance',
|
||||||
label: 'Total balance',
|
label: 'Total balance',
|
||||||
value: <Output type={OutputType.Asset} value={nativeTokenBalance + nativeStakingBalance} tag="Dv4TNT" />,
|
value: <Output type={OutputType.Asset} value={nativeTokenBalance} tag="Dv4TNT" />,
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Styled.Content>
|
</Styled.Content>
|
||||||
</Panel>
|
</Styled.TransfersCard>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Styled: Record<string, AnyStyledComponent> = {};
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
|
Styled.TransfersCard = styled(Panel)`
|
||||||
|
width: 21.25rem;
|
||||||
|
`;
|
||||||
|
|
||||||
Styled.Header = styled.div`
|
Styled.Header = styled.div`
|
||||||
${layoutMixins.spacedRow}
|
${layoutMixins.spacedRow}
|
||||||
padding: 1.25rem 1.5rem 0.5rem;
|
padding: 1.25rem 1.5rem 0.5rem;
|
||||||
@@ -170,15 +174,13 @@ Styled.IconContainer = styled.div`
|
|||||||
|
|
||||||
Styled.WalletAndStakedBalance = styled(Details)`
|
Styled.WalletAndStakedBalance = styled(Details)`
|
||||||
--details-item-backgroundColor: var(--color-layer-6);
|
--details-item-backgroundColor: var(--color-layer-6);
|
||||||
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
gap: 0.5rem;
|
gap: 0.5rem;
|
||||||
|
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
|
width: 8.625rem;
|
||||||
|
|
||||||
border-radius: 0.75em;
|
border-radius: 0.75em;
|
||||||
background-color: var(--color-layer-5);
|
background-color: var(--color-layer-5);
|
||||||
|
|||||||
@@ -1,333 +1,17 @@
|
|||||||
import styled, { AnyStyledComponent } from 'styled-components';
|
import styled, { AnyStyledComponent } from 'styled-components';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
|
||||||
|
|
||||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
|
||||||
import { ButtonAction, ButtonSize, ButtonState, ButtonType } from '@/constants/buttons';
|
|
||||||
import { DialogTypes } from '@/constants/dialogs';
|
|
||||||
|
|
||||||
import { useAccountBalance, useBreakpoints, useStringGetter } from '@/hooks';
|
|
||||||
|
|
||||||
import { breakpoints } from '@/styles';
|
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
import { Details } from '@/components/Details';
|
|
||||||
import { Panel } from '@/components/Panel';
|
|
||||||
import { IconName } from '@/components/Icon';
|
|
||||||
import { Button } from '@/components/Button';
|
|
||||||
import { IconButton } from '@/components/IconButton';
|
|
||||||
import { Link } from '@/components/Link';
|
|
||||||
import { Output, OutputType } from '@/components/Output';
|
|
||||||
import { VerticalSeparator } from '@/components/Separator';
|
|
||||||
import { WithReceipt } from '@/components/WithReceipt';
|
|
||||||
|
|
||||||
import { openDialog } from '@/state/dialogs';
|
|
||||||
import { getSelectedNetwork } from '@/state/appSelectors';
|
|
||||||
|
|
||||||
import { DYDXBalancePanel } from './DYDXBalancePanel';
|
import { DYDXBalancePanel } from './DYDXBalancePanel';
|
||||||
|
|
||||||
// TODO: replace placeholder URL with real URLs when avaialble
|
export const RewardsPage = () => (
|
||||||
const GOVERNANCE_HELP_URL = 'https://help.dydx.exchange/';
|
<Styled.Page>
|
||||||
const STAKING_HELP_URL = 'https://help.dydx.exchange/';
|
<DYDXBalancePanel />
|
||||||
|
</Styled.Page>
|
||||||
export const RewardsPage = () => {
|
);
|
||||||
const dispatch = useDispatch();
|
|
||||||
const stringGetter = useStringGetter();
|
|
||||||
const { isTablet, isNotTablet } = useBreakpoints();
|
|
||||||
|
|
||||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
|
||||||
|
|
||||||
// const chainId = Number(ENVIRONMENT_CONFIG_MAP[selectedNetwork].ethereumChainId);
|
|
||||||
|
|
||||||
// const { balance } = useAccountBalance({
|
|
||||||
// addressOrDenom: import.meta.env.VITE_V3_TOKEN_ADDRESS,
|
|
||||||
// assetSymbol: 'DYDX',
|
|
||||||
// chainId,
|
|
||||||
// isCosmosChain: false,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// const tokenBalance = import.meta.env.VITE_V3_TOKEN_ADDRESS ? balance : 0;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Styled.Page>
|
|
||||||
{/* {isNotTablet ? (
|
|
||||||
<Styled.Migrate>
|
|
||||||
<Styled.TwoItemRow>
|
|
||||||
<div>
|
|
||||||
<Styled.MigrateTitle>
|
|
||||||
{stringGetter({ key: STRING_KEYS.MIGRATE })}
|
|
||||||
</Styled.MigrateTitle>
|
|
||||||
<Styled.Description>
|
|
||||||
{stringGetter({ key: STRING_KEYS.MIGRATE_DESCRIPTION })}
|
|
||||||
<Link href={MIGRATE_HELP_URL}>
|
|
||||||
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} →
|
|
||||||
</Link>
|
|
||||||
</Styled.Description>
|
|
||||||
</div>
|
|
||||||
<Styled.MigrateAction>
|
|
||||||
<div>
|
|
||||||
<div>{stringGetter({ key: STRING_KEYS.AVAILABLE_TO_MIGRATE })}</div>
|
|
||||||
<div>
|
|
||||||
<Styled.Token type={OutputType.Asset} value={tokenBalance} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
action={tokenBalance ? ButtonAction.Primary : ButtonAction.Base}
|
|
||||||
// type={ButtonType.Link}
|
|
||||||
// href={BRIDGE_URL}
|
|
||||||
disabled
|
|
||||||
>
|
|
||||||
{tokenBalance
|
|
||||||
? `${stringGetter({ key: STRING_KEYS.MIGRATE_NOW })} →`
|
|
||||||
: stringGetter({ key: STRING_KEYS.NO_TOKENS_TO_MIGRATE })}
|
|
||||||
</Button>
|
|
||||||
</Styled.MigrateAction>
|
|
||||||
</Styled.TwoItemRow>
|
|
||||||
</Styled.Migrate>
|
|
||||||
) : (
|
|
||||||
<Styled.MobileMigrateCard
|
|
||||||
slotHeader={
|
|
||||||
<Styled.MobileMigrateHeader>
|
|
||||||
<h3>{stringGetter({ key: STRING_KEYS.MIGRATE })}</h3>
|
|
||||||
<VerticalSeparator />
|
|
||||||
<span>
|
|
||||||
{stringGetter({
|
|
||||||
key: STRING_KEYS.FROM_TO,
|
|
||||||
params: { FROM: <strong>Ethereum</strong>, TO: <strong>dYdX Chain</strong> },
|
|
||||||
})}
|
|
||||||
</span>
|
|
||||||
</Styled.MobileMigrateHeader>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Styled.WithReceipt
|
|
||||||
slotReceipt={
|
|
||||||
<Styled.Details
|
|
||||||
items={[
|
|
||||||
{
|
|
||||||
key: 'available-to-migrate',
|
|
||||||
label: stringGetter({ key: STRING_KEYS.AVAILABLE_TO_MIGRATE }),
|
|
||||||
value: <Output type={OutputType.Asset} value={tokenBalance} />,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
action={tokenBalance ? ButtonAction.Primary : ButtonAction.Base}
|
|
||||||
size={ButtonSize.Medium}
|
|
||||||
disabled
|
|
||||||
>
|
|
||||||
{tokenBalance
|
|
||||||
? `${stringGetter({ key: STRING_KEYS.MIGRATE_NOW })} →`
|
|
||||||
: stringGetter({ key: STRING_KEYS.NO_TOKENS_TO_MIGRATE })}
|
|
||||||
</Button>
|
|
||||||
</Styled.WithReceipt>
|
|
||||||
<Styled.LearnMore>
|
|
||||||
{stringGetter({ key: STRING_KEYS.WANT_TO_LEARN })}
|
|
||||||
<Link href={MIGRATE_HELP_URL}>{stringGetter({ key: STRING_KEYS.CLICK_HERE })}</Link>
|
|
||||||
</Styled.LearnMore>
|
|
||||||
</Styled.MobileMigrateCard>
|
|
||||||
)} */}
|
|
||||||
|
|
||||||
<Styled.PanelRow>
|
|
||||||
{isTablet && (
|
|
||||||
<Styled.BalancePanelContainer>
|
|
||||||
<DYDXBalancePanel />
|
|
||||||
</Styled.BalancePanelContainer>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Styled.Panel
|
|
||||||
slotHeader={<Styled.Title>{stringGetter({ key: STRING_KEYS.GOVERNANCE })}</Styled.Title>}
|
|
||||||
onClick={() => dispatch(openDialog({ type: DialogTypes.ExternalNavKeplr }))}
|
|
||||||
>
|
|
||||||
<Styled.Row>
|
|
||||||
<Styled.Description>
|
|
||||||
{stringGetter({ key: STRING_KEYS.GOVERNANCE_DESCRIPTION })}
|
|
||||||
<Link href={GOVERNANCE_HELP_URL} onClick={(e) => e.stopPropagation()}>
|
|
||||||
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} →
|
|
||||||
</Link>
|
|
||||||
</Styled.Description>
|
|
||||||
{/* TODO: vertically center based on Panel height */}
|
|
||||||
<Styled.IconButton
|
|
||||||
action={ButtonAction.Base}
|
|
||||||
iconName={IconName.Arrow}
|
|
||||||
size={ButtonSize.Small}
|
|
||||||
/>
|
|
||||||
</Styled.Row>
|
|
||||||
</Styled.Panel>
|
|
||||||
|
|
||||||
<Styled.Panel
|
|
||||||
slotHeader={<Styled.Title>{stringGetter({ key: STRING_KEYS.STAKING })}</Styled.Title>}
|
|
||||||
onClick={() => dispatch(openDialog({ type: DialogTypes.ExternalNavKeplr }))}
|
|
||||||
>
|
|
||||||
<Styled.Row>
|
|
||||||
<Styled.Description>
|
|
||||||
{stringGetter({ key: STRING_KEYS.STAKING_DESCRIPTION })}
|
|
||||||
<Link href={STAKING_HELP_URL} onClick={(e) => e.stopPropagation()}>
|
|
||||||
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} →
|
|
||||||
</Link>
|
|
||||||
</Styled.Description>
|
|
||||||
{/* TODO: vertically center based on Panel height */}
|
|
||||||
<Styled.IconButton
|
|
||||||
action={ButtonAction.Base}
|
|
||||||
iconName={IconName.Arrow}
|
|
||||||
size={ButtonSize.Small}
|
|
||||||
/>
|
|
||||||
</Styled.Row>
|
|
||||||
</Styled.Panel>
|
|
||||||
|
|
||||||
{isNotTablet && (
|
|
||||||
<Styled.BalancePanelContainer>
|
|
||||||
<DYDXBalancePanel />
|
|
||||||
</Styled.BalancePanelContainer>
|
|
||||||
)}
|
|
||||||
</Styled.PanelRow>
|
|
||||||
</Styled.Page>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const Styled: Record<string, AnyStyledComponent> = {};
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
Styled.Page = styled.div`
|
Styled.Page = styled.div`
|
||||||
${layoutMixins.contentContainerPage}
|
${layoutMixins.centered}
|
||||||
gap: 1.5rem;
|
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
|
||||||
padding: 1rem;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Panel = styled(Panel)`
|
|
||||||
padding: 0 1.5rem 1rem;
|
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
|
||||||
max-width: calc(100vw - 2rem);
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Row = styled.div`
|
|
||||||
${layoutMixins.spacedRow}
|
|
||||||
gap: 1rem;
|
|
||||||
|
|
||||||
align-items: center;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Description = styled.div`
|
|
||||||
color: var(--color-text-0);
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: var(--color-text-1);
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Migrate = styled.section`
|
|
||||||
max-width: min(100vw, var(--content-max-width));
|
|
||||||
|
|
||||||
padding: 1.5rem;
|
|
||||||
|
|
||||||
background-color: var(--color-layer-3);
|
|
||||||
border-radius: 0.875rem;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.TwoItemRow = styled(Styled.Row)`
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.MigrateAction = styled(Styled.TwoItemRow)`
|
|
||||||
padding: 1rem;
|
|
||||||
|
|
||||||
background-color: var(--color-layer-2);
|
|
||||||
border: solid var(--border-width) var(--color-border);
|
|
||||||
border-radius: 0.75rem;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Token = styled(Output)`
|
|
||||||
font: var(--font-large-book);
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.PanelRow = styled(Styled.Row)`
|
|
||||||
gap: 1.5rem;
|
|
||||||
max-width: min(100vw, var(--content-max-width));
|
|
||||||
align-items: flex-start;
|
|
||||||
|
|
||||||
> section {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
|
||||||
grid-auto-flow: row;
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
max-width: auto;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.BalancePanelContainer = styled.div`
|
|
||||||
width: 21.25rem;
|
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Title = styled.h3`
|
|
||||||
${layoutMixins.inlineRow}
|
|
||||||
padding: 1.25rem 1.5rem 0.5rem;
|
|
||||||
|
|
||||||
font: var(--font-medium-book);
|
|
||||||
color: var(--color-text-2);
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.MigrateTitle = styled(Styled.Title)`
|
|
||||||
padding: 0 0 0.5rem;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.MobileMigrateCard = styled(Styled.Panel)`
|
|
||||||
${layoutMixins.flexColumn}
|
|
||||||
gap: 1rem;
|
|
||||||
|
|
||||||
align-items: center;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.MobileMigrateHeader = styled(Styled.Title)`
|
|
||||||
${layoutMixins.inlineRow}
|
|
||||||
gap: 1ch;
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
|
|
||||||
font: var(--font-small-book);
|
|
||||||
color: var(--color-text-0);
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
${layoutMixins.inlineRow}
|
|
||||||
font: var(--font-large-book);
|
|
||||||
color: var(--color-text-2);
|
|
||||||
|
|
||||||
svg {
|
|
||||||
font-size: 1.75rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
margin-top: 0.2rem;
|
|
||||||
b {
|
|
||||||
font-weight: var(--fontWeight-book);
|
|
||||||
color: var(--color-text-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Details = styled(Details)`
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.WithReceipt = styled(WithReceipt)`
|
|
||||||
width: 100%;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.LearnMore = styled(Styled.Description)`
|
|
||||||
${layoutMixins.row}
|
|
||||||
gap: 1ch;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.IconButton = styled(IconButton)`
|
|
||||||
color: var(--color-text-0);
|
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import { useState } from 'react';
|
|||||||
import { shallowEqual, useSelector } from 'react-redux';
|
import { shallowEqual, useSelector } from 'react-redux';
|
||||||
import styled, { type AnyStyledComponent } from 'styled-components';
|
import styled, { type AnyStyledComponent } from 'styled-components';
|
||||||
|
|
||||||
import { AbacusOrderStatus } from '@/constants/abacus';
|
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
|
|
||||||
import { useBreakpoints, useStringGetter } from '@/hooks';
|
import { useBreakpoints, useStringGetter } from '@/hooks';
|
||||||
@@ -19,16 +18,13 @@ import { FillsTable, FillsTableColumnKey } from '@/views/tables/FillsTable';
|
|||||||
import { OrdersTable, OrdersTableColumnKey } from '@/views/tables/OrdersTable';
|
import { OrdersTable, OrdersTableColumnKey } from '@/views/tables/OrdersTable';
|
||||||
import { PositionsTable, PositionsTableColumnKey } from '@/views/tables/PositionsTable';
|
import { PositionsTable, PositionsTableColumnKey } from '@/views/tables/PositionsTable';
|
||||||
|
|
||||||
import {
|
import { calculateIsAccountViewOnly } from '@/state/accountCalculators';
|
||||||
calculateHasUncommittedOrders,
|
|
||||||
calculateIsAccountViewOnly,
|
|
||||||
} from '@/state/accountCalculators';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
calculateHasUncommittedOrders,
|
||||||
getCurrentMarketTradeInfoNumbers,
|
getCurrentMarketTradeInfoNumbers,
|
||||||
getHasUnseenFillUpdates,
|
getHasUnseenFillUpdates,
|
||||||
getHasUnseenOrderUpdates,
|
getHasUnseenOrderUpdates,
|
||||||
getLatestOrderStatus,
|
|
||||||
getTradeInfoNumbers,
|
getTradeInfoNumbers,
|
||||||
} from '@/state/accountSelectors';
|
} from '@/state/accountSelectors';
|
||||||
|
|
||||||
@@ -73,7 +69,8 @@ export const HorizontalPanel = ({ isOpen = true, setIsOpen }: ElementProps) => {
|
|||||||
const hasUnseenOrderUpdates = useSelector(getHasUnseenOrderUpdates);
|
const hasUnseenOrderUpdates = useSelector(getHasUnseenOrderUpdates);
|
||||||
const hasUnseenFillUpdates = useSelector(getHasUnseenFillUpdates);
|
const hasUnseenFillUpdates = useSelector(getHasUnseenFillUpdates);
|
||||||
const isAccountViewOnly = useSelector(calculateIsAccountViewOnly);
|
const isAccountViewOnly = useSelector(calculateIsAccountViewOnly);
|
||||||
const isWaitingForOrderToIndex = useSelector(calculateHasUncommittedOrders);
|
const hasUncommittedOrders = useSelector(calculateHasUncommittedOrders);
|
||||||
|
|
||||||
const showCurrentMarket = isTablet || view === PanelView.CurrentMarket;
|
const showCurrentMarket = isTablet || view === PanelView.CurrentMarket;
|
||||||
|
|
||||||
const fillsTagNumber = shortenNumberForDisplay(showCurrentMarket ? numFills : numTotalFills);
|
const fillsTagNumber = shortenNumberForDisplay(showCurrentMarket ? numFills : numTotalFills);
|
||||||
@@ -121,7 +118,7 @@ export const HorizontalPanel = ({ isOpen = true, setIsOpen }: ElementProps) => {
|
|||||||
value: InfoSection.Orders,
|
value: InfoSection.Orders,
|
||||||
label: stringGetter({ key: STRING_KEYS.ORDERS }),
|
label: stringGetter({ key: STRING_KEYS.ORDERS }),
|
||||||
|
|
||||||
slotRight: isWaitingForOrderToIndex ? (
|
slotRight: hasUncommittedOrders ? (
|
||||||
<Styled.LoadingSpinner />
|
<Styled.LoadingSpinner />
|
||||||
) : (
|
) : (
|
||||||
ordersTagNumber && (
|
ordersTagNumber && (
|
||||||
|
|||||||
@@ -12,12 +12,12 @@ import { getCurrentMarketAssetData } from '@/state/assetsSelectors';
|
|||||||
import { getCurrentMarketId } from '@/state/perpetualsSelectors';
|
import { getCurrentMarketId } from '@/state/perpetualsSelectors';
|
||||||
|
|
||||||
export const MarketSelectorAndStats = ({ className }: { className?: string }) => {
|
export const MarketSelectorAndStats = ({ className }: { className?: string }) => {
|
||||||
const { id = '' } = useSelector(getCurrentMarketAssetData, shallowEqual) ?? {};
|
const { symbol = '' } = useSelector(getCurrentMarketAssetData, shallowEqual) ?? {};
|
||||||
const currentMarketId = useSelector(getCurrentMarketId);
|
const currentMarketId = useSelector(getCurrentMarketId);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Styled.Container className={className}>
|
<Styled.Container className={className}>
|
||||||
<MarketsDropdown currentMarketId={currentMarketId} symbol={id} />
|
<MarketsDropdown currentMarketId={currentMarketId} symbol={symbol} />
|
||||||
|
|
||||||
<VerticalSeparator />
|
<VerticalSeparator />
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import abacusStateManager from '@/lib/abacus';
|
|||||||
import appMiddleware from './appMiddleware';
|
import appMiddleware from './appMiddleware';
|
||||||
import localizationMiddleware from './localizationMiddleware';
|
import localizationMiddleware from './localizationMiddleware';
|
||||||
import routerMiddleware from './routerMiddleware';
|
import routerMiddleware from './routerMiddleware';
|
||||||
|
import tradeMiddleware from './tradeMiddleware';
|
||||||
|
|
||||||
import { accountSlice } from './account';
|
import { accountSlice } from './account';
|
||||||
import { appSlice } from './app';
|
import { appSlice } from './app';
|
||||||
@@ -39,6 +40,7 @@ export const store = configureStore({
|
|||||||
appMiddleware,
|
appMiddleware,
|
||||||
localizationMiddleware,
|
localizationMiddleware,
|
||||||
routerMiddleware,
|
routerMiddleware,
|
||||||
|
tradeMiddleware,
|
||||||
],
|
],
|
||||||
|
|
||||||
devTools: process.env.NODE_ENV !== 'production',
|
devTools: process.env.NODE_ENV !== 'production',
|
||||||
|
|||||||
+14
-36
@@ -1,7 +1,6 @@
|
|||||||
import { createSlice, type PayloadAction } from '@reduxjs/toolkit';
|
import { createSlice, type PayloadAction } from '@reduxjs/toolkit';
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
AccountBalance,
|
|
||||||
SubaccountFill,
|
SubaccountFill,
|
||||||
Nullable,
|
Nullable,
|
||||||
Subaccount,
|
Subaccount,
|
||||||
@@ -25,19 +24,16 @@ export type AccountState = {
|
|||||||
fundingPayments?: SubaccountFundingPayments;
|
fundingPayments?: SubaccountFundingPayments;
|
||||||
transfers?: SubaccountTransfers;
|
transfers?: SubaccountTransfers;
|
||||||
clearedOrderIds?: string[];
|
clearedOrderIds?: string[];
|
||||||
|
uncommittedOrderClientIds?: number[];
|
||||||
hasUnseenFillUpdates: boolean;
|
hasUnseenFillUpdates: boolean;
|
||||||
hasUnseenOrderUpdates: boolean;
|
hasUnseenOrderUpdates: boolean;
|
||||||
historicalPnl?: SubAccountHistoricalPNLs;
|
historicalPnl?: SubAccountHistoricalPNLs;
|
||||||
latestOrder?: Nullable<SubaccountOrder>;
|
|
||||||
onboardingGuards: Record<OnboardingGuard, boolean | undefined>;
|
onboardingGuards: Record<OnboardingGuard, boolean | undefined>;
|
||||||
onboardingState: OnboardingState;
|
onboardingState: OnboardingState;
|
||||||
subaccount?: Nullable<Subaccount>;
|
subaccount?: Nullable<Subaccount>;
|
||||||
uncommittedOrderClientIds: number[];
|
|
||||||
wallet?: Nullable<Wallet>;
|
wallet?: Nullable<Wallet>;
|
||||||
walletType?: WalletType;
|
walletType?: WalletType;
|
||||||
historicalPnlPeriod?: HistoricalPnlPeriods;
|
historicalPnlPeriod?: HistoricalPnlPeriods;
|
||||||
balances?: Record<string, AccountBalance>;
|
|
||||||
stakingBalances?: Record<string, AccountBalance>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const initialState: AccountState = {
|
const initialState: AccountState = {
|
||||||
@@ -45,10 +41,10 @@ const initialState: AccountState = {
|
|||||||
fundingPayments: undefined,
|
fundingPayments: undefined,
|
||||||
transfers: undefined,
|
transfers: undefined,
|
||||||
clearedOrderIds: undefined,
|
clearedOrderIds: undefined,
|
||||||
|
uncommittedOrderClientIds: undefined,
|
||||||
hasUnseenFillUpdates: false,
|
hasUnseenFillUpdates: false,
|
||||||
hasUnseenOrderUpdates: false,
|
hasUnseenOrderUpdates: false,
|
||||||
historicalPnl: undefined,
|
historicalPnl: undefined,
|
||||||
latestOrder: undefined,
|
|
||||||
onboardingGuards: {
|
onboardingGuards: {
|
||||||
[OnboardingGuard.hasAcknowledgedTerms]: Boolean(
|
[OnboardingGuard.hasAcknowledgedTerms]: Boolean(
|
||||||
getLocalStorage<boolean>({
|
getLocalStorage<boolean>({
|
||||||
@@ -60,7 +56,6 @@ const initialState: AccountState = {
|
|||||||
},
|
},
|
||||||
onboardingState: OnboardingState.Disconnected,
|
onboardingState: OnboardingState.Disconnected,
|
||||||
subaccount: undefined,
|
subaccount: undefined,
|
||||||
uncommittedOrderClientIds: [],
|
|
||||||
wallet: undefined,
|
wallet: undefined,
|
||||||
walletType: getLocalStorage<WalletType>({
|
walletType: getLocalStorage<WalletType>({
|
||||||
key: LocalStorageKey.OnboardingSelectedWalletType,
|
key: LocalStorageKey.OnboardingSelectedWalletType,
|
||||||
@@ -91,16 +86,6 @@ export const accountSlice = createSlice({
|
|||||||
setTransfers: (state, action: PayloadAction<any>) => {
|
setTransfers: (state, action: PayloadAction<any>) => {
|
||||||
state.transfers = action.payload;
|
state.transfers = action.payload;
|
||||||
},
|
},
|
||||||
setLatestOrder: (state, action: PayloadAction<Nullable<SubaccountOrder>>) => {
|
|
||||||
const { clientId } = action.payload ?? {};
|
|
||||||
state.latestOrder = action.payload;
|
|
||||||
|
|
||||||
if (clientId) {
|
|
||||||
state.uncommittedOrderClientIds = state.uncommittedOrderClientIds.filter(
|
|
||||||
(id) => id !== clientId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
clearOrder: (state, action: PayloadAction<string>) => ({
|
clearOrder: (state, action: PayloadAction<string>) => ({
|
||||||
...state,
|
...state,
|
||||||
clearedOrderIds: [...(state.clearedOrderIds || []), action.payload],
|
clearedOrderIds: [...(state.clearedOrderIds || []), action.payload],
|
||||||
@@ -146,26 +131,22 @@ export const accountSlice = createSlice({
|
|||||||
...state,
|
...state,
|
||||||
wallet: action.payload,
|
wallet: action.payload,
|
||||||
}),
|
}),
|
||||||
|
addUncommittedOrderClientId: (state, action: PayloadAction<number>) => {
|
||||||
|
state.uncommittedOrderClientIds = state.uncommittedOrderClientIds
|
||||||
|
? [...state.uncommittedOrderClientIds, action.payload]
|
||||||
|
: [action.payload];
|
||||||
|
},
|
||||||
|
removeUncommittedOrderClientId: (state, action: PayloadAction<number>) => {
|
||||||
|
state.uncommittedOrderClientIds = state.uncommittedOrderClientIds?.filter(
|
||||||
|
(clientId) => clientId !== action.payload
|
||||||
|
);
|
||||||
|
},
|
||||||
viewedFills: (state) => {
|
viewedFills: (state) => {
|
||||||
state.hasUnseenFillUpdates = false;
|
state.hasUnseenFillUpdates = false;
|
||||||
},
|
},
|
||||||
viewedOrders: (state) => {
|
viewedOrders: (state) => {
|
||||||
state.hasUnseenOrderUpdates = false;
|
state.hasUnseenOrderUpdates = false;
|
||||||
},
|
},
|
||||||
setBalances: (state, action: PayloadAction<Record<string, AccountBalance>>) => {
|
|
||||||
state.balances = action.payload;
|
|
||||||
},
|
|
||||||
setStakingBalances: (state, action: PayloadAction<Record<string, AccountBalance>>) => {
|
|
||||||
state.stakingBalances = action.payload;
|
|
||||||
},
|
|
||||||
addUncommittedOrderClientId: (state, action: PayloadAction<number>) => {
|
|
||||||
state.uncommittedOrderClientIds.push(action.payload);
|
|
||||||
},
|
|
||||||
removeUncommittedOrderClientId: (state, action: PayloadAction<number>) => {
|
|
||||||
state.uncommittedOrderClientIds = state.uncommittedOrderClientIds.filter(
|
|
||||||
(id) => id !== action.payload
|
|
||||||
);
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -173,17 +154,14 @@ export const {
|
|||||||
setFills,
|
setFills,
|
||||||
setFundingPayments,
|
setFundingPayments,
|
||||||
setTransfers,
|
setTransfers,
|
||||||
setLatestOrder,
|
|
||||||
clearOrder,
|
clearOrder,
|
||||||
setOnboardingGuard,
|
setOnboardingGuard,
|
||||||
setOnboardingState,
|
setOnboardingState,
|
||||||
setHistoricalPnl,
|
setHistoricalPnl,
|
||||||
setSubaccount,
|
setSubaccount,
|
||||||
setWallet,
|
setWallet,
|
||||||
viewedFills,
|
|
||||||
viewedOrders,
|
|
||||||
setBalances,
|
|
||||||
setStakingBalances,
|
|
||||||
addUncommittedOrderClientId,
|
addUncommittedOrderClientId,
|
||||||
removeUncommittedOrderClientId,
|
removeUncommittedOrderClientId,
|
||||||
|
viewedFills,
|
||||||
|
viewedOrders,
|
||||||
} = accountSlice.actions;
|
} = accountSlice.actions;
|
||||||
|
|||||||
@@ -2,15 +2,17 @@ import { createSelector } from 'reselect';
|
|||||||
|
|
||||||
import { SubaccountPosition } from '@/constants/abacus';
|
import { SubaccountPosition } from '@/constants/abacus';
|
||||||
import { OnboardingState, OnboardingSteps } from '@/constants/account';
|
import { OnboardingState, OnboardingSteps } from '@/constants/account';
|
||||||
|
import { isDydxV4Network } from '@/constants/networks';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getExistingOpenPositions,
|
getExistingOpenPositions,
|
||||||
getOnboardingGuards,
|
getOnboardingGuards,
|
||||||
getOnboardingState,
|
getOnboardingState,
|
||||||
getSubaccountId,
|
getSubaccountId,
|
||||||
getUncommittedOrderClientIds,
|
|
||||||
} from '@/state/accountSelectors';
|
} from '@/state/accountSelectors';
|
||||||
|
|
||||||
|
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||||
|
|
||||||
export const calculateOnboardingStep = createSelector(
|
export const calculateOnboardingStep = createSelector(
|
||||||
[getOnboardingState, getOnboardingGuards],
|
[getOnboardingState, getOnboardingGuards],
|
||||||
(onboardingState: OnboardingState, onboardingGuards: ReturnType<typeof getOnboardingGuards>) => {
|
(onboardingState: OnboardingState, onboardingGuards: ReturnType<typeof getOnboardingGuards>) => {
|
||||||
@@ -32,9 +34,9 @@ export const calculateOnboardingStep = createSelector(
|
|||||||
* @description calculate whether an account is in a state where they can trade
|
* @description calculate whether an account is in a state where they can trade
|
||||||
*/
|
*/
|
||||||
export const calculateCanAccountTrade = createSelector(
|
export const calculateCanAccountTrade = createSelector(
|
||||||
[getOnboardingState],
|
[getOnboardingState, getSelectedNetwork],
|
||||||
(onboardingState: OnboardingState) => {
|
(onboardingState: OnboardingState, selectedNetwork: string) => {
|
||||||
return onboardingState === OnboardingState.AccountConnected;
|
return onboardingState === OnboardingState.AccountConnected && isDydxV4Network(selectedNetwork);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -67,11 +69,6 @@ export const calculateHasOpenPositions = createSelector(
|
|||||||
(openPositions?: SubaccountPosition[]) => (openPositions?.length || 0) > 0
|
(openPositions?: SubaccountPosition[]) => (openPositions?.length || 0) > 0
|
||||||
);
|
);
|
||||||
|
|
||||||
export const calculateHasUncommittedOrders = createSelector(
|
|
||||||
[getUncommittedOrderClientIds],
|
|
||||||
(uncommittedOrderClientIds: number[]) => uncommittedOrderClientIds.length > 0
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description calculate whether the client is loading info.
|
* @description calculate whether the client is loading info.
|
||||||
* (account is connected but subaccountId is till missing)
|
* (account is connected but subaccountId is till missing)
|
||||||
|
|||||||
@@ -78,12 +78,6 @@ export const getCurrentMarketPositionData = (state: RootState) => {
|
|||||||
export const getSubaccountOrders = (state: RootState) =>
|
export const getSubaccountOrders = (state: RootState) =>
|
||||||
state.account.subaccount?.orders?.toArray();
|
state.account.subaccount?.orders?.toArray();
|
||||||
|
|
||||||
/**
|
|
||||||
* @param state
|
|
||||||
* @returns latestOrder of the currently connected subaccount throughout this session
|
|
||||||
*/
|
|
||||||
export const getLatestOrder = (state: RootState) => state.account?.latestOrder;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state
|
* @param state
|
||||||
* @returns list of order ids that user has cleared and should be hidden
|
* @returns list of order ids that user has cleared and should be hidden
|
||||||
@@ -121,26 +115,7 @@ export const getSubaccountOpenOrdersBySideAndPrice = createSelector(
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns the clientId of the latest order
|
* @param state
|
||||||
*/
|
|
||||||
export const getLatestOrderClientId = createSelector([getLatestOrder], (order) => order?.clientId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns the rawValue status of the latest order
|
|
||||||
*/
|
|
||||||
export const getLatestOrderStatus = createSelector(
|
|
||||||
[getLatestOrder],
|
|
||||||
(order) => order?.status.rawValue
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns a list of clientIds belonging to uncommmited orders
|
|
||||||
*/
|
|
||||||
export const getUncommittedOrderClientIds = (state: RootState) =>
|
|
||||||
state.account.uncommittedOrderClientIds;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param orderId
|
|
||||||
* @returns order details with the given orderId
|
* @returns order details with the given orderId
|
||||||
*/
|
*/
|
||||||
export const getOrderDetails = (orderId: string) =>
|
export const getOrderDetails = (orderId: string) =>
|
||||||
@@ -308,6 +283,21 @@ export const getIsAccountConnected = (state: RootState) =>
|
|||||||
*/
|
*/
|
||||||
export const getOnboardingGuards = (state: RootState) => state.account.onboardingGuards;
|
export const getOnboardingGuards = (state: RootState) => state.account.onboardingGuards;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param state
|
||||||
|
* @returns a boolean indicating whether the user has uncommitted orders
|
||||||
|
*/
|
||||||
|
export const calculateHasUncommittedOrders = (state: RootState) => {
|
||||||
|
return !!state.account.uncommittedOrderClientIds?.length;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param state
|
||||||
|
* @returns List of uncommitted order clientIds
|
||||||
|
*/
|
||||||
|
export const getUncommittedOrderClientIds = (state: RootState) =>
|
||||||
|
state.account.uncommittedOrderClientIds;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param state
|
* @param state
|
||||||
* @returns Whether there are unseen fill updates
|
* @returns Whether there are unseen fill updates
|
||||||
@@ -332,13 +322,3 @@ export const getUserStats = (state: RootState) => ({
|
|||||||
makerVolume30D: state.account?.wallet?.user?.makerVolume30D,
|
makerVolume30D: state.account?.wallet?.user?.makerVolume30D,
|
||||||
takerVolume30D: state.account?.wallet?.user?.takerVolume30D,
|
takerVolume30D: state.account?.wallet?.user?.takerVolume30D,
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns user wallet balances
|
|
||||||
*/
|
|
||||||
export const getBalances = (state: RootState) => state.account?.balances;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @returns user wallet staking balances
|
|
||||||
* */
|
|
||||||
export const getStakingBalances = (state: RootState) => state.account?.stakingBalances;
|
|
||||||
|
|||||||
+6
-1
@@ -3,7 +3,11 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|||||||
import { AbacusApiState } from '@/constants/abacus';
|
import { AbacusApiState } from '@/constants/abacus';
|
||||||
import { LocalStorageKey } from '@/constants/localStorage';
|
import { LocalStorageKey } from '@/constants/localStorage';
|
||||||
|
|
||||||
import { DEFAULT_APP_ENVIRONMENT, type DydxNetwork } from '@/constants/networks';
|
import {
|
||||||
|
DEFAULT_APP_ENVIRONMENT,
|
||||||
|
isValidDydxNetwork,
|
||||||
|
type DydxNetwork,
|
||||||
|
} from '@/constants/networks';
|
||||||
|
|
||||||
import { getLocalStorage } from '@/lib/localStorage';
|
import { getLocalStorage } from '@/lib/localStorage';
|
||||||
|
|
||||||
@@ -19,6 +23,7 @@ const initialState: AppState = {
|
|||||||
selectedNetwork: getLocalStorage({
|
selectedNetwork: getLocalStorage({
|
||||||
key: LocalStorageKey.SelectedNetwork,
|
key: LocalStorageKey.SelectedNetwork,
|
||||||
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
||||||
|
validateFn: isValidDydxNetwork,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
import type { PayloadAction } from '@reduxjs/toolkit';
|
||||||
|
|
||||||
|
import type { SubaccountOrder } from '@/constants/abacus';
|
||||||
|
|
||||||
|
import { removeUncommittedOrderClientId, setSubaccount } from '@/state/account';
|
||||||
|
|
||||||
|
import { getSubaccountOrders, getUncommittedOrderClientIds } from '@/state/accountSelectors';
|
||||||
|
|
||||||
|
export default (store: any) => (next: any) => async (action: PayloadAction<any>) => {
|
||||||
|
const { type, payload } = action;
|
||||||
|
const state = store.getState();
|
||||||
|
next(action);
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case setSubaccount.type: {
|
||||||
|
const updatedOrders = payload?.orders?.toArray() || [];
|
||||||
|
const orders = getSubaccountOrders(state);
|
||||||
|
const uncommittedOrderClientIds = getUncommittedOrderClientIds(state);
|
||||||
|
|
||||||
|
if (uncommittedOrderClientIds?.length && updatedOrders?.length !== orders?.length) {
|
||||||
|
const updatedOrdersClientIds = Object.fromEntries(
|
||||||
|
updatedOrders.map((order: SubaccountOrder) => [order.clientId, order])
|
||||||
|
);
|
||||||
|
|
||||||
|
const receivedClientId = uncommittedOrderClientIds.find(
|
||||||
|
(clientId) => updatedOrdersClientIds[clientId]
|
||||||
|
);
|
||||||
|
|
||||||
|
if (receivedClientId) {
|
||||||
|
store.dispatch(removeUncommittedOrderClientId(receivedClientId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -62,10 +62,8 @@ export const AccountInfoConnectedState = () => {
|
|||||||
const { buyingPower, equity, marginUsage, leverage } = subAccount || {};
|
const { buyingPower, equity, marginUsage, leverage } = subAccount || {};
|
||||||
|
|
||||||
const hasDiff =
|
const hasDiff =
|
||||||
(marginUsage?.postOrder !== null &&
|
marginUsage?.postOrder != null &&
|
||||||
!MustBigNumber(marginUsage?.postOrder).eq(MustBigNumber(marginUsage?.current))) ||
|
!MustBigNumber(marginUsage?.postOrder).eq(MustBigNumber(marginUsage?.current));
|
||||||
(buyingPower?.postOrder !== null &&
|
|
||||||
!MustBigNumber(buyingPower?.postOrder).eq(MustBigNumber(buyingPower?.current)));
|
|
||||||
|
|
||||||
const showHeader = !hasDiff && !isTablet;
|
const showHeader = !hasDiff && !isTablet;
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const MarketDetails: React.FC = () => {
|
|||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const { isTablet } = useBreakpoints();
|
const { isTablet } = useBreakpoints();
|
||||||
const { configs, market } = useSelector(getCurrentMarketData, shallowEqual) || {};
|
const { configs, market } = useSelector(getCurrentMarketData, shallowEqual) || {};
|
||||||
const { id, name, resources } = useSelector(getCurrentMarketAssetData, shallowEqual) || {};
|
const { symbol, name, resources } = useSelector(getCurrentMarketAssetData, shallowEqual) || {};
|
||||||
|
|
||||||
if (!configs) return null;
|
if (!configs) return null;
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ export const MarketDetails: React.FC = () => {
|
|||||||
useGrouping
|
useGrouping
|
||||||
value={stepSize}
|
value={stepSize}
|
||||||
type={OutputType.Asset}
|
type={OutputType.Asset}
|
||||||
tag={id}
|
tag={symbol}
|
||||||
fractionDigits={stepSizeDecimals}
|
fractionDigits={stepSizeDecimals}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
@@ -88,7 +88,7 @@ export const MarketDetails: React.FC = () => {
|
|||||||
useGrouping
|
useGrouping
|
||||||
value={minOrderSize}
|
value={minOrderSize}
|
||||||
type={OutputType.Asset}
|
type={OutputType.Asset}
|
||||||
tag={id}
|
tag={symbol}
|
||||||
fractionDigits={stepSizeDecimals}
|
fractionDigits={stepSizeDecimals}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
@@ -132,16 +132,18 @@ export const MarketDetails: React.FC = () => {
|
|||||||
<Styled.Header>
|
<Styled.Header>
|
||||||
<Styled.WrapRow>
|
<Styled.WrapRow>
|
||||||
<Styled.MarketTitle>
|
<Styled.MarketTitle>
|
||||||
<AssetIcon symbol={id} />
|
<AssetIcon symbol={symbol} />
|
||||||
{name}
|
{name}
|
||||||
</Styled.MarketTitle>
|
</Styled.MarketTitle>
|
||||||
{isTablet && <Styled.MarketLinks />}
|
{isTablet && <Styled.MarketLinks />}
|
||||||
</Styled.WrapRow>
|
</Styled.WrapRow>
|
||||||
|
|
||||||
<Styled.MarketDescription>
|
<Styled.MarketDescription>
|
||||||
{primaryDescriptionKey && <p>{stringGetter({ key: `APP.${primaryDescriptionKey}` })}</p>}
|
{primaryDescriptionKey && (
|
||||||
|
<p>{stringGetter({ key: STRING_KEYS[primaryDescriptionKey as StringKey] })}</p>
|
||||||
|
)}
|
||||||
{secondaryDescriptionKey && (
|
{secondaryDescriptionKey && (
|
||||||
<p>{stringGetter({ key: `APP.${secondaryDescriptionKey}` })}</p>
|
<p>{stringGetter({ key: STRING_KEYS[secondaryDescriptionKey as StringKey] })}</p>
|
||||||
)}
|
)}
|
||||||
</Styled.MarketDescription>
|
</Styled.MarketDescription>
|
||||||
|
|
||||||
|
|||||||
@@ -15,17 +15,14 @@ export const MarketLinks = () => {
|
|||||||
|
|
||||||
const linkItems = [
|
const linkItems = [
|
||||||
{
|
{
|
||||||
key: 'coinmarketcap',
|
|
||||||
href: coinMarketCapsLink,
|
href: coinMarketCapsLink,
|
||||||
icon: IconName.CoinMarketCap,
|
icon: IconName.CoinMarketCap,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'whitepaper',
|
|
||||||
href: whitepaperLink,
|
href: whitepaperLink,
|
||||||
icon: IconName.Whitepaper,
|
icon: IconName.Whitepaper,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'project-website',
|
|
||||||
href: websiteLink,
|
href: websiteLink,
|
||||||
icon: IconName.Website,
|
icon: IconName.Website,
|
||||||
},
|
},
|
||||||
@@ -34,8 +31,8 @@ export const MarketLinks = () => {
|
|||||||
return (
|
return (
|
||||||
<Styled.MarketLinks>
|
<Styled.MarketLinks>
|
||||||
{linkItems.map(
|
{linkItems.map(
|
||||||
({ key, href, icon }) =>
|
({ href, icon }) =>
|
||||||
href && <IconButton key={key} href={href} iconName={icon} type={ButtonType.Link} />
|
href && <IconButton key={href} href={href} iconName={icon} type={ButtonType.Link} />
|
||||||
)}
|
)}
|
||||||
</Styled.MarketLinks>
|
</Styled.MarketLinks>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ const defaultMarketStatistics = Object.values(MarketStats);
|
|||||||
export const MarketStatsDetails = ({ showMidMarketPrice = true }: ElementProps) => {
|
export const MarketStatsDetails = ({ showMidMarketPrice = true }: ElementProps) => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const { isTablet } = useBreakpoints();
|
const { isTablet } = useBreakpoints();
|
||||||
const { id = '' } = useSelector(getCurrentMarketAssetData, shallowEqual) ?? {};
|
const { symbol = '' } = useSelector(getCurrentMarketAssetData, shallowEqual) ?? {};
|
||||||
const { tickSizeDecimals } = useSelector(getCurrentMarketConfig, shallowEqual) ?? {};
|
const { tickSizeDecimals } = useSelector(getCurrentMarketConfig, shallowEqual) ?? {};
|
||||||
const midMarketPrice = useSelector(getCurrentMarketMidMarketPrice);
|
const midMarketPrice = useSelector(getCurrentMarketMidMarketPrice);
|
||||||
const lastMidMarketPrice = useRef(midMarketPrice);
|
const lastMidMarketPrice = useRef(midMarketPrice);
|
||||||
@@ -116,7 +116,7 @@ export const MarketStatsDetails = ({ showMidMarketPrice = true }: ElementProps)
|
|||||||
<Styled.Output
|
<Styled.Output
|
||||||
type={OutputType.Number}
|
type={OutputType.Number}
|
||||||
value={value}
|
value={value}
|
||||||
tag={id}
|
tag={symbol}
|
||||||
fractionDigits={LARGE_TOKEN_DECIMALS}
|
fractionDigits={LARGE_TOKEN_DECIMALS}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -60,12 +60,12 @@ const MarketsDropdownContent = ({ onRowAction }: { onRowAction?: (market: string
|
|||||||
columnKey: 'market',
|
columnKey: 'market',
|
||||||
getCellValue: (row) => row.market,
|
getCellValue: (row) => row.market,
|
||||||
label: stringGetter({ key: STRING_KEYS.MARKET }),
|
label: stringGetter({ key: STRING_KEYS.MARKET }),
|
||||||
renderCell: ({ assetId, id }) => (
|
renderCell: ({ asset }) => (
|
||||||
<Styled.MarketName isFavorited={false}>
|
<Styled.MarketName isFavorited={false}>
|
||||||
{/* TRCL-1693 <Icon iconName={IconName.Star} /> */}
|
{/* TRCL-1693 <Icon iconName={IconName.Star} /> */}
|
||||||
<AssetIcon symbol={assetId} />
|
<AssetIcon symbol={asset.symbol} />
|
||||||
<h2>{id}</h2>
|
<h2>{asset.name}</h2>
|
||||||
<Tag>{assetId}</Tag>
|
<Tag>{asset.symbol}</Tag>
|
||||||
</Styled.MarketName>
|
</Styled.MarketName>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export const PositionInfo = ({ showNarrowVariation }: { showNarrowVariation?: bo
|
|||||||
const isLoading = useSelector(calculateIsAccountLoading);
|
const isLoading = useSelector(calculateIsAccountLoading);
|
||||||
|
|
||||||
const { stepSizeDecimals, tickSizeDecimals } = currentMarketConfigs || {};
|
const { stepSizeDecimals, tickSizeDecimals } = currentMarketConfigs || {};
|
||||||
const { id } = currentMarketAssetData || {};
|
const { symbol } = currentMarketAssetData || {};
|
||||||
const { type: dialogType } = activeDialog || {};
|
const { type: dialogType } = activeDialog || {};
|
||||||
const { type: tradeBoxDialogType } = activeTradeBoxDialog || {};
|
const { type: tradeBoxDialogType } = activeTradeBoxDialog || {};
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ export const PositionInfo = ({ showNarrowVariation }: { showNarrowVariation?: bo
|
|||||||
label: STRING_KEYS.LIQUIDATION_PRICE,
|
label: STRING_KEYS.LIQUIDATION_PRICE,
|
||||||
tooltip: 'liquidation-price',
|
tooltip: 'liquidation-price',
|
||||||
tooltipParams: {
|
tooltipParams: {
|
||||||
SYMBOL: id || '',
|
SYMBOL: symbol || '',
|
||||||
},
|
},
|
||||||
fractionDigits: tickSizeDecimals,
|
fractionDigits: tickSizeDecimals,
|
||||||
hasInvalidNewValue: Boolean(newLeverageIsInvalid),
|
hasInvalidNewValue: Boolean(newLeverageIsInvalid),
|
||||||
@@ -326,7 +326,7 @@ export const PositionInfo = ({ showNarrowVariation }: { showNarrowVariation?: bo
|
|||||||
notionalTotal={notionalTotal?.current}
|
notionalTotal={notionalTotal?.current}
|
||||||
postOrderSize={size?.postOrder}
|
postOrderSize={size?.postOrder}
|
||||||
stepSizeDecimals={stepSizeDecimals}
|
stepSizeDecimals={stepSizeDecimals}
|
||||||
symbol={id || undefined}
|
symbol={symbol || undefined}
|
||||||
tickSizeDecimals={tickSizeDecimals}
|
tickSizeDecimals={tickSizeDecimals}
|
||||||
showNarrowVariation={showNarrowVariation}
|
showNarrowVariation={showNarrowVariation}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
@@ -370,7 +370,7 @@ export const PositionInfo = ({ showNarrowVariation }: { showNarrowVariation?: bo
|
|||||||
notionalTotal={notionalTotal?.current}
|
notionalTotal={notionalTotal?.current}
|
||||||
postOrderSize={size?.postOrder}
|
postOrderSize={size?.postOrder}
|
||||||
stepSizeDecimals={stepSizeDecimals}
|
stepSizeDecimals={stepSizeDecimals}
|
||||||
symbol={id || undefined}
|
symbol={symbol || undefined}
|
||||||
tickSizeDecimals={tickSizeDecimals}
|
tickSizeDecimals={tickSizeDecimals}
|
||||||
isLoading={isLoading}
|
isLoading={isLoading}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ const useTradeTypeOptions = () => {
|
|||||||
value && {
|
value && {
|
||||||
value: value as TradeTypes,
|
value: value as TradeTypes,
|
||||||
label,
|
label,
|
||||||
|
disabled: import.meta.env.MODE === 'production', // TODO: Remove this when stop orders are supported on testnet
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.filter(isTruthy),
|
.filter(isTruthy),
|
||||||
|
|||||||
@@ -7,11 +7,9 @@ import { StatusResponse } from '@0xsquid/sdk';
|
|||||||
import { useInterval, useStringGetter } from '@/hooks';
|
import { useInterval, useStringGetter } from '@/hooks';
|
||||||
|
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { AlertType } from '@/constants/alerts';
|
|
||||||
|
|
||||||
import { formatSeconds } from '@/lib/timeUtils';
|
import { formatSeconds } from '@/lib/timeUtils';
|
||||||
|
|
||||||
import { AlertMessage } from '@/components/AlertMessage';
|
|
||||||
import { Output, OutputType } from '@/components/Output';
|
import { Output, OutputType } from '@/components/Output';
|
||||||
import { WithReceipt } from '@/components/WithReceipt';
|
import { WithReceipt } from '@/components/WithReceipt';
|
||||||
import { Icon, IconName } from '@/components/Icon';
|
import { Icon, IconName } from '@/components/Icon';
|
||||||
@@ -35,9 +33,6 @@ export const TransferStatusToast = ({
|
|||||||
const [open, setOpen] = useState<boolean>(false);
|
const [open, setOpen] = useState<boolean>(false);
|
||||||
const [secondsLeft, setSecondsLeft] = useState<number | undefined>();
|
const [secondsLeft, setSecondsLeft] = useState<number | undefined>();
|
||||||
|
|
||||||
// @ts-ignore status.errors is not in the type definition but can be returned
|
|
||||||
const error = status?.errors?.length ? status?.errors[0] : status?.error;
|
|
||||||
|
|
||||||
const type = useMemo(
|
const type = useMemo(
|
||||||
() => (status?.toChain?.chainData?.chainId === TESTNET_CHAIN_ID ? 'deposit' : 'withdrawal'),
|
() => (status?.toChain?.chainData?.chainId === TESTNET_CHAIN_ID ? 'deposit' : 'withdrawal'),
|
||||||
[status]
|
[status]
|
||||||
@@ -53,15 +48,6 @@ export const TransferStatusToast = ({
|
|||||||
|
|
||||||
if (!status) return <LoadingDots size={3} />;
|
if (!status) return <LoadingDots size={3} />;
|
||||||
|
|
||||||
const statusString =
|
|
||||||
type === 'deposit'
|
|
||||||
? status?.squidTransactionStatus === 'success'
|
|
||||||
? STRING_KEYS.DEPOSIT_COMPLETE
|
|
||||||
: STRING_KEYS.DEPOSIT_STATUS
|
|
||||||
: status?.squidTransactionStatus === 'success'
|
|
||||||
? STRING_KEYS.WITHDRAW_COMPLETE
|
|
||||||
: STRING_KEYS.WITHDRAW_STATUS;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Styled.Root open={open} onOpenChange={setOpen}>
|
<Styled.Root open={open} onOpenChange={setOpen}>
|
||||||
<WithReceipt
|
<WithReceipt
|
||||||
@@ -76,7 +62,7 @@ export const TransferStatusToast = ({
|
|||||||
<Styled.BridgingStatus>
|
<Styled.BridgingStatus>
|
||||||
<Styled.Status>
|
<Styled.Status>
|
||||||
{stringGetter({
|
{stringGetter({
|
||||||
key: statusString,
|
key: type === 'deposit' ? STRING_KEYS.DEPOSIT_STATUS : STRING_KEYS.WITHDRAW_STATUS,
|
||||||
params: {
|
params: {
|
||||||
AMOUNT_USD: <Styled.InlineOutput type={OutputType.Fiat} value={toAmount} />,
|
AMOUNT_USD: <Styled.InlineOutput type={OutputType.Fiat} value={toAmount} />,
|
||||||
ESTIMATED_DURATION: (
|
ESTIMATED_DURATION: (
|
||||||
@@ -88,16 +74,6 @@ export const TransferStatusToast = ({
|
|||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
</Styled.Status>
|
</Styled.Status>
|
||||||
{error && (
|
|
||||||
<AlertMessage type={AlertType.Error}>
|
|
||||||
{stringGetter({
|
|
||||||
key: STRING_KEYS.SOMETHING_WENT_WRONG_WITH_MESSAGE,
|
|
||||||
params: {
|
|
||||||
ERROR_MESSAGE: error.message || stringGetter({ key: STRING_KEYS.UNKNOWN_ERROR }),
|
|
||||||
},
|
|
||||||
})}
|
|
||||||
</AlertMessage>
|
|
||||||
)}
|
|
||||||
<Styled.Trigger>
|
<Styled.Trigger>
|
||||||
<Styled.TriggerIcon>
|
<Styled.TriggerIcon>
|
||||||
<Icon iconName={IconName.Caret} />
|
<Icon iconName={IconName.Caret} />
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export const TransferStatusSteps = ({ status }: ElementProps) => {
|
|||||||
label: stringGetter({
|
label: stringGetter({
|
||||||
key: type === 'deposit' ? STRING_KEYS.DEPOSIT_TO_CHAIN : STRING_KEYS.WITHDRAW_TO_CHAIN,
|
key: type === 'deposit' ? STRING_KEYS.DEPOSIT_TO_CHAIN : STRING_KEYS.WITHDRAW_TO_CHAIN,
|
||||||
params: {
|
params: {
|
||||||
CHAIN: type === 'deposit' ? 'dYdX' : status?.toChain?.chainData?.chainName,
|
CHAIN: status?.toChain?.chainData?.chainName,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
step: TransferStatusStep.ToChain,
|
step: TransferStatusStep.ToChain,
|
||||||
@@ -59,7 +59,7 @@ export const TransferStatusSteps = ({ status }: ElementProps) => {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const currentStatus = routeStatus?.[routeStatus?.length - 1];
|
const currentStatus = routeStatus[routeStatus?.length - 1];
|
||||||
|
|
||||||
let currentStep = TransferStatusStep.Bridge;
|
let currentStep = TransferStatusStep.Bridge;
|
||||||
|
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export const DepthChart = ({
|
|||||||
// Chart data
|
// Chart data
|
||||||
|
|
||||||
const orderbook = useSelector(getCurrentMarketOrderbook, shallowEqual);
|
const orderbook = useSelector(getCurrentMarketOrderbook, shallowEqual);
|
||||||
const { id = '' } = useSelector(getCurrentMarketAssetData, shallowEqual) ?? {};
|
const { symbol = '' } = useSelector(getCurrentMarketAssetData, shallowEqual) ?? {};
|
||||||
const { stepSizeDecimals, tickSizeDecimals } =
|
const { stepSizeDecimals, tickSizeDecimals } =
|
||||||
useSelector(getCurrentMarketConfig, shallowEqual) ?? {};
|
useSelector(getCurrentMarketConfig, shallowEqual) ?? {};
|
||||||
|
|
||||||
@@ -393,7 +393,7 @@ export const DepthChart = ({
|
|||||||
? chartPointAtPointer.size
|
? chartPointAtPointer.size
|
||||||
: tooltipData!.nearestDatum?.datum.depth
|
: tooltipData!.nearestDatum?.datum.depth
|
||||||
}
|
}
|
||||||
tag={id}
|
tag={symbol}
|
||||||
accentColor={
|
accentColor={
|
||||||
{
|
{
|
||||||
[DepthChartSeries.Asks]: 'var(--color-negative)',
|
[DepthChartSeries.Asks]: 'var(--color-negative)',
|
||||||
@@ -476,7 +476,7 @@ export const DepthChart = ({
|
|||||||
type={OutputType.Asset}
|
type={OutputType.Asset}
|
||||||
value={chartPointAtPointer.size}
|
value={chartPointAtPointer.size}
|
||||||
fractionDigits={stepSizeDecimals}
|
fractionDigits={stepSizeDecimals}
|
||||||
tag={id}
|
tag={symbol}
|
||||||
useGrouping={false}
|
useGrouping={false}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
@@ -543,7 +543,7 @@ export const DepthChart = ({
|
|||||||
type={OutputType.Asset}
|
type={OutputType.Asset}
|
||||||
value={nearestDatum?.datum.depth}
|
value={nearestDatum?.datum.depth}
|
||||||
fractionDigits={stepSizeDecimals}
|
fractionDigits={stepSizeDecimals}
|
||||||
tag={id}
|
tag={symbol}
|
||||||
useGrouping={false}
|
useGrouping={false}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ type ElementProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const ClosePositionDialog = ({ setIsOpen }: ElementProps) => {
|
export const ClosePositionDialog = ({ setIsOpen }: ElementProps) => {
|
||||||
const { id } = useSelector(getCurrentMarketAssetData, shallowEqual) ?? {};
|
const { symbol } = useSelector(getCurrentMarketAssetData, shallowEqual) ?? {};
|
||||||
const { isTablet } = useBreakpoints();
|
const { isTablet } = useBreakpoints();
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ export const ClosePositionDialog = ({ setIsOpen }: ElementProps) => {
|
|||||||
} = {
|
} = {
|
||||||
[MobilePlaceOrderSteps.EditOrder]: {
|
[MobilePlaceOrderSteps.EditOrder]: {
|
||||||
title: <CloseOrderHeader />,
|
title: <CloseOrderHeader />,
|
||||||
slotIcon: <AssetIcon symbol={id} />,
|
slotIcon: <AssetIcon symbol={symbol} />,
|
||||||
},
|
},
|
||||||
[MobilePlaceOrderSteps.PreviewOrder]: {
|
[MobilePlaceOrderSteps.PreviewOrder]: {
|
||||||
title: (
|
title: (
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ import { MustBigNumber } from '@/lib/numbers';
|
|||||||
|
|
||||||
type ElementProps = {
|
type ElementProps = {
|
||||||
fillId: string;
|
fillId: string;
|
||||||
setIsOpen: (open: boolean) => void;
|
setIsOpen?: (open: boolean) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const FillDetailsDialog = ({ fillId, setIsOpen }: ElementProps) => {
|
export const FillDetailsDialog = ({ fillId, setIsOpen }: ElementProps) => {
|
||||||
@@ -94,7 +94,7 @@ export const FillDetailsDialog = ({ fillId, setIsOpen }: ElementProps) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<DetailsDialog
|
<DetailsDialog
|
||||||
slotIcon={<Styled.AssetIcon symbol={asset.id} />}
|
slotIcon={<Styled.AssetIcon symbol={asset.symbol} />}
|
||||||
title={resources.typeStringKey && stringGetter({ key: resources.typeStringKey })}
|
title={resources.typeStringKey && stringGetter({ key: resources.typeStringKey })}
|
||||||
items={detailItems}
|
items={detailItems}
|
||||||
setIsOpen={setIsOpen}
|
setIsOpen={setIsOpen}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { layoutMixins } from '@/styles/layoutMixins';
|
|||||||
|
|
||||||
import { AbacusOrderStatus, AbacusOrderTypes, type Nullable } from '@/constants/abacus';
|
import { AbacusOrderStatus, AbacusOrderTypes, type Nullable } from '@/constants/abacus';
|
||||||
import { ButtonAction } from '@/constants/buttons';
|
import { ButtonAction } from '@/constants/buttons';
|
||||||
import { STRING_KEYS, type StringKey } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
|
|
||||||
import { AssetIcon } from '@/components/AssetIcon';
|
import { AssetIcon } from '@/components/AssetIcon';
|
||||||
import { Button } from '@/components/Button';
|
import { Button } from '@/components/Button';
|
||||||
@@ -47,7 +47,7 @@ export const OrderDetailsDialog = ({ orderId, setIsOpen }: ElementProps) => {
|
|||||||
const { cancelOrder } = useSubaccount();
|
const { cancelOrder } = useSubaccount();
|
||||||
|
|
||||||
const {
|
const {
|
||||||
asset,
|
asset = {},
|
||||||
cancelReason,
|
cancelReason,
|
||||||
createdAtMilliseconds,
|
createdAtMilliseconds,
|
||||||
expiresAtMilliseconds,
|
expiresAtMilliseconds,
|
||||||
@@ -57,7 +57,7 @@ export const OrderDetailsDialog = ({ orderId, setIsOpen }: ElementProps) => {
|
|||||||
price,
|
price,
|
||||||
reduceOnly,
|
reduceOnly,
|
||||||
totalFilled,
|
totalFilled,
|
||||||
resources,
|
resources = {},
|
||||||
size,
|
size,
|
||||||
status,
|
status,
|
||||||
stepSizeDecimals,
|
stepSizeDecimals,
|
||||||
@@ -121,9 +121,7 @@ export const OrderDetailsDialog = ({ orderId, setIsOpen }: ElementProps) => {
|
|||||||
{
|
{
|
||||||
key: 'cancel-reason',
|
key: 'cancel-reason',
|
||||||
label: stringGetter({ key: STRING_KEYS.CANCEL_REASON }),
|
label: stringGetter({ key: STRING_KEYS.CANCEL_REASON }),
|
||||||
value: cancelReason
|
value: cancelReason ? stringGetter({ key: STRING_KEYS[cancelReason] }) : undefined,
|
||||||
? stringGetter({ key: STRING_KEYS[cancelReason as StringKey] })
|
|
||||||
: undefined,
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: 'amount',
|
key: 'amount',
|
||||||
@@ -184,7 +182,8 @@ export const OrderDetailsDialog = ({ orderId, setIsOpen }: ElementProps) => {
|
|||||||
|
|
||||||
const onCancelClick = async () => {
|
const onCancelClick = async () => {
|
||||||
setIsPlacingCancel(true);
|
setIsPlacingCancel(true);
|
||||||
await cancelOrder({ orderId, onError: () => setIsPlacingCancel(false) });
|
await cancelOrder({ orderId });
|
||||||
|
setIsPlacingCancel(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onClearClick = () => {
|
const onClearClick = () => {
|
||||||
@@ -194,7 +193,7 @@ export const OrderDetailsDialog = ({ orderId, setIsOpen }: ElementProps) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<DetailsDialog
|
<DetailsDialog
|
||||||
slotIcon={<Styled.AssetIcon symbol={asset.id} />}
|
slotIcon={<Styled.AssetIcon symbol={asset.symbol} />}
|
||||||
title={!resources.typeStringKey ? '' : stringGetter({ key: resources.typeStringKey })}
|
title={!resources.typeStringKey ? '' : stringGetter({ key: resources.typeStringKey })}
|
||||||
slotFooter={
|
slotFooter={
|
||||||
isAccountViewOnly ? null : isOrderStatusClearable(status) ? (
|
isAccountViewOnly ? null : isOrderStatusClearable(status) ? (
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
|||||||
import { AbacusApiStatus } from '@/constants/abacus';
|
import { AbacusApiStatus } from '@/constants/abacus';
|
||||||
import { DialogTypes } from '@/constants/dialogs';
|
import { DialogTypes } from '@/constants/dialogs';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
|
import { CLIENT_NETWORK_CONFIGS } from '@/constants/networks';
|
||||||
|
import { UNICODE } from '@/constants/unicode';
|
||||||
import { useApiState, useStringGetter } from '@/hooks';
|
import { useApiState, useStringGetter } from '@/hooks';
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
@@ -29,8 +31,16 @@ export const ExchangeOfflineDialog = ({ preventClose, setIsOpen }: ElementProps)
|
|||||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||||
const activeDialog = useSelector(getActiveDialog, shallowEqual);
|
const activeDialog = useSelector(getActiveDialog, shallowEqual);
|
||||||
|
|
||||||
|
const showOfflineMessage =
|
||||||
|
import.meta.env.MODE === 'production' &&
|
||||||
|
CLIENT_NETWORK_CONFIGS[selectedNetwork].dydxChainId === 'dydx-testnet-3';
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (activeDialog?.type === DialogTypes.ExchangeOffline && status === AbacusApiStatus.NORMAL) {
|
if (
|
||||||
|
activeDialog?.type === DialogTypes.ExchangeOffline &&
|
||||||
|
status === AbacusApiStatus.NORMAL &&
|
||||||
|
!showOfflineMessage
|
||||||
|
) {
|
||||||
dispatch(closeDialog());
|
dispatch(closeDialog());
|
||||||
}
|
}
|
||||||
}, [status, selectedNetwork]);
|
}, [status, selectedNetwork]);
|
||||||
@@ -43,7 +53,16 @@ export const ExchangeOfflineDialog = ({ preventClose, setIsOpen }: ElementProps)
|
|||||||
title={stringGetter({ key: STRING_KEYS.UNAVAILABLE })}
|
title={stringGetter({ key: STRING_KEYS.UNAVAILABLE })}
|
||||||
>
|
>
|
||||||
<Styled.Content>
|
<Styled.Content>
|
||||||
<p>{statusErrorMessage}</p>
|
{showOfflineMessage ? (
|
||||||
|
<>
|
||||||
|
<p>Testnet is currently offline. Please check back!</p>
|
||||||
|
<Styled.Link href="https://v4-teacher.vercel.app/testnets/schedule">
|
||||||
|
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} {UNICODE.ARROW_RIGHT}
|
||||||
|
</Styled.Link>
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<p>{statusErrorMessage}</p>
|
||||||
|
)}
|
||||||
{import.meta.env.MODE !== 'production' && <NetworkSelectMenu />}
|
{import.meta.env.MODE !== 'production' && <NetworkSelectMenu />}
|
||||||
</Styled.Content>
|
</Styled.Content>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|||||||
@@ -1,107 +0,0 @@
|
|||||||
import styled, { type AnyStyledComponent } from 'styled-components';
|
|
||||||
|
|
||||||
import { ButtonAction, ButtonSize, ButtonType } from '@/constants/buttons';
|
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
|
||||||
import { useBreakpoints, useStringGetter } from '@/hooks';
|
|
||||||
|
|
||||||
import { Button } from '@/components/Button';
|
|
||||||
import { Dialog, DialogPlacement } from '@/components/Dialog';
|
|
||||||
import { IconName } from '@/components/Icon';
|
|
||||||
import { IconButton } from '@/components/IconButton';
|
|
||||||
|
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
|
||||||
|
|
||||||
type ElementProps = {
|
|
||||||
setIsOpen: (open: boolean) => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: replace placeholder URL with real URLs when avaialble
|
|
||||||
const KEPLR_DASHBOARD_URL = 'https://testnet.keplr.app/';
|
|
||||||
const HELP_URL = 'https://help.dydx.exchange/en/articles/2921366-how-do-i-create-an-account-or-sign-up';
|
|
||||||
|
|
||||||
export const ExternalNavKeplrDialog = ({ setIsOpen }: ElementProps) => {
|
|
||||||
const stringGetter = useStringGetter();
|
|
||||||
const { isTablet } = useBreakpoints();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Dialog
|
|
||||||
isOpen
|
|
||||||
setIsOpen={setIsOpen}
|
|
||||||
title={stringGetter({ key: STRING_KEYS.HAVE_YOU_EXPORTED })}
|
|
||||||
placement={isTablet ? DialogPlacement.FullScreen : DialogPlacement.Default}
|
|
||||||
>
|
|
||||||
<Styled.Content>
|
|
||||||
<Styled.Button type={ButtonType.Link} size={ButtonSize.XLarge} href={KEPLR_DASHBOARD_URL}>
|
|
||||||
<span>
|
|
||||||
{stringGetter({
|
|
||||||
key: STRING_KEYS.NAVIGATE_TO_KEPLR,
|
|
||||||
params: {
|
|
||||||
STRONG_YES: <strong>{stringGetter({ key: STRING_KEYS.YES })}</strong>,
|
|
||||||
},
|
|
||||||
})}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<Styled.IconButton
|
|
||||||
action={ButtonAction.Base}
|
|
||||||
iconName={IconName.Arrow}
|
|
||||||
size={ButtonSize.XSmall}
|
|
||||||
/>
|
|
||||||
</Styled.Button>
|
|
||||||
|
|
||||||
<Styled.Button type={ButtonType.Link} size={ButtonSize.XLarge} href={HELP_URL}>
|
|
||||||
<span>
|
|
||||||
{stringGetter({
|
|
||||||
key: STRING_KEYS.LEARN_TO_EXPORT,
|
|
||||||
params: {
|
|
||||||
STRONG_NO: <strong>{stringGetter({ key: STRING_KEYS.NO })}</strong>,
|
|
||||||
},
|
|
||||||
})}
|
|
||||||
</span>
|
|
||||||
|
|
||||||
<Styled.IconButton
|
|
||||||
action={ButtonAction.Base}
|
|
||||||
iconName={IconName.Arrow}
|
|
||||||
size={ButtonSize.XSmall}
|
|
||||||
/>
|
|
||||||
</Styled.Button>
|
|
||||||
</Styled.Content>
|
|
||||||
</Dialog>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const Styled: Record<string, AnyStyledComponent> = {};
|
|
||||||
|
|
||||||
Styled.TextToggle = styled.div`
|
|
||||||
${layoutMixins.stickyFooter}
|
|
||||||
color: var(--color-accent);
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
margin-top: auto;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Content = styled.div`
|
|
||||||
${layoutMixins.stickyArea0}
|
|
||||||
--stickyArea0-bottomHeight: 2rem;
|
|
||||||
--stickyArea0-bottomGap: 1rem;
|
|
||||||
--stickyArea0-totalInsetBottom: 0.5rem;
|
|
||||||
|
|
||||||
${layoutMixins.flexColumn}
|
|
||||||
gap: 1rem;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Button = styled(Button)`
|
|
||||||
--button-font: var(--font-base-book);
|
|
||||||
--button-padding: 0 1.5rem;
|
|
||||||
|
|
||||||
gap: 0;
|
|
||||||
|
|
||||||
justify-content: space-between;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.IconButton = styled(IconButton)`
|
|
||||||
color: var(--color-text-0);
|
|
||||||
`;
|
|
||||||
@@ -9,8 +9,8 @@ import { AlertType } from '@/constants/alerts';
|
|||||||
import { AnalyticsEvent } from '@/constants/analytics';
|
import { AnalyticsEvent } from '@/constants/analytics';
|
||||||
import { ButtonAction } from '@/constants/buttons';
|
import { ButtonAction } from '@/constants/buttons';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
import { CLIENT_NETWORK_CONFIGS } from '@/constants/networks';
|
||||||
import { DydxAddress, getSignTypedData } from '@/constants/wallets';
|
import { DydxAddress, SIGN_TYPED_DATA } from '@/constants/wallets';
|
||||||
|
|
||||||
import { useAccounts, useBreakpoints, useDydxClient, useStringGetter } from '@/hooks';
|
import { useAccounts, useBreakpoints, useDydxClient, useStringGetter } from '@/hooks';
|
||||||
import { useMatchingEvmNetwork } from '@/hooks/useMatchingEvmNetwork';
|
import { useMatchingEvmNetwork } from '@/hooks/useMatchingEvmNetwork';
|
||||||
@@ -55,7 +55,7 @@ export const GenerateKeys = ({
|
|||||||
// 1. Switch network
|
// 1. Switch network
|
||||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||||
|
|
||||||
const chainId = Number(ENVIRONMENT_CONFIG_MAP[selectedNetwork].ethereumChainId);
|
const chainId = Number(CLIENT_NETWORK_CONFIGS[selectedNetwork].ethereumChainId);
|
||||||
|
|
||||||
const { isMatchingNetwork, matchNetwork, isSwitchingNetwork } = useMatchingEvmNetwork({
|
const { isMatchingNetwork, matchNetwork, isSwitchingNetwork } = useMatchingEvmNetwork({
|
||||||
chainId,
|
chainId,
|
||||||
@@ -85,11 +85,10 @@ export const GenerateKeys = ({
|
|||||||
EvmDerivedAccountStatus.Derived,
|
EvmDerivedAccountStatus.Derived,
|
||||||
].includes(status);
|
].includes(status);
|
||||||
|
|
||||||
const signTypedData = getSignTypedData(selectedNetwork);
|
|
||||||
const { signTypedDataAsync } = useSignTypedData({
|
const { signTypedDataAsync } = useSignTypedData({
|
||||||
...signTypedData,
|
...SIGN_TYPED_DATA,
|
||||||
domain: {
|
domain: {
|
||||||
...signTypedData.domain,
|
...SIGN_TYPED_DATA.domain,
|
||||||
chainId,
|
chainId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -166,8 +165,8 @@ export const GenerateKeys = ({
|
|||||||
{[
|
{[
|
||||||
{
|
{
|
||||||
status: EvmDerivedAccountStatus.Deriving,
|
status: EvmDerivedAccountStatus.Deriving,
|
||||||
title: stringGetter({ key: STRING_KEYS.GENERATE_DYDX_WALLET }),
|
title: stringGetter({ key: STRING_KEYS.GENERATE_COSMOS_WALLET }),
|
||||||
description: stringGetter({ key: STRING_KEYS.VERIFY_WALLET_OWNERSHIP }),
|
description: stringGetter({ key: STRING_KEYS.GENERATE_COSMOS_WALLET }),
|
||||||
},
|
},
|
||||||
status === EvmDerivedAccountStatus.EnsuringDeterminism && {
|
status === EvmDerivedAccountStatus.EnsuringDeterminism && {
|
||||||
status: EvmDerivedAccountStatus.EnsuringDeterminism,
|
status: EvmDerivedAccountStatus.EnsuringDeterminism,
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { shallowEqual, useSelector } from 'react-redux';
|
|||||||
import styled, { AnyStyledComponent, css } from 'styled-components';
|
import styled, { AnyStyledComponent, css } from 'styled-components';
|
||||||
|
|
||||||
import { TradeInputField } from '@/constants/abacus';
|
import { TradeInputField } from '@/constants/abacus';
|
||||||
import { STRING_KEYS, StringKey } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { TradeTypes, TRADE_TYPE_STRINGS, MobilePlaceOrderSteps } from '@/constants/trade';
|
import { TradeTypes, TRADE_TYPE_STRINGS, MobilePlaceOrderSteps } from '@/constants/trade';
|
||||||
|
|
||||||
import { useBreakpoints, useStringGetter } from '@/hooks';
|
import { useBreakpoints, useStringGetter } from '@/hooks';
|
||||||
@@ -17,7 +17,7 @@ import { Ring } from '@/components/Ring';
|
|||||||
import { ToggleGroup } from '@/components/ToggleGroup';
|
import { ToggleGroup } from '@/components/ToggleGroup';
|
||||||
|
|
||||||
import { getCurrentMarketAssetData } from '@/state/assetsSelectors';
|
import { getCurrentMarketAssetData } from '@/state/assetsSelectors';
|
||||||
import { getInputTradeData, getInputTradeOptions } from '@/state/inputsSelectors';
|
import { getInputTradeData } from '@/state/inputsSelectors';
|
||||||
|
|
||||||
import abacusStateManager from '@/lib/abacus';
|
import abacusStateManager from '@/lib/abacus';
|
||||||
import { getSelectedTradeType } from '@/lib/tradeData';
|
import { getSelectedTradeType } from '@/lib/tradeData';
|
||||||
@@ -31,19 +31,10 @@ type ElementProps = {
|
|||||||
export const TradeDialog = ({ isOpen, setIsOpen, slotTrigger }: ElementProps) => {
|
export const TradeDialog = ({ isOpen, setIsOpen, slotTrigger }: ElementProps) => {
|
||||||
const { isMobile } = useBreakpoints();
|
const { isMobile } = useBreakpoints();
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const { id } = useSelector(getCurrentMarketAssetData, shallowEqual) ?? {};
|
const { symbol } = useSelector(getCurrentMarketAssetData, shallowEqual) ?? {};
|
||||||
const currentTradeData = useSelector(getInputTradeData, shallowEqual);
|
const currentTradeData = useSelector(getInputTradeData, shallowEqual);
|
||||||
const { type } = currentTradeData || {};
|
const { type } = currentTradeData || {};
|
||||||
const selectedTradeType = getSelectedTradeType(type);
|
const selectedTradeType = getSelectedTradeType(type);
|
||||||
const { typeOptions } = useSelector(getInputTradeOptions, shallowEqual) ?? {};
|
|
||||||
|
|
||||||
const allTradeTypeItems = typeOptions?.toArray()?.map(({ type, stringKey }) => ({
|
|
||||||
value: type,
|
|
||||||
label: stringGetter({
|
|
||||||
key: stringKey as StringKey,
|
|
||||||
}),
|
|
||||||
slotBefore: <AssetIcon symbol={id} />,
|
|
||||||
}));
|
|
||||||
|
|
||||||
const [currentStep, setCurrentStep] = useState<MobilePlaceOrderSteps>(
|
const [currentStep, setCurrentStep] = useState<MobilePlaceOrderSteps>(
|
||||||
MobilePlaceOrderSteps.EditOrder
|
MobilePlaceOrderSteps.EditOrder
|
||||||
@@ -71,7 +62,11 @@ export const TradeDialog = ({ isOpen, setIsOpen, slotTrigger }: ElementProps) =>
|
|||||||
[MobilePlaceOrderSteps.EditOrder]: {
|
[MobilePlaceOrderSteps.EditOrder]: {
|
||||||
title: (
|
title: (
|
||||||
<Styled.ToggleGroup
|
<Styled.ToggleGroup
|
||||||
items={allTradeTypeItems}
|
items={[TradeTypes.LIMIT, TradeTypes.MARKET].map((tradeType: TradeTypes) => ({
|
||||||
|
value: tradeType,
|
||||||
|
label: stringGetter({ key: TRADE_TYPE_STRINGS[tradeType].tradeTypeKey }),
|
||||||
|
slotBefore: <AssetIcon symbol={symbol} />,
|
||||||
|
}))}
|
||||||
value={selectedTradeType}
|
value={selectedTradeType}
|
||||||
onValueChange={(tradeType: TradeTypes) =>
|
onValueChange={(tradeType: TradeTypes) =>
|
||||||
onTradeTypeChange(tradeType || selectedTradeType)
|
onTradeTypeChange(tradeType || selectedTradeType)
|
||||||
@@ -131,8 +126,6 @@ Styled.Dialog = styled(Dialog)<{ currentStep: MobilePlaceOrderSteps }>`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.ToggleGroup = styled(ToggleGroup)`
|
Styled.ToggleGroup = styled(ToggleGroup)`
|
||||||
overflow-x: auto;
|
|
||||||
|
|
||||||
button[data-state='off'] {
|
button[data-state='off'] {
|
||||||
gap: 0;
|
gap: 0;
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { NumberSign } from '@/constants/numbers';
|
|||||||
import type { EvmAddress } from '@/constants/wallets';
|
import type { EvmAddress } from '@/constants/wallets';
|
||||||
|
|
||||||
import { useAccounts, useDebounce, useStringGetter } from '@/hooks';
|
import { useAccounts, useDebounce, useStringGetter } from '@/hooks';
|
||||||
import { useAccountBalance, CHAIN_DEFAULT_TOKEN_ADDRESS } from '@/hooks/useAccountBalance';
|
import { useAccountBalance } from '@/hooks/useAccountBalance';
|
||||||
import { useLocalNotifications } from '@/hooks/useLocalNotifications';
|
import { useLocalNotifications } from '@/hooks/useLocalNotifications';
|
||||||
import { NATIVE_TOKEN_ADDRESS, useSquid } from '@/hooks/useSquid';
|
import { NATIVE_TOKEN_ADDRESS, useSquid } from '@/hooks/useSquid';
|
||||||
import { useWalletConnection } from '@/hooks/useWalletConnection';
|
import { useWalletConnection } from '@/hooks/useWalletConnection';
|
||||||
@@ -38,7 +38,6 @@ import { getTransferInputs } from '@/state/inputsSelectors';
|
|||||||
import abacusStateManager from '@/lib/abacus';
|
import abacusStateManager from '@/lib/abacus';
|
||||||
import { MustBigNumber } from '@/lib/numbers';
|
import { MustBigNumber } from '@/lib/numbers';
|
||||||
import { log } from '@/lib/telemetry';
|
import { log } from '@/lib/telemetry';
|
||||||
import { parseWalletError } from '@/lib/wallet';
|
|
||||||
|
|
||||||
import { ChainSelectMenu } from './ChainSelectMenu';
|
import { ChainSelectMenu } from './ChainSelectMenu';
|
||||||
import { TokenSelectMenu } from './TokenSelectMenu';
|
import { TokenSelectMenu } from './TokenSelectMenu';
|
||||||
@@ -86,7 +85,7 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
|||||||
|
|
||||||
// Async Data
|
// Async Data
|
||||||
const { balance, queryStatus, isQueryFetching } = useAccountBalance({
|
const { balance, queryStatus, isQueryFetching } = useAccountBalance({
|
||||||
addressOrDenom: sourceToken?.address || CHAIN_DEFAULT_TOKEN_ADDRESS,
|
addressOrDenom: sourceToken?.address || undefined,
|
||||||
assetSymbol: sourceToken?.symbol || undefined,
|
assetSymbol: sourceToken?.symbol || undefined,
|
||||||
chainId: chainId,
|
chainId: chainId,
|
||||||
decimals: sourceToken?.decimals || undefined,
|
decimals: sourceToken?.decimals || undefined,
|
||||||
@@ -217,6 +216,7 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
|||||||
!requestPayload.data ||
|
!requestPayload.data ||
|
||||||
!requestPayload.value ||
|
!requestPayload.value ||
|
||||||
!requestPayload.gasLimit ||
|
!requestPayload.gasLimit ||
|
||||||
|
!requestPayload.gasPrice ||
|
||||||
!requestPayload.routeType
|
!requestPayload.routeType
|
||||||
) {
|
) {
|
||||||
throw new Error('Missing request payload');
|
throw new Error('Missing request payload');
|
||||||
@@ -286,7 +286,12 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
|||||||
|
|
||||||
const errorMessage = useMemo(() => {
|
const errorMessage = useMemo(() => {
|
||||||
if (error) {
|
if (error) {
|
||||||
return parseWalletError({ error, stringGetter }).message;
|
return error?.message
|
||||||
|
? stringGetter({
|
||||||
|
key: STRING_KEYS.SOMETHING_WENT_WRONG_WITH_MESSAGE,
|
||||||
|
params: { ERROR_MESSAGE: error.message },
|
||||||
|
})
|
||||||
|
: stringGetter({ key: STRING_KEYS.SOMETHING_WENT_WRONG });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromAmount) {
|
if (fromAmount) {
|
||||||
|
|||||||
@@ -168,19 +168,6 @@ export const DepositButtonAndReceipt = ({
|
|||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'estimatedRouteDuration',
|
|
||||||
label: <span>{stringGetter({ key: STRING_KEYS.ESTIMATED_TIME })}</span>,
|
|
||||||
value: typeof summary?.estimatedRouteDuration === 'number' && (
|
|
||||||
<Output
|
|
||||||
type={OutputType.Text}
|
|
||||||
value={stringGetter({
|
|
||||||
key: STRING_KEYS.X_MINUTES_LOWERCASED,
|
|
||||||
params: { X: Math.round(summary?.estimatedRouteDuration / 60) },
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const isFormValid = !isDisabled && !isEditingSlippage;
|
const isFormValid = !isDisabled && !isEditingSlippage;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import styled, { type AnyStyledComponent } from 'styled-components';
|
|||||||
|
|
||||||
import { ButtonAction, ButtonType } from '@/constants/buttons';
|
import { ButtonAction, ButtonType } from '@/constants/buttons';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
import { CLIENT_NETWORK_CONFIGS } from '@/constants/networks';
|
||||||
import { useAccounts, useStringGetter, useSubaccount } from '@/hooks';
|
import { useAccounts, useStringGetter, useSubaccount } from '@/hooks';
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
@@ -65,7 +65,7 @@ export const TestnetDepositForm = ({ onDeposit, onError }: DepositFormProps) =>
|
|||||||
key: STRING_KEYS.CREDITED_WITH,
|
key: STRING_KEYS.CREDITED_WITH,
|
||||||
params: {
|
params: {
|
||||||
AMOUNT_USD:
|
AMOUNT_USD:
|
||||||
ENVIRONMENT_CONFIG_MAP[selectedNetwork].ethereumChainId === 'dydxprotocol-testnet'
|
CLIENT_NETWORK_CONFIGS[selectedNetwork].ethereumChainId === 'dydxprotocol-testnet'
|
||||||
? 1000
|
? 1000
|
||||||
: 100,
|
: 100,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import styled, { type AnyStyledComponent } from 'styled-components';
|
|||||||
import type { NumberFormatValues } from 'react-number-format';
|
import type { NumberFormatValues } from 'react-number-format';
|
||||||
import { shallowEqual, useSelector } from 'react-redux';
|
import { shallowEqual, useSelector } from 'react-redux';
|
||||||
import { TESTNET_CHAIN_ID } from '@dydxprotocol/v4-client-js';
|
import { TESTNET_CHAIN_ID } from '@dydxprotocol/v4-client-js';
|
||||||
import { isAddress } from 'viem';
|
|
||||||
|
|
||||||
import { TransferInputField, TransferInputTokenResource, TransferType } from '@/constants/abacus';
|
import { TransferInputField, TransferInputTokenResource, TransferType } from '@/constants/abacus';
|
||||||
import { AlertType } from '@/constants/alerts';
|
import { AlertType } from '@/constants/alerts';
|
||||||
@@ -27,7 +26,6 @@ import { Link } from '@/components/Link';
|
|||||||
import { OutputType } from '@/components/Output';
|
import { OutputType } from '@/components/Output';
|
||||||
import { Tag } from '@/components/Tag';
|
import { Tag } from '@/components/Tag';
|
||||||
import { WithDetailsReceipt } from '@/components/WithDetailsReceipt';
|
import { WithDetailsReceipt } from '@/components/WithDetailsReceipt';
|
||||||
import { Icon, IconName } from '@/components/Icon';
|
|
||||||
|
|
||||||
import { ChainSelectMenu } from '@/views/forms/AccountManagementForms/ChainSelectMenu';
|
import { ChainSelectMenu } from '@/views/forms/AccountManagementForms/ChainSelectMenu';
|
||||||
|
|
||||||
@@ -45,7 +43,7 @@ export const WithdrawForm = () => {
|
|||||||
const [error, setError] = useState<Error | null>(null);
|
const [error, setError] = useState<Error | null>(null);
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const { sendSquidWithdraw } = useSubaccount();
|
const { simulateWithdraw, sendSquidWithdraw } = useSubaccount();
|
||||||
const { freeCollateral } = useSelector(getSubaccount, shallowEqual) || {};
|
const { freeCollateral } = useSelector(getSubaccount, shallowEqual) || {};
|
||||||
|
|
||||||
// User input
|
// User input
|
||||||
@@ -61,8 +59,6 @@ export const WithdrawForm = () => {
|
|||||||
resources,
|
resources,
|
||||||
} = useSelector(getTransferInputs, shallowEqual) || {};
|
} = useSelector(getTransferInputs, shallowEqual) || {};
|
||||||
|
|
||||||
const isValidAddress = toAddress && isAddress(toAddress);
|
|
||||||
|
|
||||||
const toToken = useMemo(
|
const toToken = useMemo(
|
||||||
() => (token ? resources?.tokenResources?.get(token) : undefined),
|
() => (token ? resources?.tokenResources?.get(token) : undefined),
|
||||||
[token, resources]
|
[token, resources]
|
||||||
@@ -101,10 +97,16 @@ export const WithdrawForm = () => {
|
|||||||
field: TransferInputField.usdcSize,
|
field: TransferInputField.usdcSize,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
const stdFee = await simulateWithdraw(parseFloat(debouncedAmount));
|
||||||
|
const amount =
|
||||||
|
parseFloat(debouncedAmount) -
|
||||||
|
parseFloat(stdFee?.amount[0]?.amount || '0') / QUANTUM_MULTIPLIER;
|
||||||
|
|
||||||
abacusStateManager.setTransferValue({
|
abacusStateManager.setTransferValue({
|
||||||
value: debouncedAmount,
|
value: amount.toString(),
|
||||||
field: TransferInputField.usdcSize,
|
field: TransferInputField.usdcSize,
|
||||||
});
|
});
|
||||||
|
|
||||||
setError(null);
|
setError(null);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -183,6 +185,7 @@ export const WithdrawForm = () => {
|
|||||||
|
|
||||||
const onSelectChain = useCallback((chain: string) => {
|
const onSelectChain = useCallback((chain: string) => {
|
||||||
if (chain) {
|
if (chain) {
|
||||||
|
abacusStateManager.clearTransferInputValues();
|
||||||
abacusStateManager.setTransferValue({
|
abacusStateManager.setTransferValue({
|
||||||
field: TransferInputField.chain,
|
field: TransferInputField.chain,
|
||||||
value: chain,
|
value: chain,
|
||||||
@@ -193,6 +196,7 @@ export const WithdrawForm = () => {
|
|||||||
|
|
||||||
const onSelectToken = useCallback((token: TransferInputTokenResource) => {
|
const onSelectToken = useCallback((token: TransferInputTokenResource) => {
|
||||||
if (token) {
|
if (token) {
|
||||||
|
abacusStateManager.clearTransferInputValues();
|
||||||
abacusStateManager.setTransferValue({
|
abacusStateManager.setTransferValue({
|
||||||
field: TransferInputField.token,
|
field: TransferInputField.token,
|
||||||
value: token.address,
|
value: token.address,
|
||||||
@@ -267,12 +271,7 @@ export const WithdrawForm = () => {
|
|||||||
placeholder={stringGetter({ key: STRING_KEYS.ADDRESS })}
|
placeholder={stringGetter({ key: STRING_KEYS.ADDRESS })}
|
||||||
onChange={onChangeAddress}
|
onChange={onChangeAddress}
|
||||||
value={toAddress || ''}
|
value={toAddress || ''}
|
||||||
label={
|
label={stringGetter({ key: STRING_KEYS.DESTINATION })}
|
||||||
<span>
|
|
||||||
{stringGetter({ key: STRING_KEYS.DESTINATION })}{' '}
|
|
||||||
{isValidAddress ? <Styled.CheckIcon iconName={IconName.Check} /> : null}
|
|
||||||
</span>
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
<ChainSelectMenu
|
<ChainSelectMenu
|
||||||
label={stringGetter({ key: STRING_KEYS.NETWORK })}
|
label={stringGetter({ key: STRING_KEYS.NETWORK })}
|
||||||
@@ -349,10 +348,3 @@ Styled.TransactionInfo = styled.span`
|
|||||||
Styled.FormInputButton = styled(Button)`
|
Styled.FormInputButton = styled(Button)`
|
||||||
${formMixins.inputInnerButton}
|
${formMixins.inputInnerButton}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.CheckIcon = styled(Icon)`
|
|
||||||
margin: 0 1ch;
|
|
||||||
|
|
||||||
color: var(--color-positive);
|
|
||||||
font-size: 0.625rem;
|
|
||||||
`;
|
|
||||||
|
|||||||
@@ -1,19 +1,14 @@
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { shallowEqual, useSelector } from 'react-redux';
|
import { shallowEqual, useSelector } from 'react-redux';
|
||||||
import styled, { type AnyStyledComponent } from 'styled-components';
|
import styled, { type AnyStyledComponent } from 'styled-components';
|
||||||
import { formatUnits } from 'viem';
|
|
||||||
|
|
||||||
import { TransferInputTokenResource } from '@/constants/abacus';
|
import { TransferInputTokenResource } from '@/constants/abacus';
|
||||||
import { ButtonAction, ButtonShape, ButtonSize, ButtonType } from '@/constants/buttons';
|
import { ButtonAction, ButtonShape, ButtonSize, ButtonType } from '@/constants/buttons';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { NumberSign } from '@/constants/numbers';
|
import { NumberSign } from '@/constants/numbers';
|
||||||
|
|
||||||
import { formatSeconds } from '@/lib/timeUtils';
|
|
||||||
|
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
|
||||||
|
|
||||||
import { useStringGetter } from '@/hooks';
|
import { useStringGetter } from '@/hooks';
|
||||||
import { useAccountBalance } from '@/hooks/useAccountBalance';
|
import { useAccountBalance } from '@/hooks/useAccountBalance';
|
||||||
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
import { Button } from '@/components/Button';
|
import { Button } from '@/components/Button';
|
||||||
|
|
||||||
@@ -21,7 +16,6 @@ import { Details, DetailsItem } from '@/components/Details';
|
|||||||
import { DiffOutput } from '@/components/DiffOutput';
|
import { DiffOutput } from '@/components/DiffOutput';
|
||||||
import { Icon, IconName } from '@/components/Icon';
|
import { Icon, IconName } from '@/components/Icon';
|
||||||
import { Output, OutputType } from '@/components/Output';
|
import { Output, OutputType } from '@/components/Output';
|
||||||
import { Tag } from '@/components/Tag';
|
|
||||||
import { ToggleButton } from '@/components/ToggleButton';
|
import { ToggleButton } from '@/components/ToggleButton';
|
||||||
import { WithReceipt } from '@/components/WithReceipt';
|
import { WithReceipt } from '@/components/WithReceipt';
|
||||||
|
|
||||||
@@ -55,14 +49,22 @@ export const WithdrawButtonAndReceipt = ({
|
|||||||
const [isEditingSlippage, setIsEditingSlipapge] = useState(false);
|
const [isEditingSlippage, setIsEditingSlipapge] = useState(false);
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
|
|
||||||
|
const { balance, queryStatus } = useAccountBalance({
|
||||||
|
addressOrDenom: withdrawToken?.address || undefined,
|
||||||
|
assetSymbol: withdrawToken?.symbol || undefined,
|
||||||
|
chainId: withdrawChain ? parseInt(withdrawChain) : undefined,
|
||||||
|
decimals: withdrawToken?.decimals || undefined,
|
||||||
|
isCosmosChain: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: uncomment when we have a way to get token amount estimate from abacus
|
||||||
|
// const balanceBN = MustBigNumber(balance);
|
||||||
|
// const newBalance =
|
||||||
|
// // toAmountMin && withdrawToken && parseUnits(toAmountMin, withdrawToken.decimals).toString();
|
||||||
|
|
||||||
const { leverage } = useSelector(getSubaccount, shallowEqual) || {};
|
const { leverage } = useSelector(getSubaccount, shallowEqual) || {};
|
||||||
const { summary, requestPayload } = useSelector(getTransferInputs, shallowEqual) || {};
|
const { summary, requestPayload } = useSelector(getTransferInputs, shallowEqual) || {};
|
||||||
|
|
||||||
const toAmount =
|
|
||||||
summary?.toAmount &&
|
|
||||||
withdrawToken?.decimals &&
|
|
||||||
formatUnits(BigInt(summary.toAmount), withdrawToken?.decimals);
|
|
||||||
|
|
||||||
const feeSubitems: DetailsItem[] = [];
|
const feeSubitems: DetailsItem[] = [];
|
||||||
|
|
||||||
if (typeof summary?.gasFee === 'number') {
|
if (typeof summary?.gasFee === 'number') {
|
||||||
@@ -96,27 +98,9 @@ export const WithdrawButtonAndReceipt = ({
|
|||||||
),
|
),
|
||||||
subitems: feeSubitems,
|
subitems: feeSubitems,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'wallet',
|
|
||||||
label: (
|
|
||||||
<span>
|
|
||||||
{stringGetter({ key: STRING_KEYS.AMOUNT_RECEIVED })}{' '}
|
|
||||||
{withdrawToken && <Tag>{withdrawToken?.symbol}</Tag>}
|
|
||||||
</span>
|
|
||||||
),
|
|
||||||
value: (
|
|
||||||
<Styled.DiffOutput
|
|
||||||
type={OutputType.Asset}
|
|
||||||
value={'0'}
|
|
||||||
newValue={toAmount}
|
|
||||||
sign={NumberSign.Positive}
|
|
||||||
withDiff={Boolean(toAmount)}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'leverage',
|
key: 'leverage',
|
||||||
label: <span>{stringGetter({ key: STRING_KEYS.ACCOUNT_LEVERAGE })}</span>,
|
label: <span>{stringGetter({ key: STRING_KEYS.LEVERAGE })}</span>,
|
||||||
value: (
|
value: (
|
||||||
<Styled.DiffOutput
|
<Styled.DiffOutput
|
||||||
type={OutputType.Multiple}
|
type={OutputType.Multiple}
|
||||||
@@ -153,22 +137,28 @@ export const WithdrawButtonAndReceipt = ({
|
|||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
// TODO: uncomment when we have a way to get token amount estimate from abacus
|
||||||
key: 'estimatedRouteDuration',
|
// {
|
||||||
label: <span>{stringGetter({ key: STRING_KEYS.ESTIMATED_TIME })}</span>,
|
// key: 'wallet',
|
||||||
value: typeof summary?.estimatedRouteDuration === 'number' && (
|
// label: (
|
||||||
<Output
|
// <span>
|
||||||
type={OutputType.Text}
|
// {stringGetter({ key: STRING_KEYS.WALLET })}{' '}
|
||||||
value={stringGetter({
|
// {withdrawToken && <Tag>{withdrawToken?.symbol}</Tag>}
|
||||||
key: STRING_KEYS.X_MINUTES_LOWERCASED,
|
// </span>
|
||||||
params: { X: Math.round(summary?.estimatedRouteDuration / 60) },
|
// ),
|
||||||
})}
|
// value: (
|
||||||
/>
|
// <Styled.DiffOutput
|
||||||
),
|
// type={OutputType.Asset}
|
||||||
},
|
// value={balanceBN?.toString()}
|
||||||
|
// newValue={newBalance}
|
||||||
|
// sign={NumberSign.Negative}
|
||||||
|
// withDiff={Boolean(balance !== newBalance)}
|
||||||
|
// />
|
||||||
|
// ),
|
||||||
|
// },
|
||||||
];
|
];
|
||||||
|
|
||||||
const isFormValid = !isDisabled && !isEditingSlippage;
|
const isFormValid = !isDisabled && !isEditingSlippage && queryStatus !== 'error';
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Styled.WithReceipt
|
<Styled.WithReceipt
|
||||||
|
|||||||
@@ -1,19 +1,14 @@
|
|||||||
import { type FormEvent, useCallback, useEffect, useState } from 'react';
|
import { type FormEvent, useEffect, useState } from 'react';
|
||||||
import styled, { type AnyStyledComponent } from 'styled-components';
|
import styled, { type AnyStyledComponent } from 'styled-components';
|
||||||
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
||||||
|
|
||||||
import {
|
import { ClosePositionInputField } from '@/constants/abacus';
|
||||||
ClosePositionInputField,
|
|
||||||
type HumanReadablePlaceOrderPayload,
|
|
||||||
type Nullable,
|
|
||||||
} from '@/constants/abacus';
|
|
||||||
import { AlertType } from '@/constants/alerts';
|
import { AlertType } from '@/constants/alerts';
|
||||||
import { ButtonAction, ButtonShape, ButtonSize, ButtonType } from '@/constants/buttons';
|
import { ButtonAction, ButtonShape, ButtonSize, ButtonType } from '@/constants/buttons';
|
||||||
import { TOKEN_DECIMALS } from '@/constants/numbers';
|
import { TOKEN_DECIMALS } from '@/constants/numbers';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { MobilePlaceOrderSteps } from '@/constants/trade';
|
import { MobilePlaceOrderSteps } from '@/constants/trade';
|
||||||
import { useBreakpoints, useIsFirstRender, useStringGetter, useSubaccount } from '@/hooks';
|
import { useBreakpoints, useIsFirstRender, useStringGetter, useSubaccount } from '@/hooks';
|
||||||
import { useOnLastOrderIndexed } from '@/hooks/useOnLastOrderIndexed';
|
|
||||||
|
|
||||||
import { breakpoints } from '@/styles';
|
import { breakpoints } from '@/styles';
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
@@ -32,7 +27,10 @@ import { Orderbook, orderbookMixins, type OrderbookScrollBehavior } from '@/view
|
|||||||
|
|
||||||
import { PositionPreview } from '@/views/forms/TradeForm/PositionPreview';
|
import { PositionPreview } from '@/views/forms/TradeForm/PositionPreview';
|
||||||
|
|
||||||
import { getCurrentMarketPositionData } from '@/state/accountSelectors';
|
import {
|
||||||
|
calculateHasUncommittedOrders,
|
||||||
|
getCurrentMarketPositionData,
|
||||||
|
} from '@/state/accountSelectors';
|
||||||
|
|
||||||
import { getCurrentMarketAssetData } from '@/state/assetsSelectors';
|
import { getCurrentMarketAssetData } from '@/state/assetsSelectors';
|
||||||
import { getInputClosePositionData } from '@/state/inputsSelectors';
|
import { getInputClosePositionData } from '@/state/inputsSelectors';
|
||||||
@@ -80,11 +78,13 @@ export const ClosePositionForm = ({
|
|||||||
const { closePosition } = useSubaccount();
|
const { closePosition } = useSubaccount();
|
||||||
|
|
||||||
const market = useSelector(getCurrentMarketId);
|
const market = useSelector(getCurrentMarketId);
|
||||||
const { id } = useSelector(getCurrentMarketAssetData, shallowEqual) || {};
|
const { symbol } = useSelector(getCurrentMarketAssetData, shallowEqual) || {};
|
||||||
const { stepSizeDecimals } = useSelector(getCurrentMarketConfig, shallowEqual) || {};
|
const { stepSizeDecimals } = useSelector(getCurrentMarketConfig, shallowEqual) || {};
|
||||||
const { size: sizeData, summary } = useSelector(getInputClosePositionData, shallowEqual) || {};
|
const { size: sizeData, summary } = useSelector(getInputClosePositionData, shallowEqual) || {};
|
||||||
const { size, percent } = sizeData || {};
|
const { size, percent } = sizeData || {};
|
||||||
|
const hasUncommittedOrders = useSelector(calculateHasUncommittedOrders);
|
||||||
const currentInput = useSelector(getCurrentInput);
|
const currentInput = useSelector(getCurrentInput);
|
||||||
|
|
||||||
const currentPositionData = useSelector(getCurrentMarketPositionData, shallowEqual);
|
const currentPositionData = useSelector(getCurrentMarketPositionData, shallowEqual);
|
||||||
const { size: currentPositionSize } = currentPositionData || {};
|
const { size: currentPositionSize } = currentPositionData || {};
|
||||||
const { current: currentSize } = currentPositionSize || {};
|
const { current: currentSize } = currentPositionSize || {};
|
||||||
@@ -106,22 +106,17 @@ export const ClosePositionForm = ({
|
|||||||
}
|
}
|
||||||
}, [currentInput, market, currentStep]);
|
}, [currentInput, market, currentStep]);
|
||||||
|
|
||||||
const onLastOrderIndexed = useCallback(() => {
|
useEffect(() => {
|
||||||
if (!isFirstRender) {
|
// close has been placed
|
||||||
|
if (!isFirstRender && !hasUncommittedOrders) {
|
||||||
abacusStateManager.clearClosePositionInputValues({ shouldFocusOnTradeInput: true });
|
abacusStateManager.clearClosePositionInputValues({ shouldFocusOnTradeInput: true });
|
||||||
onClosePositionSuccess?.();
|
onClosePositionSuccess?.();
|
||||||
|
|
||||||
if (currentStep === MobilePlaceOrderSteps.PlacingOrder) {
|
if (currentStep === MobilePlaceOrderSteps.PlacingOrder) {
|
||||||
setCurrentStep?.(MobilePlaceOrderSteps.Confirmation);
|
setCurrentStep?.(MobilePlaceOrderSteps.Confirmation);
|
||||||
}
|
}
|
||||||
|
|
||||||
setIsClosingPosition(false);
|
|
||||||
}
|
}
|
||||||
}, [currentStep, isFirstRender]);
|
}, [hasUncommittedOrders]);
|
||||||
|
|
||||||
const { setUnIndexedClientId } = useOnLastOrderIndexed({
|
|
||||||
callback: onLastOrderIndexed,
|
|
||||||
});
|
|
||||||
|
|
||||||
const onAmountInput = ({ floatValue }: { floatValue?: number }) => {
|
const onAmountInput = ({ floatValue }: { floatValue?: number }) => {
|
||||||
if (currentSize == null) return;
|
if (currentSize == null) return;
|
||||||
@@ -170,16 +165,14 @@ export const ClosePositionForm = ({
|
|||||||
setIsClosingPosition(true);
|
setIsClosingPosition(true);
|
||||||
|
|
||||||
await closePosition({
|
await closePosition({
|
||||||
onError: (errorParams?: { errorStringKey?: Nullable<string> }) => {
|
onError: (errorParams?: { errorStringKey?: string }) => {
|
||||||
setClosePositionError(
|
setClosePositionError(
|
||||||
stringGetter({ key: errorParams?.errorStringKey || STRING_KEYS.SOMETHING_WENT_WRONG })
|
stringGetter({ key: errorParams?.errorStringKey || STRING_KEYS.SOMETHING_WENT_WRONG })
|
||||||
);
|
);
|
||||||
setIsClosingPosition(false);
|
|
||||||
},
|
|
||||||
onSuccess: (placeOrderPayload: Nullable<HumanReadablePlaceOrderPayload>) => {
|
|
||||||
setUnIndexedClientId(placeOrderPayload?.clientId);
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
setIsClosingPosition(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
const alertMessage = closePositionError && (
|
const alertMessage = closePositionError && (
|
||||||
@@ -193,7 +186,7 @@ export const ClosePositionForm = ({
|
|||||||
label={
|
label={
|
||||||
<>
|
<>
|
||||||
{stringGetter({ key: STRING_KEYS.AMOUNT })}
|
{stringGetter({ key: STRING_KEYS.AMOUNT })}
|
||||||
{id && <Tag>{id}</Tag>}
|
{symbol && <Tag>{symbol}</Tag>}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
decimals={stepSizeDecimals || TOKEN_DECIMALS}
|
decimals={stepSizeDecimals || TOKEN_DECIMALS}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { type FormEvent, useState, Ref, useCallback } from 'react';
|
import { type FormEvent, useState, useEffect, Ref } from 'react';
|
||||||
import styled, { AnyStyledComponent, css } from 'styled-components';
|
import styled, { AnyStyledComponent, css } from 'styled-components';
|
||||||
import { shallowEqual, useSelector } from 'react-redux';
|
import { shallowEqual, useSelector } from 'react-redux';
|
||||||
import type { NumberFormatValues, SourceInfo } from 'react-number-format';
|
import type { NumberFormatValues, SourceInfo } from 'react-number-format';
|
||||||
@@ -7,8 +7,6 @@ import { AlertType } from '@/constants/alerts';
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
ErrorType,
|
ErrorType,
|
||||||
type HumanReadablePlaceOrderPayload,
|
|
||||||
type Nullable,
|
|
||||||
TradeInputErrorAction,
|
TradeInputErrorAction,
|
||||||
TradeInputField,
|
TradeInputField,
|
||||||
ValidationError,
|
ValidationError,
|
||||||
@@ -21,7 +19,6 @@ import { InputErrorData, TradeBoxKeys, MobilePlaceOrderSteps } from '@/constants
|
|||||||
|
|
||||||
import { breakpoints } from '@/styles';
|
import { breakpoints } from '@/styles';
|
||||||
import { useStringGetter, useSubaccount } from '@/hooks';
|
import { useStringGetter, useSubaccount } from '@/hooks';
|
||||||
import { useOnLastOrderIndexed } from '@/hooks/useOnLastOrderIndexed';
|
|
||||||
|
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
import { formMixins } from '@/styles/formMixins';
|
import { formMixins } from '@/styles/formMixins';
|
||||||
@@ -37,6 +34,7 @@ import { WithTooltip } from '@/components/WithTooltip';
|
|||||||
|
|
||||||
import { Orderbook } from '@/views/tables/Orderbook';
|
import { Orderbook } from '@/views/tables/Orderbook';
|
||||||
|
|
||||||
|
import { calculateHasUncommittedOrders } from '@/state/accountSelectors';
|
||||||
import { getCurrentInput, useTradeFormData } from '@/state/inputsSelectors';
|
import { getCurrentInput, useTradeFormData } from '@/state/inputsSelectors';
|
||||||
import { getCurrentMarketConfig } from '@/state/perpetualsSelectors';
|
import { getCurrentMarketConfig } from '@/state/perpetualsSelectors';
|
||||||
|
|
||||||
@@ -99,6 +97,7 @@ export const TradeForm = ({
|
|||||||
} = useTradeFormData();
|
} = useTradeFormData();
|
||||||
|
|
||||||
const { limitPrice, triggerPrice, trailingPercent } = price || {};
|
const { limitPrice, triggerPrice, trailingPercent } = price || {};
|
||||||
|
const hasUncommittedOrders = useSelector(calculateHasUncommittedOrders);
|
||||||
const currentInput = useSelector(getCurrentInput);
|
const currentInput = useSelector(getCurrentInput);
|
||||||
const { tickSizeDecimals, stepSizeDecimals } =
|
const { tickSizeDecimals, stepSizeDecimals } =
|
||||||
useSelector(getCurrentMarketConfig, shallowEqual) || {};
|
useSelector(getCurrentMarketConfig, shallowEqual) || {};
|
||||||
@@ -155,33 +154,30 @@ export const TradeForm = ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onLastOrderIndexed = useCallback(() => {
|
useEffect(() => {
|
||||||
if (!currentStep || currentStep === MobilePlaceOrderSteps.PlacingOrder) {
|
// order has been placed
|
||||||
|
if (
|
||||||
|
(!currentStep || currentStep === MobilePlaceOrderSteps.PlacingOrder) &&
|
||||||
|
!hasUncommittedOrders
|
||||||
|
) {
|
||||||
setIsPlacingOrder(false);
|
setIsPlacingOrder(false);
|
||||||
abacusStateManager.clearTradeInputValues({ shouldResetSize: true });
|
abacusStateManager.clearTradeInputValues({ shouldResetSize: true });
|
||||||
setCurrentStep?.(MobilePlaceOrderSteps.Confirmation);
|
setCurrentStep?.(MobilePlaceOrderSteps.Confirmation);
|
||||||
}
|
}
|
||||||
}, [currentStep]);
|
}, [currentStep, hasUncommittedOrders]);
|
||||||
|
|
||||||
const { setUnIndexedClientId } = useOnLastOrderIndexed({
|
|
||||||
callback: onLastOrderIndexed,
|
|
||||||
});
|
|
||||||
|
|
||||||
const onPlaceOrder = async () => {
|
const onPlaceOrder = async () => {
|
||||||
setPlaceOrderError(undefined);
|
setPlaceOrderError(undefined);
|
||||||
setIsPlacingOrder(true);
|
setIsPlacingOrder(true);
|
||||||
|
|
||||||
await placeOrder({
|
await placeOrder({
|
||||||
onError: (errorParams?: { errorStringKey?: Nullable<string> }) => {
|
onError: (errorParams?: { errorStringKey?: string }) => {
|
||||||
setPlaceOrderError(
|
setPlaceOrderError(
|
||||||
stringGetter({ key: errorParams?.errorStringKey || STRING_KEYS.SOMETHING_WENT_WRONG })
|
stringGetter({ key: errorParams?.errorStringKey || STRING_KEYS.SOMETHING_WENT_WRONG })
|
||||||
);
|
);
|
||||||
|
|
||||||
setIsPlacingOrder(false);
|
setIsPlacingOrder(false);
|
||||||
},
|
},
|
||||||
onSuccess: (placeOrderPayload?: Nullable<HumanReadablePlaceOrderPayload>) => {
|
|
||||||
setUnIndexedClientId(placeOrderPayload?.clientId);
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { layoutMixins } from '@/styles/layoutMixins';
|
|||||||
import { formMixins } from '@/styles/formMixins';
|
import { formMixins } from '@/styles/formMixins';
|
||||||
|
|
||||||
import { TradeInputField } from '@/constants/abacus';
|
import { TradeInputField } from '@/constants/abacus';
|
||||||
import { STRING_KEYS, StringKey } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { INTEGER_DECIMALS } from '@/constants/numbers';
|
import { INTEGER_DECIMALS } from '@/constants/numbers';
|
||||||
import { TimeUnitShort } from '@/constants/time';
|
import { TimeUnitShort } from '@/constants/time';
|
||||||
import { GOOD_TIL_TIME_TIMESCALE_STRINGS } from '@/constants/trade';
|
import { GOOD_TIL_TIME_TIMESCALE_STRINGS } from '@/constants/trade';
|
||||||
@@ -29,12 +29,12 @@ export const AdvancedTradeOptions = () => {
|
|||||||
const currentTradeFormConfig = useSelector(getInputTradeOptions, shallowEqual);
|
const currentTradeFormConfig = useSelector(getInputTradeOptions, shallowEqual);
|
||||||
const inputTradeData = useSelector(getInputTradeData, shallowEqual);
|
const inputTradeData = useSelector(getInputTradeData, shallowEqual);
|
||||||
|
|
||||||
const { execution, goodTil, postOnly, reduceOnly, timeInForce } = inputTradeData || {};
|
const { execution, goodUntil, postOnly, reduceOnly, timeInForce } = inputTradeData || {};
|
||||||
|
|
||||||
const { executionOptions, needsGoodUntil, needsPostOnly, needsReduceOnly, timeInForceOptions } =
|
const { executionOptions, needsGoodUntil, needsPostOnly, needsReduceOnly, timeInForceOptions } =
|
||||||
currentTradeFormConfig || {};
|
currentTradeFormConfig || {};
|
||||||
|
|
||||||
const { duration, unit } = goodTil || {};
|
const { duration, unit } = goodUntil || {};
|
||||||
|
|
||||||
const needsExecution = executionOptions || needsPostOnly || needsReduceOnly;
|
const needsExecution = executionOptions || needsPostOnly || needsReduceOnly;
|
||||||
|
|
||||||
@@ -62,7 +62,7 @@ export const AdvancedTradeOptions = () => {
|
|||||||
<Styled.SelectItem
|
<Styled.SelectItem
|
||||||
key={type}
|
key={type}
|
||||||
value={type}
|
value={type}
|
||||||
label={stringGetter({ key: stringKey as StringKey })}
|
label={stringGetter({ key: stringKey })}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Styled.SelectMenu>
|
</Styled.SelectMenu>
|
||||||
@@ -76,7 +76,7 @@ export const AdvancedTradeOptions = () => {
|
|||||||
onChange={({ value }: NumberFormatValues) => {
|
onChange={({ value }: NumberFormatValues) => {
|
||||||
abacusStateManager.setTradeValue({
|
abacusStateManager.setTradeValue({
|
||||||
value: Number(value),
|
value: Number(value),
|
||||||
field: TradeInputField.goodTilDuration,
|
field: TradeInputField.goodUntilDuration,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
value={duration ?? ''}
|
value={duration ?? ''}
|
||||||
@@ -86,7 +86,7 @@ export const AdvancedTradeOptions = () => {
|
|||||||
onValueChange={(goodTilTimeTimescale: string) => {
|
onValueChange={(goodTilTimeTimescale: string) => {
|
||||||
abacusStateManager.setTradeValue({
|
abacusStateManager.setTradeValue({
|
||||||
value: goodTilTimeTimescale,
|
value: goodTilTimeTimescale,
|
||||||
field: TradeInputField.goodTilUnit,
|
field: TradeInputField.goodUntilUnit,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@@ -121,7 +121,7 @@ export const AdvancedTradeOptions = () => {
|
|||||||
<Styled.SelectItem
|
<Styled.SelectItem
|
||||||
key={type}
|
key={type}
|
||||||
value={type}
|
value={type}
|
||||||
label={stringGetter({ key: stringKey as StringKey })}
|
label={stringGetter({ key: stringKey })}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Styled.SelectMenu>
|
</Styled.SelectMenu>
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import { TRADE_TYPE_STRINGS, MobilePlaceOrderSteps } from '@/constants/trade';
|
|||||||
|
|
||||||
import { useStringGetter } from '@/hooks';
|
import { useStringGetter } from '@/hooks';
|
||||||
|
|
||||||
import { AssetIcon } from '@/components/AssetIcon';
|
|
||||||
import { Button } from '@/components/Button';
|
import { Button } from '@/components/Button';
|
||||||
import { Output, OutputType, ShowSign } from '@/components/Output';
|
import { Output, OutputType, ShowSign } from '@/components/Output';
|
||||||
import { WithDetailsReceipt } from '@/components/WithDetailsReceipt';
|
import { WithDetailsReceipt } from '@/components/WithDetailsReceipt';
|
||||||
@@ -63,7 +62,7 @@ export const PlaceOrderButtonAndReceipt = ({
|
|||||||
const selectedTradeType = getSelectedTradeType(type);
|
const selectedTradeType = getSelectedTradeType(type);
|
||||||
const selectedOrderSide = getSelectedOrderSide(side);
|
const selectedOrderSide = getSelectedOrderSide(side);
|
||||||
|
|
||||||
const { fee, price: expectedPrice, total, reward } = summary || {};
|
const { fee, price: expectedPrice, total } = summary || {};
|
||||||
|
|
||||||
const items = [
|
const items = [
|
||||||
{
|
{
|
||||||
@@ -80,17 +79,6 @@ export const PlaceOrderButtonAndReceipt = ({
|
|||||||
label: stringGetter({ key: STRING_KEYS.FEE }),
|
label: stringGetter({ key: STRING_KEYS.FEE }),
|
||||||
value: <Output type={OutputType.Fiat} value={fee} useGrouping />,
|
value: <Output type={OutputType.Fiat} value={fee} useGrouping />,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
key: 'max-reward',
|
|
||||||
label: (
|
|
||||||
<>
|
|
||||||
{stringGetter({ key: STRING_KEYS.MAXIMUM_REWARDS })}
|
|
||||||
{/* <AssetIcon symbol="DYDX" /> */}
|
|
||||||
</>
|
|
||||||
),
|
|
||||||
value: <Output type={OutputType.Asset} value={reward} useGrouping tag={reward ? "Dv4TNT" : ''} />,
|
|
||||||
tooltip: 'max-reward',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: 'total',
|
key: 'total',
|
||||||
label: stringGetter({ key: STRING_KEYS.TOTAL }),
|
label: stringGetter({ key: STRING_KEYS.TOTAL }),
|
||||||
@@ -148,7 +136,7 @@ export const PlaceOrderButtonAndReceipt = ({
|
|||||||
|
|
||||||
const buttonState = currentStep
|
const buttonState = currentStep
|
||||||
? buttonStatesPerStep[currentStep].buttonState
|
? buttonStatesPerStep[currentStep].buttonState
|
||||||
: { isDisabled: !shouldEnableTrade || isLoading, isLoading };
|
: { isDisabled: !shouldEnableTrade, isLoading };
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WithDetailsReceipt detailItems={items}>
|
<WithDetailsReceipt detailItems={items}>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ type ElementProps = {
|
|||||||
export const PositionPreview = ({ showNarrowVariation }: ElementProps) => {
|
export const PositionPreview = ({ showNarrowVariation }: ElementProps) => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
|
|
||||||
const { id } = useSelector(getCurrentMarketAssetData, shallowEqual) || {};
|
const { symbol } = useSelector(getCurrentMarketAssetData, shallowEqual) || {};
|
||||||
const { configs, oraclePrice } = useSelector(getCurrentMarketData, shallowEqual) || {};
|
const { configs, oraclePrice } = useSelector(getCurrentMarketData, shallowEqual) || {};
|
||||||
const { size: positionSize } = useSelector(getCurrentMarketPositionData, shallowEqual) || {};
|
const { size: positionSize } = useSelector(getCurrentMarketPositionData, shallowEqual) || {};
|
||||||
const { stepSizeDecimals, tickSizeDecimals } = configs || {};
|
const { stepSizeDecimals, tickSizeDecimals } = configs || {};
|
||||||
@@ -29,12 +29,12 @@ export const PositionPreview = ({ showNarrowVariation }: ElementProps) => {
|
|||||||
return (
|
return (
|
||||||
<Styled.PositionPreviewContainer>
|
<Styled.PositionPreviewContainer>
|
||||||
<Styled.YourPosition>
|
<Styled.YourPosition>
|
||||||
{!showNarrowVariation && <AssetIcon symbol={id} />}
|
{!showNarrowVariation && <AssetIcon symbol={symbol} />}
|
||||||
<span>
|
<span>
|
||||||
{stringGetter({
|
{stringGetter({
|
||||||
key: STRING_KEYS.YOUR_MARKET_POSITION,
|
key: STRING_KEYS.YOUR_MARKET_POSITION,
|
||||||
params: {
|
params: {
|
||||||
MARKET: showNarrowVariation ? '' : <strong>{id ?? ''}</strong>,
|
MARKET: showNarrowVariation ? '' : <strong>{symbol ?? ''}</strong>,
|
||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
</span>
|
</span>
|
||||||
@@ -44,7 +44,7 @@ export const PositionPreview = ({ showNarrowVariation }: ElementProps) => {
|
|||||||
oraclePrice={oraclePrice}
|
oraclePrice={oraclePrice}
|
||||||
postOrderSize={positionSize?.postOrder}
|
postOrderSize={positionSize?.postOrder}
|
||||||
stepSizeDecimals={stepSizeDecimals}
|
stepSizeDecimals={stepSizeDecimals}
|
||||||
symbol={id || undefined}
|
symbol={symbol || undefined}
|
||||||
tickSizeDecimals={tickSizeDecimals}
|
tickSizeDecimals={tickSizeDecimals}
|
||||||
showNarrowVariation={showNarrowVariation}
|
showNarrowVariation={showNarrowVariation}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const TradeSizeInputs = () => {
|
|||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const { isTablet } = useBreakpoints();
|
const { isTablet } = useBreakpoints();
|
||||||
|
|
||||||
const { id } = useSelector(getCurrentMarketAssetData, shallowEqual) || {};
|
const { symbol } = useSelector(getCurrentMarketAssetData, shallowEqual) || {};
|
||||||
const inputTradeSizeData = useSelector(getInputTradeSizeData, shallowEqual);
|
const inputTradeSizeData = useSelector(getInputTradeSizeData, shallowEqual);
|
||||||
const currentTradeInputOptions = useSelector(getInputTradeOptions, shallowEqual);
|
const currentTradeInputOptions = useSelector(getInputTradeOptions, shallowEqual);
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ export const TradeSizeInputs = () => {
|
|||||||
shape={ButtonShape.Square}
|
shape={ButtonShape.Square}
|
||||||
>
|
>
|
||||||
<Icon iconName={IconName.Trade} />
|
<Icon iconName={IconName.Trade} />
|
||||||
{showUSDCInputOnTablet ? 'USD' : id}
|
{showUSDCInputOnTablet ? 'USD' : symbol}
|
||||||
</Styled.ToggleButton>
|
</Styled.ToggleButton>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -105,10 +105,10 @@ export const TradeSizeInputs = () => {
|
|||||||
onInput={onSizeInput}
|
onInput={onSizeInput}
|
||||||
label={
|
label={
|
||||||
<>
|
<>
|
||||||
<WithTooltip tooltip="order-amount" stringParams={{ SYMBOL: id ?? '' }} side="right">
|
<WithTooltip tooltip="order-amount" stringParams={{ SYMBOL: symbol ?? '' }} side="right">
|
||||||
{stringGetter({ key: STRING_KEYS.AMOUNT })}
|
{stringGetter({ key: STRING_KEYS.AMOUNT })}
|
||||||
</WithTooltip>
|
</WithTooltip>
|
||||||
{id && <Tag>{id}</Tag>}
|
{symbol && <Tag>{symbol}</Tag>}
|
||||||
</>
|
</>
|
||||||
}
|
}
|
||||||
slotRight={isTablet && inputToggleButton}
|
slotRight={isTablet && inputToggleButton}
|
||||||
@@ -126,7 +126,11 @@ export const TradeSizeInputs = () => {
|
|||||||
decimals={tickSizeDecimals || USD_DECIMALS}
|
decimals={tickSizeDecimals || USD_DECIMALS}
|
||||||
label={
|
label={
|
||||||
<>
|
<>
|
||||||
<WithTooltip tooltip="order-amount-usd" stringParams={{ SYMBOL: id ?? '' }} side="right">
|
<WithTooltip
|
||||||
|
tooltip="order-amount-usd"
|
||||||
|
stringParams={{ SYMBOL: symbol ?? '' }}
|
||||||
|
side="right"
|
||||||
|
>
|
||||||
{stringGetter({ key: STRING_KEYS.AMOUNT })}
|
{stringGetter({ key: STRING_KEYS.AMOUNT })}
|
||||||
</WithTooltip>
|
</WithTooltip>
|
||||||
<Tag>USD</Tag>
|
<Tag>USD</Tag>
|
||||||
|
|||||||
@@ -11,13 +11,9 @@ import { TransferInputField, TransferType } from '@/constants/abacus';
|
|||||||
import { AlertType } from '@/constants/alerts';
|
import { AlertType } from '@/constants/alerts';
|
||||||
import { ButtonShape, ButtonSize } from '@/constants/buttons';
|
import { ButtonShape, ButtonSize } from '@/constants/buttons';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
import { CLIENT_NETWORK_CONFIGS } from '@/constants/networks';
|
||||||
import { NumberSign, QUANTUM_MULTIPLIER } from '@/constants/numbers';
|
import { NumberSign, QUANTUM_MULTIPLIER } from '@/constants/numbers';
|
||||||
import {
|
import { DYDX_CHAIN_ASSET_COIN_DENOM, DydxChainAsset } from '@/constants/wallets';
|
||||||
DYDX_CHAIN_ASSET_COIN_DENOM,
|
|
||||||
DYDX_CHAIN_ASSET_TAGS,
|
|
||||||
DydxChainAsset,
|
|
||||||
} from '@/constants/wallets';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useAccountBalance,
|
useAccountBalance,
|
||||||
@@ -56,6 +52,28 @@ type TransferFormProps = {
|
|||||||
className?: string;
|
className?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const debouncedEstimateFee = debounce(
|
||||||
|
async ({ amount, recipientAddress, asset, setFees, simulateTransfer }) => {
|
||||||
|
if (!amount || !recipientAddress) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const coinDenom = DYDX_CHAIN_ASSET_COIN_DENOM[asset as DydxChainAsset];
|
||||||
|
const stdFee: StdFee = await simulateTransfer(amount, recipientAddress, coinDenom);
|
||||||
|
|
||||||
|
const fee = stdFee?.amount.find((coin) => coin.denom === coinDenom)?.amount;
|
||||||
|
const feeAmount = MustBigNumber(fee).div(QUANTUM_MULTIPLIER).toNumber();
|
||||||
|
|
||||||
|
setFees(feeAmount);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('TransferForm > : debouncedEstimateFee > ', error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
1000,
|
||||||
|
{ trailing: true }
|
||||||
|
);
|
||||||
|
|
||||||
export const TransferForm = ({
|
export const TransferForm = ({
|
||||||
selectedAsset = DydxChainAsset.DYDX,
|
selectedAsset = DydxChainAsset.DYDX,
|
||||||
onDone,
|
onDone,
|
||||||
@@ -64,12 +82,8 @@ export const TransferForm = ({
|
|||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const { freeCollateral } = useSelector(getSubaccount, shallowEqual) || {};
|
const { freeCollateral } = useSelector(getSubaccount, shallowEqual) || {};
|
||||||
const { dydxAddress } = useAccounts();
|
const { dydxAddress } = useAccounts();
|
||||||
const {
|
const { address: recipientAddress, size } = useSelector(getTransferInputs, shallowEqual) || {};
|
||||||
address: recipientAddress,
|
const { transfer, simulateTransfer } = useSubaccount();
|
||||||
size,
|
|
||||||
fee,
|
|
||||||
} = useSelector(getTransferInputs, shallowEqual) || {};
|
|
||||||
const { transfer } = useSubaccount();
|
|
||||||
const { nativeTokenBalance, usdcBalance } = useAccountBalance();
|
const { nativeTokenBalance, usdcBalance } = useAccountBalance();
|
||||||
const { selectedNetwork } = useSelectedNetwork();
|
const { selectedNetwork } = useSelectedNetwork();
|
||||||
|
|
||||||
@@ -79,6 +93,7 @@ export const TransferForm = ({
|
|||||||
// Form states
|
// Form states
|
||||||
const [error, setError] = useState<Error | undefined>();
|
const [error, setError] = useState<Error | undefined>();
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
const [fees, setFees] = useState<number>();
|
||||||
|
|
||||||
const balance = asset === DydxChainAsset.USDC ? freeCollateral?.current : nativeTokenBalance;
|
const balance = asset === DydxChainAsset.USDC ? freeCollateral?.current : nativeTokenBalance;
|
||||||
const newBalance =
|
const newBalance =
|
||||||
@@ -89,7 +104,7 @@ export const TransferForm = ({
|
|||||||
.toNumber();
|
.toNumber();
|
||||||
const amount = asset === DydxChainAsset.USDC ? size?.usdcSize : size?.size;
|
const amount = asset === DydxChainAsset.USDC ? size?.usdcSize : size?.size;
|
||||||
|
|
||||||
const showNotEnoughGasWarning = fee && asset === DydxChainAsset.USDC && usdcBalance < fee;
|
const showNotEnoughGasWarning = fees && asset === DydxChainAsset.USDC && usdcBalance < fees;
|
||||||
|
|
||||||
// BN
|
// BN
|
||||||
const amountBN = MustBigNumber(amount);
|
const amountBN = MustBigNumber(amount);
|
||||||
@@ -119,21 +134,34 @@ export const TransferForm = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setError(undefined);
|
setError(undefined);
|
||||||
abacusStateManager.setTransferValue({
|
debouncedEstimateFee.cancel();
|
||||||
value: asset,
|
|
||||||
field: TransferInputField.token,
|
if (isAmountValid && isAddressValid) {
|
||||||
});
|
debouncedEstimateFee({
|
||||||
|
amount,
|
||||||
|
recipientAddress,
|
||||||
|
asset,
|
||||||
|
setFees,
|
||||||
|
simulateTransfer,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
setFees(undefined);
|
||||||
|
}
|
||||||
|
}, [asset, amount, recipientAddress]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setError(undefined);
|
||||||
}, [asset]);
|
}, [asset]);
|
||||||
|
|
||||||
const onTransfer = async () => {
|
const onTransfer = async () => {
|
||||||
if (!isAmountValid || !isAddressValid || !fee) return;
|
if (!isAmountValid || !isAddressValid || !fees) return;
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
setError(undefined);
|
setError(undefined);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Subtract fees from amount if sending native tokens
|
// Subtract fees from amount if sending native tokens
|
||||||
const amountToTransfer = (
|
const amountToTransfer = (
|
||||||
asset === DydxChainAsset.DYDX ? amountBN.minus(fee) : amountBN
|
asset === DydxChainAsset.DYDX ? amountBN.minus(fees) : amountBN
|
||||||
).toNumber();
|
).toNumber();
|
||||||
|
|
||||||
const txResponse = await transfer(
|
const txResponse = await transfer(
|
||||||
@@ -184,7 +212,7 @@ export const TransferForm = ({
|
|||||||
value: DydxChainAsset.USDC,
|
value: DydxChainAsset.USDC,
|
||||||
label: (
|
label: (
|
||||||
<Styled.InlineRow>
|
<Styled.InlineRow>
|
||||||
<AssetIcon symbol="USDC" /> {DYDX_CHAIN_ASSET_TAGS[DydxChainAsset.USDC]}
|
<AssetIcon symbol="USDC" /> USDC
|
||||||
</Styled.InlineRow>
|
</Styled.InlineRow>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@@ -193,7 +221,7 @@ export const TransferForm = ({
|
|||||||
label: (
|
label: (
|
||||||
<Styled.InlineRow>
|
<Styled.InlineRow>
|
||||||
{/* <AssetIcon symbol="DYDX" /> */}
|
{/* <AssetIcon symbol="DYDX" /> */}
|
||||||
{DYDX_CHAIN_ASSET_TAGS[DydxChainAsset.DYDX]}
|
Dv4TNT
|
||||||
</Styled.InlineRow>
|
</Styled.InlineRow>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@@ -201,7 +229,7 @@ export const TransferForm = ({
|
|||||||
|
|
||||||
const networkOptions = [
|
const networkOptions = [
|
||||||
{
|
{
|
||||||
chainId: ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId,
|
chainId: CLIENT_NETWORK_CONFIGS[selectedNetwork].dydxChainId,
|
||||||
label: (
|
label: (
|
||||||
<Styled.InlineRow>
|
<Styled.InlineRow>
|
||||||
<AssetIcon symbol="DYDX" /> {stringGetter({ key: STRING_KEYS.DYDX_CHAIN })}
|
<AssetIcon symbol="DYDX" /> {stringGetter({ key: STRING_KEYS.DYDX_CHAIN })}
|
||||||
@@ -215,7 +243,7 @@ export const TransferForm = ({
|
|||||||
key: 'amount',
|
key: 'amount',
|
||||||
label: (
|
label: (
|
||||||
<span>
|
<span>
|
||||||
{stringGetter({ key: STRING_KEYS.AVAILABLE })} <Tag>{DYDX_CHAIN_ASSET_TAGS[asset]}</Tag>
|
{stringGetter({ key: STRING_KEYS.AVAILABLE })} <Tag>{asset}</Tag>
|
||||||
</span>
|
</span>
|
||||||
),
|
),
|
||||||
value: (
|
value: (
|
||||||
@@ -291,7 +319,7 @@ export const TransferForm = ({
|
|||||||
/>
|
/>
|
||||||
<Styled.NetworkSelectMenu
|
<Styled.NetworkSelectMenu
|
||||||
label={stringGetter({ key: STRING_KEYS.NETWORK })}
|
label={stringGetter({ key: STRING_KEYS.NETWORK })}
|
||||||
value={ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId}
|
value={CLIENT_NETWORK_CONFIGS[selectedNetwork].dydxChainId}
|
||||||
slotTriggerAfter={null}
|
slotTriggerAfter={null}
|
||||||
>
|
>
|
||||||
{networkOptions.map(({ chainId, label }) => (
|
{networkOptions.map(({ chainId, label }) => (
|
||||||
@@ -347,9 +375,9 @@ export const TransferForm = ({
|
|||||||
<Styled.Footer>
|
<Styled.Footer>
|
||||||
<TransferButtonAndReceipt
|
<TransferButtonAndReceipt
|
||||||
selectedAsset={asset}
|
selectedAsset={asset}
|
||||||
fees={fee || undefined}
|
fees={fees}
|
||||||
isDisabled={!isAmountValid || !isAddressValid || !fee}
|
isDisabled={!isAmountValid || !isAddressValid || !fees}
|
||||||
isLoading={isLoading || Boolean(isAmountValid && isAddressValid && !fee)}
|
isLoading={isLoading || Boolean(isAmountValid && isAddressValid && !fees)}
|
||||||
/>
|
/>
|
||||||
</Styled.Footer>
|
</Styled.Footer>
|
||||||
</Styled.Form>
|
</Styled.Form>
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { shallowEqual, useSelector } from 'react-redux';
|
|||||||
import { ButtonAction, ButtonSize, ButtonType } from '@/constants/buttons';
|
import { ButtonAction, ButtonSize, ButtonType } from '@/constants/buttons';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { NumberSign } from '@/constants/numbers';
|
import { NumberSign } from '@/constants/numbers';
|
||||||
import { DYDX_CHAIN_ASSET_TAGS, DydxChainAsset } from '@/constants/wallets';
|
import { DydxChainAsset } from '@/constants/wallets';
|
||||||
|
|
||||||
import { useAccountBalance, useStringGetter } from '@/hooks';
|
import { useAccountBalance, useStringGetter } from '@/hooks';
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ export const TransferButtonAndReceipt = ({
|
|||||||
key: 'fees',
|
key: 'fees',
|
||||||
label: (
|
label: (
|
||||||
<span>
|
<span>
|
||||||
{stringGetter({ key: STRING_KEYS.FEES })} <Tag>{DYDX_CHAIN_ASSET_TAGS[selectedAsset]}</Tag>
|
{stringGetter({ key: STRING_KEYS.FEES })} <Tag>{selectedAsset}</Tag>
|
||||||
</span>
|
</span>
|
||||||
),
|
),
|
||||||
value: <Output type={OutputType.Asset} value={fees} />,
|
value: <Output type={OutputType.Asset} value={fees} />,
|
||||||
@@ -69,7 +69,7 @@ export const TransferButtonAndReceipt = ({
|
|||||||
key: 'balance',
|
key: 'balance',
|
||||||
label: (
|
label: (
|
||||||
<span>
|
<span>
|
||||||
{stringGetter({ key: STRING_KEYS.BALANCE })} <Tag>{DYDX_CHAIN_ASSET_TAGS[selectedAsset]}</Tag>
|
{stringGetter({ key: STRING_KEYS.BALANCE })} <Tag>{selectedAsset}</Tag>
|
||||||
</span>
|
</span>
|
||||||
),
|
),
|
||||||
value: (
|
value: (
|
||||||
|
|||||||
@@ -129,13 +129,15 @@ export const useGlobalCommands = (): MenuConfig<string, string> => {
|
|||||||
{
|
{
|
||||||
value: NavItems.NavigateToMarket,
|
value: NavItems.NavigateToMarket,
|
||||||
label: 'Navigate to Market',
|
label: 'Navigate to Market',
|
||||||
subitems: joinedPerpetualMarketsAndAssets.map(({ market = '', name = '', id = '' }) => ({
|
subitems: joinedPerpetualMarketsAndAssets.map(
|
||||||
value: market,
|
({ market = '', name = '', symbol = '' }) => ({
|
||||||
slotBefore: <AssetIcon symbol={id} />,
|
value: market, // `${market}|${name}`,
|
||||||
label: name,
|
slotBefore: <AssetIcon symbol={symbol} />,
|
||||||
tag: id,
|
label: name,
|
||||||
onSelect: () => navigate(`/trade/${market}`),
|
tag: symbol, // <abbr>{symbol}</abbr>,
|
||||||
})),
|
onSelect: () => navigate(`/trade/${market}`),
|
||||||
|
})
|
||||||
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import { type MenuItem } from '@/constants/menus';
|
import { type MenuItem } from '@/constants/menus';
|
||||||
import {
|
import { type DydxNetwork, NETWORK_ENDPOINTS } from '@/constants/networks';
|
||||||
AVAILABLE_ENVIRONMENTS,
|
import { useStringGetter } from '@/hooks';
|
||||||
type DydxNetwork,
|
|
||||||
ENVIRONMENT_CONFIG_MAP,
|
|
||||||
} from '@/constants/networks';
|
|
||||||
|
|
||||||
export const useNetworks = (): MenuItem<DydxNetwork>[] =>
|
export const useNetworks = (): MenuItem<DydxNetwork>[] => {
|
||||||
(AVAILABLE_ENVIRONMENTS.environments as DydxNetwork[]).map((dydxNetwork) => ({
|
const stringGetter = useStringGetter();
|
||||||
key: dydxNetwork,
|
|
||||||
label: ENVIRONMENT_CONFIG_MAP[dydxNetwork].name,
|
return NETWORK_ENDPOINTS.environments.map(({ stringKey, environment }) => ({
|
||||||
value: dydxNetwork,
|
key: environment,
|
||||||
|
label: stringGetter({ key: stringKey }),
|
||||||
|
value: environment,
|
||||||
}));
|
}));
|
||||||
|
};
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ const getFillsTableColumnDef = ({
|
|||||||
label: `${stringGetter({ key: STRING_KEYS.TYPE })} / ${stringGetter({
|
label: `${stringGetter({ key: STRING_KEYS.TYPE })} / ${stringGetter({
|
||||||
key: STRING_KEYS.AMOUNT,
|
key: STRING_KEYS.AMOUNT,
|
||||||
})}`,
|
})}`,
|
||||||
renderCell: ({ resources, size, stepSizeDecimals, asset: { id } }) => (
|
renderCell: ({ resources, size, stepSizeDecimals, asset: { symbol } }) => (
|
||||||
<TableCell stacked slotLeft={<Styled.AssetIcon symbol={id} />}>
|
<TableCell stacked slotLeft={<Styled.AssetIcon symbol={symbol} />}>
|
||||||
<span>
|
<span>
|
||||||
{resources.typeStringKey ? stringGetter({ key: resources.typeStringKey }) : null}
|
{resources.typeStringKey ? stringGetter({ key: resources.typeStringKey }) : null}
|
||||||
</span>
|
</span>
|
||||||
@@ -161,7 +161,7 @@ const getFillsTableColumnDef = ({
|
|||||||
}[orderSide],
|
}[orderSide],
|
||||||
})}
|
})}
|
||||||
</Styled.Side>
|
</Styled.Side>
|
||||||
<Output type={OutputType.Text} value={asset.id} />
|
<Output type={OutputType.Text} value={asset.symbol} />
|
||||||
</Styled.TableCell>
|
</Styled.TableCell>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@@ -325,7 +325,9 @@ export const FillsTable = ({
|
|||||||
if (hasUnseenFillUpdates) dispatch(viewedFills());
|
if (hasUnseenFillUpdates) dispatch(viewedFills());
|
||||||
}, [hasUnseenFillUpdates]);
|
}, [hasUnseenFillUpdates]);
|
||||||
|
|
||||||
const symbol = currentMarket ? allAssets[allPerpetualMarkets[currentMarket]?.assetId]?.id : null;
|
const symbol = currentMarket
|
||||||
|
? allAssets[allPerpetualMarkets[currentMarket]?.assetId]?.symbol
|
||||||
|
: null;
|
||||||
|
|
||||||
const fillsData = fills.map((fill: SubaccountFill) =>
|
const fillsData = fills.map((fill: SubaccountFill) =>
|
||||||
getHydratedTradingData({
|
getHydratedTradingData({
|
||||||
|
|||||||
@@ -12,10 +12,7 @@ import { MarketTableCell } from '@/components/Table/MarketTableCell';
|
|||||||
import { Output, OutputType } from '@/components/Output';
|
import { Output, OutputType } from '@/components/Output';
|
||||||
import { Table, TableCell, type ColumnDef } from '@/components/Table';
|
import { Table, TableCell, type ColumnDef } from '@/components/Table';
|
||||||
|
|
||||||
import {
|
import { getCurrentMarketFundingPayments, getSubaccountFundingPayments } from '@/state/accountSelectors';
|
||||||
getCurrentMarketFundingPayments,
|
|
||||||
getSubaccountFundingPayments,
|
|
||||||
} from '@/state/accountSelectors';
|
|
||||||
import { getAssets } from '@/state/assetsSelectors';
|
import { getAssets } from '@/state/assetsSelectors';
|
||||||
import { getPerpetualMarkets } from '@/state/perpetualsSelectors';
|
import { getPerpetualMarkets } from '@/state/perpetualsSelectors';
|
||||||
|
|
||||||
@@ -114,7 +111,7 @@ export const FundingPaymentsTable = ({
|
|||||||
type={OutputType.Asset}
|
type={OutputType.Asset}
|
||||||
value={Math.abs(positionSize)}
|
value={Math.abs(positionSize)}
|
||||||
fractionDigits={stepSizeDecimals}
|
fractionDigits={stepSizeDecimals}
|
||||||
tag={asset.id}
|
tag={asset.symbol}
|
||||||
/>
|
/>
|
||||||
<Styled.Output
|
<Styled.Output
|
||||||
type={OutputType.Text}
|
type={OutputType.Text}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const LiveTrades = ({ className, histogramSide = 'left' }: StyleProps) =>
|
|||||||
const currentMarketConfig = useSelector(getCurrentMarketConfig, shallowEqual);
|
const currentMarketConfig = useSelector(getCurrentMarketConfig, shallowEqual);
|
||||||
const currentMarketLiveTrades = useSelector(getCurrentMarketLiveTrades, shallowEqual) || [];
|
const currentMarketLiveTrades = useSelector(getCurrentMarketLiveTrades, shallowEqual) || [];
|
||||||
|
|
||||||
const { id = '' } = currentMarketAssetData ?? {};
|
const { symbol = '' } = currentMarketAssetData ?? {};
|
||||||
const { stepSizeDecimals, tickSizeDecimals } = currentMarketConfig || {};
|
const { stepSizeDecimals, tickSizeDecimals } = currentMarketConfig || {};
|
||||||
|
|
||||||
const rows = currentMarketLiveTrades.map(
|
const rows = currentMarketLiveTrades.map(
|
||||||
@@ -84,7 +84,7 @@ export const LiveTrades = ({ className, histogramSide = 'left' }: StyleProps) =>
|
|||||||
columnKey: 'size',
|
columnKey: 'size',
|
||||||
getCellValue: (row: RowData) => row.size,
|
getCellValue: (row: RowData) => row.size,
|
||||||
label: stringGetter({ key: STRING_KEYS.SIZE }),
|
label: stringGetter({ key: STRING_KEYS.SIZE }),
|
||||||
tag: id,
|
tag: symbol,
|
||||||
renderCell: (row: RowData) => (
|
renderCell: (row: RowData) => (
|
||||||
<Styled.SizeOutput
|
<Styled.SizeOutput
|
||||||
type={OutputType.Asset}
|
type={OutputType.Asset}
|
||||||
@@ -111,7 +111,7 @@ export const LiveTrades = ({ className, histogramSide = 'left' }: StyleProps) =>
|
|||||||
},
|
},
|
||||||
!isTablet && timeColumn,
|
!isTablet && timeColumn,
|
||||||
].filter(isTruthy);
|
].filter(isTruthy);
|
||||||
}, [stepSizeDecimals, tickSizeDecimals, id, histogramSide, stringGetter]);
|
}, [stepSizeDecimals, tickSizeDecimals, symbol, histogramSide, stringGetter]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Styled.LiveTradesTable
|
<Styled.LiveTradesTable
|
||||||
|
|||||||
@@ -37,7 +37,9 @@ export const MarketsTable = ({ className }: { className?: string }) => {
|
|||||||
columnKey: 'market',
|
columnKey: 'market',
|
||||||
getCellValue: (row) => row.market,
|
getCellValue: (row) => row.market,
|
||||||
label: stringGetter({ key: STRING_KEYS.MARKET }),
|
label: stringGetter({ key: STRING_KEYS.MARKET }),
|
||||||
renderCell: ({ asset, id }) => <Styled.MarketTableCell asset={asset} marketId={id} />,
|
renderCell: ({ asset, id }) => (
|
||||||
|
<Styled.MarketTableCell asset={asset} marketId={id} />
|
||||||
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
columnKey: 'price',
|
columnKey: 'price',
|
||||||
@@ -142,7 +144,7 @@ export const MarketsTable = ({ className }: { className?: string }) => {
|
|||||||
fractionDigits={LARGE_TOKEN_DECIMALS}
|
fractionDigits={LARGE_TOKEN_DECIMALS}
|
||||||
type={OutputType.Number}
|
type={OutputType.Number}
|
||||||
value={row.openInterest}
|
value={row.openInterest}
|
||||||
tag={row.asset?.id}
|
tag={row.asset?.symbol}
|
||||||
/>
|
/>
|
||||||
<Output
|
<Output
|
||||||
type={OutputType.Fiat}
|
type={OutputType.Fiat}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import styled, { AnyStyledComponent } from 'styled-components';
|
import styled, { AnyStyledComponent } from 'styled-components';
|
||||||
|
|
||||||
import { AbacusOrderStatus, type OrderStatus } from '@/constants/abacus';
|
import { AbacusOrderStatus, type OrderStatus } from '@/constants/abacus';
|
||||||
@@ -29,7 +29,8 @@ export const OrderActionsCell = ({ orderId, status, isDisabled }: ElementProps)
|
|||||||
|
|
||||||
const onCancel = useCallback(async () => {
|
const onCancel = useCallback(async () => {
|
||||||
setIsCanceling(true);
|
setIsCanceling(true);
|
||||||
await cancelOrder({ orderId, onError: () => setIsCanceling(false) });
|
await cancelOrder({ orderId });
|
||||||
|
setIsCanceling(false);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -72,13 +72,13 @@ const getPositionsTableColumnDef = ({
|
|||||||
getCellValue: (row) => row.id,
|
getCellValue: (row) => row.id,
|
||||||
label: stringGetter({ key: STRING_KEYS.DETAILS }),
|
label: stringGetter({ key: STRING_KEYS.DETAILS }),
|
||||||
renderCell: ({ id, asset, leverage, resources, size }) => (
|
renderCell: ({ id, asset, leverage, resources, size }) => (
|
||||||
<TableCell stacked slotLeft={<Styled.AssetIcon symbol={asset?.id} />}>
|
<TableCell stacked slotLeft={<Styled.AssetIcon symbol={asset?.symbol} />}>
|
||||||
<Styled.HighlightOutput
|
<Styled.HighlightOutput
|
||||||
type={OutputType.Asset}
|
type={OutputType.Asset}
|
||||||
value={size?.current}
|
value={size?.current}
|
||||||
fractionDigits={TOKEN_DECIMALS}
|
fractionDigits={TOKEN_DECIMALS}
|
||||||
showSign={ShowSign.None}
|
showSign={ShowSign.None}
|
||||||
tag={asset?.id}
|
tag={asset?.symbol}
|
||||||
/>
|
/>
|
||||||
<Styled.InlineRow>
|
<Styled.InlineRow>
|
||||||
<Styled.PositionSide>
|
<Styled.PositionSide>
|
||||||
|
|||||||
Reference in New Issue
Block a user