@aptos-labs/cross-chain-core 5.9.0 → 6.0.0
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/CrossChainCore.d.ts +75 -0
- package/dist/CrossChainCore.d.ts.map +1 -1
- package/dist/index.js +360 -161
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +361 -165
- package/dist/index.mjs.map +1 -1
- package/dist/providers/wormhole/signers/AptosLocalSigner.d.ts +8 -6
- package/dist/providers/wormhole/signers/AptosLocalSigner.d.ts.map +1 -1
- package/dist/providers/wormhole/signers/AptosSigner.d.ts +2 -1
- package/dist/providers/wormhole/signers/AptosSigner.d.ts.map +1 -1
- package/dist/providers/wormhole/signers/EthereumSigner.d.ts +1 -1
- package/dist/providers/wormhole/signers/EthereumSigner.d.ts.map +1 -1
- package/dist/providers/wormhole/signers/Signer.d.ts +10 -2
- package/dist/providers/wormhole/signers/Signer.d.ts.map +1 -1
- package/dist/providers/wormhole/signers/SolanaLocalSigner.d.ts +4 -0
- package/dist/providers/wormhole/signers/SolanaLocalSigner.d.ts.map +1 -1
- package/dist/providers/wormhole/signers/SolanaSigner.d.ts.map +1 -1
- package/dist/providers/wormhole/signers/solanaUtils.d.ts.map +1 -1
- package/dist/providers/wormhole/types.d.ts +78 -1
- package/dist/providers/wormhole/types.d.ts.map +1 -1
- package/dist/providers/wormhole/wormhole.d.ts +27 -1
- package/dist/providers/wormhole/wormhole.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +3 -3
- package/src/CrossChainCore.ts +91 -4
- package/src/providers/wormhole/signers/AptosLocalSigner.ts +27 -14
- package/src/providers/wormhole/signers/AptosSigner.ts +10 -1
- package/src/providers/wormhole/signers/EthereumSigner.ts +57 -6
- package/src/providers/wormhole/signers/Signer.ts +19 -2
- package/src/providers/wormhole/signers/SolanaLocalSigner.ts +7 -0
- package/src/providers/wormhole/signers/SolanaSigner.ts +4 -1
- package/src/providers/wormhole/signers/solanaUtils.ts +43 -19
- package/src/providers/wormhole/types.ts +100 -1
- package/src/providers/wormhole/wormhole.ts +138 -28
- package/src/version.ts +1 -1
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Account } from "@aptos-labs/ts-sdk";
|
|
2
2
|
import { Chain, Network, SignAndSendSigner, TxHash, UnsignedTransaction } from "@wormhole-foundation/sdk";
|
|
3
3
|
import { AptosChains } from "@wormhole-foundation/sdk-aptos";
|
|
4
|
-
import {
|
|
4
|
+
import { OnTransactionSigned } from "../types";
|
|
5
|
+
import { CrossChainCore } from "../../../CrossChainCore";
|
|
5
6
|
export declare class AptosLocalSigner<N extends Network, C extends Chain> implements SignAndSendSigner<N, C> {
|
|
6
7
|
_chain: C;
|
|
7
8
|
_options: any;
|
|
8
9
|
_wallet: Account;
|
|
9
|
-
_sponsorAccount: Account |
|
|
10
|
+
_sponsorAccount: Account | undefined;
|
|
11
|
+
_onTransactionSigned: OnTransactionSigned | undefined;
|
|
12
|
+
_crossChainCore: CrossChainCore;
|
|
10
13
|
_claimedTransactionHashes: string[];
|
|
11
|
-
|
|
12
|
-
constructor(chain: C, options: any, wallet: Account, feePayerAccount: Account | GasStationApiKey | undefined, dappNetwork: AptosNetwork);
|
|
14
|
+
constructor(chain: C, options: any, wallet: Account, feePayerAccount: Account | undefined, crossChainCore: CrossChainCore, onTransactionSigned?: OnTransactionSigned);
|
|
13
15
|
chain(): C;
|
|
14
16
|
address(): string;
|
|
15
17
|
claimedTransactionHashes(): string;
|
|
16
18
|
signAndSend(txs: UnsignedTransaction<N, C>[]): Promise<TxHash[]>;
|
|
17
19
|
}
|
|
18
|
-
export declare function signAndSendTransaction(request: UnsignedTransaction<Network, AptosChains>, wallet: Account, sponsorAccount: Account |
|
|
20
|
+
export declare function signAndSendTransaction(request: UnsignedTransaction<Network, AptosChains>, wallet: Account, sponsorAccount: Account | undefined, crossChainCore: CrossChainCore): Promise<string>;
|
|
19
21
|
//# sourceMappingURL=AptosLocalSigner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AptosLocalSigner.d.ts","sourceRoot":"","sources":["../../../../src/providers/wormhole/signers/AptosLocalSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,OAAO,
|
|
1
|
+
{"version":3,"file":"AptosLocalSigner.d.ts","sourceRoot":"","sources":["../../../../src/providers/wormhole/signers/AptosLocalSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,OAAO,EACR,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,KAAK,EACL,OAAO,EACP,iBAAiB,EACjB,MAAM,EACN,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,WAAW,EACZ,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,mBAAmB,EAEpB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,qBAAa,gBAAgB,CAC3B,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,KAAK,CACf,YAAW,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC;IAClC,MAAM,EAAE,CAAC,CAAC;IACV,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,eAAe,EAAE,OAAO,GAAG,SAAS,CAAC;IACrC,oBAAoB,EAAE,mBAAmB,GAAG,SAAS,CAAC;IACtD,eAAe,EAAE,cAAc,CAAC;IAChC,yBAAyB,EAAE,MAAM,EAAE,CAAM;gBAEvC,KAAK,EAAE,CAAC,EACR,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,OAAO,EACf,eAAe,EAAE,OAAO,GAAG,SAAS,EACpC,cAAc,EAAE,cAAc,EAC9B,mBAAmB,CAAC,EAAE,mBAAmB;IAU3C,KAAK,IAAI,CAAC;IAGV,OAAO,IAAI,MAAM;IAIjB,wBAAwB,IAAI,MAAM;IAI5B,WAAW,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAkBvE;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,mBAAmB,CAAC,OAAO,EAAE,WAAW,CAAC,EAClD,MAAM,EAAE,OAAO,EACf,cAAc,EAAE,OAAO,GAAG,SAAS,EACnC,cAAc,EAAE,cAAc,mBAiE/B"}
|
|
@@ -3,6 +3,7 @@ import { AdapterWallet } from "@aptos-labs/wallet-adapter-core";
|
|
|
3
3
|
import { Network } from "@wormhole-foundation/sdk";
|
|
4
4
|
import { AptosChains, AptosUnsignedTransaction } from "@wormhole-foundation/sdk-aptos";
|
|
5
5
|
import { GasStationApiKey } from "..";
|
|
6
|
-
|
|
6
|
+
import { CrossChainCore } from "../../../CrossChainCore";
|
|
7
|
+
export declare function signAndSendTransaction(request: AptosUnsignedTransaction<Network, AptosChains>, wallet: AdapterWallet, sponsorAccount: Account | GasStationApiKey | undefined, dappNetwork: AptosNetwork, crossChainCore?: CrossChainCore): Promise<string>;
|
|
7
8
|
export declare function isAccount(obj: Account | GasStationApiKey): obj is Account;
|
|
8
9
|
//# sourceMappingURL=AptosSigner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AptosSigner.d.ts","sourceRoot":"","sources":["../../../../src/providers/wormhole/signers/AptosSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAMP,OAAO,IAAI,YAAY,EAIxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EACL,WAAW,EACX,wBAAwB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"AptosSigner.d.ts","sourceRoot":"","sources":["../../../../src/providers/wormhole/signers/AptosSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAMP,OAAO,IAAI,YAAY,EAIxB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EACL,WAAW,EACX,wBAAwB,EACzB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAA2B,MAAM,IAAI,CAAC;AAG/D,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,wBAAwB,CAAC,OAAO,EAAE,WAAW,CAAC,EACvD,MAAM,EAAE,aAAa,EACrB,cAAc,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,EACtD,WAAW,EAAE,YAAY,EACzB,cAAc,CAAC,EAAE,cAAc,mBAiHhC;AA0BD,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,GAAG,GAAG,IAAI,OAAO,CAEzE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EvmUnsignedTransaction, EvmChains } from "@wormhole-foundation/sdk-evm";
|
|
2
2
|
import { Network } from "@wormhole-foundation/sdk";
|
|
3
3
|
import { AdapterWallet } from "@aptos-labs/wallet-adapter-core";
|
|
4
|
-
export declare function signAndSendTransaction(request: EvmUnsignedTransaction<Network, EvmChains>, wallet: AdapterWallet, chainName: string
|
|
4
|
+
export declare function signAndSendTransaction(request: EvmUnsignedTransaction<Network, EvmChains>, wallet: AdapterWallet, chainName: string): Promise<string>;
|
|
5
5
|
//# sourceMappingURL=EthereumSigner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EthereumSigner.d.ts","sourceRoot":"","sources":["../../../../src/providers/wormhole/signers/EthereumSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,SAAS,EACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"EthereumSigner.d.ts","sourceRoot":"","sources":["../../../../src/providers/wormhole/signers/EthereumSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,SAAS,EACV,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAEnD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGhE,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,sBAAsB,CAAC,OAAO,EAAE,SAAS,CAAC,EACnD,MAAM,EAAE,aAAa,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAsFjB"}
|
|
@@ -2,7 +2,7 @@ import { UnsignedTransaction, Network, Chain, TxHash, SignAndSendSigner } from "
|
|
|
2
2
|
import { AdapterWallet } from "@aptos-labs/wallet-adapter-core";
|
|
3
3
|
import { ChainConfig } from "../../../config";
|
|
4
4
|
import { CrossChainCore } from "../../../CrossChainCore";
|
|
5
|
-
import { GasStationApiKey } from "../types";
|
|
5
|
+
import { GasStationApiKey, OnTransactionSigned } from "../types";
|
|
6
6
|
import { Account } from "@aptos-labs/ts-sdk";
|
|
7
7
|
export declare class Signer<N extends Network, C extends Chain> implements SignAndSendSigner<N, C> {
|
|
8
8
|
_chain: ChainConfig;
|
|
@@ -11,8 +11,16 @@ export declare class Signer<N extends Network, C extends Chain> implements SignA
|
|
|
11
11
|
_wallet: AdapterWallet;
|
|
12
12
|
_crossChainCore: CrossChainCore;
|
|
13
13
|
_sponsorAccount: Account | GasStationApiKey | undefined;
|
|
14
|
+
_onTransactionSigned: OnTransactionSigned | undefined;
|
|
14
15
|
_claimedTransactionHashes: string[];
|
|
15
|
-
|
|
16
|
+
/**
|
|
17
|
+
* When true, signed tx hashes are written to
|
|
18
|
+
* `_crossChainCore._lastSourceChainTxId` as a recovery side-channel.
|
|
19
|
+
* Set to false for destination-chain claim signers so they don't
|
|
20
|
+
* overwrite the source-chain burn hash.
|
|
21
|
+
*/
|
|
22
|
+
_trackAsSourceChain: boolean;
|
|
23
|
+
constructor(chain: ChainConfig, address: string, options: any, wallet: AdapterWallet, crossChainCore: CrossChainCore, sponsorAccount?: Account | GasStationApiKey | undefined, onTransactionSigned?: OnTransactionSigned, trackAsSourceChain?: boolean);
|
|
16
24
|
chain(): C;
|
|
17
25
|
address(): string;
|
|
18
26
|
claimedTransactionHashes(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Signer.d.ts","sourceRoot":"","sources":["../../../../src/providers/wormhole/signers/Signer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,OAAO,EACP,KAAK,EACL,MAAM,EACN,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAehE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"Signer.d.ts","sourceRoot":"","sources":["../../../../src/providers/wormhole/signers/Signer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,OAAO,EACP,KAAK,EACL,MAAM,EACN,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAehE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,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air, type Commitment } from "@solana/web3.js";
|
|
2
2
|
import { Chain, Network, SignAndSendSigner, TxHash, UnsignedTransaction } from "@wormhole-foundation/sdk";
|
|
3
3
|
import { PriorityFeeConfig } from "./solanaUtils";
|
|
4
|
+
import { OnTransactionSigned } from "../types";
|
|
4
5
|
export interface SolanaLocalSignerConfig {
|
|
5
6
|
/** The Solana keypair to sign transactions with */
|
|
6
7
|
keypair: Keypair;
|
|
@@ -14,6 +15,8 @@ export interface SolanaLocalSignerConfig {
|
|
|
14
15
|
priorityFeeConfig?: PriorityFeeConfig;
|
|
15
16
|
/** Enable verbose logging (default: false) */
|
|
16
17
|
verbose?: boolean;
|
|
18
|
+
/** Optional callback fired before and after each individual transaction is signed. */
|
|
19
|
+
onTransactionSigned?: OnTransactionSigned;
|
|
17
20
|
}
|
|
18
21
|
/**
|
|
19
22
|
* Server-side Solana signer for programmatic transaction signing.
|
|
@@ -49,6 +52,7 @@ export declare class SolanaLocalSigner<N extends Network, C extends Chain> imple
|
|
|
49
52
|
private retryIntervalMs;
|
|
50
53
|
private priorityFeeConfig?;
|
|
51
54
|
private verbose;
|
|
55
|
+
private _onTransactionSigned?;
|
|
52
56
|
private _claimedTransactionHashes;
|
|
53
57
|
constructor(config: SolanaLocalSignerConfig);
|
|
54
58
|
chain(): C;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolanaLocalSigner.d.ts","sourceRoot":"","sources":["../../../../src/providers/wormhole/signers/SolanaLocalSigner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,OAAO,EAEP,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,EACL,OAAO,EACP,iBAAiB,EACjB,MAAM,EACN,mBAAmB,EACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAEL,iBAAiB,EAElB,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"SolanaLocalSigner.d.ts","sourceRoot":"","sources":["../../../../src/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;IACH,wBAAwB,IAAI,MAAM;IAI5B,WAAW,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;YAcxD,sBAAsB;CAkIrC;AAGD,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SolanaSigner.d.ts","sourceRoot":"","sources":["../../../../src/providers/wormhole/signers/SolanaSigner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EACd,WAAW,EACX,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD,OAAO,EAGL,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAC1E,OAAO,EACL,KAAK,EACL,aAAa,EACb,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAGvB,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,yBAAyB,CAAC,OAAO,CAAC,EAC3C,MAAM,EAAE,aAAa,GAAG,SAAS,EACjC,OAAO,CAAC,EAAE,cAAc,EACxB,cAAc,CAAC,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"SolanaSigner.d.ts","sourceRoot":"","sources":["../../../../src/providers/wormhole/signers/SolanaSigner.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,cAAc,EACd,WAAW,EACX,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAEz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,CAAC,EAAE,MAAM,CAAC;IAC5B,sDAAsD;IACtD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,4DAA4D;AAC5D,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qDAAqD;AACrD,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAMzE;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,YAAY,EAAE,MAAM,GAAG,UAAU,EACjC,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,MAAM,EAC5B,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"solanaUtils.d.ts","sourceRoot":"","sources":["../../../../src/providers/wormhole/signers/solanaUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,UAAU,EAKV,WAAW,EACX,sBAAsB,EACtB,oBAAoB,EACpB,KAAK,UAAU,EAChB,MAAM,iBAAiB,CAAC;AAUzB,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,qDAAqD;IACrD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,sDAAsD;IACtD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,4DAA4D;AAC5D,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,UAAU,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,qDAAqD;AACrD,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAMzE;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC7C,YAAY,EAAE,MAAM,GAAG,UAAU,EACjC,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,MAAM,EAC5B,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,MAAM,CAAC,CA4EjB;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAa3D;AAMD;;;;;;;;;GASG;AACH,wBAAsB,0BAA0B,CAC9C,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,iBAAiB,CAAC,EAAE,iBAAiB,EACrC,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,WAAW,CAAC,CAiBtB;AAED;;GAEG;AACH,wBAAsB,6BAA6B,CACjD,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,GAAG,oBAAoB,EAC/C,iBAAiB,CAAC,EAAE,iBAAiB,EACrC,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA8CnC;AAiJD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAgBxE;AAED;;GAEG;AACH,wBAAsB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1D;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,GAAG,IAAI,GAAG,SAAS,KAAG,OAYhE,CAAC"}
|
|
@@ -18,25 +18,52 @@ export interface WormholeTransferRequest {
|
|
|
18
18
|
mainSigner: Account;
|
|
19
19
|
amount?: string;
|
|
20
20
|
sponsorAccount?: Account;
|
|
21
|
+
/** Optional callback fired before and after each individual transaction is signed. */
|
|
22
|
+
onTransactionSigned?: OnTransactionSigned;
|
|
21
23
|
}
|
|
22
24
|
export type WithdrawPhase = "initiating" | "tracking" | "claiming";
|
|
25
|
+
/**
|
|
26
|
+
* Callback fired before and after each individual transaction is signed
|
|
27
|
+
* and submitted during a bridge flow.
|
|
28
|
+
*
|
|
29
|
+
* @param description - A human-readable description of the transaction
|
|
30
|
+
* (e.g. "Approving USDC transfer"). Comes from the Wormhole SDK's
|
|
31
|
+
* `UnsignedTransaction.description`.
|
|
32
|
+
* @param txId - `null` when called *before* signing; the on-chain
|
|
33
|
+
* transaction hash when called *after* signing.
|
|
34
|
+
*/
|
|
35
|
+
export type OnTransactionSigned = (description: string, txId: string | null) => void;
|
|
23
36
|
export interface WormholeWithdrawRequest {
|
|
37
|
+
/**
|
|
38
|
+
* The non-Aptos chain involved in the withdrawal. For a withdrawal from
|
|
39
|
+
* Aptos → Solana, this is `"Solana"`.
|
|
40
|
+
*
|
|
41
|
+
* Note: despite the name, this is the *destination* of the bridge transfer
|
|
42
|
+
* (where USDC will be claimed), not the chain that burns USDC (which is
|
|
43
|
+
* always Aptos for withdrawals).
|
|
44
|
+
*/
|
|
24
45
|
sourceChain: Chain;
|
|
25
46
|
wallet: AdapterWallet;
|
|
26
47
|
destinationAddress: AccountAddressInput;
|
|
27
48
|
sponsorAccount?: Account | GasStationApiKey;
|
|
28
49
|
/** Optional callback fired when the withdraw progresses to a new phase. */
|
|
29
50
|
onPhaseChange?: (phase: WithdrawPhase) => void;
|
|
51
|
+
/** Optional callback fired before and after each individual transaction is signed. */
|
|
52
|
+
onTransactionSigned?: OnTransactionSigned;
|
|
30
53
|
}
|
|
31
54
|
export interface WormholeSubmitTransferRequest {
|
|
32
55
|
sourceChain: Chain;
|
|
33
56
|
wallet: AdapterWallet;
|
|
34
57
|
destinationAddress: AccountAddressInput;
|
|
58
|
+
/** Optional callback fired before and after each individual transaction is signed. */
|
|
59
|
+
onTransactionSigned?: OnTransactionSigned;
|
|
35
60
|
}
|
|
36
61
|
export interface WormholeClaimTransferRequest {
|
|
37
62
|
receipt: routes.Receipt<AttestationReceipt>;
|
|
38
63
|
mainSigner: AptosAccount;
|
|
39
64
|
sponsorAccount?: AptosAccount | GasStationApiKey;
|
|
65
|
+
/** Optional callback fired before and after each individual transaction is signed. */
|
|
66
|
+
onTransactionSigned?: OnTransactionSigned;
|
|
40
67
|
}
|
|
41
68
|
export interface WormholeTransferResponse {
|
|
42
69
|
destinationChainTxnId: string;
|
|
@@ -54,20 +81,70 @@ export interface WormholeInitiateWithdrawRequest {
|
|
|
54
81
|
wallet: AdapterWallet;
|
|
55
82
|
destinationAddress: AccountAddressInput;
|
|
56
83
|
sponsorAccount?: Account | GasStationApiKey;
|
|
84
|
+
/** Optional callback fired before and after each individual transaction is signed. */
|
|
85
|
+
onTransactionSigned?: OnTransactionSigned;
|
|
57
86
|
}
|
|
58
87
|
export interface WormholeInitiateWithdrawResponse {
|
|
59
88
|
originChainTxnId: string;
|
|
60
89
|
receipt: routes.Receipt<AttestationReceipt>;
|
|
61
90
|
}
|
|
62
91
|
export interface WormholeClaimWithdrawRequest {
|
|
63
|
-
|
|
92
|
+
/**
|
|
93
|
+
* The chain on which the claim transaction will be executed (the destination
|
|
94
|
+
* chain of the withdrawal).
|
|
95
|
+
*
|
|
96
|
+
* For example, when withdrawing from Aptos → Solana, `claimChain` is
|
|
97
|
+
* `"Solana"` because that's where the USDC is minted/claimed.
|
|
98
|
+
*/
|
|
99
|
+
claimChain: Chain;
|
|
64
100
|
destinationAddress: string;
|
|
65
101
|
receipt: routes.Receipt<AttestationReceipt>;
|
|
66
102
|
wallet?: AdapterWallet;
|
|
103
|
+
/** Optional callback fired before and after each individual transaction is signed. */
|
|
104
|
+
onTransactionSigned?: OnTransactionSigned;
|
|
67
105
|
}
|
|
68
106
|
export interface WormholeClaimWithdrawResponse {
|
|
69
107
|
destinationChainTxnId: string;
|
|
70
108
|
}
|
|
109
|
+
export interface RetryWithdrawClaimRequest extends WormholeClaimWithdrawRequest {
|
|
110
|
+
/** Maximum number of retry attempts (default: 5). */
|
|
111
|
+
maxRetries?: number;
|
|
112
|
+
/** Initial delay in ms before the first retry (default: 2000). */
|
|
113
|
+
initialDelayMs?: number;
|
|
114
|
+
/** Multiplier applied to the delay after each failed attempt (default: 2). */
|
|
115
|
+
backoffMultiplier?: number;
|
|
116
|
+
}
|
|
117
|
+
export interface RetryWithdrawClaimResponse extends WormholeClaimWithdrawResponse {
|
|
118
|
+
/** Number of retry attempts that were needed (0 means first attempt succeeded). */
|
|
119
|
+
retriesUsed: number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Validates that a value returned by `getExpireTimestamp` is a non-negative
|
|
123
|
+
* integer suitable for use as an epoch-second expiration timestamp.
|
|
124
|
+
* Throws immediately for NaN, Infinity, negative values, or floats so that
|
|
125
|
+
* misconfigured callbacks fail fast instead of producing silent misbehaviour.
|
|
126
|
+
*/
|
|
127
|
+
export declare function validateExpireTimestamp(value: number): void;
|
|
128
|
+
/**
|
|
129
|
+
* Error thrown when the transfer (deposit) flow fails *after* the source-chain
|
|
130
|
+
* burn transaction has already been submitted (i.e. during attestation tracking
|
|
131
|
+
* or Aptos claiming).
|
|
132
|
+
*
|
|
133
|
+
* Consumers should check `instanceof TransferError` in their catch block
|
|
134
|
+
* to recover the `originChainTxnId` and display an explorer link so the
|
|
135
|
+
* user can verify their burn on-chain.
|
|
136
|
+
*/
|
|
137
|
+
export declare class TransferError extends Error {
|
|
138
|
+
/** Source-chain burn transaction hash — available when the burn succeeded before the failure. */
|
|
139
|
+
readonly originChainTxnId: string;
|
|
140
|
+
/**
|
|
141
|
+
* The underlying error that caused this failure.
|
|
142
|
+
* Mirrors ES2022 Error.cause — declared explicitly because the project's
|
|
143
|
+
* TypeScript lib target does not include ES2022 ErrorOptions.
|
|
144
|
+
*/
|
|
145
|
+
readonly cause?: unknown;
|
|
146
|
+
constructor(message: string, originChainTxnId: string, cause?: unknown);
|
|
147
|
+
}
|
|
71
148
|
/**
|
|
72
149
|
* Error thrown when the withdraw flow fails *after* the Aptos burn
|
|
73
150
|
* transaction has already been submitted (i.e. during attestation tracking
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/providers/wormhole/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,KAAK,CAC9C,SAAS,GAAG,SAAS,EACrB,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAC,OAAO,CAAC,EAC9C,MAAM,CAAC,OAAO,CACf,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,oBAAoB,CACvD,SAAS,GAAG,SAAS,CACtB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,KAAK,CAC9C,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,uBAAuB,CAAC,MAAM,CAAC,OAAO,CAAC,EAC9C,GAAG,CACJ,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,KAAK,CAAC;IACnB,IAAI,EAAE,UAAU,GAAG,UAAU,CAAC;CAC/B;AAED,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAE1F,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,KAAK,CAAC;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F;IACnF,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAO3D;AAED;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,iGAAiG;IACjG,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;gBAGvB,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,EACxB,KAAK,CAAC,EAAE,OAAO;CAOlB;AAED;;;;;;;;GAQG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,gFAAgF;IAChF,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,iEAAiE;IACjE,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;gBAGvB,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,aAAa,EACpB,KAAK,CAAC,EAAE,OAAO;CAQlB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { routes, Wormhole } from "@wormhole-foundation/sdk";
|
|
2
2
|
import { Chain, CrossChainProvider, CrossChainCore } from "../../CrossChainCore";
|
|
3
3
|
import { ChainConfig } from "../../config";
|
|
4
|
-
import { WormholeQuoteRequest, WormholeQuoteResponse, WormholeTransferRequest, WormholeTransferResponse, WormholeSubmitTransferRequest, WormholeStartTransferResponse, WormholeClaimTransferRequest, WormholeWithdrawRequest, WormholeWithdrawResponse, WormholeInitiateWithdrawRequest, WormholeInitiateWithdrawResponse, WormholeClaimWithdrawRequest, WormholeClaimWithdrawResponse } from "./types";
|
|
4
|
+
import { WormholeQuoteRequest, WormholeQuoteResponse, WormholeTransferRequest, WormholeTransferResponse, WormholeSubmitTransferRequest, WormholeStartTransferResponse, WormholeClaimTransferRequest, WormholeWithdrawRequest, WormholeWithdrawResponse, WormholeInitiateWithdrawRequest, WormholeInitiateWithdrawResponse, WormholeClaimWithdrawRequest, WormholeClaimWithdrawResponse, RetryWithdrawClaimRequest, RetryWithdrawClaimResponse } from "./types";
|
|
5
5
|
export declare class WormholeProvider implements CrossChainProvider<WormholeQuoteRequest, WormholeQuoteResponse, WormholeTransferRequest, WormholeTransferResponse, WormholeWithdrawRequest, WormholeWithdrawResponse> {
|
|
6
6
|
private crossChainCore;
|
|
7
7
|
private _wormholeContext;
|
|
@@ -58,6 +58,32 @@ export declare class WormholeProvider implements CrossChainProvider<WormholeQuot
|
|
|
58
58
|
* as the flow progresses.
|
|
59
59
|
*/
|
|
60
60
|
withdraw(input: WormholeWithdrawRequest): Promise<WormholeWithdrawResponse>;
|
|
61
|
+
/**
|
|
62
|
+
* Retries a failed `claimWithdraw` call with configurable exponential backoff.
|
|
63
|
+
*
|
|
64
|
+
* Use this when the claim phase of a withdrawal fails (e.g., RPC instability,
|
|
65
|
+
* network congestion) but the Aptos burn transaction has already been submitted.
|
|
66
|
+
* The attested receipt can be recovered from the `WithdrawError` thrown by
|
|
67
|
+
* `withdraw()` and passed directly to this method.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* try {
|
|
72
|
+
* await provider.withdraw({ ... });
|
|
73
|
+
* } catch (error) {
|
|
74
|
+
* if (error instanceof WithdrawError && error.phase === "claiming") {
|
|
75
|
+
* const result = await provider.retryWithdrawClaim({
|
|
76
|
+
* sourceChain,
|
|
77
|
+
* destinationAddress,
|
|
78
|
+
* receipt: attestedReceipt,
|
|
79
|
+
* wallet,
|
|
80
|
+
* maxRetries: 5,
|
|
81
|
+
* });
|
|
82
|
+
* }
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
retryWithdrawClaim(input: RetryWithdrawClaimRequest): Promise<RetryWithdrawClaimResponse>;
|
|
61
87
|
getChainConfig(chain: Chain): ChainConfig;
|
|
62
88
|
}
|
|
63
89
|
//# sourceMappingURL=wormhole.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wormhole.d.ts","sourceRoot":"","sources":["../../../src/providers/wormhole/wormhole.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,QAAQ,EAIT,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EACL,KAAK,EACL,kBAAkB,EAClB,cAAc,
|
|
1
|
+
{"version":3,"file":"wormhole.d.ts","sourceRoot":"","sources":["../../../src/providers/wormhole/wormhole.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,MAAM,EACN,QAAQ,EAIT,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EACL,KAAK,EACL,kBAAkB,EAClB,cAAc,EAEf,MAAM,sBAAsB,CAAC;AAM9B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EAGxB,6BAA6B,EAC7B,6BAA6B,EAC7B,4BAA4B,EAC5B,uBAAuB,EACvB,wBAAwB,EACxB,+BAA+B,EAC/B,gCAAgC,EAChC,4BAA4B,EAC5B,6BAA6B,EAC7B,yBAAyB,EACzB,0BAA0B,EAG3B,MAAM,SAAS,CAAC;AAKjB,qBAAa,gBAAiB,YAAW,kBAAkB,CACzD,oBAAoB,EACpB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,wBAAwB,CACzB;IACC,OAAO,CAAC,cAAc,CAAiB;IAEvC,OAAO,CAAC,gBAAgB,CAA8C;IAEtE,OAAO,CAAC,aAAa,CAAoC;IACzD,OAAO,CAAC,eAAe,CAA8B;IACrD,OAAO,CAAC,aAAa,CAAoC;IACzD,OAAO,CAAC,gBAAgB,CAAC,CAAQ;gBAErB,IAAI,EAAE,cAAc;IAIhC,IAAI,eAAe,IAAI,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC,GAAG,SAAS,CAEjE;YAEa,kBAAkB;YAyClB,QAAQ;IAyBhB,QAAQ,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAuCrE,kBAAkB,CACtB,KAAK,EAAE,6BAA6B,GACnC,OAAO,CAAC,6BAA6B,CAAC;IAgEnC,iBAAiB,CACrB,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAAC;QAAE,qBAAqB,EAAE,MAAM,CAAA;KAAE,CAAC;IAkE7C;;;;OAIG;IACG,QAAQ,CACZ,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,wBAAwB,CAAC;IAmCpC;;;;OAIG;IACG,gBAAgB,CACpB,KAAK,EAAE,+BAA+B,GACrC,OAAO,CAAC,gCAAgC,CAAC;IA0C5C;;;OAGG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;IA8BrE;;;;;;;;;OASG;IACG,aAAa,CACjB,KAAK,EAAE,4BAA4B,GAClC,OAAO,CAAC,6BAA6B,CAAC;IAmEzC;;;;;;;;;;OAUG;IACG,QAAQ,CACZ,KAAK,EAAE,uBAAuB,GAC7B,OAAO,CAAC,wBAAwB,CAAC;IAiDpC;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,kBAAkB,CACtB,KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,0BAA0B,CAAC;IAgCtC,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,WAAW;CAU1C"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CROSS_CHAIN_CORE_VERSION = "
|
|
1
|
+
export declare const CROSS_CHAIN_CORE_VERSION = "6.0.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aptos-labs/cross-chain-core",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Aptos Cross Chain Core",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"eventemitter3": "^4.0.7",
|
|
58
58
|
"tweetnacl": "^1.0.3",
|
|
59
59
|
"@aptos-labs/derived-wallet-ethereum": "0.9.0",
|
|
60
|
-
"@aptos-labs/derived-wallet-solana": "0.12.0",
|
|
61
60
|
"@aptos-labs/derived-wallet-sui": "0.2.0",
|
|
62
|
-
"@aptos-labs/wallet-adapter-core": "8.4.0"
|
|
61
|
+
"@aptos-labs/wallet-adapter-core": "8.4.0",
|
|
62
|
+
"@aptos-labs/derived-wallet-solana": "0.12.1"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
65
|
"@aptos-labs/ts-sdk": "^5.1.1"
|
package/src/CrossChainCore.ts
CHANGED
|
@@ -29,6 +29,17 @@ import {
|
|
|
29
29
|
export interface CrossChainDappConfig {
|
|
30
30
|
aptosNetwork: Network;
|
|
31
31
|
disableTelemetry?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Returns an epoch-second timestamp used as `expireTimestamp` when building
|
|
34
|
+
* Aptos transactions. Called at transaction-build time so that each
|
|
35
|
+
* transaction in a multi-step bridge flow gets a fresh expiration window.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* getExpireTimestamp: () => Math.floor(Date.now() / 1000) + 120 // 2 minutes
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
getExpireTimestamp?: () => number;
|
|
32
43
|
solanaConfig?: {
|
|
33
44
|
rpc?: string;
|
|
34
45
|
priorityFeeConfig?: {
|
|
@@ -45,7 +56,7 @@ export interface CrossChainDappConfig {
|
|
|
45
56
|
* Expected request body: { serializedReceipt: string, destinationAddress: string, sourceChain: string }
|
|
46
57
|
* Expected response: { destinationChainTxnId: string }
|
|
47
58
|
* Check out the SERVERSIDE_SOLANA_SIGNER.md file for more details.
|
|
48
|
-
*
|
|
59
|
+
*
|
|
49
60
|
* @example
|
|
50
61
|
* const crossChainCore = new CrossChainCore({
|
|
51
62
|
* dappConfig: {
|
|
@@ -57,7 +68,53 @@ export interface CrossChainDappConfig {
|
|
|
57
68
|
* });
|
|
58
69
|
*/
|
|
59
70
|
serverClaimUrl?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Solana transaction confirmation commitment level.
|
|
73
|
+
*
|
|
74
|
+
* - `"finalized"` (default) — waits for supermajority finalization (~30 s).
|
|
75
|
+
* - `"confirmed"` — waits for supermajority confirmation (~0.5 s).
|
|
76
|
+
*
|
|
77
|
+
* For bridge flows `"confirmed"` is usually sufficient because Wormhole
|
|
78
|
+
* guardians independently verify finality before issuing attestations.
|
|
79
|
+
*
|
|
80
|
+
* @default "finalized"
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* const crossChainCore = new CrossChainCore({
|
|
84
|
+
* dappConfig: {
|
|
85
|
+
* aptosNetwork: Network.MAINNET,
|
|
86
|
+
* solanaConfig: {
|
|
87
|
+
* commitment: "confirmed", // ~0.5 s vs ~30 s
|
|
88
|
+
* },
|
|
89
|
+
* },
|
|
90
|
+
* });
|
|
91
|
+
*/
|
|
92
|
+
commitment?: "confirmed" | "finalized";
|
|
60
93
|
};
|
|
94
|
+
/**
|
|
95
|
+
* Custom RPC endpoints for EVM chains. When provided, these override the
|
|
96
|
+
* built-in `defaultRpc` values for balance lookups and Wormhole SDK
|
|
97
|
+
* initialization.
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```ts
|
|
101
|
+
* evmConfig: {
|
|
102
|
+
* Ethereum: { rpc: "https://rpc.ankr.com/eth/MY_KEY" },
|
|
103
|
+
* Base: { rpc: "https://rpc.ankr.com/base/MY_KEY" },
|
|
104
|
+
* }
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
evmConfig?: Partial<Record<EvmChainName, { rpc: string }>>;
|
|
108
|
+
/**
|
|
109
|
+
* Custom RPC endpoint for the Sui chain. When provided, overrides the
|
|
110
|
+
* built-in `defaultRpc` for balance lookups and Wormhole SDK initialization.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* suiConfig: { rpc: "https://fullnode.mainnet.sui.io" }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
suiConfig?: { rpc?: string };
|
|
61
118
|
}
|
|
62
119
|
export type { AccountAddressInput } from "@aptos-labs/ts-sdk";
|
|
63
120
|
export { NetworkToChainId, NetworkToNodeAPI } from "@aptos-labs/ts-sdk";
|
|
@@ -78,6 +135,27 @@ export type Chain =
|
|
|
78
135
|
| "Polygon"
|
|
79
136
|
| "Sui";
|
|
80
137
|
|
|
138
|
+
/**
|
|
139
|
+
* EVM chain names supported by the SDK — derived from {@link Chain} by
|
|
140
|
+
* excluding the non-EVM ecosystems. Adding a new EVM chain to `Chain`
|
|
141
|
+
* automatically makes it a valid key in `evmConfig`.
|
|
142
|
+
*/
|
|
143
|
+
export type EvmChainName = Exclude<Chain, "Solana" | "Aptos" | "Sui">;
|
|
144
|
+
|
|
145
|
+
// Record ensures every EvmChainName key is present at compile time.
|
|
146
|
+
const _evmChainRecord: Record<EvmChainName, true> = {
|
|
147
|
+
Ethereum: true,
|
|
148
|
+
Sepolia: true,
|
|
149
|
+
BaseSepolia: true,
|
|
150
|
+
ArbitrumSepolia: true,
|
|
151
|
+
Avalanche: true,
|
|
152
|
+
Base: true,
|
|
153
|
+
Arbitrum: true,
|
|
154
|
+
PolygonSepolia: true,
|
|
155
|
+
Polygon: true,
|
|
156
|
+
};
|
|
157
|
+
export const EVM_CHAIN_NAMES = Object.keys(_evmChainRecord) as EvmChainName[];
|
|
158
|
+
|
|
81
159
|
// Map of Ethereum chain id to testnet chain config
|
|
82
160
|
export const EthereumChainIdToTestnetChain: Record<string, ChainConfig> = {
|
|
83
161
|
11155111: testnetChains.Sepolia!,
|
|
@@ -119,6 +197,14 @@ export class CrossChainCore {
|
|
|
119
197
|
readonly CHAINS: ChainsConfig = testnetChains;
|
|
120
198
|
readonly TOKENS: Record<string, TokenConfig> = testnetTokens;
|
|
121
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Last known source-chain transaction ID, set by signers immediately after
|
|
202
|
+
* a transaction is submitted. Acts as a recovery side-channel so that
|
|
203
|
+
* callers can retrieve the tx hash even when the orchestration layer throws
|
|
204
|
+
* before returning it (e.g. claim failure after a successful burn).
|
|
205
|
+
*/
|
|
206
|
+
_lastSourceChainTxId: string | undefined;
|
|
207
|
+
|
|
122
208
|
constructor(args: { dappConfig: CrossChainDappConfig }) {
|
|
123
209
|
this._dappConfig = args.dappConfig;
|
|
124
210
|
if (args.dappConfig?.aptosNetwork === Network.MAINNET) {
|
|
@@ -181,14 +267,15 @@ export class CrossChainCore {
|
|
|
181
267
|
walletAddress,
|
|
182
268
|
this._dappConfig.aptosNetwork,
|
|
183
269
|
sourceChain,
|
|
184
|
-
|
|
185
|
-
|
|
270
|
+
this._dappConfig?.evmConfig?.[sourceChain]?.rpc ??
|
|
271
|
+
this.CHAINS[sourceChain].defaultRpc,
|
|
186
272
|
);
|
|
187
273
|
case "Sui":
|
|
188
274
|
return await getSuiWalletUSDCBalance(
|
|
189
275
|
walletAddress,
|
|
190
276
|
this._dappConfig.aptosNetwork,
|
|
191
|
-
this.
|
|
277
|
+
this._dappConfig?.suiConfig?.rpc ??
|
|
278
|
+
this.CHAINS[sourceChain].defaultRpc,
|
|
192
279
|
);
|
|
193
280
|
default:
|
|
194
281
|
throw new Error(`Unsupported chain: ${sourceChain}`);
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
AnyRawTransaction,
|
|
4
4
|
Aptos,
|
|
5
5
|
AptosConfig,
|
|
6
|
-
Network as AptosNetwork,
|
|
7
6
|
Account,
|
|
8
7
|
} from "@aptos-labs/ts-sdk";
|
|
9
8
|
|
|
@@ -18,8 +17,11 @@ import {
|
|
|
18
17
|
AptosUnsignedTransaction,
|
|
19
18
|
AptosChains,
|
|
20
19
|
} from "@wormhole-foundation/sdk-aptos";
|
|
21
|
-
import {
|
|
22
|
-
|
|
20
|
+
import {
|
|
21
|
+
OnTransactionSigned,
|
|
22
|
+
validateExpireTimestamp,
|
|
23
|
+
} from "../types";
|
|
24
|
+
import { CrossChainCore } from "../../../CrossChainCore";
|
|
23
25
|
|
|
24
26
|
export class AptosLocalSigner<
|
|
25
27
|
N extends Network,
|
|
@@ -28,21 +30,24 @@ export class AptosLocalSigner<
|
|
|
28
30
|
_chain: C;
|
|
29
31
|
_options: any;
|
|
30
32
|
_wallet: Account;
|
|
31
|
-
_sponsorAccount: Account |
|
|
33
|
+
_sponsorAccount: Account | undefined;
|
|
34
|
+
_onTransactionSigned: OnTransactionSigned | undefined;
|
|
35
|
+
_crossChainCore: CrossChainCore;
|
|
32
36
|
_claimedTransactionHashes: string[] = [];
|
|
33
|
-
_dappNetwork: AptosNetwork;
|
|
34
37
|
constructor(
|
|
35
38
|
chain: C,
|
|
36
39
|
options: any,
|
|
37
40
|
wallet: Account,
|
|
38
|
-
feePayerAccount: Account |
|
|
39
|
-
|
|
41
|
+
feePayerAccount: Account | undefined,
|
|
42
|
+
crossChainCore: CrossChainCore,
|
|
43
|
+
onTransactionSigned?: OnTransactionSigned,
|
|
40
44
|
) {
|
|
41
45
|
this._chain = chain;
|
|
42
46
|
this._options = options;
|
|
43
47
|
this._wallet = wallet;
|
|
44
48
|
this._sponsorAccount = feePayerAccount;
|
|
45
|
-
this.
|
|
49
|
+
this._crossChainCore = crossChainCore;
|
|
50
|
+
this._onTransactionSigned = onTransactionSigned;
|
|
46
51
|
}
|
|
47
52
|
|
|
48
53
|
chain(): C {
|
|
@@ -61,12 +66,14 @@ export class AptosLocalSigner<
|
|
|
61
66
|
this._claimedTransactionHashes = [];
|
|
62
67
|
|
|
63
68
|
for (const tx of txs) {
|
|
69
|
+
this._onTransactionSigned?.(tx.description, null);
|
|
64
70
|
const txId = await signAndSendTransaction(
|
|
65
71
|
tx as AptosUnsignedTransaction<Network, AptosChains>,
|
|
66
72
|
this._wallet,
|
|
67
73
|
this._sponsorAccount,
|
|
68
|
-
this.
|
|
74
|
+
this._crossChainCore,
|
|
69
75
|
);
|
|
76
|
+
this._onTransactionSigned?.(tx.description, txId);
|
|
70
77
|
txHashes.push(txId);
|
|
71
78
|
this._claimedTransactionHashes.push(txId);
|
|
72
79
|
}
|
|
@@ -77,8 +84,8 @@ export class AptosLocalSigner<
|
|
|
77
84
|
export async function signAndSendTransaction(
|
|
78
85
|
request: UnsignedTransaction<Network, AptosChains>,
|
|
79
86
|
wallet: Account,
|
|
80
|
-
sponsorAccount: Account |
|
|
81
|
-
|
|
87
|
+
sponsorAccount: Account | undefined,
|
|
88
|
+
crossChainCore: CrossChainCore,
|
|
82
89
|
) {
|
|
83
90
|
if (!wallet) {
|
|
84
91
|
throw new Error("Wallet is undefined");
|
|
@@ -96,15 +103,23 @@ export async function signAndSendTransaction(
|
|
|
96
103
|
}
|
|
97
104
|
});
|
|
98
105
|
|
|
106
|
+
const dappNetwork = crossChainCore._dappConfig.aptosNetwork;
|
|
99
107
|
const aptosConfig = new AptosConfig({
|
|
100
108
|
network: dappNetwork,
|
|
101
109
|
});
|
|
102
110
|
const aptos = new Aptos(aptosConfig);
|
|
103
111
|
|
|
112
|
+
const expireTimestamp = crossChainCore._dappConfig.getExpireTimestamp?.();
|
|
113
|
+
if (typeof expireTimestamp !== "undefined") {
|
|
114
|
+
validateExpireTimestamp(expireTimestamp);
|
|
115
|
+
}
|
|
104
116
|
const txnToSign = await aptos.transaction.build.simple({
|
|
105
117
|
data: payload,
|
|
106
118
|
sender: wallet.accountAddress.toString(),
|
|
107
119
|
withFeePayer: sponsorAccount ? true : false,
|
|
120
|
+
...(typeof expireTimestamp !== "undefined"
|
|
121
|
+
? { options: { expireTimestamp } }
|
|
122
|
+
: {}),
|
|
108
123
|
});
|
|
109
124
|
|
|
110
125
|
const senderAuthenticator = await aptos.transaction.sign({
|
|
@@ -122,10 +137,8 @@ export async function signAndSendTransaction(
|
|
|
122
137
|
};
|
|
123
138
|
|
|
124
139
|
if (sponsorAccount) {
|
|
125
|
-
// Gas station is currently impossible to use, since the transactino we get from
|
|
126
|
-
// Wormhole is a script transaction and gas station only supports entry function transactions
|
|
127
140
|
const feePayerSignerAuthenticator = aptos.transaction.signAsFeePayer({
|
|
128
|
-
signer: sponsorAccount
|
|
141
|
+
signer: sponsorAccount,
|
|
129
142
|
transaction: txnToSign,
|
|
130
143
|
});
|
|
131
144
|
txnToSubmit.feePayerAuthenticator = feePayerSignerAuthenticator;
|