@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
package/dist/CrossChainCore.d.ts
CHANGED
|
@@ -3,6 +3,17 @@ import { ChainsConfig, TokenConfig, ChainConfig } from "./config";
|
|
|
3
3
|
export interface CrossChainDappConfig {
|
|
4
4
|
aptosNetwork: Network;
|
|
5
5
|
disableTelemetry?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Returns an epoch-second timestamp used as `expireTimestamp` when building
|
|
8
|
+
* Aptos transactions. Called at transaction-build time so that each
|
|
9
|
+
* transaction in a multi-step bridge flow gets a fresh expiration window.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* getExpireTimestamp: () => Math.floor(Date.now() / 1000) + 120 // 2 minutes
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
getExpireTimestamp?: () => number;
|
|
6
17
|
solanaConfig?: {
|
|
7
18
|
rpc?: string;
|
|
8
19
|
priorityFeeConfig?: {
|
|
@@ -31,12 +42,69 @@ export interface CrossChainDappConfig {
|
|
|
31
42
|
* });
|
|
32
43
|
*/
|
|
33
44
|
serverClaimUrl?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Solana transaction confirmation commitment level.
|
|
47
|
+
*
|
|
48
|
+
* - `"finalized"` (default) — waits for supermajority finalization (~30 s).
|
|
49
|
+
* - `"confirmed"` — waits for supermajority confirmation (~0.5 s).
|
|
50
|
+
*
|
|
51
|
+
* For bridge flows `"confirmed"` is usually sufficient because Wormhole
|
|
52
|
+
* guardians independently verify finality before issuing attestations.
|
|
53
|
+
*
|
|
54
|
+
* @default "finalized"
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* const crossChainCore = new CrossChainCore({
|
|
58
|
+
* dappConfig: {
|
|
59
|
+
* aptosNetwork: Network.MAINNET,
|
|
60
|
+
* solanaConfig: {
|
|
61
|
+
* commitment: "confirmed", // ~0.5 s vs ~30 s
|
|
62
|
+
* },
|
|
63
|
+
* },
|
|
64
|
+
* });
|
|
65
|
+
*/
|
|
66
|
+
commitment?: "confirmed" | "finalized";
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Custom RPC endpoints for EVM chains. When provided, these override the
|
|
70
|
+
* built-in `defaultRpc` values for balance lookups and Wormhole SDK
|
|
71
|
+
* initialization.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* evmConfig: {
|
|
76
|
+
* Ethereum: { rpc: "https://rpc.ankr.com/eth/MY_KEY" },
|
|
77
|
+
* Base: { rpc: "https://rpc.ankr.com/base/MY_KEY" },
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
evmConfig?: Partial<Record<EvmChainName, {
|
|
82
|
+
rpc: string;
|
|
83
|
+
}>>;
|
|
84
|
+
/**
|
|
85
|
+
* Custom RPC endpoint for the Sui chain. When provided, overrides the
|
|
86
|
+
* built-in `defaultRpc` for balance lookups and Wormhole SDK initialization.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* suiConfig: { rpc: "https://fullnode.mainnet.sui.io" }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
suiConfig?: {
|
|
94
|
+
rpc?: string;
|
|
34
95
|
};
|
|
35
96
|
}
|
|
36
97
|
export type { AccountAddressInput } from "@aptos-labs/ts-sdk";
|
|
37
98
|
export { NetworkToChainId, NetworkToNodeAPI } from "@aptos-labs/ts-sdk";
|
|
38
99
|
export type AptosAccount = Account;
|
|
39
100
|
export type Chain = "Solana" | "Ethereum" | "Sepolia" | "Aptos" | "BaseSepolia" | "ArbitrumSepolia" | "Avalanche" | "Base" | "Arbitrum" | "PolygonSepolia" | "Polygon" | "Sui";
|
|
101
|
+
/**
|
|
102
|
+
* EVM chain names supported by the SDK — derived from {@link Chain} by
|
|
103
|
+
* excluding the non-EVM ecosystems. Adding a new EVM chain to `Chain`
|
|
104
|
+
* automatically makes it a valid key in `evmConfig`.
|
|
105
|
+
*/
|
|
106
|
+
export type EvmChainName = Exclude<Chain, "Solana" | "Aptos" | "Sui">;
|
|
107
|
+
export declare const EVM_CHAIN_NAMES: EvmChainName[];
|
|
40
108
|
export declare const EthereumChainIdToTestnetChain: Record<string, ChainConfig>;
|
|
41
109
|
export declare const EthereumChainIdToMainnetChain: Record<string, ChainConfig>;
|
|
42
110
|
export type CCTPProviders = "Wormhole";
|
|
@@ -49,6 +117,13 @@ export declare class CrossChainCore {
|
|
|
49
117
|
readonly _dappConfig: CrossChainDappConfig;
|
|
50
118
|
readonly CHAINS: ChainsConfig;
|
|
51
119
|
readonly TOKENS: Record<string, TokenConfig>;
|
|
120
|
+
/**
|
|
121
|
+
* Last known source-chain transaction ID, set by signers immediately after
|
|
122
|
+
* a transaction is submitted. Acts as a recovery side-channel so that
|
|
123
|
+
* callers can retrieve the tx hash even when the orchestration layer throws
|
|
124
|
+
* before returning it (e.g. claim failure after a successful burn).
|
|
125
|
+
*/
|
|
126
|
+
_lastSourceChainTxId: string | undefined;
|
|
52
127
|
constructor(args: {
|
|
53
128
|
dappConfig: CrossChainDappConfig;
|
|
54
129
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrossChainCore.d.ts","sourceRoot":"","sources":["../src/CrossChainCore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAYtD,OAAO,EACL,YAAY,EAKZ,WAAW,EACX,WAAW,EACZ,MAAM,UAAU,CAAC;AAQlB,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY,CAAC,EAAE;QACb,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,iBAAiB,CAAC,EAAE;YAClB,UAAU,CAAC,EAAE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