@aptos-labs/cross-chain-core 5.3.0 → 5.4.1
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/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +6 -6
- package/src/CrossChainCore.ts +4 -4
- package/src/providers/wormhole/signers/AptosLocalSigner.ts +3 -3
- package/src/providers/wormhole/signers/AptosSigner.ts +3 -3
- package/src/providers/wormhole/signers/Signer.ts +6 -6
- package/src/providers/wormhole/wormhole.ts +20 -20
- package/src/utils/getUsdcBalance.ts +3 -3
- package/src/version.ts +1 -1
|
@@ -80,7 +80,7 @@ export class WormholeProvider
|
|
|
80
80
|
|
|
81
81
|
private async getRoute(
|
|
82
82
|
sourceChain: Chain,
|
|
83
|
-
destinationChain: Chain
|
|
83
|
+
destinationChain: Chain,
|
|
84
84
|
): Promise<{
|
|
85
85
|
route: WormholeRouteResponse;
|
|
86
86
|
request: WormholeRequest;
|
|
@@ -91,7 +91,7 @@ export class WormholeProvider
|
|
|
91
91
|
|
|
92
92
|
const { sourceToken, destToken } = this.getTokenInfo(
|
|
93
93
|
sourceChain,
|
|
94
|
-
destinationChain
|
|
94
|
+
destinationChain,
|
|
95
95
|
);
|
|
96
96
|
|
|
97
97
|
const destContext = this._wormholeContext
|
|
@@ -114,7 +114,7 @@ export class WormholeProvider
|
|
|
114
114
|
destination: destToken,
|
|
115
115
|
},
|
|
116
116
|
sourceContext,
|
|
117
|
-
destContext
|
|
117
|
+
destContext,
|
|
118
118
|
);
|
|
119
119
|
|
|
120
120
|
const resolver = this._wormholeContext.resolver([
|
|
@@ -145,7 +145,7 @@ export class WormholeProvider
|
|
|
145
145
|
|
|
146
146
|
const { route, request } = await this.getRoute(
|
|
147
147
|
sourceChain,
|
|
148
|
-
destinationChain
|
|
148
|
+
destinationChain,
|
|
149
149
|
);
|
|
150
150
|
|
|
151
151
|
// TODO what is nativeGas for?
|
|
@@ -170,7 +170,7 @@ export class WormholeProvider
|
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
async submitCCTPTransfer(
|
|
173
|
-
input: WormholeSubmitTransferRequest
|
|
173
|
+
input: WormholeSubmitTransferRequest,
|
|
174
174
|
): Promise<WormholeStartTransferResponse> {
|
|
175
175
|
const { sourceChain, wallet, destinationAddress } = input;
|
|
176
176
|
|
|
@@ -206,7 +206,7 @@ export class WormholeProvider
|
|
|
206
206
|
this.getChainConfig(sourceChain),
|
|
207
207
|
signerAddress,
|
|
208
208
|
{},
|
|
209
|
-
wallet
|
|
209
|
+
wallet,
|
|
210
210
|
);
|
|
211
211
|
|
|
212
212
|
logger.log("signer", signer);
|
|
@@ -217,7 +217,7 @@ export class WormholeProvider
|
|
|
217
217
|
this.wormholeRequest,
|
|
218
218
|
signer,
|
|
219
219
|
this.wormholeQuote,
|
|
220
|
-
Wormhole.chainAddress("Aptos", destinationAddress.toString())
|
|
220
|
+
Wormhole.chainAddress("Aptos", destinationAddress.toString()),
|
|
221
221
|
);
|
|
222
222
|
|
|
223
223
|
const originChainTxnId =
|
|
@@ -229,7 +229,7 @@ export class WormholeProvider
|
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
async claimCCTPTransfer(
|
|
232
|
-
input: WormholeClaimTransferRequest
|
|
232
|
+
input: WormholeClaimTransferRequest,
|
|
233
233
|
): Promise<{ destinationChainTxnId: string }> {
|
|
234
234
|
let { receipt, mainSigner, sponsorAccount } = input;
|
|
235
235
|
if (!this.wormholeRoute) {
|
|
@@ -253,7 +253,7 @@ export class WormholeProvider
|
|
|
253
253
|
"Aptos",
|
|
254
254
|
{},
|
|
255
255
|
mainSigner, // the account that signs the "claim" transaction
|
|
256
|
-
sponsorAccount ? sponsorAccount : undefined // the fee payer account
|
|
256
|
+
sponsorAccount ? sponsorAccount : undefined, // the fee payer account
|
|
257
257
|
);
|
|
258
258
|
|
|
259
259
|
if (routes.isManual(this.wormholeRoute)) {
|
|
@@ -275,7 +275,7 @@ export class WormholeProvider
|
|
|
275
275
|
} catch (e) {
|
|
276
276
|
console.error(
|
|
277
277
|
`Error tracking transfer (attempt ${retries + 1} / ${maxRetries}):`,
|
|
278
|
-
e
|
|
278
|
+
e,
|
|
279
279
|
);
|
|
280
280
|
const delay = baseDelay * Math.pow(2, retries); // Exponential backoff
|
|
281
281
|
await sleep(delay);
|
|
@@ -292,7 +292,7 @@ export class WormholeProvider
|
|
|
292
292
|
* @returns
|
|
293
293
|
*/
|
|
294
294
|
async transfer(
|
|
295
|
-
input: WormholeTransferRequest
|
|
295
|
+
input: WormholeTransferRequest,
|
|
296
296
|
): Promise<WormholeTransferResponse> {
|
|
297
297
|
if (this.crossChainCore._dappConfig?.aptosNetwork === Network.DEVNET) {
|
|
298
298
|
throw new Error("Devnet is not supported on Wormhole");
|
|
@@ -318,7 +318,7 @@ export class WormholeProvider
|
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
async withdraw(
|
|
321
|
-
input: WormholeWithdrawRequest
|
|
321
|
+
input: WormholeWithdrawRequest,
|
|
322
322
|
): Promise<WormholeWithdrawResponse> {
|
|
323
323
|
const { sourceChain, wallet, destinationAddress, sponsorAccount } = input;
|
|
324
324
|
logger.log("sourceChain", sourceChain);
|
|
@@ -344,7 +344,7 @@ export class WormholeProvider
|
|
|
344
344
|
{},
|
|
345
345
|
input.wallet,
|
|
346
346
|
undefined,
|
|
347
|
-
sponsorAccount
|
|
347
|
+
sponsorAccount,
|
|
348
348
|
);
|
|
349
349
|
|
|
350
350
|
logger.log("signer", signer);
|
|
@@ -352,14 +352,14 @@ export class WormholeProvider
|
|
|
352
352
|
logger.log("wormholeQuote", this.wormholeQuote);
|
|
353
353
|
logger.log(
|
|
354
354
|
"Wormhole.chainAddress",
|
|
355
|
-
Wormhole.chainAddress(sourceChain, input.destinationAddress.toString())
|
|
355
|
+
Wormhole.chainAddress(sourceChain, input.destinationAddress.toString()),
|
|
356
356
|
);
|
|
357
357
|
|
|
358
358
|
let receipt = await this.wormholeRoute.initiate(
|
|
359
359
|
this.wormholeRequest,
|
|
360
360
|
signer,
|
|
361
361
|
this.wormholeQuote,
|
|
362
|
-
Wormhole.chainAddress(sourceChain, input.destinationAddress.toString())
|
|
362
|
+
Wormhole.chainAddress(sourceChain, input.destinationAddress.toString()),
|
|
363
363
|
);
|
|
364
364
|
logger.log("receipt", receipt);
|
|
365
365
|
|
|
@@ -383,7 +383,7 @@ export class WormholeProvider
|
|
|
383
383
|
this.getChainConfig(sourceChain),
|
|
384
384
|
destinationAddress.toString(),
|
|
385
385
|
{},
|
|
386
|
-
wallet
|
|
386
|
+
wallet,
|
|
387
387
|
);
|
|
388
388
|
|
|
389
389
|
if (routes.isManual(this.wormholeRoute)) {
|
|
@@ -415,7 +415,7 @@ export class WormholeProvider
|
|
|
415
415
|
} catch (e) {
|
|
416
416
|
console.error(
|
|
417
417
|
`Error tracking transfer (attempt ${retries + 1} / ${maxRetries}):`,
|
|
418
|
-
e
|
|
418
|
+
e,
|
|
419
419
|
);
|
|
420
420
|
const delay = baseDelay * Math.pow(2, retries); // Exponential backoff
|
|
421
421
|
await sleep(delay);
|
|
@@ -442,19 +442,19 @@ export class WormholeProvider
|
|
|
442
442
|
|
|
443
443
|
getTokenInfo(
|
|
444
444
|
sourceChain: Chain,
|
|
445
|
-
destinationChain: Chain
|
|
445
|
+
destinationChain: Chain,
|
|
446
446
|
): {
|
|
447
447
|
sourceToken: TokenId;
|
|
448
448
|
destToken: TokenId;
|
|
449
449
|
} {
|
|
450
450
|
const sourceToken: TokenId = Wormhole.tokenId(
|
|
451
451
|
this.crossChainCore.TOKENS[sourceChain].tokenId.chain as Chain,
|
|
452
|
-
this.crossChainCore.TOKENS[sourceChain].tokenId.address
|
|
452
|
+
this.crossChainCore.TOKENS[sourceChain].tokenId.address,
|
|
453
453
|
);
|
|
454
454
|
|
|
455
455
|
const destToken: TokenId = Wormhole.tokenId(
|
|
456
456
|
this.crossChainCore.TOKENS[destinationChain].tokenId.chain as Chain,
|
|
457
|
-
this.crossChainCore.TOKENS[destinationChain].tokenId.address
|
|
457
|
+
this.crossChainCore.TOKENS[destinationChain].tokenId.address,
|
|
458
458
|
);
|
|
459
459
|
|
|
460
460
|
return { sourceToken, destToken };
|
|
@@ -7,7 +7,7 @@ import { Chain } from "../CrossChainCore";
|
|
|
7
7
|
export const getSolanaWalletUSDCBalance = async (
|
|
8
8
|
walletAddress: string,
|
|
9
9
|
aptosNetwork: Network,
|
|
10
|
-
rpc: string
|
|
10
|
+
rpc: string,
|
|
11
11
|
): Promise<string> => {
|
|
12
12
|
const address = new PublicKey(walletAddress);
|
|
13
13
|
const tokenAddress =
|
|
@@ -37,7 +37,7 @@ export const getEthereumWalletUSDCBalance = async (
|
|
|
37
37
|
walletAddress: string,
|
|
38
38
|
aptosNetwork: Network,
|
|
39
39
|
chain: Chain,
|
|
40
|
-
rpc: string
|
|
40
|
+
rpc: string,
|
|
41
41
|
): Promise<string> => {
|
|
42
42
|
const token =
|
|
43
43
|
aptosNetwork === Network.MAINNET
|
|
@@ -54,7 +54,7 @@ export const getEthereumWalletUSDCBalance = async (
|
|
|
54
54
|
|
|
55
55
|
export const getAptosWalletUSDCBalance = async (
|
|
56
56
|
walletAddress: string,
|
|
57
|
-
aptosNetwork: Network
|
|
57
|
+
aptosNetwork: Network,
|
|
58
58
|
): Promise<string> => {
|
|
59
59
|
const token =
|
|
60
60
|
aptosNetwork === Network.MAINNET
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CROSS_CHAIN_CORE_VERSION = "5.
|
|
1
|
+
export const CROSS_CHAIN_CORE_VERSION = "5.4.1";
|