Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.
Open
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
22,405 changes: 9,957 additions & 12,448 deletions apps/connect/package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions apps/connect/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@xlabs/portal-bridge-ui",
"private": true,
"version": "0.2.23",
"version": "0.2.26",
"type": "module",
"scripts": {
"dev:usdc-bridge": "vite --config ./vite.usdc-bridge.config.ts",
Expand Down Expand Up @@ -34,8 +34,7 @@
"@mui/material": "^5.12.1",
"@tanstack/react-query": "^5.14.2",
"@wormhole-foundation/sdk": "^1.13.1",
"@wormhole-foundation/wormhole-connect": "^2.3.0",
"@xlabs/wormhole-connect": "^1.0.0-cctpv2.7-development",
"@wormhole-foundation/wormhole-connect": "^2.4.0",
"bech32": "^2.0.0",
"dompurify": "^3.0.6",
"ethers": "^6.4.2",
Expand Down
4 changes: 2 additions & 2 deletions apps/connect/src/components/atoms/Connect.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { memo, useEffect, useState } from "react";
import WormholeConnect, { nttRoutes } from "@xlabs/wormhole-connect";
import WormholeConnect, { nttRoutes } from "@wormhole-foundation/wormhole-connect";
import { useConnectConfig } from "../../hooks/useConnectConfig";
import { styled, CircularProgress } from "@mui/material";
import { NAVBAR_WIDTH } from "./NavBar";
import { theme } from "../../theme/connect";
import { Banner } from "./Banner";
import { WormholeConnectConfig } from "@xlabs/wormhole-connect";
import { WormholeConnectConfig } from "@wormhole-foundation/wormhole-connect";
import { fetchTokensConfig } from "../../utils/fetchTokens";
import { envVars } from "../../env/env-vars";

Expand Down
2 changes: 1 addition & 1 deletion apps/connect/src/env/common.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { WormholeConnectConfig } from "@xlabs/wormhole-connect";
import type { WormholeConnectConfig } from "@wormhole-foundation/wormhole-connect";
import { envVars } from "./env-vars";

const rpcs = (chains: string[], template: (chain: string) => string) =>
Expand Down
6 changes: 3 additions & 3 deletions apps/connect/src/env/token-bridge.mainnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
MayanRouteSWIFT,
MayanRouteSHUTTLE,
type WormholeConnectConfig,
CircleV2ManualRoute,
} from "@xlabs/wormhole-connect";
//CircleV2ManualRoute,
} from "@wormhole-foundation/wormhole-connect";
import { Env, MAINNET_RPCS } from "./common";
import { M0AutomaticRoute } from "@m0-foundation/ntt-sdk-route";

Expand All @@ -22,7 +22,7 @@ export const ENV: Env = {
// } as WormholeConnectConfig["ui"],
rpcs: MAINNET_RPCS,
routes: [
CircleV2ManualRoute,
//CircleV2ManualRoute,
...DEFAULT_ROUTES,
MayanRouteWH as any, // FIXME: Remove this any and fix wh connect type issues
MayanRouteMCTP,
Expand Down
7 changes: 4 additions & 3 deletions apps/connect/src/env/token-bridge.testnet.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ENV as ENV_BASE } from "./token-bridge";
import { mergeDeep } from "../utils/mergeDeep";
import { CircleV2ManualRoute, DEFAULT_ROUTES } from "@xlabs/wormhole-connect";
import type { WormholeConnectConfig } from "@xlabs/wormhole-connect";
import { DEFAULT_ROUTES } from "@wormhole-foundation/wormhole-connect";
import type { WormholeConnectConfig } from "@wormhole-foundation/wormhole-connect";
import { Env } from "./common";

export const ENV: Env = {
Expand Down Expand Up @@ -34,7 +34,8 @@ export const ENV: Env = {
"Mantle",
"Worldchain",
],
routes: [...DEFAULT_ROUTES, CircleV2ManualRoute],
routes: [...DEFAULT_ROUTES, //CircleV2ManualRoute
],
}
),
};
2 changes: 1 addition & 1 deletion apps/connect/src/env/token-bridge.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { WormholeConnectConfig } from "@xlabs/wormhole-connect";
import type { WormholeConnectConfig } from "@wormhole-foundation/wormhole-connect";
import { chains, Env, PUBLIC_URL, wormholeConnectConfigCommon } from "./common";
import { mergeDeep } from "../utils/mergeDeep";

