@aptos-labs/cross-chain-core 5.0.1 → 5.1.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 +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 +4 -4
- 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
package/README.md
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
1
|
# Aptos Cross Chain CCTP
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
sourceChain = originChain (x-chain)
|
|
6
|
-
destinationChain = "Aptos"
|
|
7
|
-
|
|
8
|
-
If transaction type is `withdraw`
|
|
9
|
-
|
|
10
|
-
sourceChain = "Aptos"
|
|
11
|
-
destinationChain = originChain (x-chain)
|
|
3
|
+
A Wormhole wrapper for CCTP cross chain transactions
|
package/dist/CrossChainCore.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Account, Network } from "@aptos-labs/ts-sdk";
|
|
2
|
-
import { ChainsConfig, TokenConfig } from "./config";
|
|
2
|
+
import { ChainsConfig, TokenConfig, ChainConfig } from "./config";
|
|
3
3
|
export interface CrossChainDappConfig {
|
|
4
4
|
aptosNetwork: Network;
|
|
5
5
|
disableTelemetry?: boolean;
|
|
@@ -16,7 +16,9 @@ export interface CrossChainDappConfig {
|
|
|
16
16
|
export type { AccountAddressInput } from "@aptos-labs/ts-sdk";
|
|
17
17
|
export { NetworkToChainId, NetworkToNodeAPI } from "@aptos-labs/ts-sdk";
|
|
18
18
|
export type AptosAccount = Account;
|
|
19
|
-
export type Chain = "Solana" | "Ethereum" | "Sepolia" | "Aptos";
|
|
19
|
+
export type Chain = "Solana" | "Ethereum" | "Sepolia" | "Aptos" | "BaseSepolia" | "ArbitrumSepolia" | "Avalanche" | "Base" | "Arbitrum" | "PolygonSepolia" | "Polygon";
|
|
20
|
+
export declare const EthereumChainIdToTestnetChain: Record<string, ChainConfig>;
|
|
21
|
+
export declare const EthereumChainIdToMainnetChain: Record<string, ChainConfig>;
|
|
20
22
|
export type CCTPProviders = "Wormhole";
|
|
21
23
|
export interface CrossChainProvider<TQuoteRequest = any, TQuoteResponse = any, TTransferRequest = any, TTransferResponse = any, TWithdrawRequest = any, TWithdrawResponse = any> {
|
|
22
24
|
getQuote(params: TQuoteRequest): Promise<TQuoteResponse>;
|
|
@@ -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,EACZ,MAAM,UAAU,CAAC;AAOlB,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,YAAY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,UAAU,CAAC;AAEjD,eAAO,MAAM,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../../src/config/mainnet/chains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,UAAU,CAAC;AAEjD,eAAO,MAAM,aAAa,EAAE,YA6F3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/config/mainnet/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/config/mainnet/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CA2ErD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../../src/config/testnet/chains.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../../src/config/testnet/chains.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,YAAY,EAAE,MAAM,UAAU,CAAC;AAEjD,eAAO,MAAM,aAAa,EAAE,YA8F3B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/config/testnet/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/config/testnet/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CA2ErD,CAAC"}
|
package/dist/config/types.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ChainId } from "@wormhole-foundation/sdk";
|
|
2
1
|
import { Chain } from "../CrossChainCore";
|
|
3
2
|
export declare enum Context {
|
|
4
3
|
ETH = "Ethereum",
|
|
@@ -7,9 +6,7 @@ export declare enum Context {
|
|
|
7
6
|
}
|
|
8
7
|
export type BaseChainConfig = {
|
|
9
8
|
key: Chain;
|
|
10
|
-
id: ChainId;
|
|
11
9
|
context: Context;
|
|
12
|
-
finalityThreshold: number;
|
|
13
10
|
disabledAsSource?: boolean;
|
|
14
11
|
disabledAsDestination?: boolean;
|
|
15
12
|
};
|
|
@@ -18,11 +15,8 @@ export interface ChainConfig extends BaseChainConfig {
|
|
|
18
15
|
displayName: string;
|
|
19
16
|
explorerUrl: string;
|
|
20
17
|
explorerName: string;
|
|
21
|
-
gasToken: string;
|
|
22
|
-
wrappedGasToken?: string;
|
|
23
18
|
chainId: number | string;
|
|
24
19
|
icon: Chain;
|
|
25
|
-
maxBlockSearch: number;
|
|
26
20
|
symbol?: string;
|
|
27
21
|
}
|
|
28
22
|
export type ChainsConfig = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,oBAAY,OAAO;IACjB,GAAG,aAAa;IAChB,MAAM,WAAW;IACjB,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,KAAK,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,YAAY,GAAG;KACxB,KAAK,IAAI,KAAK,CAAC,CAAC,EAAE,WAAW;CAC/B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QACP,KAAK,EAAE,KAAK,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;CACH,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,8 @@ __export(index_exports, {
|
|
|
33
33
|
AptosLocalSigner: () => AptosLocalSigner,
|
|
34
34
|
Context: () => Context,
|
|
35
35
|
CrossChainCore: () => CrossChainCore,
|
|
36
|
+
EthereumChainIdToMainnetChain: () => EthereumChainIdToMainnetChain,
|
|
37
|
+
EthereumChainIdToTestnetChain: () => EthereumChainIdToTestnetChain,
|
|
36
38
|
Network: () => import_ts_sdk7.Network,
|
|
37
39
|
NetworkToChainId: () => import_ts_sdk6.NetworkToChainId,
|
|
38
40
|
NetworkToNodeAPI: () => import_ts_sdk6.NetworkToNodeAPI,
|
|
@@ -529,7 +531,7 @@ var Signer = class {
|
|
|
529
531
|
this._claimedTransactionHashes = "";
|
|
530
532
|
}
|
|
531
533
|
chain() {
|
|
532
|
-
return this._chain.
|
|
534
|
+
return this._chain.key;
|
|
533
535
|
}
|
|
534
536
|
address() {
|
|
535
537
|
return this._address;
|
|
@@ -694,6 +696,9 @@ var WormholeProvider = class {
|
|
|
694
696
|
{},
|
|
695
697
|
wallet
|
|
696
698
|
);
|
|
699
|
+
logger.log("signer", signer);
|
|
700
|
+
logger.log("wormholeRequest", this.wormholeRequest);
|
|
701
|
+
logger.log("wormholeQuote", this.wormholeQuote);
|
|
697
702
|
let receipt = await this.wormholeRoute.initiate(
|
|
698
703
|
this.wormholeRequest,
|
|
699
704
|
signer,
|
|
@@ -899,48 +904,78 @@ var Context = /* @__PURE__ */ ((Context2) => {
|
|
|
899
904
|
var testnetChains = {
|
|
900
905
|
Sepolia: {
|
|
901
906
|
key: "Sepolia",
|
|
902
|
-
id: 10002,
|
|
903
907
|
context: "Ethereum" /* ETH */,
|
|
904
|
-
|
|
908
|
+
chainId: 11155111,
|
|
905
909
|
displayName: "Sepolia",
|
|
906
910
|
explorerUrl: "https://sepolia.etherscan.io/",
|
|
907
911
|
explorerName: "Etherscan",
|
|
908
|
-
gasToken: "ETHsepolia",
|
|
909
|
-
chainId: 11155111,
|
|
910
912
|
icon: "Ethereum",
|
|
911
|
-
maxBlockSearch: 2e3,
|
|
912
913
|
symbol: "ETH",
|
|
913
|
-
defaultRpc: "https://eth-sepolia.public.blastapi.io"
|
|
914
|
-
|
|
914
|
+
defaultRpc: "https://eth-sepolia.public.blastapi.io"
|
|
915
|
+
},
|
|
916
|
+
BaseSepolia: {
|
|
917
|
+
key: "BaseSepolia",
|
|
918
|
+
context: "Ethereum" /* ETH */,
|
|
919
|
+
chainId: 84532,
|
|
920
|
+
displayName: "Base Sepolia",
|
|
921
|
+
explorerUrl: "https://sepolia.basescan.org",
|
|
922
|
+
explorerName: "Basescan",
|
|
923
|
+
icon: "BaseSepolia",
|
|
924
|
+
symbol: "BASE",
|
|
925
|
+
defaultRpc: "https://chain-proxy.wallet.coinbase.com?targetName=base-sepolia"
|
|
926
|
+
},
|
|
927
|
+
ArbitrumSepolia: {
|
|
928
|
+
key: "ArbitrumSepolia",
|
|
929
|
+
context: "Ethereum" /* ETH */,
|
|
930
|
+
chainId: 421614,
|
|
931
|
+
displayName: "Arbitrum Sepolia",
|
|
932
|
+
explorerUrl: "https://sepolia.arbiscan.io",
|
|
933
|
+
explorerName: "Etherscan",
|
|
934
|
+
icon: "Arbitrum",
|
|
935
|
+
symbol: "ARB",
|
|
936
|
+
defaultRpc: "https://sepolia-rollup.arbitrum.io/rpc"
|
|
937
|
+
},
|
|
938
|
+
Avalanche: {
|
|
939
|
+
key: "Avalanche",
|
|
940
|
+
context: "Ethereum" /* ETH */,
|
|
941
|
+
chainId: 43113,
|
|
942
|
+
displayName: "Avalanche Fuji",
|
|
943
|
+
explorerUrl: "https://testnet.snowtrace.io",
|
|
944
|
+
explorerName: "Avascan",
|
|
945
|
+
icon: "Avalanche",
|
|
946
|
+
symbol: "AVAX",
|
|
947
|
+
defaultRpc: "https://api.avax-test.network/ext/bc/C/rpc"
|
|
948
|
+
},
|
|
949
|
+
PolygonSepolia: {
|
|
950
|
+
key: "PolygonSepolia",
|
|
951
|
+
context: "Ethereum" /* ETH */,
|
|
952
|
+
chainId: 80002,
|
|
953
|
+
displayName: "Polygon",
|
|
954
|
+
explorerUrl: "https://amoy.polygonscan.com/",
|
|
955
|
+
explorerName: "PolygonScan",
|
|
956
|
+
icon: "Polygon",
|
|
957
|
+
symbol: "MATIC",
|
|
958
|
+
defaultRpc: "https://rpc-amoy.polygon.technology/"
|
|
915
959
|
},
|
|
916
960
|
Solana: {
|
|
917
961
|
key: "Solana",
|
|
918
|
-
id: 1,
|
|
919
962
|
context: "Solana" /* SOLANA */,
|
|
920
|
-
finalityThreshold: 32,
|
|
921
963
|
displayName: "Solana",
|
|
922
964
|
explorerUrl: "https://explorer.solana.com/",
|
|
923
965
|
explorerName: "Solana Explorer",
|
|
924
|
-
gasToken: "SOL",
|
|
925
966
|
chainId: 0,
|
|
926
967
|
icon: "Solana",
|
|
927
|
-
maxBlockSearch: 2e3,
|
|
928
968
|
symbol: "SOL",
|
|
929
|
-
defaultRpc: "https://api.devnet.solana.com"
|
|
930
|
-
wrappedGasToken: "So11111111111111111111111111111111111111112"
|
|
969
|
+
defaultRpc: "https://api.devnet.solana.com"
|
|
931
970
|
},
|
|
932
971
|
Aptos: {
|
|
933
972
|
key: "Aptos",
|
|
934
|
-
id: 22,
|
|
935
973
|
context: "Aptos" /* APTOS */,
|
|
936
|
-
finalityThreshold: 0,
|
|
937
974
|
displayName: "Aptos",
|
|
938
975
|
explorerUrl: "https://explorer.aptoslabs.com?network=testnet",
|
|
939
976
|
explorerName: "Aptos Explorer",
|
|
940
|
-
gasToken: "APT",
|
|
941
977
|
chainId: 0,
|
|
942
978
|
icon: "Aptos",
|
|
943
|
-
maxBlockSearch: 0,
|
|
944
979
|
symbol: "APT",
|
|
945
980
|
defaultRpc: "https://fullnode.testnet.aptos.dev"
|
|
946
981
|
}
|
|
@@ -989,6 +1024,42 @@ var testnetTokens = {
|
|
|
989
1024
|
address: "0x69091fbab5f7d635ee7ac5098cf0c1efbe31d68fec0f2cd565e8d168daf52832"
|
|
990
1025
|
},
|
|
991
1026
|
icon: "USDC"
|
|
1027
|
+
},
|
|
1028
|
+
BaseSepolia: {
|
|
1029
|
+
symbol: "USDC",
|
|
1030
|
+
icon: "USDC",
|
|
1031
|
+
decimals: 6,
|
|
1032
|
+
tokenId: {
|
|
1033
|
+
chain: "BaseSepolia",
|
|
1034
|
+
address: "0x036CbD53842c5426634e7929541eC2318f3dCF7e"
|
|
1035
|
+
}
|
|
1036
|
+
},
|
|
1037
|
+
Avalanche: {
|
|
1038
|
+
symbol: "USDC",
|
|
1039
|
+
icon: "USDC",
|
|
1040
|
+
decimals: 6,
|
|
1041
|
+
tokenId: {
|
|
1042
|
+
chain: "Avalanche",
|
|
1043
|
+
address: "0x5425890298aed601595a70AB815c96711a31Bc65"
|
|
1044
|
+
}
|
|
1045
|
+
},
|
|
1046
|
+
ArbitrumSepolia: {
|
|
1047
|
+
symbol: "USDC",
|
|
1048
|
+
icon: "USDC",
|
|
1049
|
+
decimals: 6,
|
|
1050
|
+
tokenId: {
|
|
1051
|
+
chain: "ArbitrumSepolia",
|
|
1052
|
+
address: "0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
PolygonSepolia: {
|
|
1056
|
+
symbol: "USDC",
|
|
1057
|
+
icon: "USDC",
|
|
1058
|
+
decimals: 6,
|
|
1059
|
+
tokenId: {
|
|
1060
|
+
chain: "PolygonSepolia",
|
|
1061
|
+
address: "0x41E94Eb019C0762f9Bfcf9Fb1E58725BfB0e7582"
|
|
1062
|
+
}
|
|
992
1063
|
}
|
|
993
1064
|
// Sui: {
|
|
994
1065
|
// symbol: "USDC",
|
|
@@ -1006,48 +1077,80 @@ var testnetTokens = {
|
|
|
1006
1077
|
var mainnetChains = {
|
|
1007
1078
|
Ethereum: {
|
|
1008
1079
|
key: "Ethereum",
|
|
1009
|
-
id: 2,
|
|
1010
1080
|
context: "Ethereum" /* ETH */,
|
|
1011
|
-
finalityThreshold: 64,
|
|
1012
1081
|
displayName: "Ethereum",
|
|
1013
1082
|
explorerUrl: "https://etherscan.io/",
|
|
1014
1083
|
explorerName: "Etherscan",
|
|
1015
|
-
gasToken: "ETH",
|
|
1016
1084
|
chainId: 1,
|
|
1017
1085
|
icon: "Ethereum",
|
|
1018
|
-
maxBlockSearch: 2e3,
|
|
1019
1086
|
symbol: "ETH",
|
|
1020
1087
|
defaultRpc: "https://rpc.ankr.com/eth"
|
|
1021
1088
|
},
|
|
1022
1089
|
Solana: {
|
|
1023
1090
|
key: "Solana",
|
|
1024
|
-
id: 1,
|
|
1025
1091
|
context: "Solana" /* SOLANA */,
|
|
1026
|
-
finalityThreshold: 32,
|
|
1027
1092
|
displayName: "Solana",
|
|
1028
1093
|
explorerUrl: "https://explorer.solana.com/",
|
|
1029
1094
|
explorerName: "Solana Explorer",
|
|
1030
|
-
gasToken: "SOL",
|
|
1031
1095
|
chainId: 0,
|
|
1032
1096
|
icon: "Solana",
|
|
1033
|
-
maxBlockSearch: 2e3,
|
|
1034
1097
|
symbol: "SOL",
|
|
1035
1098
|
defaultRpc: "https://solana-mainnet.rpc.extrnode.com"
|
|
1036
1099
|
},
|
|
1037
1100
|
Aptos: {
|
|
1038
1101
|
key: "Aptos",
|
|
1039
|
-
id: 22,
|
|
1040
1102
|
context: "Aptos" /* APTOS */,
|
|
1041
|
-
finalityThreshold: 0,
|
|
1042
1103
|
displayName: "Aptos",
|
|
1043
1104
|
explorerUrl: "https://explorer.aptoslabs.com/",
|
|
1044
1105
|
explorerName: "Aptos Explorer",
|
|
1045
|
-
gasToken: "APT",
|
|
1046
1106
|
chainId: 0,
|
|
1047
1107
|
icon: "Aptos",
|
|
1048
|
-
maxBlockSearch: 0,
|
|
1049
1108
|
symbol: "APT",
|
|
1050
1109
|
defaultRpc: "https://fullnode.mainnet.aptos.dev"
|
|
1110
|
+
},
|
|
1111
|
+
Avalanche: {
|
|
1112
|
+
key: "Avalanche",
|
|
1113
|
+
context: "Ethereum" /* ETH */,
|
|
1114
|
+
chainId: 43114,
|
|
1115
|
+
displayName: "Avalanche",
|
|
1116
|
+
explorerUrl: "https://snowtrace.io",
|
|
1117
|
+
explorerName: "Avascan",
|
|
1118
|
+
icon: "Avalanche",
|
|
1119
|
+
symbol: "AVAX",
|
|
1120
|
+
defaultRpc: "https://avalanche-c-chain-rpc.publicnode.com"
|
|
1121
|
+
},
|
|
1122
|
+
Base: {
|
|
1123
|
+
key: "Base",
|
|
1124
|
+
context: "Ethereum" /* ETH */,
|
|
1125
|
+
chainId: 8453,
|
|
1126
|
+
displayName: "Base",
|
|
1127
|
+
explorerUrl: "https://basescan.org",
|
|
1128
|
+
explorerName: "BaseScan",
|
|
1129
|
+
icon: "Base",
|
|
1130
|
+
symbol: "BASE",
|
|
1131
|
+
defaultRpc: "https://mainnet.base.org"
|
|
1132
|
+
},
|
|
1133
|
+
Arbitrum: {
|
|
1134
|
+
key: "Arbitrum",
|
|
1135
|
+
context: "Ethereum" /* ETH */,
|
|
1136
|
+
chainId: 42161,
|
|
1137
|
+
displayName: "Arbitrum",
|
|
1138
|
+
explorerUrl: "https://arbiscan.io/",
|
|
1139
|
+
explorerName: "Arbitrum Explorer",
|
|
1140
|
+
icon: "Arbitrum",
|
|
1141
|
+
symbol: "ARB",
|
|
1142
|
+
defaultRpc: "https://arb1.arbitrum.io/rpc"
|
|
1143
|
+
},
|
|
1144
|
+
Polygon: {
|
|
1145
|
+
key: "Polygon",
|
|
1146
|
+
context: "Ethereum" /* ETH */,
|
|
1147
|
+
chainId: 137,
|
|
1148
|
+
displayName: "Polygon",
|
|
1149
|
+
explorerUrl: "https://polygonscan.com/",
|
|
1150
|
+
explorerName: "PolygonScan",
|
|
1151
|
+
icon: "Polygon",
|
|
1152
|
+
symbol: "MATIC",
|
|
1153
|
+
defaultRpc: "https://polygon-bor-rpc.publicnode.com"
|
|
1051
1154
|
}
|
|
1052
1155
|
// Sui: {
|
|
1053
1156
|
// key: "Sui",
|
|
@@ -1094,6 +1197,42 @@ var mainnetTokens = {
|
|
|
1094
1197
|
address: "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b"
|
|
1095
1198
|
},
|
|
1096
1199
|
icon: "USDC"
|
|
1200
|
+
},
|
|
1201
|
+
Base: {
|
|
1202
|
+
symbol: "USDC",
|
|
1203
|
+
decimals: 6,
|
|
1204
|
+
icon: "USDC",
|
|
1205
|
+
tokenId: {
|
|
1206
|
+
chain: "Base",
|
|
1207
|
+
address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
|
|
1208
|
+
}
|
|
1209
|
+
},
|
|
1210
|
+
Arbitrum: {
|
|
1211
|
+
symbol: "USDC",
|
|
1212
|
+
decimals: 6,
|
|
1213
|
+
icon: "USDC",
|
|
1214
|
+
tokenId: {
|
|
1215
|
+
chain: "Arbitrum",
|
|
1216
|
+
address: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831"
|
|
1217
|
+
}
|
|
1218
|
+
},
|
|
1219
|
+
Avalanche: {
|
|
1220
|
+
symbol: "USDC",
|
|
1221
|
+
decimals: 6,
|
|
1222
|
+
icon: "USDC",
|
|
1223
|
+
tokenId: {
|
|
1224
|
+
chain: "Avalanche",
|
|
1225
|
+
address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"
|
|
1226
|
+
}
|
|
1227
|
+
},
|
|
1228
|
+
Polygon: {
|
|
1229
|
+
symbol: "USDC",
|
|
1230
|
+
decimals: 6,
|
|
1231
|
+
icon: "USDC",
|
|
1232
|
+
tokenId: {
|
|
1233
|
+
chain: "Polygon",
|
|
1234
|
+
address: "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"
|
|
1235
|
+
}
|
|
1097
1236
|
}
|
|
1098
1237
|
// Sui: {
|
|
1099
1238
|
// symbol: "USDC",
|
|
@@ -1122,8 +1261,8 @@ var getSolanaWalletUSDCBalance = async (walletAddress, aptosNetwork, rpc) => {
|
|
|
1122
1261
|
const balance = await connection.getTokenAccountBalance(checkAddress);
|
|
1123
1262
|
return balance.value.uiAmountString ?? (Number(balance.value.amount) / 10 ** balance.value.decimals).toString();
|
|
1124
1263
|
};
|
|
1125
|
-
var getEthereumWalletUSDCBalance = async (walletAddress, aptosNetwork, rpc) => {
|
|
1126
|
-
const token = aptosNetwork === import_ts_sdk4.Network.MAINNET ? mainnetTokens[
|
|
1264
|
+
var getEthereumWalletUSDCBalance = async (walletAddress, aptosNetwork, chain, rpc) => {
|
|
1265
|
+
const token = aptosNetwork === import_ts_sdk4.Network.MAINNET ? mainnetTokens[chain] : testnetTokens[chain];
|
|
1127
1266
|
const tokenAddress = token.tokenId.address;
|
|
1128
1267
|
const connection = new import_ethers2.JsonRpcProvider(rpc);
|
|
1129
1268
|
const abi = ["function balanceOf(address owner) view returns (uint256)"];
|
|
@@ -1153,6 +1292,20 @@ var getAptosWalletUSDCBalance = async (walletAddress, aptosNetwork) => {
|
|
|
1153
1292
|
|
|
1154
1293
|
// src/CrossChainCore.ts
|
|
1155
1294
|
var import_ts_sdk6 = require("@aptos-labs/ts-sdk");
|
|
1295
|
+
var EthereumChainIdToTestnetChain = {
|
|
1296
|
+
11155111: testnetChains.Sepolia,
|
|
1297
|
+
84532: testnetChains.BaseSepolia,
|
|
1298
|
+
421614: testnetChains.ArbitrumSepolia,
|
|
1299
|
+
43113: testnetChains.Avalanche,
|
|
1300
|
+
80002: testnetChains.PolygonSepolia
|
|
1301
|
+
};
|
|
1302
|
+
var EthereumChainIdToMainnetChain = {
|
|
1303
|
+
1: mainnetChains.Ethereum,
|
|
1304
|
+
8453: mainnetChains.Base,
|
|
1305
|
+
42161: mainnetChains.Arbitrum,
|
|
1306
|
+
43114: mainnetChains.Avalanche,
|
|
1307
|
+
137: mainnetChains.Polygon
|
|
1308
|
+
};
|
|
1156
1309
|
var CrossChainCore = class {
|
|
1157
1310
|
constructor(args) {
|
|
1158
1311
|
this._dappConfig = {
|
|
@@ -1195,10 +1348,18 @@ var CrossChainCore = class {
|
|
|
1195
1348
|
this._dappConfig?.solanaConfig?.rpc ?? this.CHAINS[sourceChain].defaultRpc
|
|
1196
1349
|
);
|
|
1197
1350
|
case "Ethereum":
|
|
1351
|
+
case "BaseSepolia":
|
|
1198
1352
|
case "Sepolia":
|
|
1353
|
+
case "Avalanche":
|
|
1354
|
+
case "ArbitrumSepolia":
|
|
1355
|
+
case "Arbitrum":
|
|
1356
|
+
case "Base":
|
|
1357
|
+
case "PolygonSepolia":
|
|
1358
|
+
case "Polygon":
|
|
1199
1359
|
return await getEthereumWalletUSDCBalance(
|
|
1200
1360
|
walletAddress,
|
|
1201
1361
|
this._dappConfig.aptosNetwork,
|
|
1362
|
+
sourceChain,
|
|
1202
1363
|
// TODO: maybe let the user config it
|
|
1203
1364
|
this.CHAINS[sourceChain].defaultRpc
|
|
1204
1365
|
);
|
|
@@ -1215,6 +1376,8 @@ var import_ts_sdk7 = require("@aptos-labs/ts-sdk");
|
|
|
1215
1376
|
AptosLocalSigner,
|
|
1216
1377
|
Context,
|
|
1217
1378
|
CrossChainCore,
|
|
1379
|
+
EthereumChainIdToMainnetChain,
|
|
1380
|
+
EthereumChainIdToTestnetChain,
|
|
1218
1381
|
Network,
|
|
1219
1382
|
NetworkToChainId,
|
|
1220
1383
|
NetworkToNodeAPI,
|