Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Adapt indexer bridge name change #20

Merged
merged 3 commits into from
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
@@ -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",
};
11 changes: 6 additions & 5 deletions src/components/history-records.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/config/chains/crab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
],
Expand All @@ -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",
},
],
Expand Down
8 changes: 4 additions & 4 deletions src/config/chains/darwinia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
{
Expand All @@ -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",
},
],
Expand All @@ -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",
},
],
Expand All @@ -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",
},
],
Expand Down
4 changes: 2 additions & 2 deletions src/config/chains/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
],
Expand All @@ -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",
},
],
Expand Down
2 changes: 1 addition & 1 deletion src/config/chains/pangolin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
],
Expand Down
2 changes: 1 addition & 1 deletion src/config/chains/sepolia.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
],
Expand Down
11 changes: 6 additions & 5 deletions src/types/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
9 changes: 3 additions & 6 deletions src/utils/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)":
Expand All @@ -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;
}
Expand Down
Loading