Expand Down
6 changes: 3 additions & 3 deletions apps/connect/src/env/usdc-bridge.mainnet.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ENV as ENV_BASE } from "./usdc-bridge";
import { mergeDeep } from "../utils/mergeDeep";
import {
CircleV2ManualRoute,
//CircleV2ManualRoute,
DEFAULT_ROUTES,
MayanRouteSHUTTLE,
type WormholeConnectConfig,
} from "@xlabs/wormhole-connect";
} from "@wormhole-foundation/wormhole-connect";
import { Env, MAINNET_RPCS } from "./common";

export const ENV: Env = {
Expand All @@ -15,7 +15,7 @@ export const ENV: Env = {
{
rpcs: MAINNET_RPCS,
routes: [
CircleV2ManualRoute,
//CircleV2ManualRoute,
...DEFAULT_ROUTES,
MayanRouteSHUTTLE as any,
],
Expand Down
6 changes: 3 additions & 3 deletions apps/connect/src/env/usdc-bridge.testnet.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ENV as ENV_BASE } from "./usdc-bridge";
import { mergeDeep } from "../utils/mergeDeep";
import {
CircleV2ManualRoute,
//CircleV2ManualRoute,
DEFAULT_ROUTES,
type WormholeConnectConfig,
} from "@xlabs/wormhole-connect";
} from "@wormhole-foundation/wormhole-connect";
import { Env } from "./common";

export const ENV: Env = {
Expand All @@ -15,7 +15,7 @@ export const ENV: Env = {
routes: [
...DEFAULT_ROUTES,
//MayanRouteSHUTTLE as any,
CircleV2ManualRoute,
//CircleV2ManualRoute,
],
chains: [
"Sepolia",
Expand Down
2 changes: 1 addition & 1 deletion apps/connect/src/env/usdc-bridge.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {
DEFAULT_ROUTES,
type WormholeConnectConfig,
} from "@xlabs/wormhole-connect";
} from "@wormhole-foundation/wormhole-connect";
import { Env, PUBLIC_URL, wormholeConnectConfigCommon } from "./common";
import { mergeDeep } from "../utils/mergeDeep";

Expand Down
2 changes: 1 addition & 1 deletion apps/connect/src/hooks/useConnectConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { WormholeConnectConfig } from "@xlabs/wormhole-connect";
import type { WormholeConnectConfig } from "@wormhole-foundation/wormhole-connect";
import { useEffect, useMemo, useState } from "react";

import { useQueryParams } from "./useQueryParams";
Expand Down
2 changes: 1 addition & 1 deletion apps/connect/src/hooks/useFormatAssetParam.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { renderHook } from "@testing-library/react";
import { useFormatAssetParam } from "./useFormatAssetParam";

// Mock the wormhole-connect package
jest.mock("@xlabs/wormhole-connect", () => ({
jest.mock("@wormhole-foundation/wormhole-connect", () => ({
MAINNET: {
tokens: [
{
Expand Down
4 changes: 2 additions & 2 deletions apps/connect/src/hooks/useFormatAssetParam.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ENV } from "@env";
import { MAINNET, TESTNET } from "@xlabs/wormhole-connect";
import { MAINNET, TESTNET } from "@wormhole-foundation/wormhole-connect";
import { useMemo } from "react";

const tokensList =
Expand Down Expand Up @@ -28,4 +28,4 @@ function getFormatedAsset(asset: string | null): string | null {
export function useFormatAssetParam(asset: string | null) {
const formatedAsset = useMemo(() => getFormatedAsset(asset), [asset]);
return formatedAsset;
}
}
4 changes: 2 additions & 2 deletions apps/connect/src/providers/sanctions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe("sanctions", () => {
body: JSON.stringify([
{
address: transferDetails.fromWalletAddress,
chain: getTrmChainName(transferDetails.fromChain),
chain: getTrmChainName(transferDetails.fromChain as any),
accountExternalId: ACCOUNT_ID,
},
]),
Expand All @@ -55,7 +55,7 @@ describe("sanctions", () => {
body: JSON.stringify([
{
address: transferDetails.toWalletAddress,
chain: getTrmChainName(transferDetails.toChain),
chain: getTrmChainName(transferDetails.toChain as any),
accountExternalId: ACCOUNT_ID,
},
]),
Expand Down
10 changes: 5 additions & 5 deletions apps/connect/src/providers/sanctions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Chain, toChainId } from "@wormhole-foundation/sdk";
import { isCosmWasmChain, isEVMChain } from "../utils/constants";
import { WormholeConnectConfig } from "@xlabs/wormhole-connect";
import { WormholeConnectConfig } from "@wormhole-foundation/wormhole-connect";

export type ExtendedTransferDetails = Parameters<
NonNullable<WormholeConnectConfig["validateTransferHandler"]>
Expand Down Expand Up @@ -76,15 +76,15 @@ export const isSanctionedAddress = async (
const [isOriginSanctioned, isTargetSanctioned, isTargetSanctionedEth] =
await Promise.all([
isSanctioned({
chain: getTrmChainName(transferDetails.fromChain),
chain: getTrmChainName(transferDetails.fromChain as any),
address: transferDetails.fromWalletAddress,
}),
isSanctioned({
chain: getTrmChainName(transferDetails.toChain),
chain: getTrmChainName(transferDetails.toChain as any),
address: transferDetails.toWalletAddress,
}),
...(transferDetails.toChain !== "Ethereum" &&
(isEVMChain(transferDetails.toChain) ||
(isEVMChain(transferDetails.toChain as any) ||
transferDetails.toChain === "Worldchain")
? [
isSanctioned({
Expand All @@ -96,4 +96,4 @@ export const isSanctionedAddress = async (
]);

return isOriginSanctioned || isTargetSanctioned || isTargetSanctionedEth;
};
};
100 changes: 51 additions & 49 deletions apps/connect/src/providers/telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import mixpanel from "mixpanel-browser";
import { isPreview, isProduction } from "../utils/constants";
import type { WormholeConnectConfig } from "@xlabs/wormhole-connect";
import type { WormholeConnectConfig } from "@wormhole-foundation/wormhole-connect";
import { amount as sdkAmount } from "@wormhole-foundation/sdk";

export type WormholeConnectEvent = Parameters<
Expand Down Expand Up @@ -48,7 +48,7 @@ export const eventHandler = (e: WormholeConnectEvent) => {
if (e.type === "load") return;

// Start the trace when the event is load
const span = { event: e.type, properties: e.details as unknown };
const span = { event: e.type, properties: "details" in e ? e.details : {} };
// Wallet connect information
if (e.type === "wallet.connect") {
const side = e.details.side;
Expand All @@ -67,55 +67,57 @@ export const eventHandler = (e: WormholeConnectEvent) => {
lastChain = chain;
return;
}
if ("details" in e){
const getTokenAddress = (token: typeof e.details.fromToken): string =>
typeof token?.tokenId === "object" ? token.tokenId.address : "native";

// Convert WormholeConnectEvent to Attributes
const isTransferError =
e.type === "transfer.error" || e.type === "transfer.redeem.error";
const amount =
typeof e.details.amount === "number"
? e.details.amount
: sdkAmount.whole(e.details.amount as sdkAmount.Amount);
const attributes: { [key: string]: string | number | undefined } = {
fromChain: e.details.fromChain.toString(),
toChain: e.details.toChain.toString(),
fromTokenSymbol: e.details.fromToken?.symbol,
fromTokenAddress: getTokenAddress(e.details.fromToken),
toTokenSymbol: e.details.toToken?.symbol,
toTokenAddress: getTokenAddress(e.details.toToken),
txId: e.details.txId,
USDAmount: e.details.USDAmount,
amount: amount,
connectVersion: e.meta.version,
connectHash: e.meta.hash,
route:
{
ManualTokenBridge: "Manual Bridge",
AutomaticTokenBridge: "Relayer",
ManualCCTP: "CCTP Manual",
AutomaticCCTP: "CCTP Relayer",
ManualNtt: "NTT Manual",
AutomaticNtt: "NTT Relayer",
MayanSwap: "Mayan Swap",
MayanSwapWH: "Mayan Swap",
MayanSwapMCTP: "Mayan Swap MCTP",
MayanSwapSWIFT: "Mayan Swap Swift",
MayanSwapSHUTTLE: "Mayan Swap Shuttle",
cosmosGateway: "Cosmos Gateway",
ethBridge: "Eth Bridge",
wstETHBridge: "wstETH Bridge",
tbtc: "TBTC",
usdtBridge: "USDT Bridge",
}[e.details.route] || "Manual Bridge",
...(isTransferError
? {
"error-type": e.error.type || "unknown",
"error-message": getErrorMessage(e.error?.original),
}
: {}),
};
// Convert WormholeConnectEvent to Attributes
const isTransferError =
e.type === "transfer.error" || e.type === "transfer.redeem.error";
const amount =
typeof e.details.amount === "number"
? e.details.amount
: sdkAmount.whole(e.details.amount as sdkAmount.Amount);
const attributes: { [key: string]: string | number | undefined } = {
fromChain: e.details.fromChain.toString(),
toChain: e.details.toChain.toString(),
fromTokenSymbol: e.details.fromToken?.symbol,
fromTokenAddress: getTokenAddress(e.details.fromToken),
toTokenSymbol: e.details.toToken?.symbol,
toTokenAddress: getTokenAddress(e.details.toToken),
txId: e.details.txId,
USDAmount: e.details.USDAmount,
amount: amount,
connectVersion: e.meta.version,
connectHash: e.meta.hash,
route:
{
ManualTokenBridge: "Manual Bridge",
AutomaticTokenBridge: "Relayer",
ManualCCTP: "CCTP Manual",
AutomaticCCTP: "CCTP Relayer",
ManualNtt: "NTT Manual",
AutomaticNtt: "NTT Relayer",
MayanSwap: "Mayan Swap",
MayanSwapWH: "Mayan Swap",
MayanSwapMCTP: "Mayan Swap MCTP",
MayanSwapSWIFT: "Mayan Swap Swift",
MayanSwapSHUTTLE: "Mayan Swap Shuttle",
cosmosGateway: "Cosmos Gateway",
ethBridge: "Eth Bridge",
wstETHBridge: "wstETH Bridge",
tbtc: "TBTC",
usdtBridge: "USDT Bridge",
}[e.details.route] || "Manual Bridge",
...(isTransferError
? {
"error-type": e.error.type || "unknown",
"error-message": getErrorMessage(e.error?.original),
}
: {}),
};

// Transfer event information
sendEvent({ ...span, properties: { ...attributes } });
// Transfer event information
sendEvent({ ...span, properties: { ...attributes } });
}
};
2 changes: 1 addition & 1 deletion apps/connect/src/theme/connect.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { WormholeConnectTheme } from "@xlabs/wormhole-connect";
import type { WormholeConnectTheme } from "@wormhole-foundation/wormhole-connect";

export const theme: WormholeConnectTheme = {
mode: "dark",
Expand Down
4 changes: 2 additions & 2 deletions apps/connect/src/utils/transferVerification.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { isValidAddress } from "./isValidAddress";
import { isSanctionedAddress } from "../../src/providers/sanctions";
import { Chain } from "@wormhole-foundation/sdk";
import { WormholeConnectConfig } from "@xlabs/wormhole-connect";
import { WormholeConnectConfig } from "@wormhole-foundation/wormhole-connect";

export type ExtendedTransferDetails = Parameters<
NonNullable<WormholeConnectConfig["validateTransferHandler"]>
Expand All @@ -24,7 +24,7 @@ export const validateTransfer = async (
}

// Correct Address Validation (based on chain selected)
const isValid = await isValidAddress(tx.toWalletAddress, tx.toChain);
const isValid = await isValidAddress(tx.toWalletAddress, tx.toChain as Chain);
if (!isValid) {
return { isValid: false, error: "Not valid target address" };
}
Expand Down
2 changes: 1 addition & 1 deletion apps/connect/vite.token-bridge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export default defineConfig({
tag: "meta",
attrs: {
name: "Wormhole connect",
content: `v${packageJson.dependencies["@xlabs/wormhole-connect"]}`,
content: `v${packageJson.dependencies["@wormhole-foundation/wormhole-connect"]}`,
},
},
{
Expand Down
2 changes: 1 addition & 1 deletion apps/connect/vite.usdc-bridge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export default defineConfig({
tag: "meta",
attrs: {
name: "Wormhole connect",
content: `v${packageJson.dependencies["@xlabs/wormhole-connect"]}`,
content: `v${packageJson.dependencies["@wormhole-foundation/wormhole-connect"]}`,
},
},
{
Expand Down
Loading