@cordystackx/cordy_minikit 3.1.1 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/transfer.d.ts +4 -1
- package/dist/client/transfer.d.ts.map +1 -1
- package/dist/client/transfer.js +77 -5
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/components/Connect_wallet_bt.d.ts.map +1 -1
- package/dist/components/Connect_wallet_bt.js +19 -8
- package/dist/controllers/BridgeEvmWalletModal.d.ts.map +1 -1
- package/dist/controllers/BridgeEvmWalletModal.js +23 -1
- package/dist/controllers/cctpBridge.d.ts +1 -0
- package/dist/controllers/cctpBridge.d.ts.map +1 -1
- package/dist/controllers/cctpBridge.js +70 -35
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/wagmi__providers.d.ts.map +1 -1
- package/dist/wagmi__providers.js +3 -21
- package/package.json +1 -1
|
@@ -58,7 +58,8 @@ export type CordyBridgeResult = {
|
|
|
58
58
|
amount?: string;
|
|
59
59
|
approvalTransactionHash?: string;
|
|
60
60
|
transactionHash?: string;
|
|
61
|
-
status?: "submitted" | "pending";
|
|
61
|
+
status?: "submitted" | "pending" | "burned";
|
|
62
|
+
burnTransactionHash?: string;
|
|
62
63
|
error?: string;
|
|
63
64
|
errorDetail?: string;
|
|
64
65
|
warning?: string;
|
|
@@ -68,6 +69,8 @@ export declare function configureCordyAssets({ assets }: {
|
|
|
68
69
|
}): void;
|
|
69
70
|
/** Bridge a configured ERC-20 asset between the configured internal and external EVM sides. */
|
|
70
71
|
export declare function cordy_bridge(amount: number | string, from: CordyBridgeSide, to: CordyBridgeSide, recipient: string, options?: CordyBridgeOptions): Promise<CordyBridgeResult>;
|
|
72
|
+
/** Resume destination delivery for the most recent Stellar-to-EVM CCTP burn saved in this browser. */
|
|
73
|
+
export declare function cordy_resumeBridge(): Promise<CordyBridgeResult>;
|
|
71
74
|
/** Read the full-precision balance for the active wallet and selected asset. */
|
|
72
75
|
export declare function cordy_balance(options?: CordyBalanceOptions): Promise<CordyBalanceResult>;
|
|
73
76
|
/** Swap two configured assets using the active EVM or Stellar wallet. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transfer.d.ts","sourceRoot":"","sources":["../../client/transfer.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,iBAAiB,EAAgF,MAAM,iBAAiB,CAAC;AAEvI,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAK5N,MAAM,MAAM,oBAAoB,GAAG;IACjC,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,iHAAiH;IACjH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,e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,GAAG,IAAI,CA2BpF;AAsaD,+FAA+F;AAC/F,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,IAAI,EAAE,eAAe,EACrB,EAAE,EAAE,eAAe,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,kBAAuB,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CA8D5B;AAED,sGAAsG;AACtG,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAsCrE;AAsID,gFAAgF;AAChF,wBAAsB,aAAa,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAYlG;AAySD,yEAAyE;AACzE,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,gBAAgB,SAAiC,EACjD,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAW1B;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,iBAAiB,CAAA;CAAE,GAAG,IAAI,CAE5E;AAED,2EAA2E;AAC3E,wBAAsB,cAAc,CAClC,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,mBAAmB,CAAC,CAa9B"}
|
package/dist/client/transfer.js
CHANGED
|
@@ -5,13 +5,34 @@ import { BrowserProvider, Contract, formatUnits, isAddress, JsonRpcProvider, par
|
|
|
5
5
|
import { getActiveWagmiConfig } from "../config/walletConfig";
|
|
6
6
|
import { readTokenBalance } from "../controllers/Get_Balance";
|
|
7
7
|
import loadStellarBalance from "../controllers/loadStellarBalance";
|
|
8
|
-
import { cctpBridge } from "../controllers/cctpBridge";
|
|
8
|
+
import { cctpBridge, cctpResumeStellarToEvm } from "../controllers/cctpBridge";
|
|
9
9
|
import tokenAbi from "../config/ERC20_ABI.json";
|
|
10
10
|
import { setCordyRuntimeConfig } from "./runtimeConfig";
|
|
11
11
|
import { waitForBridgeEvmWallet } from "../controllers/bridgeWalletSession";
|
|
12
12
|
import { getConfiguredEvmAssets, requireConfiguredEvmNetwork } from "./runtimeConfig";
|
|
13
13
|
const ACTIVE_WALLET_SESSION_KEY = "cordy_minikit_active_wallet_session";
|
|
14
14
|
const STELLAR_WALLET_STORAGE_KEY = "cordy_minikit_stellar_wallet";
|
|
15
|
+
async function disconnectActiveEvmWallets() {
|
|
16
|
+
const walletConfig = getActiveWagmiConfig();
|
|
17
|
+
const connections = Array.from(walletConfig.state.connections.values());
|
|
18
|
+
if (connections.length === 0)
|
|
19
|
+
return;
|
|
20
|
+
let disconnect;
|
|
21
|
+
try {
|
|
22
|
+
({ disconnect } = await import("wagmi/actions"));
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
for (const connection of connections) {
|
|
28
|
+
try {
|
|
29
|
+
await disconnect(walletConfig, { connector: connection.connector });
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// A bridge result or its original error should not be replaced by cleanup failure.
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
15
36
|
// Bridge deployments and tokens are supplied through the app's bridge configuration.
|
|
16
37
|
const BRIDGE_ERC20_ABI = [
|
|
17
38
|
"function allowance(address owner,address spender) view returns (uint256)",
|
|
@@ -324,10 +345,6 @@ async function bridgeEvm(amount, from, to, recipient, options = {}) {
|
|
|
324
345
|
const receipt = await transaction.wait();
|
|
325
346
|
if (!receipt || receipt.status !== 1)
|
|
326
347
|
throw new Error("The source-chain bridge deposit failed.");
|
|
327
|
-
const { disconnect } = await import("wagmi/actions");
|
|
328
|
-
for (const activeConnection of Array.from(walletConfig.state.connections.values())) {
|
|
329
|
-
await disconnect(walletConfig, { connector: activeConnection.connector });
|
|
330
|
-
}
|
|
331
348
|
return {
|
|
332
349
|
success: true,
|
|
333
350
|
asset: sourceConfig.assetSymbol,
|
|
@@ -442,6 +459,7 @@ async function bridgeStellar(amount, from, to, recipient, options = {}) {
|
|
|
442
459
|
}
|
|
443
460
|
/** Bridge a configured ERC-20 asset between the configured internal and external EVM sides. */
|
|
444
461
|
export async function cordy_bridge(amount, from, to, recipient, options = {}) {
|
|
462
|
+
let disconnectEvmAfterStellarCctp = false;
|
|
445
463
|
try {
|
|
446
464
|
const normalized = normalizedAmount(amount);
|
|
447
465
|
const route = resolveBridgeRoute(configuredAssets?.bridge, options.routeId);
|
|
@@ -453,6 +471,8 @@ export async function cordy_bridge(amount, from, to, recipient, options = {}) {
|
|
|
453
471
|
if (!destinationConfig) {
|
|
454
472
|
throw new Error(`Bridge destination configuration for '${to}' is missing.`);
|
|
455
473
|
}
|
|
474
|
+
disconnectEvmAfterStellarCctp = route.protocol === "cctp" && ((sourceConfig.networkType === "stellar" && destinationConfig.networkType === "evm") ||
|
|
475
|
+
(sourceConfig.networkType === "evm" && destinationConfig.networkType === "stellar"));
|
|
456
476
|
const needsEvmWallet = sourceConfig.networkType === "evm"
|
|
457
477
|
|| (route.protocol === "cctp" && sourceConfig.networkType === "stellar" && destinationConfig.networkType === "evm");
|
|
458
478
|
if (needsEvmWallet) {
|
|
@@ -497,6 +517,58 @@ export async function cordy_bridge(amount, from, to, recipient, options = {}) {
|
|
|
497
517
|
errorDetail,
|
|
498
518
|
};
|
|
499
519
|
}
|
|
520
|
+
finally {
|
|
521
|
+
if (disconnectEvmAfterStellarCctp)
|
|
522
|
+
await disconnectActiveEvmWallets();
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
/** Resume destination delivery for the most recent Stellar-to-EVM CCTP burn saved in this browser. */
|
|
526
|
+
export async function cordy_resumeBridge() {
|
|
527
|
+
let disconnectEvmAfterResume = false;
|
|
528
|
+
try {
|
|
529
|
+
const raw = window.localStorage.getItem("cordy_minikit_stellar_cctp_recovery");
|
|
530
|
+
if (!raw)
|
|
531
|
+
throw new Error("No recoverable Stellar CCTP burn was found in this browser.");
|
|
532
|
+
const recovery = JSON.parse(raw);
|
|
533
|
+
if (!recovery.burnTransactionHash || !recovery.from || !recovery.to || !recovery.routeId)
|
|
534
|
+
throw new Error("The saved Stellar CCTP recovery record is incomplete.");
|
|
535
|
+
const route = resolveBridgeRoute(configuredAssets?.bridge, recovery.routeId);
|
|
536
|
+
const source = route[recovery.from];
|
|
537
|
+
const destination = route[recovery.to];
|
|
538
|
+
if (!source || source.networkType !== "stellar" || !destination || destination.networkType !== "evm") {
|
|
539
|
+
throw new Error("The saved recovery record does not match a Stellar-to-EVM CCTP route.");
|
|
540
|
+
}
|
|
541
|
+
disconnectEvmAfterResume = true;
|
|
542
|
+
const walletConfig = getActiveWagmiConfig();
|
|
543
|
+
const current = walletConfig.state.current;
|
|
544
|
+
const connection = current ? walletConfig.state.connections.get(current) : undefined;
|
|
545
|
+
if (!connection) {
|
|
546
|
+
await waitForBridgeEvmWallet({
|
|
547
|
+
routeId: route.id,
|
|
548
|
+
amount: recovery.amount ?? "",
|
|
549
|
+
from: recovery.from,
|
|
550
|
+
to: recovery.to,
|
|
551
|
+
recipient: recovery.recipient ?? "",
|
|
552
|
+
sourceChainId: destination.chainId,
|
|
553
|
+
sourceNetworkType: "stellar",
|
|
554
|
+
destinationNetworkType: "evm",
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
const transactionHash = await cctpResumeStellarToEvm(recovery.burnTransactionHash, route, recovery.from, recovery.to);
|
|
558
|
+
try {
|
|
559
|
+
window.localStorage.removeItem("cordy_minikit_stellar_cctp_recovery");
|
|
560
|
+
}
|
|
561
|
+
catch { /* Ignore storage cleanup failures after a successful mint. */ }
|
|
562
|
+
return { success: true, from: recovery.from, to: recovery.to, routeId: route.id, routeName: route.name, amount: recovery.amount, asset: recovery.asset, fromNetwork: recovery.fromNetwork, toNetwork: recovery.toNetwork, burnTransactionHash: recovery.burnTransactionHash, transactionHash, status: "submitted" };
|
|
563
|
+
}
|
|
564
|
+
catch (error) {
|
|
565
|
+
const errorDetail = error instanceof Error ? error.message : String(error);
|
|
566
|
+
return { success: false, status: "burned", error: errorDetail, errorDetail };
|
|
567
|
+
}
|
|
568
|
+
finally {
|
|
569
|
+
if (disconnectEvmAfterResume)
|
|
570
|
+
await disconnectActiveEvmWallets();
|
|
571
|
+
}
|
|
500
572
|
}
|
|
501
573
|
async function transferEvm(amount, recipient, requestedSymbol) {
|
|
502
574
|
if (!isAddress(recipient))
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { cordy, cons_verify, cons_disconnect } from "./client/cons";
|
|
2
2
|
export type { ConsDisconnectResult, ConsSessionResult, ConsVerifyResult } from "./client/cons";
|
|
3
3
|
export { useConsSession } from "./client/useConsSession";
|
|
4
|
-
export { configureCordyAssets, cordy_configure, cordy_bridge, cordy_swap, cordy_transfer } from "./client/transfer";
|
|
4
|
+
export { configureCordyAssets, cordy_configure, cordy_bridge, cordy_resumeBridge, cordy_swap, cordy_transfer } from "./client/transfer";
|
|
5
5
|
export type { CordyAssetsConfig, CordyBridgeConfig, CordyBridgeNetworkConfig, CordyBridgeOptions, CordyBridgeRouteConfig, CordyBridgeResult, CordyBridgeSide, CordyTransferOptions, CordyTransferResult, CordySwapOptions, CordySwapResult, EvmAssetConfig, EvmAssetRegistry, EvmNetworkConfig, StellarAssetConfig } from "./client/transfer";
|
|
6
6
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACpE,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AACpE,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxI,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,eAAe,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { cordy, cons_verify, cons_disconnect } from "./client/cons";
|
|
2
2
|
export { useConsSession } from "./client/useConsSession";
|
|
3
|
-
export { configureCordyAssets, cordy_configure, cordy_bridge, cordy_swap, cordy_transfer } from "./client/transfer";
|
|
3
|
+
export { configureCordyAssets, cordy_configure, cordy_bridge, cordy_resumeBridge, cordy_swap, cordy_transfer } from "./client/transfer";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Connect_wallet_bt.d.ts","sourceRoot":"","sources":["../../components/Connect_wallet_bt.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Connect_wallet_bt.d.ts","sourceRoot":"","sources":["../../components/Connect_wallet_bt.tsx"],"names":[],"mappings":"AAuBA,KAAK,oBAAoB,GAAG;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,CACA;IAAE,YAAY,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GACxC;IAAE,YAAY,CAAC,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,EAAE,KAAK,CAAA;CAAE,CAC7C,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,SAAS,EACT,YAAoB,EACpB,QAAQ,GACT,EAAE,oBAAoB,+BAkFtB"}
|
|
@@ -1,9 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
|
+
import { useRouter } from "next/navigation";
|
|
4
5
|
import { useAccount } from "wagmi";
|
|
5
6
|
import { getTokenBalance, loadStellarBalance } from "../controllers";
|
|
6
7
|
import { useStellarWallet, useWalletModal } from "../wagmi__providers";
|
|
8
|
+
import { useConsSession } from "../client/useConsSession";
|
|
9
|
+
function ConsSessionRedirect({ navigate }) {
|
|
10
|
+
const router = useRouter();
|
|
11
|
+
const session = useConsSession();
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (session.authenticated)
|
|
14
|
+
router.replace(navigate);
|
|
15
|
+
}, [navigate, router, session.authenticated]);
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
7
18
|
// const ACTIVE_WALLET_SESSION_KEY = "cordy_minikit_active_wallet_session";
|
|
8
19
|
const STELLAR_BALANCE_REFRESH_EVENT = "cordy:stellar-balance-updated";
|
|
9
20
|
export default function ConnectWalletBT({ className, cons_session = false, navigate, }) {
|
|
@@ -67,11 +78,11 @@ export default function ConnectWalletBT({ className, cons_session = false, navig
|
|
|
67
78
|
window.addEventListener(STELLAR_BALANCE_REFRESH_EVENT, handler);
|
|
68
79
|
return () => window.removeEventListener(STELLAR_BALANCE_REFRESH_EVENT, handler);
|
|
69
80
|
}, [cons_session, setStellarWallet, stellarWallet.address]);
|
|
70
|
-
return (_jsx("button", { className: className, onClick: () => openModal({ consSession: cons_session, navigate }), "data-cons-session": cons_session ? "enabled" : undefined, type: "button", children: cons_session
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
81
|
+
return (_jsxs(_Fragment, { children: [cons_session && navigate && _jsx(ConsSessionRedirect, { navigate: navigate }), _jsx("button", { className: className, onClick: () => openModal({ consSession: cons_session, navigate }), "data-cons-session": cons_session ? "enabled" : undefined, type: "button", children: cons_session
|
|
82
|
+
? walletConnected ? "Connected" : "Connect Wallet"
|
|
83
|
+
: isConnected
|
|
84
|
+
? `BAL ${balance} ${symbol}`
|
|
85
|
+
: stellarWallet.address
|
|
86
|
+
? `BAL ${stellarWallet.balance ?? "0"} XLM`
|
|
87
|
+
: "Connect Wallet" })] }));
|
|
77
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BridgeEvmWalletModal.d.ts","sourceRoot":"","sources":["../../controllers/BridgeEvmWalletModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BridgeEvmWalletModal.d.ts","sourceRoot":"","sources":["../../controllers/BridgeEvmWalletModal.tsx"],"names":[],"mappings":"AAkBA,MAAM,MAAM,yBAAyB,GAAG;IACtC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAwEF,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,EAC3C,IAAI,EAAE,cAAc,EACpB,OAAO,EAAE,iBAAiB,EAC1B,WAAW,EACX,iBAAiB,EACjB,eAAe,EACf,KAAK,EACL,IAAI,GACL,EAAE,yBAAyB,sCAmI3B"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect, useSyncExternalStore, useState } from "react";
|
|
3
|
+
import { useEffect, useRef, useSyncExternalStore, useState } from "react";
|
|
4
4
|
import { useConnect } from "wagmi";
|
|
5
5
|
import Images from "../config/Image.json";
|
|
6
6
|
import { UI_Comp__css } from "../css";
|
|
7
7
|
import { isEvmEnvironmentConfigured } from "../config/walletConfig";
|
|
8
8
|
import { getConfiguredEvmAssets, getCordyRuntimeConfig } from "../client/runtimeConfig";
|
|
9
|
+
import { cordy_resumeBridge } from "../client/transfer";
|
|
9
10
|
import { getBridgeWalletSession, rejectBridgeWalletSession, resolveBridgeWalletSession, subscribeBridgeWalletSession, } from "./bridgeWalletSession";
|
|
10
11
|
const ALWAYS_AVAILABLE_CONNECTOR_NAMES = new Set([
|
|
11
12
|
"WalletConnect",
|
|
@@ -69,6 +70,7 @@ async function prepareConnectedWallet(connector, routeId, from, to) {
|
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
export default function BridgeEvmWalletModal({ open: controlledOpen, onClose: controlledOnClose, onConnected, onConnectionError, targetChainName, title, note, }) {
|
|
73
|
+
const recoveryStarted = useRef(false);
|
|
72
74
|
const sessionRequest = useSyncExternalStore(subscribeBridgeWalletSession, getBridgeWalletSession, () => undefined);
|
|
73
75
|
const open = controlledOpen ?? Boolean(sessionRequest);
|
|
74
76
|
const onClose = controlledOnClose ?? (() => rejectBridgeWalletSession());
|
|
@@ -90,6 +92,26 @@ export default function BridgeEvmWalletModal({ open: controlledOpen, onClose: co
|
|
|
90
92
|
setError(undefined);
|
|
91
93
|
}
|
|
92
94
|
}, [open]);
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
if (recoveryStarted.current || typeof window === "undefined")
|
|
97
|
+
return;
|
|
98
|
+
try {
|
|
99
|
+
if (!window.localStorage.getItem("cordy_minikit_stellar_cctp_recovery"))
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
recoveryStarted.current = true;
|
|
106
|
+
void cordy_resumeBridge().then((result) => {
|
|
107
|
+
window.dispatchEvent(new CustomEvent("cordy:stellar-cctp-recovery-result", { detail: result }));
|
|
108
|
+
}).catch((error) => {
|
|
109
|
+
const errorDetail = error instanceof Error ? error.message : String(error);
|
|
110
|
+
window.dispatchEvent(new CustomEvent("cordy:stellar-cctp-recovery-result", {
|
|
111
|
+
detail: { success: false, status: "burned", error: errorDetail, errorDetail },
|
|
112
|
+
}));
|
|
113
|
+
});
|
|
114
|
+
}, []);
|
|
93
115
|
if (!open)
|
|
94
116
|
return null;
|
|
95
117
|
const connect = async (connector) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CordyBridgeRouteConfig } from "../client/runtimeConfig";
|
|
2
2
|
import type { CordyBridgeResult } from "../client/transfer";
|
|
3
3
|
type CordyBridgeSide = "internal" | "external";
|
|
4
|
+
export declare function cctpResumeStellarToEvm(burnHash: string, route: CordyBridgeRouteConfig, from: CordyBridgeSide, to: CordyBridgeSide): Promise<string>;
|
|
4
5
|
export declare function cctpBridge(amount: string, from: CordyBridgeSide, to: CordyBridgeSide, recipient: string, route: CordyBridgeRouteConfig): Promise<CordyBridgeResult>;
|
|
5
6
|
export {};
|
|
6
7
|
//# sourceMappingURL=cctpBridge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cctpBridge.d.ts","sourceRoot":"","sources":["../../controllers/cctpBridge.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,KAAK,eAAe,GAAG,UAAU,GAAG,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"cctpBridge.d.ts","sourceRoot":"","sources":["../../controllers/cctpBridge.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,sBAAsB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D,KAAK,eAAe,GAAG,UAAU,GAAG,UAAU,CAAC;AA+Q/C,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,sBAAsB,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAUzJ;AAED,wBAAsB,UAAU,CAC9B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,eAAe,EACrB,EAAE,EAAE,eAAe,EACnB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,iBAAiB,CAAC,CAgH5B"}
|
|
@@ -32,6 +32,17 @@ const MESSAGE_TRANSMITTER_ABI = [
|
|
|
32
32
|
"function receiveMessage(bytes message,bytes attestation)",
|
|
33
33
|
];
|
|
34
34
|
const EMPTY_DESTINATION_CALLER = `0x${"00".repeat(32)}`;
|
|
35
|
+
const STELLAR_CCTP_RECOVERY_KEY = "cordy_minikit_stellar_cctp_recovery";
|
|
36
|
+
async function getConnectedEvmProvider(connection) {
|
|
37
|
+
const connector = connection.connector;
|
|
38
|
+
if (typeof connector.getProvider === "function") {
|
|
39
|
+
return await connector.getProvider();
|
|
40
|
+
}
|
|
41
|
+
const injectedProvider = window.ethereum;
|
|
42
|
+
if (injectedProvider)
|
|
43
|
+
return injectedProvider;
|
|
44
|
+
throw new Error("The connected EVM wallet provider is unavailable. Reconnect the destination wallet and resume the bridge.");
|
|
45
|
+
}
|
|
35
46
|
function toBytes32(value) {
|
|
36
47
|
if (!isAddress(value))
|
|
37
48
|
throw new Error("CCTP EVM recipients must be valid EVM addresses.");
|
|
@@ -67,7 +78,7 @@ function evmAddressBytes32(value) {
|
|
|
67
78
|
throw new Error("CCTP EVM recipients must be valid EVM addresses.");
|
|
68
79
|
return xdr.ScVal.scvBytes(Buffer.from(value.slice(2).padStart(64, "0"), "hex"));
|
|
69
80
|
}
|
|
70
|
-
async function submitStellarSorobanTransaction(server, contractId, method, args, networkPassphrase, sourceAddress) {
|
|
81
|
+
async function submitStellarSorobanTransaction(server, contractId, method, args, networkPassphrase, sourceAddress, onSubmitted) {
|
|
71
82
|
const account = await server.getAccount(sourceAddress);
|
|
72
83
|
const transaction = new TransactionBuilder(account, {
|
|
73
84
|
fee: "10000000",
|
|
@@ -91,6 +102,7 @@ async function submitStellarSorobanTransaction(server, contractId, method, args,
|
|
|
91
102
|
const result = await server.sendTransaction(TransactionBuilder.fromXDR(signed.signedTxXdr, networkPassphrase));
|
|
92
103
|
if (result.status === "ERROR")
|
|
93
104
|
throw new Error(`Stellar transaction submission failed: ${JSON.stringify(result)}`);
|
|
105
|
+
onSubmitted?.(result.hash);
|
|
94
106
|
let completed = await server.getTransaction(result.hash);
|
|
95
107
|
while (completed.status === "NOT_FOUND") {
|
|
96
108
|
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
@@ -125,7 +137,7 @@ async function getDestinationEvmWallet(destination) {
|
|
|
125
137
|
if (!connection) {
|
|
126
138
|
throw new Error("Connect an EVM wallet on the destination network before starting the Stellar CCTP transfer.");
|
|
127
139
|
}
|
|
128
|
-
const rawProvider = await connection
|
|
140
|
+
const rawProvider = await getConnectedEvmProvider(connection);
|
|
129
141
|
let provider = new BrowserProvider(rawProvider);
|
|
130
142
|
const chain = await evmStep(`read the connected wallet chain for ${destination.networkName}`, () => provider.getNetwork());
|
|
131
143
|
if (destination.chainId === undefined || Number(chain.chainId) !== destination.chainId) {
|
|
@@ -149,13 +161,6 @@ async function getDestinationEvmWallet(destination) {
|
|
|
149
161
|
}
|
|
150
162
|
return { walletConfig, connection, provider };
|
|
151
163
|
}
|
|
152
|
-
async function disconnectEvmWallets(walletConfig) {
|
|
153
|
-
const { disconnect } = await import("wagmi/actions");
|
|
154
|
-
const connections = Array.from(walletConfig.state.connections.values());
|
|
155
|
-
for (const connection of connections) {
|
|
156
|
-
await disconnect(walletConfig, { connector: connection.connector });
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
164
|
async function bridgeStellarToEvm(amount, from, to, recipient, route) {
|
|
160
165
|
const source = route[from];
|
|
161
166
|
const destination = route[to];
|
|
@@ -193,6 +198,7 @@ async function bridgeStellarToEvm(amount, from, to, recipient, route) {
|
|
|
193
198
|
nativeToScVal(amountIn, { type: "i128" }),
|
|
194
199
|
nativeToScVal(latestLedger.sequence + 100000, { type: "u32" }),
|
|
195
200
|
], networkPassphrase, sourceAddress);
|
|
201
|
+
const recoveryForBurn = (burnTransactionHash) => ({ burnTransactionHash, from, to, routeId: route.id, routeName: route.name, amount, recipient, asset: source.assetSymbol, fromNetwork: source.networkName, toNetwork: destination.networkName });
|
|
196
202
|
const burnHash = await submitStellarSorobanTransaction(server, source.tokenMessengerMinter, "deposit_for_burn", [
|
|
197
203
|
owner,
|
|
198
204
|
nativeToScVal(amountIn, { type: "i128" }),
|
|
@@ -202,7 +208,48 @@ async function bridgeStellarToEvm(amount, from, to, recipient, route) {
|
|
|
202
208
|
xdr.ScVal.scvBytes(Buffer.alloc(32)),
|
|
203
209
|
nativeToScVal(0n, { type: "i128" }),
|
|
204
210
|
nativeToScVal(2000, { type: "u32" }),
|
|
205
|
-
], networkPassphrase, sourceAddress)
|
|
211
|
+
], networkPassphrase, sourceAddress, (hash) => {
|
|
212
|
+
try {
|
|
213
|
+
window.localStorage.setItem(STELLAR_CCTP_RECOVERY_KEY, JSON.stringify(recoveryForBurn(hash)));
|
|
214
|
+
}
|
|
215
|
+
catch { /* Recovery storage may be unavailable in restricted browsers. */ }
|
|
216
|
+
window.dispatchEvent(new CustomEvent("cordy:stellar-cctp-burn-submitted", { detail: { transactionHash: hash } }));
|
|
217
|
+
});
|
|
218
|
+
const recovery = recoveryForBurn(burnHash);
|
|
219
|
+
try {
|
|
220
|
+
window.localStorage.setItem(STELLAR_CCTP_RECOVERY_KEY, JSON.stringify(recovery));
|
|
221
|
+
}
|
|
222
|
+
catch { /* Recovery storage may be unavailable in restricted browsers. */ }
|
|
223
|
+
try {
|
|
224
|
+
const result = await finishStellarToEvm(burnHash, source, destination, destinationWallet);
|
|
225
|
+
try {
|
|
226
|
+
window.localStorage.removeItem(STELLAR_CCTP_RECOVERY_KEY);
|
|
227
|
+
}
|
|
228
|
+
catch { /* Ignore storage cleanup failures. */ }
|
|
229
|
+
return {
|
|
230
|
+
success: true,
|
|
231
|
+
asset: source.assetSymbol,
|
|
232
|
+
from,
|
|
233
|
+
to,
|
|
234
|
+
fromNetwork: source.networkName,
|
|
235
|
+
toNetwork: destination.networkName,
|
|
236
|
+
routeId: route.id,
|
|
237
|
+
routeName: route.name,
|
|
238
|
+
amount,
|
|
239
|
+
transactionHash: result.hash,
|
|
240
|
+
status: "submitted",
|
|
241
|
+
approvalTransactionHash: approveHash,
|
|
242
|
+
burnTransactionHash: burnHash,
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
catch (error) {
|
|
246
|
+
const errorDetail = error instanceof Error ? error.message : String(error);
|
|
247
|
+
return { success: false, ...recovery, status: "burned", error: `The Stellar burn succeeded (${burnHash}), but destination minting did not finish: ${errorDetail}`, errorDetail };
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
async function finishStellarToEvm(burnHash, source, destination, destinationWallet) {
|
|
251
|
+
if (source.domain === undefined || !destination.messageTransmitter)
|
|
252
|
+
throw new Error("The saved CCTP route is missing its source domain or destination transmitter.");
|
|
206
253
|
const attestation = await waitForCctpAttestation(source.domain, burnHash);
|
|
207
254
|
const signer = await destinationWallet.provider.getSigner(destinationWallet.connection.accounts[0]);
|
|
208
255
|
const transmitter = new Contract(destination.messageTransmitter, MESSAGE_TRANSMITTER_ABI, signer);
|
|
@@ -210,21 +257,19 @@ async function bridgeStellarToEvm(amount, from, to, recipient, route) {
|
|
|
210
257
|
const receipt = await mintTransaction.wait();
|
|
211
258
|
if (!receipt || receipt.status !== 1)
|
|
212
259
|
throw new Error("EVM CCTP mint transaction failed.");
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
approvalTransactionHash: approveHash,
|
|
227
|
-
};
|
|
260
|
+
return { hash: receipt.hash || mintTransaction.hash };
|
|
261
|
+
}
|
|
262
|
+
export async function cctpResumeStellarToEvm(burnHash, route, from, to) {
|
|
263
|
+
const source = route[from];
|
|
264
|
+
const destination = route[to];
|
|
265
|
+
if (!source || source.networkType !== "stellar" || !destination || destination.networkType !== "evm") {
|
|
266
|
+
throw new Error("Recovery requires a Stellar-to-EVM CCTP route.");
|
|
267
|
+
}
|
|
268
|
+
if (!destination.messageTransmitter)
|
|
269
|
+
throw new Error("The destination CCTP message transmitter is not configured.");
|
|
270
|
+
const wallet = await getDestinationEvmWallet(destination);
|
|
271
|
+
const result = await finishStellarToEvm(burnHash, source, destination, wallet);
|
|
272
|
+
return result.hash;
|
|
228
273
|
}
|
|
229
274
|
export async function cctpBridge(amount, from, to, recipient, route) {
|
|
230
275
|
const source = route[from];
|
|
@@ -299,15 +344,6 @@ export async function cctpBridge(amount, from, to, recipient, route) {
|
|
|
299
344
|
const receipt = await evmStep("wait for the EVM burn receipt", () => transaction.wait());
|
|
300
345
|
if (!receipt || receipt.status !== 1)
|
|
301
346
|
throw new Error("CCTP burn transaction failed.");
|
|
302
|
-
let disconnectWarning;
|
|
303
|
-
try {
|
|
304
|
-
await disconnectEvmWallets(walletConfig);
|
|
305
|
-
}
|
|
306
|
-
catch (error) {
|
|
307
|
-
disconnectWarning = error instanceof Error
|
|
308
|
-
? `The bridge completed, but the EVM wallet could not be disconnected: ${error.message}`
|
|
309
|
-
: "The bridge completed, but the EVM wallet could not be disconnected.";
|
|
310
|
-
}
|
|
311
347
|
return {
|
|
312
348
|
success: true,
|
|
313
349
|
asset: source.assetSymbol,
|
|
@@ -321,6 +357,5 @@ export async function cctpBridge(amount, from, to, recipient, route) {
|
|
|
321
357
|
...(approvalTransactionHash ? { approvalTransactionHash } : {}),
|
|
322
358
|
transactionHash: receipt.hash || transaction.hash,
|
|
323
359
|
status: "pending",
|
|
324
|
-
...(disconnectWarning ? { warning: disconnectWarning } : {}),
|
|
325
360
|
};
|
|
326
361
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,6 @@ export type { BridgeEvmWalletModalProps, BridgeEvmWalletRequest, UseBridgeEvmWal
|
|
|
7
7
|
export { cordy, cons_verify, cons_disconnect } from "./client";
|
|
8
8
|
export type { ConsDisconnectResult, ConsSessionResult, ConsVerifyResult } from "./client";
|
|
9
9
|
export { useConsSession } from "./client/useConsSession";
|
|
10
|
-
export { configureCordyAssets, cordy_balance, cordy_configure, cordy_bridge, cordy_swap, cordy_transfer } from "./client/transfer";
|
|
10
|
+
export { configureCordyAssets, cordy_balance, cordy_configure, cordy_bridge, cordy_resumeBridge, cordy_swap, cordy_transfer } from "./client/transfer";
|
|
11
11
|
export type { CordyAssetsConfig, CordyBalanceOptions, CordyBalanceResult, CordyTransferOptions, CordyTransferResult, CordySwapOptions, CordySwapResult, CordyBridgeConfig, CordyBridgeNetworkConfig, CordyBridgeOptions, CordyBridgeRouteConfig, CordyBridgeResult, CordyBridgeSide, EvmAssetConfig, EvmAssetRegistry, EvmNetworkConfig, StellarAssetConfig, StellarNetworkConfig } from "./client/transfer";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGvE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAGlH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAGvE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAG7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAGpD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,oBAAoB,EACpB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,yBAAyB,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAGlH,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC/D,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC1F,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,eAAe,EAAE,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACvJ,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,4 +11,4 @@ export { CordyStackTrans, CordyStackTransStellar, useWalletStatus, useDisconnect
|
|
|
11
11
|
// Client-side JWT session helpers (safe for browser imports).
|
|
12
12
|
export { cordy, cons_verify, cons_disconnect } from "./client";
|
|
13
13
|
export { useConsSession } from "./client/useConsSession";
|
|
14
|
-
export { configureCordyAssets, cordy_balance, cordy_configure, cordy_bridge, cordy_swap, cordy_transfer } from "./client/transfer";
|
|
14
|
+
export { configureCordyAssets, cordy_balance, cordy_configure, cordy_bridge, cordy_resumeBridge, cordy_swap, cordy_transfer } from "./client/transfer";
|