@aptos-labs/cross-chain-core 5.0.2 → 5.1.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/README.md +1 -9
- package/dist/CrossChainCore.d.ts +4 -2
- package/dist/CrossChainCore.d.ts.map +1 -1
- package/dist/config/mainnet/chains.d.ts.map +1 -1
- package/dist/config/mainnet/tokens.d.ts.map +1 -1
- package/dist/config/testnet/chains.d.ts.map +1 -1
- package/dist/config/testnet/tokens.d.ts.map +1 -1
- package/dist/config/types.d.ts +0 -6
- package/dist/config/types.d.ts.map +1 -1
- package/dist/index.js +195 -32
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +193 -32
- package/dist/index.mjs.map +1 -1
- package/dist/providers/wormhole/wormhole.d.ts.map +1 -1
- package/dist/utils/getUsdcBalance.d.ts +2 -1
- package/dist/utils/getUsdcBalance.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +2 -2
- package/src/CrossChainCore.ts +40 -1
- package/src/config/mainnet/chains.ts +44 -12
- package/src/config/mainnet/tokens.ts +36 -0
- package/src/config/testnet/chains.ts +47 -18
- package/src/config/testnet/tokens.ts +36 -0
- package/src/config/types.ts +0 -6
- package/src/providers/wormhole/signers/Signer.ts +1 -1
- package/src/providers/wormhole/wormhole.ts +6 -0
- package/src/utils/getUsdcBalance.ts +4 -2
- package/src/version.ts +1 -1
|
@@ -29,6 +29,42 @@ export const mainnetTokens: Record<string, TokenConfig> = {
|
|
|
29
29
|
},
|
|
30
30
|
icon: "USDC",
|
|
31
31
|
},
|
|
32
|
+
Base: {
|
|
33
|
+
symbol: "USDC",
|
|
34
|
+
decimals: 6,
|
|
35
|
+
icon: "USDC",
|
|
36
|
+
tokenId: {
|
|
37
|
+
chain: "Base",
|
|
38
|
+
address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
Arbitrum: {
|
|
42
|
+
symbol: "USDC",
|
|
43
|
+
decimals: 6,
|
|
44
|
+
icon: "USDC",
|
|
45
|
+
tokenId: {
|
|
46
|
+
chain: "Arbitrum",
|
|
47
|
+
address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
Avalanche: {
|
|
51
|
+
symbol: "USDC",
|
|
52
|
+
decimals: 6,
|
|
53
|
+
icon: "USDC",
|
|
54
|
+
tokenId: {
|
|
55
|
+
chain: "Avalanche",
|
|
56
|
+
address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
Polygon: {
|
|
60
|
+
symbol: "USDC",
|
|
61
|
+
decimals: 6,
|
|
62
|
+
icon: "USDC",
|
|
63
|
+
tokenId: {
|
|
64
|
+
chain: "Polygon",
|
|
65
|
+
address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
32
68
|
// Sui: {
|
|
33
69
|
// symbol: "USDC",
|
|
34
70
|
// decimals: 6,
|
|
@@ -1,52 +1,81 @@
|
|
|
1
|
-
import { Context } from "../types";
|
|
2
|
-
|
|
3
|
-
import { ChainsConfig } from "../types";
|
|
1
|
+
import { Context, ChainsConfig } from "../types";
|
|
4
2
|
|
|
5
3
|
export const testnetChains: ChainsConfig = {
|
|
6
4
|
Sepolia: {
|
|
7
5
|
key: "Sepolia",
|
|
8
|
-
id: 10002,
|
|
9
6
|
context: Context.ETH,
|
|
10
|
-
|
|
7
|
+
chainId: 11155111,
|
|
11
8
|
displayName: "Sepolia",
|
|
12
9
|
explorerUrl: "https://sepolia.etherscan.io/",
|
|
13
10
|
explorerName: "Etherscan",
|
|
14
|
-
gasToken: "ETHsepolia",
|
|
15
|
-
chainId: 11155111,
|
|
16
11
|
icon: "Ethereum",
|
|
17
|
-
maxBlockSearch: 2000,
|
|
18
12
|
symbol: "ETH",
|
|
19
13
|
defaultRpc: "https://eth-sepolia.public.blastapi.io",
|
|
20
|
-
|
|
14
|
+
},
|
|
15
|
+
BaseSepolia: {
|
|
16
|
+
key: "BaseSepolia",
|
|
17
|
+
context: Context.ETH,
|
|
18
|
+
chainId: 84532,
|
|
19
|
+
displayName: "Base Sepolia",
|
|
20
|
+
explorerUrl: "https://sepolia.basescan.org",
|
|
21
|
+
explorerName: "Basescan",
|
|
22
|
+
icon: "BaseSepolia",
|
|
23
|
+
symbol: "BASE",
|
|
24
|
+
defaultRpc:
|
|
25
|
+
"https://chain-proxy.wallet.coinbase.com?targetName=base-sepolia",
|
|
26
|
+
},
|
|
27
|
+
ArbitrumSepolia: {
|
|
28
|
+
key: "ArbitrumSepolia",
|
|
29
|
+
context: Context.ETH,
|
|
30
|
+
chainId: 421614,
|
|
31
|
+
displayName: "Arbitrum Sepolia",
|
|
32
|
+
explorerUrl: "https://sepolia.arbiscan.io",
|
|
33
|
+
explorerName: "Etherscan",
|
|
34
|
+
icon: "Arbitrum",
|
|
35
|
+
symbol: "ARB",
|
|
36
|
+
defaultRpc: "https://sepolia-rollup.arbitrum.io/rpc",
|
|
37
|
+
},
|
|
38
|
+
Avalanche: {
|
|
39
|
+
key: "Avalanche",
|
|
40
|
+
context: Context.ETH,
|
|
41
|
+
chainId: 43113,
|
|
42
|
+
displayName: "Avalanche Fuji",
|
|
43
|
+
explorerUrl: "https://testnet.snowtrace.io",
|
|
44
|
+
explorerName: "Avascan",
|
|
45
|
+
icon: "Avalanche",
|
|
46
|
+
symbol: "AVAX",
|
|
47
|
+
defaultRpc: "https://api.avax-test.network/ext/bc/C/rpc",
|
|
48
|
+
},
|
|
49
|
+
PolygonSepolia: {
|
|
50
|
+
key: "PolygonSepolia",
|
|
51
|
+
context: Context.ETH,
|
|
52
|
+
chainId: 80002,
|
|
53
|
+
displayName: "Polygon",
|
|
54
|
+
explorerUrl: "https://amoy.polygonscan.com/",
|
|
55
|
+
explorerName: "PolygonScan",
|
|
56
|
+
icon: "Polygon",
|
|
57
|
+
symbol: "MATIC",
|
|
58
|
+
defaultRpc: "https://rpc-amoy.polygon.technology/",
|
|
21
59
|
},
|
|
22
60
|
Solana: {
|
|
23
61
|
key: "Solana",
|
|
24
|
-
id: 1,
|
|
25
62
|
context: Context.SOLANA,
|
|
26
|
-
finalityThreshold: 32,
|
|
27
63
|
displayName: "Solana",
|
|
28
64
|
explorerUrl: "https://explorer.solana.com/",
|
|
29
65
|
explorerName: "Solana Explorer",
|
|
30
|
-
gasToken: "SOL",
|
|
31
66
|
chainId: 0,
|
|
32
67
|
icon: "Solana",
|
|
33
|
-
maxBlockSearch: 2000,
|
|
34
68
|
symbol: "SOL",
|
|
35
69
|
defaultRpc: "https://api.devnet.solana.com",
|
|
36
|
-
wrappedGasToken: "So11111111111111111111111111111111111111112",
|
|
37
70
|
},
|
|
38
71
|
Aptos: {
|
|
39
72
|
key: "Aptos",
|
|
40
|
-
id: 22,
|
|
41
73
|
context: Context.APTOS,
|
|
42
|
-
finalityThreshold: 0,
|
|
43
74
|
displayName: "Aptos",
|
|
44
75
|
explorerUrl: "https://explorer.aptoslabs.com?network=testnet",
|
|
45
76
|
explorerName: "Aptos Explorer",
|
|
46
|
-
gasToken: "APT",
|
|
47
77
|
chainId: 0,
|
|
48
78
|
icon: "Aptos",
|
|
49
|
-
maxBlockSearch: 0,
|
|
50
79
|
symbol: "APT",
|
|
51
80
|
defaultRpc: "https://fullnode.testnet.aptos.dev",
|
|
52
81
|
},
|
|
@@ -29,6 +29,42 @@ export const testnetTokens: Record<string, TokenConfig> = {
|
|
|
29
29
|
},
|
|
30
30
|
icon: "USDC",
|
|
31
31
|
},
|
|
32
|
+
BaseSepolia: {
|
|
33
|
+
symbol: "USDC",
|
|
34
|
+
icon: "USDC",
|
|
35
|
+
decimals: 6,
|
|
36
|
+
tokenId: {
|
|
37
|
+
chain: "BaseSepolia",
|
|
38
|
+
address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
Avalanche: {
|
|
42
|
+
symbol: "USDC",
|
|
43
|
+
icon: "USDC",
|
|
44
|
+
decimals: 6,
|
|
45
|
+
tokenId: {
|
|
46
|
+
chain: "Avalanche",
|
|
47
|
+
address: "0x5425890298aed601595a70AB815c96711a31Bc65",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
ArbitrumSepolia: {
|
|
51
|
+
symbol: "USDC",
|
|
52
|
+
icon: "USDC",
|
|
53
|
+
decimals: 6,
|
|
54
|
+
tokenId: {
|
|
55
|
+
chain: "ArbitrumSepolia",
|
|
56
|
+
address: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
PolygonSepolia: {
|
|
60
|
+
symbol: "USDC",
|
|
61
|
+
icon: "USDC",
|
|
62
|
+
decimals: 6,
|
|
63
|
+
tokenId: {
|
|
64
|
+
chain: "PolygonSepolia",
|
|
65
|
+
address: "0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582",
|
|
66
|
+
},
|
|
67
|
+
},
|
|
32
68
|
// Sui: {
|
|
33
69
|
// symbol: "USDC",
|
|
34
70
|
// tokenId: {
|
package/src/config/types.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ChainId } from "@wormhole-foundation/sdk";
|
|
2
1
|
import { Chain } from "../CrossChainCore";
|
|
3
2
|
|
|
4
3
|
export enum Context {
|
|
@@ -9,9 +8,7 @@ export enum Context {
|
|
|
9
8
|
|
|
10
9
|
export type BaseChainConfig = {
|
|
11
10
|
key: Chain;
|
|
12
|
-
id: ChainId;
|
|
13
11
|
context: Context;
|
|
14
|
-
finalityThreshold: number;
|
|
15
12
|
disabledAsSource?: boolean;
|
|
16
13
|
disabledAsDestination?: boolean;
|
|
17
14
|
};
|
|
@@ -21,11 +18,8 @@ export interface ChainConfig extends BaseChainConfig {
|
|
|
21
18
|
displayName: string;
|
|
22
19
|
explorerUrl: string;
|
|
23
20
|
explorerName: string;
|
|
24
|
-
gasToken: string;
|
|
25
|
-
wrappedGasToken?: string;
|
|
26
21
|
chainId: number | string;
|
|
27
22
|
icon: Chain;
|
|
28
|
-
maxBlockSearch: number;
|
|
29
23
|
symbol?: string;
|
|
30
24
|
}
|
|
31
25
|
|
|
@@ -200,6 +200,8 @@ export class WormholeProvider
|
|
|
200
200
|
}
|
|
201
201
|
logger.log("signerAddress", signerAddress);
|
|
202
202
|
|
|
203
|
+
//const chainContext =
|
|
204
|
+
|
|
203
205
|
const signer = new Signer(
|
|
204
206
|
this.getChainConfig(sourceChain),
|
|
205
207
|
signerAddress,
|
|
@@ -207,6 +209,10 @@ export class WormholeProvider
|
|
|
207
209
|
wallet
|
|
208
210
|
);
|
|
209
211
|
|
|
212
|
+
logger.log("signer", signer);
|
|
213
|
+
logger.log("wormholeRequest", this.wormholeRequest);
|
|
214
|
+
logger.log("wormholeQuote", this.wormholeQuote);
|
|
215
|
+
|
|
210
216
|
let receipt = await this.wormholeRoute.initiate(
|
|
211
217
|
this.wormholeRequest,
|
|
212
218
|
signer,
|
|
@@ -2,6 +2,7 @@ import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
|
|
|
2
2
|
import { Connection, PublicKey } from "@solana/web3.js";
|
|
3
3
|
import { mainnetTokens, testnetTokens } from "../config";
|
|
4
4
|
import { ethers, JsonRpcProvider } from "ethers";
|
|
5
|
+
import { Chain } from "../CrossChainCore";
|
|
5
6
|
|
|
6
7
|
export const getSolanaWalletUSDCBalance = async (
|
|
7
8
|
walletAddress: string,
|
|
@@ -35,12 +36,13 @@ export const getSolanaWalletUSDCBalance = async (
|
|
|
35
36
|
export const getEthereumWalletUSDCBalance = async (
|
|
36
37
|
walletAddress: string,
|
|
37
38
|
aptosNetwork: Network,
|
|
39
|
+
chain: Chain,
|
|
38
40
|
rpc: string
|
|
39
41
|
): Promise<string> => {
|
|
40
42
|
const token =
|
|
41
43
|
aptosNetwork === Network.MAINNET
|
|
42
|
-
? mainnetTokens[
|
|
43
|
-
: testnetTokens[
|
|
44
|
+
? mainnetTokens[chain]
|
|
45
|
+
: testnetTokens[chain];
|
|
44
46
|
|
|
45
47
|
const tokenAddress = token.tokenId.address;
|
|
46
48
|
const connection = new JsonRpcProvider(rpc);
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CROSS_CHAIN_CORE_VERSION = "5.
|
|
1
|
+
export const CROSS_CHAIN_CORE_VERSION = "5.1.1";
|