@cordystackx/cordy_minikit 3.1.4 → 3.1.5

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.
@@ -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,eAAe,GAAG;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;IAC5B,IAAI,CAAC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,GAC/B,OAAO,CAAC,iBAAiB,CAAC,CAgE5B;AAED,sGAAsG;AACtG,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,iBAAiB,CAAC,CAwCrE;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"}
@@ -5,34 +5,13 @@ 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, cctpResumeStellarToEvm } from "../controllers/cctpBridge";
8
+ import { cctpBridge, cctpResumeStellarToEvm, disconnectCctpEvmWallets, getStellarCctpRecoveryRecords, removeStellarCctpRecoveryRecord } 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
- }
36
15
  // Bridge deployments and tokens are supplied through the app's bridge configuration.
37
16
  const BRIDGE_ERC20_ABI = [
38
17
  "function allowance(address owner,address spender) view returns (uint256)",
@@ -459,7 +438,7 @@ async function bridgeStellar(amount, from, to, recipient, options = {}) {
459
438
  }
460
439
  /** Bridge a configured ERC-20 asset between the configured internal and external EVM sides. */
461
440
  export async function cordy_bridge(amount, from, to, recipient, options = {}) {
462
- let disconnectEvmAfterStellarCctp = false;
441
+ let disconnectEvmAfterCctp = false;
463
442
  try {
464
443
  const normalized = normalizedAmount(amount);
465
444
  const route = resolveBridgeRoute(configuredAssets?.bridge, options.routeId);
@@ -471,7 +450,9 @@ export async function cordy_bridge(amount, from, to, recipient, options = {}) {
471
450
  if (!destinationConfig) {
472
451
  throw new Error(`Bridge destination configuration for '${to}' is missing.`);
473
452
  }
474
- disconnectEvmAfterStellarCctp = route.protocol === "cctp" && ((sourceConfig.networkType === "stellar" && destinationConfig.networkType === "evm") ||
453
+ // CCTP may use an EVM wallet on either side. Always release it after the
454
+ // bridge settles, including when a wallet transaction is rejected/cancelled.
455
+ disconnectEvmAfterCctp = route.protocol === "cctp" && ((sourceConfig.networkType === "stellar" && destinationConfig.networkType === "evm") ||
475
456
  (sourceConfig.networkType === "evm" && destinationConfig.networkType === "stellar"));
476
457
  const needsEvmWallet = sourceConfig.networkType === "evm"
477
458
  || (route.protocol === "cctp" && sourceConfig.networkType === "stellar" && destinationConfig.networkType === "evm");
@@ -518,20 +499,17 @@ export async function cordy_bridge(amount, from, to, recipient, options = {}) {
518
499
  };
519
500
  }
520
501
  finally {
521
- if (disconnectEvmAfterStellarCctp)
522
- await disconnectActiveEvmWallets();
502
+ if (disconnectEvmAfterCctp)
503
+ await disconnectCctpEvmWallets();
523
504
  }
524
505
  }
525
506
  /** Resume destination delivery for the most recent Stellar-to-EVM CCTP burn saved in this browser. */
526
507
  export async function cordy_resumeBridge() {
527
508
  let disconnectEvmAfterResume = false;
528
509
  try {
529
- const raw = window.localStorage.getItem("cordy_minikit_stellar_cctp_recovery");
530
- if (!raw)
510
+ const recovery = getStellarCctpRecoveryRecords()[0];
511
+ if (!recovery)
531
512
  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
513
  const route = resolveBridgeRoute(configuredAssets?.bridge, recovery.routeId);
536
514
  const source = route[recovery.from];
537
515
  const destination = route[recovery.to];
@@ -554,20 +532,21 @@ export async function cordy_resumeBridge() {
554
532
  destinationNetworkType: "evm",
555
533
  });
556
534
  }
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" };
535
+ const resumed = await cctpResumeStellarToEvm(recovery.burnTransactionHash, route, recovery.from, recovery.to);
536
+ removeStellarCctpRecoveryRecord(recovery.burnTransactionHash);
537
+ 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: resumed.transactionHash, status: "submitted", ...(resumed.alreadyReceived ? { warning: "This CCTP message was already received on the destination. No additional mint was submitted." } : {}) };
563
538
  }
564
539
  catch (error) {
565
540
  const errorDetail = error instanceof Error ? error.message : String(error);
541
+ if (error instanceof Error && error.name === "CctpMintPendingError") {
542
+ const pendingError = error;
543
+ return { success: false, status: "pending", burnTransactionHash: pendingError.burnTransactionHash, transactionHash: pendingError.mintTransactionHash, error: errorDetail, errorDetail };
544
+ }
566
545
  return { success: false, status: "burned", error: errorDetail, errorDetail };
567
546
  }
568
547
  finally {
569
548
  if (disconnectEvmAfterResume)
570
- await disconnectActiveEvmWallets();
549
+ await disconnectCctpEvmWallets();
571
550
  }
572
551
  }
