Skip to content

Commit

Permalink
Merge pull request #65 from skip-mev/dydx-support
Browse files Browse the repository at this point in the history
Support dydx
  • Loading branch information
thal0x authored Oct 30, 2023
2 parents 97c5c3a + 8621254 commit fc35e08
Show file tree
Hide file tree
Showing 6 changed files with 244 additions and 11 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-toast": "^1.1.4",
"@radix-ui/react-tooltip": "^1.0.6",
"@skip-router/core": "^0.0.11",
"@skip-router/core": "^0.0.12",
"@tanstack/react-query": "^4.29.5",
"@types/node": "20.1.2",
"@types/react": "18.2.6",
Expand Down
11 changes: 8 additions & 3 deletions src/components/ChainSelect/ChainSelectContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ const ChainSelectContent: FC<Props> = ({ chains, onChange, onClose }) => {
) : (
<div className="h-full overflow-y-auto scrollbar-hide">
{filteredChains.map((chain) => {
let chainLogo = `${chainNameToChainlistURL(
chain.chainName,
)}/chainImg/_chainImg.svg`;
if (chain.chainID === "dydx-mainnet-1") {
chainLogo =
"https://raw.githubusercontent.com/cosmos/chain-registry/master/dydx/images/dydx.png";
}
return (
<button
className="flex text-left w-full items-center gap-4 hover:bg-[#ECD9D9] p-4 rounded-lg transition-colors"
Expand All @@ -107,9 +114,7 @@ const ChainSelectContent: FC<Props> = ({ chains, onChange, onClose }) => {
<img
alt={chain.prettyName}
className="w-12 h-12 rounded-full"
src={`${chainNameToChainlistURL(
chain.chainName,
)}/chainImg/_chainImg.svg`}
src={chainLogo}
onError={(e) =>
(e.currentTarget.src =
"https://api.dicebear.com/6.x/shapes/svg")
Expand Down
17 changes: 17 additions & 0 deletions src/components/SwapWidget/SwapWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,23 @@ export const SwapWidget: FC = () => {
numberOfTransactions={numberOfTransactions}
/>
)}
{destinationChain?.chainID === "dydx-mainnet-1" ? (
<div className="bg-red-50 text-red-500 font-medium uppercase text-xs p-3 rounded-md flex items-center w-full text-left">
<p className="flex-1">
This transaction will let you transfer and stake tokens on dydx,
it will not allow you to trade. Follow the{" "}
<a
href="https://dydx.exchange/"
className="underline"
target="_blank"
rel="noreferrer"
>
dydx frontend
</a>{" "}
directions to set up a trading account
</p>
</div>
) : null}
{sourceChain && walletConnectStatus !== WalletStatus.Connected && (
<button
className="bg-[#FF486E] text-white font-semibold py-4 rounded-md w-full transition-transform hover:scale-105 hover:rotate-1"
Expand Down
206 changes: 206 additions & 0 deletions src/constants/chains.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
export const DYDX_CHAIN = {
$schema: "../chain.schema.json",
chain_name: "dydx",
status: "live",
website: "https://dydx.exchange/",
network_type: "mainnet",
pretty_name: "dYdX Protocol",
chain_id: "dydx-mainnet-1",
bech32_prefix: "dydx",
daemon_name: "dydxprotocold",
node_home: "$HOME/.dydxprotocol",
key_algos: ["secp256k1"],
slip44: 118,
fees: {
fee_tokens: [
{
denom: "adydx",
fixed_min_gas_price: 12500000000,
low_gas_price: 12500000000,
average_gas_price: 12500000000,
high_gas_price: 20000000000,
},
{
denom:
"ibc/8E27BA2D5493AF5636760E354E46004562C46AB7EC0CC4C1CA14E9E20E2545B5",
fixed_min_gas_price: 0.025,
low_gas_price: 0.025,
average_gas_price: 0.025,
high_gas_price: 0.03,
},
],
},
staking: {
staking_tokens: [
{
denom: "adydx",
},
],
},
codebase: {
git_repo: "https://github.com/dydxprotocol/v4-chain/",
recommended_version: "v1.0.0",
compatible_versions: ["v1.0.0"],
cosmos_sdk_version: "v0.47.4",
cosmwasm_enabled: false,
genesis: {
genesis_url:
"https://raw.githubusercontent.com/dydxopsdao/networks/main/dydx-mainnet-1/genesis.json",
},
versions: [
{
name: "v1",
recommended_version: "v1.0.0",
compatible_versions: ["v1.0.0"],
cosmos_sdk_version: "v0.47.4",
},
],
},
logo_URIs: {
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/dydx/images/dydx.png",
svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/dydx/images/dydx.svg",
},
peers: {
seeds: [
{
id: "20e1000e88125698264454a884812746c2eb4807",
address: "seeds.lavenderfive.com:23856",
provider: "Lavender.Five Nodes 🐝",
},
{
id: "ebc272824924ea1a27ea3183dd0b9ba713494f83",
address: "dydx-mainnet-seed.autostake.com:27366",
provider: "AutoStake 🛡️ Slash Protected",
},
{
id: "65b740ee326c9260c30af1f044e9cda63c73f7c1",
address: "seeds.kingnodes.net:23856",
provider: "Kingnodes",
},
{
id: "4c30c8a95e26b07b249813b677caab28bf0c54eb",
address: "rpc.dydx.nodestake.top:666",
provider: "NodeStake",
},
{
id: "400f3d9e30b69e78a7fb891f60d76fa3c73f0ecc",
address: "dydx.rpc.kjnodes.com:17059",
provider: "kjnodes",
},
{
id: "e1b058e5cfa2b836ddaa496b10911da62dcf182e",
address: "dydx-seed-de.allnodes.me:26656",
provider: "Allnodes ⚡️ Nodes & Staking",
},
{
id: "e726816f42831689eab9378d5d577f1d06d25716",
address: "dydx-seed-us.allnodes.me:26656",
provider: "Allnodes ⚡️ Nodes & Staking",
},
],
persistent_peers: [
{
id: "ebc272824924ea1a27ea3183dd0b9ba713494f83",
address: "dydx-mainnet-peer.autostake.com:27366",
provider: "AutoStake 🛡️ Slash Protected",
},
],
},
apis: {
rpc: [
{
address: "https://dydx-rpc.lavenderfive.com:443",
provider: "Lavender.Five Nodes 🐝",
},
{
address: "https://dydx-mainnet-rpc.autostake.com:443",
provider: "AutoStake 🛡️ Slash Protected",
},
{
address: "https://rpc-dydx.ecostake.com:443",
provider: "ecostake",
},
{
address: "https://rpc.dydx.nodestake.top:443",
provider: "NodeStake",
},
{
address: "https://dydx.rpc.kjnodes.com:443",
provider: "kjnodes",
},
{
address: "https://dydx-rpc.publicnode.com:443",
provider: "Allnodes ⚡️ Nodes & Staking",
},
],
rest: [
{
address: "https://dydx-api.lavenderfive.com:443",
provider: "Lavender.Five Nodes 🐝",
},
{
address: "https://dydx-mainnet-lcd.autostake.com:443",
provider: "AutoStake 🛡️ Slash Protected",
},
{
address: "https://rest-dydx.ecostake.com:443",
provider: "ecostake",
},
{
address: "https://api.dydx.nodestake.top:443",
provider: "NodeStake",
},
{
address: "https://dydx.api.kjnodes.com:443",
provider: "kjnodes",
},
{
address: "https://dydx-rest.publicnode.com",
provider: "Allnodes ⚡️ Nodes & Staking",
},
],
grpc: [
{
address: "https://dydx-grpc.lavenderfive.com",
provider: "Lavender.Five Nodes 🐝",
},
{
address: "dydx-mainnet-grpc.autostake.com:443",
provider: "AutoStake 🛡️ Slash Protected",
},
{
address: "https://grpc.dydx.nodestake.top",
provider: "NodeStake",
},
{
address: "dydx.grpc.kjnodes.com:443",
provider: "kjnodes",
},
{
address: "dydx-grpc.publicnode.com:443",
provider: "Allnodes ⚡️ Nodes & Staking",
},
],
},
explorers: [
{
kind: "mintscan",
url: "https://www.mintscan.io/dydx",
tx_page: "https://www.mintscan.io/dydx/txs/${txHash}",
account_page: "https://www.mintscan.io/dydx/account/${accountAddress}",
},
{
kind: "NodeStake",
url: "https://explorer.nodestake.top/dydx/",
tx_page: "https://explorer.nodestake.top/dydx/txs/${txHash}",
account_page:
"https://explorer.nodestake.top/dydx/account/${accountAddress}",
},
],
images: [
{
png: "https://raw.githubusercontent.com/cosmos/chain-registry/master/dydx/images/dydx.png",
svg: "https://raw.githubusercontent.com/cosmos/chain-registry/master/dydx/images/dydx.svg",
},
],
};
5 changes: 5 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { AppProps } from "next/app";
import Head from "next/head";

import MainLayout from "@/components/MainLayout";
import { DYDX_CHAIN } from "@/constants/chains";
import { AssetsProvider } from "@/context/assets";
import { ChainsProvider } from "@/context/chains";
import { ToastProvider } from "@/context/toast";
Expand Down Expand Up @@ -164,6 +165,10 @@ export default function App({ Component, pageProps }: AppProps) {
],
});

if (chains.findIndex((c) => c.chain_id === "dydx-mainnet-1") === -1) {
chains.push(DYDX_CHAIN);
}

const wallets = [
...keplrWallets,
...cosmostationWallets,
Expand Down

1 comment on commit fc35e08

@vercel
Copy link

@vercel vercel bot commented on fc35e08 Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.