@aptos-labs/cross-chain-core 5.1.2 → 5.3.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/README.md +88 -1
- package/dist/version.d.ts +1 -1
- package/package.json +6 -6
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,90 @@
|
|
|
1
1
|
# Aptos Cross Chain CCTP
|
|
2
2
|
|
|
3
|
-
A
|
|
3
|
+
A wrapper for CCTP cross chain transactions.
|
|
4
|
+
|
|
5
|
+
#### Supported Providers
|
|
6
|
+
|
|
7
|
+
- Wormhole
|
|
8
|
+
|
|
9
|
+
### Usage
|
|
10
|
+
|
|
11
|
+
Install the `@aptos-labs/cross-chain-core` package
|
|
12
|
+
|
|
13
|
+
```cli
|
|
14
|
+
pnpm i @aptos-labs/cross-chain-core
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Import the `CrossChainCore` class
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { CrossChainCore } from "@aptos-labs/cross-chain-core";
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Initialize `CrossChainCore` and chosen provider
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
const crossChainCore = new CrossChainCore({
|
|
27
|
+
dappConfig: { aptosNetwork: dappNetwork },
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const provider = crossChainCore.getProvider("Wormhole");
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Once you have your provider setup, you can use it to query for:
|
|
34
|
+
|
|
35
|
+
- `getQuote` can be used to calculate the cost and parameters for transferring tokens between different blockchain networks using the provider's cross-chain bridge.
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
const quote = await provider?.getQuote({
|
|
39
|
+
// How much to transfer
|
|
40
|
+
amount,
|
|
41
|
+
// The origin network involved (besides Aptos, e.g Solana, Ethereum)
|
|
42
|
+
originChain: sourceChain,
|
|
43
|
+
// The transaction type:
|
|
44
|
+
// transfer - transfer funds from a cross chain (Solana, Ethereum) wallet to Aptos
|
|
45
|
+
// withdraw - transfer funds from an Aptos wallet to a cross chain (Solana, Ethereum) wallet
|
|
46
|
+
type: "transfer",
|
|
47
|
+
});
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The function returns pricing, fees, and transfer details needed to execute the cross-chain transaction.
|
|
51
|
+
|
|
52
|
+
- `transfer` can be used to initiate a transfer of USDC funds from the source chain wallet to Aptos wallet
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
const { originChainTxnId, destinationChainTxnId } = await provider.transfer({
|
|
56
|
+
// The blockchain to transfer from
|
|
57
|
+
sourceChain,
|
|
58
|
+
// The source chain wallet to sign the transfer transaction
|
|
59
|
+
wallet,
|
|
60
|
+
// The destination address for the funds to go to
|
|
61
|
+
destinationAddress: account?.address?.toString() ?? "",
|
|
62
|
+
// The wallet/signer for the destination (Aptos) chain
|
|
63
|
+
mainSigner,
|
|
64
|
+
// (optional) Account to sponsor gas fees
|
|
65
|
+
sponsorAccount,
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
This function returns:
|
|
70
|
+
`originChainTxnId`: Transaction hash on the source chain
|
|
71
|
+
`destinationChainTxnId`: Transaction hash on the Aptos destination chain
|
|
72
|
+
|
|
73
|
+
- `withdraw` can be used to initiate a transfer of USDC funds an Aptos wallet to the destination chain wallet
|
|
74
|
+
|
|
75
|
+
```ts
|
|
76
|
+
const { originChainTxnId, destinationChainTxnId } = await provider.withdraw({
|
|
77
|
+
// The blockchain to transfer from
|
|
78
|
+
sourceChain,
|
|
79
|
+
// The source chain wallet to sign the transfer transaction
|
|
80
|
+
wallet,
|
|
81
|
+
// The destination address for the funds to go to
|
|
82
|
+
destinationAddress: originWalletDetails?.address.toString(),
|
|
83
|
+
// (optional) Account to sponsor gas fees
|
|
84
|
+
sponsorAccount,
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
This function returns:
|
|
89
|
+
`originChainTxnId`: Transaction hash on the source chain
|
|
90
|
+
`destinationChainTxnId`: Transaction hash on the Aptos destination chain
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CROSS_CHAIN_CORE_VERSION = "5.
|
|
1
|
+
export declare const CROSS_CHAIN_CORE_VERSION = "5.3.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": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Aptos Cross Chain Core",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@aptos-labs/wallet-adapter-tsconfig": "0.0.2"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@aptos-labs/wallet-standard": "^0.5.
|
|
42
|
+
"@aptos-labs/wallet-standard": "^0.5.2",
|
|
43
43
|
"@mysten/sui": "^1.21.2",
|
|
44
44
|
"@mysten/wallet-standard": "^0.13.26",
|
|
45
45
|
"@solana/spl-token": "^0.4.12",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"ethers": "^6.13.5",
|
|
58
58
|
"eventemitter3": "^4.0.7",
|
|
59
59
|
"tweetnacl": "^1.0.3",
|
|
60
|
-
"@aptos-labs/wallet-adapter-core": "7.
|
|
61
|
-
"@aptos-labs/derived-wallet-
|
|
62
|
-
"@aptos-labs/derived-wallet-
|
|
60
|
+
"@aptos-labs/wallet-adapter-core": "7.3.0",
|
|
61
|
+
"@aptos-labs/derived-wallet-ethereum": "0.7.0",
|
|
62
|
+
"@aptos-labs/derived-wallet-solana": "0.7.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"@aptos-labs/ts-sdk": "^
|
|
65
|
+
"@aptos-labs/ts-sdk": "^5.0.0"
|
|
66
66
|
},
|
|
67
67
|
"files": [
|
|
68
68
|
"dist",
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CROSS_CHAIN_CORE_VERSION = "5.
|
|
1
|
+
export const CROSS_CHAIN_CORE_VERSION = "5.3.0";
|