Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0a00acdc6 | ||
|
|
c40f5eb549 | ||
|
|
d53e8f693e | ||
|
|
f9e301b3f0 | ||
|
|
67ecbd75b4 |
@@ -33,11 +33,13 @@ jobs:
|
|||||||
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
|
AMPLITUDE_API_KEY: ${{ secrets.AMPLITUDE_API_KEY }}
|
||||||
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
|
BUGSNAG_API_KEY: ${{ secrets.BUGSNAG_API_KEY }}
|
||||||
STATUS_PAGE_SCRIPT_URI: ${{ secrets.STATUS_PAGE_SCRIPT_URI }}
|
STATUS_PAGE_SCRIPT_URI: ${{ secrets.STATUS_PAGE_SCRIPT_URI }}
|
||||||
|
IOS_APP_ID: ${{ secrets.IOS_APP_ID }}
|
||||||
run: |
|
run: |
|
||||||
pnpm run build
|
pnpm run build
|
||||||
pnpm run build:inject-amplitude
|
pnpm run build:inject-amplitude
|
||||||
pnpm run build:inject-bugsnag
|
pnpm run build:inject-bugsnag
|
||||||
pnpm run build:inject-statuspage
|
pnpm run build:inject-statuspage
|
||||||
|
sh scripts/inject-app-deeplinks.sh
|
||||||
|
|
||||||
- name: Upload to IPFS via web3.storage
|
- name: Upload to IPFS via web3.storage
|
||||||
uses: dydxprotocol/add-to-web3@v1
|
uses: dydxprotocol/add-to-web3@v1
|
||||||
|
|||||||
+2
-1
@@ -10,6 +10,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
|
"build:inject-app-deeplinks": "sh scripts/inject-app-deeplinks.sh",
|
||||||
"build:inject-amplitude": "node scripts/inject-amplitude.js",
|
"build:inject-amplitude": "node scripts/inject-amplitude.js",
|
||||||
"build:inject-bugsnag": "node scripts/inject-bugsnag.js",
|
"build:inject-bugsnag": "node scripts/inject-bugsnag.js",
|
||||||
"build:inject-statuspage": "node scripts/inject-statuspage.js",
|
"build:inject-statuspage": "node scripts/inject-statuspage.js",
|
||||||
@@ -39,7 +40,7 @@
|
|||||||
"@cosmjs/tendermint-rpc": "^0.31.0",
|
"@cosmjs/tendermint-rpc": "^0.31.0",
|
||||||
"@dydxprotocol/v4-abacus": "^0.6.4",
|
"@dydxprotocol/v4-abacus": "^0.6.4",
|
||||||
"@dydxprotocol/v4-client-js": "^0.36.1",
|
"@dydxprotocol/v4-client-js": "^0.36.1",
|
||||||
"@dydxprotocol/v4-localization": "^0.1.24",
|
"@dydxprotocol/v4-localization": "^0.1.28",
|
||||||
"@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",
|
||||||
|
|||||||
Generated
+8
-8
@@ -1,9 +1,5 @@
|
|||||||
lockfileVersion: '6.0'
|
lockfileVersion: '6.0'
|
||||||
|
|
||||||
settings:
|
|
||||||
autoInstallPeers: true
|
|
||||||
excludeLinksFromLockfile: false
|
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
'@0xsquid/sdk':
|
'@0xsquid/sdk':
|
||||||
specifier: ^1.10.0
|
specifier: ^1.10.0
|
||||||
@@ -33,8 +29,8 @@ dependencies:
|
|||||||
specifier: ^0.36.1
|
specifier: ^0.36.1
|
||||||
version: 0.36.1
|
version: 0.36.1
|
||||||
'@dydxprotocol/v4-localization':
|
'@dydxprotocol/v4-localization':
|
||||||
specifier: ^0.1.24
|
specifier: ^0.1.28
|
||||||
version: 0.1.24
|
version: 0.1.28
|
||||||
'@ethersproject/providers':
|
'@ethersproject/providers':
|
||||||
specifier: ^5.7.2
|
specifier: ^5.7.2
|
||||||
version: 5.7.2
|
version: 5.7.2
|
||||||
@@ -1010,8 +1006,8 @@ packages:
|
|||||||
- utf-8-validate
|
- utf-8-validate
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@dydxprotocol/v4-localization@0.1.24:
|
/@dydxprotocol/v4-localization@0.1.28:
|
||||||
resolution: {integrity: sha512-zSiu8+/6BWNWZXxe73zUp/UjuLG1Cp5UuhXKtbATqqkeZyVCs01QxbBCTs1MLfgsLh02IrfhXCPHvXnzZyReEw==}
|
resolution: {integrity: sha512-g6LwjX7EIRm9HISfSX0H6yhktBCZby5opP/yI2aIUvn2OYyB25WcjLEuEvzW5Bh9XXiLijgLf3Tk91wPKWuFbA==}
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
/@dydxprotocol/v4-proto@0.2.1:
|
/@dydxprotocol/v4-proto@0.2.1:
|
||||||
@@ -14099,3 +14095,7 @@ packages:
|
|||||||
/zwitch@2.0.4:
|
/zwitch@2.0.4:
|
||||||
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
|
resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
|
settings:
|
||||||
|
autoInstallPeers: true
|
||||||
|
excludeLinksFromLockfile: false
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
+22
-9
@@ -45,6 +45,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -103,6 +104,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -160,6 +162,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -217,6 +220,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -274,6 +278,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -288,7 +293,7 @@
|
|||||||
"validators": [
|
"validators": [
|
||||||
"https://validator.v4staging.dydx.exchange"
|
"https://validator.v4staging.dydx.exchange"
|
||||||
],
|
],
|
||||||
"0xsquid": "https://squid-api-git-main-cosmos-testnet-0xsquid.vercel.app"
|
"0xsquid": "https://testnet.api.squidrouter.com"
|
||||||
},
|
},
|
||||||
"links": {
|
"links": {
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
"tos": "https://dydx.exchange/v4-terms",
|
||||||
@@ -322,7 +327,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dydxprotocol-staging-west": {
|
"dydxprotocol-staging-west": {
|
||||||
"name": "v4 Staging",
|
"name": "v4 Staging West",
|
||||||
"ethereumChainId": "5",
|
"ethereumChainId": "5",
|
||||||
"dydxChainId": "dydxprotocol-testnet",
|
"dydxChainId": "dydxprotocol-testnet",
|
||||||
"isMainNet": false,
|
"isMainNet": false,
|
||||||
@@ -335,6 +340,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -349,7 +355,7 @@
|
|||||||
"validators": [
|
"validators": [
|
||||||
"https://validator-uswest1.v4staging.dydx.exchange"
|
"https://validator-uswest1.v4staging.dydx.exchange"
|
||||||
],
|
],
|
||||||
"0xsquid": "https://squid-api-git-main-cosmos-testnet-0xsquid.vercel.app"
|
"0xsquid": "https://testnet.api.squidrouter.com"
|
||||||
},
|
},
|
||||||
"links": {
|
"links": {
|
||||||
"tos": "https://dydx.exchange/v4-terms",
|
"tos": "https://dydx.exchange/v4-terms",
|
||||||
@@ -396,6 +402,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -411,7 +418,7 @@
|
|||||||
"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"
|
||||||
],
|
],
|
||||||
"0xsquid": "https://squid-api-git-main-cosmos-testnet-0xsquid.vercel.app",
|
"0xsquid": "https://testnet.api.squidrouter.com",
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
||||||
},
|
},
|
||||||
"links": {
|
"links": {
|
||||||
@@ -459,6 +466,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -472,7 +480,7 @@
|
|||||||
"validators": [
|
"validators": [
|
||||||
"https://validator.v4testnet.dydx.exchange"
|
"https://validator.v4testnet.dydx.exchange"
|
||||||
],
|
],
|
||||||
"0xsquid": "https://squid-api-git-main-cosmos-testnet-0xsquid.vercel.app",
|
"0xsquid": "https://testnet.api.squidrouter.com",
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
||||||
},
|
},
|
||||||
"links": {
|
"links": {
|
||||||
@@ -521,6 +529,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -534,7 +543,7 @@
|
|||||||
"validators": [
|
"validators": [
|
||||||
"https://dydx-testnet-archive.allthatnode.com:26657/XZvMM41hESf8PJrEQiTzbCOMVyFca79R"
|
"https://dydx-testnet-archive.allthatnode.com:26657/XZvMM41hESf8PJrEQiTzbCOMVyFca79R"
|
||||||
],
|
],
|
||||||
"0xsquid": "https://squid-api-git-main-cosmos-testnet-0xsquid.vercel.app",
|
"0xsquid": "https://testnet.api.squidrouter.com",
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
||||||
},
|
},
|
||||||
"links": {
|
"links": {
|
||||||
@@ -583,6 +592,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -596,7 +606,7 @@
|
|||||||
"validators": [
|
"validators": [
|
||||||
"https://dydx-testnet.nodefleet.org"
|
"https://dydx-testnet.nodefleet.org"
|
||||||
],
|
],
|
||||||
"0xsquid": "https://squid-api-git-main-cosmos-testnet-0xsquid.vercel.app",
|
"0xsquid": "https://testnet.api.squidrouter.com",
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
||||||
},
|
},
|
||||||
"links": {
|
"links": {
|
||||||
@@ -645,6 +655,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -658,7 +669,7 @@
|
|||||||
"validators": [
|
"validators": [
|
||||||
"https://test-dydx.kingnodes.com"
|
"https://test-dydx.kingnodes.com"
|
||||||
],
|
],
|
||||||
"0xsquid": "https://squid-api-git-main-cosmos-testnet-0xsquid.vercel.app",
|
"0xsquid": "https://testnet.api.squidrouter.com",
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
||||||
},
|
},
|
||||||
"links": {
|
"links": {
|
||||||
@@ -707,6 +718,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -720,7 +732,7 @@
|
|||||||
"validators": [
|
"validators": [
|
||||||
"https://dydx-rpc.liquify.com/api=8878132/dydx"
|
"https://dydx-rpc.liquify.com/api=8878132/dydx"
|
||||||
],
|
],
|
||||||
"0xsquid": "https://squid-api-git-main-cosmos-testnet-0xsquid.vercel.app",
|
"0xsquid": "https://testnet.api.squidrouter.com",
|
||||||
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
"faucet": "https://faucet.v4testnet.dydx.exchange"
|
||||||
},
|
},
|
||||||
"links": {
|
"links": {
|
||||||
@@ -770,6 +782,7 @@
|
|||||||
"usdc": {
|
"usdc": {
|
||||||
"name": "USDC",
|
"name": "USDC",
|
||||||
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
"denom": "ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
|
||||||
|
"gasDenom": "uusdc",
|
||||||
"image": "/currencies/usdc.png"
|
"image": "/currencies/usdc.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Executable
+19
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
source="dist/.well-known/apple-app-site-association"
|
||||||
|
if [ ! -f "$source" ]; then
|
||||||
|
echo "Error: $source file not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
app_id=$IOS_APP_ID
|
||||||
|
if [ -z "$app_id" ]; then
|
||||||
|
echo "Error: IOS_APP_ID is empty"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
sed -i '' "s/{PLACE_YOUR_APP_ID_HERE}/$app_id/g" $source
|
||||||
|
else
|
||||||
|
sed -i "s/{PLACE_YOUR_APP_ID_HERE}/$app_id/g" $source
|
||||||
|
fi
|
||||||
@@ -8,5 +8,5 @@ export const AVAILABLE_ENVIRONMENTS =
|
|||||||
|
|
||||||
export const CURRENT_ABACUS_DEPLOYMENT = import.meta.env.MODE === 'production' ? 'TESTNET' : 'DEV';
|
export const CURRENT_ABACUS_DEPLOYMENT = import.meta.env.MODE === 'production' ? 'TESTNET' : 'DEV';
|
||||||
export const ENVIRONMENT_CONFIG_MAP = environments.environments;
|
export const ENVIRONMENT_CONFIG_MAP = environments.environments;
|
||||||
export type DydxNetwork = keyof typeof ENVIRONMENT_CONFIG_MAP;
|
export type DydxNetwork = (typeof AVAILABLE_ENVIRONMENTS.environments)[number];
|
||||||
export const DEFAULT_APP_ENVIRONMENT = AVAILABLE_ENVIRONMENTS.default as DydxNetwork;
|
export const DEFAULT_APP_ENVIRONMENT = AVAILABLE_ENVIRONMENTS.default as DydxNetwork;
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { useLocalStorage } from '@/hooks';
|
|||||||
import { initializeLocalization } from '@/state/app';
|
import { initializeLocalization } from '@/state/app';
|
||||||
|
|
||||||
import abacusStateManager from '@/lib/abacus';
|
import abacusStateManager from '@/lib/abacus';
|
||||||
|
import { validateAgainstAvailableEnvironments } from '@/lib/network';
|
||||||
|
|
||||||
export const useInitializePage = () => {
|
export const useInitializePage = () => {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -18,6 +19,7 @@ export const useInitializePage = () => {
|
|||||||
const [localStorageNetwork] = useLocalStorage<DydxNetwork>({
|
const [localStorageNetwork] = useLocalStorage<DydxNetwork>({
|
||||||
key: LocalStorageKey.SelectedNetwork,
|
key: LocalStorageKey.SelectedNetwork,
|
||||||
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
||||||
|
validateFn: validateAgainstAvailableEnvironments,
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ 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 { validateAgainstAvailableEnvironments } from '@/lib/network';
|
||||||
|
|
||||||
export const useSelectedNetwork = (): {
|
export const useSelectedNetwork = (): {
|
||||||
switchNetwork: (network: DydxNetwork) => void;
|
switchNetwork: (network: DydxNetwork) => void;
|
||||||
selectedNetwork: DydxNetwork;
|
selectedNetwork: DydxNetwork;
|
||||||
@@ -20,6 +22,7 @@ export const useSelectedNetwork = (): {
|
|||||||
const [, setLocalStorageNetwork] = useLocalStorage<DydxNetwork>({
|
const [, setLocalStorageNetwork] = useLocalStorage<DydxNetwork>({
|
||||||
key: LocalStorageKey.SelectedNetwork,
|
key: LocalStorageKey.SelectedNetwork,
|
||||||
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
||||||
|
validateFn: validateAgainstAvailableEnvironments,
|
||||||
});
|
});
|
||||||
|
|
||||||
const switchNetwork = useCallback(
|
const switchNetwork = useCallback(
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
import environments from '../../../public/configs/env.json';
|
||||||
|
|
||||||
|
import { validateAgainstAvailableEnvironments } from '../network';
|
||||||
|
|
||||||
|
describe('validateAgainstAvailableEnvironments', () => {
|
||||||
|
describe('production environment', () => {
|
||||||
|
beforeAll(() => {
|
||||||
|
jest.mock('../../constants/networks', () => ({
|
||||||
|
AVAILABLE_ENVIRONMENTS: {
|
||||||
|
environments: [],
|
||||||
|
default: 'dydxprotocol-testnet-dydx',
|
||||||
|
}, //environments.deployments.TESTNET,
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
afterAll(() => {
|
||||||
|
jest.unmock('../../constants/networks');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Returns true for valid environments', () => {
|
||||||
|
expect(validateAgainstAvailableEnvironments('dydxprotocol-testnet-dydx')).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Returns false for invalid environments', () => {
|
||||||
|
expect(validateAgainstAvailableEnvironments('dydxprotocol-dev')).toEqual(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('staging environment', () => {
|
||||||
|
it('Returns true for valid environments', () => {
|
||||||
|
expect(validateAgainstAvailableEnvironments('dydxprotocol-dev')).toEqual(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Returns false for invalid environments', () => {
|
||||||
|
expect(validateAgainstAvailableEnvironments('INVALID')).toEqual(false);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -45,11 +45,15 @@ describe('getStringsForDateTimeDiff', () => {
|
|||||||
|
|
||||||
describe('getStringsForTimeInterval', () => {
|
describe('getStringsForTimeInterval', () => {
|
||||||
it.each([
|
it.each([
|
||||||
[Duration.fromObject({ months: 2 }), '2', 'MONTHS_ABBREVIATED'],
|
[Duration.fromObject({ months: 2 }), '2', 'APP.GENERAL.TIME_STRINGS.MONTHS_ABBREVIATED'],
|
||||||
[Duration.fromObject({ weeks: 3, days: 2 }), '3', 'WEEKS_ABBREVIATED'],
|
[Duration.fromObject({ weeks: 3, days: 2 }), '3', 'APP.GENERAL.TIME_STRINGS.WEEKS_ABBREVIATED'],
|
||||||
[Duration.fromObject({ days: 5, hours: 12 }), '6', 'DAYS_ABBREVIATED'],
|
[Duration.fromObject({ days: 5, hours: 12 }), '6', 'APP.GENERAL.TIME_STRINGS.DAYS_ABBREVIATED'],
|
||||||
[Duration.fromObject({ hours: 8, minutes: 30 }), '9', 'HOURS_ABBREVIATED'],
|
[
|
||||||
[Duration.fromObject({ minutes: 45 }), '45', 'MINUTES_ABBREVIATED'],
|
Duration.fromObject({ hours: 8, minutes: 30 }),
|
||||||
|
'9',
|
||||||
|
'APP.GENERAL.TIME_STRINGS.HOURS_ABBREVIATED',
|
||||||
|
],
|
||||||
|
[Duration.fromObject({ minutes: 45 }), '45', 'APP.GENERAL.TIME_STRINGS.MINUTES_ABBREVIATED'],
|
||||||
])(
|
])(
|
||||||
'returns the correct timeString and unitStringKey',
|
'returns the correct timeString and unitStringKey',
|
||||||
(timeInterval, expectedTimeString, expectedUnitStringKey) => {
|
(timeInterval, expectedTimeString, expectedUnitStringKey) => {
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
import { AVAILABLE_ENVIRONMENTS, type DydxNetwork } from '@/constants/networks';
|
||||||
|
|
||||||
|
export const validateAgainstAvailableEnvironments = (value: DydxNetwork) =>
|
||||||
|
AVAILABLE_ENVIRONMENTS.environments.includes(value);
|
||||||
@@ -10,7 +10,7 @@ export const getTimestamp = (value?: BigNumberish | null) =>
|
|||||||
? value
|
? value
|
||||||
: typeof value === 'string'
|
: typeof value === 'string'
|
||||||
? new Date(value).getTime()
|
? new Date(value).getTime()
|
||||||
: new Date(value.toString()).getTime()
|
: new Date(value.toNumber()).getTime()
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
export const getStringsForDateTimeDiff = (dateTime: DateTime) => {
|
export const getStringsForDateTimeDiff = (dateTime: DateTime) => {
|
||||||
@@ -77,4 +77,4 @@ export const formatSeconds = (seconds: number) => {
|
|||||||
const minutes = Math.floor(seconds / 60);
|
const minutes = Math.floor(seconds / 60);
|
||||||
const remainingSeconds = seconds % 60;
|
const remainingSeconds = seconds % 60;
|
||||||
return `${getTimeString(minutes)}:${getTimeString(remainingSeconds)}`;
|
return `${getTimeString(minutes)}:${getTimeString(remainingSeconds)}`;
|
||||||
}
|
};
|
||||||
|
|||||||
+2
-3
@@ -100,11 +100,10 @@ const walletconnect2ConnectorOptions: ConstructorParameters<typeof WalletConnect
|
|||||||
options: {
|
options: {
|
||||||
projectId: import.meta.env.VITE_WALLETCONNECT2_PROJECT_ID,
|
projectId: import.meta.env.VITE_WALLETCONNECT2_PROJECT_ID,
|
||||||
metadata: {
|
metadata: {
|
||||||
// TODO: update to local URLs/images
|
|
||||||
name: 'dYdX',
|
name: 'dYdX',
|
||||||
description: '',
|
description: '',
|
||||||
url: 'https://trade.dydx.exchange',
|
url: import.meta.env.VITE_BASE_URL,
|
||||||
icons: ['https://trade.dydx.exchange/cbw-image.png'],
|
icons: [`${import.meta.env.VITE_BASE_URL}/cbw-image.png}`],
|
||||||
},
|
},
|
||||||
showQrModal: true,
|
showQrModal: true,
|
||||||
qrModalOptions: {
|
qrModalOptions: {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { LocalStorageKey } from '@/constants/localStorage';
|
|||||||
import { DEFAULT_APP_ENVIRONMENT, type DydxNetwork } from '@/constants/networks';
|
import { DEFAULT_APP_ENVIRONMENT, type DydxNetwork } from '@/constants/networks';
|
||||||
|
|
||||||
import { getLocalStorage } from '@/lib/localStorage';
|
import { getLocalStorage } from '@/lib/localStorage';
|
||||||
|
import { validateAgainstAvailableEnvironments } from '@/lib/network';
|
||||||
|
|
||||||
export interface AppState {
|
export interface AppState {
|
||||||
apiState: AbacusApiState | undefined;
|
apiState: AbacusApiState | undefined;
|
||||||
@@ -19,6 +20,7 @@ const initialState: AppState = {
|
|||||||
selectedNetwork: getLocalStorage({
|
selectedNetwork: getLocalStorage({
|
||||||
key: LocalStorageKey.SelectedNetwork,
|
key: LocalStorageKey.SelectedNetwork,
|
||||||
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
defaultValue: DEFAULT_APP_ENVIRONMENT,
|
||||||
|
validateFn: validateAgainstAvailableEnvironments,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ export const DisconnectDialog = ({ setIsOpen }: ElementProps) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog isOpen setIsOpen={setIsOpen} title="Disconnect">
|
<Dialog isOpen setIsOpen={setIsOpen} title={stringGetter({ key: STRING_KEYS.DISCONNECT })}>
|
||||||
<Styled.Content>
|
<Styled.Content>
|
||||||
<p>Are you sure you want to disconnect your account?</p>
|
<p>{stringGetter({ key: STRING_KEYS.DISCONNECT_CONFIRMATION })}</p>
|
||||||
<Styled.ButtonRow>
|
<Styled.ButtonRow>
|
||||||
<Close asChild>
|
<Close asChild>
|
||||||
<Button action={ButtonAction.Destroy} onClick={disconnect}>
|
<Button action={ButtonAction.Destroy} onClick={disconnect}>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ 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.dydxacademy.info/educational-video-series/onboarding-to-defi-with-dydx`;
|
const aboutWalletsLink = `https://www.dydx.academy/video/defi-wallet`;
|
||||||
|
|
||||||
export const ChooseWallet = () => {
|
export const ChooseWallet = () => {
|
||||||
const stringGetter = useStringGetter();
|
const stringGetter = useStringGetter();
|
||||||
@@ -34,7 +34,14 @@ export const ChooseWallet = () => {
|
|||||||
<Styled.AlertMessage type={AlertType.Error}>
|
<Styled.AlertMessage type={AlertType.Error}>
|
||||||
{
|
{
|
||||||
<h4>
|
<h4>
|
||||||
Couldn't connect to {stringGetter({ key: wallets[selectedWalletType].stringKey })}.
|
{stringGetter({
|
||||||
|
key: STRING_KEYS.COULD_NOT_CONNECT,
|
||||||
|
params: {
|
||||||
|
WALLET: stringGetter({
|
||||||
|
key: wallets[selectedWalletType].stringKey,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
})}
|
||||||
</h4>
|
</h4>
|
||||||
}
|
}
|
||||||
{selectedWalletError}
|
{selectedWalletError}
|
||||||
|
|||||||
Reference in New Issue
Block a user