Skip to content

Commit fc35e08

Browse files
authored
Merge pull request #65 from skip-mev/dydx-support
Support dydx
2 parents 97c5c3a + 8621254 commit fc35e08

File tree

6 files changed

+244
-11
lines changed

6 files changed

+244
-11
lines changed

Diff for: package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"@radix-ui/react-dialog": "^1.0.4",
4040
"@radix-ui/react-toast": "^1.1.4",
4141
"@radix-ui/react-tooltip": "^1.0.6",
42-
"@skip-router/core": "^0.0.11",
42+
"@skip-router/core": "^0.0.12",
4343
"@tanstack/react-query": "^4.29.5",
4444
"@types/node": "20.1.2",
4545
"@types/react": "18.2.6",

Diff for: src/components/ChainSelect/ChainSelectContent.tsx

+8-3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ const ChainSelectContent: FC<Props> = ({ chains, onChange, onClose }) => {
9696
) : (
9797
<div className="h-full overflow-y-auto scrollbar-hide">
9898
{filteredChains.map((chain) => {
99+
let chainLogo = `${chainNameToChainlistURL(
100+
chain.chainName,
101+
)}/chainImg/_chainImg.svg`;
102+
if (chain.chainID === "dydx-mainnet-1") {
103+
chainLogo =
104+
"https://raw.githubusercontent.com/cosmos/chain-registry/master/dydx/images/dydx.png";
105+
}
99106
return (
100107
<button
101108
className="flex text-left w-full items-center gap-4 hover:bg-[#ECD9D9] p-4 rounded-lg transition-colors"
@@ -107,9 +114,7 @@ const ChainSelectContent: FC<Props> = ({ chains, onChange, onClose }) => {
107114
<img
108115
alt={chain.prettyName}
109116
className="w-12 h-12 rounded-full"
110-
src={`${chainNameToChainlistURL(
111-
chain.chainName,
112-
)}/chainImg/_chainImg.svg`}
117+
src={chainLogo}
113118
onError={(e) =>
114119
(e.currentTarget.src =
115120
"https://api.dicebear.com/6.x/shapes/svg")

Diff for: src/components/SwapWidget/SwapWidget.tsx

+17
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,23 @@ export const SwapWidget: FC = () => {
163163
numberOfTransactions={numberOfTransactions}
164164
/>
165165
)}
166+
{destinationChain?.chainID === "dydx-mainnet-1" ? (
167+
<div className="bg-red-50 text-red-500 font-medium uppercase text-xs p-3 rounded-md flex items-center w-full text-left">
168+
<p className="flex-1">
169+
This transaction will let you transfer and stake tokens on dydx,
170+
it will not allow you to trade. Follow the{" "}
171+
<a
172+
href="https://dydx.exchange/"
173+
className="underline"
174+
target="_blank"
175+
rel="noreferrer"
176+
>
177+
dydx frontend
178+
</a>{" "}
179+
directions to set up a trading account
180+
</p>
181+
</div>
182+
) : null}
166183
{sourceChain && walletConnectStatus !== WalletStatus.Connected && (
167184
<button
168185
className="bg-[#FF486E] text-white font-semibold py-4 rounded-md w-full transition-transform hover:scale-105 hover:rotate-1"

Diff for: src/constants/chains.ts

+206
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
export const DYDX_CHAIN = {
2+
$schema: "../chain.schema.json",
3+
chain_name: "dydx",
4+
status: "live",
5+
website: "https://dydx.exchange/",
6+
network_type: "mainnet",
7+
pretty_name: "dYdX Protocol",
8+
chain_id: "dydx-mainnet-1",
9+
bech32_prefix: "dydx",
10+
daemon_name: "dydxprotocold",
11+
node_home: "$HOME/.dydxprotocol",
12+
key_algos: ["secp256k1"],
13+
slip44: 118,
14+
fees: {
15+
fee_tokens: [
16+
{
17+
denom: "adydx",
18+
fixed_min_gas_price: 12500000000,
19+
low_gas_price: 12500000000,
20+
average_gas_price: 12500000000,
21+
high_gas_price: 20000000000,
22+
},
23+
{
24+
denom:
25+
"ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
26+
fixed_min_gas_price: 0.025,
27+
low_gas_price: 0.025,
28+
average_gas_price: 0.025,
29+
high_gas_price: 0.03,
30+
},
31+
],
32+
},
33+
staking: {
34+
staking_tokens: [
35+
{
36+
denom: "adydx",
37+
},
38+
],
39+
},
40+
codebase: {
41+
git_repo: "https://github.com/dydxprotocol/v4-chain/",
42+
recommended_version: "v1.0.0",
43+
compatible_versions: ["v1.0.0"],
44+
cosmos_sdk_version: "v0.47.4",
45+
cosmwasm_enabled: false,
46+
genesis: {
47+
genesis_url:
48+
"https://raw.githubusercontent.com/dydxopsdao/networks/main/dydx-mainnet-1/genesis.json",
49+
},
50+
versions: [
51+
{
52+
name: "v1",
53+
recommended_version: "v1.0.0",
54+
compatible_versions: ["v1.0.0"],
55+
cosmos_sdk_version: "v0.47.4",
56+
},
57+
],
58+
},
59+
logo_URIs: {
60+
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/dydx/images/dydx.png",
61+
svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/dydx/images/dydx.svg",
62+
},
63+
peers: {
64+
seeds: [
65+
{
66+
id: "20e1000e88125698264454a884812746c2eb4807",
67+
address: "seeds.lavenderfive.com:23856",
68+
provider: "Lavender.Five Nodes 🐝",
69+
},
70+
{
71+
id: "ebc272824924ea1a27ea3183dd0b9ba713494f83",
72+
address: "dydx-mainnet-seed.autostake.com:27366",
73+
provider: "AutoStake 🛡️ Slash Protected",
74+
},
75+
{
76+
id: "65b740ee326c9260c30af1f044e9cda63c73f7c1",
77+
address: "seeds.kingnodes.net:23856",
78+
provider: "Kingnodes",
79+
},
80+
{
81+
id: "4c30c8a95e26b07b249813b677caab28bf0c54eb",
82+
address: "rpc.dydx.nodestake.top:666",
83+
provider: "NodeStake",
84+
},
85+
{
86+
id: "400f3d9e30b69e78a7fb891f60d76fa3c73f0ecc",
87+
address: "dydx.rpc.kjnodes.com:17059",
88+
provider: "kjnodes",
89+
},
90+
{
91+
id: "e1b058e5cfa2b836ddaa496b10911da62dcf182e",
92+
address: "dydx-seed-de.allnodes.me:26656",
93+
provider: "Allnodes ⚡️ Nodes & Staking",
94+
},
95+
{
96+
id: "e726816f42831689eab9378d5d577f1d06d25716",
97+
address: "dydx-seed-us.allnodes.me:26656",
98+
provider: "Allnodes ⚡️ Nodes & Staking",
99+
},
100+
],
101+
persistent_peers: [
102+
{
103+
id: "ebc272824924ea1a27ea3183dd0b9ba713494f83",
104+
address: "dydx-mainnet-peer.autostake.com:27366",
105+
provider: "AutoStake 🛡️ Slash Protected",
106+
},
107+
],
108+
},
109+
apis: {
110+
rpc: [
111+
{
112+
address: "https://dydx-rpc.lavenderfive.com:443",
113+
provider: "Lavender.Five Nodes 🐝",
114+
},
115+
{
116+
address: "https://dydx-mainnet-rpc.autostake.com:443",
117+
provider: "AutoStake 🛡️ Slash Protected",
118+
},
119+
{
120+
address: "https://rpc-dydx.ecostake.com:443",
121+
provider: "ecostake",
122+
},
123+
{
124+
address: "https://rpc.dydx.nodestake.top:443",
125+
provider: "NodeStake",
126+
},
127+
{
128+
address: "https://dydx.rpc.kjnodes.com:443",
129+
provider: "kjnodes",
130+
},
131+
{
132+
address: "https://dydx-rpc.publicnode.com:443",
133+
provider: "Allnodes ⚡️ Nodes & Staking",
134+
},
135+
],
136+
rest: [
137+
{
138+
address: "https://dydx-api.lavenderfive.com:443",
139+
provider: "Lavender.Five Nodes 🐝",
140+
},
141+
{
142+
address: "https://dydx-mainnet-lcd.autostake.com:443",
143+
provider: "AutoStake 🛡️ Slash Protected",
144+
},
145+
{
146+
address: "https://rest-dydx.ecostake.com:443",
147+
provider: "ecostake",
148+
},
149+
{
150+
address: "https://api.dydx.nodestake.top:443",
151+
provider: "NodeStake",
152+
},
153+
{
154+
address: "https://dydx.api.kjnodes.com:443",
155+
provider: "kjnodes",
156+
},
157+
{
158+
address: "https://dydx-rest.publicnode.com",
159+
provider: "Allnodes ⚡️ Nodes & Staking",
160+
},
161+
],
162+
grpc: [
163+
{
164+
address: "https://dydx-grpc.lavenderfive.com",
165+
provider: "Lavender.Five Nodes 🐝",
166+
},
167+
{
168+
address: "dydx-mainnet-grpc.autostake.com:443",
169+
provider: "AutoStake 🛡️ Slash Protected",
170+
},
171+
{
172+
address: "https://grpc.dydx.nodestake.top",
173+
provider: "NodeStake",
174+
},
175+
{
176+
address: "dydx.grpc.kjnodes.com:443",
177+
provider: "kjnodes",
178+
},
179+
{
180+
address: "dydx-grpc.publicnode.com:443",
181+
provider: "Allnodes ⚡️ Nodes & Staking",
182+
},
183+
],
184+
},
185+
explorers: [
186+
{
187+
kind: "mintscan",
188+
url: "https://www.mintscan.io/dydx",
189+
tx_page: "https://www.mintscan.io/dydx/txs/${txHash}",
190+
account_page: "https://www.mintscan.io/dydx/account/${accountAddress}",
191+
},
192+
{
193+
kind: "NodeStake",
194+
url: "https://explorer.nodestake.top/dydx/",
195+
tx_page: "https://explorer.nodestake.top/dydx/txs/${txHash}",
196+
account_page:
197+
"https://explorer.nodestake.top/dydx/account/${accountAddress}",
198+
},
199+
],
200+
images: [
201+
{
202+
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/dydx/images/dydx.png",
203+
svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/dydx/images/dydx.svg",
204+
},
205+
],
206+
};

Diff for: src/pages/_app.tsx

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { AppProps } from "next/app";
1414
import Head from "next/head";
1515

1616
import MainLayout from "@/components/MainLayout";
17+
import { DYDX_CHAIN } from "@/constants/chains";
1718
import { AssetsProvider } from "@/context/assets";
1819
import { ChainsProvider } from "@/context/chains";
1920
import { ToastProvider } from "@/context/toast";
@@ -164,6 +165,10 @@ export default function App({ Component, pageProps }: AppProps) {
164165
],
165166
});
166167

168+
if (chains.findIndex((c) => c.chain_id === "dydx-mainnet-1") === -1) {
169+
chains.push(DYDX_CHAIN);
170+
}
171+
167172
const wallets = [
168173
...keplrWallets,
169174
...cosmostationWallets,

0 commit comments

Comments
 (0)