Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
514a2d3ab3 | ||
|
|
c58d94e477 | ||
|
|
68f3552569 | ||
|
|
18b12591ca | ||
|
|
3f963ffb07 | ||
|
|
aac024fd5e | ||
|
|
4913c690ec | ||
|
|
b0db577b28 | ||
|
|
9815437a80 | ||
|
|
890a4b2c0e | ||
|
|
8d3cc76d14 | ||
|
|
c7ad4b3028 | ||
|
|
c88d5dd411 | ||
|
|
d6ab547055 | ||
|
|
2fe6c2bb3b | ||
|
|
e6858ca917 | ||
|
|
d92b49f4fa | ||
|
|
e7da21962a | ||
|
|
b479531e34 | ||
|
|
0d4c5a547a | ||
|
|
5b235ee53f | ||
|
|
18dee0586b | ||
|
|
9f1f5987ee | ||
|
|
7f531516ca | ||
|
|
3fd71558c0 | ||
|
|
575856b77b | ||
|
|
e3609782ed | ||
|
|
5ca923984d | ||
|
|
d97626f543 | ||
|
|
835f82dbcc | ||
|
|
051bdda73a | ||
|
|
27b79957d4 | ||
|
|
4bacc901dc | ||
|
|
82d32a91a9 | ||
|
|
2a794f9459 | ||
|
|
5c26a0c270 | ||
|
|
e4991cc31d | ||
|
|
da908c826a |
@@ -4,6 +4,11 @@ VITE_ALCHEMY_API_KEY=
|
|||||||
|
|
||||||
VITE_PK_ENCRYPTION_KEY=
|
VITE_PK_ENCRYPTION_KEY=
|
||||||
|
|
||||||
VITE_WALLETCONNECT2_PROJECT_ID=
|
|
||||||
|
|
||||||
VITE_V3_TOKEN_ADDRESS=
|
VITE_V3_TOKEN_ADDRESS=
|
||||||
|
VITE_TOKEN_MIGRATION_URI=
|
||||||
|
|
||||||
|
AMPLITUDE_API_KEY=
|
||||||
|
BUGSNAG_API_KEY=
|
||||||
|
IOS_APP_ID=
|
||||||
|
INTERCOM_APP_ID=
|
||||||
|
STATUS_PAGE_SCRIPT_URI=
|
||||||
|
|||||||
@@ -1,48 +1,9 @@
|
|||||||
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.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
Copyright (C) 2023 dYdX Trading Inc.
|
||||||
|
|
||||||
Parameters
|
Subject to your compliance with applicable law and the v4 Terms of Use, available at dydx.exchange/legal, you are granted the right to use the Program or 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 Program or Licensed Work, all of your rights and licenses to use (including any rights to reproduce, distribute, install or modify) the Program or Licensed Work will automatically and immediately terminate.
|
||||||
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.
|
|
||||||
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 License: GNU Affero GPL License v3
|
|
||||||
|
|
||||||
License text copyright © 2023 MariaDB plc, All Rights Reserved. “Business Source License” is a trademark of MariaDB plc.
|
|
||||||
Terms
|
|
||||||
The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.
|
|
||||||
Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the terms of the Change License, and the rights granted in the paragraph above terminate.
|
|
||||||
If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License, you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must refrain from using the Licensed Work.
|
|
||||||
All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each version of the Licensed Work released by Licensor.
|
|
||||||
You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply to your use of that work.
|
|
||||||
Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License for the current and all other versions of the Licensed Work.
|
|
||||||
This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may use a trademark or logo of Licensor as expressly required by this License).TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE. MariaDB hereby grants you permission to use this License’s text to license your works, and to refer to it using the trademark “Business Source License”, as long as you comply with the Covenants of Licensor below.
|
|
||||||
Covenants of Licensor
|
|
||||||
In consideration of the right to use this License’s text and the “Business Source License” name and trademark, Licensor covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor:
|
|
||||||
To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL Version 2.0 or a later version, where “compatible” means that software provided under the Change License can be included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify additional Change Licenses without limitation.
|
|
||||||
To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the right granted in this License, as the Additional Use Grant; or (b) insert the text “None” to specify a Change Date. Not to modify this License in any other way.
|
|
||||||
Notice
|
|
||||||
The Business Source License (this document, or the “License”) is not an Open Source license. However, the Licensed Work will eventually be made available under an Open Source License, as stated in this License.
|
|
||||||
|
|
||||||
|
|
||||||
|
The “Program” or “Licensed Work” shall mean any of the following: 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. repository reflecting a copy of, or link to, this license.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
OPEN SOURCE LICENSE BELOW - TO BE APPLIED AFTER THE CHANGE DATE.
|
|
||||||
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
|
|
||||||
The GNU Affero General Public License
|
The GNU Affero General Public License
|
||||||
|
|||||||
@@ -1,16 +1,17 @@
|
|||||||
<p align="center"><img src="https://dydx.exchange/icon.svg?" width="256" /></p>
|
<p align="center"><img src="https://dydx.exchange/icon.svg?" width="256" /></p>
|
||||||
|
|
||||||
<h1 align="center">v4 Web</h1>
|
<h1 align="center">dYdX Chain Web</h1>
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<a href='https://github.com/dydxprotocol/v4-web/blob/main/LICENSE'>
|
<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' />
|
<img src='https://img.shields.io/badge/License-AGPL_v3-blue.svg' alt='License' />
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- Node.js version 18 and `pnpm` installed on your system
|
- Node.js version 18 and `pnpm` installed on your system
|
||||||
|
- Wallet Connect account
|
||||||
|
|
||||||
For deploying with Vercel, create an account with [Vercel](https://vercel.com/signup) if you don't have one already.
|
For deploying with Vercel, create an account with [Vercel](https://vercel.com/signup) if you don't have one already.
|
||||||
|
|
||||||
@@ -25,7 +26,7 @@ Alternatively, follow the [IPFS Kubo installation guide](https://docs.ipfs.tech
|
|||||||
|
|
||||||
## Part 1: Setting up your local environment
|
## Part 1: Setting up your local environment
|
||||||
|
|
||||||
### Step 1: Clone the repo
|
### 1. Clone the repo
|
||||||
|
|
||||||
Clone the repository and navigate to its directory:
|
Clone the repository and navigate to its directory:
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ git clone https://github.com/dydxprotocol/v4-web.git
|
|||||||
cd v4-web
|
cd v4-web
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 2: Install pnpm and dependencies
|
### 2. Install pnpm and dependencies
|
||||||
|
|
||||||
Install pnpm and the project dependencies:
|
Install pnpm and the project dependencies:
|
||||||
|
|
||||||
@@ -61,7 +62,31 @@ pnpm ladle
|
|||||||
|
|
||||||
This will automatically open your default browser at `http://localhost:61000`.
|
This will automatically open your default browser at `http://localhost:61000`.
|
||||||
|
|
||||||
## Part 3: Deploying with Vercel
|
## Part 3: Configuring environment
|
||||||
|
|
||||||
|
Add or modify the relevant endpoints, links and options in `/public/configs/env.json`.
|
||||||
|
You'll need to provide a Wallet Connect project id to enable onboarding and wallet connection:
|
||||||
|
- Create a project on https://cloud.walletconnect.com/app
|
||||||
|
- Copy over the project ID into this [field](https://github.com/dydxprotocol/v4-web/blob/67ecbd75b43e0c264b7b4d2d9b3d969830b0621c/public/configs/env.json#L822C33-L822C46)
|
||||||
|
|
||||||
|
## Part 4: Set Enviornment variables
|
||||||
|
Set environment variables via `.env`.
|
||||||
|
|
||||||
|
- `VITE_BASE_URL` (required): The base URL of the deployment (e.g., `https://www.example.com`).
|
||||||
|
- `VITE_ALCHEMY_API_KEY` (optional): Add an Alchemy API key for EVM interactions; the app will fall back to public RPCs if not provided.
|
||||||
|
- `VITE_PK_ENCRYPTION_KEY` (optional): AES encryption key used for signature obfuscation; necessary for enabling the "Remember Me" feature.
|
||||||
|
- `VITE_V3_TOKEN_ADDRESS` (optional): Address of the V3 $DYDX token.
|
||||||
|
- `VITE_TOKEN_MIGRATION_URI` (optional): The URL of the token migration website.
|
||||||
|
- `AMPLITUDE_API_KEY` (optional): Amplitude API key for enabling Amplitude; used with `pnpm run build:inject-amplitude`.
|
||||||
|
- `BUGSNAG_API_KEY` (optional): API key for enabling Bugsnag; used with `pnpm run build:inject-bugsnag`.
|
||||||
|
- `IOS_APP_ID` (optional): iOS app ID used for enabling deep linking to the iOS app; used with `pnpm run build:inject-app-deeplinks`.
|
||||||
|
- `INTERCOM_APP_ID` (optional): Used for enabling Intercom; utilized with `pnpm run build:inject-intercom`.
|
||||||
|
- `STATUS_PAGE_SCRIPT_URI` (optional): Used for enabling the status page; used with `pnpm run build:inject-statuspage`.
|
||||||
|
|
||||||
|
|
||||||
|
# Deployments
|
||||||
|
|
||||||
|
## Deploying with Vercel
|
||||||
|
|
||||||
### Step 1: Connect your repository to Vercel
|
### Step 1: Connect your repository to Vercel
|
||||||
|
|
||||||
@@ -78,7 +103,7 @@ If you wish to incorporate analytics via Amplitude and Bugsnag, you can use our
|
|||||||
|
|
||||||
For more details, check out Vercel's [official documentation](https://vercel.com/docs).
|
For more details, check out Vercel's [official documentation](https://vercel.com/docs).
|
||||||
|
|
||||||
## Part 4: Deploying to IPFS
|
## Deploying to IPFS
|
||||||
|
|
||||||
### web3.storage: deploy to IPFS via web3.storage using the provided script
|
### web3.storage: deploy to IPFS via web3.storage using the provided script
|
||||||
|
|
||||||
@@ -110,3 +135,18 @@ To access your content on IPFS:
|
|||||||
2. **Public IPFS gateway:** Access your content via a public IPFS gateway, such as [https://dweb.link](https://dweb.link/) or [https://w3s.link/](https://w3s.link/). Use the gateway URL with your CID appended, like `https://dweb.link/ipfs/your_cid`.
|
2. **Public IPFS gateway:** Access your content via a public IPFS gateway, such as [https://dweb.link](https://dweb.link/) or [https://w3s.link/](https://w3s.link/). Use the gateway URL with your CID appended, like `https://dweb.link/ipfs/your_cid`.
|
||||||
|
|
||||||
Replace `your_cid` with the actual CID.
|
Replace `your_cid` with the actual CID.
|
||||||
|
|
||||||
|
## Cloudflare Settings
|
||||||
|
|
||||||
|
We recommend that you add your website to Cloudflare for additional security settings.
|
||||||
|
|
||||||
|
To block OFAC Sanctioned countries:
|
||||||
|
1. Navigate Websites > Domain > Security > WAF
|
||||||
|
|
||||||
|
2. Create Rule with the following settings:
|
||||||
|
* If incoming requests match
|
||||||
|
`(ip.geoip.country eq "CU") or (ip.geoip.country eq "IR") or (ip.geoip.country eq "KP") or (ip.geoip.country eq "SY") or (ip.geoip.country eq "MM") or (ip.geoip.subdivision_1_iso_code eq "UA-09") or (ip.geoip.subdivision_1_iso_code eq "UA-14") or (ip.geoip.subdivision_1_iso_code eq "UA-43")`
|
||||||
|
* This rule will bring up a Cloudflare page when a restricted geography tries to access your site. You will have the option to display:
|
||||||
|
1. Custom Text
|
||||||
|
- (e.g. `Because you appear to be a resident of, or trading from, a jurisdiction that violates our terms of use, or have engaged in activity that violates our terms of use, you have been blocked. You may withdraw your funds from the protocol at any time.`)
|
||||||
|
2. Default Cloudflare WAF block page
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"name": "dydx-chain-web",
|
"name": "dydx-chain-web",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.1",
|
"version": "1.0.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "BSL-1.1",
|
"license": "AGPL-3.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18"
|
"node": ">=18"
|
||||||
},
|
},
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
"build:inject-app-deeplinks": "sh scripts/inject-app-deeplinks.sh",
|
"build:inject-app-deeplinks": "sh scripts/inject-app-deeplinks.sh",
|
||||||
"build:inject-amplitude": "node scripts/inject-amplitude.js",
|
"build:inject-amplitude": "node scripts/inject-amplitude.js",
|
||||||
"build:inject-bugsnag": "node scripts/inject-bugsnag.js",
|
"build:inject-bugsnag": "node scripts/inject-bugsnag.js",
|
||||||
|
"build:inject-intercom": "node scripts/inject-intercom.js",
|
||||||
"build:inject-statuspage": "node scripts/inject-statuspage.js",
|
"build:inject-statuspage": "node scripts/inject-statuspage.js",
|
||||||
"deploy:ipfs": "node scripts/upload-ipfs.js --verbose",
|
"deploy:ipfs": "node scripts/upload-ipfs.js --verbose",
|
||||||
"deploy:update-ipns": "node scripts/update-ipns.js",
|
"deploy:update-ipns": "node scripts/update-ipns.js",
|
||||||
@@ -38,9 +39,9 @@
|
|||||||
"@cosmjs/proto-signing": "^0.31.0",
|
"@cosmjs/proto-signing": "^0.31.0",
|
||||||
"@cosmjs/stargate": "^0.31.0",
|
"@cosmjs/stargate": "^0.31.0",
|
||||||
"@cosmjs/tendermint-rpc": "^0.31.0",
|
"@cosmjs/tendermint-rpc": "^0.31.0",
|
||||||
"@dydxprotocol/v4-abacus": "^0.6.4",
|
"@dydxprotocol/v4-abacus": "^1.0.10",
|
||||||
"@dydxprotocol/v4-client-js": "^0.36.1",
|
"@dydxprotocol/v4-client-js": "^1.0.0",
|
||||||
"@dydxprotocol/v4-localization": "^0.1.30",
|
"@dydxprotocol/v4-localization": "^1.0.0",
|
||||||
"@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",
|
||||||
|
|||||||
@@ -27,14 +27,14 @@ dependencies:
|
|||||||
specifier: ^0.31.0
|
specifier: ^0.31.0
|
||||||
version: 0.31.0
|
version: 0.31.0
|
||||||
'@dydxprotocol/v4-abacus':
|
'@dydxprotocol/v4-abacus':
|
||||||
specifier: ^0.6.4
|
specifier: ^1.0.10
|
||||||
version: 0.6.4
|
version: 1.0.10
|
||||||
'@dydxprotocol/v4-client-js':
|
'@dydxprotocol/v4-client-js':
|
||||||
specifier: ^0.36.1
|
specifier: ^1.0.0
|
||||||
version: 0.36.1
|
version: 1.0.0
|
||||||
'@dydxprotocol/v4-localization':
|
'@dydxprotocol/v4-localization':
|
||||||
specifier: ^0.1.30
|
specifier: ^1.0.0
|
||||||
version: 0.1.30
|
version: 1.0.0
|
||||||
'@ethersproject/providers':
|
'@ethersproject/providers':
|
||||||
specifier: ^5.7.2
|
specifier: ^5.7.2
|
||||||
version: 5.7.2
|
version: 5.7.2
|
||||||
@@ -645,7 +645,7 @@ packages:
|
|||||||
/@confio/ics23@0.6.8:
|
/@confio/ics23@0.6.8:
|
||||||
resolution: {integrity: sha512-wB6uo+3A50m0sW/EWcU64xpV/8wShZ6bMTa7pF8eYsTrSkQA7oLUIJcs/wb8g4y2Oyq701BaGiO6n/ak5WXO1w==}
|
resolution: {integrity: sha512-wB6uo+3A50m0sW/EWcU64xpV/8wShZ6bMTa7pF8eYsTrSkQA7oLUIJcs/wb8g4y2Oyq701BaGiO6n/ak5WXO1w==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@noble/hashes': 1.3.1
|
'@noble/hashes': 1.3.2
|
||||||
protobufjs: 6.11.4
|
protobufjs: 6.11.4
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
@@ -717,7 +717,7 @@ packages:
|
|||||||
'@cosmjs/encoding': 0.30.1
|
'@cosmjs/encoding': 0.30.1
|
||||||
'@cosmjs/math': 0.30.1
|
'@cosmjs/math': 0.30.1
|
||||||
'@cosmjs/utils': 0.30.1
|
'@cosmjs/utils': 0.30.1
|
||||||
'@noble/hashes': 1.3.1
|
'@noble/hashes': 1.3.2
|
||||||
bn.js: 5.2.1
|
bn.js: 5.2.1
|
||||||
elliptic: 6.5.4
|
elliptic: 6.5.4
|
||||||
libsodium-wrappers: 0.7.11
|
libsodium-wrappers: 0.7.11
|
||||||
@@ -979,12 +979,12 @@ packages:
|
|||||||
resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==}
|
resolution: {integrity: sha512-RpfLEtTlyIxeNPGKcokS+p3BZII/Q3bYxryFRglh5H3A3T8q9fsLYm72VYAMEOOIBLEa8o93kFLiBDUWKrwXZA==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@dydxprotocol/v4-abacus@0.6.4:
|
/@dydxprotocol/v4-abacus@1.0.10:
|
||||||
resolution: {integrity: sha512-eH+/9Q/OnQtwzBwM1BJyXybFPdivGmFQWrxM71MFWGs6uIQGbZX775mpoa8deweSTyQ/QrRLRQ1mP2BPDgBQYg==}
|
resolution: {integrity: sha512-SdxI/JcyxM1ydtR9ImWujeurea3gbxj37qYnw1wz829BQiZ05uNEtll3xJCI0MjpG+01ARsxVys7SHbpjSxwOg==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@dydxprotocol/v4-client-js@0.36.1:
|
/@dydxprotocol/v4-client-js@1.0.0:
|
||||||
resolution: {integrity: sha512-KJ3MtWI61wmm+xZtXQd7/hYKIoVFG32TRdyyVaXXO8vpW9Oqd0JD8QSM/wuegkciAh5YmP/BrDzYuu77zHO6yg==}
|
resolution: {integrity: sha512-ehfHO+zQy795TcJRwtiawadFHZyh4HnpJNP26hCGsIjLE5q6LLHweQHpK/1N/sXU1PBOuQwc7iaJnFop6gYauQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@cosmjs/amino': 0.30.1
|
'@cosmjs/amino': 0.30.1
|
||||||
'@cosmjs/encoding': 0.31.1
|
'@cosmjs/encoding': 0.31.1
|
||||||
@@ -993,14 +993,15 @@ packages:
|
|||||||
'@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
|
'@cosmjs/utils': 0.31.1
|
||||||
'@dydxprotocol/v4-proto': 0.2.1
|
'@dydxprotocol/v4-proto': 0.4.1
|
||||||
'@osmonauts/lcd': 0.6.0
|
'@osmonauts/lcd': 0.6.0
|
||||||
'@scure/bip32': 1.3.1
|
'@scure/bip32': 1.3.2
|
||||||
'@scure/bip39': 1.2.1
|
'@scure/bip39': 1.2.1
|
||||||
axios: 1.1.3
|
axios: 1.1.3
|
||||||
bech32: 1.1.4
|
bech32: 1.1.4
|
||||||
bignumber.js: 9.1.1
|
bignumber.js: 9.1.1
|
||||||
ethereum-cryptography: 2.1.2
|
ethereum-cryptography: 2.1.2
|
||||||
|
ethers: 6.6.1
|
||||||
long: 4.0.0
|
long: 4.0.0
|
||||||
protobufjs: 6.11.4
|
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)
|
||||||
@@ -1010,12 +1011,12 @@ packages:
|
|||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@dydxprotocol/v4-localization@0.1.30:
|
/@dydxprotocol/v4-localization@1.0.0:
|
||||||
resolution: {integrity: sha512-xTlQuQmPz7wfGkjd07giYMAxRrolDbJE3DryJSIMB6R1MBq1wLzAcwp/iR/nELRwilRX9c44Tap0gGt+oAajiQ==}
|
resolution: {integrity: sha512-U7QjOlzpfSAVEchkNDB3xYRx7okzdeYi83XsnHwI+EHa2quFm/2Y2dhrBkT5fqpZmhcwxb/vG8AZmFSToOf9hA==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@dydxprotocol/v4-proto@0.2.1:
|
/@dydxprotocol/v4-proto@0.4.1:
|
||||||
resolution: {integrity: sha512-Q5b/g331DoyMjBpO2/jtrxUX3WF5UaIKZp/unK332xuefHNFnkMYtZ05p0V71iSdO35tBdz8yt0VYP2WtUsp+w==}
|
resolution: {integrity: sha512-2pBkokufWcxfIpiXE6QuQOBXUe154OTp6ojCIdOPW9TFLxzchoygxXnb5dL6rAQVNj9Qbg+hhXBllutt4m99dw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
protobufjs: 6.11.4
|
protobufjs: 6.11.4
|
||||||
dev: false
|
dev: false
|
||||||
@@ -4708,8 +4709,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==}
|
resolution: {integrity: sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@noble/curves': 1.1.0
|
'@noble/curves': 1.1.0
|
||||||
'@noble/hashes': 1.3.1
|
'@noble/hashes': 1.3.2
|
||||||
'@scure/base': 1.1.1
|
'@scure/base': 1.1.3
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@scure/bip32@1.3.2:
|
/@scure/bip32@1.3.2:
|
||||||
@@ -4731,7 +4732,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==}
|
resolution: {integrity: sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@noble/hashes': 1.3.2
|
'@noble/hashes': 1.3.2
|
||||||
'@scure/base': 1.1.1
|
'@scure/base': 1.1.3
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@solana/buffer-layout@4.0.1:
|
/@solana/buffer-layout@4.0.1:
|
||||||
@@ -4745,8 +4746,8 @@ packages:
|
|||||||
resolution: {integrity: sha512-up5VG1dK+GPhykmuMIozJZBbVqpm77vbOG6/r5dS7NBGZonwHfTLdBbsYc3rjmaQ4DpCXUa3tUc4RZHRORvZrw==}
|
resolution: {integrity: sha512-up5VG1dK+GPhykmuMIozJZBbVqpm77vbOG6/r5dS7NBGZonwHfTLdBbsYc3rjmaQ4DpCXUa3tUc4RZHRORvZrw==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@babel/runtime': 7.22.10
|
'@babel/runtime': 7.22.10
|
||||||
'@noble/curves': 1.1.0
|
'@noble/curves': 1.2.0
|
||||||
'@noble/hashes': 1.3.1
|
'@noble/hashes': 1.3.2
|
||||||
'@solana/buffer-layout': 4.0.1
|
'@solana/buffer-layout': 4.0.1
|
||||||
agentkeepalive: 4.5.0
|
agentkeepalive: 4.5.0
|
||||||
bigint-buffer: 1.1.5
|
bigint-buffer: 1.1.5
|
||||||
@@ -7144,7 +7145,7 @@ packages:
|
|||||||
/bip39@3.1.0:
|
/bip39@3.1.0:
|
||||||
resolution: {integrity: sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A==}
|
resolution: {integrity: sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A==}
|
||||||
dependencies:
|
dependencies:
|
||||||
'@noble/hashes': 1.3.1
|
'@noble/hashes': 1.3.2
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/bl@5.1.0:
|
/bl@5.1.0:
|
||||||
@@ -7655,7 +7656,7 @@ packages:
|
|||||||
resolution: {integrity: sha512-WIdaQ8uW1vIbYvNnAVunkC6yxTrneJC7VQ5UUQ0kuw8b0C0A39KTIpoQHCfc8tV7o9vF4niwRhdXEdfAgQEsQQ==}
|
resolution: {integrity: sha512-WIdaQ8uW1vIbYvNnAVunkC6yxTrneJC7VQ5UUQ0kuw8b0C0A39KTIpoQHCfc8tV7o9vF4niwRhdXEdfAgQEsQQ==}
|
||||||
dependencies:
|
dependencies:
|
||||||
cosmos-directory-types: 0.0.6
|
cosmos-directory-types: 0.0.6
|
||||||
node-fetch-native: 1.4.0
|
node-fetch-native: 1.4.1
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/cosmos-directory-types@0.0.6:
|
/cosmos-directory-types@0.0.6:
|
||||||
@@ -11286,8 +11287,8 @@ packages:
|
|||||||
engines: {node: '>=10.5.0'}
|
engines: {node: '>=10.5.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/node-fetch-native@1.4.0:
|
/node-fetch-native@1.4.1:
|
||||||
resolution: {integrity: sha512-F5kfEj95kX8tkDhUCYdV8dg3/8Olx/94zB8+ZNthFs6Bz31UpUi8Xh40TN3thLwXgrwXry1pEg9lJ++tLWTcqA==}
|
resolution: {integrity: sha512-NsXBU0UgBxo2rQLOeWNZqS3fvflWePMECr8CoSWoSTqCqGbVVsvl9vZu1HfQicYN0g5piV9Gh8RTEvo/uP752w==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/node-fetch@2.6.12:
|
/node-fetch@2.6.12:
|
||||||
|
|||||||
@@ -8,67 +8,43 @@
|
|||||||
],
|
],
|
||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"/": "/trade/*"
|
"/": "/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/r/*"
|
"/": "/#/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/portfolio/overview"
|
"/": "*/markets"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/portfolio/positions"
|
"/": "*/trade"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/portfolio/orders"
|
"/": "*/trade/*"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/portfolio/fees"
|
"/": "*/portfolio"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/portfolio/history"
|
"/": "*/portfolio/overview"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/portfolio/history/trades"
|
"/": "*/portfolio/positions"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/portfolio/history/transfers"
|
"/": "*/portfolio/orders"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/portfolio/history/funding"
|
"/": "*/portfolio/fees"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/rewards"
|
"/": "*/portfolio/history/trades"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/my-profile"
|
"/": "*/portfolio/history/transfers"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/rankings/hedgies"
|
"/": "*/portfolio/history/funding"
|
||||||
},
|
|
||||||
{
|
|
||||||
"/": "/rankings/competition"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"/": "/rankings/diamond"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"/": "/rankings/platinum"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"/": "/rankings/gold"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"/": "/rankings/silver"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"/": "/rankings/bronze"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"/": "/rankings/pnl-absolute"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"/": "/rankings/pnl-percent"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"/": "/walletsegue",
|
"/": "/walletsegue",
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 16 KiB |
@@ -1,4 +1,9 @@
|
|||||||
{
|
{
|
||||||
|
"apps": {
|
||||||
|
"iOS": {
|
||||||
|
"scheme": "dydxv4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"deployments": {
|
"deployments": {
|
||||||
"MAINNET": {
|
"MAINNET": {
|
||||||
"environments": [
|
"environments": [
|
||||||
@@ -22,10 +27,11 @@
|
|||||||
"dydxprotocol-staging-west",
|
"dydxprotocol-staging-west",
|
||||||
"dydxprotocol-testnet",
|
"dydxprotocol-testnet",
|
||||||
"dydxprotocol-testnet-dydx",
|
"dydxprotocol-testnet-dydx",
|
||||||
"dydxprotocol-testnet-dsrv",
|
|
||||||
"dydxprotocol-testnet-nodefleet",
|
"dydxprotocol-testnet-nodefleet",
|
||||||
"dydxprotocol-testnet-kingnodes",
|
"dydxprotocol-testnet-kingnodes",
|
||||||
"dydxprotocol-testnet-liquify"
|
"dydxprotocol-testnet-liquify",
|
||||||
|
"dydxprotocol-testnet-polkachu",
|
||||||
|
"dydxprotocol-testnet-bware"
|
||||||
],
|
],
|
||||||
"default": "dydxprotocol-testnet"
|
"default": "dydxprotocol-testnet"
|
||||||
}
|
}
|
||||||
@@ -37,10 +43,11 @@
|
|||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
"name": "DYDX",
|
"name": "Dv4TNT",
|
||||||
"denom": "adv4tnt",
|
"denom": "adv4tnt",
|
||||||
"decimals": 18,
|
"decimals": 18,
|
||||||
"image": "/currencies/dydx.png"
|
"image": "/currencies/dydx.png"
|
||||||
@@ -56,21 +63,33 @@
|
|||||||
"endpoints": {
|
"endpoints": {
|
||||||
"indexers": [
|
"indexers": [
|
||||||
{
|
{
|
||||||
"api": "http://indexer.v4dev.dydx.exchange",
|
"api": "https://indexer.v4dev.dydx.exchange",
|
||||||
"socket": "wss://indexer.v4dev.dydx.exchange"
|
"socket": "wss://indexer.v4dev.dydx.exchange"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"validators": [
|
"validators": [
|
||||||
"http://validator.v4dev.dydx.exchange"
|
"https://validator.v4dev.dydx.exchange"
|
||||||
],
|
],
|
||||||
"0xsquid": "https://testnet.api.0xsquid.com",
|
"0xsquid": "https://testnet.api.0xsquid.com",
|
||||||
"faucet": "http://faucet.v4dev.dydx.exchange"
|
"faucet": "https://faucet.v4dev.dydx.exchange"
|
||||||
},
|
},
|
||||||
"links": {
|
"links": {
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
"tos": "https://dydx.exchange/v4-terms",
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
"blogs": "https://www.dydx.foundation/blog",
|
||||||
|
"foundation": "https://www.dydx.foundation",
|
||||||
|
"help": "https://help.dydx.exchange/",
|
||||||
|
"initialMarginFractionLearnMore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes",
|
||||||
|
"reduceOnlyLearnMore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
|
"mintscanBase": "https://testnet.mintscan.io/dydx-testnet",
|
||||||
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
|
"community": "https://discord.com/invite/dydx",
|
||||||
|
"governanceLearnMore": "https://help.dydx.exchange",
|
||||||
|
"stakingLearnMore": "https://help.dydx.exchange",
|
||||||
|
"keplrDashboard": "https://testnet.keplr.app/",
|
||||||
|
"accountExportLearnMore": "https://help.dydx.exchange",
|
||||||
|
"walletLearnMore": "https://www.dydx.academy/video/defi-wallet"
|
||||||
},
|
},
|
||||||
"wallets": {
|
"wallets": {
|
||||||
"walletconnect": {
|
"walletconnect": {
|
||||||
@@ -97,10 +116,11 @@
|
|||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
"name": "DYDX",
|
"name": "Dv4TNT",
|
||||||
"denom": "adv4tnt",
|
"denom": "adv4tnt",
|
||||||
"decimals": 18,
|
"decimals": 18,
|
||||||
"image": "/currencies/dydx.png"
|
"image": "/currencies/dydx.png"
|
||||||
@@ -121,7 +141,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"validators": [
|
"validators": [
|
||||||
"http://35.75.227.118"
|
"http://54.92.118.111"
|
||||||
],
|
],
|
||||||
"0xsquid": "https://testnet.api.0xsquid.com"
|
"0xsquid": "https://testnet.api.0xsquid.com"
|
||||||
},
|
},
|
||||||
@@ -129,7 +149,19 @@
|
|||||||
"tos": "https://dydx.exchange/v4-terms",
|
"tos": "https://dydx.exchange/v4-terms",
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
"blogs": "https://www.dydx.foundation/blog",
|
||||||
|
"foundation": "https://www.dydx.foundation",
|
||||||
|
"help": "https://help.dydx.exchange/",
|
||||||
|
"initialMarginFractionLearnMore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes",
|
||||||
|
"reduceOnlyLearnMore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
|
"mintscanBase": "https://testnet.mintscan.io/dydx-testnet",
|
||||||
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
|
"community": "https://discord.com/invite/dydx",
|
||||||
|
"governanceLearnMore": "https://help.dydx.exchange",
|
||||||
|
"stakingLearnMore": "https://help.dydx.exchange",
|
||||||
|
"keplrDashboard": "https://testnet.keplr.app/",
|
||||||
|
"accountExportLearnMore": "https://help.dydx.exchange",
|
||||||
|
"walletLearnMore": "https://www.dydx.academy/video/defi-wallet"
|
||||||
},
|
},
|
||||||
"wallets": {
|
"wallets": {
|
||||||
"walletconnect": {
|
"walletconnect": {
|
||||||
@@ -156,10 +188,11 @@
|
|||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
"name": "DYDX",
|
"name": "Dv4TNT",
|
||||||
"denom": "adv4tnt",
|
"denom": "adv4tnt",
|
||||||
"decimals": 18,
|
"decimals": 18,
|
||||||
"image": "/currencies/dydx.png"
|
"image": "/currencies/dydx.png"
|
||||||
@@ -175,8 +208,8 @@
|
|||||||
"endpoints": {
|
"endpoints": {
|
||||||
"indexers": [
|
"indexers": [
|
||||||
{
|
{
|
||||||
"api": "http://indexer.v4dev4.dydx.exchange",
|
"api": "https://indexer.v4dev4.dydx.exchange",
|
||||||
"socket": "ws://indexer.v4dev4.dydx.exchange"
|
"socket": "wss://indexer.v4dev4.dydx.exchange"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"validators": [
|
"validators": [
|
||||||
@@ -188,7 +221,19 @@
|
|||||||
"tos": "https://dydx.exchange/v4-terms",
|
"tos": "https://dydx.exchange/v4-terms",
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
"blogs": "https://www.dydx.foundation/blog",
|
||||||
|
"foundation": "https://www.dydx.foundation",
|
||||||
|
"help": "https://help.dydx.exchange/",
|
||||||
|
"initialMarginFractionLearnMore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes",
|
||||||
|
"reduceOnlyLearnMore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
|
"mintscanBase": "https://testnet.mintscan.io/dydx-testnet",
|
||||||
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
|
"community": "https://discord.com/invite/dydx",
|
||||||
|
"governanceLearnMore": "https://help.dydx.exchange",
|
||||||
|
"stakingLearnMore": "https://help.dydx.exchange",
|
||||||
|
"keplrDashboard": "https://testnet.keplr.app/",
|
||||||
|
"accountExportLearnMore": "https://help.dydx.exchange",
|
||||||
|
"walletLearnMore": "https://www.dydx.academy/video/defi-wallet"
|
||||||
},
|
},
|
||||||
"wallets": {
|
"wallets": {
|
||||||
"walletconnect": {
|
"walletconnect": {
|
||||||
@@ -215,10 +260,11 @@
|
|||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
"name": "DYDX",
|
"name": "Dv4TNT",
|
||||||
"denom": "adv4tnt",
|
"denom": "adv4tnt",
|
||||||
"decimals": 18,
|
"decimals": 18,
|
||||||
"image": "/currencies/dydx.png"
|
"image": "/currencies/dydx.png"
|
||||||
@@ -247,7 +293,19 @@
|
|||||||
"tos": "https://dydx.exchange/v4-terms",
|
"tos": "https://dydx.exchange/v4-terms",
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
"blogs": "https://www.dydx.foundation/blog",
|
||||||
|
"foundation": "https://www.dydx.foundation",
|
||||||
|
"help": "https://help.dydx.exchange/",
|
||||||
|
"initialMarginFractionLearnMore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes",
|
||||||
|
"reduceOnlyLearnMore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
|
"mintscanBase": "https://testnet.mintscan.io/dydx-testnet",
|
||||||
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
|
"community": "https://discord.com/invite/dydx",
|
||||||
|
"governanceLearnMore": "https://help.dydx.exchange",
|
||||||
|
"stakingLearnMore": "https://help.dydx.exchange",
|
||||||
|
"keplrDashboard": "https://testnet.keplr.app/",
|
||||||
|
"accountExportLearnMore": "https://help.dydx.exchange",
|
||||||
|
"walletLearnMore": "https://www.dydx.academy/video/defi-wallet"
|
||||||
},
|
},
|
||||||
"wallets": {
|
"wallets": {
|
||||||
"walletconnect": {
|
"walletconnect": {
|
||||||
@@ -274,10 +332,11 @@
|
|||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
"name": "DYDX",
|
"name": "Dv4TNT",
|
||||||
"denom": "adv4tnt",
|
"denom": "adv4tnt",
|
||||||
"decimals": 18,
|
"decimals": 18,
|
||||||
"image": "/currencies/dydx.png"
|
"image": "/currencies/dydx.png"
|
||||||
@@ -307,10 +366,20 @@
|
|||||||
"tos": "https://dydx.exchange/v4-terms",
|
"tos": "https://dydx.exchange/v4-terms",
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
"community": "https://discord.com/invite/dydx",
|
"community": "https://discord.com/invite/dydx",
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
"blogs": "https://www.dydx.foundation/blog",
|
||||||
|
"help": "https://help.dydx.exchange",
|
||||||
|
"foundation": "https://www.dydx.foundation",
|
||||||
|
"initialMarginFractionLearnMore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes",
|
||||||
|
"reduceOnlyLearnMore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
|
"mintscanBase": "https://testnet.mintscan.io/dydx-testnet",
|
||||||
|
"governanceLearnMore": "https://help.dydx.exchange",
|
||||||
|
"stakingLearnMore": "https://help.dydx.exchange",
|
||||||
|
"keplrDashboard": "https://testnet.keplr.app/",
|
||||||
|
"accountExportLearnMore": "https://help.dydx.exchange",
|
||||||
|
"walletLearnMore": "https://www.dydx.academy/video/defi-wallet"
|
||||||
},
|
},
|
||||||
"wallets": {
|
"wallets": {
|
||||||
"walletconnect": {
|
"walletconnect": {
|
||||||
@@ -337,10 +406,11 @@
|
|||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
"name": "DYDX",
|
"name": "Dv4TNT",
|
||||||
"denom": "adv4tnt",
|
"denom": "adv4tnt",
|
||||||
"decimals": 18,
|
"decimals": 18,
|
||||||
"image": "/currencies/dydx.png"
|
"image": "/currencies/dydx.png"
|
||||||
@@ -370,10 +440,20 @@
|
|||||||
"tos": "https://dydx.exchange/v4-terms",
|
"tos": "https://dydx.exchange/v4-terms",
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
"community": "https://discord.com/invite/dydx",
|
"community": "https://discord.com/invite/dydx",
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
"blogs": "https://www.dydx.foundation/blog",
|
||||||
|
"help": "https://help.dydx.exchange",
|
||||||
|
"foundation": "https://www.dydx.foundation",
|
||||||
|
"initialMarginFractionLearnMore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes",
|
||||||
|
"reduceOnlyLearnMore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
|
"mintscanBase": "https://testnet.mintscan.io/dydx-testnet",
|
||||||
|
"governanceLearnMore": "https://help.dydx.exchange",
|
||||||
|
"stakingLearnMore": "https://help.dydx.exchange",
|
||||||
|
"keplrDashboard": "https://testnet.keplr.app/",
|
||||||
|
"accountExportLearnMore": "https://help.dydx.exchange",
|
||||||
|
"walletLearnMore": "https://www.dydx.academy/video/defi-wallet"
|
||||||
},
|
},
|
||||||
"wallets": {
|
"wallets": {
|
||||||
"walletconnect": {
|
"walletconnect": {
|
||||||
@@ -400,10 +480,11 @@
|
|||||||
"dydxChainId": "dydx-testnet-4",
|
"dydxChainId": "dydx-testnet-4",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
"name": "DYDX",
|
"name": "Dv4TNT",
|
||||||
"denom": "adv4tnt",
|
"denom": "adv4tnt",
|
||||||
"decimals": 18,
|
"decimals": 18,
|
||||||
"image": "/currencies/dydx.png"
|
"image": "/currencies/dydx.png"
|
||||||
@@ -424,6 +505,8 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"validators": [
|
"validators": [
|
||||||
|
"https://dydx-testnet-full-rpc.public.blastapi.io/",
|
||||||
|
"https://dydx-testnet-rpc.polkachu.com/",
|
||||||
"https://dydx-testnet.nodefleet.org",
|
"https://dydx-testnet.nodefleet.org",
|
||||||
"https://test-dydx.kingnodes.com",
|
"https://test-dydx.kingnodes.com",
|
||||||
"https://dydx-rpc.liquify.com/api=8878132/dydx"
|
"https://dydx-rpc.liquify.com/api=8878132/dydx"
|
||||||
@@ -435,10 +518,20 @@
|
|||||||
"tos": "https://dydx.exchange/v4-terms",
|
"tos": "https://dydx.exchange/v4-terms",
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
"community": "https://discord.com/invite/dydx",
|
"community": "https://discord.com/invite/dydx",
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
"blogs": "https://www.dydx.foundation/blog",
|
||||||
|
"foundation": "https://www.dydx.foundation",
|
||||||
|
"help": "https://help.dydx.exchange/",
|
||||||
|
"initialMarginFractionLearnMore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes",
|
||||||
|
"reduceOnlyLearnMore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
|
"mintscanBase": "https://testnet.mintscan.io/dydx-testnet",
|
||||||
|
"governanceLearnMore": "https://help.dydx.exchange",
|
||||||
|
"stakingLearnMore": "https://help.dydx.exchange",
|
||||||
|
"keplrDashboard": "https://testnet.keplr.app/",
|
||||||
|
"accountExportLearnMore": "https://help.dydx.exchange",
|
||||||
|
"walletLearnMore": "https://www.dydx.academy/video/defi-wallet"
|
||||||
},
|
},
|
||||||
"wallets": {
|
"wallets": {
|
||||||
"walletconnect": {
|
"walletconnect": {
|
||||||
@@ -465,10 +558,11 @@
|
|||||||
"dydxChainId": "dydx-testnet-4",
|
"dydxChainId": "dydx-testnet-4",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
"name": "DYDX",
|
"name": "Dv4TNT",
|
||||||
"denom": "adv4tnt",
|
"denom": "adv4tnt",
|
||||||
"decimals": 18,
|
"decimals": 18,
|
||||||
"image": "/currencies/dydx.png"
|
"image": "/currencies/dydx.png"
|
||||||
@@ -499,74 +593,20 @@
|
|||||||
"privacy": "https://dydx.exchange/privacy",
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
"community": "https://discord.com/invite/dydx",
|
"community": "https://discord.com/invite/dydx",
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
"blogs": "https://www.dydx.foundation/blog",
|
||||||
},
|
"foundation": "https://www.dydx.foundation",
|
||||||
"wallets": {
|
"help": "https://help.dydx.exchange/",
|
||||||
"walletconnect": {
|
"initialMarginFractionLearnMore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes",
|
||||||
"client": {
|
"reduceOnlyLearnMore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
"name": "dYdX v4",
|
"mintscanBase": "https://testnet.mintscan.io/dydx-testnet",
|
||||||
"description": "dYdX v4 App",
|
"governanceLearnMore": "https://help.dydx.exchange",
|
||||||
"iconUrl": "/logos/dydx-x.png"
|
"stakingLearnMore": "https://help.dydx.exchange",
|
||||||
},
|
"keplrDashboard": "https://testnet.keplr.app/",
|
||||||
"v2": {
|
"accountExportLearnMore": "https://help.dydx.exchange",
|
||||||
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
"walletLearnMore": "https://www.dydx.academy/video/defi-wallet"
|
||||||
}
|
|
||||||
},
|
|
||||||
"walletSegue": {
|
|
||||||
"callbackUrl": "/walletsegue"
|
|
||||||
},
|
|
||||||
"images": "/wallets/",
|
|
||||||
"signTypedDataAction": "dYdX Chain Onboarding",
|
|
||||||
"signTypedDataDomainName": "dYdX V4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dydxprotocol-testnet-dsrv": {
|
|
||||||
"name": "v4 Public Testnet/DSRV",
|
|
||||||
"ethereumChainId": "5",
|
|
||||||
"dydxChainId": "dydx-testnet-4",
|
|
||||||
"chainName": "dYdX Chain",
|
|
||||||
"chainLogo": "dydx-chain.png",
|
|
||||||
"isMainNet": false,
|
|
||||||
"tokens": {
|
|
||||||
"chain": {
|
|
||||||
"name": "DYDX",
|
|
||||||
"denom": "adv4tnt",
|
|
||||||
"decimals": 18,
|
|
||||||
"image": "/currencies/dydx.png"
|
|
||||||
},
|
|
||||||
"usdc": {
|
|
||||||
"name": "USDC",
|
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
|
||||||
"gasDenom": "uusdc",
|
|
||||||
"decimals": 6,
|
|
||||||
"image": "/currencies/usdc.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"endpoints": {
|
|
||||||
"indexers": [
|
|
||||||
{
|
|
||||||
"api": "https://dydx-testnet.imperator.co",
|
|
||||||
"socket": "wss://dydx-testnet.imperator.co"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"validators": [
|
|
||||||
"https://dydx-testnet-archive.allthatnode.com:26657/XZvMM41hESf8PJrEQiTzbCOMVyFca79R"
|
|
||||||
],
|
|
||||||
"0xsquid": "https://testnet.api.squidrouter.com",
|
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
|
||||||
},
|
|
||||||
"links": {
|
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
|
||||||
"privacy": "https://dydx.exchange/privacy",
|
|
||||||
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
|
||||||
"community": "https://discord.com/invite/dydx",
|
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
|
||||||
},
|
},
|
||||||
"wallets": {
|
"wallets": {
|
||||||
"walletconnect": {
|
"walletconnect": {
|
||||||
@@ -593,10 +633,11 @@
|
|||||||
"dydxChainId": "dydx-testnet-4",
|
"dydxChainId": "dydx-testnet-4",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
"name": "DYDX",
|
"name": "Dv4TNT",
|
||||||
"denom": "adv4tnt",
|
"denom": "adv4tnt",
|
||||||
"decimals": 18,
|
"decimals": 18,
|
||||||
"image": "/currencies/dydx.png"
|
"image": "/currencies/dydx.png"
|
||||||
@@ -627,10 +668,20 @@
|
|||||||
"privacy": "https://dydx.exchange/privacy",
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
"community": "https://discord.com/invite/dydx",
|
"community": "https://discord.com/invite/dydx",
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
"blogs": "https://www.dydx.foundation/blog",
|
||||||
|
"foundation": "https://www.dydx.foundation",
|
||||||
|
"help": "https://help.dydx.exchange/",
|
||||||
|
"initialMarginFractionLearnMore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes",
|
||||||
|
"reduceOnlyLearnMore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
|
"mintscanBase": "https://testnet.mintscan.io/dydx-testnet",
|
||||||
|
"governanceLearnMore": "https://help.dydx.exchange",
|
||||||
|
"stakingLearnMore": "https://help.dydx.exchange",
|
||||||
|
"keplrDashboard": "https://testnet.keplr.app/",
|
||||||
|
"accountExportLearnMore": "https://help.dydx.exchange",
|
||||||
|
"walletLearnMore": "https://www.dydx.academy/video/defi-wallet"
|
||||||
},
|
},
|
||||||
"wallets": {
|
"wallets": {
|
||||||
"walletconnect": {
|
"walletconnect": {
|
||||||
@@ -657,10 +708,11 @@
|
|||||||
"dydxChainId": "dydx-testnet-4",
|
"dydxChainId": "dydx-testnet-4",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
"name": "DYDX",
|
"name": "Dv4TNT",
|
||||||
"denom": "adv4tnt",
|
"denom": "adv4tnt",
|
||||||
"decimals": 18,
|
"decimals": 18,
|
||||||
"image": "/currencies/dydx.png"
|
"image": "/currencies/dydx.png"
|
||||||
@@ -691,10 +743,20 @@
|
|||||||
"privacy": "https://dydx.exchange/privacy",
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
"community": "https://discord.com/invite/dydx",
|
"community": "https://discord.com/invite/dydx",
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
"blogs": "https://www.dydx.foundation/blog",
|
||||||
|
"foundation": "https://www.dydx.foundation",
|
||||||
|
"help": "https://help.dydx.exchange/",
|
||||||
|
"initialMarginFractionLearnMore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes",
|
||||||
|
"reduceOnlyLearnMore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
|
"mintscanBase": "https://testnet.mintscan.io/dydx-testnet",
|
||||||
|
"governanceLearnMore": "https://help.dydx.exchange",
|
||||||
|
"stakingLearnMore": "https://help.dydx.exchange",
|
||||||
|
"keplrDashboard": "https://testnet.keplr.app/",
|
||||||
|
"accountExportLearnMore": "https://help.dydx.exchange",
|
||||||
|
"walletLearnMore": "https://www.dydx.academy/video/defi-wallet"
|
||||||
},
|
},
|
||||||
"wallets": {
|
"wallets": {
|
||||||
"walletconnect": {
|
"walletconnect": {
|
||||||
@@ -721,10 +783,11 @@
|
|||||||
"dydxChainId": "dydx-testnet-4",
|
"dydxChainId": "dydx-testnet-4",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"chain": {
|
"chain": {
|
||||||
"name": "DYDX",
|
"name": "Dv4TNT",
|
||||||
"denom": "adv4tnt",
|
"denom": "adv4tnt",
|
||||||
"decimals": 18,
|
"decimals": 18,
|
||||||
"image": "/currencies/dydx.png"
|
"image": "/currencies/dydx.png"
|
||||||
@@ -755,7 +818,82 @@
|
|||||||
"privacy": "https://dydx.exchange/privacy",
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
||||||
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
"documentation": "https://v4-teacher.vercel.app/",
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
|
"community": "https://discord.com/invite/dydx",
|
||||||
|
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
||||||
|
"blogs": "https://www.dydx.foundation/blog",
|
||||||
|
"foundation": "https://www.dydx.foundation",
|
||||||
|
"help": "https://help.dydx.exchange/",
|
||||||
|
"initialMarginFractionLearnMore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes",
|
||||||
|
"reduceOnlyLearnMore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
|
"mintscanBase": "https://testnet.mintscan.io/dydx-testnet",
|
||||||
|
"governanceLearnMore": "https://help.dydx.exchange",
|
||||||
|
"stakingLearnMore": "https://help.dydx.exchange",
|
||||||
|
"keplrDashboard": "https://testnet.keplr.app/",
|
||||||
|
"accountExportLearnMore": "https://help.dydx.exchange",
|
||||||
|
"walletLearnMore": "https://www.dydx.academy/video/defi-wallet"
|
||||||
|
},
|
||||||
|
"wallets": {
|
||||||
|
"walletconnect": {
|
||||||
|
"client": {
|
||||||
|
"name": "dYdX v4",
|
||||||
|
"description": "dYdX v4 App",
|
||||||
|
"iconUrl": "/logos/dydx-x.png"
|
||||||
|
},
|
||||||
|
"v2": {
|
||||||
|
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"walletSegue": {
|
||||||
|
"callbackUrl": "/walletsegue"
|
||||||
|
},
|
||||||
|
"images": "/wallets/",
|
||||||
|
"signTypedDataAction": "dYdX Chain Onboarding",
|
||||||
|
"signTypedDataDomainName": "dYdX V4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"dydxprotocol-testnet-polkachu": {
|
||||||
|
"name": "v4 Public Testnet/Polkahcu",
|
||||||
|
"ethereumChainId": "5",
|
||||||
|
"dydxChainId": "dydx-testnet-4",
|
||||||
|
"chainName": "dYdX Chain",
|
||||||
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
|
"isMainNet": false,
|
||||||
|
"tokens": {
|
||||||
|
"chain": {
|
||||||
|
"name": "Dv4TNT",
|
||||||
|
"denom": "adv4tnt",
|
||||||
|
"decimals": 18,
|
||||||
|
"image": "/currencies/dydx.png"
|
||||||
|
},
|
||||||
|
"usdc": {
|
||||||
|
"name": "USDC",
|
||||||
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
|
"decimals": 6,
|
||||||
|
"image": "/currencies/usdc.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"endpoints": {
|
||||||
|
"indexers": [
|
||||||
|
{
|
||||||
|
"api": "https://dydx-testnet.imperator.co",
|
||||||
|
"socket": "wss://dydx-testnet.imperator.co"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"validators": [
|
||||||
|
"https://dydx-testnet-rpc.polkachu.com/"
|
||||||
|
],
|
||||||
|
"0xsquid": "https://testnet.api.squidrouter.com",
|
||||||
|
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
||||||
|
},
|
||||||
|
"links": {
|
||||||
|
"tos": "https://dydx.exchange/v4-terms",
|
||||||
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
|
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
||||||
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
"community": "https://discord.com/invite/dydx",
|
"community": "https://discord.com/invite/dydx",
|
||||||
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
||||||
"blogs": "https://www.dydx.foundation/blog"
|
"blogs": "https://www.dydx.foundation/blog"
|
||||||
@@ -779,18 +917,94 @@
|
|||||||
"signTypedDataDomainName": "dYdX V4"
|
"signTypedDataDomainName": "dYdX V4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"dydxprotocol-testnet-bware": {
|
||||||
|
"name": "v4 Public Testnet/BWare",
|
||||||
|
"ethereumChainId": "5",
|
||||||
|
"dydxChainId": "dydx-testnet-4",
|
||||||
|
"chainName": "dYdX Chain",
|
||||||
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "dYdX-api",
|
||||||
|
"isMainNet": false,
|
||||||
|
"tokens": {
|
||||||
|
"chain": {
|
||||||
|
"name": "Dv4TNT",
|
||||||
|
"denom": "adv4tnt",
|
||||||
|
"decimals": 18,
|
||||||
|
"image": "/currencies/dydx.png"
|
||||||
|
},
|
||||||
|
"usdc": {
|
||||||
|
"name": "USDC",
|
||||||
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
|
"decimals": 6,
|
||||||
|
"image": "/currencies/usdc.png"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"endpoints": {
|
||||||
|
"indexers": [
|
||||||
|
{
|
||||||
|
"api": "https://dydx-testnet.imperator.co",
|
||||||
|
"socket": "wss://dydx-testnet.imperator.co"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"validators": [
|
||||||
|
"https://dydx-testnet-full-rpc.public.blastapi.io/"
|
||||||
|
],
|
||||||
|
"0xsquid": "https://testnet.api.squidrouter.com",
|
||||||
|
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
||||||
|
},
|
||||||
|
"links": {
|
||||||
|
"tos": "https://dydx.exchange/v4-terms",
|
||||||
|
"privacy": "https://dydx.exchange/privacy",
|
||||||
|
"statusPage": "https://status.v4testnet.dydx.exchange/",
|
||||||
|
"mintscan": "https://testnet.mintscan.io/dydx-testnet/txs/{tx_hash}",
|
||||||
|
"documentation": "https://docs.dydx.exchange/",
|
||||||
|
"community": "https://discord.com/invite/dydx",
|
||||||
|
"feedback": "https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform",
|
||||||
|
"blogs": "https://www.dydx.foundation/blog",
|
||||||
|
"foundation": "https://www.dydx.foundation",
|
||||||
|
"help": "https://help.dydx.exchange/",
|
||||||
|
"initialMarginFractionLearnmore": "https://help.dydx.exchange/articles/5232637-maximum-position-sizes",
|
||||||
|
"reduceOnlyLearnmore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
|
"mintscanBase": "https://testnet.mintscan.io/dydx-testnet",
|
||||||
|
"governanceLearnmore": "https://help.dydx.exchange",
|
||||||
|
"stakingLearnmore": "https://help.dydx.exchange",
|
||||||
|
"keplrDashboard": "https://testnet.keplr.app/",
|
||||||
|
"accountExportLearnmore": "https://help.dydx.exchange",
|
||||||
|
"walletLearnmore": "https://www.dydx.academy/video/defi-wallet"
|
||||||
|
},
|
||||||
|
"wallets": {
|
||||||
|
"walletconnect": {
|
||||||
|
"client": {
|
||||||
|
"name": "dYdX v4",
|
||||||
|
"description": "dYdX v4 App",
|
||||||
|
"iconUrl": "/logos/dydx-x.png"
|
||||||
|
},
|
||||||
|
"v2": {
|
||||||
|
"projectId": "47559b2ec96c09aed9ff2cb54a31ab0e"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"walletSegue": {
|
||||||
|
"callbackUrl": "/walletsegue"
|
||||||
|
},
|
||||||
|
"images": "/wallets/",
|
||||||
|
"signTypedDataAction": "dYdX Chain Onboarding",
|
||||||
|
"signTypedDataDomainName": "dYdX V4"
|
||||||
|
}
|
||||||
|
},
|
||||||
"dydxprotocol-mainnet": {
|
"dydxprotocol-mainnet": {
|
||||||
"name": "v4",
|
"name": "v4",
|
||||||
"ethereumChainId": "1",
|
"ethereumChainId": "1",
|
||||||
"dydxChainId": "[mainnet chain id]",
|
"dydxChainId": "[mainnet chain id]",
|
||||||
"chainName": "dYdX Chain",
|
"chainName": "dYdX Chain",
|
||||||
"chainLogo": "dydx-chain.png",
|
"chainLogo": "dydx-chain.png",
|
||||||
|
"squidIntegratorId": "[mainnet squid integrator id]",
|
||||||
"isMainNet": true,
|
"isMainNet": true,
|
||||||
"tokens": {
|
"tokens": {
|
||||||
"comment": "Change according to mainnet release",
|
"comment": "Change according to mainnet release",
|
||||||
"chain": {
|
"chain": {
|
||||||
"name": "DYDX",
|
"name": "TokenName",
|
||||||
"denom": "adv4tnt",
|
"denom": "tokenDenom",
|
||||||
"decimals": 18,
|
"decimals": 18,
|
||||||
"image": "/currencies/dydx.png"
|
"image": "/currencies/dydx.png"
|
||||||
},
|
},
|
||||||
@@ -819,10 +1033,20 @@
|
|||||||
"tos": "[HTTP link to TOS]",
|
"tos": "[HTTP link to TOS]",
|
||||||
"privacy": "[HTTP link to Privacy Policy]",
|
"privacy": "[HTTP link to Privacy Policy]",
|
||||||
"mintscan": "[HTTP link to Mintscan, with {tx_hash} placeholder]",
|
"mintscan": "[HTTP link to Mintscan, with {tx_hash} placeholder]",
|
||||||
|
"mintscanBase": "[HTTP link to TOS mintsacn base url]",
|
||||||
|
"feedback": "[HTTP link to feedback form, can be null]",
|
||||||
|
"blogs": "[HTTP link to blogs, can be null]",
|
||||||
|
"foundation": "[HTTP link to foundation, can be null]",
|
||||||
|
"initialMarginFractionLearnMore": "[HTTP link to initial margin fraction learn more, can be null]",
|
||||||
|
"reduceOnlyLearnMore": "https://help.dydx.exchange/articles/6345793-reduce-only-orders",
|
||||||
"documentation": "[HTTP link to documentation, can be null]",
|
"documentation": "[HTTP link to documentation, can be null]",
|
||||||
"community": "[HTTP link to community, can be null]",
|
"community": "[HTTP link to community, can be null]",
|
||||||
"feedback": "[HTTP link to feedback form, can be null]",
|
"help": "[HTTP link to help page, can be null]",
|
||||||
"blogs": "[HTTP link to blogs, can be null]"
|
"governanceLearnMore": "[HTTP link to governance learn more, can be null]",
|
||||||
|
"stakingLearnMore": "[HTTP link to staking learn more, can be null]",
|
||||||
|
"keplrDashboard": "[HTTP link to keplr dashboard, can be null]",
|
||||||
|
"accountExportLearnMore": "[HTTP link to account export learn more, can be null]",
|
||||||
|
"walletLearnMore": "[HTTP link to wallet learn more, can be null]"
|
||||||
},
|
},
|
||||||
"wallets": {
|
"wallets": {
|
||||||
"walletconnect": {
|
"walletconnect": {
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
"iosMinVersion": "0",
|
"iosMinVersion": "0",
|
||||||
"imageUrl": "",
|
"imageUrl": "",
|
||||||
"encoding": "=\"#%/<>?@\\^`{|}:&",
|
"encoding": "=\"#%/<>?@\\^`{|}:&",
|
||||||
|
"androidPackage": "io.metamask",
|
||||||
"connections": [
|
"connections": [
|
||||||
{
|
{
|
||||||
"type": "walletConnectV2",
|
"type": "walletConnectV2",
|
||||||
@@ -98,6 +99,7 @@
|
|||||||
"iosMinVersion": "1.8.0",
|
"iosMinVersion": "1.8.0",
|
||||||
"imageUrl": "",
|
"imageUrl": "",
|
||||||
"encoding": "=\"#%/<>?@\\^`{|}:&",
|
"encoding": "=\"#%/<>?@\\^`{|}:&",
|
||||||
|
"androidPackage": "org.toshi",
|
||||||
"connections": [
|
"connections": [
|
||||||
{
|
{
|
||||||
"type": "walletSegue",
|
"type": "walletSegue",
|
||||||
@@ -155,6 +157,7 @@
|
|||||||
"comment": "imToken",
|
"comment": "imToken",
|
||||||
"iosMinVersion": "0",
|
"iosMinVersion": "0",
|
||||||
"imageUrl": "",
|
"imageUrl": "",
|
||||||
|
"androidPackage": "im.token.app",
|
||||||
"connections": [
|
"connections": [
|
||||||
{
|
{
|
||||||
"type": "walletConnectV2",
|
"type": "walletConnectV2",
|
||||||
@@ -214,6 +217,7 @@
|
|||||||
"iosMinVersion": "0",
|
"iosMinVersion": "0",
|
||||||
"encoding": "=\"#%/<>?@\\^`{|}:&",
|
"encoding": "=\"#%/<>?@\\^`{|}:&",
|
||||||
"imageUrl": "",
|
"imageUrl": "",
|
||||||
|
"androidPackage": "com.wallet.crypto.trustapp",
|
||||||
"connections": [
|
"connections": [
|
||||||
{
|
{
|
||||||
"type": "walletConnectV2",
|
"type": "walletConnectV2",
|
||||||
@@ -271,6 +275,7 @@
|
|||||||
"iosMinVersion": "0",
|
"iosMinVersion": "0",
|
||||||
"encoding": "=\"#%/<>?@\\^`{|}:&",
|
"encoding": "=\"#%/<>?@\\^`{|}:&",
|
||||||
"imageUrl": "",
|
"imageUrl": "",
|
||||||
|
"androidPackage": "io.zerion.android",
|
||||||
"connections": [
|
"connections": [
|
||||||
{
|
{
|
||||||
"type": "walletConnectV2",
|
"type": "walletConnectV2",
|
||||||
@@ -327,6 +332,7 @@
|
|||||||
"comment": "TokenPocket",
|
"comment": "TokenPocket",
|
||||||
"iosMinVersion": "0",
|
"iosMinVersion": "0",
|
||||||
"imageUrl": "",
|
"imageUrl": "",
|
||||||
|
"androidPackage": "vip.mytokenpocket",
|
||||||
"connections": [
|
"connections": [
|
||||||
{
|
{
|
||||||
"type": "walletConnectV2",
|
"type": "walletConnectV2",
|
||||||
@@ -383,6 +389,7 @@
|
|||||||
"comment": "Rainbow",
|
"comment": "Rainbow",
|
||||||
"iosMinVersion": "0",
|
"iosMinVersion": "0",
|
||||||
"encoding": "=\"#%/<>?@\\^`{|}:&",
|
"encoding": "=\"#%/<>?@\\^`{|}:&",
|
||||||
|
"androidPackage": "me.rainbow",
|
||||||
"backlinked": true,
|
"backlinked": true,
|
||||||
"imageUrl": "",
|
"imageUrl": "",
|
||||||
"connections": [
|
"connections": [
|
||||||
@@ -442,6 +449,7 @@
|
|||||||
"comment": "1inch",
|
"comment": "1inch",
|
||||||
"iosMinVersion": "0",
|
"iosMinVersion": "0",
|
||||||
"encoding": "=\"#%/<>?@\\^`{|}:&",
|
"encoding": "=\"#%/<>?@\\^`{|}:&",
|
||||||
|
"androidPackage": "io.oneinch.android",
|
||||||
"imageUrl": "",
|
"imageUrl": "",
|
||||||
"connections": [
|
"connections": [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
## App Integrations
|
||||||
|
### Amplitude
|
||||||
|
Analytics service used to collect data to help the dYdX Product team make informed product decisions.
|
||||||
|
|
||||||
|
<b>To use with dydxprotocol/v4-web:</b>
|
||||||
|
1. Amplitude account with API key.
|
||||||
|
2. Add API key in Github > Secrets and Variables > Actions as `AMPLITUDE_API_KEY`
|
||||||
|
3. In your deploy scripts add `pnpm run build:inject-amplitude` after your pnpm build / vite build command.
|
||||||
|
|
||||||
|
### Bugsnag
|
||||||
|
Error handling service used to collect handled/unhandled errors within the app. The information collected is used to help debug and alert the engineering team of crashes/unhandled errors within the app to improve stability.
|
||||||
|
|
||||||
|
<b>To use with dydxprotocol/v4-web:</b>
|
||||||
|
1. Bugsnag account with API key.
|
||||||
|
2. Add API key in Github > Secrets and Variables > Actions as `BUGSNAG_API_KEY`
|
||||||
|
3. In your deploy scripts add `pnpm run build:inject-bugsnag` after your pnpm build / vite build command.
|
||||||
|
4. If you are using with the Amplitude deployment scripts, your build command may look like the following: `pnpm build && pnpm run build:inject-amplitude && pnpm run build:inject-bugsnag`
|
||||||
|
|
||||||
|
### StatusPage
|
||||||
|
Service used to inform users of any status updates to our platform. These status updates are manually set and updated by the On Call engineers.
|
||||||
|
|
||||||
|
<b>To use with dydxprotocol/v4-web:</b>
|
||||||
|
1. StatusPage account and script URI
|
||||||
|
2. Add API key in Github > Secrets and Variables > Actions as `STATUS_PAGE_SCRIPT_URI`
|
||||||
|
3. In your deploy scripts add `pnpm run build:inject-statuspage` after your pnpm build / vite build command.
|
||||||
|
4. If you are using with the Amplitude deployment scripts, your build command may look like the following: `pnpm build && pnpm run build:inject-amplitude && pnpm run build:inject-statuspage`
|
||||||
|
|
||||||
|
### Intercom
|
||||||
|
Service used for live customer support (chat/inbox) as well as home for Help Articles.
|
||||||
|
|
||||||
|
<b>To use with dydxprotocol/v4-web:</b>
|
||||||
|
1. Create Intercom account
|
||||||
|
2. In Intercom UI
|
||||||
|
Getting started > Set up Messenger > will give you your API Key on Step 2
|
||||||
|
Customize Intercom Messenger by adding logo and brand colors
|
||||||
|
3. Add API key in Github > Secrets and Variables > Actions as `INTERCOM_APP_ID`
|
||||||
|
4. In your deploy scripts add `pnpm run build:inject-intercom` after your pnpm build / vite build command.
|
||||||
|
5. If you are using with the Amplitude deployment scripts, your build command may look like the following: `pnpm build && pnpm run build:inject-amplitude && pnpm run build:inject-intercom`
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
/* eslint-disable no-console */
|
||||||
|
import fs from 'fs/promises';
|
||||||
|
import path from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const INTERCOM_APP_ID = process.env.INTERCOM_APP_ID;
|
||||||
|
|
||||||
|
const currentPath = fileURLToPath(import.meta.url);
|
||||||
|
const projectRoot = path.dirname(currentPath);
|
||||||
|
const htmlFilePath = path.resolve(projectRoot, '../dist/index.html');
|
||||||
|
|
||||||
|
if (INTERCOM_APP_ID) {
|
||||||
|
try {
|
||||||
|
const html = await fs.readFile(htmlFilePath, 'utf-8');
|
||||||
|
|
||||||
|
const intercomScripts = `
|
||||||
|
<!-- Intercom -->
|
||||||
|
<script>
|
||||||
|
window.intercomSettings = {
|
||||||
|
api_base: 'https://api-iam.intercom.io',
|
||||||
|
app_id: '${INTERCOM_APP_ID}',
|
||||||
|
custom_launcher_selector: '.custom_intercom',
|
||||||
|
hide_default_launcher: true,
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
// We pre-filled your app ID in the widget URL: 'https://widget.intercom.io/widget/${INTERCOM_APP_ID}'
|
||||||
|
(function () {
|
||||||
|
var w = window;
|
||||||
|
var ic = w.Intercom;
|
||||||
|
if (typeof ic === 'function') {
|
||||||
|
ic('reattach_activator');
|
||||||
|
ic('update', w.intercomSettings);
|
||||||
|
} else {
|
||||||
|
var d = document;
|
||||||
|
var i = function () {
|
||||||
|
i.c(arguments);
|
||||||
|
};
|
||||||
|
i.q = [];
|
||||||
|
i.c = function (args) {
|
||||||
|
i.q.push(args);
|
||||||
|
};
|
||||||
|
w.Intercom = i;
|
||||||
|
var l = function () {
|
||||||
|
var s = d.createElement('script');
|
||||||
|
s.type = 'text/javascript';
|
||||||
|
s.async = true;
|
||||||
|
s.src = 'https://widget.intercom.io/widget/${INTERCOM_APP_ID}';
|
||||||
|
var x = d.getElementsByTagName('script')[0];
|
||||||
|
x.parentNode.insertBefore(s, x);
|
||||||
|
};
|
||||||
|
if (document.readyState === 'complete') {
|
||||||
|
l();
|
||||||
|
} else if (w.attachEvent) {
|
||||||
|
w.attachEvent('onload', l);
|
||||||
|
} else {
|
||||||
|
w.addEventListener('load', l, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const injectedHtml = html.replace(
|
||||||
|
'<div id="root"></div>',
|
||||||
|
`<div id="root"></div>\n${intercomScripts}\n`
|
||||||
|
);
|
||||||
|
|
||||||
|
await fs.writeFile(htmlFilePath, injectedHtml, 'utf-8');
|
||||||
|
|
||||||
|
console.log('Intercom scripts successfully injected.');
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Error injecting Intercom scripts:', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,7 +7,13 @@ import { GrazProvider } from 'graz';
|
|||||||
|
|
||||||
import { AppRoute, DEFAULT_TRADE_ROUTE } from '@/constants/routes';
|
import { AppRoute, DEFAULT_TRADE_ROUTE } from '@/constants/routes';
|
||||||
|
|
||||||
import { useBreakpoints, useInitializePage, useShouldShowFooter, useAnalytics } from '@/hooks';
|
import {
|
||||||
|
useBreakpoints,
|
||||||
|
useTokenConfigs,
|
||||||
|
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';
|
||||||
@@ -27,6 +33,8 @@ import ProfilePage from '@/pages/Profile';
|
|||||||
import { SettingsPage } from '@/pages/settings/Settings';
|
import { SettingsPage } from '@/pages/settings/Settings';
|
||||||
import TradePage from '@/pages/trade/Trade';
|
import TradePage from '@/pages/trade/Trade';
|
||||||
import { RewardsPage } from '@/pages/rewards/RewardsPage';
|
import { RewardsPage } from '@/pages/rewards/RewardsPage';
|
||||||
|
import { TermsOfUsePage } from '@/pages/TermsOfUsePage';
|
||||||
|
import { PrivacyPolicyPage } from '@/pages/PrivacyPolicyPage';
|
||||||
|
|
||||||
import { HeaderDesktop } from '@/layout/Header/HeaderDesktop';
|
import { HeaderDesktop } from '@/layout/Header/HeaderDesktop';
|
||||||
import { FooterDesktop } from '@/layout/Footer/FooterDesktop';
|
import { FooterDesktop } from '@/layout/Footer/FooterDesktop';
|
||||||
@@ -55,6 +63,7 @@ const Content = () => {
|
|||||||
const { isTablet, isNotTablet } = useBreakpoints();
|
const { isTablet, isNotTablet } = useBreakpoints();
|
||||||
const isShowingHeader = isNotTablet;
|
const isShowingHeader = isNotTablet;
|
||||||
const isShowingFooter = useShouldShowFooter();
|
const isShowingFooter = useShouldShowFooter();
|
||||||
|
const { chainTokenLabel } = useTokenConfigs();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Styled.Content isShowingHeader={isShowingHeader} isShowingFooter={isShowingFooter}>
|
<Styled.Content isShowingHeader={isShowingHeader} isShowingFooter={isShowingFooter}>
|
||||||
@@ -69,7 +78,7 @@ const Content = () => {
|
|||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
<Route path={AppRoute.Markets} element={<MarketsPage />} />
|
<Route path={AppRoute.Markets} element={<MarketsPage />} />
|
||||||
<Route path={AppRoute.Rewards} element={<RewardsPage />} />
|
<Route path={`/${chainTokenLabel}`} element={<RewardsPage />} />
|
||||||
{isTablet && (
|
{isTablet && (
|
||||||
<>
|
<>
|
||||||
<Route path={AppRoute.Alerts} element={<AlertsPage />} />
|
<Route path={AppRoute.Alerts} element={<AlertsPage />} />
|
||||||
@@ -82,6 +91,9 @@ const Content = () => {
|
|||||||
<Route path={`${AppRoute.Portfolio}/*`} element={<PortfolioPage />} />
|
<Route path={`${AppRoute.Portfolio}/*`} element={<PortfolioPage />} />
|
||||||
</Route>
|
</Route>
|
||||||
|
|
||||||
|
<Route path={AppRoute.Terms} element={<TermsOfUsePage />} />
|
||||||
|
<Route path={AppRoute.Privacy} element={<PrivacyPolicyPage />} />
|
||||||
|
|
||||||
<Route path="*" element={<Navigate to={DEFAULT_TRADE_ROUTE} replace />} />
|
<Route path="*" element={<Navigate to={DEFAULT_TRADE_ROUTE} replace />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ Styled.TriggerIcon = styled.span`
|
|||||||
width: var(--trigger-icon-width);
|
width: var(--trigger-icon-width);
|
||||||
|
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
transition: transform 0.3s var(--ease-out-expo);
|
transition: rotate 0.3s var(--ease-out-expo);
|
||||||
color: var(--trigger-icon-color);
|
color: var(--trigger-icon-color);
|
||||||
|
|
||||||
${Styled.Trigger}[data-state='open'] & {
|
${Styled.Trigger}[data-state='open'] & {
|
||||||
|
|||||||
@@ -225,6 +225,7 @@ Styled.CollapsibleContent = styled(CollapsibleContent)`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.IconButton = styled(IconButton)`
|
Styled.IconButton = styled(IconButton)`
|
||||||
|
--button-icon-size: 1em;
|
||||||
${Styled.CollapsibleRoot}[data-state='closed'] & {
|
${Styled.CollapsibleRoot}[data-state='closed'] & {
|
||||||
rotate: -0.5turn;
|
rotate: -0.5turn;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,31 +3,44 @@ import styled, { AnyStyledComponent } from 'styled-components';
|
|||||||
|
|
||||||
import { type MenuConfig } from '@/constants/menus';
|
import { type MenuConfig } from '@/constants/menus';
|
||||||
|
|
||||||
import { Dialog, DialogPlacement } from '@/components/Dialog';
|
import { Dialog, DialogPlacement, type DialogProps } from '@/components/Dialog';
|
||||||
import { ComboboxMenu } from '@/components/ComboboxMenu';
|
import { ComboboxMenu, type ComboboxMenuProps } from '@/components/ComboboxMenu';
|
||||||
|
|
||||||
type ElementProps<MenuItemValue extends string | number, MenuGroupValue extends string | number> = {
|
type ElementProps<MenuItemValue extends string | number, MenuGroupValue extends string | number> = {
|
||||||
isOpen?: boolean;
|
|
||||||
setIsOpen?: (open: boolean) => void;
|
|
||||||
title?: React.ReactNode;
|
title?: React.ReactNode;
|
||||||
description?: React.ReactNode;
|
description?: React.ReactNode;
|
||||||
slotTrigger?: React.ReactNode;
|
|
||||||
slotHeaderInner?: React.ReactNode;
|
|
||||||
slotFooter?: React.ReactNode;
|
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
|
|
||||||
items: MenuConfig<MenuItemValue, MenuGroupValue>;
|
items: MenuConfig<MenuItemValue, MenuGroupValue>;
|
||||||
onItemSelected?: () => void;
|
|
||||||
inputPlaceholder?: string;
|
|
||||||
slotEmpty?: React.ReactNode;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type StyleProps = {
|
type StyleProps = {
|
||||||
placement: DialogPlacement,
|
|
||||||
className?: string;
|
className?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ComboboxDialogMenu = <MenuItemValue extends string | number, MenuGroupValue extends string | number>({
|
type PickComboxMenuProps<
|
||||||
|
MenuItemValue extends string | number,
|
||||||
|
MenuGroupValue extends string | number
|
||||||
|
> = Pick<
|
||||||
|
ComboboxMenuProps<MenuItemValue, MenuGroupValue>,
|
||||||
|
'inputPlaceholder' | 'onItemSelected' | 'slotEmpty' | 'withSearch' | 'withStickyLayout'
|
||||||
|
>;
|
||||||
|
|
||||||
|
type PickDialogProps = Pick<
|
||||||
|
DialogProps,
|
||||||
|
| 'description'
|
||||||
|
| 'isOpen'
|
||||||
|
| 'placement'
|
||||||
|
| 'setIsOpen'
|
||||||
|
| 'slotHeaderInner'
|
||||||
|
| 'slotTrigger'
|
||||||
|
| 'slotFooter'
|
||||||
|
| 'preventClose'
|
||||||
|
>;
|
||||||
|
|
||||||
|
export const ComboboxDialogMenu = <
|
||||||
|
MenuItemValue extends string | number,
|
||||||
|
MenuGroupValue extends string | number
|
||||||
|
>({
|
||||||
isOpen = false,
|
isOpen = false,
|
||||||
setIsOpen,
|
setIsOpen,
|
||||||
title,
|
title,
|
||||||
@@ -40,11 +53,17 @@ export const ComboboxDialogMenu = <MenuItemValue extends string | number, MenuGr
|
|||||||
onItemSelected,
|
onItemSelected,
|
||||||
inputPlaceholder,
|
inputPlaceholder,
|
||||||
slotEmpty,
|
slotEmpty,
|
||||||
|
withSearch,
|
||||||
|
withStickyLayout = true,
|
||||||
children,
|
children,
|
||||||
|
|
||||||
placement = DialogPlacement.Default,
|
placement = DialogPlacement.Default,
|
||||||
|
preventClose,
|
||||||
className,
|
className,
|
||||||
}: ElementProps<MenuItemValue, MenuGroupValue> & StyleProps) => (
|
}: ElementProps<MenuItemValue, MenuGroupValue> &
|
||||||
|
PickComboxMenuProps<MenuItemValue, MenuGroupValue> &
|
||||||
|
PickDialogProps &
|
||||||
|
StyleProps) => (
|
||||||
// TODO: sub-menu state management
|
// TODO: sub-menu state management
|
||||||
<Styled.Dialog
|
<Styled.Dialog
|
||||||
isOpen={isOpen}
|
isOpen={isOpen}
|
||||||
@@ -54,8 +73,8 @@ export const ComboboxDialogMenu = <MenuItemValue extends string | number, MenuGr
|
|||||||
slotHeaderInner={slotHeaderInner}
|
slotHeaderInner={slotHeaderInner}
|
||||||
slotTrigger={slotTrigger}
|
slotTrigger={slotTrigger}
|
||||||
slotFooter={slotFooter}
|
slotFooter={slotFooter}
|
||||||
|
|
||||||
placement={placement}
|
placement={placement}
|
||||||
|
preventClose={preventClose}
|
||||||
className={className}
|
className={className}
|
||||||
>
|
>
|
||||||
<Styled.ComboboxMenu
|
<Styled.ComboboxMenu
|
||||||
@@ -64,7 +83,8 @@ export const ComboboxDialogMenu = <MenuItemValue extends string | number, MenuGr
|
|||||||
title={title}
|
title={title}
|
||||||
inputPlaceholder={inputPlaceholder}
|
inputPlaceholder={inputPlaceholder}
|
||||||
slotEmpty={slotEmpty}
|
slotEmpty={slotEmpty}
|
||||||
withStickyLayout
|
withSearch={withSearch}
|
||||||
|
withStickyLayout={withStickyLayout}
|
||||||
/>
|
/>
|
||||||
{children}
|
{children}
|
||||||
</Styled.Dialog>
|
</Styled.Dialog>
|
||||||
@@ -98,4 +118,5 @@ Styled.Dialog = styled(Dialog)`
|
|||||||
|
|
||||||
Styled.ComboboxMenu = styled(ComboboxMenu)`
|
Styled.ComboboxMenu = styled(ComboboxMenu)`
|
||||||
--comboboxMenu-backgroundColor: var(--comboboxDialogMenu-backgroundColor);
|
--comboboxMenu-backgroundColor: var(--comboboxDialogMenu-backgroundColor);
|
||||||
|
--comboboxMenu-item-gap: var(--comboxDialogMenu-item-gap, 0.5rem);
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { layoutMixins } from '@/styles/layoutMixins';
|
|||||||
|
|
||||||
import { Tag } from '@/components/Tag';
|
import { Tag } from '@/components/Tag';
|
||||||
|
|
||||||
type ElementProps<MenuItemValue extends string, MenuGroupValue extends string> = {
|
type ElementProps<MenuItemValue extends string | number, MenuGroupValue extends string | number> = {
|
||||||
items: MenuConfig<MenuItemValue, MenuGroupValue>;
|
items: MenuConfig<MenuItemValue, MenuGroupValue>;
|
||||||
onItemSelected?: () => void;
|
onItemSelected?: () => void;
|
||||||
|
|
||||||
@@ -23,6 +23,11 @@ type StyleProps = {
|
|||||||
withStickyLayout?: boolean;
|
withStickyLayout?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type ComboboxMenuProps<
|
||||||
|
MenuItemValue extends string | number,
|
||||||
|
MenuGroupValue extends string | number
|
||||||
|
> = ElementProps<MenuItemValue, MenuGroupValue> & StyleProps;
|
||||||
|
|
||||||
export const ComboboxMenu = <MenuItemValue extends string, MenuGroupValue extends string>({
|
export const ComboboxMenu = <MenuItemValue extends string, MenuGroupValue extends string>({
|
||||||
items,
|
items,
|
||||||
onItemSelected,
|
onItemSelected,
|
||||||
@@ -34,7 +39,7 @@ export const ComboboxMenu = <MenuItemValue extends string, MenuGroupValue extend
|
|||||||
|
|
||||||
className,
|
className,
|
||||||
withStickyLayout,
|
withStickyLayout,
|
||||||
}: ElementProps<MenuItemValue, MenuGroupValue> & StyleProps) => {
|
}: ComboboxMenuProps<MenuItemValue, MenuGroupValue>) => {
|
||||||
const [highlightedCommand, setHighlightedCommand] = useState<MenuItemValue>();
|
const [highlightedCommand, setHighlightedCommand] = useState<MenuItemValue>();
|
||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
// const inputRef = useRef<HTMLInputElement | null>(null);
|
// const inputRef = useRef<HTMLInputElement | null>(null);
|
||||||
@@ -171,6 +176,7 @@ Styled.Command = styled(Command)<{ $withStickyLayout?: boolean }>`
|
|||||||
--comboboxMenu-item-highlighted-backgroundColor: var(--color-layer-3);
|
--comboboxMenu-item-highlighted-backgroundColor: var(--color-layer-3);
|
||||||
--comboboxMenu-item-highlighted-textColor: var(--color-text-1);
|
--comboboxMenu-item-highlighted-textColor: var(--color-text-1);
|
||||||
--comboboxMenu-item-backgroundColor: ;
|
--comboboxMenu-item-backgroundColor: ;
|
||||||
|
--comboboxMenu-item-gap: 0.5rem;
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
align-content: start;
|
align-content: start;
|
||||||
@@ -269,18 +275,17 @@ Styled.List = styled(Command.List)<{ $withStickyLayout?: boolean }>`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Item = styled(Command.Item)`
|
Styled.Item = styled(Command.Item)`
|
||||||
|
${layoutMixins.scrollSnapItem}
|
||||||
${popoverMixins.item}
|
${popoverMixins.item}
|
||||||
--item-checked-backgroundColor: var(--comboboxMenu-item-checked-backgroundColor);
|
--item-checked-backgroundColor: var(--comboboxMenu-item-checked-backgroundColor);
|
||||||
--item-checked-textColor: var(--comboboxMenu-item-checked-textColor);
|
--item-checked-textColor: var(--comboboxMenu-item-checked-textColor);
|
||||||
--item-highlighted-textColor: var(--comboboxMenu-item-highlighted-textColor);
|
--item-highlighted-textColor: var(--comboboxMenu-item-highlighted-textColor);
|
||||||
|
--item-gap: var(--comboboxMenu-item-gap);
|
||||||
${layoutMixins.scrollSnapItem}
|
|
||||||
|
|
||||||
background-color: var(--comboboxMenu-backgroundColor, inherit);
|
background-color: var(--comboboxMenu-backgroundColor, inherit);
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.5rem;
|
|
||||||
|
|
||||||
&[aria-disabled='true'] {
|
&[aria-disabled='true'] {
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ type StyleProps = {
|
|||||||
className?: string;
|
className?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type DialogProps = ElementProps & StyleProps;
|
||||||
|
|
||||||
const DialogPortal = ({
|
const DialogPortal = ({
|
||||||
withPortal,
|
withPortal,
|
||||||
container,
|
container,
|
||||||
@@ -82,7 +84,7 @@ export const Dialog = ({
|
|||||||
hasHeaderBorder = false,
|
hasHeaderBorder = false,
|
||||||
children,
|
children,
|
||||||
className,
|
className,
|
||||||
}: ElementProps & StyleProps) => {
|
}: DialogProps) => {
|
||||||
const closeButtonRef = useRef<HTMLButtonElement>();
|
const closeButtonRef = useRef<HTMLButtonElement>();
|
||||||
|
|
||||||
const showOverlay = ![DialogPlacement.Inline, DialogPlacement.FullScreen].includes(placement);
|
const showOverlay = ![DialogPlacement.Inline, DialogPlacement.FullScreen].includes(placement);
|
||||||
|
|||||||
@@ -33,9 +33,11 @@ export const DropdownHeaderMenu = <MenuItemValue extends string>({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Root>
|
<Root>
|
||||||
<Styled.Trigger className={className}>
|
<Styled.Trigger className={className} asChild>
|
||||||
|
<div>
|
||||||
{children}
|
{children}
|
||||||
<Styled.DropdownIconButton iconName={IconName.Caret} isToggle />
|
<Styled.DropdownIconButton iconName={IconName.Caret} isToggle />
|
||||||
|
</div>
|
||||||
</Styled.Trigger>
|
</Styled.Trigger>
|
||||||
<Portal>
|
<Portal>
|
||||||
<Styled.Content
|
<Styled.Content
|
||||||
|
|||||||
@@ -6,11 +6,14 @@ import {
|
|||||||
AddressConnectorIcon,
|
AddressConnectorIcon,
|
||||||
ArrowIcon,
|
ArrowIcon,
|
||||||
Bar3Icon,
|
Bar3Icon,
|
||||||
|
BellIcon,
|
||||||
|
BellStrokeIcon,
|
||||||
BoxCloseIcon,
|
BoxCloseIcon,
|
||||||
CalculatorIcon,
|
CalculatorIcon,
|
||||||
CaretIcon,
|
CaretIcon,
|
||||||
CautionCircleStrokeIcon,
|
CautionCircleStrokeIcon,
|
||||||
CautionCircleIcon,
|
CautionCircleIcon,
|
||||||
|
ChatIcon,
|
||||||
CheckIcon,
|
CheckIcon,
|
||||||
ChevronLeftIcon,
|
ChevronLeftIcon,
|
||||||
ChevronRightIcon,
|
ChevronRightIcon,
|
||||||
@@ -21,9 +24,10 @@ import {
|
|||||||
CommentIcon,
|
CommentIcon,
|
||||||
CopyIcon,
|
CopyIcon,
|
||||||
CubeIcon,
|
CubeIcon,
|
||||||
|
DepositIcon,
|
||||||
|
DepthChartIcon,
|
||||||
DiscordIcon,
|
DiscordIcon,
|
||||||
EtherscanIcon,
|
EtherscanIcon,
|
||||||
DepthChartIcon,
|
|
||||||
ExportKeysIcon,
|
ExportKeysIcon,
|
||||||
FeedbackIcon,
|
FeedbackIcon,
|
||||||
FileIcon,
|
FileIcon,
|
||||||
@@ -37,6 +41,7 @@ import {
|
|||||||
LockIcon,
|
LockIcon,
|
||||||
LogoShortIcon,
|
LogoShortIcon,
|
||||||
MenuIcon,
|
MenuIcon,
|
||||||
|
MigrateIcon,
|
||||||
MintscanIcon,
|
MintscanIcon,
|
||||||
OrderbookIcon,
|
OrderbookIcon,
|
||||||
OrderCanceledIcon,
|
OrderCanceledIcon,
|
||||||
@@ -65,17 +70,21 @@ import {
|
|||||||
WarningIcon,
|
WarningIcon,
|
||||||
WebsiteIcon,
|
WebsiteIcon,
|
||||||
WhitepaperIcon,
|
WhitepaperIcon,
|
||||||
|
WithdrawIcon,
|
||||||
} from '@/icons';
|
} from '@/icons';
|
||||||
|
|
||||||
export enum IconName {
|
export enum IconName {
|
||||||
AddressConnector = 'AddressConnector',
|
AddressConnector = 'AddressConnector',
|
||||||
Arrow = 'Arrow',
|
Arrow = 'Arrow',
|
||||||
Bar3 = 'Bar3',
|
Bar3 = 'Bar3',
|
||||||
|
Bell = 'Bell',
|
||||||
|
BellStroked = 'BellStroked',
|
||||||
BoxClose = 'BoxClose',
|
BoxClose = 'BoxClose',
|
||||||
Calculator = 'Calculator',
|
Calculator = 'Calculator',
|
||||||
Caret = 'Caret',
|
Caret = 'Caret',
|
||||||
CautionCircle = 'CautionCircle',
|
CautionCircle = 'CautionCircle',
|
||||||
CautionCircleStroked = 'CautionCircleStroked',
|
CautionCircleStroked = 'CautionCircleStroked',
|
||||||
|
Chat = 'Chat',
|
||||||
Check = 'Check',
|
Check = 'Check',
|
||||||
ChevronLeft = 'ChevronLeft',
|
ChevronLeft = 'ChevronLeft',
|
||||||
ChevronRight = 'ChevronRight',
|
ChevronRight = 'ChevronRight',
|
||||||
@@ -86,6 +95,7 @@ export enum IconName {
|
|||||||
Comment = 'Comment',
|
Comment = 'Comment',
|
||||||
Copy = 'Copy',
|
Copy = 'Copy',
|
||||||
Cube = 'Cube',
|
Cube = 'Cube',
|
||||||
|
Deposit = 'Deposit',
|
||||||
DepthChart = 'DepthChart',
|
DepthChart = 'DepthChart',
|
||||||
Discord = 'Discord',
|
Discord = 'Discord',
|
||||||
Etherscan = 'Etherscan',
|
Etherscan = 'Etherscan',
|
||||||
@@ -102,6 +112,7 @@ export enum IconName {
|
|||||||
Lock = 'Lock',
|
Lock = 'Lock',
|
||||||
LogoShort = 'LogoShort',
|
LogoShort = 'LogoShort',
|
||||||
Menu = 'Menu',
|
Menu = 'Menu',
|
||||||
|
Migrate = 'Migrate',
|
||||||
Mintscan = 'Mintscan',
|
Mintscan = 'Mintscan',
|
||||||
Onboarding = 'Onboarding',
|
Onboarding = 'Onboarding',
|
||||||
Orderbook = 'OrderbookIcon',
|
Orderbook = 'OrderbookIcon',
|
||||||
@@ -131,17 +142,21 @@ export enum IconName {
|
|||||||
Warning = 'Warning',
|
Warning = 'Warning',
|
||||||
Website = 'Website',
|
Website = 'Website',
|
||||||
Whitepaper = 'Whitepaper',
|
Whitepaper = 'Whitepaper',
|
||||||
|
Withdraw = 'Withdraw',
|
||||||
}
|
}
|
||||||
|
|
||||||
const icons = {
|
const icons = {
|
||||||
[IconName.AddressConnector]: AddressConnectorIcon,
|
[IconName.AddressConnector]: AddressConnectorIcon,
|
||||||
[IconName.Arrow]: ArrowIcon,
|
[IconName.Arrow]: ArrowIcon,
|
||||||
[IconName.Bar3]: Bar3Icon,
|
[IconName.Bar3]: Bar3Icon,
|
||||||
|
[IconName.Bell]: BellIcon,
|
||||||
|
[IconName.BellStroked]: BellStrokeIcon,
|
||||||
[IconName.BoxClose]: BoxCloseIcon,
|
[IconName.BoxClose]: BoxCloseIcon,
|
||||||
[IconName.Calculator]: CalculatorIcon,
|
[IconName.Calculator]: CalculatorIcon,
|
||||||
[IconName.Caret]: CaretIcon,
|
[IconName.Caret]: CaretIcon,
|
||||||
[IconName.CautionCircle]: CautionCircleIcon,
|
[IconName.CautionCircle]: CautionCircleIcon,
|
||||||
[IconName.CautionCircleStroked]: CautionCircleStrokeIcon,
|
[IconName.CautionCircleStroked]: CautionCircleStrokeIcon,
|
||||||
|
[IconName.Chat]: ChatIcon,
|
||||||
[IconName.Check]: CheckIcon,
|
[IconName.Check]: CheckIcon,
|
||||||
[IconName.ChevronLeft]: ChevronLeftIcon,
|
[IconName.ChevronLeft]: ChevronLeftIcon,
|
||||||
[IconName.ChevronRight]: ChevronRightIcon,
|
[IconName.ChevronRight]: ChevronRightIcon,
|
||||||
@@ -152,6 +167,7 @@ const icons = {
|
|||||||
[IconName.Comment]: CommentIcon,
|
[IconName.Comment]: CommentIcon,
|
||||||
[IconName.Copy]: CopyIcon,
|
[IconName.Copy]: CopyIcon,
|
||||||
[IconName.Cube]: CubeIcon,
|
[IconName.Cube]: CubeIcon,
|
||||||
|
[IconName.Deposit]: DepositIcon,
|
||||||
[IconName.DepthChart]: DepthChartIcon,
|
[IconName.DepthChart]: DepthChartIcon,
|
||||||
[IconName.Discord]: DiscordIcon,
|
[IconName.Discord]: DiscordIcon,
|
||||||
[IconName.Etherscan]: EtherscanIcon,
|
[IconName.Etherscan]: EtherscanIcon,
|
||||||
@@ -168,6 +184,7 @@ const icons = {
|
|||||||
[IconName.Lock]: LockIcon,
|
[IconName.Lock]: LockIcon,
|
||||||
[IconName.LogoShort]: LogoShortIcon,
|
[IconName.LogoShort]: LogoShortIcon,
|
||||||
[IconName.Menu]: MenuIcon,
|
[IconName.Menu]: MenuIcon,
|
||||||
|
[IconName.Migrate]: MigrateIcon,
|
||||||
[IconName.Mintscan]: MintscanIcon,
|
[IconName.Mintscan]: MintscanIcon,
|
||||||
[IconName.Orderbook]: OrderbookIcon,
|
[IconName.Orderbook]: OrderbookIcon,
|
||||||
[IconName.OrderCanceled]: OrderCanceledIcon,
|
[IconName.OrderCanceled]: OrderCanceledIcon,
|
||||||
@@ -196,6 +213,7 @@ const icons = {
|
|||||||
[IconName.Warning]: WarningIcon,
|
[IconName.Warning]: WarningIcon,
|
||||||
[IconName.Website]: WebsiteIcon,
|
[IconName.Website]: WebsiteIcon,
|
||||||
[IconName.Whitepaper]: WhitepaperIcon,
|
[IconName.Whitepaper]: WhitepaperIcon,
|
||||||
|
[IconName.Withdraw]: WithdrawIcon,
|
||||||
} as Record<IconName, ElementType>;
|
} as Record<IconName, ElementType>;
|
||||||
|
|
||||||
type ElementProps = {
|
type ElementProps = {
|
||||||
@@ -213,7 +231,8 @@ export const Icon = styled(
|
|||||||
iconComponent: Component = iconName && icons[iconName],
|
iconComponent: Component = iconName && icons[iconName],
|
||||||
className,
|
className,
|
||||||
...props
|
...props
|
||||||
}: ElementProps & StyleProps) => (Component ? <Component className={className} {...props} /> : null)
|
}: ElementProps & StyleProps) =>
|
||||||
|
Component ? <Component className={className} {...props} /> : null
|
||||||
)`
|
)`
|
||||||
width: 1em;
|
width: 1em;
|
||||||
height: 1em;
|
height: 1em;
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ const Styled: Record<string, AnyStyledComponent> = {};
|
|||||||
const buttonMixin = css`
|
const buttonMixin = css`
|
||||||
// Params
|
// Params
|
||||||
--button-icon-size: 1.125em;
|
--button-icon-size: 1.125em;
|
||||||
|
--button-padding: 0;
|
||||||
|
|
||||||
// Rules
|
// Rules
|
||||||
> * {
|
> * {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ const NavItem = forwardRef(
|
|||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
{slotAfter}
|
{slotAfter}
|
||||||
{subitems?.length && <Styled.Icon iconName={IconName.Caret} />}
|
{subitems?.length && <Styled.Icon iconName={IconName.Triangle} />}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -525,6 +525,9 @@ Styled.NavItem = styled(NavItem)<{ orientation: 'horizontal' | 'vertical' }>`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Icon = styled(Icon)`
|
Styled.Icon = styled(Icon)`
|
||||||
|
font-size: 0.375em;
|
||||||
|
transition: rotate 0.3s var(--ease-out-expo);
|
||||||
|
|
||||||
${Styled.List}[data-orientation="menu"] & {
|
${Styled.List}[data-orientation="menu"] & {
|
||||||
rotate: -0.25turn;
|
rotate: -0.25turn;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { layoutMixins } from '@/styles/layoutMixins';
|
|||||||
type PanelProps = {
|
type PanelProps = {
|
||||||
slotHeaderContent?: string;
|
slotHeaderContent?: string;
|
||||||
slotHeader?: React.ReactNode;
|
slotHeader?: React.ReactNode;
|
||||||
|
slotRight?: React.ReactNode;
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
href?: string;
|
href?: string;
|
||||||
onHeaderClick?: () => void;
|
onHeaderClick?: () => void;
|
||||||
@@ -22,6 +23,7 @@ type PanelStyleProps = {
|
|||||||
export const Panel = ({
|
export const Panel = ({
|
||||||
slotHeaderContent,
|
slotHeaderContent,
|
||||||
slotHeader,
|
slotHeader,
|
||||||
|
slotRight,
|
||||||
children,
|
children,
|
||||||
href,
|
href,
|
||||||
onHeaderClick,
|
onHeaderClick,
|
||||||
@@ -29,7 +31,8 @@ export const Panel = ({
|
|||||||
hasSeparator,
|
hasSeparator,
|
||||||
className,
|
className,
|
||||||
}: PanelProps & PanelStyleProps) => (
|
}: PanelProps & PanelStyleProps) => (
|
||||||
<Styled.Panel onClick={onClick}>
|
<Styled.Panel onClick={onClick} className={className}>
|
||||||
|
<Styled.Left>
|
||||||
{href ? (
|
{href ? (
|
||||||
<Link to={href}>
|
<Link to={href}>
|
||||||
{slotHeader ? (
|
{slotHeader ? (
|
||||||
@@ -50,35 +53,58 @@ export const Panel = ({
|
|||||||
</Styled.Header>
|
</Styled.Header>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
<Styled.Content className={className}>{children}</Styled.Content>
|
<Styled.Content>{children}</Styled.Content>
|
||||||
|
</Styled.Left>
|
||||||
|
{slotRight}
|
||||||
</Styled.Panel>
|
</Styled.Panel>
|
||||||
);
|
);
|
||||||
|
|
||||||
const Styled: Record<string, AnyStyledComponent> = {};
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
Styled.Panel = styled.section`
|
Styled.Panel = styled.section<{ onClick?: () => void }>`
|
||||||
${layoutMixins.flexColumn}
|
--panel-paddingY: 1rem;
|
||||||
|
--panel-paddingX: 1rem;
|
||||||
|
--panel-content-paddingY: var(--panel-paddingY);
|
||||||
|
--panel-content-paddingX: var(--panel-paddingX);
|
||||||
|
|
||||||
|
${layoutMixins.row}
|
||||||
|
|
||||||
background-color: var(--color-layer-3);
|
background-color: var(--color-layer-3);
|
||||||
border-radius: 0.875rem;
|
border-radius: 0.875rem;
|
||||||
|
|
||||||
|
${({ onClick }) =>
|
||||||
|
onClick &&
|
||||||
|
css`
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
button:not(:disabled) {
|
||||||
|
color: var(--button-hover-textColor);
|
||||||
|
filter: var(--button-hover-filter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Left = styled.div`
|
||||||
|
${layoutMixins.flexColumn}
|
||||||
|
width: 100%;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Header = styled.header<{ hasSeparator?: boolean }>`
|
Styled.Header = styled.header<{ hasSeparator?: boolean }>`
|
||||||
${layoutMixins.spacedRow}
|
${layoutMixins.spacedRow}
|
||||||
|
padding: var(--panel-paddingY) var(--panel-paddingX);
|
||||||
padding: 0.875rem 1rem 0.625rem;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
|
|
||||||
${({ hasSeparator }) =>
|
${({ hasSeparator }) =>
|
||||||
hasSeparator &&
|
hasSeparator &&
|
||||||
css`
|
css`
|
||||||
|
padding-bottom: 0.625rem;
|
||||||
box-shadow: 0 var(--border-width) var(--border-color);
|
box-shadow: 0 var(--border-width) var(--border-color);
|
||||||
`}
|
`}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Icon = styled(Icon)`
|
Styled.Icon = styled(Icon)`
|
||||||
color: var(--color-text-0);
|
color: var(--color-text-0);
|
||||||
|
|
||||||
font-size: 0.625rem;
|
font-size: 0.625rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
@@ -86,6 +112,5 @@ Styled.Content = styled.div`
|
|||||||
${layoutMixins.scrollArea}
|
${layoutMixins.scrollArea}
|
||||||
${layoutMixins.stickyArea0}
|
${layoutMixins.stickyArea0}
|
||||||
--stickyArea0-background: transparent;
|
--stickyArea0-background: transparent;
|
||||||
|
padding: var(--panel-content-paddingY) var(--panel-content-paddingX);
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -13,7 +13,9 @@ import { ToggleButton } from '@/components/ToggleButton';
|
|||||||
type ElementProps<MenuItemValue extends string> = {
|
type ElementProps<MenuItemValue extends string> = {
|
||||||
items: MenuItem<MenuItemValue>[];
|
items: MenuItem<MenuItemValue>[];
|
||||||
value: MenuItemValue;
|
value: MenuItemValue;
|
||||||
onValueChange: (value: MenuItemValue) => void;
|
onValueChange: (value: any) => void;
|
||||||
|
onInteraction?: () => void;
|
||||||
|
ensureSelected?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
type StyleProps = {
|
type StyleProps = {
|
||||||
@@ -25,10 +27,14 @@ export const ToggleGroup = forwardRef(
|
|||||||
{
|
{
|
||||||
items,
|
items,
|
||||||
value,
|
value,
|
||||||
|
ensureSelected = true,
|
||||||
onValueChange,
|
onValueChange,
|
||||||
|
onInteraction,
|
||||||
|
|
||||||
className,
|
className,
|
||||||
size,
|
size,
|
||||||
shape = ButtonShape.Pill,
|
shape = ButtonShape.Pill,
|
||||||
|
|
||||||
...buttonProps
|
...buttonProps
|
||||||
}: ElementProps<MenuItemValue> & StyleProps & BaseButtonProps,
|
}: ElementProps<MenuItemValue> & StyleProps & BaseButtonProps,
|
||||||
ref: Ref<HTMLDivElement>
|
ref: Ref<HTMLDivElement>
|
||||||
@@ -40,12 +46,17 @@ export const ToggleGroup = forwardRef(
|
|||||||
ref={ref}
|
ref={ref}
|
||||||
type="single"
|
type="single"
|
||||||
value={value}
|
value={value}
|
||||||
onValueChange={onValueChange}
|
onValueChange={(newValue: MenuItemValue) => {
|
||||||
|
if ((ensureSelected && newValue) || !ensureSelected) {
|
||||||
|
onValueChange(newValue);
|
||||||
|
}
|
||||||
|
onInteraction?.();
|
||||||
|
}}
|
||||||
className={className}
|
className={className}
|
||||||
loop
|
loop
|
||||||
>
|
>
|
||||||
{items.map((item) => (
|
{items.map((item) => (
|
||||||
<Item key={item.value} value={item.value} aria-label={item.label} asChild>
|
<Item key={item.value} value={item.value} asChild>
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
size={size ? size : isTablet ? ButtonSize.Small : ButtonSize.XSmall}
|
size={size ? size : isTablet ? ButtonSize.Small : ButtonSize.XSmall}
|
||||||
shape={shape}
|
shape={shape}
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ import type { ReactNode } from 'react';
|
|||||||
import styled, { AnyStyledComponent } from 'styled-components';
|
import styled, { AnyStyledComponent } from 'styled-components';
|
||||||
import { Content, Portal, Provider, Root, Trigger, Arrow } from '@radix-ui/react-tooltip';
|
import { Content, Portal, Provider, Root, Trigger, Arrow } from '@radix-ui/react-tooltip';
|
||||||
|
|
||||||
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { tooltipStrings } from '@/constants/tooltips';
|
import { tooltipStrings } from '@/constants/tooltips';
|
||||||
|
|
||||||
import { useStringGetter } from '@/hooks';
|
import { useStringGetter, useURLConfigs } from '@/hooks';
|
||||||
|
|
||||||
import { Icon, IconName } from '@/components/Icon';
|
import { Icon, IconName } from '@/components/Icon';
|
||||||
|
import { Link } from '@/components/Link';
|
||||||
|
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
import { popoverMixins } from '@/styles/popoverMixins';
|
import { popoverMixins } from '@/styles/popoverMixins';
|
||||||
@@ -38,20 +40,24 @@ export const WithTooltip = ({
|
|||||||
slotTooltip,
|
slotTooltip,
|
||||||
}: ElementProps & StyleProps) => {
|
}: ElementProps & StyleProps) => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
|
const urlConfigs = useURLConfigs();
|
||||||
|
|
||||||
const getTooltipStrings = tooltip && tooltipStrings[tooltip];
|
const getTooltipStrings = tooltip && tooltipStrings[tooltip];
|
||||||
if (!getTooltipStrings && !tooltipString && !slotTooltip) return <>{children}</>;
|
if (!getTooltipStrings && !tooltipString && !slotTooltip) return <>{children}</>;
|
||||||
|
|
||||||
let tooltipTitle;
|
let tooltipTitle;
|
||||||
let tooltipBody;
|
let tooltipBody;
|
||||||
|
let tooltipLearnMore;
|
||||||
|
|
||||||
if (getTooltipStrings) {
|
if (getTooltipStrings) {
|
||||||
const { title, body } = getTooltipStrings({
|
const { title, body, learnMoreLink } = getTooltipStrings({
|
||||||
stringGetter,
|
stringGetter,
|
||||||
stringParams,
|
stringParams,
|
||||||
|
urlConfigs,
|
||||||
});
|
});
|
||||||
tooltipTitle = title;
|
tooltipTitle = title;
|
||||||
tooltipBody = body;
|
tooltipBody = body;
|
||||||
|
tooltipLearnMore = learnMoreLink;
|
||||||
} else {
|
} else {
|
||||||
tooltipBody = tooltipString;
|
tooltipBody = tooltipString;
|
||||||
}
|
}
|
||||||
@@ -72,6 +78,13 @@ export const WithTooltip = ({
|
|||||||
<dl>
|
<dl>
|
||||||
{tooltipTitle && <dt>{tooltipTitle}</dt>}
|
{tooltipTitle && <dt>{tooltipTitle}</dt>}
|
||||||
{tooltipBody && <dd>{tooltipBody}</dd>}
|
{tooltipBody && <dd>{tooltipBody}</dd>}
|
||||||
|
{tooltipLearnMore && (
|
||||||
|
<dd>
|
||||||
|
<Styled.LearnMore href={tooltipLearnMore}>
|
||||||
|
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} →
|
||||||
|
</Styled.LearnMore>
|
||||||
|
</dd>
|
||||||
|
)}
|
||||||
<Styled.Arrow />
|
<Styled.Arrow />
|
||||||
</dl>
|
</dl>
|
||||||
)}
|
)}
|
||||||
@@ -142,3 +155,7 @@ Styled.Arrow = styled(Arrow)`
|
|||||||
Styled.Icon = styled(Icon)`
|
Styled.Icon = styled(Icon)`
|
||||||
color: var(--color-text-0);
|
color: var(--color-text-0);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
Styled.LearnMore = styled(Link)`
|
||||||
|
--link-color: var(--color-accent);
|
||||||
|
`;
|
||||||
|
|||||||
@@ -59,16 +59,6 @@ export const TransactionType = Abacus.exchange.dydx.abacus.protocols.Transaction
|
|||||||
const transactionTypes = [...TransactionType.values()] as const;
|
const transactionTypes = [...TransactionType.values()] as const;
|
||||||
export type TransactionTypes = (typeof transactionTypes)[number];
|
export type TransactionTypes = (typeof transactionTypes)[number];
|
||||||
|
|
||||||
export type NetworkConfig = {
|
|
||||||
chainId: string;
|
|
||||||
indexerUrl: string;
|
|
||||||
indexerSocketUrl: string;
|
|
||||||
validatorUrl: string;
|
|
||||||
faucetUrl?: string | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type ConnectNetworkEvent = CustomEvent<Partial<NetworkConfig>>;
|
|
||||||
|
|
||||||
// ------ State ------
|
// ------ State ------
|
||||||
export type AbacusApiState = Abacus.exchange.dydx.abacus.state.manager.ApiState;
|
export type AbacusApiState = Abacus.exchange.dydx.abacus.state.manager.ApiState;
|
||||||
export const AbacusApiStatus = Abacus.exchange.dydx.abacus.state.manager.ApiStatus;
|
export const AbacusApiStatus = Abacus.exchange.dydx.abacus.state.manager.ApiStatus;
|
||||||
@@ -267,3 +257,20 @@ export const TRADE_TYPES: Record<
|
|||||||
[AbacusOrderType.liquidation.name]: null,
|
[AbacusOrderType.liquidation.name]: null,
|
||||||
[AbacusOrderType.trailingStop.name]: null,
|
[AbacusOrderType.trailingStop.name]: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Custom types involving Abacus
|
||||||
|
|
||||||
|
export type NetworkConfig = Partial<{
|
||||||
|
indexerUrl: Nullable<string>;
|
||||||
|
websocketUrl: Nullable<string>;
|
||||||
|
validatorUrl: Nullable<string>;
|
||||||
|
chainId: Nullable<string>;
|
||||||
|
faucetUrl: Nullable<string>;
|
||||||
|
USDC_DENOM: Nullable<string>;
|
||||||
|
USDC_DECIMALS: Nullable<number>;
|
||||||
|
USDC_GAS_DENOM: Nullable<string>;
|
||||||
|
CHAINTOKEN_DENOM: Nullable<string>;
|
||||||
|
CHAINTOKEN_DECIMALS: Nullable<number>;
|
||||||
|
}>;
|
||||||
|
|
||||||
|
export type ConnectNetworkEvent = CustomEvent<Partial<NetworkConfig>>;
|
||||||
|
|||||||
@@ -44,4 +44,4 @@ export type EvmDerivedAddresses = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AMOUNT_RESERVED_FOR_GAS_USDC = 100_000;
|
export const AMOUNT_RESERVED_FOR_GAS_USDC = 0.1;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import {
|
|||||||
WARNINGS_STRING_KEYS,
|
WARNINGS_STRING_KEYS,
|
||||||
} from '@dydxprotocol/v4-localization';
|
} from '@dydxprotocol/v4-localization';
|
||||||
|
|
||||||
|
import { type LinksConfigs } from '@/hooks/useURLConfigs';
|
||||||
|
|
||||||
export { TOOLTIP_STRING_KEYS } from '@dydxprotocol/v4-localization';
|
export { TOOLTIP_STRING_KEYS } from '@dydxprotocol/v4-localization';
|
||||||
|
|
||||||
export enum SupportedLocales {
|
export enum SupportedLocales {
|
||||||
@@ -79,9 +81,11 @@ export type TooltipStrings = {
|
|||||||
[key: string]: ({
|
[key: string]: ({
|
||||||
stringGetter,
|
stringGetter,
|
||||||
stringParams,
|
stringParams,
|
||||||
|
urlConfigs,
|
||||||
}: {
|
}: {
|
||||||
stringGetter: StringGetterFunction;
|
stringGetter: StringGetterFunction;
|
||||||
stringParams?: any;
|
stringParams?: any;
|
||||||
|
urlConfigs?: LinksConfigs;
|
||||||
}) => {
|
}) => {
|
||||||
title: string;
|
title: string;
|
||||||
body: string;
|
body: string;
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export type MenuItem<MenuItemValue, MenuItemTypes = string> = {
|
|||||||
value: MenuItemValue;
|
value: MenuItemValue;
|
||||||
|
|
||||||
slotBefore?: React.ReactNode;
|
slotBefore?: React.ReactNode;
|
||||||
label: string;
|
label: React.ReactNode;
|
||||||
labelRight?: React.ReactNode;
|
labelRight?: React.ReactNode;
|
||||||
tag?: React.ReactNode;
|
tag?: React.ReactNode;
|
||||||
slotAfter?: React.ReactNode;
|
slotAfter?: React.ReactNode;
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ export enum AppRoute {
|
|||||||
Profile = '/profile',
|
Profile = '/profile',
|
||||||
Alerts = '/alerts',
|
Alerts = '/alerts',
|
||||||
Settings = '/settings',
|
Settings = '/settings',
|
||||||
Rewards = '/DV4TNT',
|
Terms = '/terms',
|
||||||
|
Privacy = '/privacy',
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum PortfolioRoute {
|
export enum PortfolioRoute {
|
||||||
@@ -36,7 +37,3 @@ export const HISTORY_ROUTE = `${AppRoute.Portfolio}/${PortfolioRoute.History}/:s
|
|||||||
export const DEFAULT_TRADE_ROUTE = `${AppRoute.Trade}/${DEFAULT_MARKETID}`;
|
export const DEFAULT_TRADE_ROUTE = `${AppRoute.Trade}/${DEFAULT_MARKETID}`;
|
||||||
export const SETTINGS_ROUTE = `${AppRoute.Settings}/*`;
|
export const SETTINGS_ROUTE = `${AppRoute.Settings}/*`;
|
||||||
export const DEFAULT_DOCUMENT_TITLE = 'dYdX';
|
export const DEFAULT_DOCUMENT_TITLE = 'dYdX';
|
||||||
|
|
||||||
export enum ExternalLink {
|
|
||||||
Foundation = 'https://dydx.foundation',
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -57,10 +57,10 @@ export const tradeTooltips: TooltipStrings = {
|
|||||||
title: stringGetter({ key: TOOLTIP_STRING_KEYS.INDEX_PRICE_TITLE }),
|
title: stringGetter({ key: TOOLTIP_STRING_KEYS.INDEX_PRICE_TITLE }),
|
||||||
body: stringGetter({ key: TOOLTIP_STRING_KEYS.INDEX_PRICE_BODY }),
|
body: stringGetter({ key: TOOLTIP_STRING_KEYS.INDEX_PRICE_BODY }),
|
||||||
}),
|
}),
|
||||||
'initial-margin-fraction': ({ stringGetter }) => ({
|
'initial-margin-fraction': ({ stringGetter, urlConfigs }) => ({
|
||||||
title: stringGetter({ key: TOOLTIP_STRING_KEYS.INITIAL_MARGIN_FRACTION_TITLE }),
|
title: stringGetter({ key: TOOLTIP_STRING_KEYS.INITIAL_MARGIN_FRACTION_TITLE }),
|
||||||
body: stringGetter({ key: TOOLTIP_STRING_KEYS.INITIAL_MARGIN_FRACTION_BODY }),
|
body: stringGetter({ key: TOOLTIP_STRING_KEYS.INITIAL_MARGIN_FRACTION_BODY }),
|
||||||
learnMoreLink: 'https://help.dydx.exchange/articles/5232637-maximum-position-sizes',
|
learnMoreLink: urlConfigs?.initialMarginFractionLearnMore,
|
||||||
}),
|
}),
|
||||||
'initial-stop': ({ stringGetter }) => ({
|
'initial-stop': ({ stringGetter }) => ({
|
||||||
title: stringGetter({ key: TOOLTIP_STRING_KEYS.INITIAL_STOP_TITLE }),
|
title: stringGetter({ key: TOOLTIP_STRING_KEYS.INITIAL_STOP_TITLE }),
|
||||||
@@ -146,10 +146,10 @@ export const tradeTooltips: TooltipStrings = {
|
|||||||
title: stringGetter({ key: TOOLTIP_STRING_KEYS.REALIZED_PNL_TITLE }),
|
title: stringGetter({ key: TOOLTIP_STRING_KEYS.REALIZED_PNL_TITLE }),
|
||||||
body: stringGetter({ key: TOOLTIP_STRING_KEYS.REALIZED_PNL_BODY }),
|
body: stringGetter({ key: TOOLTIP_STRING_KEYS.REALIZED_PNL_BODY }),
|
||||||
}),
|
}),
|
||||||
'reduce-only': ({ stringGetter }) => ({
|
'reduce-only': ({ stringGetter, urlConfigs }) => ({
|
||||||
title: stringGetter({ key: TOOLTIP_STRING_KEYS.REDUCE_ONLY_TITLE }),
|
title: stringGetter({ key: TOOLTIP_STRING_KEYS.REDUCE_ONLY_TITLE }),
|
||||||
body: stringGetter({ key: TOOLTIP_STRING_KEYS.REDUCE_ONLY_BODY }),
|
body: stringGetter({ key: TOOLTIP_STRING_KEYS.REDUCE_ONLY_BODY }),
|
||||||
learnMoreLink: 'https://help.dydx.exchange/articles/6345793-reduce-only-orders',
|
learnMoreLink: urlConfigs?.reduceOnlyLearnMore,
|
||||||
}),
|
}),
|
||||||
spread: () => ({
|
spread: () => ({
|
||||||
title: 'Spread',
|
title: 'Spread',
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
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 onboarding } from '@dydxprotocol/v4-client-js';
|
||||||
import type { suggestChain } from 'graz';
|
import type { suggestChain } from 'graz';
|
||||||
|
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
@@ -352,15 +352,5 @@ export const DYDX_CHAIN_INFO: Parameters<typeof suggestChain>[0] = {
|
|||||||
// TODO: export this type from abacus instead
|
// TODO: export this type from abacus instead
|
||||||
export enum DydxChainAsset {
|
export enum DydxChainAsset {
|
||||||
USDC = 'usdc',
|
USDC = 'usdc',
|
||||||
DYDX = 'dydx',
|
CHAINTOKEN = 'chain',
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DYDX_CHAIN_ASSET_COIN_DENOM: Record<DydxChainAsset, string> = {
|
|
||||||
[DydxChainAsset.USDC]: USDC_DENOM,
|
|
||||||
[DydxChainAsset.DYDX]: DYDX_DENOM,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DYDX_CHAIN_ASSET_TAGS: Record<DydxChainAsset, string> = {
|
|
||||||
[DydxChainAsset.USDC]: 'USDC',
|
|
||||||
[DydxChainAsset.DYDX]: 'Dv4TNT',
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { useApiState } from './useApiState';
|
import { useApiState } from './useApiState';
|
||||||
import { useBreakpoints } from './useBreakpoints';
|
import { useBreakpoints } from './useBreakpoints';
|
||||||
|
import { useTokenConfigs } from './useTokenConfigs';
|
||||||
import { useCommandMenu } from './useCommandMenu';
|
import { useCommandMenu } from './useCommandMenu';
|
||||||
import { useCurrentMarketId } from './useCurrentMarketId';
|
import { useCurrentMarketId } from './useCurrentMarketId';
|
||||||
import { useDebounce } from './useDebounce';
|
import { useDebounce } from './useDebounce';
|
||||||
@@ -21,10 +22,12 @@ import { useShouldShowFooter } from './useShouldShowFooter';
|
|||||||
import { useSelectedNetwork } from './useSelectedNetwork';
|
import { useSelectedNetwork } from './useSelectedNetwork';
|
||||||
import { useStringGetter } from './useStringGetter';
|
import { useStringGetter } from './useStringGetter';
|
||||||
import { useSubaccount } from './useSubaccount';
|
import { useSubaccount } from './useSubaccount';
|
||||||
|
import { useURLConfigs } from './useURLConfigs';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
useApiState,
|
useApiState,
|
||||||
useBreakpoints,
|
useBreakpoints,
|
||||||
|
useTokenConfigs,
|
||||||
useCommandMenu,
|
useCommandMenu,
|
||||||
useCurrentMarketId,
|
useCurrentMarketId,
|
||||||
useDebounce,
|
useDebounce,
|
||||||
@@ -46,4 +49,5 @@ export {
|
|||||||
useSelectedNetwork,
|
useSelectedNetwork,
|
||||||
useStringGetter,
|
useStringGetter,
|
||||||
useSubaccount,
|
useSubaccount,
|
||||||
|
useURLConfigs,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export const useTradingView = ({
|
|||||||
const marketIds = useSelector(getMarketIds, shallowEqual);
|
const marketIds = useSelector(getMarketIds, shallowEqual);
|
||||||
const selectedLocale = useSelector(getSelectedLocale);
|
const selectedLocale = useSelector(getSelectedLocale);
|
||||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||||
const { getCandlesForDatafeed } = useDydxClient();
|
const { getCandlesForDatafeed, isConnected: isClientConnected } = useDydxClient();
|
||||||
|
|
||||||
const [savedTvChartConfig, setTvChartConfig] = useLocalStorage<object | undefined>({
|
const [savedTvChartConfig, setTvChartConfig] = useLocalStorage<object | undefined>({
|
||||||
key: LocalStorageKey.TradingViewChartConfig,
|
key: LocalStorageKey.TradingViewChartConfig,
|
||||||
@@ -44,7 +44,7 @@ export const useTradingView = ({
|
|||||||
const hasMarkets = marketIds.length > 0;
|
const hasMarkets = marketIds.length > 0;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (hasMarkets) {
|
if (hasMarkets && isClientConnected && marketId) {
|
||||||
const widgetOptions = getWidgetOptions();
|
const widgetOptions = getWidgetOptions();
|
||||||
const widgetOverrides = getWidgetOverrides(appTheme);
|
const widgetOverrides = getWidgetOverrides(appTheme);
|
||||||
const options = {
|
const options = {
|
||||||
@@ -75,7 +75,7 @@ export const useTradingView = ({
|
|||||||
tvWidgetRef.current = null;
|
tvWidgetRef.current = null;
|
||||||
setIsChartReady(false);
|
setIsChartReady(false);
|
||||||
};
|
};
|
||||||
}, [getCandlesForDatafeed, hasMarkets, selectedLocale, selectedNetwork]);
|
}, [getCandlesForDatafeed, isClientConnected, hasMarkets, selectedLocale, selectedNetwork, !!marketId]);
|
||||||
|
|
||||||
return { savedResolution };
|
return { savedResolution };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,10 +5,7 @@ import { StargateClient } from '@cosmjs/stargate';
|
|||||||
import { useQuery } from 'react-query';
|
import { useQuery } from 'react-query';
|
||||||
import { formatUnits } from 'viem';
|
import { formatUnits } from 'viem';
|
||||||
|
|
||||||
import { USDC_DENOM, DYDX_DENOM } from '@dydxprotocol/v4-client-js';
|
|
||||||
|
|
||||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||||
import { QUANTUM_MULTIPLIER } from '@/constants/numbers';
|
|
||||||
import { EvmAddress } from '@/constants/wallets';
|
import { EvmAddress } from '@/constants/wallets';
|
||||||
|
|
||||||
import { convertBech32Address } from '@/lib/addressUtils';
|
import { convertBech32Address } from '@/lib/addressUtils';
|
||||||
@@ -18,11 +15,11 @@ import { getBalances, getStakingBalances } from '@/state/accountSelectors';
|
|||||||
import { getSelectedNetwork } from '@/state/appSelectors';
|
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||||
|
|
||||||
import { useAccounts } from './useAccounts';
|
import { useAccounts } from './useAccounts';
|
||||||
|
import { useTokenConfigs } from './useTokenConfigs';
|
||||||
|
|
||||||
type UseAccountBalanceProps = {
|
type UseAccountBalanceProps = {
|
||||||
// Token Items
|
// Token Items
|
||||||
addressOrDenom?: string;
|
addressOrDenom?: string;
|
||||||
assetSymbol?: string;
|
|
||||||
decimals?: number;
|
decimals?: number;
|
||||||
|
|
||||||
// Chain Items
|
// Chain Items
|
||||||
@@ -41,7 +38,6 @@ export const CHAIN_DEFAULT_TOKEN_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeee
|
|||||||
|
|
||||||
export const useAccountBalance = ({
|
export const useAccountBalance = ({
|
||||||
addressOrDenom,
|
addressOrDenom,
|
||||||
assetSymbol,
|
|
||||||
bech32AddrPrefix,
|
bech32AddrPrefix,
|
||||||
chainId,
|
chainId,
|
||||||
decimals = 0,
|
decimals = 0,
|
||||||
@@ -52,6 +48,7 @@ export const useAccountBalance = ({
|
|||||||
|
|
||||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||||
const balances = useSelector(getBalances, shallowEqual);
|
const balances = useSelector(getBalances, shallowEqual);
|
||||||
|
const { chainTokenDenom, usdcDenom } = useTokenConfigs();
|
||||||
const evmChainId = Number(ENVIRONMENT_CONFIG_MAP[selectedNetwork].ethereumChainId);
|
const evmChainId = Number(ENVIRONMENT_CONFIG_MAP[selectedNetwork].ethereumChainId);
|
||||||
const stakingBalances = useSelector(getStakingBalances, shallowEqual);
|
const stakingBalances = useSelector(getStakingBalances, shallowEqual);
|
||||||
|
|
||||||
@@ -91,20 +88,16 @@ export const useAccountBalance = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const { formatted: evmBalance } = evmQuery.data || {};
|
const { formatted: evmBalance } = evmQuery.data || {};
|
||||||
const balance = !assetSymbol ? '0' : isCosmosChain ? cosmosQuery.data : evmBalance;
|
const balance = isCosmosChain ? cosmosQuery.data : evmBalance;
|
||||||
|
|
||||||
const nativeTokenCoinBalance = balances?.[DYDX_DENOM];
|
const nativeTokenCoinBalance = balances?.[chainTokenDenom];
|
||||||
const nativeTokenBalance = MustBigNumber(nativeTokenCoinBalance?.amount)
|
const nativeTokenBalance = MustBigNumber(nativeTokenCoinBalance?.amount);
|
||||||
.div(QUANTUM_MULTIPLIER)
|
|
||||||
.toNumber();
|
|
||||||
|
|
||||||
const usdcCoinBalance = balances?.[USDC_DENOM];
|
const usdcCoinBalance = balances?.[usdcDenom];
|
||||||
const usdcBalance = MustBigNumber(usdcCoinBalance?.amount).div(QUANTUM_MULTIPLIER).toNumber();
|
const usdcBalance = MustBigNumber(usdcCoinBalance?.amount).toNumber();
|
||||||
|
|
||||||
const nativeStakingCoinBalanace = stakingBalances?.[DYDX_DENOM];
|
const nativeStakingCoinBalanace = stakingBalances?.[chainTokenDenom];
|
||||||
const nativeStakingBalance = MustBigNumber(nativeStakingCoinBalanace?.amount)
|
const nativeStakingBalance = MustBigNumber(nativeStakingCoinBalanace?.amount).toNumber();
|
||||||
.div(QUANTUM_MULTIPLIER)
|
|
||||||
.toNumber();
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
balance,
|
balance,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { useCallback, useContext, createContext, useEffect, useState, useMemo }
|
|||||||
|
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
import { AES, enc } from 'crypto-js';
|
import { AES, enc } from 'crypto-js';
|
||||||
import { LocalWallet, USDC_DENOM, type Subaccount } from '@dydxprotocol/v4-client-js';
|
import { LocalWallet, type Subaccount } from '@dydxprotocol/v4-client-js';
|
||||||
|
|
||||||
import { OnboardingGuard, OnboardingState, type EvmDerivedAddresses } from '@/constants/account';
|
import { OnboardingGuard, OnboardingState, type EvmDerivedAddresses } from '@/constants/account';
|
||||||
import { DialogTypes } from '@/constants/dialogs';
|
import { DialogTypes } from '@/constants/dialogs';
|
||||||
@@ -130,16 +130,8 @@ const useAccountsContext = () => {
|
|||||||
// dYdX subaccounts
|
// dYdX subaccounts
|
||||||
const [dydxSubaccounts, setDydxSubaccounts] = useState<Subaccount[] | undefined>();
|
const [dydxSubaccounts, setDydxSubaccounts] = useState<Subaccount[] | undefined>();
|
||||||
|
|
||||||
const { getAccountBalance, getSubaccounts } = useMemo(
|
const { getSubaccounts } = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
getAccountBalance: async ({
|
|
||||||
dydxAddress,
|
|
||||||
denom = USDC_DENOM,
|
|
||||||
}: {
|
|
||||||
dydxAddress: DydxAddress;
|
|
||||||
denom?: string;
|
|
||||||
}) => await compositeClient?.validatorClient.get.getAccountBalance(dydxAddress, denom),
|
|
||||||
|
|
||||||
getSubaccounts: async ({ dydxAddress }: { dydxAddress: DydxAddress }) => {
|
getSubaccounts: async ({ dydxAddress }: { dydxAddress: DydxAddress }) => {
|
||||||
try {
|
try {
|
||||||
const response = await compositeClient?.indexerClient.account.getSubaccounts(dydxAddress);
|
const response = await compositeClient?.indexerClient.account.getSubaccounts(dydxAddress);
|
||||||
@@ -326,7 +318,6 @@ const useAccountsContext = () => {
|
|||||||
disconnect,
|
disconnect,
|
||||||
|
|
||||||
// dydxClient Account methods
|
// dydxClient Account methods
|
||||||
getAccountBalance,
|
|
||||||
getSubaccounts,
|
getSubaccounts,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ export const useCurrentMarketId = () => {
|
|||||||
}, [validId]);
|
}, [validId]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// Check for marketIds otherwise Abacus will silently fail its isMarketValid check
|
||||||
|
if (marketIds) {
|
||||||
abacusStateManager.setMarket(marketId ?? DEFAULT_MARKETID);
|
abacusStateManager.setMarket(marketId ?? DEFAULT_MARKETID);
|
||||||
}, [selectedNetwork, marketId]);
|
}
|
||||||
|
}, [selectedNetwork, marketIds, marketId]);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,8 +13,10 @@ import {
|
|||||||
|
|
||||||
import type { ResolutionString } from 'public/tradingview/charting_library';
|
import type { ResolutionString } from 'public/tradingview/charting_library';
|
||||||
|
|
||||||
import type { NetworkConfig, ConnectNetworkEvent } from '@/constants/abacus';
|
import type { ConnectNetworkEvent, NetworkConfig } from '@/constants/abacus';
|
||||||
import { type Candle, RESOLUTION_MAP } from '@/constants/candles';
|
import { type Candle, RESOLUTION_MAP } from '@/constants/candles';
|
||||||
|
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||||
|
import { DydxChainAsset } from '@/constants/wallets';
|
||||||
|
|
||||||
import { getSelectedNetwork } from '@/state/appSelectors';
|
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||||
|
|
||||||
@@ -36,8 +38,9 @@ const useDydxClientContext = () => {
|
|||||||
// ------ Network ------ //
|
// ------ Network ------ //
|
||||||
|
|
||||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||||
|
const tokensConfigs = ENVIRONMENT_CONFIG_MAP[selectedNetwork].tokens;
|
||||||
|
|
||||||
const [networkConfig, setNetworkConfig] = useState<Partial<NetworkConfig>>();
|
const [networkConfig, setNetworkConfig] = useState<NetworkConfig>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onConnectNetwork = (event: ConnectNetworkEvent) => setNetworkConfig(event.detail);
|
const onConnectNetwork = (event: ConnectNetworkEvent) => setNetworkConfig(event.detail);
|
||||||
@@ -57,15 +60,22 @@ const useDydxClientContext = () => {
|
|||||||
if (
|
if (
|
||||||
networkConfig?.chainId &&
|
networkConfig?.chainId &&
|
||||||
networkConfig?.indexerUrl &&
|
networkConfig?.indexerUrl &&
|
||||||
networkConfig?.indexerSocketUrl &&
|
networkConfig?.websocketUrl &&
|
||||||
networkConfig?.validatorUrl
|
networkConfig?.validatorUrl
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
const initializedClient = await CompositeClient.connect(
|
const initializedClient = await CompositeClient.connect(
|
||||||
new Network(
|
new Network(
|
||||||
selectedNetwork,
|
selectedNetwork,
|
||||||
new IndexerConfig(networkConfig.indexerUrl, networkConfig.indexerSocketUrl),
|
new IndexerConfig(networkConfig.indexerUrl, networkConfig.websocketUrl),
|
||||||
new ValidatorConfig(networkConfig.validatorUrl, networkConfig.chainId, {
|
new ValidatorConfig(networkConfig.validatorUrl, networkConfig.chainId,
|
||||||
|
{
|
||||||
|
USDC_DENOM: tokensConfigs[DydxChainAsset.USDC].denom,
|
||||||
|
USDC_DECIMALS: tokensConfigs[DydxChainAsset.USDC].decimals,
|
||||||
|
USDC_GAS_DENOM: tokensConfigs[DydxChainAsset.USDC].gasDenom,
|
||||||
|
CHAINTOKEN_DENOM: tokensConfigs[DydxChainAsset.CHAINTOKEN].denom,
|
||||||
|
CHAINTOKEN_DECIMALS: tokensConfigs[DydxChainAsset.CHAINTOKEN].decimals,
|
||||||
|
}, {
|
||||||
broadcastPollIntervalMs: 3_000,
|
broadcastPollIntervalMs: 3_000,
|
||||||
broadcastTimeoutMs: 60_000,
|
broadcastTimeoutMs: 60_000,
|
||||||
})
|
})
|
||||||
@@ -209,6 +219,7 @@ const useDydxClientContext = () => {
|
|||||||
networkConfig,
|
networkConfig,
|
||||||
compositeClient,
|
compositeClient,
|
||||||
faucetClient,
|
faucetClient,
|
||||||
|
isConnected: !!compositeClient,
|
||||||
|
|
||||||
// Wallet Methods
|
// Wallet Methods
|
||||||
getWalletFromEvmSignature,
|
getWalletFromEvmSignature,
|
||||||
|
|||||||
@@ -6,8 +6,10 @@ import { MarketFilters, MARKET_FILTER_LABELS, type MarketData } from '@/constant
|
|||||||
import { getAssets } from '@/state/assetsSelectors';
|
import { getAssets } from '@/state/assetsSelectors';
|
||||||
import { getPerpetualMarkets } from '@/state/perpetualsSelectors';
|
import { getPerpetualMarkets } from '@/state/perpetualsSelectors';
|
||||||
|
|
||||||
|
import { isTruthy } from '@/lib/isTruthy';
|
||||||
|
|
||||||
const filterFunctions = {
|
const filterFunctions = {
|
||||||
[MarketFilters.ALL]: (market: MarketData) => true,
|
[MarketFilters.ALL]: () => true,
|
||||||
[MarketFilters.LAYER_1]: (market: MarketData) => {
|
[MarketFilters.LAYER_1]: (market: MarketData) => {
|
||||||
return market.asset.tags?.toArray().includes('Layer 1');
|
return market.asset.tags?.toArray().includes('Layer 1');
|
||||||
},
|
},
|
||||||
@@ -28,7 +30,9 @@ export const useMarketsData = (
|
|||||||
const allAssets = useSelector(getAssets, shallowEqual) || {};
|
const allAssets = useSelector(getAssets, shallowEqual) || {};
|
||||||
|
|
||||||
const markets = useMemo(() => {
|
const markets = useMemo(() => {
|
||||||
return Object.values(allPerpetualMarkets).map((marketData) => ({
|
return Object.values(allPerpetualMarkets)
|
||||||
|
.filter(isTruthy)
|
||||||
|
.map((marketData) => ({
|
||||||
asset: allAssets[marketData.assetId],
|
asset: allAssets[marketData.assetId],
|
||||||
tickSizeDecimals: marketData.configs?.tickSizeDecimals,
|
tickSizeDecimals: marketData.configs?.tickSizeDecimals,
|
||||||
...marketData,
|
...marketData,
|
||||||
|
|||||||
@@ -4,15 +4,14 @@ import { useSelector, shallowEqual, useDispatch } from 'react-redux';
|
|||||||
import { groupBy } from 'lodash';
|
import { groupBy } from 'lodash';
|
||||||
|
|
||||||
import { AlertType } from '@/constants/alerts';
|
import { AlertType } from '@/constants/alerts';
|
||||||
import { AbacusOrderStatus, ORDER_SIDES, ORDER_STATUS_STRINGS } from '@/constants/abacus';
|
import { AbacusOrderStatus, ORDER_SIDES } from '@/constants/abacus';
|
||||||
import { DialogTypes } from '@/constants/dialogs';
|
import { DialogTypes } from '@/constants/dialogs';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS, StringKey } 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 { AlertMessage } from '@/components/AlertMessage';
|
|
||||||
import { Icon, IconName } from '@/components/Icon';
|
import { Icon, IconName } from '@/components/Icon';
|
||||||
import { Output, OutputType } from '@/components/Output';
|
import { Output, OutputType } from '@/components/Output';
|
||||||
import { TransferStatusToast } from '@/views/TransferStatus';
|
import { TransferStatusToast } from '@/views/TransferStatus';
|
||||||
@@ -69,11 +68,11 @@ export const notificationTypes = [
|
|||||||
<OrderStatusIcon status={order.status} totalFilled={order.totalFilled ?? 0} />
|
<OrderStatusIcon status={order.status} totalFilled={order.totalFilled ?? 0} />
|
||||||
),
|
),
|
||||||
title: `${stringGetter({
|
title: `${stringGetter({
|
||||||
key: TRADE_TYPE_STRINGS[order.type.rawValue as TradeTypes].tradeTypeKey,
|
key: order.resources.typeStringKey as StringKey,
|
||||||
})} ${
|
})} ${
|
||||||
order.status === AbacusOrderStatus.open && (order?.totalFilled ?? 0) > 0
|
order.status === AbacusOrderStatus.open && (order?.totalFilled ?? 0) > 0
|
||||||
? stringGetter({ key: STRING_KEYS.PARTIALLY_FILLED })
|
? stringGetter({ key: STRING_KEYS.PARTIALLY_FILLED })
|
||||||
: stringGetter({ key: ORDER_STATUS_STRINGS[order.status.name] })
|
: stringGetter({ key: order.resources.statusStringKey as StringKey })
|
||||||
}`,
|
}`,
|
||||||
description: `${stringGetter({
|
description: `${stringGetter({
|
||||||
key: ORDER_SIDE_STRINGS[ORDER_SIDES[order.side.name]],
|
key: ORDER_SIDE_STRINGS[ORDER_SIDES[order.side.name]],
|
||||||
@@ -91,18 +90,34 @@ export const notificationTypes = [
|
|||||||
}, [orderIds]);
|
}, [orderIds]);
|
||||||
},
|
},
|
||||||
|
|
||||||
useNotificationAction: () => {
|
// useNotificationAction: () => {
|
||||||
const dispatch = useDispatch();
|
// const dispatch = useDispatch();
|
||||||
|
// const orders = useSelector(getSubaccountOrders, shallowEqual) || [];
|
||||||
|
// const ordersByOrderId = Object.fromEntries(orders.map((order) => [order.id, order]));
|
||||||
|
|
||||||
return (orderId) => {
|
// const fills = useSelector(getSubaccountFills, shallowEqual) || [];
|
||||||
dispatch(
|
// const fillsByOrderId = groupBy(fills, (fill) => fill.orderId);
|
||||||
openDialog({
|
|
||||||
type: DialogTypes.OrderDetails,
|
// return (id) => {
|
||||||
dialogProps: { orderId },
|
// if (ordersByOrderId[id]) {
|
||||||
})
|
// dispatch(
|
||||||
);
|
// openDialog({
|
||||||
};
|
// type: DialogTypes.OrderDetails,
|
||||||
},
|
// dialogProps: { orderId: id },
|
||||||
|
// })
|
||||||
|
// );
|
||||||
|
// } else if (fillsByOrderId[id]) {
|
||||||
|
// const fillId = fillsByOrderId[id][0].id;
|
||||||
|
|
||||||
|
// dispatch(
|
||||||
|
// openDialog({
|
||||||
|
// type: DialogTypes.FillDetails,
|
||||||
|
// dialogProps: { fillId },
|
||||||
|
// })
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// };
|
||||||
|
// },
|
||||||
} as NotificationTypeConfig<string, [string, number]>,
|
} as NotificationTypeConfig<string, [string, number]>,
|
||||||
{
|
{
|
||||||
type: NotificationType.SquidTransfer,
|
type: NotificationType.SquidTransfer,
|
||||||
@@ -138,7 +153,8 @@ export const notificationTypes = [
|
|||||||
{stringGetter({
|
{stringGetter({
|
||||||
key: STRING_KEYS.SOMETHING_WENT_WRONG_WITH_MESSAGE,
|
key: STRING_KEYS.SOMETHING_WENT_WRONG_WITH_MESSAGE,
|
||||||
params: {
|
params: {
|
||||||
ERROR_MESSAGE: error.message || stringGetter({ key: STRING_KEYS.UNKNOWN_ERROR }),
|
ERROR_MESSAGE:
|
||||||
|
error.message || stringGetter({ key: STRING_KEYS.UNKNOWN_ERROR }),
|
||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
</Styled.ErrorMessage>
|
</Styled.ErrorMessage>
|
||||||
@@ -182,7 +198,7 @@ Styled.TransferText = styled.span`
|
|||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.5ch;
|
gap: 0.5ch;
|
||||||
`
|
`;
|
||||||
|
|
||||||
Styled.ErrorMessage = styled.div`
|
Styled.ErrorMessage = styled.div`
|
||||||
max-width: 13rem;
|
max-width: 13rem;
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
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 { DEFAULT_APP_ENVIRONMENT, DydxNetwork, ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
import { DEFAULT_APP_ENVIRONMENT, DydxNetwork, ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||||
|
|
||||||
@@ -9,7 +8,6 @@ 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';
|
|
||||||
|
|
||||||
import { validateAgainstAvailableEnvironments } from '@/lib/network';
|
import { validateAgainstAvailableEnvironments } from '@/lib/network';
|
||||||
|
|
||||||
@@ -27,17 +25,6 @@ export const useSelectedNetwork = (): {
|
|||||||
validateFn: validateAgainstAvailableEnvironments,
|
validateFn: validateAgainstAvailableEnvironments,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (
|
|
||||||
import.meta.env.MODE === 'production' &&
|
|
||||||
ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId === 'dydx-testnet-4'
|
|
||||||
) {
|
|
||||||
dispatch(
|
|
||||||
openDialog({ type: DialogTypes.ExchangeOffline, dialogProps: { preventClose: true } })
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}, [selectedNetwork]);
|
|
||||||
|
|
||||||
const switchNetwork = useCallback(
|
const switchNetwork = useCallback(
|
||||||
(network: DydxNetwork) => {
|
(network: DydxNetwork) => {
|
||||||
disconnect();
|
disconnect();
|
||||||
|
|||||||
@@ -22,7 +22,11 @@ const useSquidContext = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const squid = useMemo(
|
const squid = useMemo(
|
||||||
() => new Squid({ baseUrl: ENVIRONMENT_CONFIG_MAP[selectedNetwork]?.endpoints['0xsquid'] }),
|
() =>
|
||||||
|
new Squid({
|
||||||
|
baseUrl: ENVIRONMENT_CONFIG_MAP[selectedNetwork]?.endpoints['0xsquid'],
|
||||||
|
integratorId: ENVIRONMENT_CONFIG_MAP[selectedNetwork]?.squidIntegratorId,
|
||||||
|
}),
|
||||||
[selectedNetwork]
|
[selectedNetwork]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -3,15 +3,10 @@ import { shallowEqual, useSelector, useDispatch } from 'react-redux';
|
|||||||
import type { Nullable } from '@dydxprotocol/v4-abacus';
|
import type { Nullable } from '@dydxprotocol/v4-abacus';
|
||||||
import Long from 'long';
|
import Long from 'long';
|
||||||
import type { IndexedTx } from '@cosmjs/stargate';
|
import type { IndexedTx } from '@cosmjs/stargate';
|
||||||
import type { EncodeObject, Coin } from '@cosmjs/proto-signing';
|
import type { EncodeObject } from '@cosmjs/proto-signing';
|
||||||
import { Method } from '@cosmjs/tendermint-rpc';
|
import { Method } from '@cosmjs/tendermint-rpc';
|
||||||
|
|
||||||
import {
|
import { type LocalWallet, SubaccountClient } from '@dydxprotocol/v4-client-js';
|
||||||
type LocalWallet,
|
|
||||||
SubaccountClient,
|
|
||||||
DYDX_DENOM,
|
|
||||||
USDC_DENOM,
|
|
||||||
} from '@dydxprotocol/v4-client-js';
|
|
||||||
|
|
||||||
import type {
|
import type {
|
||||||
AccountBalance,
|
AccountBalance,
|
||||||
@@ -34,6 +29,7 @@ import { MustBigNumber } from '@/lib/numbers';
|
|||||||
import { log } from '@/lib/telemetry';
|
import { log } from '@/lib/telemetry';
|
||||||
|
|
||||||
import { useAccounts } from './useAccounts';
|
import { useAccounts } from './useAccounts';
|
||||||
|
import { useTokenConfigs } from './useTokenConfigs';
|
||||||
import { useDydxClient } from './useDydxClient';
|
import { useDydxClient } from './useDydxClient';
|
||||||
|
|
||||||
type SubaccountContextType = ReturnType<typeof useSubaccountContext>;
|
type SubaccountContextType = ReturnType<typeof useSubaccountContext>;
|
||||||
@@ -52,6 +48,7 @@ export const useSubaccount = () => useContext(SubaccountContext);
|
|||||||
|
|
||||||
export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: LocalWallet }) => {
|
export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: LocalWallet }) => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const { usdcDenom, usdcDecimals } = useTokenConfigs();
|
||||||
const { compositeClient, faucetClient } = useDydxClient();
|
const { compositeClient, faucetClient } = useDydxClient();
|
||||||
|
|
||||||
const { getFaucetFunds } = useMemo(
|
const { getFaucetFunds } = useMemo(
|
||||||
@@ -77,22 +74,39 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
() => ({
|
() => ({
|
||||||
depositToSubaccount: async ({
|
depositToSubaccount: async ({
|
||||||
subaccountClient,
|
subaccountClient,
|
||||||
assetId = 0,
|
|
||||||
amount,
|
amount,
|
||||||
}: {
|
}: {
|
||||||
subaccountClient: SubaccountClient;
|
subaccountClient: SubaccountClient;
|
||||||
assetId?: number;
|
assetId?: number;
|
||||||
amount: Long;
|
amount: number;
|
||||||
}) => await compositeClient?.validatorClient.post.deposit(subaccountClient, assetId, amount),
|
}) => {
|
||||||
|
try {
|
||||||
|
return await compositeClient?.depositToSubaccount(
|
||||||
|
subaccountClient,
|
||||||
|
amount.toFixed(usdcDecimals)
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
log('useSubaccount/depositToSubaccount', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
},
|
||||||
withdrawFromSubaccount: async ({
|
withdrawFromSubaccount: async ({
|
||||||
subaccountClient,
|
subaccountClient,
|
||||||
amount,
|
amount,
|
||||||
}: {
|
}: {
|
||||||
subaccountClient: SubaccountClient;
|
subaccountClient: SubaccountClient;
|
||||||
amount: number;
|
amount: number;
|
||||||
}) => await compositeClient?.withdrawFromSubaccount(subaccountClient, amount),
|
}) => {
|
||||||
|
try {
|
||||||
|
return await compositeClient?.withdrawFromSubaccount(
|
||||||
|
subaccountClient,
|
||||||
|
amount.toFixed(usdcDecimals)
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
log('useSubaccount/withdrawFromSubaccount', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
},
|
||||||
transferFromSubaccountToAddress: async ({
|
transferFromSubaccountToAddress: async ({
|
||||||
subaccountClient,
|
subaccountClient,
|
||||||
assetId = 0,
|
assetId = 0,
|
||||||
@@ -103,8 +117,9 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
assetId?: number;
|
assetId?: number;
|
||||||
amount: number;
|
amount: number;
|
||||||
recipient: string;
|
recipient: string;
|
||||||
}) =>
|
}) => {
|
||||||
await compositeClient?.validatorClient.post.send(
|
try {
|
||||||
|
return await compositeClient?.validatorClient.post.send(
|
||||||
subaccountClient?.wallet,
|
subaccountClient?.wallet,
|
||||||
() =>
|
() =>
|
||||||
new Promise((resolve) => {
|
new Promise((resolve) => {
|
||||||
@@ -123,7 +138,12 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
undefined,
|
undefined,
|
||||||
undefined,
|
undefined,
|
||||||
Method.BroadcastTxCommit
|
Method.BroadcastTxCommit
|
||||||
),
|
);
|
||||||
|
} catch (error) {
|
||||||
|
log('useSubaccount/transferFromSubaccountToAddress', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
transferNativeToken: async ({
|
transferNativeToken: async ({
|
||||||
subaccountClient,
|
subaccountClient,
|
||||||
@@ -133,15 +153,30 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
subaccountClient: SubaccountClient;
|
subaccountClient: SubaccountClient;
|
||||||
amount: number;
|
amount: number;
|
||||||
recipient: string;
|
recipient: string;
|
||||||
}) =>
|
}) => {
|
||||||
await compositeClient?.validatorClient.post.sendToken(
|
try {
|
||||||
subaccountClient,
|
return await compositeClient?.validatorClient.post.send(
|
||||||
recipient,
|
subaccountClient.wallet,
|
||||||
DYDX_DENOM,
|
() =>
|
||||||
Long.fromNumber(amount * QUANTUM_MULTIPLIER),
|
new Promise((resolve) => {
|
||||||
|
const msg = compositeClient?.sendTokenMessage(
|
||||||
|
subaccountClient.wallet,
|
||||||
|
amount.toString(),
|
||||||
|
recipient
|
||||||
|
);
|
||||||
|
|
||||||
|
resolve([msg]);
|
||||||
|
}),
|
||||||
false,
|
false,
|
||||||
|
compositeClient?.validatorClient?.post.defaultDydxGasPrice,
|
||||||
|
undefined,
|
||||||
Method.BroadcastTxCommit
|
Method.BroadcastTxCommit
|
||||||
),
|
);
|
||||||
|
} catch (error) {
|
||||||
|
log('useSubaccount/transferNativeToken', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
sendSquidWithdrawFromSubaccount: async ({
|
sendSquidWithdrawFromSubaccount: async ({
|
||||||
subaccountClient,
|
subaccountClient,
|
||||||
@@ -153,10 +188,13 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
payload: string;
|
payload: string;
|
||||||
}) => {
|
}) => {
|
||||||
if (!compositeClient) throw new Error('client not initialized');
|
if (!compositeClient) throw new Error('client not initialized');
|
||||||
|
try {
|
||||||
const transaction = JSON.parse(payload);
|
const transaction = JSON.parse(payload);
|
||||||
|
|
||||||
const msg = compositeClient.withdrawFromSubaccountMessage(subaccountClient, amount);
|
const msg = compositeClient.withdrawFromSubaccountMessage(
|
||||||
|
subaccountClient,
|
||||||
|
amount.toFixed(usdcDecimals)
|
||||||
|
);
|
||||||
const ibcMsg: EncodeObject = {
|
const ibcMsg: EncodeObject = {
|
||||||
typeUrl: transaction.msgTypeUrl,
|
typeUrl: transaction.msgTypeUrl,
|
||||||
value: transaction.msg,
|
value: transaction.msg,
|
||||||
@@ -167,6 +205,10 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
() => Promise.resolve([msg, ibcMsg]),
|
() => Promise.resolve([msg, ibcMsg]),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
} catch (error) {
|
||||||
|
log('useSubaccount/sendSquidWithdrawFromSubaccount', error);
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
[compositeClient]
|
[compositeClient]
|
||||||
@@ -195,13 +237,9 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
async (balance: AccountBalance) => {
|
async (balance: AccountBalance) => {
|
||||||
if (!localDydxWallet) return;
|
if (!localDydxWallet) return;
|
||||||
|
|
||||||
const amountAfterDust = MustBigNumber(balance.amount)
|
const amount = parseFloat(balance.amount) - AMOUNT_RESERVED_FOR_GAS_USDC;
|
||||||
.minus(AMOUNT_RESERVED_FOR_GAS_USDC) // keep 0.1 USDC in user's wallet for gas
|
|
||||||
.toString();
|
|
||||||
|
|
||||||
const amount = Long.fromString(amountAfterDust || '0');
|
if (amount > 0) {
|
||||||
|
|
||||||
if (amount.greaterThan(Long.ZERO)) {
|
|
||||||
const subaccountClient = new SubaccountClient(localDydxWallet, 0);
|
const subaccountClient = new SubaccountClient(localDydxWallet, 0);
|
||||||
await depositToSubaccount({ amount, subaccountClient });
|
await depositToSubaccount({ amount, subaccountClient });
|
||||||
}
|
}
|
||||||
@@ -210,7 +248,7 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
);
|
);
|
||||||
|
|
||||||
const balances = useSelector(getBalances, shallowEqual);
|
const balances = useSelector(getBalances, shallowEqual);
|
||||||
const usdcCoinBalance = balances?.[USDC_DENOM];
|
const usdcCoinBalance = balances?.[usdcDenom];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (usdcCoinBalance) {
|
if (usdcCoinBalance) {
|
||||||
@@ -219,7 +257,7 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
}, [usdcCoinBalance]);
|
}, [usdcCoinBalance]);
|
||||||
|
|
||||||
const deposit = useCallback(
|
const deposit = useCallback(
|
||||||
async (amount: Long) => {
|
async (amount: number) => {
|
||||||
if (!subaccountClient) {
|
if (!subaccountClient) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -247,8 +285,7 @@ export const useSubaccountContext = ({ localDydxWallet }: { localDydxWallet?: Lo
|
|||||||
if (!subaccountClient) {
|
if (!subaccountClient) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
return (await (coinDenom === usdcDenom
|
||||||
return (await (coinDenom === USDC_DENOM
|
|
||||||
? transferFromSubaccountToAddress
|
? transferFromSubaccountToAddress
|
||||||
: transferNativeToken)({ subaccountClient, amount, recipient })) as IndexedTx;
|
: transferNativeToken)({ subaccountClient, amount, recipient })) as IndexedTx;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||||
|
import { DydxChainAsset } from '@/constants/wallets';
|
||||||
|
|
||||||
|
import { useSelectedNetwork } from '@/hooks';
|
||||||
|
|
||||||
|
export const useTokenConfigs = (): {
|
||||||
|
tokensConfigs: {
|
||||||
|
[DydxChainAsset.USDC]: {
|
||||||
|
denom: string;
|
||||||
|
name: string;
|
||||||
|
decimals: number;
|
||||||
|
gasDenom?: string;
|
||||||
|
},
|
||||||
|
[DydxChainAsset.CHAINTOKEN]: {
|
||||||
|
denom: string;
|
||||||
|
name: string;
|
||||||
|
decimals: number;
|
||||||
|
gasDenom?: string;
|
||||||
|
},
|
||||||
|
};
|
||||||
|
usdcDenom: string;
|
||||||
|
usdcDecimals: number;
|
||||||
|
usdcLabel: string;
|
||||||
|
chainTokenDenom: string;
|
||||||
|
chainTokenDecimals: number;
|
||||||
|
chainTokenLabel: string;
|
||||||
|
} => {
|
||||||
|
const { selectedNetwork } = useSelectedNetwork();
|
||||||
|
const tokensConfigs = ENVIRONMENT_CONFIG_MAP[selectedNetwork].tokens;
|
||||||
|
|
||||||
|
return {
|
||||||
|
tokensConfigs,
|
||||||
|
usdcDenom: tokensConfigs[DydxChainAsset.USDC].denom,
|
||||||
|
usdcDecimals: tokensConfigs[DydxChainAsset.USDC].decimals,
|
||||||
|
usdcLabel: tokensConfigs[DydxChainAsset.USDC].name,
|
||||||
|
chainTokenDenom: tokensConfigs[DydxChainAsset.CHAINTOKEN].denom,
|
||||||
|
chainTokenDecimals: tokensConfigs[DydxChainAsset.CHAINTOKEN].decimals,
|
||||||
|
chainTokenLabel: tokensConfigs[DydxChainAsset.CHAINTOKEN].name,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||||
|
|
||||||
|
import { useSelectedNetwork } from '@/hooks';
|
||||||
|
|
||||||
|
const FALLBACK_URL = 'https://help.dydx.exchange/';
|
||||||
|
|
||||||
|
export interface LinksConfigs {
|
||||||
|
tos: string,
|
||||||
|
privacy: string,
|
||||||
|
mintscan: string,
|
||||||
|
mintscanBase: string,
|
||||||
|
feedback?: string,
|
||||||
|
help?: string,
|
||||||
|
blogs?: string,
|
||||||
|
foundation?: string,
|
||||||
|
initialMarginFractionLearnMore?: string,
|
||||||
|
reduceOnlyLearnMore?: string,
|
||||||
|
documentation?: string,
|
||||||
|
community?: string,
|
||||||
|
governanceLearnMore?: string,
|
||||||
|
stakingLearnMore?: string,
|
||||||
|
keplrDashboard?: string,
|
||||||
|
accountExportLearnMore?: string,
|
||||||
|
walletLearnMore?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const useURLConfigs = (): LinksConfigs => {
|
||||||
|
const { selectedNetwork } = useSelectedNetwork();
|
||||||
|
const linksConfigs = ENVIRONMENT_CONFIG_MAP[selectedNetwork].links as LinksConfigs;
|
||||||
|
|
||||||
|
return {
|
||||||
|
tos: linksConfigs.tos,
|
||||||
|
privacy: linksConfigs.privacy,
|
||||||
|
mintscan: linksConfigs.mintscan,
|
||||||
|
mintscanBase: linksConfigs.mintscanBase,
|
||||||
|
feedback: linksConfigs.feedback || FALLBACK_URL,
|
||||||
|
help: linksConfigs.help || FALLBACK_URL,
|
||||||
|
blogs: linksConfigs.blogs || FALLBACK_URL,
|
||||||
|
foundation: linksConfigs.foundation || FALLBACK_URL,
|
||||||
|
initialMarginFractionLearnMore: linksConfigs.initialMarginFractionLearnMore || FALLBACK_URL,
|
||||||
|
reduceOnlyLearnMore: linksConfigs.reduceOnlyLearnMore || FALLBACK_URL,
|
||||||
|
documentation: linksConfigs.documentation || FALLBACK_URL,
|
||||||
|
community: linksConfigs.community || FALLBACK_URL,
|
||||||
|
governanceLearnMore: linksConfigs.governanceLearnMore || FALLBACK_URL,
|
||||||
|
stakingLearnMore: linksConfigs.stakingLearnMore || FALLBACK_URL,
|
||||||
|
keplrDashboard: linksConfigs.keplrDashboard || FALLBACK_URL,
|
||||||
|
accountExportLearnMore: linksConfigs.accountExportLearnMore || FALLBACK_URL,
|
||||||
|
walletLearnMore: linksConfigs.walletLearnMore || FALLBACK_URL,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
|
||||||
import { LocalStorageKey } from '@/constants/localStorage';
|
import { LocalStorageKey } from '@/constants/localStorage';
|
||||||
|
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
type DydxAddress,
|
type DydxAddress,
|
||||||
@@ -28,6 +30,8 @@ import {
|
|||||||
WalletType as CosmosWalletType,
|
WalletType as CosmosWalletType,
|
||||||
} from 'graz';
|
} from 'graz';
|
||||||
|
|
||||||
|
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||||
|
|
||||||
import { resolveWagmiConnector } from '@/lib/wagmi';
|
import { resolveWagmiConnector } from '@/lib/wagmi';
|
||||||
import { getWalletConnection, parseWalletError } from '@/lib/wallet';
|
import { getWalletConnection, parseWalletError } from '@/lib/wallet';
|
||||||
import { log } from '@/lib/telemetry';
|
import { log } from '@/lib/telemetry';
|
||||||
@@ -84,6 +88,9 @@ export const useWalletConnection = () => {
|
|||||||
|
|
||||||
// Wallet connection
|
// Wallet connection
|
||||||
|
|
||||||
|
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||||
|
const walletConnectConfig = ENVIRONMENT_CONFIG_MAP[selectedNetwork].wallets.walletconnect;
|
||||||
|
|
||||||
const { connectAsync: connectWagmi } =
|
const { connectAsync: connectWagmi } =
|
||||||
walletType && walletConnectionType
|
walletType && walletConnectionType
|
||||||
? useConnectWagmi({
|
? useConnectWagmi({
|
||||||
@@ -92,6 +99,7 @@ export const useWalletConnection = () => {
|
|||||||
walletConnection: {
|
walletConnection: {
|
||||||
type: walletConnectionType,
|
type: walletConnectionType,
|
||||||
},
|
},
|
||||||
|
walletConnectConfig,
|
||||||
}),
|
}),
|
||||||
})
|
})
|
||||||
: useConnectWagmi();
|
: useConnectWagmi();
|
||||||
@@ -127,6 +135,7 @@ export const useWalletConnection = () => {
|
|||||||
connector: resolveWagmiConnector({
|
connector: resolveWagmiConnector({
|
||||||
walletType,
|
walletType,
|
||||||
walletConnection,
|
walletConnection,
|
||||||
|
walletConnectConfig,
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
<svg width="16" height="18" viewBox="0 0 16 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M10.3811 13.235C11.9338 13.0512 13.4593 12.6847 14.9261 12.1433C13.6839 10.7673 12.9975 8.97875 13.0003 7.125V6.54167V6.5C13.0003 5.17392 12.4735 3.90215 11.5358 2.96447C10.5981 2.02678 9.32636 1.5 8.00028 1.5C6.67419 1.5 5.40242 2.02678 4.46474 2.96447C3.52706 3.90215 3.00028 5.17392 3.00028 6.5V7.125C3.00279 8.97886 2.3161 10.7675 1.07361 12.1433C2.51778 12.6767 4.04027 13.0475 5.61944 13.235M10.3811 13.235C8.79943 13.4226 7.20112 13.4226 5.61944 13.235M10.3811 13.235C10.5012 13.6099 10.5311 14.0078 10.4683 14.3964C10.4055 14.785 10.2518 15.1533 10.0198 15.4713C9.78772 15.7893 9.48386 16.048 9.13293 16.2263C8.78201 16.4047 8.39392 16.4976 8.00028 16.4976C7.60663 16.4976 7.21854 16.4047 6.86762 16.2263C6.51669 16.048 6.21283 15.7893 5.98079 15.4713C5.74875 15.1533 5.59508 14.785 5.53229 14.3964C5.46949 14.0078 5.49936 13.6099 5.61944 13.235" stroke="currentColor" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 1.0 KiB |
@@ -0,0 +1 @@
|
|||||||
|
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.625 6.1875h6.75m-6.75 2.25H9M1.6875 9.57c0 1.2.84225 2.2455 2.03025 2.4203.84675.1245 1.7025.2197 2.56725.2842.2625.0195.5025.1575.64875.3758L9 15.75l2.0663-3.0997c.0724-.1078.1685-.1977.2809-.2628.1125-.0651.2382-.1038.3678-.113.8589-.0641 1.7152-.1589 2.5672-.2842 1.188-.1748 2.0303-1.2195 2.0303-2.42105v-4.5135c0-1.2015-.8423-2.24625-2.0303-2.421A36.294434 36.294434 0 0 0 9 2.25c-1.794 0-3.558.13125-5.28225.38475-1.188.17475-2.03025 1.22025-2.03025 2.421V9.57Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
||||||
|
After Width: | Height: | Size: 672 B |
@@ -0,0 +1,11 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
||||||
|
<g clip-path="url(#clip0_18204_36775)">
|
||||||
|
<path d="M13.2426 6.25736C14.0817 7.09647 14.6531 8.16557 14.8846 9.32946C15.1162 10.4933 14.9973 11.6997 14.5432 12.7961C14.0891 13.8925 13.32 14.8295 12.3334 15.4888C11.3467 16.1481 10.1866 16.5 8.99993 16.5C7.81324 16.5 6.6532 16.1481 5.66651 15.4888C4.67981 14.8295 3.91078 13.8925 3.45665 12.7961C3.00253 11.6997 2.88371 10.4933 3.11522 9.32946C3.34673 8.16557 3.91817 7.09647 4.75729 6.25736" stroke="#C8C7D8" stroke-width="1.35" stroke-linecap="round"/>
|
||||||
|
<path d="M11.25 9L9 11.25M9 11.25L6.75 9M9 11.25V1.6875" stroke="#C8C7D8" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<clipPath id="clip0_18204_36775">
|
||||||
|
<rect width="18" height="18" fill="white"/>
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 886 B |
@@ -1 +1 @@
|
|||||||
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M15 8C15 9.53527 14.6867 10.8758 14.2269 11.7954C13.77 12.7092 13.3116 12.9664 13.0527 12.9968L12.6636 12.8953C12.4116 12.7511 12.092 12.4331 11.7731 11.7954C11.3133 10.8758 11 9.53527 11 8C11 6.46473 11.3133 5.12424 11.7731 4.20457C12.0924 3.56607 12.4124 3.24815 12.6645 3.10417L13.0519 3.00311C13.3107 3.0331 13.7696 3.28991 14.2269 4.20457C14.6867 5.12424 15 6.46473 15 8ZM12.2928 2.16768L1.41963 5.00415C0.628571 5.08768 0 6.39699 0 7.99992C0 9.60346 0.629045 10.9131 1.42053 10.9958L2.50023 11.2774V12.9998C2.50023 13.8283 3.17181 14.4998 4.00023 14.4998C4.82866 14.4998 5.50023 13.8283 5.50023 12.9998V12.0601L12.2914 13.8317C12.5186 13.9417 12.7559 14 13 14C14.6569 14 16 11.3137 16 8C16 4.68629 14.6569 2 13 2C12.7564 2 12.5196 2.05808 12.2928 2.16768ZM10.9931 3.5402L2.49607 5.75681C2.80523 6.30634 3 7.10764 3 7.99992C3 8.89214 2.80525 9.69339 2.49614 10.2429L10.9929 12.4595C10.3833 11.3612 10 9.77013 10 8C10 6.22968 10.3834 4.63843 10.9931 3.5402ZM2 7.99992C2 8.70677 1.85462 9.29725 1.66623 9.67403C1.59961 9.80728 1.54246 9.88955 1.5 9.93955C1.45754 9.88955 1.40039 9.80728 1.33377 9.67403C1.14538 9.29725 1 8.70677 1 7.99992C1 7.29308 1.14538 6.70259 1.33377 6.32582C1.40039 6.19256 1.45754 6.11029 1.5 6.06029C1.54246 6.11029 1.59961 6.19256 1.66623 6.32582C1.85462 6.70259 2 7.29308 2 7.99992ZM1.41964 10.0124C1.41962 10.0124 1.42071 10.0118 1.42296 10.0109C1.42079 10.0121 1.41966 10.0125 1.41964 10.0124ZM1.57704 10.0109C1.57929 10.0118 1.58038 10.0124 1.58036 10.0124C1.58033 10.0125 1.57921 10.0121 1.57704 10.0109ZM1.58036 5.9874C1.58038 5.98747 1.57929 5.98808 1.57704 5.98899C1.57921 5.98778 1.58034 5.98732 1.58036 5.9874ZM1.42296 5.98899C1.42071 5.98808 1.41962 5.98747 1.41964 5.9874C1.41966 5.98732 1.42079 5.98778 1.42296 5.98899ZM3.50023 12.9998V11.5383L4.50023 11.7992V12.9998C4.50023 13.276 4.27638 13.4998 4.00023 13.4998C3.72409 13.4998 3.50023 13.276 3.50023 12.9998Z" fill="currentColor"/></svg>
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M15 8C15 9.53527 14.6867 10.8758 14.2269 11.7954C13.77 12.7092 13.3116 12.9664 13.0527 12.9968L12.6636 12.8953C12.4116 12.7511 12.092 12.4331 11.7731 11.7954C11.3133 10.8758 11 9.53527 11 8C11 6.46473 11.3133 5.12424 11.7731 4.20457C12.0924 3.56607 12.4124 3.24815 12.6645 3.10417L13.0519 3.00311C13.3107 3.0331 13.7696 3.28991 14.2269 4.20457C14.6867 5.12424 15 6.46473 15 8ZM12.2928 2.16768L1.41963 5.00415C0.628571 5.08768 0 6.39699 0 7.99992C0 9.60346 0.629045 10.9131 1.42053 10.9958L2.50023 11.2774V12.9998C2.50023 13.8283 3.17181 14.4998 4.00023 14.4998C4.82866 14.4998 5.50023 13.8283 5.50023 12.9998V12.0601L12.2914 13.8317C12.5186 13.9417 12.7559 14 13 14C14.6569 14 16 11.3137 16 8C16 4.68629 14.6569 2 13 2C12.7564 2 12.5196 2.05808 12.2928 2.16768ZM10.9931 3.5402L2.49607 5.75681C2.80523 6.30634 3 7.10764 3 7.99992C3 8.89214 2.80525 9.69339 2.49614 10.2429L10.9929 12.4595C10.3833 11.3612 10 9.77013 10 8C10 6.22968 10.3834 4.63843 10.9931 3.5402ZM2 7.99992C2 8.70677 1.85462 9.29725 1.66623 9.67403C1.59961 9.80728 1.54246 9.88955 1.5 9.93955C1.45754 9.88955 1.40039 9.80728 1.33377 9.67403C1.14538 9.29725 1 8.70677 1 7.99992C1 7.29308 1.14538 6.70259 1.33377 6.32582C1.40039 6.19256 1.45754 6.11029 1.5 6.06029C1.54246 6.11029 1.59961 6.19256 1.66623 6.32582C1.85462 6.70259 2 7.29308 2 7.99992ZM1.41964 10.0124C1.41962 10.0124 1.42071 10.0118 1.42296 10.0109C1.42079 10.0121 1.41966 10.0125 1.41964 10.0124ZM1.57704 10.0109C1.57929 10.0118 1.58038 10.0124 1.58036 10.0124C1.58033 10.0125 1.57921 10.0121 1.57704 10.0109ZM1.58036 5.9874C1.58038 5.98747 1.57929 5.98808 1.57704 5.98899C1.57921 5.98778 1.58034 5.98732 1.58036 5.9874ZM1.42296 5.98899C1.42071 5.98808 1.41962 5.98747 1.41964 5.9874C1.41966 5.98732 1.42079 5.98778 1.42296 5.98899ZM3.50023 12.9998V11.5383L4.50023 11.7992V12.9998C4.50023 13.276 4.27638 13.4998 4.00023 13.4998C3.72409 13.4998 3.50023 13.276 3.50023 12.9998Z" fill="currentColor"/></svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
@@ -2,11 +2,13 @@ export { default as AddressConnectorIcon } from './address-connector.svg';
|
|||||||
export { default as ArrowIcon } from './arrow.svg';
|
export { default as ArrowIcon } from './arrow.svg';
|
||||||
export { default as Bar3Icon } from './bar3.svg';
|
export { default as Bar3Icon } from './bar3.svg';
|
||||||
export { default as BellIcon } from './bell.svg';
|
export { default as BellIcon } from './bell.svg';
|
||||||
|
export { default as BellStrokeIcon } from './bell-stroke.svg';
|
||||||
export { default as BoxCloseIcon } from './box-close.svg';
|
export { default as BoxCloseIcon } from './box-close.svg';
|
||||||
export { default as CalculatorIcon } from './calculator.svg';
|
export { default as CalculatorIcon } from './calculator.svg';
|
||||||
export { default as CaretIcon } from './caret-down.svg';
|
export { default as CaretIcon } from './caret-down.svg';
|
||||||
export { default as CautionCircleIcon } from './caution-circle.svg';
|
export { default as CautionCircleIcon } from './caution-circle.svg';
|
||||||
export { default as CautionCircleStrokeIcon } from './caution-circle-stroke.svg';
|
export { default as CautionCircleStrokeIcon } from './caution-circle-stroke.svg';
|
||||||
|
export { default as ChatIcon } from './chat-bubble.svg';
|
||||||
export { default as CheckIcon } from './check.svg';
|
export { default as CheckIcon } from './check.svg';
|
||||||
export { default as ChevronLeftIcon } from './chevron-left.svg';
|
export { default as ChevronLeftIcon } from './chevron-left.svg';
|
||||||
export { default as ChevronRightIcon } from './chevron-right.svg';
|
export { default as ChevronRightIcon } from './chevron-right.svg';
|
||||||
@@ -17,6 +19,7 @@ export { default as CoinsIcon } from './coins.svg';
|
|||||||
export { default as CommentIcon } from './comment.svg';
|
export { default as CommentIcon } from './comment.svg';
|
||||||
export { default as CopyIcon } from './copy.svg';
|
export { default as CopyIcon } from './copy.svg';
|
||||||
export { default as CubeIcon } from './cube.svg';
|
export { default as CubeIcon } from './cube.svg';
|
||||||
|
export { default as DepositIcon } from './deposit.svg';
|
||||||
export { default as DepthChartIcon } from './depth-chart.svg';
|
export { default as DepthChartIcon } from './depth-chart.svg';
|
||||||
export { default as DiscordIcon } from './discord.svg';
|
export { default as DiscordIcon } from './discord.svg';
|
||||||
export { default as ExportKeysIcon } from './export-keys.svg';
|
export { default as ExportKeysIcon } from './export-keys.svg';
|
||||||
@@ -33,6 +36,7 @@ export { default as LockIcon } from './lock.svg';
|
|||||||
export { default as LogoShortIcon } from './logo-short';
|
export { default as LogoShortIcon } from './logo-short';
|
||||||
export { default as MarketsIcon } from './markets.svg';
|
export { default as MarketsIcon } from './markets.svg';
|
||||||
export { default as MenuIcon } from './menu.svg';
|
export { default as MenuIcon } from './menu.svg';
|
||||||
|
export { default as MigrateIcon } from './migrate.svg';
|
||||||
export { default as MintscanIcon } from './logos/mintscan.svg';
|
export { default as MintscanIcon } from './logos/mintscan.svg';
|
||||||
export { default as OrderbookIcon } from './orderbook.svg';
|
export { default as OrderbookIcon } from './orderbook.svg';
|
||||||
export { default as OverviewIcon } from './overview.svg';
|
export { default as OverviewIcon } from './overview.svg';
|
||||||
@@ -56,6 +60,7 @@ export { default as TransferIcon } from './transfer.svg';
|
|||||||
export { default as TriangleIcon } from './triangle.svg';
|
export { default as TriangleIcon } from './triangle.svg';
|
||||||
export { default as TryAgainIcon } from './try-again.svg';
|
export { default as TryAgainIcon } from './try-again.svg';
|
||||||
export { default as WarningIcon } from './warning.svg';
|
export { default as WarningIcon } from './warning.svg';
|
||||||
|
export { default as WithdrawIcon } from './withdraw.svg';
|
||||||
|
|
||||||
// Wallets
|
// Wallets
|
||||||
export { default as BitkeepIcon } from './wallets/bitkeep.svg';
|
export { default as BitkeepIcon } from './wallets/bitkeep.svg';
|
||||||
|
|||||||
|
After Width: | Height: | Size: 694 KiB |
@@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
|
||||||
|
<path d="M13.2426 6.2573C14.0817 7.09641 14.6531 8.16551 14.8846 9.3294C15.1162 10.4933 14.9973 11.6997 14.5432 12.796C14.0891 13.8924 13.32 14.8295 12.3334 15.4888C11.3467 16.148 10.1866 16.4999 8.99993 16.4999C7.81324 16.4999 6.6532 16.148 5.66651 15.4888C4.67981 14.8295 3.91078 13.8924 3.45665 12.796C3.00253 11.6997 2.88371 10.4933 3.11522 9.3294C3.34673 8.16551 3.91817 7.09641 4.75729 6.2573" stroke="#C8C7D8" stroke-width="1.35" stroke-linecap="round"/>
|
||||||
|
<path d="M11.25 2.9375L9 0.6875M9 0.6875L6.75 2.9375M9 0.6875V10.25" stroke="#C8C7D8" stroke-width="1.35" stroke-linecap="round" stroke-linejoin="round"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 723 B |
@@ -1,12 +1,16 @@
|
|||||||
import styled, { type AnyStyledComponent, css } from 'styled-components';
|
import styled, { type AnyStyledComponent, css } from 'styled-components';
|
||||||
|
|
||||||
import { AbacusApiStatus } from '@/constants/abacus';
|
import { AbacusApiStatus } from '@/constants/abacus';
|
||||||
|
import { ButtonSize } from '@/constants/buttons';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
|
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||||
|
|
||||||
import { useApiState, useStringGetter } from '@/hooks';
|
import { useApiState, useSelectedNetwork, useStringGetter } from '@/hooks';
|
||||||
|
import { ChatIcon, LinkOutIcon } from '@/icons';
|
||||||
|
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
|
import { Button } from '@/components/Button';
|
||||||
import { Details } from '@/components/Details';
|
import { Details } from '@/components/Details';
|
||||||
import { Output, OutputType } from '@/components/Output';
|
import { Output, OutputType } from '@/components/Output';
|
||||||
import { WithTooltip } from '@/components/WithTooltip';
|
import { WithTooltip } from '@/components/WithTooltip';
|
||||||
@@ -24,6 +28,8 @@ enum ExchangeStatus {
|
|||||||
export const FooterDesktop = () => {
|
export const FooterDesktop = () => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const { height, indexerHeight, status, statusErrorMessage } = useApiState();
|
const { height, indexerHeight, status, statusErrorMessage } = useApiState();
|
||||||
|
const { selectedNetwork } = useSelectedNetwork();
|
||||||
|
const { statusPage } = ENVIRONMENT_CONFIG_MAP[selectedNetwork].links;
|
||||||
|
|
||||||
const { exchangeStatus, label } =
|
const { exchangeStatus, label } =
|
||||||
!status || status === AbacusApiStatus.NORMAL
|
!status || status === AbacusApiStatus.NORMAL
|
||||||
@@ -38,6 +44,7 @@ export const FooterDesktop = () => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Styled.Footer>
|
<Styled.Footer>
|
||||||
|
<Styled.Row>
|
||||||
<WithTooltip
|
<WithTooltip
|
||||||
slotTooltip={
|
slotTooltip={
|
||||||
statusErrorMessage && (
|
statusErrorMessage && (
|
||||||
@@ -47,11 +54,27 @@ export const FooterDesktop = () => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
<Styled.Row>
|
<Styled.FooterButton
|
||||||
<Styled.StatusDot exchangeStatus={exchangeStatus} />
|
slotLeft={<Styled.StatusDot exchangeStatus={exchangeStatus} />}
|
||||||
<span>{label}</span>
|
slotRight={statusPage && <LinkOutIcon />}
|
||||||
</Styled.Row>
|
size={ButtonSize.XSmall}
|
||||||
|
state={{ isDisabled: !statusPage }}
|
||||||
|
>
|
||||||
|
{label}
|
||||||
|
</Styled.FooterButton>
|
||||||
</WithTooltip>
|
</WithTooltip>
|
||||||
|
|
||||||
|
{globalThis?.Intercom && (
|
||||||
|
<Styled.FooterButton
|
||||||
|
slotLeft={<ChatIcon />}
|
||||||
|
size={ButtonSize.XSmall}
|
||||||
|
onClick={() => globalThis.Intercom('show')}
|
||||||
|
>
|
||||||
|
{stringGetter({ key: STRING_KEYS.HELP_AND_SUPPORT })}
|
||||||
|
</Styled.FooterButton>
|
||||||
|
)}
|
||||||
|
</Styled.Row>
|
||||||
|
|
||||||
{import.meta.env.MODE !== 'production' && (
|
{import.meta.env.MODE !== 'production' && (
|
||||||
<Styled.Details
|
<Styled.Details
|
||||||
withSeparators
|
withSeparators
|
||||||
@@ -82,20 +105,22 @@ Styled.Footer = styled.footer`
|
|||||||
${layoutMixins.stickyFooter}
|
${layoutMixins.stickyFooter}
|
||||||
${layoutMixins.spacedRow}
|
${layoutMixins.spacedRow}
|
||||||
grid-area: Footer;
|
grid-area: Footer;
|
||||||
|
|
||||||
font-size: 0.66em;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Row = styled.div`
|
Styled.Row = styled.div`
|
||||||
${layoutMixins.row}
|
${layoutMixins.row}
|
||||||
padding: 0 1rem;
|
${layoutMixins.spacedRow}
|
||||||
gap: 0.5rem;
|
width: var(--sidebar-width);
|
||||||
|
|
||||||
|
padding: 0 0.5rem;
|
||||||
|
border-right: 1px solid var(--color-border);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.StatusDot = styled.div<{ exchangeStatus: ExchangeStatus }>`
|
Styled.StatusDot = styled.div<{ exchangeStatus: ExchangeStatus }>`
|
||||||
width: 1em;
|
width: 0.5rem;
|
||||||
height: 1em;
|
height: 0.5rem;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
margin-right: 0.25rem;
|
||||||
|
|
||||||
background-color: ${({ exchangeStatus }) =>
|
background-color: ${({ exchangeStatus }) =>
|
||||||
({
|
({
|
||||||
@@ -104,12 +129,28 @@ Styled.StatusDot = styled.div<{ exchangeStatus: ExchangeStatus }>`
|
|||||||
}[exchangeStatus])};
|
}[exchangeStatus])};
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
Styled.FooterButton = styled(Button)`
|
||||||
|
--button-height: 1.5rem;
|
||||||
|
--button-radius: 0.25rem;
|
||||||
|
--button-backgroundColor: var(--color-layer-2);
|
||||||
|
--button-border: none;
|
||||||
|
--button-textColor: var(--color-text-0);
|
||||||
|
|
||||||
|
&:hover:not(:disabled) {
|
||||||
|
--button-backgroundColor: var(--color-layer-3);
|
||||||
|
--button-textColor: var(--color-text-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
&:disabled {
|
||||||
|
cursor: default;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
Styled.WarningOutput = styled(Output)`
|
Styled.WarningOutput = styled(Output)`
|
||||||
color: var(--color-warning);
|
color: var(--color-warning);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Details = styled(Details)`
|
Styled.Details = styled(Details)`
|
||||||
${layoutMixins.scrollArea}
|
${layoutMixins.scrollArea}
|
||||||
|
font: var(--font-tiny-book);
|
||||||
padding: 0 0.5em;
|
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ import { ButtonShape } from '@/constants/buttons';
|
|||||||
import { DialogTypes } from '@/constants/dialogs';
|
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 { LogoShortIcon, BellStrokeIcon } from '@/icons';
|
||||||
import { LogoShortIcon, BellIcon } from '@/icons';
|
|
||||||
|
import { useTokenConfigs, useStringGetter, useURLConfigs } from '@/hooks';
|
||||||
|
|
||||||
import { Icon, IconName } from '@/components/Icon';
|
import { Icon, IconName } from '@/components/Icon';
|
||||||
import { IconButton } from '@/components/IconButton';
|
import { IconButton } from '@/components/IconButton';
|
||||||
@@ -23,35 +24,38 @@ import { openDialog } from '@/state/dialogs';
|
|||||||
|
|
||||||
import { headerMixins } from '@/styles/headerMixins';
|
import { headerMixins } from '@/styles/headerMixins';
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
import breakpoints from '@/styles/breakpoints';
|
||||||
|
|
||||||
export const HeaderDesktop = () => {
|
export const HeaderDesktop = () => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
|
const { documentation, community, mintscanBase } = useURLConfigs();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const { chainTokenLabel } = useTokenConfigs();
|
||||||
|
|
||||||
const navItems = [
|
const navItems = [
|
||||||
{
|
{
|
||||||
group: 'navigation',
|
group: 'navigation',
|
||||||
items: [
|
items: [
|
||||||
{
|
|
||||||
value: 'MARKET',
|
|
||||||
label: stringGetter({ key: STRING_KEYS.MARKET }),
|
|
||||||
href: AppRoute.Markets,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
value: 'TRADE',
|
value: 'TRADE',
|
||||||
label: stringGetter({ key: STRING_KEYS.TRADE }),
|
label: stringGetter({ key: STRING_KEYS.TRADE }),
|
||||||
href: AppRoute.Trade,
|
href: AppRoute.Trade,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
value: 'Dv4TNT',
|
|
||||||
label: 'Dv4TNT',
|
|
||||||
href: AppRoute.Rewards,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
value: 'PORTFOLIO',
|
value: 'PORTFOLIO',
|
||||||
label: stringGetter({ key: STRING_KEYS.PORTFOLIO }),
|
label: stringGetter({ key: STRING_KEYS.PORTFOLIO }),
|
||||||
href: AppRoute.Portfolio,
|
href: AppRoute.Portfolio,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
value: 'MARKETS',
|
||||||
|
label: stringGetter({ key: STRING_KEYS.MARKETS }),
|
||||||
|
href: AppRoute.Markets,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: chainTokenLabel,
|
||||||
|
label: chainTokenLabel,
|
||||||
|
href: `/${chainTokenLabel}`,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
value: 'MORE',
|
value: 'MORE',
|
||||||
label: stringGetter({ key: STRING_KEYS.MORE }),
|
label: stringGetter({ key: STRING_KEYS.MORE }),
|
||||||
@@ -60,31 +64,31 @@ export const HeaderDesktop = () => {
|
|||||||
value: 'DOCUMENTATION',
|
value: 'DOCUMENTATION',
|
||||||
slotBefore: <Icon iconName={IconName.Terminal} />,
|
slotBefore: <Icon iconName={IconName.Terminal} />,
|
||||||
label: stringGetter({ key: STRING_KEYS.DOCUMENTATION }),
|
label: stringGetter({ key: STRING_KEYS.DOCUMENTATION }),
|
||||||
href: 'https://v4-teacher.vercel.app/',
|
href: documentation,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'MINTSCAN',
|
value: 'MINTSCAN',
|
||||||
slotBefore: <Icon iconName={IconName.Mintscan} />,
|
slotBefore: <Icon iconName={IconName.Mintscan} />,
|
||||||
label: stringGetter({ key: STRING_KEYS.MINTSCAN }),
|
label: stringGetter({ key: STRING_KEYS.MINTSCAN }),
|
||||||
href: 'https://testnet.mintscan.io/dydx-testnet',
|
href: mintscanBase,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'COMMUNITY',
|
value: 'COMMUNITY',
|
||||||
slotBefore: <Icon iconName={IconName.Discord} />,
|
slotBefore: <Icon iconName={IconName.Discord} />,
|
||||||
label: stringGetter({ key: STRING_KEYS.COMMUNITY }),
|
label: stringGetter({ key: STRING_KEYS.COMMUNITY }),
|
||||||
href: 'https://discord.gg/dydx',
|
href: community,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'TERMS_OF_USE',
|
value: 'TERMS_OF_USE',
|
||||||
slotBefore: <Icon iconName={IconName.File} />,
|
slotBefore: <Icon iconName={IconName.File} />,
|
||||||
label: stringGetter({ key: STRING_KEYS.TERMS_OF_USE }),
|
label: stringGetter({ key: STRING_KEYS.TERMS_OF_USE }),
|
||||||
href: 'https://dydx.exchange/terms',
|
href: AppRoute.Terms,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'PRIVACY_POLICY',
|
value: 'PRIVACY_POLICY',
|
||||||
slotBefore: <Icon iconName={IconName.Privacy} />,
|
slotBefore: <Icon iconName={IconName.Privacy} />,
|
||||||
label: stringGetter({ key: STRING_KEYS.PRIVACY_POLICY }),
|
label: stringGetter({ key: STRING_KEYS.PRIVACY_POLICY }),
|
||||||
href: 'https://dydx.exchange/privacy',
|
href: AppRoute.Privacy,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: 'HELP',
|
value: 'HELP',
|
||||||
@@ -131,7 +135,9 @@ export const HeaderDesktop = () => {
|
|||||||
<VerticalSeparator />
|
<VerticalSeparator />
|
||||||
|
|
||||||
<NotificationsMenu
|
<NotificationsMenu
|
||||||
slotTrigger={<Styled.IconButton shape={ButtonShape.Rectangle} iconComponent={BellIcon} />}
|
slotTrigger={
|
||||||
|
<Styled.IconButton shape={ButtonShape.Rectangle} iconComponent={BellStrokeIcon} />
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<VerticalSeparator />
|
<VerticalSeparator />
|
||||||
@@ -146,6 +152,7 @@ const Styled: Record<string, AnyStyledComponent> = {};
|
|||||||
|
|
||||||
Styled.Header = styled.header`
|
Styled.Header = styled.header`
|
||||||
--header-horizontal-padding-mobile: 0.5rem;
|
--header-horizontal-padding-mobile: 0.5rem;
|
||||||
|
--trigger-height: 2.25rem;
|
||||||
--logo-width: 3.5rem;
|
--logo-width: 3.5rem;
|
||||||
|
|
||||||
${layoutMixins.container}
|
${layoutMixins.container}
|
||||||
@@ -153,6 +160,8 @@ Styled.Header = styled.header`
|
|||||||
${layoutMixins.scrollSnapItem}
|
${layoutMixins.scrollSnapItem}
|
||||||
backdrop-filter: none;
|
backdrop-filter: none;
|
||||||
|
|
||||||
|
height: var(--page-currentHeaderHeight);
|
||||||
|
|
||||||
grid-area: Header;
|
grid-area: Header;
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
@@ -165,7 +174,15 @@ Styled.Header = styled.header`
|
|||||||
)
|
)
|
||||||
var(--border-width) 1fr var(--border-width) auto;
|
var(--border-width) 1fr var(--border-width) auto;
|
||||||
|
|
||||||
font-size: 0.9375em;
|
@media ${breakpoints.tablet} {
|
||||||
|
--trigger-height: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media ${breakpoints.mobile} {
|
||||||
|
--navBefore-width: 7rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
font-size: 0.9375rem;
|
||||||
|
|
||||||
:before {
|
:before {
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
@@ -175,6 +192,7 @@ Styled.Header = styled.header`
|
|||||||
Styled.NavigationMenu = styled(NavigationMenu)`
|
Styled.NavigationMenu = styled(NavigationMenu)`
|
||||||
& {
|
& {
|
||||||
--navigationMenu-height: var(--stickyArea-topHeight);
|
--navigationMenu-height: var(--stickyArea-topHeight);
|
||||||
|
--navigationMenu-item-height: var(--trigger-height);
|
||||||
}
|
}
|
||||||
|
|
||||||
${layoutMixins.scrollArea}
|
${layoutMixins.scrollArea}
|
||||||
@@ -214,7 +232,8 @@ Styled.NavAfter = styled.div`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.IconButton = styled(IconButton)`
|
Styled.IconButton = styled(IconButton)<{ size?: string }>`
|
||||||
${headerMixins.button}
|
${headerMixins.button}
|
||||||
--button-border: none;
|
--button-border: none;
|
||||||
|
--button-icon-size: 1rem;
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -14,8 +14,6 @@ import {
|
|||||||
OrderSide,
|
OrderSide,
|
||||||
OrderTimeInForce,
|
OrderTimeInForce,
|
||||||
OrderExecution,
|
OrderExecution,
|
||||||
DYDX_DENOM,
|
|
||||||
GAS_PRICE_DYDX_DENOM,
|
|
||||||
} from '@dydxprotocol/v4-client-js';
|
} from '@dydxprotocol/v4-client-js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -61,22 +59,42 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async connectNetwork(
|
async connectNetwork(
|
||||||
indexerUrl: string,
|
paramsInJson: Nullable<string>,
|
||||||
indexerSocketUrl: string,
|
|
||||||
validatorUrl: string,
|
|
||||||
chainId: string,
|
|
||||||
faucetUrl: Nullable<string> | undefined,
|
|
||||||
callback: (p0: Nullable<string>) => void
|
callback: (p0: Nullable<string>) => void
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
try {
|
try {
|
||||||
|
const parsedParams = paramsInJson ? JSON.parse(paramsInJson) : {};
|
||||||
|
const {
|
||||||
|
indexerUrl,
|
||||||
|
websocketUrl,
|
||||||
|
validatorUrl,
|
||||||
|
chainId,
|
||||||
|
USDC_DENOM,
|
||||||
|
USDC_DECIMALS,
|
||||||
|
USDC_GAS_DENOM,
|
||||||
|
CHAINTOKEN_DENOM,
|
||||||
|
CHAINTOKEN_DECIMALS,
|
||||||
|
} = parsedParams;
|
||||||
|
|
||||||
const compositeClient = await CompositeClient.connect(
|
const compositeClient = await CompositeClient.connect(
|
||||||
new Network(
|
new Network(
|
||||||
chainId,
|
chainId,
|
||||||
new IndexerConfig(indexerUrl, indexerSocketUrl),
|
new IndexerConfig(indexerUrl, websocketUrl),
|
||||||
new ValidatorConfig(validatorUrl, chainId, {
|
new ValidatorConfig(
|
||||||
|
validatorUrl,
|
||||||
|
chainId,
|
||||||
|
{
|
||||||
|
USDC_DENOM,
|
||||||
|
USDC_DECIMALS,
|
||||||
|
USDC_GAS_DENOM,
|
||||||
|
CHAINTOKEN_DENOM,
|
||||||
|
CHAINTOKEN_DECIMALS,
|
||||||
|
},
|
||||||
|
{
|
||||||
broadcastPollIntervalMs: 3_000,
|
broadcastPollIntervalMs: 3_000,
|
||||||
broadcastTimeoutMs: 60_000,
|
broadcastTimeoutMs: 60_000,
|
||||||
})
|
}
|
||||||
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -84,13 +102,7 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
|
|
||||||
// Dispatch custom event to notify other parts of the app that the network has been connected
|
// Dispatch custom event to notify other parts of the app that the network has been connected
|
||||||
const customEvent = new CustomEvent('abacus:connectNetwork', {
|
const customEvent = new CustomEvent('abacus:connectNetwork', {
|
||||||
detail: {
|
detail: parsedParams,
|
||||||
indexerUrl,
|
|
||||||
indexerSocketUrl,
|
|
||||||
validatorUrl,
|
|
||||||
chainId,
|
|
||||||
faucetUrl,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
globalThis.dispatchEvent(customEvent);
|
globalThis.dispatchEvent(customEvent);
|
||||||
@@ -99,9 +111,7 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
this.store?.dispatch(
|
this.store?.dispatch(
|
||||||
openDialog({ type: DialogTypes.ExchangeOffline, dialogProps: { preventClose: true } })
|
openDialog({ type: DialogTypes.ExchangeOffline, dialogProps: { preventClose: true } })
|
||||||
);
|
);
|
||||||
|
|
||||||
log('DydxChainTransactions/connectNetwork', error);
|
log('DydxChainTransactions/connectNetwork', error);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,13 +223,13 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
params ?? {};
|
params ?? {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const tx = await this.compositeClient?.cancelOrder(
|
const tx = await this.compositeClient?.cancelRawOrder(
|
||||||
new SubaccountClient(this.localWallet, subaccountNumber),
|
new SubaccountClient(this.localWallet, subaccountNumber),
|
||||||
clientId,
|
clientId,
|
||||||
orderFlags,
|
orderFlags,
|
||||||
clobPairId,
|
clobPairId,
|
||||||
goodTilBlock ?? undefined,
|
goodTilBlock || undefined,
|
||||||
goodTilBlockTime ?? undefined
|
goodTilBlockTime || undefined,
|
||||||
);
|
);
|
||||||
|
|
||||||
const parsedTx = this.parseToPrimitives(tx);
|
const parsedTx = this.parseToPrimitives(tx);
|
||||||
@@ -251,7 +261,7 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
const msg = compositeClient.withdrawFromSubaccountMessage(subaccountClient, amount);
|
const msg = compositeClient.withdrawFromSubaccountMessage(subaccountClient, amount);
|
||||||
|
|
||||||
resolve([msg]);
|
resolve([msg]);
|
||||||
}),
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
const parsedTx = this.parseToPrimitives(tx);
|
const parsedTx = this.parseToPrimitives(tx);
|
||||||
@@ -266,7 +276,9 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async simulateTransferNativeTokenTransaction(params: HumanReadableTransferPayload): Promise<string> {
|
async simulateTransferNativeTokenTransaction(
|
||||||
|
params: HumanReadableTransferPayload
|
||||||
|
): Promise<string> {
|
||||||
if (!this.compositeClient || !this.localWallet) {
|
if (!this.compositeClient || !this.localWallet) {
|
||||||
throw new Error('Missing compositeClient or localWallet');
|
throw new Error('Missing compositeClient or localWallet');
|
||||||
}
|
}
|
||||||
@@ -280,16 +292,18 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
this.localWallet,
|
this.localWallet,
|
||||||
() =>
|
() =>
|
||||||
new Promise((resolve) => {
|
new Promise((resolve) => {
|
||||||
const msg = compositeClient?.validatorClient.post.composer.composeMsgSendToken(
|
if (!this.localWallet) {
|
||||||
subaccountClient.address,
|
throw new Error('Missing compositeClient or localWallet');
|
||||||
|
}
|
||||||
|
const msg = compositeClient?.sendTokenMessage(
|
||||||
|
this.localWallet,
|
||||||
|
amount,
|
||||||
recipient,
|
recipient,
|
||||||
DYDX_DENOM,
|
|
||||||
Long.fromNumber(amount * QUANTUM_MULTIPLIER)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
resolve([msg]);
|
resolve([msg]);
|
||||||
}),
|
}),
|
||||||
GAS_PRICE_DYDX_DENOM,
|
this.compositeClient?.validatorClient?.post.defaultDydxGasPrice,
|
||||||
);
|
);
|
||||||
|
|
||||||
const parsedTx = this.parseToPrimitives(tx);
|
const parsedTx = this.parseToPrimitives(tx);
|
||||||
@@ -397,7 +411,8 @@ class DydxChainTransactions implements AbacusDYDXChainTransactionsProtocol {
|
|||||||
break;
|
break;
|
||||||
case QueryType.GetAccountBalances:
|
case QueryType.GetAccountBalances:
|
||||||
if (!this.localWallet?.address) throw new Error('Missing localWallet');
|
if (!this.localWallet?.address) throw new Error('Missing localWallet');
|
||||||
const accountBalances = await this.compositeClient?.validatorClient.get.getAccountBalances(
|
const accountBalances =
|
||||||
|
await this.compositeClient?.validatorClient.get.getAccountBalances(
|
||||||
this.localWallet.address
|
this.localWallet.address
|
||||||
);
|
);
|
||||||
const parsedAccountBalances = this.parseToPrimitives(accountBalances);
|
const parsedAccountBalances = this.parseToPrimitives(accountBalances);
|
||||||
|
|||||||
@@ -107,8 +107,8 @@ export const getHydratedTradingData = ({
|
|||||||
perpetualMarkets?: Record<string, PerpetualMarket>;
|
perpetualMarkets?: Record<string, PerpetualMarket>;
|
||||||
}) => ({
|
}) => ({
|
||||||
...data,
|
...data,
|
||||||
asset: assets && perpetualMarkets && assets[perpetualMarkets[data.marketId].assetId],
|
asset: assets && perpetualMarkets && assets[perpetualMarkets[data.marketId]?.assetId],
|
||||||
stepSizeDecimals: perpetualMarkets?.[data.marketId].configs?.stepSizeDecimals,
|
stepSizeDecimals: perpetualMarkets?.[data.marketId]?.configs?.stepSizeDecimals,
|
||||||
tickSizeDecimals: perpetualMarkets?.[data.marketId].configs?.tickSizeDecimals,
|
tickSizeDecimals: perpetualMarkets?.[data.marketId]?.configs?.tickSizeDecimals,
|
||||||
...('side' in data && { orderSide: convertAbacusOrderSide(data.side) }),
|
...('side' in data && { orderSide: convertAbacusOrderSide(data.side) }),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ import {
|
|||||||
WALLET_CONNECT_EXPLORER_RECOMMENDED_IDS,
|
WALLET_CONNECT_EXPLORER_RECOMMENDED_IDS,
|
||||||
} from '@/constants/wallets';
|
} from '@/constants/wallets';
|
||||||
|
|
||||||
|
import { isTruthy } from './isTruthy';
|
||||||
|
|
||||||
// Config
|
// Config
|
||||||
|
|
||||||
export const WAGMI_SUPPORTED_CHAINS: Chain[] = [
|
export const WAGMI_SUPPORTED_CHAINS: Chain[] = [
|
||||||
@@ -78,13 +80,17 @@ export const WAGMI_SUPPORTED_CHAINS: Chain[] = [
|
|||||||
celoAlfajores,
|
celoAlfajores,
|
||||||
];
|
];
|
||||||
|
|
||||||
const { chains, publicClient, webSocketPublicClient } = configureChains(WAGMI_SUPPORTED_CHAINS, [
|
const { chains, publicClient, webSocketPublicClient } = configureChains(
|
||||||
// alchemyProvider({ apiKey: import.meta.env.VITE_ALCHEMY_API_KEY }),
|
WAGMI_SUPPORTED_CHAINS,
|
||||||
|
[
|
||||||
|
import.meta.env.VITE_ALCHEMY_API_KEY &&
|
||||||
|
alchemyProvider({ apiKey: import.meta.env.VITE_ALCHEMY_API_KEY }),
|
||||||
jsonRpcProvider({
|
jsonRpcProvider({
|
||||||
rpc: (chain) => ({ http: chain.rpcUrls.default.http[0] }),
|
rpc: (chain) => ({ http: chain.rpcUrls.default.http[0] }),
|
||||||
}),
|
}),
|
||||||
publicProvider(),
|
publicProvider(),
|
||||||
]);
|
].filter(isTruthy)
|
||||||
|
);
|
||||||
|
|
||||||
const injectedConnectorOptions = {
|
const injectedConnectorOptions = {
|
||||||
chains,
|
chains,
|
||||||
@@ -95,15 +101,28 @@ const injectedConnectorOptions = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const walletconnect2ConnectorOptions: ConstructorParameters<typeof WalletConnectConnector>[0] = {
|
type WalletConnectConfig = {
|
||||||
|
client: {
|
||||||
|
name: string;
|
||||||
|
description: string;
|
||||||
|
iconUrl: string;
|
||||||
|
};
|
||||||
|
v2: {
|
||||||
|
projectId: string;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const getWalletconnect2ConnectorOptions = (
|
||||||
|
config: WalletConnectConfig
|
||||||
|
): ConstructorParameters<typeof WalletConnectConnector>[0] => ({
|
||||||
chains,
|
chains,
|
||||||
options: {
|
options: {
|
||||||
projectId: import.meta.env.VITE_WALLETCONNECT2_PROJECT_ID,
|
projectId: config.v2.projectId,
|
||||||
metadata: {
|
metadata: {
|
||||||
name: 'dYdX',
|
name: config.client.name,
|
||||||
description: '',
|
description: config.client.description,
|
||||||
url: import.meta.env.VITE_BASE_URL,
|
url: import.meta.env.VITE_BASE_URL,
|
||||||
icons: [`${import.meta.env.VITE_BASE_URL}/cbw-image.png}`],
|
icons: [config.client.iconUrl],
|
||||||
},
|
},
|
||||||
showQrModal: true,
|
showQrModal: true,
|
||||||
qrModalOptions: {
|
qrModalOptions: {
|
||||||
@@ -115,9 +134,9 @@ const walletconnect2ConnectorOptions: ConstructorParameters<typeof WalletConnect
|
|||||||
explorerRecommendedWalletIds: WALLET_CONNECT_EXPLORER_RECOMMENDED_IDS,
|
explorerRecommendedWalletIds: WALLET_CONNECT_EXPLORER_RECOMMENDED_IDS,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
const connectors = [
|
const getConnectors = (walletConnectConfig: WalletConnectConfig) => [
|
||||||
new MetaMaskConnector({
|
new MetaMaskConnector({
|
||||||
chains,
|
chains,
|
||||||
options: {
|
options: {
|
||||||
@@ -131,7 +150,7 @@ const connectors = [
|
|||||||
reloadOnDisconnect: false,
|
reloadOnDisconnect: false,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
new WalletConnectConnector(walletconnect2ConnectorOptions),
|
new WalletConnectConnector(getWalletconnect2ConnectorOptions(walletConnectConfig)),
|
||||||
new InjectedConnector(injectedConnectorOptions),
|
new InjectedConnector(injectedConnectorOptions),
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -153,27 +172,34 @@ const createInjectedConnectorWithProvider = (provider: ExternalProvider) =>
|
|||||||
provider as unknown as Awaited<ReturnType<InjectedConnector['getProvider']>>;
|
provider as unknown as Awaited<ReturnType<InjectedConnector['getProvider']>>;
|
||||||
})(injectedConnectorOptions) as InjectedConnector;
|
})(injectedConnectorOptions) as InjectedConnector;
|
||||||
|
|
||||||
const createWalletConnect2ConnectorWithId = (walletconnect2Id: string) =>
|
const createWalletConnect2ConnectorWithId = (
|
||||||
new WalletConnectConnector({
|
walletconnectId: string,
|
||||||
|
walletConnectConfig: WalletConnectConfig
|
||||||
|
) => {
|
||||||
|
const walletconnect2ConnectorOptions = getWalletconnect2ConnectorOptions(walletConnectConfig);
|
||||||
|
return new WalletConnectConnector({
|
||||||
...walletconnect2ConnectorOptions,
|
...walletconnect2ConnectorOptions,
|
||||||
options: {
|
options: {
|
||||||
...walletconnect2ConnectorOptions.options,
|
...walletconnect2ConnectorOptions.options,
|
||||||
qrModalOptions: {
|
qrModalOptions: {
|
||||||
...walletconnect2ConnectorOptions.options.qrModalOptions,
|
...walletconnect2ConnectorOptions.options.qrModalOptions,
|
||||||
explorerRecommendedWalletIds: [walletconnect2Id],
|
explorerRecommendedWalletIds: [walletconnectId],
|
||||||
explorerExcludedWalletIds: 'ALL',
|
explorerExcludedWalletIds: 'ALL',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
// Custom connector from wallet selection
|
// Custom connector from wallet selection
|
||||||
|
|
||||||
export const resolveWagmiConnector = ({
|
export const resolveWagmiConnector = ({
|
||||||
walletType,
|
walletType,
|
||||||
walletConnection,
|
walletConnection,
|
||||||
|
walletConnectConfig,
|
||||||
}: {
|
}: {
|
||||||
walletType: WalletType;
|
walletType: WalletType;
|
||||||
walletConnection: WalletConnection;
|
walletConnection: WalletConnection;
|
||||||
|
walletConnectConfig: WalletConnectConfig;
|
||||||
}) => {
|
}) => {
|
||||||
const walletConfig = wallets[walletType];
|
const walletConfig = wallets[walletType];
|
||||||
const walletConnectionConfig = walletConnectionTypes[walletConnection.type];
|
const walletConnectionConfig = walletConnectionTypes[walletConnection.type];
|
||||||
@@ -181,6 +207,8 @@ export const resolveWagmiConnector = ({
|
|||||||
return walletConnection.type === WalletConnectionType.InjectedEip1193 && walletConnection.provider
|
return walletConnection.type === WalletConnectionType.InjectedEip1193 && walletConnection.provider
|
||||||
? createInjectedConnectorWithProvider(walletConnection.provider)
|
? createInjectedConnectorWithProvider(walletConnection.provider)
|
||||||
: walletConnection.type === WalletConnectionType.WalletConnect2 && walletConfig.walletconnect2Id
|
: walletConnection.type === WalletConnectionType.WalletConnect2 && walletConfig.walletconnect2Id
|
||||||
? createWalletConnect2ConnectorWithId(walletConfig.walletconnect2Id)
|
? createWalletConnect2ConnectorWithId(walletConfig.walletconnect2Id, walletConnectConfig)
|
||||||
: connectors.find(({ id }: { id: string }) => id === walletConnectionConfig.wagmiConnectorId);
|
: getConnectors(walletConnectConfig).find(
|
||||||
|
({ id }: { id: string }) => id === walletConnectionConfig.wagmiConnectorId
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import styled, { AnyStyledComponent } from 'styled-components';
|
||||||
|
|
||||||
|
import { articleMixins } from '@/styles/articleMixins';
|
||||||
|
|
||||||
|
export const PrivacyPolicyPage = () => (
|
||||||
|
<Styled.Article>
|
||||||
|
<header>
|
||||||
|
<h1>Privacy Policy</h1>
|
||||||
|
</header>
|
||||||
|
</Styled.Article>
|
||||||
|
);
|
||||||
|
|
||||||
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
|
Styled.Article = styled.article`
|
||||||
|
${articleMixins.article}
|
||||||
|
`;
|
||||||
@@ -17,7 +17,7 @@ import { DialogTypes } from '@/constants/dialogs';
|
|||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { AppRoute, PortfolioRoute, HistoryRoute } from '@/constants/routes';
|
import { AppRoute, PortfolioRoute, HistoryRoute } from '@/constants/routes';
|
||||||
import { wallets, WalletType } from '@/constants/wallets';
|
import { wallets, WalletType } from '@/constants/wallets';
|
||||||
import { useAccounts, useStringGetter } from '@/hooks';
|
import { useAccounts, useStringGetter, useTokenConfigs } from '@/hooks';
|
||||||
|
|
||||||
import { getOnboardingState } from '@/state/accountSelectors';
|
import { getOnboardingState } from '@/state/accountSelectors';
|
||||||
import { openDialog } from '@/state/dialogs';
|
import { openDialog } from '@/state/dialogs';
|
||||||
@@ -37,6 +37,7 @@ const Profile = () => {
|
|||||||
const isConnected = onboardingState !== OnboardingState.Disconnected;
|
const isConnected = onboardingState !== OnboardingState.Disconnected;
|
||||||
|
|
||||||
const { evmAddress, dydxAddress, walletType } = useAccounts();
|
const { evmAddress, dydxAddress, walletType } = useAccounts();
|
||||||
|
const { chainTokenLabel } = useTokenConfigs();
|
||||||
|
|
||||||
const { data: ensName } = useEnsName({
|
const { data: ensName } = useEnsName({
|
||||||
address: evmAddress,
|
address: evmAddress,
|
||||||
@@ -137,7 +138,11 @@ const Profile = () => {
|
|||||||
layout="grid"
|
layout="grid"
|
||||||
/>
|
/>
|
||||||
</Panel>
|
</Panel>
|
||||||
<Styled.RewardsPanel header={stringGetter({ key: STRING_KEYS.REWARDS })} hasSeparator>
|
<Styled.RewardsPanel
|
||||||
|
slotHeaderContent={stringGetter({ key: STRING_KEYS.REWARDS })}
|
||||||
|
href={`/${chainTokenLabel}`}
|
||||||
|
hasSeparator
|
||||||
|
>
|
||||||
<Styled.Details
|
<Styled.Details
|
||||||
items={[
|
items={[
|
||||||
{ key: 'maker', label: stringGetter({ key: STRING_KEYS.YOU_WILL_EARN }), value: '-' },
|
{ key: 'maker', label: stringGetter({ key: STRING_KEYS.YOU_WILL_EARN }), value: '-' },
|
||||||
@@ -149,8 +154,8 @@ const Profile = () => {
|
|||||||
</Styled.EqualGrid>
|
</Styled.EqualGrid>
|
||||||
|
|
||||||
<Styled.TablePanel
|
<Styled.TablePanel
|
||||||
header={stringGetter({ key: STRING_KEYS.HISTORY })}
|
slotHeaderContent={stringGetter({ key: STRING_KEYS.HISTORY })}
|
||||||
linkto={`${AppRoute.Portfolio}/${PortfolioRoute.History}/${HistoryRoute.Trades}`}
|
href={`${AppRoute.Portfolio}/${PortfolioRoute.History}/${HistoryRoute.Trades}`}
|
||||||
hasSeparator
|
hasSeparator
|
||||||
>
|
>
|
||||||
<FillsTable
|
<FillsTable
|
||||||
@@ -175,7 +180,7 @@ Styled.MobileProfileLayout = styled.div`
|
|||||||
${layoutMixins.contentContainerPage}
|
${layoutMixins.contentContainerPage}
|
||||||
|
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
padding: 1rem;
|
padding: 1.25rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Header = styled.header`
|
Styled.Header = styled.header`
|
||||||
@@ -273,22 +278,25 @@ Styled.RewardsPanel = styled(Panel)`
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.TablePanel = styled(Panel)`
|
Styled.TablePanel = styled(Panel)`
|
||||||
padding: 0;
|
--panel-content-paddingY: 0;
|
||||||
max-width: calc(100vw - 2rem);
|
--panel-content-paddingX: 0;
|
||||||
max-height: 10rem;
|
|
||||||
|
> div > div {
|
||||||
|
margin-top: 0.5rem;
|
||||||
|
--scrollArea-height: 10rem;
|
||||||
|
border-radius: 0.875rem;
|
||||||
|
}
|
||||||
|
|
||||||
table {
|
table {
|
||||||
|
max-height: 10rem;
|
||||||
--tableCell-padding: 0.25rem 1rem;
|
--tableCell-padding: 0.25rem 1rem;
|
||||||
|
--tableRow-backgroundColor: var(--color-layer-3);
|
||||||
background-color: transparent;
|
background-color: var(--color-layer-3);
|
||||||
|
|
||||||
thead {
|
thead {
|
||||||
color: var(--color-text-0);
|
color: var(--color-text-0);
|
||||||
}
|
}
|
||||||
|
|
||||||
tbody {
|
tbody {
|
||||||
background-color: transparent;
|
|
||||||
|
|
||||||
tr {
|
tr {
|
||||||
td:nth-child(2),
|
td:nth-child(2),
|
||||||
td:nth-child(3) {
|
td:nth-child(3) {
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import styled, { AnyStyledComponent } from 'styled-components';
|
||||||
|
|
||||||
|
import { articleMixins } from '@/styles/articleMixins';
|
||||||
|
|
||||||
|
export const TermsOfUsePage = () => (
|
||||||
|
<Styled.Article>
|
||||||
|
<header>
|
||||||
|
<h1>Terms of Use</h1>
|
||||||
|
</header>
|
||||||
|
</Styled.Article>
|
||||||
|
);
|
||||||
|
|
||||||
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
|
Styled.Article = styled.article`
|
||||||
|
${articleMixins.article}
|
||||||
|
`;
|
||||||
@@ -131,7 +131,7 @@ export const AccountDetailsAndHistory = () => {
|
|||||||
key: 'BuyingPower',
|
key: 'BuyingPower',
|
||||||
labelKey: STRING_KEYS.BUYING_POWER,
|
labelKey: STRING_KEYS.BUYING_POWER,
|
||||||
type: OutputType.Fiat,
|
type: OutputType.Fiat,
|
||||||
value: buyingPower?.current,
|
value: MustBigNumber(buyingPower?.current).lt(0) ? undefined : buyingPower?.current, // show '-' when buying power is negative
|
||||||
},
|
},
|
||||||
].filter(isTruthy);
|
].filter(isTruthy);
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import { Nullable } from '@dydxprotocol/v4-abacus';
|
import { Nullable } from '@dydxprotocol/v4-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';
|
||||||
|
|
||||||
import { FeeTier } from '@/constants/abacus';
|
import { FeeTier } from '@/constants/abacus';
|
||||||
import { FEE_DECIMALS, QUANTUM_MULTIPLIER } from '@/constants/numbers';
|
import { FEE_DECIMALS } from '@/constants/numbers';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { useAccounts, 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';
|
||||||
import { tableMixins } from '@/styles/tableMixins';
|
import { tableMixins } from '@/styles/tableMixins';
|
||||||
@@ -29,9 +29,8 @@ const EQUALITY_SYMBOL_MAP = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const Fees = () => {
|
export const Fees = () => {
|
||||||
const { dydxAddress } = useAccounts();
|
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const { isNotTablet } = useBreakpoints();
|
const { isTablet, isNotTablet } = useBreakpoints();
|
||||||
const userFeeTier = useSelector(getUserFeeTier, shallowEqual);
|
const userFeeTier = useSelector(getUserFeeTier, shallowEqual);
|
||||||
const userStats = useSelector(getUserStats, shallowEqual);
|
const userStats = useSelector(getUserStats, shallowEqual);
|
||||||
const feeTiers = useSelector(getFeeTiers, shallowEqual);
|
const feeTiers = useSelector(getFeeTiers, shallowEqual);
|
||||||
@@ -56,28 +55,28 @@ export const Fees = () => {
|
|||||||
<Styled.AdditionalConditions>
|
<Styled.AdditionalConditions>
|
||||||
{!isAdditional && !totalShare && !makerShare && <Output type={OutputType.Text} />}
|
{!isAdditional && !totalShare && !makerShare && <Output type={OutputType.Text} />}
|
||||||
{!!totalShare && (
|
{!!totalShare && (
|
||||||
<Styled.TextRow>
|
<Styled.AdditionalConditionsText>
|
||||||
{isAdditional && <span>{stringGetter({ key: STRING_KEYS.AND })}</span>}
|
{isAdditional && stringGetter({ key: STRING_KEYS.AND })}{' '}
|
||||||
<span>{stringGetter({ key: STRING_KEYS.EXCHANGE_MARKET_SHARE })}</span>
|
{stringGetter({ key: STRING_KEYS.EXCHANGE_MARKET_SHARE })}{' '}
|
||||||
<Styled.Highlighted>{'>'}</Styled.Highlighted>
|
<Styled.Highlighted>{'>'}</Styled.Highlighted>{' '}
|
||||||
<Styled.HighlightOutput
|
<Styled.HighlightOutput
|
||||||
type={OutputType.Percent}
|
type={OutputType.Percent}
|
||||||
value={totalShare}
|
value={totalShare}
|
||||||
fractionDigits={0}
|
fractionDigits={0}
|
||||||
/>
|
/>
|
||||||
</Styled.TextRow>
|
</Styled.AdditionalConditionsText>
|
||||||
)}
|
)}
|
||||||
{!!makerShare && (
|
{!!makerShare && (
|
||||||
<Styled.TextRow>
|
<Styled.AdditionalConditionsText>
|
||||||
{isAdditional && <span>{stringGetter({ key: STRING_KEYS.AND })}</span>}
|
{isAdditional && stringGetter({ key: STRING_KEYS.AND })}{' '}
|
||||||
<span>{stringGetter({ key: STRING_KEYS.MAKER_MARKET_SHARE })}</span>
|
{stringGetter({ key: STRING_KEYS.MAKER_MARKET_SHARE })}{' '}
|
||||||
<Styled.Highlighted>{'>'}</Styled.Highlighted>
|
<Styled.Highlighted>{'>'}</Styled.Highlighted>{' '}
|
||||||
<Styled.HighlightOutput
|
<Styled.HighlightOutput
|
||||||
type={OutputType.Percent}
|
type={OutputType.Percent}
|
||||||
value={makerShare}
|
value={makerShare}
|
||||||
fractionDigits={0}
|
fractionDigits={0}
|
||||||
/>
|
/>
|
||||||
</Styled.TextRow>
|
</Styled.AdditionalConditionsText>
|
||||||
)}
|
)}
|
||||||
</Styled.AdditionalConditions>
|
</Styled.AdditionalConditions>
|
||||||
),
|
),
|
||||||
@@ -103,7 +102,7 @@ export const Fees = () => {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
<div>
|
|
||||||
<Styled.FeeTable
|
<Styled.FeeTable
|
||||||
label="Fee Tiers"
|
label="Fee Tiers"
|
||||||
data={feeTiers || []}
|
data={feeTiers || []}
|
||||||
@@ -142,7 +141,7 @@ export const Fees = () => {
|
|||||||
: symbol
|
: symbol
|
||||||
} `}</span>
|
} `}</span>
|
||||||
<Styled.HighlightOutput type={OutputType.CompactFiat} value={volume} />
|
<Styled.HighlightOutput type={OutputType.CompactFiat} value={volume} />
|
||||||
{!isNotTablet &&
|
{isTablet &&
|
||||||
AdditionalConditions({ totalShare, makerShare, isAdditional: true })}
|
AdditionalConditions({ totalShare, makerShare, isAdditional: true })}
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
@@ -187,7 +186,6 @@ export const Fees = () => {
|
|||||||
withOuterBorder={isNotTablet}
|
withOuterBorder={isNotTablet}
|
||||||
withInnerBorders
|
withInnerBorders
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
</Styled.ContentWrapper>
|
</Styled.ContentWrapper>
|
||||||
</AttachedExpandingSection>
|
</AttachedExpandingSection>
|
||||||
);
|
);
|
||||||
@@ -198,21 +196,43 @@ const Styled: Record<string, AnyStyledComponent> = {};
|
|||||||
Styled.ContentWrapper = styled.div`
|
Styled.ContentWrapper = styled.div`
|
||||||
${layoutMixins.flexColumn}
|
${layoutMixins.flexColumn}
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
|
max-width: 100vw;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.AdditionalConditions = styled.div`
|
Styled.AdditionalConditions = styled.div`
|
||||||
${tableMixins.cellContentColumn}
|
${tableMixins.cellContentColumn}
|
||||||
|
justify-content: end;
|
||||||
|
|
||||||
color: var(--color-text-0);
|
color: var(--color-text-0);
|
||||||
|
font: var(--font-small-book);
|
||||||
|
|
||||||
> :nth-child(2) {
|
> :nth-child(2) {
|
||||||
font: var(--font-base-book);
|
font: var(--font-small-book);
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.AdditionalConditionsText = styled.span`
|
||||||
|
display: flex;
|
||||||
|
gap: 0.5ch;
|
||||||
|
|
||||||
|
@media ${breakpoints.mobile} {
|
||||||
|
display: inline;
|
||||||
|
max-width: 8rem;
|
||||||
|
min-width: 0;
|
||||||
|
|
||||||
|
output {
|
||||||
|
display: inline;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.FeesDetails = styled(Details)`
|
Styled.FeesDetails = styled(Details)`
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
|
||||||
|
@media ${breakpoints.notTablet} {
|
||||||
|
margin: 0 1.25rem;
|
||||||
|
}
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
@media ${breakpoints.tablet} {
|
||||||
padding: 1rem 1rem 0 1rem;
|
padding: 1rem 1rem 0 1rem;
|
||||||
--details-grid-numColumns: 1;
|
--details-grid-numColumns: 1;
|
||||||
@@ -237,12 +257,8 @@ Styled.FeesDetails = styled(Details)`
|
|||||||
}
|
}
|
||||||
|
|
||||||
output {
|
output {
|
||||||
font: var(--font-medium-book);
|
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
|
||||||
font: var(--font-base-book);
|
font: var(--font-base-book);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.TextRow = styled.div`
|
Styled.TextRow = styled.div`
|
||||||
@@ -271,6 +287,11 @@ Styled.FeeTable = styled(Table)`
|
|||||||
|
|
||||||
font: var(--font-base-book);
|
font: var(--font-base-book);
|
||||||
|
|
||||||
|
@media ${breakpoints.mobile} {
|
||||||
|
--tableCell-padding: 1rem 1.25rem;
|
||||||
|
font: var(--font-small-book);
|
||||||
|
}
|
||||||
|
|
||||||
tbody tr {
|
tbody tr {
|
||||||
&[data-yours='true'] {
|
&[data-yours='true'] {
|
||||||
background-color: var(--color-layer-3);
|
background-color: var(--color-layer-3);
|
||||||
@@ -283,6 +304,10 @@ Styled.FeeTable = styled(Table)`
|
|||||||
|
|
||||||
@media ${breakpoints.notTablet} {
|
@media ${breakpoints.notTablet} {
|
||||||
--tableHeader-backgroundColor: var(--color-layer-1);
|
--tableHeader-backgroundColor: var(--color-layer-1);
|
||||||
|
|
||||||
|
thead tr {
|
||||||
|
--border-width: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import styled, { AnyStyledComponent } from 'styled-components';
|
|||||||
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
||||||
|
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
import { useAccountBalance, useAccounts, useStringGetter } from '@/hooks';
|
import { useAccountBalance, useAccounts, useTokenConfigs, useStringGetter } from '@/hooks';
|
||||||
|
|
||||||
import { ButtonAction, ButtonSize } from '@/constants/buttons';
|
import { ButtonAction, ButtonSize } from '@/constants/buttons';
|
||||||
import { DialogTypes } from '@/constants/dialogs';
|
import { DialogTypes } from '@/constants/dialogs';
|
||||||
@@ -22,7 +22,6 @@ import { OnboardingTriggerButton } from '@/views/dialogs/OnboardingTriggerButton
|
|||||||
import { openDialog } from '@/state/dialogs';
|
import { openDialog } from '@/state/dialogs';
|
||||||
import { calculateCanAccountTrade } from '@/state/accountCalculators';
|
import { calculateCanAccountTrade } from '@/state/accountCalculators';
|
||||||
|
|
||||||
// TODO(@aforaleka): replace with real data
|
|
||||||
export const DYDXBalancePanel = () => {
|
export const DYDXBalancePanel = () => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
@@ -30,14 +29,15 @@ export const DYDXBalancePanel = () => {
|
|||||||
const { walletType } = useAccounts();
|
const { walletType } = useAccounts();
|
||||||
const canAccountTrade = useSelector(calculateCanAccountTrade, shallowEqual);
|
const canAccountTrade = useSelector(calculateCanAccountTrade, shallowEqual);
|
||||||
const { nativeTokenBalance, nativeStakingBalance } = useAccountBalance();
|
const { nativeTokenBalance, nativeStakingBalance } = useAccountBalance();
|
||||||
|
const { chainTokenLabel } = useTokenConfigs();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Panel
|
<Styled.Panel
|
||||||
slotHeader={
|
slotHeader={
|
||||||
<Styled.Header>
|
<Styled.Header>
|
||||||
<Styled.Title>
|
<Styled.Title>
|
||||||
{/* <AssetIcon symbol="DYDX" /> */}
|
<AssetIcon symbol={chainTokenLabel} />
|
||||||
Dv4TNT
|
{chainTokenLabel}
|
||||||
</Styled.Title>
|
</Styled.Title>
|
||||||
<Styled.ReceiveAndTransferButtons>
|
<Styled.ReceiveAndTransferButtons>
|
||||||
{!canAccountTrade ? (
|
{!canAccountTrade ? (
|
||||||
@@ -106,20 +106,31 @@ export const DYDXBalancePanel = () => {
|
|||||||
{
|
{
|
||||||
key: 'totalBalance',
|
key: 'totalBalance',
|
||||||
label: 'Total balance',
|
label: 'Total balance',
|
||||||
value: <Output type={OutputType.Asset} value={nativeTokenBalance + nativeStakingBalance} tag="Dv4TNT" />,
|
value: (
|
||||||
|
<Output
|
||||||
|
type={OutputType.Asset}
|
||||||
|
value={nativeTokenBalance.plus(nativeStakingBalance)}
|
||||||
|
tag={chainTokenLabel}
|
||||||
|
/>
|
||||||
|
),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
</Styled.Content>
|
</Styled.Content>
|
||||||
</Panel>
|
</Styled.Panel>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Styled: Record<string, AnyStyledComponent> = {};
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
|
Styled.Panel = styled(Panel)`
|
||||||
|
--panel-paddingX: 1.5rem;
|
||||||
|
`;
|
||||||
|
|
||||||
Styled.Header = styled.div`
|
Styled.Header = styled.div`
|
||||||
${layoutMixins.spacedRow}
|
${layoutMixins.spacedRow}
|
||||||
padding: 1.25rem 1.5rem 0.5rem;
|
gap: 1rem;
|
||||||
|
padding: 1rem 1.5rem 0;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Title = styled.h3`
|
Styled.Title = styled.h3`
|
||||||
@@ -148,7 +159,6 @@ Styled.ReceiveButton = styled(Button)`
|
|||||||
Styled.Content = styled.div`
|
Styled.Content = styled.div`
|
||||||
${layoutMixins.flexColumn}
|
${layoutMixins.flexColumn}
|
||||||
gap: 0.75rem;
|
gap: 0.75rem;
|
||||||
padding: 0 0.5rem 0.5rem;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.IconContainer = styled.div`
|
Styled.IconContainer = styled.div`
|
||||||
@@ -172,8 +182,7 @@ Styled.WalletAndStakedBalance = styled(Details)`
|
|||||||
--details-item-backgroundColor: var(--color-layer-6);
|
--details-item-backgroundColor: var(--color-layer-6);
|
||||||
|
|
||||||
grid-template-columns: 1fr 1fr;
|
grid-template-columns: 1fr 1fr;
|
||||||
gap: 0.5rem;
|
gap: 1rem;
|
||||||
|
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
|
|||||||
@@ -0,0 +1,224 @@
|
|||||||
|
import styled, { AnyStyledComponent } from 'styled-components';
|
||||||
|
import { useSelector } from 'react-redux';
|
||||||
|
|
||||||
|
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||||
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
|
import { ButtonAction, ButtonSize, ButtonType } from '@/constants/buttons';
|
||||||
|
|
||||||
|
import { useAccountBalance, useBreakpoints, useStringGetter } from '@/hooks';
|
||||||
|
|
||||||
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
|
import { Details } from '@/components/Details';
|
||||||
|
import { Panel } from '@/components/Panel';
|
||||||
|
import { Button } from '@/components/Button';
|
||||||
|
import { Link } from '@/components/Link';
|
||||||
|
import { IconName, Icon } from '@/components/Icon';
|
||||||
|
import { Output, OutputType } from '@/components/Output';
|
||||||
|
import { VerticalSeparator } from '@/components/Separator';
|
||||||
|
import { Tag } from '@/components/Tag';
|
||||||
|
import { WithReceipt } from '@/components/WithReceipt';
|
||||||
|
|
||||||
|
import { getSelectedNetwork } from '@/state/appSelectors';
|
||||||
|
|
||||||
|
import { MustBigNumber } from '@/lib/numbers';
|
||||||
|
|
||||||
|
const TOKEN_MIGRATION_LEARN_MORE_LINK =
|
||||||
|
'https://www.dydx.foundation/blog/update-on-exploring-the-future-of-dydx';
|
||||||
|
|
||||||
|
export const MigratePanel = () => {
|
||||||
|
const { isNotTablet } = useBreakpoints();
|
||||||
|
const stringGetter = useStringGetter();
|
||||||
|
|
||||||
|
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||||
|
|
||||||
|
const chainId = Number(ENVIRONMENT_CONFIG_MAP[selectedNetwork].ethereumChainId);
|
||||||
|
|
||||||
|
// v3 token is only on mainnet
|
||||||
|
const { balance: tokenBalance } = useAccountBalance({
|
||||||
|
addressOrDenom: chainId === 1 ? import.meta.env.VITE_V3_TOKEN_ADDRESS : undefined,
|
||||||
|
chainId: 1,
|
||||||
|
isCosmosChain: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return isNotTablet ? (
|
||||||
|
<Styled.MigratePanel
|
||||||
|
slotHeader={<Styled.Title>{stringGetter({ key: STRING_KEYS.MIGRATE })}</Styled.Title>}
|
||||||
|
slotRight={
|
||||||
|
<Styled.MigrateAction>
|
||||||
|
<div>
|
||||||
|
<div>{stringGetter({ key: STRING_KEYS.AVAILABLE_TO_MIGRATE })}</div>
|
||||||
|
<Styled.Token type={OutputType.Asset} value={tokenBalance} />
|
||||||
|
</div>
|
||||||
|
{import.meta.env.VITE_TOKEN_MIGRATION_URI && (
|
||||||
|
<Button
|
||||||
|
action={MustBigNumber(tokenBalance).gt(0) ? ButtonAction.Primary : ButtonAction.Base}
|
||||||
|
type={ButtonType.Link}
|
||||||
|
href={import.meta.env.VITE_TOKEN_MIGRATION_URI}
|
||||||
|
slotRight={<Icon iconName={IconName.LinkOut} />}
|
||||||
|
>
|
||||||
|
{stringGetter({ key: STRING_KEYS.MIGRATE_NOW })}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</Styled.MigrateAction>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Styled.Description>
|
||||||
|
{stringGetter({ key: STRING_KEYS.MIGRATE_DESCRIPTION })}
|
||||||
|
<Link href={TOKEN_MIGRATION_LEARN_MORE_LINK}>
|
||||||
|
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} →
|
||||||
|
</Link>
|
||||||
|
</Styled.Description>
|
||||||
|
</Styled.MigratePanel>
|
||||||
|
) : (
|
||||||
|
<Styled.MigratePanel
|
||||||
|
slotHeader={
|
||||||
|
<Styled.MobileMigrateHeader>
|
||||||
|
<h3>
|
||||||
|
<Icon iconName={IconName.Migrate} />
|
||||||
|
{stringGetter({ key: STRING_KEYS.MIGRATE })}
|
||||||
|
</h3>
|
||||||
|
<Styled.VerticalSeparator />
|
||||||
|
<span>
|
||||||
|
{stringGetter({
|
||||||
|
key: STRING_KEYS.FROM_TO,
|
||||||
|
params: { FROM: <b>Ethereum</b>, TO: <b>dYdX Chain</b> },
|
||||||
|
})}
|
||||||
|
</span>
|
||||||
|
</Styled.MobileMigrateHeader>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<Styled.Column>
|
||||||
|
<Styled.WithReceipt
|
||||||
|
slotReceipt={
|
||||||
|
<Styled.Details
|
||||||
|
items={[
|
||||||
|
{
|
||||||
|
key: 'available-to-migrate',
|
||||||
|
label: (
|
||||||
|
<Styled.InlineRow>
|
||||||
|
{stringGetter({ key: STRING_KEYS.AVAILABLE_TO_MIGRATE })}
|
||||||
|
<Tag>DYDX</Tag>
|
||||||
|
</Styled.InlineRow>
|
||||||
|
),
|
||||||
|
value: <Output type={OutputType.Asset} value={tokenBalance} />,
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{import.meta.env.VITE_TOKEN_MIGRATION_URI && (
|
||||||
|
<Button
|
||||||
|
action={tokenBalance ? ButtonAction.Primary : ButtonAction.Base}
|
||||||
|
size={ButtonSize.Medium}
|
||||||
|
slotRight={<Icon iconName={IconName.LinkOut} />}
|
||||||
|
href={import.meta.env.VITE_TOKEN_MIGRATION_URI}
|
||||||
|
>
|
||||||
|
{stringGetter({ key: STRING_KEYS.MIGRATE_NOW })}
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
|
</Styled.WithReceipt>
|
||||||
|
<Styled.InlineRow>
|
||||||
|
{stringGetter({ key: STRING_KEYS.WANT_TO_LEARN })}
|
||||||
|
<Link href={TOKEN_MIGRATION_LEARN_MORE_LINK} withIcon>
|
||||||
|
{stringGetter({ key: STRING_KEYS.CLICK_HERE })}
|
||||||
|
</Link>
|
||||||
|
</Styled.InlineRow>
|
||||||
|
</Styled.Column>
|
||||||
|
</Styled.MigratePanel>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
|
Styled.MigratePanel = styled(Panel)`
|
||||||
|
--panel-paddingX: 1.5rem;
|
||||||
|
width: 100%;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Title = styled.h3`
|
||||||
|
font: var(--font-medium-book);
|
||||||
|
color: var(--color-text-2);
|
||||||
|
|
||||||
|
padding: 1rem 1.5rem 0;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.MigrateAction = styled.div`
|
||||||
|
${layoutMixins.flexEqualColumns}
|
||||||
|
align-items: center;
|
||||||
|
margin-right: 1rem;
|
||||||
|
gap: 1rem;
|
||||||
|
padding: 1rem;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
background-color: var(--color-layer-2);
|
||||||
|
border: solid var(--border-width) var(--color-border);
|
||||||
|
border-radius: 0.75rem;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Token = styled(Output)`
|
||||||
|
font: var(--font-large-book);
|
||||||
|
color: var(--color-text-2);
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Description = styled.div`
|
||||||
|
color: var(--color-text-0);
|
||||||
|
--link-color: var(--color-text-1);
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Column = styled.div`
|
||||||
|
${layoutMixins.flexColumn}
|
||||||
|
gap: 1rem;
|
||||||
|
align-items: center;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.MobileMigrateHeader = styled.div`
|
||||||
|
${layoutMixins.inlineRow}
|
||||||
|
gap: 1ch;
|
||||||
|
|
||||||
|
font: var(--font-small-book);
|
||||||
|
color: var(--color-text-0);
|
||||||
|
|
||||||
|
padding: 1rem 1.5rem 0;
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
${layoutMixins.inlineRow}
|
||||||
|
font: var(--font-large-book);
|
||||||
|
color: var(--color-text-2);
|
||||||
|
|
||||||
|
svg {
|
||||||
|
font-size: 1.75rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
margin-top: 0.2rem;
|
||||||
|
|
||||||
|
b {
|
||||||
|
font-weight: var(--fontWeight-book);
|
||||||
|
color: var(--color-text-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.VerticalSeparator = styled(VerticalSeparator)`
|
||||||
|
z-index: 1;
|
||||||
|
|
||||||
|
&& {
|
||||||
|
height: 1.5rem;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Details = styled(Details)`
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.WithReceipt = styled(WithReceipt)`
|
||||||
|
width: 100%;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.InlineRow = styled.div`
|
||||||
|
${layoutMixins.inlineRow}
|
||||||
|
color: var(--color-text-0);
|
||||||
|
--link-color: var(--color-text-1);
|
||||||
|
`;
|
||||||
@@ -1,186 +1,74 @@
|
|||||||
import styled, { AnyStyledComponent } from 'styled-components';
|
import styled, { AnyStyledComponent } from 'styled-components';
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
|
|
||||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { ButtonAction, ButtonSize, ButtonState, ButtonType } from '@/constants/buttons';
|
import { ButtonAction, ButtonSize } from '@/constants/buttons';
|
||||||
import { DialogTypes } from '@/constants/dialogs';
|
import { DialogTypes } from '@/constants/dialogs';
|
||||||
|
|
||||||
import { useAccountBalance, useBreakpoints, useStringGetter } from '@/hooks';
|
import { useBreakpoints, useStringGetter, useURLConfigs } from '@/hooks';
|
||||||
|
|
||||||
import { breakpoints } from '@/styles';
|
import { breakpoints } from '@/styles';
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
import { Details } from '@/components/Details';
|
|
||||||
import { Panel } from '@/components/Panel';
|
import { Panel } from '@/components/Panel';
|
||||||
import { IconName } from '@/components/Icon';
|
import { IconName } from '@/components/Icon';
|
||||||
import { Button } from '@/components/Button';
|
|
||||||
import { IconButton } from '@/components/IconButton';
|
import { IconButton } from '@/components/IconButton';
|
||||||
import { Link } from '@/components/Link';
|
import { Link } from '@/components/Link';
|
||||||
import { Output, OutputType } from '@/components/Output';
|
|
||||||
import { VerticalSeparator } from '@/components/Separator';
|
|
||||||
import { WithReceipt } from '@/components/WithReceipt';
|
|
||||||
|
|
||||||
import { openDialog } from '@/state/dialogs';
|
import { openDialog } from '@/state/dialogs';
|
||||||
import { getSelectedNetwork } from '@/state/appSelectors';
|
|
||||||
|
|
||||||
import { DYDXBalancePanel } from './DYDXBalancePanel';
|
import { DYDXBalancePanel } from './DYDXBalancePanel';
|
||||||
|
import { MigratePanel } from './MigratePanel';
|
||||||
// TODO: replace placeholder URL with real URLs when avaialble
|
|
||||||
const GOVERNANCE_HELP_URL = 'https://help.dydx.exchange/';
|
|
||||||
const STAKING_HELP_URL = 'https://help.dydx.exchange/';
|
|
||||||
|
|
||||||
export const RewardsPage = () => {
|
export const RewardsPage = () => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
|
const { governanceLearnMore, stakingLearnMore } = useURLConfigs();
|
||||||
const { isTablet, isNotTablet } = useBreakpoints();
|
const { isTablet, isNotTablet } = useBreakpoints();
|
||||||
|
|
||||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
const panelArrow = (
|
||||||
|
<Styled.Arrow>
|
||||||
// const chainId = Number(ENVIRONMENT_CONFIG_MAP[selectedNetwork].ethereumChainId);
|
|
||||||
|
|
||||||
// const { balance } = useAccountBalance({
|
|
||||||
// addressOrDenom: import.meta.env.VITE_V3_TOKEN_ADDRESS,
|
|
||||||
// assetSymbol: 'DYDX',
|
|
||||||
// chainId,
|
|
||||||
// isCosmosChain: false,
|
|
||||||
// });
|
|
||||||
|
|
||||||
// const tokenBalance = import.meta.env.VITE_V3_TOKEN_ADDRESS ? balance : 0;
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Styled.Page>
|
|
||||||
{/* {isNotTablet ? (
|
|
||||||
<Styled.Migrate>
|
|
||||||
<Styled.TwoItemRow>
|
|
||||||
<div>
|
|
||||||
<Styled.MigrateTitle>
|
|
||||||
{stringGetter({ key: STRING_KEYS.MIGRATE })}
|
|
||||||
</Styled.MigrateTitle>
|
|
||||||
<Styled.Description>
|
|
||||||
{stringGetter({ key: STRING_KEYS.MIGRATE_DESCRIPTION })}
|
|
||||||
<Link href={MIGRATE_HELP_URL}>
|
|
||||||
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} →
|
|
||||||
</Link>
|
|
||||||
</Styled.Description>
|
|
||||||
</div>
|
|
||||||
<Styled.MigrateAction>
|
|
||||||
<div>
|
|
||||||
<div>{stringGetter({ key: STRING_KEYS.AVAILABLE_TO_MIGRATE })}</div>
|
|
||||||
<div>
|
|
||||||
<Styled.Token type={OutputType.Asset} value={tokenBalance} />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
action={tokenBalance ? ButtonAction.Primary : ButtonAction.Base}
|
|
||||||
// type={ButtonType.Link}
|
|
||||||
// href={BRIDGE_URL}
|
|
||||||
disabled
|
|
||||||
>
|
|
||||||
{tokenBalance
|
|
||||||
? `${stringGetter({ key: STRING_KEYS.MIGRATE_NOW })} →`
|
|
||||||
: stringGetter({ key: STRING_KEYS.NO_TOKENS_TO_MIGRATE })}
|
|
||||||
</Button>
|
|
||||||
</Styled.MigrateAction>
|
|
||||||
</Styled.TwoItemRow>
|
|
||||||
</Styled.Migrate>
|
|
||||||
) : (
|
|
||||||
<Styled.MobileMigrateCard
|
|
||||||
slotHeader={
|
|
||||||
<Styled.MobileMigrateHeader>
|
|
||||||
<h3>{stringGetter({ key: STRING_KEYS.MIGRATE })}</h3>
|
|
||||||
<VerticalSeparator />
|
|
||||||
<span>
|
|
||||||
{stringGetter({
|
|
||||||
key: STRING_KEYS.FROM_TO,
|
|
||||||
params: { FROM: <strong>Ethereum</strong>, TO: <strong>dYdX Chain</strong> },
|
|
||||||
})}
|
|
||||||
</span>
|
|
||||||
</Styled.MobileMigrateHeader>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Styled.WithReceipt
|
|
||||||
slotReceipt={
|
|
||||||
<Styled.Details
|
|
||||||
items={[
|
|
||||||
{
|
|
||||||
key: 'available-to-migrate',
|
|
||||||
label: stringGetter({ key: STRING_KEYS.AVAILABLE_TO_MIGRATE }),
|
|
||||||
value: <Output type={OutputType.Asset} value={tokenBalance} />,
|
|
||||||
},
|
|
||||||
]}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Button
|
|
||||||
action={tokenBalance ? ButtonAction.Primary : ButtonAction.Base}
|
|
||||||
size={ButtonSize.Medium}
|
|
||||||
disabled
|
|
||||||
>
|
|
||||||
{tokenBalance
|
|
||||||
? `${stringGetter({ key: STRING_KEYS.MIGRATE_NOW })} →`
|
|
||||||
: stringGetter({ key: STRING_KEYS.NO_TOKENS_TO_MIGRATE })}
|
|
||||||
</Button>
|
|
||||||
</Styled.WithReceipt>
|
|
||||||
<Styled.LearnMore>
|
|
||||||
{stringGetter({ key: STRING_KEYS.WANT_TO_LEARN })}
|
|
||||||
<Link href={MIGRATE_HELP_URL}>{stringGetter({ key: STRING_KEYS.CLICK_HERE })}</Link>
|
|
||||||
</Styled.LearnMore>
|
|
||||||
</Styled.MobileMigrateCard>
|
|
||||||
)} */}
|
|
||||||
|
|
||||||
<Styled.PanelRow>
|
|
||||||
{isTablet && (
|
|
||||||
<Styled.BalancePanelContainer>
|
|
||||||
<DYDXBalancePanel />
|
|
||||||
</Styled.BalancePanelContainer>
|
|
||||||
)}
|
|
||||||
|
|
||||||
<Styled.Panel
|
|
||||||
slotHeader={<Styled.Title>{stringGetter({ key: STRING_KEYS.GOVERNANCE })}</Styled.Title>}
|
|
||||||
onClick={() => dispatch(openDialog({ type: DialogTypes.ExternalNavKeplr }))}
|
|
||||||
>
|
|
||||||
<Styled.Row>
|
|
||||||
<Styled.Description>
|
|
||||||
{stringGetter({ key: STRING_KEYS.GOVERNANCE_DESCRIPTION })}
|
|
||||||
<Link href={GOVERNANCE_HELP_URL} onClick={(e) => e.stopPropagation()}>
|
|
||||||
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} →
|
|
||||||
</Link>
|
|
||||||
</Styled.Description>
|
|
||||||
{/* TODO: vertically center based on Panel height */}
|
|
||||||
<Styled.IconButton
|
<Styled.IconButton
|
||||||
action={ButtonAction.Base}
|
action={ButtonAction.Base}
|
||||||
iconName={IconName.Arrow}
|
iconName={IconName.Arrow}
|
||||||
size={ButtonSize.Small}
|
size={ButtonSize.Small}
|
||||||
/>
|
/>
|
||||||
</Styled.Row>
|
</Styled.Arrow>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Styled.Page>
|
||||||
|
{import.meta.env.VITE_V3_TOKEN_ADDRESS && <MigratePanel />}
|
||||||
|
<Styled.PanelRow>
|
||||||
|
{isTablet && <DYDXBalancePanel />}
|
||||||
|
|
||||||
|
<Styled.Panel
|
||||||
|
slotHeader={<Styled.Title>{stringGetter({ key: STRING_KEYS.GOVERNANCE })}</Styled.Title>}
|
||||||
|
slotRight={panelArrow}
|
||||||
|
onClick={() => dispatch(openDialog({ type: DialogTypes.ExternalNavKeplr }))}
|
||||||
|
>
|
||||||
|
<Styled.Description>
|
||||||
|
{stringGetter({ key: STRING_KEYS.GOVERNANCE_DESCRIPTION })}
|
||||||
|
<Link href={governanceLearnMore} onClick={(e) => e.stopPropagation()}>
|
||||||
|
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} →
|
||||||
|
</Link>
|
||||||
|
</Styled.Description>
|
||||||
</Styled.Panel>
|
</Styled.Panel>
|
||||||
|
|
||||||
<Styled.Panel
|
<Styled.Panel
|
||||||
slotHeader={<Styled.Title>{stringGetter({ key: STRING_KEYS.STAKING })}</Styled.Title>}
|
slotHeader={<Styled.Title>{stringGetter({ key: STRING_KEYS.STAKING })}</Styled.Title>}
|
||||||
|
slotRight={panelArrow}
|
||||||
onClick={() => dispatch(openDialog({ type: DialogTypes.ExternalNavKeplr }))}
|
onClick={() => dispatch(openDialog({ type: DialogTypes.ExternalNavKeplr }))}
|
||||||
>
|
>
|
||||||
<Styled.Row>
|
|
||||||
<Styled.Description>
|
<Styled.Description>
|
||||||
{stringGetter({ key: STRING_KEYS.STAKING_DESCRIPTION })}
|
{stringGetter({ key: STRING_KEYS.STAKING_DESCRIPTION })}
|
||||||
<Link href={STAKING_HELP_URL} onClick={(e) => e.stopPropagation()}>
|
<Link href={stakingLearnMore} onClick={(e) => e.stopPropagation()}>
|
||||||
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} →
|
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} →
|
||||||
</Link>
|
</Link>
|
||||||
</Styled.Description>
|
</Styled.Description>
|
||||||
{/* TODO: vertically center based on Panel height */}
|
|
||||||
<Styled.IconButton
|
|
||||||
action={ButtonAction.Base}
|
|
||||||
iconName={IconName.Arrow}
|
|
||||||
size={ButtonSize.Small}
|
|
||||||
/>
|
|
||||||
</Styled.Row>
|
|
||||||
</Styled.Panel>
|
</Styled.Panel>
|
||||||
|
|
||||||
{isNotTablet && (
|
{isNotTablet && <DYDXBalancePanel />}
|
||||||
<Styled.BalancePanelContainer>
|
|
||||||
<DYDXBalancePanel />
|
|
||||||
</Styled.BalancePanelContainer>
|
|
||||||
)}
|
|
||||||
</Styled.PanelRow>
|
</Styled.PanelRow>
|
||||||
</Styled.Page>
|
</Styled.Page>
|
||||||
);
|
);
|
||||||
@@ -191,143 +79,56 @@ const Styled: Record<string, AnyStyledComponent> = {};
|
|||||||
Styled.Page = styled.div`
|
Styled.Page = styled.div`
|
||||||
${layoutMixins.contentContainerPage}
|
${layoutMixins.contentContainerPage}
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
|
padding: 2rem;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
--content-max-width: 70rem;
|
||||||
|
max-width: min(calc(100vw - 4rem), var(--content-max-width));
|
||||||
|
}
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
@media ${breakpoints.tablet} {
|
||||||
padding: 1rem;
|
padding: 1.25rem;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
max-width: calc(100vw - 2.5rem);
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Panel = styled(Panel)`
|
Styled.Panel = styled(Panel)`
|
||||||
padding: 0 1.5rem 1rem;
|
--panel-paddingX: 1.5rem;
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
|
||||||
max-width: calc(100vw - 2rem);
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Row = styled.div`
|
Styled.Title = styled.h3`
|
||||||
${layoutMixins.spacedRow}
|
font: var(--font-medium-book);
|
||||||
gap: 1rem;
|
color: var(--color-text-2);
|
||||||
|
padding: 1rem 1.5rem 0;
|
||||||
align-items: center;
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Description = styled.div`
|
Styled.Description = styled.div`
|
||||||
color: var(--color-text-0);
|
color: var(--color-text-0);
|
||||||
|
--link-color: var(--color-text-1);
|
||||||
a {
|
|
||||||
color: var(--color-text-1);
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.Migrate = styled.section`
|
Styled.PanelRow = styled.div`
|
||||||
max-width: min(100vw, var(--content-max-width));
|
${layoutMixins.gridEqualColumns}
|
||||||
|
|
||||||
padding: 1.5rem;
|
|
||||||
|
|
||||||
background-color: var(--color-layer-3);
|
|
||||||
border-radius: 0.875rem;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.TwoItemRow = styled(Styled.Row)`
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.MigrateAction = styled(Styled.TwoItemRow)`
|
|
||||||
padding: 1rem;
|
|
||||||
|
|
||||||
background-color: var(--color-layer-2);
|
|
||||||
border: solid var(--border-width) var(--color-border);
|
|
||||||
border-radius: 0.75rem;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Token = styled(Output)`
|
|
||||||
font: var(--font-large-book);
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.PanelRow = styled(Styled.Row)`
|
|
||||||
gap: 1.5rem;
|
gap: 1.5rem;
|
||||||
max-width: min(100vw, var(--content-max-width));
|
|
||||||
align-items: flex-start;
|
|
||||||
|
|
||||||
> section {
|
align-items: flex-start;
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
@media ${breakpoints.tablet} {
|
||||||
grid-auto-flow: row;
|
grid-auto-flow: row;
|
||||||
grid-template-columns: 1fr;
|
grid-template-columns: 1fr;
|
||||||
max-width: auto;
|
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
Styled.BalancePanelContainer = styled.div`
|
|
||||||
width: 21.25rem;
|
|
||||||
|
|
||||||
@media ${breakpoints.tablet} {
|
|
||||||
width: auto;
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Title = styled.h3`
|
|
||||||
${layoutMixins.inlineRow}
|
|
||||||
padding: 1.25rem 1.5rem 0.5rem;
|
|
||||||
|
|
||||||
font: var(--font-medium-book);
|
|
||||||
color: var(--color-text-2);
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.MigrateTitle = styled(Styled.Title)`
|
|
||||||
padding: 0 0 0.5rem;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.MobileMigrateCard = styled(Styled.Panel)`
|
|
||||||
${layoutMixins.flexColumn}
|
|
||||||
gap: 1rem;
|
|
||||||
|
|
||||||
align-items: center;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.MobileMigrateHeader = styled(Styled.Title)`
|
|
||||||
${layoutMixins.inlineRow}
|
|
||||||
gap: 1ch;
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
|
|
||||||
font: var(--font-small-book);
|
|
||||||
color: var(--color-text-0);
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
${layoutMixins.inlineRow}
|
|
||||||
font: var(--font-large-book);
|
|
||||||
color: var(--color-text-2);
|
|
||||||
|
|
||||||
svg {
|
|
||||||
font-size: 1.75rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
span {
|
|
||||||
margin-top: 0.2rem;
|
|
||||||
b {
|
|
||||||
font-weight: var(--fontWeight-book);
|
|
||||||
color: var(--color-text-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Details = styled(Details)`
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.WithReceipt = styled(WithReceipt)`
|
|
||||||
width: 100%;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.LearnMore = styled(Styled.Description)`
|
|
||||||
${layoutMixins.row}
|
|
||||||
gap: 1ch;
|
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.IconButton = styled(IconButton)`
|
Styled.IconButton = styled(IconButton)`
|
||||||
color: var(--color-text-0);
|
color: var(--color-text-0);
|
||||||
|
--color-border: var(--color-layer-6);
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Arrow = styled.div`
|
||||||
|
padding: 1rem;
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -227,8 +227,8 @@ export const HorizontalPanel = ({ isOpen = true, setIsOpen }: ElementProps) => {
|
|||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
value={view}
|
value={view}
|
||||||
onValueChange={(newView: string) => {
|
onValueChange={setView}
|
||||||
setView((newView || view) as PanelView);
|
onInteraction={() => {
|
||||||
setIsOpen?.(true);
|
setIsOpen?.(true);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ import { MustBigNumber } from '@/lib/numbers';
|
|||||||
import { MidMarketPrice } from '@/views/MidMarketPrice';
|
import { MidMarketPrice } from '@/views/MidMarketPrice';
|
||||||
|
|
||||||
export const TradeHeaderMobile = () => {
|
export const TradeHeaderMobile = () => {
|
||||||
const { name, symbol } = useSelector(getCurrentMarketAssetData, shallowEqual) ?? {};
|
const { name, id } = useSelector(getCurrentMarketAssetData, shallowEqual) ?? {};
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const { market, priceChange24H, priceChange24HPercent } =
|
const { market, priceChange24H, priceChange24HPercent } =
|
||||||
@@ -27,7 +27,7 @@ export const TradeHeaderMobile = () => {
|
|||||||
<Styled.Header>
|
<Styled.Header>
|
||||||
<BackButton onClick={() => navigate(AppRoute.Markets)} />
|
<BackButton onClick={() => navigate(AppRoute.Markets)} />
|
||||||
<Styled.MarketName>
|
<Styled.MarketName>
|
||||||
<Styled.AssetIcon symbol={symbol} />
|
<Styled.AssetIcon symbol={id} />
|
||||||
<Styled.Name>
|
<Styled.Name>
|
||||||
<h3>{name}</h3>
|
<h3>{name}</h3>
|
||||||
<span>{market}</span>
|
<span>{market}</span>
|
||||||
|
|||||||
@@ -13,4 +13,6 @@ declare global {
|
|||||||
|
|
||||||
'abacus:connectNetwork': CustomEvent;
|
'abacus:connectNetwork': CustomEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var Intercom: any;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ export const dialogsSlice = createSlice({
|
|||||||
initialState,
|
initialState,
|
||||||
reducers: {
|
reducers: {
|
||||||
openDialog: (state: DialogsState, action: PayloadAction<DialogInfo<DialogTypes>>) => {
|
openDialog: (state: DialogsState, action: PayloadAction<DialogInfo<DialogTypes>>) => {
|
||||||
|
if (state.activeDialog?.type === action.payload.type) return;
|
||||||
|
|
||||||
if (state.activeDialog) {
|
if (state.activeDialog) {
|
||||||
state.dialogQueue.push(action.payload);
|
state.dialogQueue.push(action.payload);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import {
|
||||||
|
css,
|
||||||
|
type FlattenInterpolation,
|
||||||
|
type FlattenSimpleInterpolation,
|
||||||
|
type ThemeProps,
|
||||||
|
} from 'styled-components';
|
||||||
|
|
||||||
|
export const articleMixins: Record<
|
||||||
|
string,
|
||||||
|
FlattenSimpleInterpolation | FlattenInterpolation<ThemeProps<any>>
|
||||||
|
> = {
|
||||||
|
article: css`
|
||||||
|
padding: 2rem;
|
||||||
|
overflow-wrap: break-word;
|
||||||
|
user-select: text;
|
||||||
|
margin: 0 auto;
|
||||||
|
width: 60rem;
|
||||||
|
max-width: 100vw;
|
||||||
|
|
||||||
|
header {
|
||||||
|
color: var(--color-text-0);
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font: var(--font-extra-book);
|
||||||
|
color: var(--color-text-2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
font: var(--font-large-book);
|
||||||
|
color: var(--color-text-2);
|
||||||
|
padding: 0.5rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
h3,
|
||||||
|
strong {
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
|
||||||
|
strong {
|
||||||
|
color: var(--color-text-2);
|
||||||
|
}
|
||||||
|
|
||||||
|
p {
|
||||||
|
padding: 0.5rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
padding: 0.5rem 1rem;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
};
|
||||||
@@ -36,11 +36,10 @@
|
|||||||
--single-unit-height: 9.375rem;
|
--single-unit-height: 9.375rem;
|
||||||
|
|
||||||
/* Modal constants */
|
/* Modal constants */
|
||||||
--sidebar-modal-width: 18.75rem;
|
--dialog-small-width: 18.75rem;
|
||||||
--modal-small-width: 18.75rem;
|
--dialog-medium-width: 20.5rem;
|
||||||
--modal-medium-width: 20.5rem;
|
--dialog-large-width: 26.25rem;
|
||||||
--modal-large-width: 26.25rem;
|
--dialog-header-height: 4rem;
|
||||||
--modal-header-height: 4rem;
|
|
||||||
|
|
||||||
/* Market Selector constants */
|
/* Market Selector constants */
|
||||||
--marketsDropdown-openWidth: 45rem;
|
--marketsDropdown-openWidth: 45rem;
|
||||||
|
|||||||
@@ -188,13 +188,14 @@ export const popoverMixins = {
|
|||||||
--item-highlighted-backgroundColor: var(--color-layer-2);
|
--item-highlighted-backgroundColor: var(--color-layer-2);
|
||||||
--item-highlighted-textColor: var(--color-text-2);
|
--item-highlighted-textColor: var(--color-text-2);
|
||||||
|
|
||||||
|
--item-gap: 0.5em;
|
||||||
--item-radius: 0px;
|
--item-radius: 0px;
|
||||||
--item-padding: 0.5em 1em;
|
--item-padding: 0.5em 1em;
|
||||||
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.5em;
|
gap: var(--item-gap);
|
||||||
|
|
||||||
padding: var(--item-padding);
|
padding: var(--item-padding);
|
||||||
border-radius: var(--item-radius);
|
border-radius: var(--item-radius);
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ export const AccountInfoConnectedState = () => {
|
|||||||
<Styled.Header>
|
<Styled.Header>
|
||||||
<span>{stringGetter({ key: STRING_KEYS.ACCOUNT })}</span>
|
<span>{stringGetter({ key: STRING_KEYS.ACCOUNT })}</span>
|
||||||
<Styled.TransferButtons>
|
<Styled.TransferButtons>
|
||||||
{import.meta.env.MODE !== 'production' && (
|
|
||||||
<Styled.Button
|
<Styled.Button
|
||||||
state={{ isDisabled: !dydxAccounts }}
|
state={{ isDisabled: !dydxAccounts }}
|
||||||
onClick={() => dispatch(openDialog({ type: DialogTypes.Withdraw }))}
|
onClick={() => dispatch(openDialog({ type: DialogTypes.Withdraw }))}
|
||||||
@@ -84,7 +83,6 @@ export const AccountInfoConnectedState = () => {
|
|||||||
>
|
>
|
||||||
{stringGetter({ key: STRING_KEYS.WITHDRAW })}
|
{stringGetter({ key: STRING_KEYS.WITHDRAW })}
|
||||||
</Styled.Button>
|
</Styled.Button>
|
||||||
)}
|
|
||||||
<Styled.Button
|
<Styled.Button
|
||||||
state={{ isDisabled: !dydxAccounts }}
|
state={{ isDisabled: !dydxAccounts }}
|
||||||
onClick={() => dispatch(openDialog({ type: DialogTypes.Deposit }))}
|
onClick={() => dispatch(openDialog({ type: DialogTypes.Deposit }))}
|
||||||
@@ -153,7 +151,10 @@ export const AccountInfoConnectedState = () => {
|
|||||||
),
|
),
|
||||||
label: stringGetter({ key: STRING_KEYS.BUYING_POWER }),
|
label: stringGetter({ key: STRING_KEYS.BUYING_POWER }),
|
||||||
type: OutputType.Fiat,
|
type: OutputType.Fiat,
|
||||||
value: buyingPower,
|
value:
|
||||||
|
MustBigNumber(buyingPower?.current).lt(0) && buyingPower?.postOrder === null
|
||||||
|
? undefined
|
||||||
|
: buyingPower,
|
||||||
},
|
},
|
||||||
].map(
|
].map(
|
||||||
({
|
({
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const MarketFilter = ({
|
|||||||
<>
|
<>
|
||||||
{!isSearch && (
|
{!isSearch && (
|
||||||
<ToggleGroup
|
<ToggleGroup
|
||||||
items={Object.entries(filters).map(([key, value]) => ({
|
items={Object.values(filters).map((value) => ({
|
||||||
label: stringGetter({ key: MARKET_FILTER_LABELS[value] }),
|
label: stringGetter({ key: MARKET_FILTER_LABELS[value] }),
|
||||||
value,
|
value,
|
||||||
}))}
|
}))}
|
||||||
|
|||||||
@@ -198,8 +198,6 @@ Styled.Details = styled(Details)`
|
|||||||
@media ${breakpoints.tablet} {
|
@media ${breakpoints.tablet} {
|
||||||
${layoutMixins.withOuterAndInnerBorders}
|
${layoutMixins.withOuterAndInnerBorders}
|
||||||
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
|
|
||||||
font: var(--font-small-book);
|
font: var(--font-small-book);
|
||||||
|
|
||||||
> * {
|
> * {
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ Styled.TriggerIcon = styled.span`
|
|||||||
width: 0.75em;
|
width: 0.75em;
|
||||||
|
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
transition: transform 0.3s var(--ease-out-expo);
|
transition: rotate 0.3s var(--ease-out-expo);
|
||||||
|
|
||||||
${Styled.Trigger}[data-state='open'] & {
|
${Styled.Trigger}[data-state='open'] & {
|
||||||
rotate: -0.5turn;
|
rotate: -0.5turn;
|
||||||
|
|||||||
@@ -246,9 +246,7 @@ export const FundingChart = ({ selectedLocale }: ElementProps) => {
|
|||||||
}[rate] || '',
|
}[rate] || '',
|
||||||
}))}
|
}))}
|
||||||
value={fundingRateView}
|
value={fundingRateView}
|
||||||
onValueChange={(newRate: FundingRateResolution) => {
|
onValueChange={setFundingRateView}
|
||||||
if (newRate) setFundingRateView(newRate);
|
|
||||||
}}
|
|
||||||
size={ButtonSize.XSmall}
|
size={ButtonSize.XSmall}
|
||||||
/>
|
/>
|
||||||
</Styled.FundingRateToggle>
|
</Styled.FundingRateToggle>
|
||||||
|
|||||||
@@ -32,12 +32,9 @@ export const DepositDialog = ({ setIsOpen }: ElementProps) => {
|
|||||||
>
|
>
|
||||||
<Styled.Content>
|
<Styled.Content>
|
||||||
{showTestDeposit ? <TestnetDepositForm onDeposit={closeDialog} /> : <DepositForm />}
|
{showTestDeposit ? <TestnetDepositForm onDeposit={closeDialog} /> : <DepositForm />}
|
||||||
{/* TODO TRCL-1693 - uncomment when deposit form is ready */}
|
|
||||||
{import.meta.env.MODE !== 'production' && (
|
|
||||||
<Styled.TextToggle onClick={() => setShowTestDeposit(!showTestDeposit)}>
|
<Styled.TextToggle onClick={() => setShowTestDeposit(!showTestDeposit)}>
|
||||||
{showTestDeposit ? 'Show deposit form (Under Construction)' : 'Show test faucet'}
|
{showTestDeposit ? 'Show deposit form (Under Construction)' : 'Show test faucet'}
|
||||||
</Styled.TextToggle>
|
</Styled.TextToggle>
|
||||||
)}
|
|
||||||
</Styled.Content>
|
</Styled.Content>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import { shallowEqual, useDispatch, useSelector } from 'react-redux';
|
|||||||
import { AbacusApiStatus } from '@/constants/abacus';
|
import { AbacusApiStatus } from '@/constants/abacus';
|
||||||
import { DialogTypes } from '@/constants/dialogs';
|
import { DialogTypes } from '@/constants/dialogs';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
|
||||||
import { UNICODE } from '@/constants/unicode';
|
|
||||||
|
|
||||||
import { useApiState, useStringGetter } from '@/hooks';
|
import { useApiState, useStringGetter } from '@/hooks';
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
@@ -32,16 +30,8 @@ export const ExchangeOfflineDialog = ({ preventClose, setIsOpen }: ElementProps)
|
|||||||
const selectedNetwork = useSelector(getSelectedNetwork);
|
const selectedNetwork = useSelector(getSelectedNetwork);
|
||||||
const activeDialog = useSelector(getActiveDialog, shallowEqual);
|
const activeDialog = useSelector(getActiveDialog, shallowEqual);
|
||||||
|
|
||||||
const showOfflineMessage =
|
|
||||||
import.meta.env.MODE === 'production' &&
|
|
||||||
ENVIRONMENT_CONFIG_MAP[selectedNetwork].dydxChainId === 'dydx-testnet-4';
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (
|
if (activeDialog?.type === DialogTypes.ExchangeOffline && status === AbacusApiStatus.NORMAL) {
|
||||||
activeDialog?.type === DialogTypes.ExchangeOffline &&
|
|
||||||
status === AbacusApiStatus.NORMAL &&
|
|
||||||
!showOfflineMessage
|
|
||||||
) {
|
|
||||||
dispatch(closeDialog());
|
dispatch(closeDialog());
|
||||||
}
|
}
|
||||||
}, [status, selectedNetwork]);
|
}, [status, selectedNetwork]);
|
||||||
@@ -54,16 +44,7 @@ export const ExchangeOfflineDialog = ({ preventClose, setIsOpen }: ElementProps)
|
|||||||
title={stringGetter({ key: STRING_KEYS.UNAVAILABLE })}
|
title={stringGetter({ key: STRING_KEYS.UNAVAILABLE })}
|
||||||
>
|
>
|
||||||
<Styled.Content>
|
<Styled.Content>
|
||||||
{showOfflineMessage ? (
|
|
||||||
<>
|
|
||||||
<p>Testnet is currently offline. Please check back!</p>
|
|
||||||
<Styled.Link href="https://v4-teacher.vercel.app/testnets/schedule">
|
|
||||||
{stringGetter({ key: STRING_KEYS.LEARN_MORE })} {UNICODE.ARROW_RIGHT}
|
|
||||||
</Styled.Link>
|
|
||||||
</>
|
|
||||||
) : (
|
|
||||||
<p>{statusErrorMessage}</p>
|
<p>{statusErrorMessage}</p>
|
||||||
)}
|
|
||||||
{import.meta.env.MODE !== 'production' && <NetworkSelectMenu />}
|
{import.meta.env.MODE !== 'production' && <NetworkSelectMenu />}
|
||||||
</Styled.Content>
|
</Styled.Content>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import styled, { type AnyStyledComponent } from 'styled-components';
|
|||||||
|
|
||||||
import { ButtonAction, ButtonSize, ButtonType } from '@/constants/buttons';
|
import { ButtonAction, ButtonSize, ButtonType } from '@/constants/buttons';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { useBreakpoints, useStringGetter } from '@/hooks';
|
import { useBreakpoints, useStringGetter, useURLConfigs } from '@/hooks';
|
||||||
|
|
||||||
import { Button } from '@/components/Button';
|
import { Button } from '@/components/Button';
|
||||||
import { Dialog, DialogPlacement } from '@/components/Dialog';
|
import { Dialog, DialogPlacement } from '@/components/Dialog';
|
||||||
@@ -15,12 +15,10 @@ type ElementProps = {
|
|||||||
setIsOpen: (open: boolean) => void;
|
setIsOpen: (open: boolean) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: replace placeholder URL with real URLs when avaialble
|
|
||||||
const KEPLR_DASHBOARD_URL = 'https://testnet.keplr.app/';
|
|
||||||
const HELP_URL = 'https://help.dydx.exchange/en/articles/2921366-how-do-i-create-an-account-or-sign-up';
|
|
||||||
|
|
||||||
export const ExternalNavKeplrDialog = ({ setIsOpen }: ElementProps) => {
|
export const ExternalNavKeplrDialog = ({ setIsOpen }: ElementProps) => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
|
const { keplrDashboard, accountExportLearnMore } = useURLConfigs();
|
||||||
|
|
||||||
const { isTablet } = useBreakpoints();
|
const { isTablet } = useBreakpoints();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -31,7 +29,7 @@ export const ExternalNavKeplrDialog = ({ setIsOpen }: ElementProps) => {
|
|||||||
placement={isTablet ? DialogPlacement.FullScreen : DialogPlacement.Default}
|
placement={isTablet ? DialogPlacement.FullScreen : DialogPlacement.Default}
|
||||||
>
|
>
|
||||||
<Styled.Content>
|
<Styled.Content>
|
||||||
<Styled.Button type={ButtonType.Link} size={ButtonSize.XLarge} href={KEPLR_DASHBOARD_URL}>
|
<Styled.Button type={ButtonType.Link} size={ButtonSize.XLarge} href={keplrDashboard}>
|
||||||
<span>
|
<span>
|
||||||
{stringGetter({
|
{stringGetter({
|
||||||
key: STRING_KEYS.NAVIGATE_TO_KEPLR,
|
key: STRING_KEYS.NAVIGATE_TO_KEPLR,
|
||||||
@@ -48,7 +46,7 @@ export const ExternalNavKeplrDialog = ({ setIsOpen }: ElementProps) => {
|
|||||||
/>
|
/>
|
||||||
</Styled.Button>
|
</Styled.Button>
|
||||||
|
|
||||||
<Styled.Button type={ButtonType.Link} size={ButtonSize.XLarge} href={HELP_URL}>
|
<Styled.Button type={ButtonType.Link} size={ButtonSize.XLarge} href={accountExportLearnMore}>
|
||||||
<span>
|
<span>
|
||||||
{stringGetter({
|
{stringGetter({
|
||||||
key: STRING_KEYS.LEARN_TO_EXPORT,
|
key: STRING_KEYS.LEARN_TO_EXPORT,
|
||||||
@@ -104,4 +102,5 @@ Styled.Button = styled(Button)`
|
|||||||
|
|
||||||
Styled.IconButton = styled(IconButton)`
|
Styled.IconButton = styled(IconButton)`
|
||||||
color: var(--color-text-0);
|
color: var(--color-text-0);
|
||||||
|
--color-border: var(--color-layer-6);
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -1,69 +1,79 @@
|
|||||||
|
import { useMemo } from 'react';
|
||||||
import styled, { AnyStyledComponent } from 'styled-components';
|
import styled, { AnyStyledComponent } from 'styled-components';
|
||||||
import { useDispatch } from 'react-redux';
|
|
||||||
import { Close } from '@radix-ui/react-dialog';
|
|
||||||
|
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { useStringGetter } from '@/hooks';
|
import { useStringGetter, useURLConfigs } from '@/hooks';
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
|
||||||
|
|
||||||
import { Button } from '@/components/Button';
|
import { ComboboxDialogMenu } from '@/components/ComboboxDialogMenu';
|
||||||
import { Dialog } from '@/components/Dialog';
|
|
||||||
import { ButtonAction, ButtonType } from '@/constants/buttons';
|
|
||||||
import { Icon, IconName } from '@/components/Icon';
|
import { Icon, IconName } from '@/components/Icon';
|
||||||
|
|
||||||
|
import { isTruthy } from '@/lib/isTruthy';
|
||||||
|
|
||||||
type ElementProps = {
|
type ElementProps = {
|
||||||
setIsOpen: (open: boolean) => void;
|
setIsOpen: (open: boolean) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const HELP_URL = `https://docs.google.com/forms/d/e/1FAIpQLSezLsWCKvAYDEb7L-2O4wOON1T56xxro9A2Azvl6IxXHP_15Q/viewform?usp=sf_link`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* HelpDialog
|
|
||||||
* - Will temporarily be used as a 'Give Feedback' dialog.
|
|
||||||
* - It will ask users to navigate to a Google Form in order to record feedback.
|
|
||||||
*/
|
|
||||||
export const HelpDialog = ({ setIsOpen }: ElementProps) => {
|
export const HelpDialog = ({ setIsOpen }: ElementProps) => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
|
const { help: helpCenter, community } = useURLConfigs();
|
||||||
|
|
||||||
|
const HELP_ITEMS = useMemo(
|
||||||
|
() => [
|
||||||
|
{
|
||||||
|
group: 'help-items',
|
||||||
|
items: [
|
||||||
|
helpCenter && {
|
||||||
|
value: 'help-center',
|
||||||
|
label: stringGetter({ key: STRING_KEYS.HELP_CENTER }),
|
||||||
|
description: stringGetter({ key: STRING_KEYS.HELP_CENTER_DESCRIPTION }),
|
||||||
|
onSelect: () => {
|
||||||
|
helpCenter && globalThis.open(helpCenter, '_blank');
|
||||||
|
setIsOpen(false);
|
||||||
|
},
|
||||||
|
slotBefore: <Icon iconName={IconName.File} />,
|
||||||
|
},
|
||||||
|
globalThis?.Intercom && {
|
||||||
|
value: 'live-chat',
|
||||||
|
label: stringGetter({ key: STRING_KEYS.LIVE_CHAT }),
|
||||||
|
description: stringGetter({ key: STRING_KEYS.LIVE_CHAT_DESCRIPTION }),
|
||||||
|
onSelect: () => {
|
||||||
|
globalThis.Intercom('show');
|
||||||
|
setIsOpen(false);
|
||||||
|
},
|
||||||
|
slotBefore: <Icon iconName={IconName.Chat} />,
|
||||||
|
},
|
||||||
|
community && {
|
||||||
|
value: 'community',
|
||||||
|
label: stringGetter({ key: STRING_KEYS.COMMUNITY }),
|
||||||
|
description: stringGetter({ key: STRING_KEYS.COMMUNITY_DESCRIPTION }),
|
||||||
|
onSelect: () => {
|
||||||
|
community && globalThis.open(community, '_blank');
|
||||||
|
setIsOpen(false);
|
||||||
|
},
|
||||||
|
slotBefore: <Icon iconName={IconName.Discord} />,
|
||||||
|
},
|
||||||
|
].filter(isTruthy),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
[stringGetter, helpCenter, community]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog
|
<Styled.ComboboxDialogMenu
|
||||||
isOpen
|
isOpen
|
||||||
|
withSearch={false}
|
||||||
setIsOpen={setIsOpen}
|
setIsOpen={setIsOpen}
|
||||||
title={stringGetter({ key: STRING_KEYS.PROVIDE_FEEDBACK })}
|
title={stringGetter({ key: STRING_KEYS.HELP })}
|
||||||
description={stringGetter({ key: STRING_KEYS.PROVIDE_FEEDBACK_DESCRIPTION })}
|
items={HELP_ITEMS}
|
||||||
>
|
/>
|
||||||
<Styled.Content>
|
|
||||||
<p>
|
|
||||||
You will be navigated to a Google Form where you will be able to provide feedback. Thank
|
|
||||||
you for your contribution!
|
|
||||||
</p>
|
|
||||||
<Styled.ButtonRow>
|
|
||||||
<Close asChild>
|
|
||||||
<Button
|
|
||||||
action={ButtonAction.Primary}
|
|
||||||
type={ButtonType.Link}
|
|
||||||
href={HELP_URL}
|
|
||||||
slotRight={<Icon iconName={IconName.LinkOut} />}
|
|
||||||
>
|
|
||||||
{stringGetter({ key: STRING_KEYS.CONTINUE })}
|
|
||||||
</Button>
|
|
||||||
</Close>
|
|
||||||
</Styled.ButtonRow>
|
|
||||||
</Styled.Content>
|
|
||||||
</Dialog>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const Styled: Record<string, AnyStyledComponent> = {};
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
Styled.ButtonRow = styled.div`
|
Styled.ComboboxDialogMenu = styled(ComboboxDialogMenu)`
|
||||||
${layoutMixins.row}
|
--dialog-width: var(--dialog-small-width);
|
||||||
|
--dialog-content-paddingTop: 1rem;
|
||||||
gap: 0.5rem;
|
--dialog-content-paddingBottom: 1rem;
|
||||||
justify-content: end;
|
--comboxDialogMenu-item-gap: 1rem;
|
||||||
`;
|
|
||||||
|
|
||||||
Styled.Content = styled.div`
|
|
||||||
${layoutMixins.column}
|
|
||||||
gap: 1rem;
|
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export const OnboardingDialog = ({ setIsOpen }: ElementProps) => {
|
|||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const { isMobile } = useBreakpoints();
|
const { isMobile } = useBreakpoints();
|
||||||
|
|
||||||
const { walletType } = useAccounts();
|
const { disconnect, walletType } = useAccounts();
|
||||||
|
|
||||||
const currentOnboardingStep = useSelector(calculateOnboardingStep);
|
const currentOnboardingStep = useSelector(calculateOnboardingStep);
|
||||||
|
|
||||||
@@ -45,10 +45,17 @@ export const OnboardingDialog = ({ setIsOpen }: ElementProps) => {
|
|||||||
if (!currentOnboardingStep) setIsOpen?.(false);
|
if (!currentOnboardingStep) setIsOpen?.(false);
|
||||||
}, [currentOnboardingStep]);
|
}, [currentOnboardingStep]);
|
||||||
|
|
||||||
|
const setIsOpenFromDialog = (open: boolean) => {
|
||||||
|
if (!open && currentOnboardingStep === OnboardingSteps.AcknowledgeTerms) {
|
||||||
|
disconnect();
|
||||||
|
}
|
||||||
|
setIsOpen?.(open);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Styled.Dialog
|
<Styled.Dialog
|
||||||
isOpen={Boolean(currentOnboardingStep)}
|
isOpen={Boolean(currentOnboardingStep)}
|
||||||
setIsOpen={setIsOpen}
|
setIsOpen={setIsOpenFromDialog}
|
||||||
{...(currentOnboardingStep &&
|
{...(currentOnboardingStep &&
|
||||||
{
|
{
|
||||||
[OnboardingSteps.ChooseWallet]: {
|
[OnboardingSteps.ChooseWallet]: {
|
||||||
@@ -87,10 +94,10 @@ export const OnboardingDialog = ({ setIsOpen }: ElementProps) => {
|
|||||||
title: stringGetter({ key: STRING_KEYS.ACKNOWLEDGE_TERMS }),
|
title: stringGetter({ key: STRING_KEYS.ACKNOWLEDGE_TERMS }),
|
||||||
children: (
|
children: (
|
||||||
<Styled.Content>
|
<Styled.Content>
|
||||||
<AcknowledgeTerms />
|
<AcknowledgeTerms onClose={() => setIsOpenFromDialog?.(false)} />
|
||||||
</Styled.Content>
|
</Styled.Content>
|
||||||
),
|
),
|
||||||
width: '20rem',
|
width: '30rem',
|
||||||
},
|
},
|
||||||
[OnboardingSteps.DepositFunds]: {
|
[OnboardingSteps.DepositFunds]: {
|
||||||
title: stringGetter({ key: STRING_KEYS.DEPOSIT }),
|
title: stringGetter({ key: STRING_KEYS.DEPOSIT }),
|
||||||
|
|||||||
@@ -2,17 +2,21 @@ import styled, { type AnyStyledComponent } from 'styled-components';
|
|||||||
|
|
||||||
import { useAccounts, useStringGetter } from '@/hooks';
|
import { useAccounts, useStringGetter } from '@/hooks';
|
||||||
|
|
||||||
|
import { AppRoute } from '@/constants/routes';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { ButtonAction } from '@/constants/buttons';
|
import { ButtonAction } from '@/constants/buttons';
|
||||||
|
|
||||||
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
import { Button } from '@/components/Button';
|
import { Button } from '@/components/Button';
|
||||||
import { Link } from '@/components/Link';
|
import { Link } from '@/components/Link';
|
||||||
|
|
||||||
type ElementProps = {
|
type ElementProps = {
|
||||||
|
onClose?: () => void;
|
||||||
onContinue?: () => void;
|
onContinue?: () => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const AcknowledgeTerms = ({ onContinue }: ElementProps) => {
|
export const AcknowledgeTerms = ({ onClose, onContinue }: ElementProps) => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
|
|
||||||
const { saveHasAcknowledgedTerms } = useAccounts();
|
const { saveHasAcknowledgedTerms } = useAccounts();
|
||||||
@@ -24,26 +28,40 @@ export const AcknowledgeTerms = ({ onContinue }: ElementProps) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<span>
|
<p>
|
||||||
{stringGetter({
|
{stringGetter({
|
||||||
key: STRING_KEYS.LEGAL_UPDATES_DESCRIPTION,
|
key: STRING_KEYS.TOS_TITLE,
|
||||||
params: {
|
params: {
|
||||||
TOU: (
|
TERMS_LINK: (
|
||||||
<Styled.Link href="https://dydx.exchange/v4-terms">
|
<Styled.Link href={`/#${AppRoute.Terms}`}>
|
||||||
{stringGetter({ key: STRING_KEYS.TERMS_OF_USE })}
|
{stringGetter({ key: STRING_KEYS.TERMS_OF_USE })}
|
||||||
</Styled.Link>
|
</Styled.Link>
|
||||||
),
|
),
|
||||||
PRIVACY_POLICY: (
|
PRIVACY_POLICY_LINK: (
|
||||||
<Styled.Link href="https://dydx.exchange/privacy">
|
<Styled.Link href={`/#${AppRoute.Privacy}`}>
|
||||||
{stringGetter({ key: STRING_KEYS.PRIVACY_POLICY })}
|
{stringGetter({ key: STRING_KEYS.PRIVACY_POLICY })}
|
||||||
</Styled.Link>
|
</Styled.Link>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
})}
|
})}
|
||||||
</span>
|
</p>
|
||||||
<Button onClick={onAcknowledgement} action={ButtonAction.Primary}>
|
<Styled.TOS>
|
||||||
|
<ul>
|
||||||
|
<li>{stringGetter({ key: STRING_KEYS.TOS_LINE1 })}</li>
|
||||||
|
<li>{stringGetter({ key: STRING_KEYS.TOS_LINE2 })}</li>
|
||||||
|
<li>{stringGetter({ key: STRING_KEYS.TOS_LINE3 })}</li>
|
||||||
|
<li>{stringGetter({ key: STRING_KEYS.TOS_LINE4 })}</li>
|
||||||
|
<li>{stringGetter({ key: STRING_KEYS.TOS_LINE5 })}</li>
|
||||||
|
</ul>
|
||||||
|
</Styled.TOS>
|
||||||
|
<Styled.Row>
|
||||||
|
<Styled.Button onClick={onClose} action={ButtonAction.Base}>
|
||||||
|
{stringGetter({ key: STRING_KEYS.CLOSE })}
|
||||||
|
</Styled.Button>
|
||||||
|
<Styled.Button onClick={onAcknowledgement} action={ButtonAction.Primary}>
|
||||||
{stringGetter({ key: STRING_KEYS.I_AGREE })}
|
{stringGetter({ key: STRING_KEYS.I_AGREE })}
|
||||||
</Button>
|
</Styled.Button>
|
||||||
|
</Styled.Row>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -58,3 +76,23 @@ Styled.Link = styled(Link)`
|
|||||||
color: var(--color-accent);
|
color: var(--color-accent);
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
Styled.TOS = styled.section`
|
||||||
|
background-color: var(--color-layer-4);
|
||||||
|
padding: 1rem 1rem 1rem 2rem;
|
||||||
|
border-radius: 0.875rem;
|
||||||
|
> ul {
|
||||||
|
${layoutMixins.column};
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Row = styled.div`
|
||||||
|
${layoutMixins.row};
|
||||||
|
|
||||||
|
gap: 1rem;
|
||||||
|
`;
|
||||||
|
|
||||||
|
Styled.Button = styled(Button)`
|
||||||
|
flex-grow: 1;
|
||||||
|
`;
|
||||||
|
|||||||
@@ -13,16 +13,15 @@ import { Button } from '@/components/Button';
|
|||||||
import { Icon } from '@/components/Icon';
|
import { Icon } from '@/components/Icon';
|
||||||
import { Link } from '@/components/Link';
|
import { Link } from '@/components/Link';
|
||||||
|
|
||||||
import { useAccounts, useStringGetter } from '@/hooks';
|
import { useAccounts, useStringGetter, useURLConfigs } from '@/hooks';
|
||||||
import { useDisplayedWallets } from '@/hooks/useDisplayedWallets';
|
import { useDisplayedWallets } from '@/hooks/useDisplayedWallets';
|
||||||
|
|
||||||
import { breakpoints } from '@/styles';
|
import { breakpoints } from '@/styles';
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
|
|
||||||
const aboutWalletsLink = `https://www.dydx.academy/video/defi-wallet`;
|
|
||||||
|
|
||||||
export const ChooseWallet = () => {
|
export const ChooseWallet = () => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
|
const { walletLearnMore } = useURLConfigs();
|
||||||
|
|
||||||
const displayedWallets = useDisplayedWallets();
|
const displayedWallets = useDisplayedWallets();
|
||||||
|
|
||||||
@@ -63,7 +62,7 @@ export const ChooseWallet = () => {
|
|||||||
</Styled.Wallets>
|
</Styled.Wallets>
|
||||||
|
|
||||||
<Styled.Footer>
|
<Styled.Footer>
|
||||||
<Link href={aboutWalletsLink} withIcon>
|
<Link href={walletLearnMore} withIcon>
|
||||||
{stringGetter({ key: STRING_KEYS.ABOUT_WALLETS })}
|
{stringGetter({ key: STRING_KEYS.ABOUT_WALLETS })}
|
||||||
</Link>
|
</Link>
|
||||||
</Styled.Footer>
|
</Styled.Footer>
|
||||||
|
|||||||
@@ -130,12 +130,14 @@ export const GenerateKeys = ({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
setStatus(EvmDerivedAccountStatus.NotDerived);
|
||||||
const { message } = parseWalletError({ error, stringGetter });
|
const { message } = parseWalletError({ error, stringGetter });
|
||||||
|
|
||||||
if (message) {
|
if (message) {
|
||||||
track(AnalyticsEvent.OnboardingWalletIsNonDeterministic);
|
track(AnalyticsEvent.OnboardingWalletIsNonDeterministic);
|
||||||
setError(message);
|
setError(message);
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await setWalletFromEvmSignature(signature);
|
await setWalletFromEvmSignature(signature);
|
||||||
@@ -264,7 +266,6 @@ const Styled: Record<string, AnyStyledComponent> = {};
|
|||||||
|
|
||||||
Styled.StatusCardsContainer = styled.div`
|
Styled.StatusCardsContainer = styled.div`
|
||||||
display: grid;
|
display: grid;
|
||||||
margin-top: 1rem;
|
|
||||||
gap: 1rem;
|
gap: 1rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { DydxChainAsset } from '@/constants/wallets';
|
|||||||
|
|
||||||
import { formMixins } from '@/styles/formMixins';
|
import { formMixins } from '@/styles/formMixins';
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
import { useAccounts, useStringGetter } from '@/hooks';
|
import { useAccounts, useTokenConfigs, useStringGetter } from '@/hooks';
|
||||||
|
|
||||||
import { AssetIcon } from '@/components/AssetIcon';
|
import { AssetIcon } from '@/components/AssetIcon';
|
||||||
import { CopyButton } from '@/components/CopyButton';
|
import { CopyButton } from '@/components/CopyButton';
|
||||||
@@ -24,9 +24,10 @@ type ElementProps = {
|
|||||||
setIsOpen: (open: boolean) => void;
|
setIsOpen: (open: boolean) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const ReceiveDialog = ({ selectedAsset = DydxChainAsset.DYDX, setIsOpen }: ElementProps) => {
|
export const ReceiveDialog = ({ selectedAsset = DydxChainAsset.CHAINTOKEN, setIsOpen }: ElementProps) => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const { dydxAddress } = useAccounts();
|
const { dydxAddress } = useAccounts();
|
||||||
|
const { chainTokenLabel, usdcLabel } = useTokenConfigs();
|
||||||
|
|
||||||
const [asset, setAsset] = useState(selectedAsset);
|
const [asset, setAsset] = useState(selectedAsset);
|
||||||
|
|
||||||
@@ -35,16 +36,17 @@ export const ReceiveDialog = ({ selectedAsset = DydxChainAsset.DYDX, setIsOpen }
|
|||||||
value: DydxChainAsset.USDC,
|
value: DydxChainAsset.USDC,
|
||||||
label: (
|
label: (
|
||||||
<Styled.InlineRow>
|
<Styled.InlineRow>
|
||||||
<AssetIcon symbol="USDC" /> USDC
|
<AssetIcon symbol="USDC" /> {usdcLabel}
|
||||||
</Styled.InlineRow>
|
</Styled.InlineRow>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: DydxChainAsset.DYDX,
|
value: DydxChainAsset.CHAINTOKEN,
|
||||||
label: (
|
label: (
|
||||||
<Styled.InlineRow>
|
<Styled.InlineRow>
|
||||||
|
{/* TODO: conditionally display the native token assetIcon */}
|
||||||
{/* <AssetIcon symbol="DYDX" /> */}
|
{/* <AssetIcon symbol="DYDX" /> */}
|
||||||
Dv4TNT
|
{chainTokenLabel}
|
||||||
</Styled.InlineRow>
|
</Styled.InlineRow>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ export const TradeDialog = ({ isOpen, setIsOpen, slotTrigger }: ElementProps) =>
|
|||||||
const selectedTradeType = getSelectedTradeType(type);
|
const selectedTradeType = getSelectedTradeType(type);
|
||||||
const { typeOptions } = useSelector(getInputTradeOptions, shallowEqual) ?? {};
|
const { typeOptions } = useSelector(getInputTradeOptions, shallowEqual) ?? {};
|
||||||
|
|
||||||
const allTradeTypeItems = typeOptions?.toArray()?.map(({ type, stringKey }) => ({
|
const allTradeTypeItems = (typeOptions?.toArray() ?? []).map(({ type, stringKey }) => ({
|
||||||
value: type,
|
value: type,
|
||||||
label: stringGetter({
|
label: stringGetter({
|
||||||
key: stringKey as StringKey,
|
key: stringKey as StringKey,
|
||||||
@@ -73,9 +73,7 @@ export const TradeDialog = ({ isOpen, setIsOpen, slotTrigger }: ElementProps) =>
|
|||||||
<Styled.ToggleGroup
|
<Styled.ToggleGroup
|
||||||
items={allTradeTypeItems}
|
items={allTradeTypeItems}
|
||||||
value={selectedTradeType}
|
value={selectedTradeType}
|
||||||
onValueChange={(tradeType: TradeTypes) =>
|
onValueChange={onTradeTypeChange}
|
||||||
onTradeTypeChange(tradeType || selectedTradeType)
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ export const DepositForm = ({ onDeposit, onError }: DepositFormProps) => {
|
|||||||
// Async Data
|
// Async Data
|
||||||
const { balance, queryStatus, isQueryFetching } = useAccountBalance({
|
const { balance, queryStatus, isQueryFetching } = useAccountBalance({
|
||||||
addressOrDenom: sourceToken?.address || CHAIN_DEFAULT_TOKEN_ADDRESS,
|
addressOrDenom: sourceToken?.address || CHAIN_DEFAULT_TOKEN_ADDRESS,
|
||||||
assetSymbol: sourceToken?.symbol || undefined,
|
|
||||||
chainId: chainId,
|
chainId: chainId,
|
||||||
decimals: sourceToken?.decimals || undefined,
|
decimals: sourceToken?.decimals || undefined,
|
||||||
isCosmosChain: false,
|
isCosmosChain: false,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { type Dispatch, type SetStateAction, useState, type ReactNode } from 'react';
|
import { type Dispatch, type SetStateAction, useState, type ReactNode } from 'react';
|
||||||
import styled, { type AnyStyledComponent, } from 'styled-components';
|
import styled, { type AnyStyledComponent } from 'styled-components';
|
||||||
import { shallowEqual, useSelector } from 'react-redux';
|
import { shallowEqual, useSelector } from 'react-redux';
|
||||||
import type { RouteData } from '@0xsquid/sdk';
|
import type { RouteData } from '@0xsquid/sdk';
|
||||||
|
|
||||||
@@ -32,6 +32,8 @@ import { WithReceipt } from '@/components/WithReceipt';
|
|||||||
import { getSubaccountBuyingPower, getSubaccountEquity } from '@/state/accountSelectors';
|
import { getSubaccountBuyingPower, getSubaccountEquity } from '@/state/accountSelectors';
|
||||||
import { getTransferInputs } from '@/state/inputsSelectors';
|
import { getTransferInputs } from '@/state/inputsSelectors';
|
||||||
|
|
||||||
|
import { MustBigNumber } from '@/lib/numbers';
|
||||||
|
|
||||||
import { SlippageEditor } from '../SlippageEditor';
|
import { SlippageEditor } from '../SlippageEditor';
|
||||||
|
|
||||||
type ElementProps = {
|
type ElementProps = {
|
||||||
@@ -131,7 +133,7 @@ export const DepositButtonAndReceipt = ({
|
|||||||
value: (
|
value: (
|
||||||
<DiffOutput
|
<DiffOutput
|
||||||
type={OutputType.Fiat}
|
type={OutputType.Fiat}
|
||||||
value={buyingPower}
|
value={MustBigNumber(buyingPower).lt(0) ? undefined : buyingPower}
|
||||||
newValue={newBuyingPower}
|
newValue={newBuyingPower}
|
||||||
sign={NumberSign.Positive}
|
sign={NumberSign.Positive}
|
||||||
withDiff={Boolean(newBuyingPower) && buyingPower !== newBuyingPower}
|
withDiff={Boolean(newBuyingPower) && buyingPower !== newBuyingPower}
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ export const ClosePositionForm = ({
|
|||||||
value: value.toString(),
|
value: value.toString(),
|
||||||
}))}
|
}))}
|
||||||
value={percent?.toString() ?? ''}
|
value={percent?.toString() ?? ''}
|
||||||
onValueChange={(value: any) => onSelectPercentage((value || percent?.toString()) ?? '')}
|
onValueChange={onSelectPercentage}
|
||||||
shape={ButtonShape.Rectangle}
|
shape={ButtonShape.Rectangle}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|||||||
@@ -322,7 +322,6 @@ export const TradeForm = ({
|
|||||||
summary={summary ?? undefined}
|
summary={summary ?? undefined}
|
||||||
currentStep={currentStep}
|
currentStep={currentStep}
|
||||||
showDeposit={inputAlert?.errorAction === TradeInputErrorAction.DEPOSIT}
|
showDeposit={inputAlert?.errorAction === TradeInputErrorAction.DEPOSIT}
|
||||||
showConnectWallet={inputAlert?.errorAction === TradeInputErrorAction.CONNECT_WALLET}
|
|
||||||
/>
|
/>
|
||||||
</Styled.Footer>
|
</Styled.Footer>
|
||||||
</Styled.TradeForm>
|
</Styled.TradeForm>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ export const AdvancedTradeOptions = () => {
|
|||||||
const currentTradeFormConfig = useSelector(getInputTradeOptions, shallowEqual);
|
const currentTradeFormConfig = useSelector(getInputTradeOptions, shallowEqual);
|
||||||
const inputTradeData = useSelector(getInputTradeData, shallowEqual);
|
const inputTradeData = useSelector(getInputTradeData, shallowEqual);
|
||||||
|
|
||||||
const { execution, goodTil, postOnly, reduceOnly, timeInForce } = inputTradeData || {};
|
const { execution, goodTil, postOnly, reduceOnly, timeInForce, type } = inputTradeData || {};
|
||||||
|
|
||||||
const { executionOptions, needsGoodUntil, needsPostOnly, needsReduceOnly, timeInForceOptions } =
|
const { executionOptions, needsGoodUntil, needsPostOnly, needsReduceOnly, timeInForceOptions } =
|
||||||
currentTradeFormConfig || {};
|
currentTradeFormConfig || {};
|
||||||
@@ -37,6 +37,7 @@ export const AdvancedTradeOptions = () => {
|
|||||||
const { duration, unit } = goodTil || {};
|
const { duration, unit } = goodTil || {};
|
||||||
|
|
||||||
const needsExecution = executionOptions || needsPostOnly || needsReduceOnly;
|
const needsExecution = executionOptions || needsPostOnly || needsReduceOnly;
|
||||||
|
const hasTimeInForce = timeInForceOptions?.toArray()?.length;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Styled.Collapsible
|
<Styled.Collapsible
|
||||||
@@ -47,7 +48,7 @@ export const AdvancedTradeOptions = () => {
|
|||||||
>
|
>
|
||||||
<Styled.AdvancedInputsContainer>
|
<Styled.AdvancedInputsContainer>
|
||||||
<Styled.AdvancedInputsRow needsGoodUntil={needsGoodUntil}>
|
<Styled.AdvancedInputsRow needsGoodUntil={needsGoodUntil}>
|
||||||
{timeInForceOptions?.toArray() && (
|
{hasTimeInForce && (
|
||||||
<Styled.SelectMenu
|
<Styled.SelectMenu
|
||||||
value={timeInForce}
|
value={timeInForce}
|
||||||
onValueChange={(selectedTimeInForceOption: string) =>
|
onValueChange={(selectedTimeInForceOption: string) =>
|
||||||
@@ -72,7 +73,9 @@ export const AdvancedTradeOptions = () => {
|
|||||||
id="trade-good-til-time"
|
id="trade-good-til-time"
|
||||||
type={InputType.Number}
|
type={InputType.Number}
|
||||||
decimals={INTEGER_DECIMALS}
|
decimals={INTEGER_DECIMALS}
|
||||||
label={stringGetter({ key: STRING_KEYS.TIME })}
|
label={stringGetter({
|
||||||
|
key: hasTimeInForce ? STRING_KEYS.TIME : STRING_KEYS.GOOD_TIL_TIME,
|
||||||
|
})}
|
||||||
onChange={({ value }: NumberFormatValues) => {
|
onChange={({ value }: NumberFormatValues) => {
|
||||||
abacusStateManager.setTradeValue({
|
abacusStateManager.setTradeValue({
|
||||||
value: Number(value),
|
value: Number(value),
|
||||||
|
|||||||
@@ -153,9 +153,7 @@ export const MarketLeverageInput = ({
|
|||||||
value: MustBigNumber(leverageAmount).toFixed(LEVERAGE_DECIMALS),
|
value: MustBigNumber(leverageAmount).toFixed(LEVERAGE_DECIMALS),
|
||||||
}))}
|
}))}
|
||||||
value={MustBigNumber(formattedLeverageValue).abs().toFixed(LEVERAGE_DECIMALS)} // sign agnostic
|
value={MustBigNumber(formattedLeverageValue).abs().toFixed(LEVERAGE_DECIMALS)} // sign agnostic
|
||||||
onValueChange={(option?: number) =>
|
onValueChange={updateLeverage}
|
||||||
updateLeverage(option === undefined ? formattedLeverageValue : option)
|
|
||||||
}
|
|
||||||
shape={ButtonShape.Rectangle}
|
shape={ButtonShape.Rectangle}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -7,9 +7,8 @@ import { DialogTypes } from '@/constants/dialogs';
|
|||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { TRADE_TYPE_STRINGS, MobilePlaceOrderSteps } from '@/constants/trade';
|
import { TRADE_TYPE_STRINGS, MobilePlaceOrderSteps } from '@/constants/trade';
|
||||||
|
|
||||||
import { useStringGetter } from '@/hooks';
|
import { useStringGetter, useTokenConfigs } from '@/hooks';
|
||||||
|
|
||||||
import { AssetIcon } from '@/components/AssetIcon';
|
|
||||||
import { Button } from '@/components/Button';
|
import { Button } from '@/components/Button';
|
||||||
import { Output, OutputType, ShowSign } from '@/components/Output';
|
import { Output, OutputType, ShowSign } from '@/components/Output';
|
||||||
import { WithDetailsReceipt } from '@/components/WithDetailsReceipt';
|
import { WithDetailsReceipt } from '@/components/WithDetailsReceipt';
|
||||||
@@ -47,6 +46,7 @@ export const PlaceOrderButtonAndReceipt = ({
|
|||||||
}: ElementProps) => {
|
}: ElementProps) => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const { chainTokenLabel } = useTokenConfigs();
|
||||||
|
|
||||||
const canAccountTrade = useSelector(calculateCanAccountTrade);
|
const canAccountTrade = useSelector(calculateCanAccountTrade);
|
||||||
const subaccountNumber = useSelector(getSubaccountId);
|
const subaccountNumber = useSelector(getSubaccountId);
|
||||||
@@ -88,7 +88,14 @@ export const PlaceOrderButtonAndReceipt = ({
|
|||||||
{/* <AssetIcon symbol="DYDX" /> */}
|
{/* <AssetIcon symbol="DYDX" /> */}
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
value: <Output type={OutputType.Asset} value={reward} useGrouping tag={reward ? "Dv4TNT" : ''} />,
|
value: (
|
||||||
|
<Output
|
||||||
|
type={OutputType.Asset}
|
||||||
|
value={reward}
|
||||||
|
useGrouping
|
||||||
|
tag={reward ? chainTokenLabel : ''}
|
||||||
|
/>
|
||||||
|
),
|
||||||
tooltip: 'max-reward',
|
tooltip: 'max-reward',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -111,7 +118,7 @@ export const PlaceOrderButtonAndReceipt = ({
|
|||||||
? actionStringKey
|
? actionStringKey
|
||||||
: STRING_KEYS.UNAVAILABLE,
|
: STRING_KEYS.UNAVAILABLE,
|
||||||
buttonAction: ButtonAction.Primary,
|
buttonAction: ButtonAction.Primary,
|
||||||
buttonState: { isDisabled: !shouldEnableTrade },
|
buttonState: { isDisabled: !shouldEnableTrade, isLoading: hasMissingData },
|
||||||
},
|
},
|
||||||
|
|
||||||
[MobilePlaceOrderSteps.PreviewOrder]: {
|
[MobilePlaceOrderSteps.PreviewOrder]: {
|
||||||
@@ -148,7 +155,10 @@ export const PlaceOrderButtonAndReceipt = ({
|
|||||||
|
|
||||||
const buttonState = currentStep
|
const buttonState = currentStep
|
||||||
? buttonStatesPerStep[currentStep].buttonState
|
? buttonStatesPerStep[currentStep].buttonState
|
||||||
: { isDisabled: !shouldEnableTrade || isLoading, isLoading };
|
: {
|
||||||
|
isDisabled: !shouldEnableTrade || isLoading,
|
||||||
|
isLoading: isLoading || hasMissingData,
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<WithDetailsReceipt detailItems={items}>
|
<WithDetailsReceipt detailItems={items}>
|
||||||
|
|||||||
@@ -11,11 +11,7 @@ import { ButtonShape, ButtonSize } from '@/constants/buttons';
|
|||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
import { ENVIRONMENT_CONFIG_MAP } from '@/constants/networks';
|
||||||
import { NumberSign } from '@/constants/numbers';
|
import { NumberSign } from '@/constants/numbers';
|
||||||
import {
|
import { DydxChainAsset } from '@/constants/wallets';
|
||||||
DYDX_CHAIN_ASSET_COIN_DENOM,
|
|
||||||
DYDX_CHAIN_ASSET_TAGS,
|
|
||||||
DydxChainAsset,
|
|
||||||
} from '@/constants/wallets';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useAccountBalance,
|
useAccountBalance,
|
||||||
@@ -25,6 +21,7 @@ import {
|
|||||||
useSelectedNetwork,
|
useSelectedNetwork,
|
||||||
useStringGetter,
|
useStringGetter,
|
||||||
useSubaccount,
|
useSubaccount,
|
||||||
|
useTokenConfigs,
|
||||||
} from '@/hooks';
|
} from '@/hooks';
|
||||||
|
|
||||||
import { formMixins } from '@/styles/formMixins';
|
import { formMixins } from '@/styles/formMixins';
|
||||||
@@ -57,7 +54,7 @@ type TransferFormProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const TransferForm = ({
|
export const TransferForm = ({
|
||||||
selectedAsset = DydxChainAsset.DYDX,
|
selectedAsset = DydxChainAsset.CHAINTOKEN,
|
||||||
onDone,
|
onDone,
|
||||||
className,
|
className,
|
||||||
}: TransferFormProps) => {
|
}: TransferFormProps) => {
|
||||||
@@ -72,6 +69,7 @@ export const TransferForm = ({
|
|||||||
const { transfer } = useSubaccount();
|
const { transfer } = useSubaccount();
|
||||||
const { nativeTokenBalance, usdcBalance } = useAccountBalance();
|
const { nativeTokenBalance, usdcBalance } = useAccountBalance();
|
||||||
const { selectedNetwork } = useSelectedNetwork();
|
const { selectedNetwork } = useSelectedNetwork();
|
||||||
|
const { tokensConfigs, usdcLabel, chainTokenLabel } = useTokenConfigs();
|
||||||
|
|
||||||
// User Input
|
// User Input
|
||||||
const [asset, setAsset] = useState<DydxChainAsset>(selectedAsset);
|
const [asset, setAsset] = useState<DydxChainAsset>(selectedAsset);
|
||||||
@@ -138,7 +136,7 @@ export const TransferForm = ({
|
|||||||
try {
|
try {
|
||||||
// Subtract fees from amount if sending native tokens
|
// Subtract fees from amount if sending native tokens
|
||||||
const amountToTransfer = (
|
const amountToTransfer = (
|
||||||
asset === DydxChainAsset.DYDX ? amountBN.minus(fee) : amountBN
|
asset === DydxChainAsset.CHAINTOKEN ? amountBN.minus(fee) : amountBN
|
||||||
).toNumber();
|
).toNumber();
|
||||||
|
|
||||||
const screenResults = await screenAddresses({
|
const screenResults = await screenAddresses({
|
||||||
@@ -161,7 +159,7 @@ export const TransferForm = ({
|
|||||||
const txResponse = await transfer(
|
const txResponse = await transfer(
|
||||||
amountToTransfer,
|
amountToTransfer,
|
||||||
recipientAddress as string,
|
recipientAddress as string,
|
||||||
DYDX_CHAIN_ASSET_COIN_DENOM[asset]
|
tokensConfigs[asset].denom,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (txResponse?.code === 0) {
|
if (txResponse?.code === 0) {
|
||||||
@@ -220,16 +218,16 @@ export const TransferForm = ({
|
|||||||
value: DydxChainAsset.USDC,
|
value: DydxChainAsset.USDC,
|
||||||
label: (
|
label: (
|
||||||
<Styled.InlineRow>
|
<Styled.InlineRow>
|
||||||
<AssetIcon symbol="USDC" /> {DYDX_CHAIN_ASSET_TAGS[DydxChainAsset.USDC]}
|
<AssetIcon symbol="USDC" /> {usdcLabel}
|
||||||
</Styled.InlineRow>
|
</Styled.InlineRow>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
value: DydxChainAsset.DYDX,
|
value: DydxChainAsset.CHAINTOKEN,
|
||||||
label: (
|
label: (
|
||||||
<Styled.InlineRow>
|
<Styled.InlineRow>
|
||||||
{/* <AssetIcon symbol="DYDX" /> */}
|
{/* <AssetIcon symbol="DYDX" /> */}
|
||||||
{DYDX_CHAIN_ASSET_TAGS[DydxChainAsset.DYDX]}
|
{chainTokenLabel}
|
||||||
</Styled.InlineRow>
|
</Styled.InlineRow>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@@ -251,7 +249,7 @@ export const TransferForm = ({
|
|||||||
key: 'amount',
|
key: 'amount',
|
||||||
label: (
|
label: (
|
||||||
<span>
|
<span>
|
||||||
{stringGetter({ key: STRING_KEYS.AVAILABLE })} <Tag>{DYDX_CHAIN_ASSET_TAGS[asset]}</Tag>
|
{stringGetter({ key: STRING_KEYS.AVAILABLE })} <Tag>{tokensConfigs[asset].name}</Tag>
|
||||||
</span>
|
</span>
|
||||||
),
|
),
|
||||||
value: (
|
value: (
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ import { shallowEqual, useSelector } from 'react-redux';
|
|||||||
import { ButtonAction, ButtonSize, ButtonType } from '@/constants/buttons';
|
import { ButtonAction, ButtonSize, ButtonType } from '@/constants/buttons';
|
||||||
import { STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS } from '@/constants/localization';
|
||||||
import { NumberSign } from '@/constants/numbers';
|
import { NumberSign } from '@/constants/numbers';
|
||||||
import { DYDX_CHAIN_ASSET_TAGS, DydxChainAsset } from '@/constants/wallets';
|
import { DydxChainAsset } from '@/constants/wallets';
|
||||||
|
|
||||||
import { useAccountBalance, useStringGetter } from '@/hooks';
|
import { useAccountBalance, useTokenConfigs, useStringGetter } from '@/hooks';
|
||||||
|
|
||||||
import { Button } from '@/components/Button';
|
import { Button } from '@/components/Button';
|
||||||
import { DiffOutput } from '@/components/DiffOutput';
|
import { DiffOutput } from '@/components/DiffOutput';
|
||||||
@@ -37,6 +37,7 @@ export const TransferButtonAndReceipt = ({
|
|||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
const canAccountTrade = useSelector(calculateCanAccountTrade, shallowEqual);
|
const canAccountTrade = useSelector(calculateCanAccountTrade, shallowEqual);
|
||||||
const { size } = useSelector(getTransferInputs, shallowEqual) || {};
|
const { size } = useSelector(getTransferInputs, shallowEqual) || {};
|
||||||
|
const { tokensConfigs } = useTokenConfigs();
|
||||||
|
|
||||||
const { equity: equityInfo, leverage: leverageInfo } =
|
const { equity: equityInfo, leverage: leverageInfo } =
|
||||||
useSelector(getSubaccount, shallowEqual) || {};
|
useSelector(getSubaccount, shallowEqual) || {};
|
||||||
@@ -60,7 +61,7 @@ export const TransferButtonAndReceipt = ({
|
|||||||
key: 'fees',
|
key: 'fees',
|
||||||
label: (
|
label: (
|
||||||
<span>
|
<span>
|
||||||
{stringGetter({ key: STRING_KEYS.FEES })} <Tag>{DYDX_CHAIN_ASSET_TAGS[selectedAsset]}</Tag>
|
{stringGetter({ key: STRING_KEYS.FEES })} <Tag>{tokensConfigs[selectedAsset].name}</Tag>
|
||||||
</span>
|
</span>
|
||||||
),
|
),
|
||||||
value: <Output type={OutputType.Asset} value={fees} />,
|
value: <Output type={OutputType.Asset} value={fees} />,
|
||||||
@@ -69,7 +70,7 @@ export const TransferButtonAndReceipt = ({
|
|||||||
key: 'balance',
|
key: 'balance',
|
||||||
label: (
|
label: (
|
||||||
<span>
|
<span>
|
||||||
{stringGetter({ key: STRING_KEYS.BALANCE })} <Tag>{DYDX_CHAIN_ASSET_TAGS[selectedAsset]}</Tag>
|
{stringGetter({ key: STRING_KEYS.BALANCE })} <Tag>{tokensConfigs[selectedAsset].name}</Tag>
|
||||||
</span>
|
</span>
|
||||||
),
|
),
|
||||||
value: (
|
value: (
|
||||||
|
|||||||
@@ -9,7 +9,14 @@ import { DialogTypes } from '@/constants/dialogs';
|
|||||||
import { STRING_KEYS, TOOLTIP_STRING_KEYS } from '@/constants/localization';
|
import { STRING_KEYS, TOOLTIP_STRING_KEYS } from '@/constants/localization';
|
||||||
import { DydxChainAsset, wallets } from '@/constants/wallets';
|
import { DydxChainAsset, wallets } from '@/constants/wallets';
|
||||||
|
|
||||||
import { useAccounts, useBreakpoints, useStringGetter, useAccountBalance } from '@/hooks';
|
import {
|
||||||
|
useAccounts,
|
||||||
|
useBreakpoints,
|
||||||
|
useTokenConfigs,
|
||||||
|
useStringGetter,
|
||||||
|
useAccountBalance,
|
||||||
|
useURLConfigs,
|
||||||
|
} from '@/hooks';
|
||||||
|
|
||||||
import { OnboardingTriggerButton } from '@/views/dialogs/OnboardingTriggerButton';
|
import { OnboardingTriggerButton } from '@/views/dialogs/OnboardingTriggerButton';
|
||||||
|
|
||||||
@@ -29,19 +36,22 @@ import { truncateAddress } from '@/lib/wallet';
|
|||||||
|
|
||||||
import { layoutMixins } from '@/styles/layoutMixins';
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
import { headerMixins } from '@/styles/headerMixins';
|
import { headerMixins } from '@/styles/headerMixins';
|
||||||
|
import { MustBigNumber } from '@/lib/numbers';
|
||||||
const explorerBaseUri = 'https://testnet.mintscan.io/dydx-testnet';
|
|
||||||
|
|
||||||
export const AccountMenu = () => {
|
export const AccountMenu = () => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
|
const { mintscanBase } = useURLConfigs();
|
||||||
const { isTablet } = useBreakpoints();
|
const { isTablet } = useBreakpoints();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const onboardingState = useSelector(getOnboardingState);
|
const onboardingState = useSelector(getOnboardingState);
|
||||||
const { freeCollateral } = useSelector(getSubaccount, shallowEqual) || {};
|
const { freeCollateral } = useSelector(getSubaccount, shallowEqual) || {};
|
||||||
const { nativeTokenBalance } = useAccountBalance();
|
const { nativeTokenBalance } = useAccountBalance();
|
||||||
|
const { usdcLabel, chainTokenLabel } = useTokenConfigs();
|
||||||
|
|
||||||
const { evmAddress, walletType, dydxAddress, hdKey } = useAccounts();
|
const { evmAddress, walletType, dydxAddress, hdKey } = useAccounts();
|
||||||
|
|
||||||
|
const usdcBalance = freeCollateral?.current || 0;
|
||||||
|
|
||||||
const onRecoverKeys = () => {
|
const onRecoverKeys = () => {
|
||||||
dispatch(openDialog({ type: DialogTypes.Onboarding }));
|
dispatch(openDialog({ type: DialogTypes.Onboarding }));
|
||||||
};
|
};
|
||||||
@@ -85,7 +95,7 @@ export const AccountMenu = () => {
|
|||||||
/>
|
/>
|
||||||
<IconButton
|
<IconButton
|
||||||
action={ButtonAction.Base}
|
action={ButtonAction.Base}
|
||||||
href={`${explorerBaseUri}/account/${dydxAddress}`}
|
href={`${mintscanBase}/account/${dydxAddress}`}
|
||||||
iconName={IconName.LinkOut}
|
iconName={IconName.LinkOut}
|
||||||
shape={ButtonShape.Square}
|
shape={ButtonShape.Square}
|
||||||
type={ButtonType.Link}
|
type={ButtonType.Link}
|
||||||
@@ -107,26 +117,41 @@ export const AccountMenu = () => {
|
|||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<Styled.label>
|
<Styled.label>
|
||||||
{stringGetter({ key: STRING_KEYS.ASSET_BALANCE, params: { ASSET: 'Dv4TNT' } })}
|
{stringGetter({
|
||||||
|
key: STRING_KEYS.ASSET_BALANCE,
|
||||||
|
params: { ASSET: chainTokenLabel },
|
||||||
|
})}
|
||||||
{/* <AssetIcon symbol="DYDX" /> */}
|
{/* <AssetIcon symbol="DYDX" /> */}
|
||||||
</Styled.label>
|
</Styled.label>
|
||||||
<Styled.BalanceOutput type={OutputType.Asset} value={nativeTokenBalance} />
|
<Styled.BalanceOutput type={OutputType.Asset} value={nativeTokenBalance} />
|
||||||
</div>
|
</div>
|
||||||
<AssetActions asset={DydxChainAsset.DYDX} dispatch={dispatch} />
|
<AssetActions
|
||||||
|
asset={DydxChainAsset.CHAINTOKEN}
|
||||||
|
dispatch={dispatch}
|
||||||
|
hasBalance={nativeTokenBalance.gt(0)}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<Styled.label>
|
<Styled.label>
|
||||||
{stringGetter({ key: STRING_KEYS.ASSET_BALANCE, params: { ASSET: 'USDC' } })}
|
{stringGetter({
|
||||||
|
key: STRING_KEYS.ASSET_BALANCE,
|
||||||
|
params: { ASSET: usdcLabel },
|
||||||
|
})}
|
||||||
<AssetIcon symbol="USDC" />
|
<AssetIcon symbol="USDC" />
|
||||||
</Styled.label>
|
</Styled.label>
|
||||||
<Styled.BalanceOutput
|
<Styled.BalanceOutput
|
||||||
type={OutputType.Asset}
|
type={OutputType.Asset}
|
||||||
value={freeCollateral?.current || 0}
|
value={usdcBalance}
|
||||||
fractionDigits={2}
|
fractionDigits={2}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<AssetActions asset={DydxChainAsset.USDC} dispatch={dispatch} />
|
<AssetActions
|
||||||
|
asset={DydxChainAsset.USDC}
|
||||||
|
dispatch={dispatch}
|
||||||
|
hasBalance={MustBigNumber(usdcBalance).gt(0)}
|
||||||
|
withOnboarding
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</Styled.Balances>
|
</Styled.Balances>
|
||||||
</Styled.AccountInfo>
|
</Styled.AccountInfo>
|
||||||
@@ -154,7 +179,7 @@ export const AccountMenu = () => {
|
|||||||
// value: 'ViewInExplorer',
|
// value: 'ViewInExplorer',
|
||||||
// icon: <Icon iconName={IconName.Etherscan} />,
|
// icon: <Icon iconName={IconName.Etherscan} />,
|
||||||
// label: stringGetter({ key: STRING_KEYS.OPEN_IN_ETHERSCAN }),
|
// label: stringGetter({ key: STRING_KEYS.OPEN_IN_ETHERSCAN }),
|
||||||
// onSelect: () => globalThis.open(`${explorerBaseUri}/address/${address}`),
|
// onSelect: () => globalThis.open(`${mintscanBase}/address/${address}`),
|
||||||
// separator: true,
|
// separator: true,
|
||||||
// },
|
// },
|
||||||
...(onboardingState === OnboardingState.AccountConnected && hdKey
|
...(onboardingState === OnboardingState.AccountConnected && hdKey
|
||||||
@@ -199,28 +224,48 @@ export const AccountMenu = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const AssetActions = memo(({ asset, dispatch }: { asset: DydxChainAsset; dispatch: Dispatch }) => (
|
const AssetActions = memo(
|
||||||
|
({
|
||||||
|
asset,
|
||||||
|
dispatch,
|
||||||
|
withOnboarding,
|
||||||
|
hasBalance,
|
||||||
|
}: {
|
||||||
|
asset: DydxChainAsset;
|
||||||
|
dispatch: Dispatch;
|
||||||
|
withOnboarding?: boolean;
|
||||||
|
hasBalance?: boolean;
|
||||||
|
}) => (
|
||||||
<Styled.InlineRow>
|
<Styled.InlineRow>
|
||||||
{[
|
{[
|
||||||
// TODO(@rosepuppy): Add withdraw action for USDC
|
withOnboarding &&
|
||||||
{
|
hasBalance && {
|
||||||
dialogType: DialogTypes.Receive,
|
dialogType: DialogTypes.Withdraw,
|
||||||
iconName: IconName.Qr,
|
iconName: IconName.Withdraw,
|
||||||
},
|
},
|
||||||
{ dialogType: DialogTypes.Transfer, iconName: IconName.Send },
|
withOnboarding && {
|
||||||
].map(({ iconName, dialogType }) => (
|
dialogType: DialogTypes.Deposit,
|
||||||
<IconButton
|
iconName: IconName.Deposit,
|
||||||
|
},
|
||||||
|
hasBalance && {
|
||||||
|
dialogType: DialogTypes.Transfer,
|
||||||
|
dialogProps: { selectedAsset: asset },
|
||||||
|
iconName: IconName.Send,
|
||||||
|
},
|
||||||
|
]
|
||||||
|
.filter(isTruthy)
|
||||||
|
.map(({ iconName, dialogType, dialogProps }) => (
|
||||||
|
<Styled.IconButton
|
||||||
key={dialogType}
|
key={dialogType}
|
||||||
action={ButtonAction.Base}
|
action={ButtonAction.Base}
|
||||||
shape={ButtonShape.Square}
|
shape={ButtonShape.Square}
|
||||||
iconName={iconName}
|
iconName={iconName}
|
||||||
onClick={() =>
|
onClick={() => dispatch(openDialog({ type: dialogType, dialogProps }))}
|
||||||
dispatch(openDialog({ type: dialogType, dialogProps: { selectedAsset: asset } }))
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Styled.InlineRow>
|
</Styled.InlineRow>
|
||||||
));
|
)
|
||||||
|
);
|
||||||
|
|
||||||
const Styled: Record<string, AnyStyledComponent> = {};
|
const Styled: Record<string, AnyStyledComponent> = {};
|
||||||
|
|
||||||
@@ -338,3 +383,7 @@ Styled.ConnectToChain = styled(Styled.Column)`
|
|||||||
font: var(--font-small-book);
|
font: var(--font-small-book);
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
Styled.IconButton = styled(IconButton)`
|
||||||
|
--button-padding: 0 0.25rem;
|
||||||
|
`;
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { layoutMixins } from '@/styles/layoutMixins';
|
||||||
import { groupBy } from 'lodash';
|
import { groupBy } from 'lodash';
|
||||||
|
|
||||||
import { type Notification, NotificationStatus } from '@/constants/notifications';
|
import { type Notification, NotificationStatus } from '@/constants/notifications';
|
||||||
|
|
||||||
|
import { useBreakpoints } 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,10 +16,6 @@ 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';
|
|
||||||
|
|
||||||
type ElementProps = {
|
type ElementProps = {
|
||||||
slotTrigger?: React.ReactNode;
|
slotTrigger?: React.ReactNode;
|
||||||
@@ -27,6 +26,7 @@ export const NotificationsMenu = ({
|
|||||||
slotTrigger,
|
slotTrigger,
|
||||||
placement = DialogPlacement.Sidebar,
|
placement = DialogPlacement.Sidebar,
|
||||||
}: ElementProps) => {
|
}: ElementProps) => {
|
||||||
|
const { isTablet } = useBreakpoints();
|
||||||
const {
|
const {
|
||||||
notifications,
|
notifications,
|
||||||
getDisplayData,
|
getDisplayData,
|
||||||
@@ -173,15 +173,17 @@ export const NotificationsMenu = ({
|
|||||||
</$FooterToolbar>
|
</$FooterToolbar>
|
||||||
}
|
}
|
||||||
placement={placement}
|
placement={placement}
|
||||||
|
preventClose={isTablet}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const $UnreadIndicator = styled.div`
|
const $UnreadIndicator = styled.div`
|
||||||
width: 0.5em;
|
width: 0.5rem;
|
||||||
height: 0.5em;
|
height: 0.5rem;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
background-color: var(--color-accent);
|
background-color: var(--color-accent);
|
||||||
|
border: 1px solid var(--color-layer-2);
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const $TriggerContainer = styled.div`
|
const $TriggerContainer = styled.div`
|
||||||
@@ -192,8 +194,8 @@ const $TriggerUnreadIndicator = styled($UnreadIndicator)`
|
|||||||
place-self: center;
|
place-self: center;
|
||||||
|
|
||||||
position: relative;
|
position: relative;
|
||||||
right: -0.425em;
|
right: -0.2rem;
|
||||||
top: -0.425em;
|
top: -0.325rem;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const $Output = styled(Output)`
|
const $Output = styled(Output)`
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ const getFillsTableColumnDef = ({
|
|||||||
}[orderSide],
|
}[orderSide],
|
||||||
})}
|
})}
|
||||||
</Styled.Side>
|
</Styled.Side>
|
||||||
<Output type={OutputType.Text} value={asset.id} />
|
<Output type={OutputType.Text} value={asset?.id} />
|
||||||
</Styled.TableCell>
|
</Styled.TableCell>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ const getOrdersTableColumnDef = ({
|
|||||||
key: STRING_KEYS.FILL,
|
key: STRING_KEYS.FILL,
|
||||||
})}`,
|
})}`,
|
||||||
renderCell: ({
|
renderCell: ({
|
||||||
asset: { symbol: assetSymbol },
|
asset,
|
||||||
createdAtMilliseconds,
|
createdAtMilliseconds,
|
||||||
size,
|
size,
|
||||||
status,
|
status,
|
||||||
@@ -254,7 +254,7 @@ const getOrdersTableColumnDef = ({
|
|||||||
value={createdAtMilliseconds}
|
value={createdAtMilliseconds}
|
||||||
/>
|
/>
|
||||||
<Styled.AssetIconWithStatus>
|
<Styled.AssetIconWithStatus>
|
||||||
<Styled.AssetIcon symbol={assetSymbol} />
|
<Styled.AssetIcon symbol={asset?.id} />
|
||||||
<Styled.StatusDot color={statusIconColor} />
|
<Styled.StatusDot color={statusIconColor} />
|
||||||
</Styled.AssetIconWithStatus>
|
</Styled.AssetIconWithStatus>
|
||||||
</>
|
</>
|
||||||
@@ -276,7 +276,7 @@ const getOrdersTableColumnDef = ({
|
|||||||
type={OutputType.Asset}
|
type={OutputType.Asset}
|
||||||
value={size}
|
value={size}
|
||||||
fractionDigits={TOKEN_DECIMALS}
|
fractionDigits={TOKEN_DECIMALS}
|
||||||
tag={assetSymbol}
|
tag={asset?.id}
|
||||||
/>
|
/>
|
||||||
</Styled.InlineRow>
|
</Styled.InlineRow>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
|
|||||||