diff --git a/.lintstagedrc.js b/.lintstagedrc.js index a24c0ca4..18d979e7 100644 --- a/.lintstagedrc.js +++ b/.lintstagedrc.js @@ -1,9 +1,9 @@ const path = require("path"); const buildAppsEslintCommand = (filenames) => - `npm run lint -w apps -- --fix --file ${filenames.map((f) => path.relative("packages/apps", f)).join(" --file ")}`; + `npm run lint -- --fix --file ${filenames.map((f) => path.relative("./", f)).join(" --file ")}`; module.exports = { - "packages/apps/src/**/*.{js,jsx,ts,tsx}": [buildAppsEslintCommand], + "src/**/*.{js,jsx,ts,tsx}": [buildAppsEslintCommand], "**/*.{js,jsx,ts,tsx,json}": "prettier --write", }; diff --git a/src/components/history-records.tsx b/src/components/history-records.tsx index 0549329b..b59651dd 100644 --- a/src/components/history-records.tsx +++ b/src/components/history-records.tsx @@ -41,11 +41,12 @@ export default function HistoryRecords() { "l2arbitrumbridge-ethereum", "lpbridge-darwinia-dvm", "lpbridge-ethereum", - "xtoken-crab-dvm", - "xtoken-darwinia-dvm", - "xtoken-pangolin-dvm", - "xtoken-sepolia", - "xtoken-ethereum", + "xtoken-crab-darwinia", + "xtoken-darwinia-crab", + "xtoken-darwinia-ethereum", + "xtoken-ethereum-darwinia", + "xtoken-pangolin-sepolia", + "xtoken-sepolia-pangolin", ], }, notifyOnNetworkStatusChange: true, diff --git a/src/config/chains/crab.ts b/src/config/chains/crab.ts index 062c2d21..3b9c9a5b 100644 --- a/src/config/chains/crab.ts +++ b/src/config/chains/crab.ts @@ -52,7 +52,7 @@ export const crabChain: ChainConfig = { cross: [ { target: { network: "darwinia-dvm", symbol: "xWCRAB" }, - bridge: { category: "xtoken-crab-dvm" }, + bridge: { category: "xtoken-crab-darwinia" }, action: "issue", }, ], @@ -69,7 +69,7 @@ export const crabChain: ChainConfig = { cross: [ { target: { network: "darwinia-dvm", symbol: "RING" }, - bridge: { category: "xtoken-crab-dvm" }, + bridge: { category: "xtoken-darwinia-crab" }, action: "redeem", }, ], diff --git a/src/config/chains/darwinia.ts b/src/config/chains/darwinia.ts index 7e564417..a62e6b94 100644 --- a/src/config/chains/darwinia.ts +++ b/src/config/chains/darwinia.ts @@ -53,7 +53,7 @@ export const darwiniaChain: ChainConfig = { cross: [ { target: { network: "crab-dvm", symbol: "xWRING" }, - bridge: { category: "xtoken-darwinia-dvm" }, + bridge: { category: "xtoken-darwinia-crab" }, action: "issue", }, { @@ -74,7 +74,7 @@ export const darwiniaChain: ChainConfig = { }, { target: { network: "ethereum", symbol: "RING" }, - bridge: { category: "xtoken-darwinia-dvm" }, + bridge: { category: "xtoken-darwinia-ethereum" }, action: "issue", }, ], @@ -97,7 +97,7 @@ export const darwiniaChain: ChainConfig = { }, { target: { network: "ethereum", symbol: "KTON" }, - bridge: { category: "xtoken-darwinia-dvm" }, + bridge: { category: "xtoken-darwinia-ethereum" }, action: "issue", }, ], @@ -114,7 +114,7 @@ export const darwiniaChain: ChainConfig = { cross: [ { target: { network: "crab-dvm", symbol: "CRAB" }, - bridge: { category: "xtoken-darwinia-dvm" }, + bridge: { category: "xtoken-crab-darwinia" }, action: "redeem", }, ], diff --git a/src/config/chains/ethereum.ts b/src/config/chains/ethereum.ts index 9c5c756b..725a3d2d 100644 --- a/src/config/chains/ethereum.ts +++ b/src/config/chains/ethereum.ts @@ -52,7 +52,7 @@ export const ethereumChain: ChainConfig = { }, { target: { network: "darwinia-dvm", symbol: "RING" }, - bridge: { category: "xtoken-ethereum" }, + bridge: { category: "xtoken-darwinia-ethereum" }, action: "redeem", }, ], @@ -75,7 +75,7 @@ export const ethereumChain: ChainConfig = { }, { target: { network: "darwinia-dvm", symbol: "KTON" }, - bridge: { category: "xtoken-ethereum" }, + bridge: { category: "xtoken-darwinia-ethereum" }, action: "redeem", }, ], diff --git a/src/config/chains/pangolin.ts b/src/config/chains/pangolin.ts index 46a32bb7..aa1d52fd 100644 --- a/src/config/chains/pangolin.ts +++ b/src/config/chains/pangolin.ts @@ -47,7 +47,7 @@ export const pangolinChain: ChainConfig = { cross: [ { target: { network: "sepolia", symbol: "xPRING" }, - bridge: { category: "xtoken-pangolin-dvm" }, + bridge: { category: "xtoken-pangolin-sepolia" }, action: "issue", }, ], diff --git a/src/config/chains/sepolia.ts b/src/config/chains/sepolia.ts index 910f562f..2c0fcded 100644 --- a/src/config/chains/sepolia.ts +++ b/src/config/chains/sepolia.ts @@ -47,7 +47,7 @@ export const sepoliaChain: ChainConfig = { cross: [ { target: { network: "pangolin-dvm", symbol: "PRING" }, - bridge: { category: "xtoken-sepolia" }, + bridge: { category: "xtoken-pangolin-sepolia" }, action: "redeem", }, ], diff --git a/src/types/bridge.ts b/src/types/bridge.ts index 88f49f1d..88bc3b0a 100644 --- a/src/types/bridge.ts +++ b/src/types/bridge.ts @@ -14,11 +14,12 @@ export type HelixBridgeCategory = | "helix-sub2subv21(unlock)" | "helix-sub2subv21(lock)"; export type XTokenBridgeCategory = - | "xtoken-sepolia" - | "xtoken-ethereum" - | "xtoken-darwinia-dvm" - | "xtoken-crab-dvm" - | "xtoken-pangolin-dvm"; + | "xtoken-crab-darwinia" + | "xtoken-darwinia-crab" + | "xtoken-darwinia-ethereum" + | "xtoken-ethereum-darwinia" + | "xtoken-pangolin-sepolia" + | "xtoken-sepolia-pangolin"; export type BridgeCategory = L2BridgeCategory | HelixLpBridgeCategory | HelixBridgeCategory | XTokenBridgeCategory; export interface BridgeContract { diff --git a/src/utils/bridge.ts b/src/utils/bridge.ts index 671d0ba1..dcf8d925 100644 --- a/src/utils/bridge.ts +++ b/src/utils/bridge.ts @@ -9,6 +9,9 @@ import { import { BridgeConstructorArgs } from "@/types"; export function bridgeFactory(args: BridgeConstructorArgs): BaseBridge | undefined { + if (args.category.startsWith("xtoken-")) { + return new XTokenNextBridge(args); + } switch (args.category) { case "helix-sub2ethv2(lock)": case "helix-sub2ethv2(unlock)": @@ -21,12 +24,6 @@ export function bridgeFactory(args: BridgeConstructorArgs): BaseBridge | undefin return new HelixLpBridge(args); case "l2arbitrumbridge-ethereum": return new L2ArbitrumBridge(args); - case "xtoken-darwinia-dvm": - case "xtoken-crab-dvm": - case "xtoken-pangolin-dvm": - case "xtoken-sepolia": - case "xtoken-ethereum": - return new XTokenNextBridge(args); default: return; }