Compare commits

..
Author SHA1 Message Date
jaredvu a123976646 notification adjustments 2023-09-06 13:53:38 -07:00
jaredvu 788fed9c26 Merge branch 'main' into abacus-tracking 2023-09-05 15:03:36 -07:00
Bill 564192fa2b Deposit/Withdraw status notifications (#9)
* Deposit/Withdraw status notifications

* prevent log out during switch accounts

* fix merge

* check for token approval

* address comments

* update lock

* wait for approval

* address comments
2023-09-05 13:04:53 -07:00
jaredvu b8526a5568 Merge branch 'main' into abacus-tracking 2023-09-05 13:01:07 -07:00
Rui 102b1702ff Add wallets PNGs to be used on mobile (#21) 2023-09-05 12:58:36 -07:00
Jared Vu 2b888001aa Update Onboarding logs and utilize helper functions (#20)
* Handle wallet signing rejection

* nits

* selectedWalletError -> string
2023-09-05 09:59:27 -07:00
Jared Vu d4c149af12 Conditional limit validation (#17)
* abacus 0.4.3

* Add new strings, bump abacus, fix order validation error

* Use STRING_KEYS as ORDER_ERRORS_MAP valu

* remove unused import
2023-09-05 09:56:12 -07:00
jaredvu b0cd8e71ac add tracking protocol 2023-09-02 14:25:23 -07:00
aleka ffde6ed0fc add transfer insufficient usdc gas warning (#19) 2023-09-01 17:51:02 -04:00
Jared Vu 6ac94e5949 Show outline only on focus-within (#18) 2023-09-01 14:01:15 -07:00
James Jia c067206cd1 update LICENSE (#16) 2023-09-01 15:40:04 -04:00
aleka 30187ef69f add new optimized market icons (#15)
* add new optimized market icons
2023-08-31 17:43:25 -04:00
Jared Vu 7d1b9eb65f Adopt v4-localization STRING_KEYS and translation files (#13)
* Delete old localization files

* nits

* @dydxprotocol/v4-localization: 0.0.21

* TAKE_PROFIT -> TAKE_PROFIT_LIMIT
2023-08-31 10:50:41 -07:00
aleka 1835b42bb0 ChainQueriesProtocol -> ChainTransactionsProtocol (#14) 2023-08-31 13:35:51 -04:00
aleka 37a50def99 AssetIcon .svg -> .png (#11) 2023-08-30 18:28:30 -04:00
Jared Vu a97f296905 Utilize v4-localization for Environment Endpoints (#7)
* add abacusFileSystem protocol

* Use v4-localization endpoints, replace old usage of CLIENT_NETWORK_CONFIGS

* remove squidRouter switchNetwork calls, bump abacus

* use ENDPOINTS_PATH to keep abacus/fileSystem consistent

* use NETWORK_ENDPOINTS const

* @dydxprotocol/v4-client -> @dydxprotocol/v4-client-js

* use v4-client-js

* WithdrawForm: Use v4-client-js

* Fix undefined Symbol

* Bump v4-localization
2023-08-30 15:12:40 -04:00
Rui 683d806f44 Add asset PNGs of 128x128 (#10) 2023-08-30 11:23:01 -07:00
Bill e635778438 Deposit/Withdraw with abacus (#3)
* Deposit/Withdraw with abacus

* revert package

* e2e working deposit/withdraws

* deprecate usesquidrouter

* remove unused types

* fix chain select menu

* fix switch network bug

* working switch network deposits

* fix withdraw chain select

* address comments

* address comments

* address comments

* fix clear bug

* use diffarrow

* address nits
2023-08-29 12:11:20 -07:00
aleka 7a456b33d4 Merge pull request #6 from dydxprotocol/readme-vercel-setup
Add instructions for deploying with vercel in readme
2023-08-29 13:07:21 -04:00
aleka 6d25a072bd Add instructions for deploying with vercel in readme 2023-08-28 17:51:03 -04:00
Jared Vu d6baa6ef3f Merge pull request #5 from dydxprotocol/conditional-orders
Conditional orders
2023-08-28 05:49:27 -10:00
jaredvu 195ddd5af7 Move localeProvider, add label, valid marketId 2023-08-28 08:43:36 -07:00
aleka 2a5373c972 Merge pull request #4 from dydxprotocol/transfers-history-table
[TRCL-1842] Transfers history table
2023-08-25 14:13:53 -04:00
Aleka Cheung 64f663ed5b add CopyButton component 2023-08-25 14:07:03 -04:00
jaredvu 983128fd74 misc fix/cleanup 2023-08-25 10:59:59 -07:00
jaredvu e15f4b919c useCurrentMarketId hook for navigation 2023-08-25 10:59:35 -07:00
jaredvu 71c29524b1 useMarketsData: Filter out test-usd market 2023-08-24 14:23:02 -07:00
jaredvu 0e26433e29 disable conditional orders on testnet until they support them 2023-08-24 14:18:55 -07:00
jaredvu 3afd5ef783 OrdersTable: Minimum stepSizeDecimals = TOKEN_DECIMALS 2023-08-24 13:35:38 -07:00
jaredvu b2cac81235 SearchSelect: DropdownIcon position 2023-08-24 13:27:40 -07:00
jaredvu e48ec4ca73 Fix Orderbook spread when nothing on the books 2023-08-24 12:06:03 -07:00
jaredvu 78f9ddff7a Fix crash on test coin 2023-08-24 12:05:47 -07:00
jaredvu c1dcca43c8 Render TradeBoxOrderView from Abacus typeOptions 2023-08-23 23:32:02 -07:00
jaredvu 029476fa19 fix type for placeOrder analytics 2023-08-23 17:31:14 -07:00
jaredvu 6ecdcd981e enable conditional orders 2023-08-23 17:18:40 -07:00
jaredvu 591166e93d locale/browserTag 2023-08-23 17:18:10 -07:00
Aleka Cheung e30940e7df bump abacus + make addresses copyable 2023-08-23 19:37:19 -04:00
Aleka Cheung 2d0a944097 transfers history table 2023-08-23 19:37:14 -04:00
aleka 0dd2ecb6d2 Merge pull request #1 from dydxprotocol/receive-transfer-entry-in-account-menu
Add receive/transfer dialog entry points in AccountMenu + dv4tnt renames
2023-08-23 18:57:32 -04:00
Aleka Cheung 76819e0839 signed commits 2023-08-23 18:56:12 -04:00
Aleka Cheung 32b375cfa4 address feedback 2023-08-23 18:56:11 -04:00
Aleka Cheung 3dc87e873d show receive button for both assets 2023-08-23 18:56:10 -04:00
Aleka Cheung ed61b3112e rename tokens to dv4tnt, fix header dropdown hover state, add entry points to receive/send dialogs in account menu 2023-08-23 18:56:08 -04:00
Jared Vu 42f4142307 Merge pull request #2 from dydxprotocol/analytics-performance
Analytics: add performance metrics
2023-08-21 10:00:00 -10:00
Darryl Yeo c5e79980d1 Analytics: add performance metrics 2023-08-18 13:02:25 -07:00
James Jia - Test 6e179191d8 Initial commit 2023-08-17 15:52:35 -07:00
61 changed files with 629 additions and 391 deletions
+12
View File
@@ -2,5 +2,17 @@ VITE_BASE_URL=https://v4.testnet.dydx.exchange
VITE_ALCHEMY_API_KEY=FP275q327Yh7qswtZWenbPXdZZdnAFmC VITE_ALCHEMY_API_KEY=FP275q327Yh7qswtZWenbPXdZZdnAFmC
VITE_FAUCET_URL_DEV=https://faucet.v4dev.dydx.exchange/
VITE_FAUCET_URL_STAGE=https://faucet.v4staging.dydx.exchange/
VITE_FAUCET_URL_TESTNET2=https://faucet.v4testnet2.dydx.exchange/
VITE_VALIDATOR_URL_DEV=http://52.192.187.113:26657/
VITE_VALIDATOR_URL_STAGE=https://validator.v4staging.dydx.exchange/
VITE_VALIDATOR_URL_TESTNET2=https://validator.v4testnet2.dydx.exchange/
VITE_INDEXER_URL_DEV=http://dev-indexer-apne1-lb-public-890774175.ap-northeast-1.elb.amazonaws.com
VITE_INDEXER_URL_STAGE=https://indexer.v4staging.dydx.exchange
VITE_INDEXER_URL_TESTNET2=https://indexer.v4testnet2.dydx.exchange
VITE_WALLETCONNECT1_BRIDGE=wss://api.dydx.exchange/wc/ VITE_WALLETCONNECT1_BRIDGE=wss://api.dydx.exchange/wc/
VITE_WALLETCONNECT2_PROJECT_ID=fbe94eaa691fa8d929561f8567062b32 VITE_WALLETCONNECT2_PROJECT_ID=fbe94eaa691fa8d929561f8567062b32
+12 -3
View File
@@ -1,8 +1,17 @@
VITE_BASE_URL= VITE_BASE_URL=
VITE_ALCHEMY_API_KEY= VITE_ALCHEMY_API_KEY=
VITE_PK_ENCRYPTION_KEY= VITE_PK_ENCRYPTION_KEY=
VITE_WALLETCONNECT1_BRIDGE=
VITE_WALLETCONNECT2_PROJECT_ID= VITE_WALLETCONNECT2_PROJECT_ID=
VITE_FAUCET_URL_DEV=
VITE_FAUCET_URL_STAGE=
VITE_FAUCET_URL_TESTNET2=
VITE_VALIDATOR_URL_DEV=
VITE_VALIDATOR_URL_STAGE=
VITE_VALIDATOR_URL_TESTNET2=
VITE_INDEXER_URL_DEV=
VITE_INDEXER_URL_STAGE=
VITE_INDEXER_URL_TESTNET2=
+5
View File
@@ -5,10 +5,15 @@ vite.config.ts
# Temporarily ignore, we will slowly remove each directory as we fix files to follow ESLint rules # Temporarily ignore, we will slowly remove each directory as we fix files to follow ESLint rules
/src/components /src/components
/src/dialogs
/src/forms /src/forms
/src/hooks /src/hooks
/src/history.ts
/src/icons
/src/lib /src/lib
/src/main.tsx /src/main.tsx
/src/menus /src/menus
/src/pages /src/pages
/src/state
/src/styles
/src/views /src/views
+6 -4
View File
@@ -33,11 +33,14 @@
"jsx-a11y/anchor-is-valid": "off", "jsx-a11y/anchor-is-valid": "off",
"jsx-a11y/click-events-have-key-events": "off", "jsx-a11y/click-events-have-key-events": "off",
"no-continue": "off", "no-continue": "off",
"no-console": ["error"], "no-console": [
"error",
{
"devDependencies": ["./scripts/*.js"]
}
],
"no-lonely-if": "off", "no-lonely-if": "off",
"no-multi-assign": "off",
"no-nested-ternary": "off", "no-nested-ternary": "off",
"no-param-reassign": ["error", { "props": false }],
"no-return-assign": "off", "no-return-assign": "off",
"no-return-await": "off", "no-return-await": "off",
"no-underscore-dangle": "off", "no-underscore-dangle": "off",
@@ -62,7 +65,6 @@
"react/sort-comp": "off", "react/sort-comp": "off",
"@typescript-eslint/no-use-before-define": "off", "@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/comma-dangle": "off", "@typescript-eslint/comma-dangle": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/member-delimiter-style": [ "@typescript-eslint/member-delimiter-style": [
"error", "error",
{ {
+4 -4
View File
@@ -1,4 +1,4 @@
# Contributing to V4-web # Contributing to Trader-Fe
We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's:
- Reporting a bug - Reporting a bug
@@ -18,10 +18,10 @@ Pull requests are the best way to propose changes to the codebase (we use [Githu
4. Issue that pull request! 4. Issue that pull request!
## Any contributions you make will be under the same License ## Any contributions you make will be under the same License
When you submit code changes, your submissions are understood to be under the same [License](https://github.com/dydxprotocol/v4-web/blob/master/LICENSE) that covers the project. When you submit code changes, your submissions are understood to be under the same [License](https://github.com/dydxprotocol/trader-fe/blob/master/LICENSE) that covers the project.
## Report bugs using Github's [issues](https://github.com/dydxprotocol/v4-web/issues) ## Report bugs using Github's [issues](https://github.com/dydxprotocol/trader-fe/issues)
Report a bug by [opening a new issue](https://github.com/dydxprotocol/v4-web/issues/new). Report a bug by [opening a new issue](https://github.com/dydxprotocol/trader-fe/issues/new).
**Great Bug Reports** tend to have: **Great Bug Reports** tend to have:
+6 -9
View File
@@ -1,19 +1,16 @@
Subject to your compliance with applicable law, you are granted the right to use the Licensed Work (defined below) under the terms of the below licenses; provided, however, that if you violate any such applicable law in your use of the Licensed Work, all of your rights and licenses to use (including any rights to reproduce, distribute, install or modify) the Licensed Work will automatically and immediately terminate. Business Source License 1.1
License text copyright © 2023 MariaDB plc, All Rights Reserved. “Business Source License” is a trademark of MariaDB plc.
Copyright (C) 2023 dYdX Trading Inc.
Use of this software before the Change Date specified in the LICENSE file is governed by the Business Source License included in the LICENSE file and at https://spdx.org/licenses/BUSL-1.1.html. Use of this software before the Change Date specified in the LICENSE file is governed by the Business Source License included in the LICENSE file and at https://spdx.org/licenses/BUSL-1.1.html.
On and after the Change Date specified in the LICENSE file, use of this software will be governed by the Change License (GNU Affero GPL v3) as specified in the LICENSE file. On and after the Change Date specified in the LICENSE file, use of this software will be governed by the Change License (GNU Affero GPL v3) as specified in the LICENSE file.
Business Source License 1.1
Business Source License text copyright © 2023 MariaDB plc, All Rights Reserved. “Business Source License” is a trademark of MariaDB plc.
Copyright (C) 2023 dYdX Trading Inc.
Parameters Parameters
Licensor: dYdX Trading Inc. Licensor: dYdX Trading Inc.
Licensed Work: dydxprotocol/cosmos-sdk, dydxprotocol/cometbft, dydxprotocol/v4-chain, dydxprotocol/v4-clients, dydxprotocol/v4-web, dydxprotocol/v4-abacus, dydxprotocol/v4-localization, dydxprotocol/v4-documentation, and any dYdX or dYdX Trading Inc. github repository reflecting a copy of this license, or link to this license. Licensed Work: dydxprotocol/cosmos-sdk, dydxprotocol/cometbft, dydxprotocol/v4-chain, dydxprotocol/v4-clients, dydxprotocol/v4-web, dydxprotocol/v4-abacus, dydxprotocol/v4-localization, dydxprotocol/v4-documentation, and any dYdX or dYdX Trading Inc. github repository reflecting a copy of this license, or link to this license.
Additional Use Grant: None Additional Use Grant: None
Change Date: On the later to occur of (i) the release of the Licensed Work labeled “dYdX Version 1.0 Affero GPL”, and which includes a document uploaded to the relevant github repository stating “The software in this repository is Version 1.0, subject to Affero GPL license”, and (ii) September 30, 2023 (approximate projected release of “Version 1.0” of this software). Change Date: On the later to occur of (i) the release of the Licensed Work labeled “dYdX Version 1.0 GPL”, and which includes a document uploaded to the relevant github repository stating “The software in this repository is Version 1.0, subject to GPL license”, and (ii) September 30, 2023 (approximate projected release of “Version 1.0” of this software).
Change License: GNU Affero GPL License v3 Change License: GNU Affero GPL License v3
License text copyright © 2023 MariaDB plc, All Rights Reserved. “Business Source License” is a trademark of MariaDB plc. License text copyright © 2023 MariaDB plc, All Rights Reserved. “Business Source License” is a trademark of MariaDB plc.
@@ -42,7 +39,7 @@ OPEN SOURCE LICENSE BELOW - TO BE APPLIED AFTER THE CHANGE DATE.
Copyright (C) 2023 dYdX Trading Inc. Copyright (C) 2023 dYdX Trading Inc.
Subject to your compliance with applicable law, you are granted the right to use the Licensed Work (defined below) under the terms of the GNU Affero General Public License as set forth below; provided, however, that if you violate any such applicable law in your use of the Licensed Work, all of your rights and licenses to use (including any rights to reproduce, distribute, install or modify) the Licensed Work will automatically and immediately terminate. Use of this software is governed by the The GNU Affero General Public License as set forth below.
The GNU Affero General Public License The GNU Affero General Public License
@@ -838,4 +835,4 @@ copy of the Program in return for a fee.
For more information about this software, see https://dydx.exchange. For more information about this software, see https://dydx.exchange.
Copyright (C) 2023 dYdX Trading Inc. Copyright (C) 2023 dYdX Trading Inc.
+3 -11
View File
@@ -1,12 +1,4 @@
<p align="center"><img src="https://dydx.exchange/icon.svg?" width="256" /></p> # v4 Web App
<h1 align="center">v4 Web</h1>
<div align="center">
<a href='https://github.com/dydxprotocol/v4-web/blob/main/LICENSE'>
<img src='https://img.shields.io/badge/License-BSL_1.1-blue' alt='License' />
</a>
</div>
## Prerequisites ## Prerequisites
@@ -30,8 +22,8 @@ Alternatively, follow the [IPFS Kubo installation guide](https://docs.ipfs.tech
Clone the repository and navigate to its directory: Clone the repository and navigate to its directory:
```bash ```bash
git clone https://github.com/dydxprotocol/v4-web.git git clone https://github.com/dydxprotocol/trader-fe.git
cd v4-web cd trader-fe
``` ```
### Step 2: Install pnpm and dependencies ### Step 2: Install pnpm and dependencies
+3 -3
View File
@@ -37,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.4.28", "@dydxprotocol/abacus": "^0.4.8",
"@dydxprotocol/v4-client-js": "^0.35.0", "@dydxprotocol/v4-client-js": "^0.32.0",
"@dydxprotocol/v4-localization": "^0.1.5", "@dydxprotocol/v4-localization": "^0.0.25",
"@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",
+242 -36
View File
@@ -26,15 +26,15 @@ dependencies:
'@cosmjs/tendermint-rpc': '@cosmjs/tendermint-rpc':
specifier: ^0.31.0 specifier: ^0.31.0
version: 0.31.0 version: 0.31.0
'@dydxprotocol/v4-abacus': '@dydxprotocol/abacus':
specifier: ^0.4.28 specifier: ^0.4.8
version: 0.4.28 version: 0.4.8
'@dydxprotocol/v4-client-js': '@dydxprotocol/v4-client-js':
specifier: ^0.35.0 specifier: ^0.32.0
version: 0.35.0 version: 0.32.0
'@dydxprotocol/v4-localization': '@dydxprotocol/v4-localization':
specifier: ^0.1.5 specifier: ^0.0.25
version: 0.1.5 version: 0.0.25
'@ethersproject/providers': '@ethersproject/providers':
specifier: ^5.7.2 specifier: ^5.7.2
version: 5.7.2 version: 5.7.2
@@ -614,6 +614,74 @@ packages:
'@babel/helper-validator-identifier': 7.22.5 '@babel/helper-validator-identifier': 7.22.5
to-fast-properties: 2.0.0 to-fast-properties: 2.0.0
/@bufbuild/buf-darwin-arm64@1.19.0-1:
resolution: {integrity: sha512-HsWPii21wm3QSyuxrNq9+Yf8iAgpnC4rNCy4x3d6P1fd/LmgE1NPzQW0ghEZvl9dgAQKkL/4S5bKhlm7kbUdmQ==}
engines: {node: '>=12'}
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@bufbuild/buf-darwin-x64@1.19.0-1:
resolution: {integrity: sha512-2+Ig7ylYpVh4kms/OeJJVY+X0KX4awPA6hYr7L7aZOIcHwZEM8lWtSTO/se5pQc7dc8FXNiC4YUqHC8yfxxX6Q==}
engines: {node: '>=12'}
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@bufbuild/buf-linux-aarch64@1.19.0-1:
resolution: {integrity: sha512-g/Vxg3WiBr3nhsxsRr2Q81xXJD+0ktHIO3ZJggTG2Sbbl3dh8kyg1iKM6MjJiMP7su5RKCylLigzoEJzVTShyA==}
engines: {node: '>=12'}
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@bufbuild/buf-linux-x64@1.19.0-1:
resolution: {integrity: sha512-anYuGx8k/2kp8GPX3eHNUf3IY/01Zpnyw0HaLPXK1Btqyy6XkapVywrDqg7YUzMd1ySFEp1wD9UqRNdEFNCQ4A==}
engines: {node: '>=12'}
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@bufbuild/buf-win32-arm64@1.19.0-1:
resolution: {integrity: sha512-xXgF1qYnCfRKbGx1FqvPbpZ6ajh4ddxpXhSxI3VCeb3MsMBuIbiLqX4fQAL3ls/Zwz8tVIITuSwOhYmSEGcpBA==}
engines: {node: '>=12'}
cpu: [arm64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@bufbuild/buf-win32-x64@1.19.0-1:
resolution: {integrity: sha512-futmqgpMQCR1lcAzZJEGjPr7ECw1gYTPIV8crm5SY+iCJ7sOeStOBNt7q5hV4LKmmeWmvm03XIMZPjhQzjH5NQ==}
engines: {node: '>=12'}
cpu: [x64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@bufbuild/buf@1.19.0-1:
resolution: {integrity: sha512-TIsLTTQUntr/Xq/IMSULv3dlC3/ZsVwQtWgxmJ++IzSuOW79TFQfq59vFeTWrPa6+QXFMz5t6jkMyD4ghzO5nw==}
engines: {node: '>=12'}
hasBin: true
requiresBuild: true
optionalDependencies:
'@bufbuild/buf-darwin-arm64': 1.19.0-1
'@bufbuild/buf-darwin-x64': 1.19.0-1
'@bufbuild/buf-linux-aarch64': 1.19.0-1
'@bufbuild/buf-linux-x64': 1.19.0-1
'@bufbuild/buf-win32-arm64': 1.19.0-1
'@bufbuild/buf-win32-x64': 1.19.0-1
dev: false
/@coinbase/wallet-sdk@3.7.1: /@coinbase/wallet-sdk@3.7.1:
resolution: {integrity: sha512-LjyoDCB+7p0waQXfK+fUgcAs3Ezk6S6e+LYaoFjpJ6c9VTop3NyZF40Pi7df4z7QJohCwzuIDjz0Rhtig6Y7Pg==} resolution: {integrity: sha512-LjyoDCB+7p0waQXfK+fUgcAs3Ezk6S6e+LYaoFjpJ6c9VTop3NyZF40Pi7df4z7QJohCwzuIDjz0Rhtig6Y7Pg==}
engines: {node: '>= 10.0.0'} engines: {node: '>= 10.0.0'}
@@ -658,6 +726,15 @@ packages:
'@cosmjs/utils': 0.27.1 '@cosmjs/utils': 0.27.1
dev: false dev: false
/@cosmjs/amino@0.29.3:
resolution: {integrity: sha512-BFz1++ERerIggiFc7iGHhGe1CeV3rCv8BvkoBQTBN/ZwzHOaKvqQj8smDlRGlQxX3HWlTwgiLN2A+OB5yX4ZRw==}
dependencies:
'@cosmjs/crypto': 0.29.5
'@cosmjs/encoding': 0.29.5
'@cosmjs/math': 0.29.5
'@cosmjs/utils': 0.29.5
dev: false
/@cosmjs/amino@0.30.1: /@cosmjs/amino@0.30.1:
resolution: {integrity: sha512-yNHnzmvAlkETDYIpeCTdVqgvrdt1qgkOXwuRVi8s27UKI5hfqyE9fJ/fuunXE6ZZPnKkjIecDznmuUOMrMvw4w==} resolution: {integrity: sha512-yNHnzmvAlkETDYIpeCTdVqgvrdt1qgkOXwuRVi8s27UKI5hfqyE9fJ/fuunXE6ZZPnKkjIecDznmuUOMrMvw4w==}
dependencies: dependencies:
@@ -711,6 +788,18 @@ packages:
sha.js: 2.4.11 sha.js: 2.4.11
dev: false dev: false
/@cosmjs/crypto@0.29.5:
resolution: {integrity: sha512-2bKkaLGictaNL0UipQCL6C1afaisv6k8Wr/GCLx9FqiyFkh9ZgRHDyetD64ZsjnWV/N/D44s/esI+k6oPREaiQ==}
dependencies:
'@cosmjs/encoding': 0.29.5
'@cosmjs/math': 0.29.5
'@cosmjs/utils': 0.29.5
'@noble/hashes': 1.3.1
bn.js: 5.2.1
elliptic: 6.5.4
libsodium-wrappers: 0.7.11
dev: false
/@cosmjs/crypto@0.30.1: /@cosmjs/crypto@0.30.1:
resolution: {integrity: sha512-rAljUlake3MSXs9xAm87mu34GfBLN0h/1uPPV6jEwClWjNkAMotzjC0ab9MARy5FFAvYHL3lWb57bhkbt2GtzQ==} resolution: {integrity: sha512-rAljUlake3MSXs9xAm87mu34GfBLN0h/1uPPV6jEwClWjNkAMotzjC0ab9MARy5FFAvYHL3lWb57bhkbt2GtzQ==}
dependencies: dependencies:
@@ -743,6 +832,14 @@ packages:
readonly-date: 1.0.0 readonly-date: 1.0.0
dev: false dev: false
/@cosmjs/encoding@0.29.5:
resolution: {integrity: sha512-G4rGl/Jg4dMCw5u6PEZHZcoHnUBlukZODHbm/wcL4Uu91fkn5jVo5cXXZcvs4VCkArVGrEj/52eUgTZCmOBGWQ==}
dependencies:
base64-js: 1.5.1
bech32: 1.1.4
readonly-date: 1.0.0
dev: false
/@cosmjs/encoding@0.30.1: /@cosmjs/encoding@0.30.1:
resolution: {integrity: sha512-rXmrTbgqwihORwJ3xYhIgQFfMSrwLu1s43RIK9I8EBudPx3KmnmyAKzMOVsRDo9edLFNuZ9GIvysUCwQfq3WlQ==} resolution: {integrity: sha512-rXmrTbgqwihORwJ3xYhIgQFfMSrwLu1s43RIK9I8EBudPx3KmnmyAKzMOVsRDo9edLFNuZ9GIvysUCwQfq3WlQ==}
dependencies: dependencies:
@@ -759,12 +856,11 @@ packages:
readonly-date: 1.0.0 readonly-date: 1.0.0
dev: false dev: false
/@cosmjs/encoding@0.31.1: /@cosmjs/json-rpc@0.29.5:
resolution: {integrity: sha512-IuxP6ewwX6vg9sUJ8ocJD92pkerI4lyG8J5ynAM3NaX3q+n+uMoPRSQXNeL9bnlrv01FF1kIm8if/f5F7ZPtkA==} resolution: {integrity: sha512-C78+X06l+r9xwdM1yFWIpGl03LhB9NdM1xvZpQHwgCOl0Ir/WV8pw48y3Ez2awAoUBRfTeejPe4KvrE6NoIi/w==}
dependencies: dependencies:
base64-js: 1.5.1 '@cosmjs/stream': 0.29.5
bech32: 1.1.4 xstream: 11.14.0
readonly-date: 1.0.0
dev: false dev: false
/@cosmjs/json-rpc@0.30.1: /@cosmjs/json-rpc@0.30.1:
@@ -801,6 +897,12 @@ packages:
bn.js: 5.2.1 bn.js: 5.2.1
dev: false dev: false
/@cosmjs/math@0.29.5:
resolution: {integrity: sha512-2GjKcv+A9f86MAWYLUkjhw1/WpRl2R1BTb3m9qPG7lzMA7ioYff9jY5SPCfafKdxM4TIQGxXQlYGewQL16O68Q==}
dependencies:
bn.js: 5.2.1
dev: false
/@cosmjs/math@0.30.1: /@cosmjs/math@0.30.1:
resolution: {integrity: sha512-yaoeI23pin9ZiPHIisa6qqLngfnBR/25tSaWpkTm8Cy10MX70UF5oN4+/t1heLaM6SSmRrhk3psRkV4+7mH51Q==} resolution: {integrity: sha512-yaoeI23pin9ZiPHIisa6qqLngfnBR/25tSaWpkTm8Cy10MX70UF5oN4+/t1heLaM6SSmRrhk3psRkV4+7mH51Q==}
dependencies: dependencies:
@@ -813,10 +915,16 @@ packages:
bn.js: 5.2.1 bn.js: 5.2.1
dev: false dev: false
/@cosmjs/math@0.31.1: /@cosmjs/proto-signing@0.29.3:
resolution: {integrity: sha512-kiuHV6m6DSB8/4UV1qpFhlc4ul8SgLXTGRlYkYiIIP4l0YNeJ+OpPYaOlEgx4Unk2mW3/O2FWYj7Jc93+BWXng==} resolution: {integrity: sha512-Ai3l9THjMOrLJ4Ebn1Dgptwg6W5ZIRJqtnJjijHhGwTVC1WT0WdYU3aMZ7+PwubcA/cA1rH4ZTK7jrfYbra63g==}
dependencies: dependencies:
bn.js: 5.2.1 '@cosmjs/amino': 0.29.3
'@cosmjs/crypto': 0.29.5
'@cosmjs/encoding': 0.29.5
'@cosmjs/math': 0.29.5
'@cosmjs/utils': 0.29.5
cosmjs-types: 0.5.2
long: 4.0.0
dev: false dev: false
/@cosmjs/proto-signing@0.30.1: /@cosmjs/proto-signing@0.30.1:
@@ -843,6 +951,18 @@ packages:
long: 4.0.0 long: 4.0.0
dev: false dev: false
/@cosmjs/socket@0.29.5:
resolution: {integrity: sha512-5VYDupIWbIXq3ftPV1LkS5Ya/T7Ol/AzWVhNxZ79hPe/mBfv1bGau/LqIYOm2zxGlgm9hBHOTmWGqNYDwr9LNQ==}
dependencies:
'@cosmjs/stream': 0.29.5
isomorphic-ws: 4.0.1(ws@7.5.9)
ws: 7.5.9
xstream: 11.14.0
transitivePeerDependencies:
- bufferutil
- utf-8-validate
dev: false
/@cosmjs/socket@0.30.1: /@cosmjs/socket@0.30.1:
resolution: {integrity: sha512-r6MpDL+9N+qOS/D5VaxnPaMJ3flwQ36G+vPvYJsXArj93BjgyFB7BwWwXCQDzZ+23cfChPUfhbINOenr8N2Kow==} resolution: {integrity: sha512-r6MpDL+9N+qOS/D5VaxnPaMJ3flwQ36G+vPvYJsXArj93BjgyFB7BwWwXCQDzZ+23cfChPUfhbINOenr8N2Kow==}
dependencies: dependencies:
@@ -867,6 +987,27 @@ packages:
- utf-8-validate - utf-8-validate
dev: false dev: false
/@cosmjs/stargate@0.29.3:
resolution: {integrity: sha512-455TgXStCi6E8KDjnhDAM8wt6aLSjobH4Dixvd7Up1DfCH6UB9NkC/G0fMJANNcNXMaM4wSX14niTXwD1d31BA==}
dependencies:
'@confio/ics23': 0.6.8
'@cosmjs/amino': 0.29.3
'@cosmjs/encoding': 0.29.5
'@cosmjs/math': 0.29.5
'@cosmjs/proto-signing': 0.29.3
'@cosmjs/stream': 0.29.5
'@cosmjs/tendermint-rpc': 0.29.5
'@cosmjs/utils': 0.29.5
cosmjs-types: 0.5.2
long: 4.0.0
protobufjs: 6.11.4
xstream: 11.14.0
transitivePeerDependencies:
- bufferutil
- debug
- utf-8-validate
dev: false
/@cosmjs/stargate@0.30.1: /@cosmjs/stargate@0.30.1:
resolution: {integrity: sha512-RdbYKZCGOH8gWebO7r6WvNnQMxHrNXInY/gPHPzMjbQF6UatA6fNM2G2tdgS5j5u7FTqlCI10stNXrknaNdzog==} resolution: {integrity: sha512-RdbYKZCGOH8gWebO7r6WvNnQMxHrNXInY/gPHPzMjbQF6UatA6fNM2G2tdgS5j5u7FTqlCI10stNXrknaNdzog==}
dependencies: dependencies:
@@ -909,6 +1050,12 @@ packages:
- utf-8-validate - utf-8-validate
dev: false dev: false
/@cosmjs/stream@0.29.5:
resolution: {integrity: sha512-TToTDWyH1p05GBtF0Y8jFw2C+4783ueDCmDyxOMM6EU82IqpmIbfwcdMOCAm0JhnyMh+ocdebbFvnX/sGKzRAA==}
dependencies:
xstream: 11.14.0
dev: false
/@cosmjs/stream@0.30.1: /@cosmjs/stream@0.30.1:
resolution: {integrity: sha512-Fg0pWz1zXQdoxQZpdHRMGvUH5RqS6tPv+j9Eh7Q953UjMlrwZVo0YFLC8OTf/HKVf10E4i0u6aM8D69Q6cNkgQ==} resolution: {integrity: sha512-Fg0pWz1zXQdoxQZpdHRMGvUH5RqS6tPv+j9Eh7Q953UjMlrwZVo0YFLC8OTf/HKVf10E4i0u6aM8D69Q6cNkgQ==}
dependencies: dependencies:
@@ -921,6 +1068,25 @@ packages:
xstream: 11.14.0 xstream: 11.14.0
dev: false dev: false
/@cosmjs/tendermint-rpc@0.29.5:
resolution: {integrity: sha512-ar80twieuAxsy0x2za/aO3kBr2DFPAXDmk2ikDbmkda+qqfXgl35l9CVAAjKRqd9d+cRvbQyb5M4wy6XQpEV6w==}
dependencies:
'@cosmjs/crypto': 0.29.5
'@cosmjs/encoding': 0.29.5
'@cosmjs/json-rpc': 0.29.5
'@cosmjs/math': 0.29.5
'@cosmjs/socket': 0.29.5
'@cosmjs/stream': 0.29.5
'@cosmjs/utils': 0.29.5
axios: 0.21.4
readonly-date: 1.0.0
xstream: 11.14.0
transitivePeerDependencies:
- bufferutil
- debug
- utf-8-validate
dev: false
/@cosmjs/tendermint-rpc@0.30.1: /@cosmjs/tendermint-rpc@0.30.1:
resolution: {integrity: sha512-Z3nCwhXSbPZJ++v85zHObeUggrEHVfm1u18ZRwXxFE9ZMl5mXTybnwYhczuYOl7KRskgwlB+rID0WYACxj4wdQ==} resolution: {integrity: sha512-Z3nCwhXSbPZJ++v85zHObeUggrEHVfm1u18ZRwXxFE9ZMl5mXTybnwYhczuYOl7KRskgwlB+rID0WYACxj4wdQ==}
dependencies: dependencies:
@@ -963,6 +1129,10 @@ packages:
resolution: {integrity: sha512-VG7QPDiMUzVPxRdJahDV8PXxVdnuAHiIuG56hldV4yPnOz/si/DLNd7VAUUA5923b6jS1Hhev0Hr6AhEkcxBMg==} resolution: {integrity: sha512-VG7QPDiMUzVPxRdJahDV8PXxVdnuAHiIuG56hldV4yPnOz/si/DLNd7VAUUA5923b6jS1Hhev0Hr6AhEkcxBMg==}
dev: false dev: false
/@cosmjs/utils@0.29.5:
resolution: {integrity: sha512-m7h+RXDUxOzEOGt4P+3OVPX7PuakZT3GBmaM/Y2u+abN3xZkziykD/NvedYFvvCCdQo714XcGl33bwifS9FZPQ==}
dev: false
/@cosmjs/utils@0.30.1: /@cosmjs/utils@0.30.1:
resolution: {integrity: sha512-KvvX58MGMWh7xA+N+deCfunkA/ZNDvFLw4YbOmX3f/XBIkqrVY7qlotfy2aNb1kgp6h4B6Yc8YawJPDTfvWX7g==} resolution: {integrity: sha512-KvvX58MGMWh7xA+N+deCfunkA/ZNDvFLw4YbOmX3f/XBIkqrVY7qlotfy2aNb1kgp6h4B6Yc8YawJPDTfvWX7g==}
dev: false dev: false
@@ -971,29 +1141,39 @@ packages:
resolution: {integrity: sha512-nNcycZWUYLNJlrIXgpcgVRqdl6BXjF4YlXdxobQWpW9Tikk61bEGeAFhDYtC0PwHlokCNw0KxWiHGJL4nL7Q5A==} resolution: {integrity: sha512-nNcycZWUYLNJlrIXgpcgVRqdl6BXjF4YlXdxobQWpW9Tikk61bEGeAFhDYtC0PwHlokCNw0KxWiHGJL4nL7Q5A==}
dev: false dev: false
/@cosmjs/utils@0.31.1:
resolution: {integrity: sha512-n4Se1wu4GnKwztQHNFfJvUeWcpvx3o8cWhSbNs9JQShEuB3nv3R5lqFBtDCgHZF/emFQAP+ZjF8bTfCs9UBGhA==}
dev: false
/@cush/relative@1.0.0: /@cush/relative@1.0.0:
resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==} resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==}
dev: true dev: true
/@dydxprotocol/v4-abacus@0.4.28: /@dydxprotocol/abacus@0.4.8:
resolution: {integrity: sha512-RQGTXI7q4HAXDmlUpDhpJDLN8C0dFMgKHzFITK1Sz3KnLb3mkkpqEU1D8VIn/hB7ngt+equMsLFSkUwzXCzgdA==} resolution: {integrity: sha512-hX31m+a5Bwbs4dr5raPDtnflwUzEu/9BIt+LOlQgt1YOViuIse8dozgpgCHvqvA8MttqY3QGPalx5iRB8j8vtw==}
dev: false dev: false
/@dydxprotocol/v4-client-js@0.35.0: /@dydxprotocol/dydxjs@0.3.0:
resolution: {integrity: sha512-H+0/tOBVqyWx2JQ4jUFdJOlFof0NqN1u9vzKJ2h3Nv5KNteSPd59eiywoz+3J0jlmkREw0Jzg9CS0bLwzYVLvA==} resolution: {integrity: sha512-ygNeBs0f3H7sJk1qLUjfNwaXgc5TmjD+qZf7BFDbi7+boHJI9xuOWrGpjfBo7OTUZxS6O5jZG323CgU5XqMSPw==}
dependencies: dependencies:
'@babel/runtime': 7.22.10
'@bufbuild/buf': 1.19.0-1
'@cosmjs/amino': 0.30.1 '@cosmjs/amino': 0.30.1
'@cosmjs/encoding': 0.31.1
'@cosmjs/math': 0.31.1
'@cosmjs/proto-signing': 0.30.1 '@cosmjs/proto-signing': 0.30.1
'@cosmjs/stargate': 0.30.1 '@cosmjs/stargate': 0.30.1
'@cosmjs/tendermint-rpc': 0.30.1 '@cosmjs/tendermint-rpc': 0.30.1
'@cosmjs/utils': 0.31.1 osmojs: 15.5.0
'@dydxprotocol/v4-proto': 0.2.1 protobufjs: 6.11.4
transitivePeerDependencies:
- bufferutil
- debug
- utf-8-validate
dev: false
/@dydxprotocol/v4-client-js@0.32.0:
resolution: {integrity: sha512-KvKActMgWLcsRQ7RQhpi/F8xeQ7MWUp3G5+4IPNZ4wyRwAxDSbcrfYbTetI/IesHyelRPSeYxam9eYq3wXwZ1A==}
dependencies:
'@cosmjs/amino': 0.30.1
'@cosmjs/proto-signing': 0.30.1
'@cosmjs/stargate': 0.30.1
'@cosmjs/tendermint-rpc': 0.30.1
'@dydxprotocol/dydxjs': 0.3.0
'@osmonauts/lcd': 0.6.0 '@osmonauts/lcd': 0.6.0
'@scure/bip32': 1.3.1 '@scure/bip32': 1.3.1
'@scure/bip39': 1.2.1 '@scure/bip39': 1.2.1
@@ -1002,7 +1182,6 @@ packages:
bignumber.js: 9.1.1 bignumber.js: 9.1.1
ethereum-cryptography: 2.1.2 ethereum-cryptography: 2.1.2
long: 4.0.0 long: 4.0.0
protobufjs: 6.11.4
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)
transitivePeerDependencies: transitivePeerDependencies:
- bufferutil - bufferutil
@@ -1010,14 +1189,8 @@ packages:
- utf-8-validate - utf-8-validate
dev: false dev: false
/@dydxprotocol/v4-localization@0.1.5: /@dydxprotocol/v4-localization@0.0.25:
resolution: {integrity: sha512-fiSHWrG8E2HuXkCzWsqyekntlI13hBRACrP0vaYudeSulw+ScGeAqZ5xp9/cANF6PP+H3z1yciNCZOH3OwSDwA==} resolution: {integrity: sha512-Rp6VHA8z+nwgvTjjB3fvL8gY7bd4DYDHV+NPoL0MFuRm39vhFxGlBVAGDkXPkQTh6YU5BlZV2yXLkDeSfFqEBQ==}
dev: false
/@dydxprotocol/v4-proto@0.2.1:
resolution: {integrity: sha512-Q5b/g331DoyMjBpO2/jtrxUX3WF5UaIKZp/unK332xuefHNFnkMYtZ05p0V71iSdO35tBdz8yt0VYP2WtUsp+w==}
dependencies:
protobufjs: 6.11.4
dev: false dev: false
/@emotion/is-prop-valid@1.2.1: /@emotion/is-prop-valid@1.2.1:
@@ -2073,6 +2246,15 @@ packages:
fastq: 1.15.0 fastq: 1.15.0
dev: true dev: true
/@osmonauts/lcd@0.10.0:
resolution: {integrity: sha512-PzmXk9x9MHyLn2fUztpAqWqvDmMiEJaQv/JcAoAOE8VdHrD9Hf/KWnE1RZtamuS2ngQRqvQPD0xotCGXW7eTxA==}
dependencies:
'@babel/runtime': 7.22.10
axios: 0.27.2
transitivePeerDependencies:
- debug
dev: false
/@osmonauts/lcd@0.6.0: /@osmonauts/lcd@0.6.0:
resolution: {integrity: sha512-vz9VavXrEfxZoXbSAfNfk90MLpn34XtBYPV3L9YilE+s56AhqYxUh83nne9J5somnTRfGnyR3oeV8C+lHkqiuA==} resolution: {integrity: sha512-vz9VavXrEfxZoXbSAfNfk90MLpn34XtBYPV3L9YilE+s56AhqYxUh83nne9J5somnTRfGnyR3oeV8C+lHkqiuA==}
dependencies: dependencies:
@@ -7605,6 +7787,13 @@ packages:
path-type: 4.0.0 path-type: 4.0.0
dev: true dev: true
/cosmjs-types@0.5.2:
resolution: {integrity: sha512-zxCtIJj8v3Di7s39uN4LNcN3HIE1z0B9Z0SPE8ZNQR0oSzsuSe1ACgxoFkvhkS7WBasCAFcglS11G2hyfd5tPg==}
dependencies:
long: 4.0.0
protobufjs: 6.11.4
dev: false
/cosmjs-types@0.7.2: /cosmjs-types@0.7.2:
resolution: {integrity: sha512-vf2uLyktjr/XVAgEq0DjMxeAWh1yYREe7AMHDKd7EiHVqxBPCaBS+qEEQUkXbR9ndnckqr1sUG8BQhazh4X5lA==} resolution: {integrity: sha512-vf2uLyktjr/XVAgEq0DjMxeAWh1yYREe7AMHDKd7EiHVqxBPCaBS+qEEQUkXbR9ndnckqr1sUG8BQhazh4X5lA==}
dependencies: dependencies:
@@ -11452,6 +11641,23 @@ packages:
type-check: 0.4.0 type-check: 0.4.0
dev: true dev: true
/osmojs@15.5.0:
resolution: {integrity: sha512-7wy3QEYu+R+c8imfLEPS1PliYA8uw0qdFYjc2PToHteYG4hzYt4Noa7X0lM9O59s7nxo9ozT1N9z7uwB/1qHkA==}
dependencies:
'@babel/runtime': 7.22.10
'@cosmjs/amino': 0.29.3
'@cosmjs/proto-signing': 0.29.3
'@cosmjs/stargate': 0.29.3
'@cosmjs/tendermint-rpc': 0.29.5
'@osmonauts/lcd': 0.10.0
long: 5.2.3
protobufjs: 6.11.4
transitivePeerDependencies:
- bufferutil
- debug
- utf-8-validate
dev: false
/p-defer@3.0.0: /p-defer@3.0.0:
resolution: {integrity: sha512-ugZxsxmtTln604yeYd29EGrNhazN2lywetzpKhfmQjW/VJmhpDmWbiX+h0zL8V91R0UXkhb3KtPmyq9PZw3aYw==} resolution: {integrity: sha512-ugZxsxmtTln604yeYd29EGrNhazN2lywetzpKhfmQjW/VJmhpDmWbiX+h0zL8V91R0UXkhb3KtPmyq9PZw3aYw==}
engines: {node: '>=8'} engines: {node: '>=8'}
+5 -6
View File
@@ -10,11 +10,11 @@ import { AppRoute, DEFAULT_TRADE_ROUTE } from '@/constants/routes';
import { useBreakpoints, useInitializePage, useShouldShowFooter, useAnalytics } from '@/hooks'; import { useBreakpoints, useInitializePage, useShouldShowFooter, useAnalytics } from '@/hooks';
import { DydxProvider } from '@/hooks/useDydxClient'; import { DydxProvider } from '@/hooks/useDydxClient';
import { AccountsProvider } from '@/hooks/useAccounts'; import { AccountsProvider } from '@/hooks/useAccounts';
import { DialogAreaProvider, useDialogArea } from '@/hooks/useDialogArea'; import { DialogAreaProvider, useDialogArea } from './hooks/useDialogArea';
import { LocaleProvider } from '@/hooks/useLocaleSeparators'; import { LocaleProvider } from './hooks/useLocaleSeparators';
import { NotificationsProvider } from '@/hooks/useNotifications'; import { NotificationsProvider } from './hooks/useNotifications';
import { LocalNotificationsProvider } from '@/hooks/useLocalNotifications'; import { LocalNotificationsProvider } from './hooks/useLocalNotifications';
import { SubaccountProvider } from '@/hooks/useSubaccount'; import { SubaccountProvider } from './hooks/useSubaccount';
import { SquidProvider } from '@/hooks/useSquid'; import { SquidProvider } from '@/hooks/useSquid';
import { GuardedMobileRoute } from '@/components/GuardedMobileRoute'; import { GuardedMobileRoute } from '@/components/GuardedMobileRoute';
@@ -100,7 +100,6 @@ const Content = () => {
}; };
const wrapProvider = (Component: React.ComponentType<any>, props?: any) => { const wrapProvider = (Component: React.ComponentType<any>, props?: any) => {
// eslint-disable-next-line react/display-name
return ({ children }: { children: React.ReactNode }) => ( return ({ children }: { children: React.ReactNode }) => (
<Component {...props}>{children}</Component> <Component {...props}>{children}</Component>
); );
-4
View File
@@ -80,8 +80,6 @@ export const ComboboxMenu = <MenuItemValue extends string, MenuGroupValue extend
{group.items.map((item) => ( {group.items.map((item) => (
<Fragment key={item.value}> <Fragment key={item.value}>
<Styled.Item <Styled.Item
// value={item.value} // search by both value and textContent
// value={[group.groupLabel, item.label, item.tag].filter(Boolean).join('|')} // exclude item.value from searchable terms (not guaranteed to be unique)
value={[group.groupLabel, item.value, item.description, item.label, item.tag] value={[group.groupLabel, item.value, item.description, item.label, item.tag]
.filter(Boolean) .filter(Boolean)
.join('|')} .join('|')}
@@ -116,8 +114,6 @@ export const ComboboxMenu = <MenuItemValue extends string, MenuGroupValue extend
item.subitems?.map((subitem) => ( item.subitems?.map((subitem) => (
<Fragment key={subitem.value}> <Fragment key={subitem.value}>
<Styled.Item <Styled.Item
// value={subitem.value} // search by both value and textContent
// value={[group.groupLabel, item.label, subitem.label, subitem.tag].filter(Boolean).join('|')}
value={[ value={[
group.groupLabel, group.groupLabel,
item.value, item.value,
+5 -2
View File
@@ -1,4 +1,4 @@
import Abacus, { kollections } from '@dydxprotocol/v4-abacus'; import Abacus, { kollections } from '@dydxprotocol/abacus';
import { OrderSide } from '@dydxprotocol/v4-client-js'; import { OrderSide } from '@dydxprotocol/v4-client-js';
import { PositionSide, TradeTypes } from './trade'; import { PositionSide, TradeTypes } from './trade';
import { STRING_KEYS } from './localization'; import { STRING_KEYS } from './localization';
@@ -40,7 +40,10 @@ 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;
export const CoroutineTimer = Abacus.exchange.dydx.abacus.utils.CoroutineTimer; export const CoroutineTimer = Abacus.exchange.dydx.abacus.utils.CoroutineTimer;
+19 -4
View File
@@ -1,5 +1,18 @@
import type { DydxAddress, EvmAddress } from './wallets'; /**
* OnboardingSteps
* 1. Choose between 3 options
* a. Ethereum EOA (current)
* b. Keplr or Other Cosmos (future)
* c. Social (future)
* 2. Key derivation
* a. If wallet has no dYdX Chain transactions and not on whitelist, sign twice (future)
* i. Success
* ii. Signatures don't match error (Wallet is non-deterministic)
* b. Success
* 3. Post Registration items (Only on first onboarding)
* a. Acknowledge Terms
* b. DepositFunds
*/
export enum OnboardingSteps { export enum OnboardingSteps {
ChooseWallet = 'ChooseWallet', ChooseWallet = 'ChooseWallet',
KeyDerivation = 'KeyDerivation', KeyDerivation = 'KeyDerivation',
@@ -36,12 +49,14 @@ export enum EvmDerivedAccountStatus {
Derived, Derived,
} }
import type { DydxAddress, EvmAddress } from './wallets';
export type EvmDerivedAddresses = { export type EvmDerivedAddresses = {
version?: string; version?: string;
[EvmAddress: EvmAddress]: { [EvmAddress: EvmAddress]: {
encryptedSignature?: string; encryptedSignature?: string;
dydxAddress?: DydxAddress; dydxAddress?: DydxAddress;
}; };
}; }
export const AMOUNT_RESERVED_FOR_GAS_USDC = 100_000; export const AMOUNT_RESERVED_FOR_GAS_USDC = 100_000;
+30
View File
@@ -1,6 +1,36 @@
import { Asset, PerpetualMarket } from '@/constants/abacus'; import { Asset, PerpetualMarket } from '@/constants/abacus';
import { STRING_KEYS } from '@/constants/localization'; import { STRING_KEYS } from '@/constants/localization';
export interface Market {
market: string;
status: string;
baseAsset: string;
quoteAsset: string;
stepSize: string;
tickSize: string;
oraclePrice: string;
priceChange24H: string;
nextFundingRate: string;
nextFundingAt: string;
minOrderSize: string;
type: string;
initialMarginFraction: string;
maintenanceMarginFraction: string;
volume24H: string;
trades24H: string;
openInterest: string;
incrementalInitialMarginFraction: string;
incrementalPositionSize: string;
maxPositionSize: string;
baselinePositionSize: string;
assetResolution: string;
syntheticAssetId: string;
}
export type AllMarkets = {
[market: string]: Market;
};
export type MarketData = { export type MarketData = {
asset: Asset; asset: Asset;
tickSizeDecimals: number; tickSizeDecimals: number;
+21 -15
View File
@@ -1,4 +1,5 @@
import { StatusResponse } from '@0xsquid/sdk'; import type { ReactNode } from 'react';
import type { StatusResponse } from '@0xsquid/sdk';
/** implemented in useNotificationTypes */ /** implemented in useNotificationTypes */
export enum NotificationType { export enum NotificationType {
@@ -11,39 +12,44 @@ export enum NotificationComponentType {}
export type NotificationId = string | number; export type NotificationId = string | number;
export type NotificationTypeConfig< export type NotificationTypeConfig<
NotificationIdType extends NotificationId = string, _NotificationId extends NotificationId = string,
NotificationUpdateKey = any NotificationUpdateKey = any
> = { > = {
type: NotificationType; type: NotificationType;
/** React hook to trigger notifications based on app state */ /** React hook to trigger notifications based on app state */
useTrigger: (_: { useTrigger: (_: {
trigger: ( trigger: ({
id,
displayData,
updateKey,
isNew,
}: {
/** Unique ID for the triggered notification */ /** Unique ID for the triggered notification */
id: NotificationIdType, id: _NotificationId;
/** Display data for the triggered notification */ /** Display data for the triggered notification */
displayData: NotificationDisplayData, displayData: NotificationDisplayData;
/** /**
* JSON-serializable key. * JSON-serializable key.
* Re-triggers the notification if passed a different value from the last trigger() call (even from a previous browser session). * Re-triggers the notification if passed a different value from the last trigger() call (even from a previous browser session).
* Suggested usage: data dependency array * Suggested usage: data dependency array
*/ */
updateKey?: NotificationUpdateKey, updateKey?: NotificationUpdateKey;
/** /**
* @param true (default): Notification initialized with status NotificationStatus.Triggered * @param true (default): Notification initialized with status NotificationStatus.Triggered
* @param false: Notification initialized with status NotificationStatus.Cleared * @param false: Notification initialized with status NotificationStatus.Cleared
*/ */
isNew?: boolean isNew?: boolean;
) => void; }) => void;
lastUpdated: number; lastUpdated: number;
}) => void; }) => void;
/** Callback for notification action (Toast action button click, NotificationsMenu item click, or native push notification interaction) */ /** Callback for notification action (Toast action button click, NotificationsMenu item click, or native push notification interaction) */
useNotificationAction?: () => (id: NotificationIdType) => any; useNotificationAction?: () => (id: _NotificationId) => any;
}; };
export enum NotificationStatus { export enum NotificationStatus {
@@ -65,10 +71,10 @@ export enum NotificationStatus {
/** Notification state. Serialized and cached into localStorage. */ /** Notification state. Serialized and cached into localStorage. */
export type Notification< export type Notification<
NotificationIdType extends NotificationId = string, _NotificationId extends NotificationId = string,
NotificationUpdateKey = any NotificationUpdateKey = any
> = { > = {
id: NotificationIdType; id: _NotificationId;
type: NotificationType; type: NotificationType;
status: NotificationStatus; status: NotificationStatus;
timestamps: Partial<Record<NotificationStatus, number>>; timestamps: Partial<Record<NotificationStatus, number>>;
@@ -79,15 +85,15 @@ export type Notifications = Record<NotificationId, Notification<any>>;
/** Notification display data derived from app state at runtime. */ /** Notification display data derived from app state at runtime. */
export type NotificationDisplayData = { export type NotificationDisplayData = {
icon?: React.ReactNode; icon?: React.ReactElement<any, 'svg'>;
title?: string; title?: string;
description?: React.ReactNode; description?: ReactNode;
customContent?: React.ReactNode; customContent?: ReactNode;
customMenuContent?: React.ReactNode; customMenuContent?: ReactNode;
actionDescription?: string; actionDescription?: string;
+2
View File
@@ -1,3 +1,5 @@
import { getSeparator } from '@/lib/numbers';
export const USD_DECIMALS = 2; export const USD_DECIMALS = 2;
export const SMALL_USD_DECIMALS = 4; export const SMALL_USD_DECIMALS = 4;
-4
View File
@@ -5,10 +5,6 @@ export const tradeTooltips: TooltipStrings = {
title: stringGetter({ key: TOOLTIP_STRING_KEYS.ACCOUNT_LEVERAGE_TITLE }), title: stringGetter({ key: TOOLTIP_STRING_KEYS.ACCOUNT_LEVERAGE_TITLE }),
body: stringGetter({ key: TOOLTIP_STRING_KEYS.ACCOUNT_LEVERAGE_BODY }), body: stringGetter({ key: TOOLTIP_STRING_KEYS.ACCOUNT_LEVERAGE_BODY }),
}), }),
'base-position-notional': ({ stringGetter }) => ({
title: stringGetter({ key: TOOLTIP_STRING_KEYS.BASE_POSITION_NOTIONAL_TITLE }),
body: stringGetter({ key: TOOLTIP_STRING_KEYS.BASE_POSITION_NOTIONAL_BODY }),
}),
'bracket-sl': ({ stringGetter }) => ({ 'bracket-sl': ({ stringGetter }) => ({
title: stringGetter({ key: TOOLTIP_STRING_KEYS.BRACKET_ORDER_SL_TITLE }), title: stringGetter({ key: TOOLTIP_STRING_KEYS.BRACKET_ORDER_SL_TITLE }),
body: stringGetter({ key: TOOLTIP_STRING_KEYS.BRACKET_ORDER_SL_BODY }), body: stringGetter({ key: TOOLTIP_STRING_KEYS.BRACKET_ORDER_SL_BODY }),
+4 -2
View File
@@ -1,6 +1,4 @@
import type { ExternalProvider } from '@ethersproject/providers'; import type { ExternalProvider } from '@ethersproject/providers';
import { USDC_DENOM, type onboarding, DYDX_DENOM } from '@dydxprotocol/v4-client-js';
import type { suggestChain } from 'graz';
import { STRING_KEYS } from '@/constants/localization'; import { STRING_KEYS } from '@/constants/localization';
@@ -315,6 +313,10 @@ export type WalletConnection = {
}; };
// dYdX Chain wallets // dYdX Chain wallets
import { USDC_DENOM, type onboarding, DYDX_DENOM } from '@dydxprotocol/v4-client-js';
import type { suggestChain } from 'graz';
export const COSMOS_DERIVATION_PATH = "m/44'/118'/0'/0/0"; export const COSMOS_DERIVATION_PATH = "m/44'/118'/0'/0/0";
/** /**
+1 -1
View File
@@ -4,7 +4,7 @@ import { useMatch, useNavigate } from 'react-router-dom';
import { LocalStorageKey } from '@/constants/localStorage'; import { LocalStorageKey } from '@/constants/localStorage';
import { DEFAULT_MARKETID } from '@/constants/markets'; import { DEFAULT_MARKETID } from '@/constants/markets';
import { AppRoute } from '@/constants/routes'; import { AppRoute, DEFAULT_TRADE_ROUTE } from '@/constants/routes';
import { getSelectedNetwork } from '@/state/appSelectors'; import { getSelectedNetwork } from '@/state/appSelectors';
import { closeDialogInTradeBox } from '@/state/dialogs'; import { closeDialogInTradeBox } from '@/state/dialogs';
+1 -1
View File
@@ -114,7 +114,7 @@ const useDydxClientContext = () => {
}): Promise<Candle[]> => { }): Promise<Candle[]> => {
try { try {
const { candles } = const { candles } =
(await compositeClient?.indexerClient.markets.getPerpetualMarketCandles( (await compositeClient!.indexerClient.markets.getPerpetualMarketCandles(
marketId, marketId,
RESOLUTION_MAP[resolution], RESOLUTION_MAP[resolution],
fromIso, fromIso,
+38 -39
View File
@@ -1,27 +1,27 @@
import { useCallback, useEffect, useMemo } from 'react'; import { useCallback, useEffect, useMemo } from 'react';
import { useSelector, shallowEqual, useDispatch } from 'react-redux'; import { useSelector, shallowEqual, useDispatch } from 'react-redux';
import { groupBy } from 'lodash'; import { groupBy } from 'lodash';
import { TESTNET_CHAIN_ID } from '@dydxprotocol/v4-client-js';
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';
import { type NotificationTypeConfig, NotificationType } from '@/constants/notifications'; import { type NotificationTypeConfig, NotificationType } from '@/constants/notifications';
import { ORDER_SIDE_STRINGS, TRADE_TYPE_STRINGS, TradeTypes } from '@/constants/trade'; import { ORDER_SIDE_STRINGS } from '@/constants/trade';
import { useLocalNotifications } from '@/hooks/useLocalNotifications'; import { useLocalNotifications } from '@/hooks/useLocalNotifications';
import { AssetIcon } from '@/components/AssetIcon';
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 { OrderStatusIcon } from '@/views/OrderStatusIcon';
import { TransferStatusToast } from '@/views/TransferStatus'; import { TransferStatusToast } from '@/views/TransferStatus';
import { TransferStatusSteps } from '@/views/TransferStatusSteps';
import { getSubaccountFills, getSubaccountOrders } from '@/state/accountSelectors'; import { getSubaccountFills, getSubaccountOrders } from '@/state/accountSelectors';
import { openDialog } from '@/state/dialogs'; import { openDialog } from '@/state/dialogs';
import { OrderStatusIcon } from '@/views/OrderStatusIcon';
import { useStringGetter } from './useStringGetter'; import { useStringGetter } from './useStringGetter';
import { TransferStatusSteps } from '@/views/TransferStatusSteps';
import { TESTNET_CHAIN_ID } from '@dydxprotocol/v4-client-js';
export const notificationTypes = [ export const notificationTypes = [
{ {
@@ -58,34 +58,33 @@ export const notificationTypes = [
} }
: undefined); : undefined);
if (order) if (order) console.log(order);
trigger( trigger({
order.id, id: order.id,
{ displayData: {
icon: ( icon: <AssetIcon symbol={order.marketId.split('-')[0]} />, //<OrderStatusIcon status={order.status} totalFilled={order.totalFilled ?? 0} />,
<OrderStatusIcon status={order.status} totalFilled={order.totalFilled ?? 0} /> title: `${stringGetter({
), key: order.resources.typeStringKey ?? '',
title: `${stringGetter({ })} ${
key: TRADE_TYPE_STRINGS[order.type.rawValue as TradeTypes].tradeTypeKey, order.status === AbacusOrderStatus.open && (order?.totalFilled ?? 0) > 0
})} ${ ? stringGetter({ key: STRING_KEYS.PARTIALLY_FILLED })
order.status === AbacusOrderStatus.open && (order?.totalFilled ?? 0) > 0 : stringGetter({ key: ORDER_STATUS_STRINGS[order.status.name] })
? stringGetter({ key: STRING_KEYS.PARTIALLY_FILLED }) }`,
: stringGetter({ key: ORDER_STATUS_STRINGS[order.status.name] })
}`, description: `${stringGetter({
description: `${stringGetter({ key: ORDER_SIDE_STRINGS[ORDER_SIDES[order.side.name]],
key: ORDER_SIDE_STRINGS[ORDER_SIDES[order.side.name]], })} ${order.size} ${order.marketId} @ $${order.price}`,
})} ${order.size} ${order.marketId} @ $${order.price}`, actionDescription: 'View Order',
actionDescription: 'View Order', actionAltText: 'View this order in the Orders tab or the Notifications menu.',
actionAltText: 'View this order in the Orders tab or the Notifications menu.', toastSensitivity:
toastSensitivity: order.status === AbacusOrderStatus.pending ? 'foreground' : 'background',
order.status === AbacusOrderStatus.pending ? 'foreground' : 'background', toastDuration: Infinity,
toastDuration: 5000, },
}, updateKey: [order.status.name, order.size],
[order.status.name, order.size], isNew: !order.createdAtMilliseconds || order.createdAtMilliseconds > lastUpdated,
!order.createdAtMilliseconds || order.createdAtMilliseconds > lastUpdated });
);
} }
}, [orderIds]); }, [orderIds, stringGetter]);
}, },
useNotificationAction: () => { useNotificationAction: () => {
@@ -120,9 +119,9 @@ export const notificationTypes = [
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';
trigger( trigger({
txHash, id: txHash,
{ displayData: {
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) }),
// TODO: confirm with design what the description should be // TODO: confirm with design what the description should be
@@ -142,10 +141,10 @@ export const notificationTypes = [
customMenuContent: !finished && <TransferStatusSteps status={transfer.status} />, customMenuContent: !finished && <TransferStatusSteps status={transfer.status} />,
toastSensitivity: 'foreground', toastSensitivity: 'foreground',
}, },
[] updateKey: [],
); });
} }
}, [transferNotifications]); }, [transferNotifications, stringGetter]);
}, },
}, } as NotificationTypeConfig<string, []>,
] satisfies NotificationTypeConfig[]; ] satisfies NotificationTypeConfig[];
+17 -22
View File
@@ -92,7 +92,7 @@ const useNotificationsContext = () => {
for (const { type, useTrigger } of notificationTypes) for (const { type, useTrigger } of notificationTypes)
useTrigger({ useTrigger({
trigger: useCallback( trigger: useCallback(
(id, displayData, updateKey, isNew = true) => { ({ id, displayData, updateKey, isNew = true }) => {
const key = getKey({ type, id }); const key = getKey({ type, id });
const notification = notifications[key]; const notification = notifications[key];
@@ -182,28 +182,23 @@ const useNotificationsContext = () => {
const iconUrl = const iconUrl =
displayData.icon && (await renderSvgToDataUrl(displayData.icon).catch(() => undefined)); displayData.icon && (await renderSvgToDataUrl(displayData.icon).catch(() => undefined));
const pushNotification = new globalThis.Notification(displayData.title, { if (displayData.title) {
renotify: true, const pushNotification = new globalThis.Notification(displayData.title, {
tag: getKey(notification), renotify: true,
data: notification, tag: getKey(notification),
body: displayData.description, data: notification,
icon: iconUrl ?? '/favicon.svg', body: displayData.description ?? '',
badge: iconUrl ?? '/favicon.svg', icon: (iconUrl as string) ?? '/favicon.svg',
image: iconUrl ?? '/favicon.svg', badge: (iconUrl as string) ?? '/favicon.svg',
vibrate: displayData.toastSensitivity === 'foreground', image: (iconUrl as string) ?? '/favicon.svg',
requireInteraction: displayData.toastDuration === Infinity, requireInteraction: displayData.toastDuration === Infinity,
// actions: [ });
// {
// action: displayData.actionDescription,
// title: displayData.actionDescription,
// }
// ].slice(0, globalThis.Notification.maxActions),
});
pushNotification.addEventListener('click', () => { pushNotification.addEventListener('click', () => {
onNotificationAction(notification); onNotificationAction(notification);
markSeen(notification); markSeen(notification);
}); });
}
} }
setPushNotificationsLastUpdated(Date.now()); setPushNotificationsLastUpdated(Date.now());
+2 -15
View File
@@ -1,15 +1,13 @@
import { useCallback, useEffect } from 'react'; import { useCallback } 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 { CLIENT_NETWORK_CONFIGS, DEFAULT_APP_ENVIRONMENT, DydxNetwork } from '@/constants/networks'; import { 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;
@@ -24,17 +22,6 @@ 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 -1
View File
@@ -1,6 +1,6 @@
import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react'; import { createContext, useCallback, useContext, useEffect, useMemo, useState } from 'react';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import type { Nullable } from '@dydxprotocol/v4-abacus'; import type { Nullable } from '@dydxprotocol/abacus';
import Long from 'long'; import Long from 'long';
import type { IndexedTx } from '@cosmjs/stargate'; import type { IndexedTx } from '@cosmjs/stargate';
import type { EncodeObject, Coin } from '@cosmjs/proto-signing'; import type { EncodeObject, Coin } from '@cosmjs/proto-signing';
+1 -1
View File
@@ -1,4 +1,4 @@
const LogoShortIcon: React.FC<{ id?: string }> = ({ id }: { id?: string }) => ( const LogoShortIcon: React.FC<{ id?: string }> = ({ id }) => (
<svg <svg
width="135" width="135"
height="145" height="145"
+2 -1
View File
@@ -7,9 +7,10 @@ import { DialogTypes } from '@/constants/dialogs';
import { STRING_KEYS } from '@/constants/localization'; import { STRING_KEYS } from '@/constants/localization';
import { AppRoute } from '@/constants/routes'; import { AppRoute } from '@/constants/routes';
import { useStringGetter } from '@/hooks'; import { useStringGetter } from '@/hooks';
import { LogoShortIcon, BellIcon } from '@/icons'; import { LogoShortIcon } from '@/icons';
import { Icon, IconName } from '@/components/Icon'; import { Icon, IconName } from '@/components/Icon';
import { BellIcon } from '@/icons';
import { IconButton } from '@/components/IconButton'; import { IconButton } from '@/components/IconButton';
import { NavigationMenu } from '@/components/NavigationMenu'; import { NavigationMenu } from '@/components/NavigationMenu';
import { VerticalSeparator } from '@/components/Separator'; import { VerticalSeparator } from '@/components/Separator';
+6 -15
View File
@@ -15,20 +15,12 @@ type StyleProps = {
}; };
export const NotificationsToastArea = ({ className }: StyleProps) => { export const NotificationsToastArea = ({ className }: StyleProps) => {
const { const { notifications, getKey, getDisplayData, markUnseen, markSeen, isMenuOpen, onNotificationAction } = useNotifications();
notifications,
getKey,
getDisplayData,
markUnseen,
markSeen,
isMenuOpen,
onNotificationAction,
} = useNotifications();
const { isMobile } = useBreakpoints(); const { isMobile } = useBreakpoints();
return ( return (
<StyledToastArea swipeDirection={isMobile ? 'up' : 'right'} className={className}> <$ToastArea swipeDirection={isMobile ? 'up' : 'right'} className={className}>
{Object.values(notifications) {Object.values(notifications)
// Sort by time of first trigger // Sort by time of first trigger
.sort( .sort(
@@ -61,20 +53,19 @@ export const NotificationsToastArea = ({ className }: StyleProps) => {
sensitivity={displayData.toastSensitivity} sensitivity={displayData.toastSensitivity}
setIsOpen={(isOpen, isClosedFromTimeout) => { setIsOpen={(isOpen, isClosedFromTimeout) => {
if (!isOpen) if (!isOpen)
if (isClosedFromTimeout) // Toast timer expired without user interaction
// Toast timer expired without user interaction if (isClosedFromTimeout) markUnseen(notification);
markUnseen(notification);
// Toast interacted with or dismissed // Toast interacted with or dismissed
else markSeen(notification); else markSeen(notification);
}} }}
lastUpdated={notification.timestamps[notification.status]} lastUpdated={notification.timestamps[notification.status]}
/> />
))} ))}
</StyledToastArea> </$ToastArea>
); );
}; };
const StyledToastArea = styled(ToastArea)` const $ToastArea = styled(ToastArea)`
position: absolute; position: absolute;
width: min(16rem, 100%); width: min(16rem, 100%);
inset: 0 0 0 auto; inset: 0 0 0 auto;
+24 -44
View File
@@ -1,4 +1,4 @@
import Abacus, { Nullable } from '@dydxprotocol/v4-abacus'; import Abacus, { Nullable } from '@dydxprotocol/abacus';
import Long from 'long'; import Long from 'long';
import { import {
@@ -15,24 +15,14 @@ import {
type QueryTypes, type QueryTypes,
type TransactionTypes, type TransactionTypes,
} from '@/constants/abacus'; } from '@/constants/abacus';
import { DialogTypes } from '@/constants/dialogs';
import { RootStore } from '@/state/_store';
import { openDialog } from '@/state/dialogs';
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;
constructor() { constructor() {
this.compositeClient = undefined; this.compositeClient = undefined;
this.store = undefined;
}
setStore(store: RootStore): void {
this.store = store;
} }
async connectNetwork( async connectNetwork(
@@ -43,41 +33,30 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
faucetUrl: Nullable<string> | undefined, faucetUrl: Nullable<string> | undefined,
callback: (p0: Nullable<string>) => void callback: (p0: Nullable<string>) => void
): Promise<void> { ): Promise<void> {
try { this.compositeClient = await CompositeClient.connect(
const compositeClient = await CompositeClient.connect( new Network(
new Network( chainId,
chainId, new IndexerConfig(indexerUrl, indexerSocketUrl),
new IndexerConfig(indexerUrl, indexerSocketUrl), new ValidatorConfig(validatorUrl, chainId, {
new ValidatorConfig(validatorUrl, chainId, { broadcastPollIntervalMs: 3_000,
broadcastPollIntervalMs: 3_000, broadcastTimeoutMs: 60_000,
broadcastTimeoutMs: 60_000, })
}) )
) );
);
this.compositeClient = compositeClient; // Dispatch custom event to notify other parts of the app that the network has been connected
const customEvent = new CustomEvent('abacus:connectNetwork', {
detail: {
indexerUrl,
indexerSocketUrl,
validatorUrl,
chainId,
faucetUrl,
},
});
// Dispatch custom event to notify other parts of the app that the network has been connected globalThis.dispatchEvent(customEvent);
const customEvent = new CustomEvent('abacus:connectNetwork', { callback(JSON.stringify({ success: true }));
detail: {
indexerUrl,
indexerSocketUrl,
validatorUrl,
chainId,
faucetUrl,
},
});
globalThis.dispatchEvent(customEvent);
callback(JSON.stringify({ success: true }));
} catch (error) {
this.store?.dispatch(
openDialog({ type: DialogTypes.ExchangeOffline, dialogProps: { preventClose: true } })
);
log('DydxChainTransactions/connectNetwork', error);
return;
}
} }
parseToPrimitives<T>(x: T): T { parseToPrimitives<T>(x: T): T {
@@ -106,6 +85,7 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
throw new Error(`Unsupported data type: ${typeof x}`); throw new Error(`Unsupported data type: ${typeof x}`);
} }
async transaction( async transaction(
type: TransactionTypes, type: TransactionTypes,
paramsInJson: Abacus.Nullable<string>, paramsInJson: Abacus.Nullable<string>,
+3 -5
View File
@@ -36,6 +36,7 @@ import AbacusStateNotifier from './stateNotification';
import AbacusLocalizer from './localizer'; import AbacusLocalizer from './localizer';
import AbacusFormatter from './formatter'; import AbacusFormatter from './formatter';
import AbacusThreading from './threading'; import AbacusThreading from './threading';
import AbacusTracking from './tracking';
import AbacusFileSystem, { ENDPOINTS_PATH } from './filesystem'; import AbacusFileSystem, { ENDPOINTS_PATH } from './filesystem';
import { LocaleSeparators } from '../numbers'; import { LocaleSeparators } from '../numbers';
class AbacusStateManager { class AbacusStateManager {
@@ -46,7 +47,6 @@ class AbacusStateManager {
websocket: AbacusWebsocket; websocket: AbacusWebsocket;
stateNotifier: AbacusStateNotifier; stateNotifier: AbacusStateNotifier;
abacusFormatter: AbacusFormatter; abacusFormatter: AbacusFormatter;
chainTransactionClient: AbacusChainTransaction;
constructor() { constructor() {
this.store = undefined; this.store = undefined;
@@ -54,14 +54,13 @@ class AbacusStateManager {
this.stateNotifier = new AbacusStateNotifier(); this.stateNotifier = new AbacusStateNotifier();
this.websocket = new AbacusWebsocket(); this.websocket = new AbacusWebsocket();
this.abacusFormatter = new AbacusFormatter(); this.abacusFormatter = new AbacusFormatter();
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.chainTransactionClient, new AbacusChainTransaction(),
null, new AbacusTracking(),
new AbacusThreading(), new AbacusThreading(),
new CoroutineTimer(), new CoroutineTimer(),
new AbacusFileSystem() new AbacusFileSystem()
@@ -157,7 +156,6 @@ class AbacusStateManager {
setStore = (store: RootStore) => { setStore = (store: RootStore) => {
this.store = store; this.store = store;
this.stateNotifier.setStore(store); this.stateNotifier.setStore(store);
this.chainTransactionClient.setStore(store);
}; };
setAccount = (walletAddress: string) => { setAccount = (walletAddress: string) => {
+1 -1
View File
@@ -1,4 +1,4 @@
import type { Nullable, kollections } from '@dydxprotocol/v4-abacus'; import type { Nullable, kollections } from '@dydxprotocol/abacus';
import type { AbacusRestProtocol } from '@/constants/abacus'; import type { AbacusRestProtocol } from '@/constants/abacus';
+1 -1
View File
@@ -1,4 +1,4 @@
import { kollections } from '@dydxprotocol/v4-abacus'; import { kollections } from '@dydxprotocol/abacus';
import type { import type {
AbacusApiState, AbacusApiState,
+9
View File
@@ -0,0 +1,9 @@
import type { AbacusTrackingProtocol, Nullable } from '@/constants/abacus';
class AbacusTracking implements AbacusTrackingProtocol {
log(event: string, data: Nullable<string>) {
console.log({ event, data });
}
}
export default AbacusTracking;
+1 -1
View File
@@ -48,7 +48,7 @@ export const isNumber = (value: any): value is number =>
/** /**
* @description Returns null if input is 0 or null, '99+' if input is greater than 99, otherwise original input number * @description Returns null if input is 0 or null, '99+' if input is greater than 99, otherwise original input number
*/ */
export const shortenNumberForDisplay = (num?: number) => export const shorternNumberForDisplay = (num?: number) =>
MustBigNumber(num).eq(0) ? null : MustBigNumber(num).gt(99) ? '99+' : num; MustBigNumber(num).eq(0) ? null : MustBigNumber(num).gt(99) ? '99+' : num;
/** /**
+4 -2
View File
@@ -21,8 +21,10 @@ const applyComputedStyles = (html: string) => {
const toDataUrl = (bytes: string, type = 'image/svg+xml') => const toDataUrl = (bytes: string, type = 'image/svg+xml') =>
new Promise<string | ArrayBuffer | null>((resolve, reject) => { new Promise<string | ArrayBuffer | null>((resolve, reject) => {
Object.assign(new FileReader(), { Object.assign(new FileReader(), {
onload: (e) => resolve(e.target.result), onload: (e: {
onerror: (e) => reject(e.target.error), target: { result: string | ArrayBuffer | PromiseLike<string | ArrayBuffer | null> | null };
}) => resolve(e.target.result),
onerror: (e: { target: { error: Error } }) => reject(e.target.error),
}).readAsDataURL(new File([bytes], '', { type })); }).readAsDataURL(new File([bytes], '', { type }));
}); });
+3 -11
View File
@@ -1,7 +1,5 @@
export const log = (location: string, error: Error, metadata?: any) => { export const log = (location: string, error: Error, metadata?: any) => {
if (import.meta.env.MODE !== 'production') { // console.warn(error);
console.warn('telemetry/log:', { location, error, metadata });
}
const customEvent = new CustomEvent('dydx:log', { const customEvent = new CustomEvent('dydx:log', {
detail: { detail: {
@@ -18,10 +16,7 @@ export const log = (location: string, error: Error, metadata?: any) => {
globalThis.addEventListener('unhandledrejection', (event) => { globalThis.addEventListener('unhandledrejection', (event) => {
event.preventDefault(); event.preventDefault();
log( log('window/onunhandledrejection', new Error(`Promise rejected and uncaught; reason: ${event.reason}`));
'window/onunhandledrejection',
new Error(`Promise rejected and uncaught; reason: ${event.reason}`)
);
}); });
// Log rejected Promises that are caught late (handler attached at a later time) // Log rejected Promises that are caught late (handler attached at a later time)
@@ -30,10 +25,7 @@ globalThis.addEventListener(
(event) => { (event) => {
event.preventDefault(); event.preventDefault();
log( log('window/onrejectionhandled', new Error(`Promise rejected and caught late; reason: ${event.reason}`));
'window/onrejectionhandled',
new Error(`Promise rejected and caught late; reason: ${event.reason}`)
);
}, },
false false
); );
+3 -3
View File
@@ -1,5 +1,5 @@
import { useCallback, useEffect, useMemo, useState } from 'react'; import { useCallback, useEffect, useMemo, useState } from 'react';
import { Nullable } from '@dydxprotocol/v4-abacus'; import { Nullable } from '@dydxprotocol/abacus';
import styled, { AnyStyledComponent } from 'styled-components'; import styled, { AnyStyledComponent } from 'styled-components';
import { shallowEqual, useSelector } from 'react-redux'; import { shallowEqual, useSelector } from 'react-redux';
@@ -270,11 +270,11 @@ Styled.FeeTable = styled(Table)`
--table-cell-align: end; --table-cell-align: end;
font: var(--font-base-book); font: var(--font-base-book);
tbody tr { tbody tr {
&[data-yours='true'] { &[data-yours='true'] {
background-color: var(--color-layer-3); background-color: var(--color-layer-3);
td:first-child { td:first-child {
border-left: 0.125rem solid var(--color-accent); border-left: 0.125rem solid var(--color-accent);
} }
+5 -5
View File
@@ -31,7 +31,7 @@ import {
import { getCurrentMarketAssetId, getCurrentMarketId } from '@/state/perpetualsSelectors'; import { getCurrentMarketAssetId, getCurrentMarketId } from '@/state/perpetualsSelectors';
import { isTruthy } from '@/lib/isTruthy'; import { isTruthy } from '@/lib/isTruthy';
import { shortenNumberForDisplay } from '@/lib/numbers'; import { shorternNumberForDisplay } from '@/lib/numbers';
import { PositionInfo } from '@/views/PositionInfo'; import { PositionInfo } from '@/views/PositionInfo';
@@ -73,9 +73,9 @@ export const HorizontalPanel = ({ isOpen = true, setIsOpen }: ElementProps) => {
const showCurrentMarket = isTablet || view === PanelView.CurrentMarket; const showCurrentMarket = isTablet || view === PanelView.CurrentMarket;
const fillsTagNumber = shortenNumberForDisplay(showCurrentMarket ? numFills : numTotalFills); const fillsTagNumber = shorternNumberForDisplay(showCurrentMarket ? numFills : numTotalFills);
const ordersTagNumber = shortenNumberForDisplay( const ordersTagNumber = shorternNumberForDisplay(
showCurrentMarket ? numOpenOrders : numTotalOpenOrders showCurrentMarket ? numOpenOrders : numTotalOpenOrders
); );
@@ -86,7 +86,7 @@ export const HorizontalPanel = ({ isOpen = true, setIsOpen }: ElementProps) => {
key: showCurrentMarket ? STRING_KEYS.POSITION : STRING_KEYS.POSITIONS, key: showCurrentMarket ? STRING_KEYS.POSITION : STRING_KEYS.POSITIONS,
}), }),
tag: showCurrentMarket ? null : shortenNumberForDisplay(numTotalPositions), tag: showCurrentMarket ? null : shorternNumberForDisplay(numTotalPositions),
content: showCurrentMarket ? ( content: showCurrentMarket ? (
<PositionInfo showNarrowVariation={isTablet} /> <PositionInfo showNarrowVariation={isTablet} />
@@ -190,7 +190,7 @@ export const HorizontalPanel = ({ isOpen = true, setIsOpen }: ElementProps) => {
// value: InfoSection.Payments, // value: InfoSection.Payments,
// label: stringGetter({ key: STRING_KEYS.PAYMENTS }), // label: stringGetter({ key: STRING_KEYS.PAYMENTS }),
// tag: shortenNumberForDisplay( // tag: shorternNumberForDisplay(
// showCurrentMarket ? numFundingPayments : numTotalFundingPayments // showCurrentMarket ? numFundingPayments : numTotalFundingPayments
// ), // ),
// content: ( // content: (
+2 -1
View File
@@ -1,6 +1,5 @@
import { configureStore } from '@reduxjs/toolkit'; import { configureStore } from '@reduxjs/toolkit';
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';
@@ -17,6 +16,8 @@ import { localizationSlice } from './localization';
import { navigationSlice } from './navigation'; import { navigationSlice } from './navigation';
import { perpetualsSlice } from './perpetuals'; import { perpetualsSlice } from './perpetuals';
import abacusStateManager from '@/lib/abacus';
export const commandMenuSlices = [layoutSlice, localizationSlice]; export const commandMenuSlices = [layoutSlice, localizationSlice];
export const store = configureStore({ export const store = configureStore({
+1
View File
@@ -1,4 +1,5 @@
import { createSlice, type PayloadAction } from '@reduxjs/toolkit'; import { createSlice, type PayloadAction } from '@reduxjs/toolkit';
import _ from 'lodash';
import type { import type {
SubaccountFill, SubaccountFill,
+8 -11
View File
@@ -12,9 +12,10 @@ import {
import { OnboardingState } from '@/constants/account'; import { OnboardingState } from '@/constants/account';
import { getHydratedTradingData } from '@/lib/orders';
import type { RootState } from './_store'; import type { RootState } from './_store';
import { getHydratedTradingData } from '@/lib/orders';
import { getCurrentMarketId, getPerpetualMarkets } from './perpetualsSelectors'; import { getCurrentMarketId, getPerpetualMarkets } from './perpetualsSelectors';
import { getAssets } from './assetsSelectors'; import { getAssets } from './assetsSelectors';
@@ -105,11 +106,11 @@ export const getSubaccountOpenOrdersBySideAndPrice = createSelector(
[getSubaccountOpenOrders], [getSubaccountOpenOrders],
(openOrders = []) => { (openOrders = []) => {
const ordersBySide: Partial<Record<OrderSide, Record<number, SubaccountOrder>>> = {}; const ordersBySide: Partial<Record<OrderSide, Record<number, SubaccountOrder>>> = {};
openOrders.forEach((order) => { for (const order of openOrders) {
const side = ORDER_SIDES[order.side.name]; const side = ORDER_SIDES[order.side.name];
const byPrice = (ordersBySide[side] ??= {}); const byPrice = (ordersBySide[side] ??= {});
byPrice[order.price] = order; byPrice[order.price] = order;
}); }
return ordersBySide; return ordersBySide;
} }
); );
@@ -122,10 +123,8 @@ export const getOrderDetails = (orderId: string) =>
createSelector( createSelector(
[getSubaccountOrders, getAssets, getPerpetualMarkets], [getSubaccountOrders, getAssets, getPerpetualMarkets],
(orders, assets, perpetualMarkets) => { (orders, assets, perpetualMarkets) => {
const matchingOrder = orders?.find((order) => order.id === orderId); const order = orders?.find((order) => order.id === orderId);
return matchingOrder return order ? getHydratedTradingData({ data: order, assets, perpetualMarkets }) : undefined;
? getHydratedTradingData({ data: matchingOrder, assets, perpetualMarkets })
: undefined;
} }
); );
@@ -179,10 +178,8 @@ export const getFillDetails = (fillId: string) =>
createSelector( createSelector(
[getSubaccountFills, getAssets, getPerpetualMarkets], [getSubaccountFills, getAssets, getPerpetualMarkets],
(fills, assets, perpetualMarkets) => { (fills, assets, perpetualMarkets) => {
const matchingFill = fills?.find((fill) => fill.id === fillId); const fill = fills?.find((fill) => fill.id === fillId);
return matchingFill return fill ? getHydratedTradingData({ data: fill, assets, perpetualMarkets }) : undefined;
? getHydratedTradingData({ data: matchingFill, assets, perpetualMarkets })
: undefined;
} }
); );
+6 -2
View File
@@ -47,5 +47,9 @@ export const appSlice = createSlice({
}, },
}); });
export const { initializeLocalization, initializeWebsocket, setApiState, setSelectedNetwork } = export const {
appSlice.actions; initializeLocalization,
initializeWebsocket,
setApiState,
setSelectedNetwork,
} = appSlice.actions;
+1 -1
View File
@@ -1,5 +1,5 @@
import { createSlice, type PayloadAction } from '@reduxjs/toolkit'; import { createSlice, type PayloadAction } from '@reduxjs/toolkit';
import type { kollections } from '@dydxprotocol/v4-abacus'; import type { kollections } from '@dydxprotocol/abacus';
import type { Configs, FeeDiscount, FeeTier, NetworkConfigs, Nullable } from '@/constants/abacus'; import type { Configs, FeeDiscount, FeeTier, NetworkConfigs, Nullable } from '@/constants/abacus';
import { LocalStorageKey } from '@/constants/localStorage'; import { LocalStorageKey } from '@/constants/localStorage';
+1 -1
View File
@@ -2,4 +2,4 @@ import { type RootState } from './_store';
export const getActiveDialog = (state: RootState) => state.dialogs.activeDialog; export const getActiveDialog = (state: RootState) => state.dialogs.activeDialog;
export const getActiveTradeBoxDialog = (state: RootState) => state.dialogs.activeTradeBoxDialog; export const getActiveTradeBoxDialog = (state: RootState) => state.dialogs.activeTradeBoxDialog;
+1 -1
View File
@@ -40,7 +40,7 @@ export const getStringGetterForLocaleData = (localeData: LocaleData) => {
params?: { [key: string]: string | React.ReactNode }; params?: { [key: string]: string | React.ReactNode };
}): string | Array<string | React.ReactNode> => { }): string | Array<string | React.ReactNode> => {
// Fallback to english whenever a key doesn't exist for other languages // Fallback to english whenever a key doesn't exist for other languages
const formattedString: string = _.get(localeData, key) || _.get(EN_LOCALE_DATA, key) || ''; let formattedString: string = _.get(localeData, key) || _.get(EN_LOCALE_DATA, key) || '';
return formatString(formattedString, params); return formatString(formattedString, params);
}; };
+3 -2
View File
@@ -1,10 +1,11 @@
import { matchPath } from 'react-router-dom';
import { createSelector } from 'reselect'; import { createSelector } from 'reselect';
import { Candle, TradingViewBar } from '@/constants/candles'; import { Candle, TradingViewBar } from '@/constants/candles';
import { TRADE_ROUTE } from '@/constants/routes';
import { mapCandle } from '@/lib/tradingView/utils';
import type { RootState } from './_store'; import type { RootState } from './_store';
import { mapCandle } from '@/lib/tradingView/utils';
/** /**
* @param state * @param state
+1 -1
View File
@@ -1,4 +1,4 @@
import { css } from 'styled-components'; import styled, { css, type FlattenSimpleInterpolation } from 'styled-components';
import breakpoints from './breakpoints'; import breakpoints from './breakpoints';
+22 -26
View File
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2
View File
@@ -6,6 +6,8 @@ import {
type ThemeProps, type ThemeProps,
} from 'styled-components'; } from 'styled-components';
import breakpoints from './breakpoints';
export const layoutMixins: Record< export const layoutMixins: Record<
string, string,
FlattenSimpleInterpolation | FlattenInterpolation<ThemeProps<any>> FlattenSimpleInterpolation | FlattenInterpolation<ThemeProps<any>>
+1
View File
@@ -5,6 +5,7 @@ import {
type ThemeProps, type ThemeProps,
} from 'styled-components'; } from 'styled-components';
import breakpoints from './breakpoints';
import { layoutMixins } from './layoutMixins'; import { layoutMixins } from './layoutMixins';
export const tableMixins: Record< export const tableMixins: Record<
+8 -2
View File
@@ -1,16 +1,22 @@
/* Constants */ /* Constants */
:root { :root {
--fontFamily-base: "Satoshi", system-ui, -apple-system, Helvetica, Arial, sans-serif; --fontFamily-base: "Circular", system-ui, -apple-system, Helvetica, Arial, sans-serif;
--fontFamily-monospace: Courier, monospace, var(--fontFamily-base); --fontFamily-monospace: "CircularMono", Courier, monospace, var(--fontFamily-base);
--fontWeight-base-0: 450; --fontWeight-base-0: 450;
--fontWeight-base-1: 500; --fontWeight-base-1: 500;
--fontWeight-base-2: 700; --fontWeight-base-2: 700;
--fontWeight-monospace: 400;
--letter-spacing-base: -0.02em; --letter-spacing-base: -0.02em;
/* New Typography system */ /* New Typography system */
/**
* @size 10px/11px
* @weight 400
*/
--fontSize-tiny: 0.625rem; /* 10px/11px */ --fontSize-tiny: 0.625rem; /* 10px/11px */
--fontSize-mini: 0.75rem; /* 12px/13px */ --fontSize-mini: 0.75rem; /* 12px/13px */
--fontSize-small: 0.8438rem; /* 13.5px/14.5px */ --fontSize-small: 0.8438rem; /* 13.5px/14.5px */
+39 -29
View File
@@ -2,7 +2,7 @@ import { shallowEqual, useSelector } from 'react-redux';
import styled, { type AnyStyledComponent } from 'styled-components'; import styled, { type AnyStyledComponent } from 'styled-components';
import { ButtonShape, ButtonSize, ButtonType } from '@/constants/buttons'; import { ButtonShape, ButtonSize, ButtonType } from '@/constants/buttons';
import { STRING_KEYS, type StringKey } from '@/constants/localization'; import { STRING_KEYS } from '@/constants/localization';
import { useBreakpoints, useStringGetter } from '@/hooks'; import { useBreakpoints, useStringGetter } from '@/hooks';
import { breakpoints } from '@/styles'; import { breakpoints } from '@/styles';
import { layoutMixins } from '@/styles/layoutMixins'; import { layoutMixins } from '@/styles/layoutMixins';
@@ -29,13 +29,15 @@ export const MarketDetails: React.FC = () => {
if (!configs) return null; if (!configs) return null;
const { const {
basePositionNotional,
tickSize, tickSize,
stepSize, stepSize,
initialMarginFraction, initialMarginFraction,
maintenanceMarginFraction, maintenanceMarginFraction,
minOrderSize, minOrderSize,
stepSizeDecimals, maxPositionSize,
baselinePositionSize,
incrementalInitialMarginFraction,
incrementalPositionSize,
tickSizeDecimals, tickSizeDecimals,
} = configs; } = configs;
@@ -70,28 +72,12 @@ export const MarketDetails: React.FC = () => {
key: 'step-size', key: 'step-size',
label: stringGetter({ key: STRING_KEYS.STEP_SIZE }), label: stringGetter({ key: STRING_KEYS.STEP_SIZE }),
tooltip: 'step-size', tooltip: 'step-size',
value: ( value: <Output useGrouping value={stepSize} type={OutputType.Asset} tag={symbol} />,
<Output
useGrouping
value={stepSize}
type={OutputType.Asset}
tag={symbol}
fractionDigits={stepSizeDecimals}
/>
),
}, },
{ {
key: 'min-order-size', key: 'min-order-size',
label: stringGetter({ key: STRING_KEYS.MINIMUM_ORDER_SIZE }), label: stringGetter({ key: STRING_KEYS.MINIMUM_ORDER_SIZE }),
value: ( value: <Output useGrouping value={minOrderSize} type={OutputType.Asset} tag={symbol} />,
<Output
useGrouping
value={minOrderSize}
type={OutputType.Asset}
tag={symbol}
fractionDigits={stepSizeDecimals}
/>
),
}, },
{ {
key: 'max-leverage', key: 'max-leverage',
@@ -114,16 +100,40 @@ export const MarketDetails: React.FC = () => {
), ),
}, },
{ {
key: 'base-initial-margin-fraction', key: 'initial-margin-fraction',
label: stringGetter({ key: STRING_KEYS.BASE_INITIAL_MARGIN_FRACTION }), label: stringGetter({ key: STRING_KEYS.INITIAL_MARGIN_FRACTION }),
tooltip: 'initial-margin-fraction', tooltip: 'initial-margin-fraction',
value: <Output useGrouping value={initialMarginFraction} type={OutputType.SmallPercent} />, value: <Output useGrouping value={initialMarginFraction} type={OutputType.SmallPercent} />,
}, },
{ {
key: 'base-position-notional', key: 'incremental-initial-margin-fraction',
label: stringGetter({ key: STRING_KEYS.BASE_POSITION_NOTIONAL }), label: stringGetter({ key: STRING_KEYS.INCREMENTAL_INITIAL_MARGIN_FRACTION }),
tooltip: 'base-position-notional', value: (
value: <Output useGrouping value={basePositionNotional} type={OutputType.Number} />, <Output
useGrouping
value={incrementalInitialMarginFraction}
type={OutputType.SmallPercent}
/>
),
},
{
key: 'incremental-position-size',
label: stringGetter({ key: STRING_KEYS.INCREMENTAL_POSITION_SIZE }),
value: (
<Output useGrouping value={incrementalPositionSize} type={OutputType.Asset} tag={symbol} />
),
},
{
key: 'baseline-position-size',
label: stringGetter({ key: STRING_KEYS.BASELINE_POSITION_SIZE }),
value: (
<Output useGrouping value={baselinePositionSize} type={OutputType.Asset} tag={symbol} />
),
},
{
key: 'max-position-size',
label: stringGetter({ key: STRING_KEYS.MAXIMUM_POSITION_SIZE }),
value: <Output useGrouping value={maxPositionSize} type={OutputType.Asset} tag={symbol} />,
}, },
]; ];
@@ -140,10 +150,10 @@ export const MarketDetails: React.FC = () => {
<Styled.MarketDescription> <Styled.MarketDescription>
{primaryDescriptionKey && ( {primaryDescriptionKey && (
<p>{stringGetter({ key: STRING_KEYS[primaryDescriptionKey as StringKey] })}</p> <p>{stringGetter({ key: STRING_KEYS[primaryDescriptionKey] })}</p>
)} )}
{secondaryDescriptionKey && ( {secondaryDescriptionKey && (
<p>{stringGetter({ key: STRING_KEYS[secondaryDescriptionKey as StringKey] })}</p> <p>{stringGetter({ key: STRING_KEYS[secondaryDescriptionKey] })}</p>
)} )}
</Styled.MarketDescription> </Styled.MarketDescription>
@@ -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 } from '@/constants/localization'; import { STRING_KEYS, StringKey } from '@/constants/localization';
import { AssetIcon } from '@/components/AssetIcon'; import { AssetIcon } from '@/components/AssetIcon';
import { Button } from '@/components/Button'; import { Button } from '@/components/Button';
@@ -38,6 +38,9 @@ type ElementProps = {
setIsOpen: (open: boolean) => void; setIsOpen: (open: boolean) => void;
}; };
const isStringKey = (key: Nullable<string>): key is StringKey =>
key != null && STRING_KEYS.hasOwnProperty(key);
export const OrderDetailsDialog = ({ orderId, setIsOpen }: ElementProps) => { export const OrderDetailsDialog = ({ orderId, setIsOpen }: ElementProps) => {
const stringGetter = useStringGetter(); const stringGetter = useStringGetter();
const dispatch = useDispatch(); const dispatch = useDispatch();
@@ -47,7 +50,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 +60,7 @@ export const OrderDetailsDialog = ({ orderId, setIsOpen }: ElementProps) => {
price, price,
reduceOnly, reduceOnly,
totalFilled, totalFilled,
resources = {}, resources,
size, size,
status, status,
stepSizeDecimals, stepSizeDecimals,
@@ -109,9 +112,9 @@ export const OrderDetailsDialog = ({ orderId, setIsOpen }: ElementProps) => {
<Styled.Row> <Styled.Row>
<Styled.StatusIcon iconName={statusIcon} color={statusIconColor} /> <Styled.StatusIcon iconName={statusIcon} color={statusIconColor} />
<Styled.Status> <Styled.Status>
{statusStringKey {isStringKey(statusStringKey)
? stringGetter({ key: statusStringKey }) ? stringGetter({ key: statusStringKey })
: resources.statusStringKey : isStringKey(resources.statusStringKey)
? stringGetter({ key: resources.statusStringKey }) ? stringGetter({ key: resources.statusStringKey })
: undefined} : undefined}
</Styled.Status> </Styled.Status>
@@ -121,7 +124,9 @@ 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 ? stringGetter({ key: STRING_KEYS[cancelReason] }) : undefined, value: isStringKey(cancelReason)
? stringGetter({ key: STRING_KEYS[cancelReason] })
: undefined,
}, },
{ {
key: 'amount', key: 'amount',
+9 -23
View File
@@ -1,12 +1,12 @@
import { useEffect } from 'react'; import { useEffect } from 'react';
import styled, { AnyStyledComponent } from 'styled-components'; import styled, { AnyStyledComponent } from 'styled-components';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { useDispatch, useSelector } from 'react-redux';
import { AbacusApiStatus } from '@/constants/abacus'; import { AbacusApiStatus } from '@/constants/abacus';
import { DialogTypes } from '@/constants/dialogs';
import { STRING_KEYS } from '@/constants/localization';
import { CLIENT_NETWORK_CONFIGS } from '@/constants/networks'; import { CLIENT_NETWORK_CONFIGS } from '@/constants/networks';
import { UNICODE } from '@/constants/unicode'; import { UNICODE } from '@/constants/unicode';
import { STRING_KEYS } from '@/constants/localization';
import { useApiState, useStringGetter } from '@/hooks'; import { useApiState, useStringGetter } from '@/hooks';
import { layoutMixins } from '@/styles/layoutMixins'; import { layoutMixins } from '@/styles/layoutMixins';
@@ -17,7 +17,6 @@ import { NetworkSelectMenu } from '@/views/menus/NetworkSelectMenu';
import { closeDialog } from '@/state/dialogs'; import { closeDialog } from '@/state/dialogs';
import { getSelectedNetwork } from '@/state/appSelectors'; import { getSelectedNetwork } from '@/state/appSelectors';
import { getActiveDialog } from '@/state/dialogsSelectors';
type ElementProps = { type ElementProps = {
preventClose?: boolean; preventClose?: boolean;
@@ -29,18 +28,9 @@ export const ExchangeOfflineDialog = ({ preventClose, setIsOpen }: ElementProps)
const stringGetter = useStringGetter(); const stringGetter = useStringGetter();
const { status, statusErrorMessage } = useApiState(); const { status, statusErrorMessage } = useApiState();
const selectedNetwork = useSelector(getSelectedNetwork); const selectedNetwork = useSelector(getSelectedNetwork);
const activeDialog = useSelector(getActiveDialog, shallowEqual);
const showOfflineMessage =
import.meta.env.MODE === 'production' &&
CLIENT_NETWORK_CONFIGS[selectedNetwork].dydxChainId === 'dydx-testnet-3';
useEffect(() => { useEffect(() => {
if ( if (status === AbacusApiStatus.NORMAL) {
activeDialog?.type === DialogTypes.ExchangeOffline &&
status === AbacusApiStatus.NORMAL &&
!showOfflineMessage
) {
dispatch(closeDialog()); dispatch(closeDialog());
} }
}, [status, selectedNetwork]); }, [status, selectedNetwork]);
@@ -53,15 +43,11 @@ export const ExchangeOfflineDialog = ({ preventClose, setIsOpen }: ElementProps)
title={stringGetter({ key: STRING_KEYS.UNAVAILABLE })} title={stringGetter({ key: STRING_KEYS.UNAVAILABLE })}
> >
<Styled.Content> <Styled.Content>
{showOfflineMessage ? ( <p>{statusErrorMessage}</p>
<> {CLIENT_NETWORK_CONFIGS[selectedNetwork].dydxChainId === 'dydx-testnet-2' && (
<p>Testnet is currently offline. Please check back!</p> <Styled.Link href="https://status.v4testnet.dydx.exchange">
<Styled.Link href="https://v4-teacher.vercel.app/testnets/schedule"> {stringGetter({ key: STRING_KEYS.LEARN_MORE })} {UNICODE.ARROW_RIGHT}
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} {UNICODE.ARROW_RIGHT} </Styled.Link>
</Styled.Link>
</>
) : (
<p>{statusErrorMessage}</p>
)} )}
{import.meta.env.MODE !== 'production' && <NetworkSelectMenu />} {import.meta.env.MODE !== 'production' && <NetworkSelectMenu />}
</Styled.Content> </Styled.Content>
+1 -1
View File
@@ -13,7 +13,7 @@ import { ButtonShape, ButtonSize } from '@/constants/buttons';
import { STRING_KEYS } from '@/constants/localization'; import { STRING_KEYS } from '@/constants/localization';
import { CLIENT_NETWORK_CONFIGS } 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 { DYDX_CHAIN_ASSET_COIN_DENOM, DydxChainAsset } from '@/constants/wallets'; import { DYDX_CHAIN_ASSET_COIN_DENOM, DYDX_CHAIN_INFO, DydxChainAsset } from '@/constants/wallets';
import { import {
useAccountBalance, useAccountBalance,
+9 -7
View File
@@ -1,10 +1,12 @@
import React, { useMemo } from 'react'; import React, { useMemo } from 'react';
import { groupBy } from 'lodash'; import { groupBy } from 'lodash';
import styled from 'styled-components';
import { STRING_KEYS } from '@/constants/localization';
import { type Notification, NotificationStatus } from '@/constants/notifications'; import { type Notification, NotificationStatus } from '@/constants/notifications';
import { useStringGetter } from '@/hooks';
import { useNotifications } from '@/hooks/useNotifications'; import { useNotifications } from '@/hooks/useNotifications';
import { CloseIcon } from '@/icons';
import { Button } from '@/components/Button'; import { Button } from '@/components/Button';
import { ButtonAction, ButtonSize } from '@/constants/buttons'; import { ButtonAction, ButtonSize } from '@/constants/buttons';
@@ -13,9 +15,7 @@ import { DialogPlacement } from '@/components/Dialog';
import { Output, OutputType } from '@/components/Output'; import { Output, OutputType } from '@/components/Output';
import { IconButton } from '@/components/IconButton'; import { IconButton } from '@/components/IconButton';
import { Toolbar } from '@/components/Toolbar'; import { Toolbar } from '@/components/Toolbar';
import { CloseIcon } from '@/icons';
import styled from 'styled-components';
import { layoutMixins } from '@/styles/layoutMixins'; import { layoutMixins } from '@/styles/layoutMixins';
type ElementProps = { type ElementProps = {
@@ -27,6 +27,8 @@ export const NotificationsMenu = ({
slotTrigger, slotTrigger,
placement = DialogPlacement.Sidebar, placement = DialogPlacement.Sidebar,
}: ElementProps) => { }: ElementProps) => {
const stringGetter = useStringGetter();
const { const {
notifications, notifications,
getDisplayData, getDisplayData,
@@ -69,7 +71,7 @@ export const NotificationsMenu = ({
.map(([status, notifications]) => ({ .map(([status, notifications]) => ({
group: status, group: status,
groupLabel: { groupLabel: {
[NotificationStatus.Triggered]: 'New', [NotificationStatus.Triggered]: stringGetter({ key: STRING_KEYS.NEW }),
// [NotificationStatus.Updated]: 'Updates', // [NotificationStatus.Updated]: 'Updates',
[NotificationStatus.Seen]: 'Seen', [NotificationStatus.Seen]: 'Seen',
[NotificationStatus.Cleared]: 'Archived', [NotificationStatus.Cleared]: 'Archived',
@@ -135,7 +137,7 @@ export const NotificationsMenu = ({
isOpen={isMenuOpen || placement === DialogPlacement.Inline} isOpen={isMenuOpen || placement === DialogPlacement.Inline}
setIsOpen={setIsMenuOpen} setIsOpen={setIsMenuOpen}
items={items} items={items}
title="Notifications" title={stringGetter({ key: STRING_KEYS.NOTIFICATIONS })}
slotTrigger={ slotTrigger={
<$TriggerContainer> <$TriggerContainer>
{slotTrigger} {slotTrigger}
@@ -168,7 +170,7 @@ export const NotificationsMenu = ({
), ),
}} }}
> >
Clear All {stringGetter({ key: STRING_KEYS.CLEAR })}
</Button> </Button>
</$FooterToolbar> </$FooterToolbar>
} }
+1 -1
View File
@@ -3,12 +3,12 @@ import styled, { type AnyStyledComponent, css } from 'styled-components';
import { shallowEqual, useDispatch, useSelector } from 'react-redux'; import { shallowEqual, useDispatch, useSelector } from 'react-redux';
import { OrderSide } from '@dydxprotocol/v4-client-js'; import { OrderSide } from '@dydxprotocol/v4-client-js';
import type { ColumnSize } from '@react-types/table'; import type { ColumnSize } from '@react-types/table';
import { Nullable } from '@dydxprotocol/v4-abacus';
import { type Asset, type SubaccountFill } from '@/constants/abacus'; import { type Asset, type SubaccountFill } from '@/constants/abacus';
import { DialogTypes } from '@/constants/dialogs'; import { DialogTypes } from '@/constants/dialogs';
import { STRING_KEYS, StringGetterFunction } from '@/constants/localization'; import { STRING_KEYS, StringGetterFunction } from '@/constants/localization';
import { Nullable } from '@dydxprotocol/abacus';
import { useBreakpoints, useStringGetter } from '@/hooks'; import { useBreakpoints, useStringGetter } from '@/hooks';
import { layoutMixins } from '@/styles/layoutMixins'; import { layoutMixins } from '@/styles/layoutMixins';
Binary file not shown.