573
552
  async function transferEvm(amount, recipient, requestedSymbol) {
@@ -1 +1 @@
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
+ {"version":3,"file":"BridgeEvmWalletModal.d.ts","sourceRoot":"","sources":["../../controllers/BridgeEvmWalletModal.tsx"],"names":[],"mappings":"AAmBA,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"}
@@ -7,6 +7,7 @@ import { UI_Comp__css } from "../css";
7
7
  import { isEvmEnvironmentConfigured } from "../config/walletConfig";
8
8
  import { getConfiguredEvmAssets, getCordyRuntimeConfig } from "../client/runtimeConfig";
9
9
  import { cordy_resumeBridge } from "../client/transfer";
10
+ import { getStellarCctpRecoveryRecords } from "./cctpBridge";
10
11
  import { getBridgeWalletSession, rejectBridgeWalletSession, resolveBridgeWalletSession, subscribeBridgeWalletSession, } from "./bridgeWalletSession";
11
12
  const ALWAYS_AVAILABLE_CONNECTOR_NAMES = new Set([
12
13
  "WalletConnect",
@@ -96,7 +97,7 @@ export default function BridgeEvmWalletModal({ open: controlledOpen, onClose: co
96
97
  if (recoveryStarted.current || typeof window === "undefined")
97
98
  return;
98
99
  try {
99
- if (!window.localStorage.getItem("cordy_minikit_stellar_cctp_recovery"))
100
+ if (getStellarCctpRecoveryRecords().length === 0)
100
101
  return;
101
102
  }
102
103
  catch {
@@ -1,7 +1,26 @@
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
+ export declare function disconnectCctpEvmWallets(): Promise<void>;
5
+ export type StellarCctpRecoveryRecord = {
6
+ burnTransactionHash: string;
7
+ from: CordyBridgeSide;
8
+ to: CordyBridgeSide;
9
+ routeId: string;
10
+ routeName?: string;
11
+ amount?: string;
12
+ recipient?: string;
13
+ asset?: string;
14
+ fromNetwork?: string;
15
+ toNetwork?: string;
16
+ mintTransactionHash?: string;
17
+ };
18
+ export declare function getStellarCctpRecoveryRecords(): StellarCctpRecoveryRecord[];
19
+ export declare function removeStellarCctpRecoveryRecord(burnHash: string): void;
20
+ export declare function cctpResumeStellarToEvm(burnHash: string, route: CordyBridgeRouteConfig, from: CordyBridgeSide, to: CordyBridgeSide): Promise<{
21
+ transactionHash?: string;
22
+ alreadyReceived?: boolean;
23
+ }>;
5
24
  export declare function cctpBridge(amount: string, from: CordyBridgeSide, to: CordyBridgeSide, recipient: string, route: CordyBridgeRouteConfig): Promise<CordyBridgeResult>;
6
25
  export {};
7
26
  //# 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;AAoT/C,wBAAsB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,E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,eAAe,EAAE,EAAE,EAAE,eAAe,GAAG,OAAO,CAAC;IAAE,eAAe,CAAC,EAAE,MAAM,CAAC;IAAC,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAU1M;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,CAkH5B"}
@@ -1,8 +1,29 @@
1
- import { BrowserProvider, Contract, isAddress, parseUnits } from "ethers";
1
+ import { BrowserProvider, Contract, isAddress, isError, parseUnits } from "ethers";
2
2
  import { Address, Contract as StellarContract, nativeToScVal, rpc, StrKey, TransactionBuilder, xdr } from "@stellar/stellar-sdk";
3
3
  import { getNetworkDetails, requestAccess, signTransaction as freighterSignTransaction } from "@stellar/freighter-api";
4
4
  import { getCordyRuntimeConfig } from "../client/runtimeConfig";
5
5
  import { getActiveWagmiConfig } from "../config/walletConfig";
6
+ export async function disconnectCctpEvmWallets() {
7
+ const walletConfig = getActiveWagmiConfig();
8
+ const connections = Array.from(walletConfig.state.connections.values());
9
+ if (connections.length === 0)
10
+ return;
11
+ let disconnect;
12
+ try {
13
+ ({ disconnect } = await import("wagmi/actions"));
14
+ }
15
+ catch {
16
+ return;
17
+ }
18
+ for (const connection of connections) {
19
+ try {
20
+ await disconnect(walletConfig, { connector: connection.connector });
21
+ }
22
+ catch {
23
+ // Preserve the bridge result if wallet cleanup fails.
24
+ }
25
+ }
26
+ }
6
27
  async function evmStep(step, action) {
7
28
  try {
8
29
  return await action();
@@ -30,11 +51,76 @@ const CCTP_MESSENGER_ABI = [
30
51
  ];
31
52
  const MESSAGE_TRANSMITTER_ABI = [
32
53
  "function receiveMessage(bytes message,bytes attestation)",
54
+ "function usedNonces(bytes32 nonce) view returns (bool)",
33
55
  ];
34
56
  const EMPTY_DESTINATION_CALLER = `0x${"00".repeat(32)}`;
35
57
  const STELLAR_CCTP_RECOVERY_KEY = "cordy_minikit_stellar_cctp_recovery";
36
58
  const STELLAR_CONFIRMATION_POLL_INTERVAL_MS = 2000;
37
59
  const STELLAR_CONFIRMATION_MAX_POLLS = 60;
60
+ const CCTP_MINT_LOCK_TTL_MS = 15 * 60 * 1000;
61
+ const activeCctpMints = new Set();
62
+ function readStellarCctpRecoveryMap() {
63
+ try {
64
+ const stored = window.localStorage.getItem(STELLAR_CCTP_RECOVERY_KEY);
65
+ if (!stored)
66
+ return {};
67
+ const parsed = JSON.parse(stored);
68
+ const legacyRecord = parsed;
69
+ if (typeof legacyRecord.burnTransactionHash === "string") {
70
+ return { [legacyRecord.burnTransactionHash]: legacyRecord };
71
+ }
72
+ return parsed;
73
+ }
74
+ catch {
75
+ return {};
76
+ }
77
+ }
78
+ export function getStellarCctpRecoveryRecords() {
79
+ return Object.values(readStellarCctpRecoveryMap()).filter((record) => Boolean(record?.burnTransactionHash && record?.routeId));
80
+ }
81
+ function saveStellarCctpRecoveryRecord(record) {
82
+ const records = readStellarCctpRecoveryMap();
83
+ records[record.burnTransactionHash] = record;
84
+ window.localStorage.setItem(STELLAR_CCTP_RECOVERY_KEY, JSON.stringify(records));
85
+ }
86
+ export function removeStellarCctpRecoveryRecord(burnHash) {
87
+ const records = readStellarCctpRecoveryMap();
88
+ delete records[burnHash];
89
+ try {
90
+ if (Object.keys(records).length)
91
+ window.localStorage.setItem(STELLAR_CCTP_RECOVERY_KEY, JSON.stringify(records));
92
+ else
93
+ window.localStorage.removeItem(STELLAR_CCTP_RECOVERY_KEY);
94
+ }
95
+ catch { /* Ignore storage cleanup failures. */ }
96
+ }
97
+ class CctpMintPendingError extends Error {
98
+ constructor(burnTransactionHash, mintTransactionHash) {
99
+ super(`Destination mint recovery for burn ${burnTransactionHash} is already in progress. Check the pending wallet transaction before retrying.`);
100
+ this.burnTransactionHash = burnTransactionHash;
101
+ this.mintTransactionHash = mintTransactionHash;
102
+ this.name = "CctpMintPendingError";
103
+ }
104
+ }
105
+ class EvmTransactionCancelledError extends Error {
106
+ constructor(replacementHash) {
107
+ super("The wallet cancelled the EVM transaction by replacing it with a cancellation transaction.");
108
+ this.replacementHash = replacementHash;
109
+ this.name = "EvmTransactionCancelledError";
110
+ }
111
+ }
112
+ async function waitForReplaceableEvmTransaction(transaction, startBlock) {
113
+ try {
114
+ return await transaction.replaceableTransaction(startBlock).wait();
115
+ }
116
+ catch (error) {
117
+ if (!isError(error, "TRANSACTION_REPLACED"))
118
+ throw error;
119
+ if (error.cancelled)
120
+ throw new EvmTransactionCancelledError(error.receipt?.hash);
121
+ return error.receipt;
122
+ }
123
+ }
38
124
  class StellarTransactionPendingError extends Error {
39
125
  constructor(transactionHash, detail) {
40
126
  super(detail
@@ -198,6 +284,38 @@ async function bridgeStellarToEvm(amount, from, to, recipient, route) {
198
284
  throw new Error("Configure stellarNetwork.sorobanRpcUrl for Stellar CCTP.");
199
285
  }
200
286
  const destinationWallet = await getDestinationEvmWallet(destination);
287
+ const pendingRecovery = getStellarCctpRecoveryRecords().find((record) => record.routeId === route.id && record.from === from && record.to === to);
288
+ if (pendingRecovery) {
289
+ try {
290
+ const resumed = await finishStellarToEvm(pendingRecovery.burnTransactionHash, source, destination, destinationWallet);
291
+ removeStellarCctpRecoveryRecord(pendingRecovery.burnTransactionHash);
292
+ return {
293
+ success: true,
294
+ asset: pendingRecovery.asset ?? source.assetSymbol,
295
+ from,
296
+ to,
297
+ fromNetwork: pendingRecovery.fromNetwork ?? source.networkName,
298
+ toNetwork: pendingRecovery.toNetwork ?? destination.networkName,
299
+ routeId: route.id,
300
+ routeName: route.name,
301
+ amount: pendingRecovery.amount,
302
+ burnTransactionHash: pendingRecovery.burnTransactionHash,
303
+ transactionHash: resumed.hash,
304
+ status: "submitted",
305
+ ...(resumed.alreadyReceived ? { warning: "This CCTP message was already received on the destination; no additional mint was submitted." } : {}),
306
+ };
307
+ }
308
+ catch (error) {
309
+ const errorDetail = error instanceof Error ? error.message : String(error);
310
+ return {
311
+ success: false,
312
+ ...pendingRecovery,
313
+ status: error instanceof CctpMintPendingError ? "pending" : "burned",
314
+ error: errorDetail,
315
+ errorDetail,
316
+ };
317
+ }
318
+ }
201
319
  const access = await requestAccess();
202
320
  const sourceAddress = access.address;
203
321
  if (!sourceAddress)
@@ -241,7 +359,7 @@ async function bridgeStellarToEvm(amount, from, to, recipient, route) {
241
359
  nativeToScVal(2000, { type: "u32" }),
242
360
  ], networkPassphrase, sourceAddress, (hash) => {
243
361
  try {
244
- window.localStorage.setItem(STELLAR_CCTP_RECOVERY_KEY, JSON.stringify(recoveryForBurn(hash)));
362
+ saveStellarCctpRecoveryRecord(recoveryForBurn(hash));
245
363
  }
246
364
  catch { /* Recovery storage may be unavailable in restricted browsers. */ }
247
365
  window.dispatchEvent(new CustomEvent("cordy:stellar-cctp-burn-submitted", { detail: { transactionHash: hash } }));
@@ -251,28 +369,21 @@ async function bridgeStellarToEvm(amount, from, to, recipient, route) {
251
369
  if (error instanceof StellarTransactionPendingError) {
252
370
  const recovery = recoveryForBurn(error.transactionHash);
253
371
  try {
254
- window.localStorage.setItem(STELLAR_CCTP_RECOVERY_KEY, JSON.stringify(recovery));
372
+ saveStellarCctpRecoveryRecord(recovery);
255
373
  }
256
374
  catch { /* Recovery storage may be unavailable in restricted browsers. */ }
257
375
  return { success: false, ...recovery, status: "pending", transactionHash: error.transactionHash, error: error.message, errorDetail: error.message };
258
376
  }
259
- try {
260
- window.localStorage.removeItem(STELLAR_CCTP_RECOVERY_KEY);
261
- }
262
- catch { /* Ignore storage cleanup failures. */ }
263
377
  throw error;
264
378
  }
265
379
  const recovery = recoveryForBurn(burnHash);
266
380
  try {
267
- window.localStorage.setItem(STELLAR_CCTP_RECOVERY_KEY, JSON.stringify(recovery));
381
+ saveStellarCctpRecoveryRecord(recovery);
268
382
  }
269
383
  catch { /* Recovery storage may be unavailable in restricted browsers. */ }
270
384
  try {
271
385
  const result = await finishStellarToEvm(burnHash, source, destination, destinationWallet);
272
- try {
273
- window.localStorage.removeItem(STELLAR_CCTP_RECOVERY_KEY);
274
- }
275
- catch { /* Ignore storage cleanup failures. */ }
386
+ removeStellarCctpRecoveryRecord(burnHash);
276
387
  return {
277
388
  success: true,
278
389
  asset: source.assetSymbol,
@@ -287,24 +398,131 @@ async function bridgeStellarToEvm(amount, from, to, recipient, route) {
287
398
  status: "submitted",
288
399
  approvalTransactionHash: approveHash,
289
400
  burnTransactionHash: burnHash,
401
+ ...(result.alreadyReceived ? { warning: "This CCTP message was already received on the destination; no additional mint was submitted." } : {}),
290
402
  };
291
403
  }
292
404
  catch (error) {
293
405
  const errorDetail = error instanceof Error ? error.message : String(error);
406
+ if (error instanceof CctpMintPendingError) {
407
+ return { success: false, ...recovery, status: "pending", transactionHash: error.mintTransactionHash, error: errorDetail, errorDetail };
408
+ }
294
409
  return { success: false, ...recovery, status: "burned", error: `The Stellar burn succeeded (${burnHash}), but destination minting did not finish: ${errorDetail}`, errorDetail };
295
410
  }
296
411
  }
297
412
  async function finishStellarToEvm(burnHash, source, destination, destinationWallet) {
298
413
  if (source.domain === undefined || !destination.messageTransmitter)
299
414
  throw new Error("The saved CCTP route is missing its source domain or destination transmitter.");
300
- const attestation = await waitForCctpAttestation(source.domain, burnHash);
301
- const signer = await destinationWallet.provider.getSigner(destinationWallet.connection.accounts[0]);
302
- const transmitter = new Contract(destination.messageTransmitter, MESSAGE_TRANSMITTER_ABI, signer);
303
- const mintTransaction = await transmitter.receiveMessage(attestation.message, attestation.attestation);
304
- const receipt = await mintTransaction.wait();
305
- if (!receipt || receipt.status !== 1)
306
- throw new Error("EVM CCTP mint transaction failed.");
307
- return { hash: receipt.hash || mintTransaction.hash };
415
+ if (activeCctpMints.has(burnHash))
416
+ throw new CctpMintPendingError(burnHash);
417
+ activeCctpMints.add(burnHash);
418
+ const lockKey = `${STELLAR_CCTP_RECOVERY_KEY}:mint:${burnHash}`;
419
+ let mintTransactionHash;
420
+ let lockWritten = false;
421
+ let transmitter;
422
+ let nonce;
423
+ try {
424
+ const attestation = await waitForCctpAttestation(source.domain, burnHash);
425
+ const signer = await destinationWallet.provider.getSigner(destinationWallet.connection.accounts[0]);
426
+ transmitter = new Contract(destination.messageTransmitter, MESSAGE_TRANSMITTER_ABI, signer);
427
+ if (!/^0x[\da-fA-F]{88,}$/.test(attestation.message))
428
+ throw new Error("Circle returned a malformed CCTP message; its nonce cannot be checked.");
429
+ nonce = `0x${attestation.message.slice(2 + 24, 2 + 24 + 64)}`;
430
+ if (await transmitter.usedNonces(nonce)) {
431
+ try {
432
+ window.localStorage.removeItem(lockKey);
433
+ }
434
+ catch { /* The on-chain nonce is authoritative. */ }
435
+ return { alreadyReceived: true };
436
+ }
437
+ let previousLock;
438
+ try {
439
+ const rawLock = window.localStorage.getItem(lockKey);
440
+ previousLock = rawLock ? JSON.parse(rawLock) : undefined;
441
+ }
442
+ catch { /* Ignore malformed or inaccessible lock data and continue with the nonce check. */ }
443
+ if (previousLock?.expiresAt && previousLock.expiresAt > Date.now()) {
444
+ throw new CctpMintPendingError(burnHash, previousLock.mintTransactionHash);
445
+ }
446
+ const lock = { burnTransactionHash: burnHash, expiresAt: Date.now() + CCTP_MINT_LOCK_TTL_MS };
447
+ try {
448
+ window.localStorage.setItem(lockKey, JSON.stringify(lock));
449
+ lockWritten = true;
450
+ }
451
+ catch { /* In-memory guard still protects retries in this tab. */ }
452
+ const startBlock = await signer.provider.getBlockNumber();
453
+ const mintTransaction = await transmitter.receiveMessage(attestation.message, attestation.attestation);
454
+ mintTransactionHash = mintTransaction.hash;
455
+ const extendedLock = { ...lock, mintTransactionHash, expiresAt: Date.now() + CCTP_MINT_LOCK_TTL_MS };
456
+ try {
457
+ window.localStorage.setItem(lockKey, JSON.stringify(extendedLock));
458
+ const recovery = readStellarCctpRecoveryMap()[burnHash];
459
+ if (recovery)
460
+ saveStellarCctpRecoveryRecord({ ...recovery, mintTransactionHash });
461
+ }
462
+ catch { /* Keep the persistent pre-submit lock if storage becomes unavailable. */ }
463
+ let receipt;
464
+ try {
465
+ receipt = await waitForReplaceableEvmTransaction(mintTransaction, startBlock);
466
+ }
467
+ catch (error) {
468
+ if (error instanceof EvmTransactionCancelledError) {
469
+ try {
470
+ window.localStorage.removeItem(lockKey);
471
+ }
472
+ catch { /* A cancelled tx cannot consume this CCTP nonce. */ }
473
+ lockWritten = false;
474
+ const recovery = readStellarCctpRecoveryMap()[burnHash];
475
+ if (recovery) {
476
+ const { mintTransactionHash: _ignored, ...withoutMintHash } = recovery;
477
+ try {
478
+ saveStellarCctpRecoveryRecord(withoutMintHash);
479
+ }
480
+ catch { /* Keep the burn record for another resume attempt. */ }
481
+ }
482
+ mintTransactionHash = undefined;
483
+ }
484
+ throw error;
485
+ }
486
+ if (receipt?.hash) {
487
+ mintTransactionHash = receipt.hash;
488
+ try {
489
+ const lock = { burnTransactionHash: burnHash, mintTransactionHash, expiresAt: Date.now() + CCTP_MINT_LOCK_TTL_MS };
490
+ window.localStorage.setItem(lockKey, JSON.stringify(lock));
491
+ const recovery = readStellarCctpRecoveryMap()[burnHash];
492
+ if (recovery)
493
+ saveStellarCctpRecoveryRecord({ ...recovery, mintTransactionHash });
494
+ }
495
+ catch { /* The receipt hash is still returned to the caller below. */ }
496
+ }
497
+ if (!receipt || receipt.status !== 1)
498
+ throw new Error("EVM CCTP mint transaction failed.");
499
+ try {
500
+ window.localStorage.removeItem(lockKey);
501
+ }
502
+ catch { /* Nonce check protects the next retry. */ }
503
+ return { hash: receipt.hash || mintTransactionHash };
504
+ }
505
+ catch (error) {
506
+ if (lockWritten && !mintTransactionHash) {
507
+ try {
508
+ window.localStorage.removeItem(lockKey);
509
+ }
510
+ catch { /* Ignore lock cleanup failures. */ }
511
+ }
512
+ else if (lockWritten && mintTransactionHash) {
513
+ try {
514
+ const receipt = await destinationWallet.provider.getTransactionReceipt(mintTransactionHash);
515
+ if (receipt && (receipt.status === 0 || (transmitter && nonce && await transmitter.usedNonces(nonce)))) {
516
+ window.localStorage.removeItem(lockKey);
517
+ }
518
+ }
519
+ catch { /* Keep the lock while transaction outcome remains unknown. */ }
520
+ }
521
+ throw error;
522
+ }
523
+ finally {
524
+ activeCctpMints.delete(burnHash);
525
+ }
308
526
  }
309
527
  export async function cctpResumeStellarToEvm(burnHash, route, from, to) {
310
528
  const source = route[from];
@@ -316,7 +534,7 @@ export async function cctpResumeStellarToEvm(burnHash, route, from, to) {
316
534
  throw new Error("The destination CCTP message transmitter is not configured.");
317
535
  const wallet = await getDestinationEvmWallet(destination);
318
536
  const result = await finishStellarToEvm(burnHash, source, destination, wallet);
319
- return result.hash;
537
+ return { transactionHash: result.hash, alreadyReceived: result.alreadyReceived };
320
538
  }
321
539
  export async function cctpBridge(amount, from, to, recipient, route) {
322
540
  const source = route[from];
@@ -369,8 +587,9 @@ export async function cctpBridge(amount, from, to, recipient, route) {
369
587
  const allowance = BigInt(allowanceValue.toString());
370
588
  let approvalTransactionHash;
371
589
  if (allowance < amountIn) {
590
+ const approvalStartBlock = await signer.provider.getBlockNumber();
372
591
  const approval = await evmStep(`submit ${source.assetSymbol} approval`, () => token.approve(source.tokenMessenger, amountIn));
373
- const receipt = await evmStep("wait for the EVM approval receipt", () => approval.wait());
592
+ const receipt = await evmStep("wait for the EVM approval receipt", () => waitForReplaceableEvmTransaction(approval, approvalStartBlock));
374
593
  if (!receipt || receipt.status !== 1)
375
594
  throw new Error("CCTP token approval failed.");
376
595
  approvalTransactionHash = receipt.hash || approval.hash;
@@ -379,6 +598,7 @@ export async function cctpBridge(amount, from, to, recipient, route) {
379
598
  const destinationDomain = requireCctpArgument(destination.domain, "destination domain");
380
599
  const maxFee = 0n;
381
600
  const minFinalityThreshold = 2000;
601
+ const burnStartBlock = await signer.provider.getBlockNumber();
382
602
  if (destination.networkType === "stellar") {
383
603
  const forwarder = stellarContractToBytes32(destination.cctpForwarder);
384
604
  const hookData = buildForwarderHook(recipient);
@@ -388,7 +608,7 @@ export async function cctpBridge(amount, from, to, recipient, route) {
388
608
  const mintRecipient = toBytes32(recipient);
389
609
  transaction = await evmStep("submit the EVM CCTP burn", () => messenger.depositForBurn(amountIn, destinationDomain, mintRecipient, source.tokenAddress, EMPTY_DESTINATION_CALLER, maxFee, minFinalityThreshold));
390
610
  }
391
- const receipt = await evmStep("wait for the EVM burn receipt", () => transaction.wait());
611
+ const receipt = await evmStep("wait for the EVM burn receipt", () => waitForReplaceableEvmTransaction(transaction, burnStartBlock));
392
612
  if (!receipt || receipt.status !== 1)
393
613
  throw new Error("CCTP burn transaction failed.");
394
614
  return {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cordystackx/cordy_minikit",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },