@galacticcouncil/xc-core 0.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 +11 -0
- package/build/index.cjs +1 -0
- package/build/index.mjs +1 -0
- package/build/types/asset/Asset.d.ts +10 -0
- package/build/types/asset/AssetAmount.d.ts +23 -0
- package/build/types/asset/index.d.ts +2 -0
- package/build/types/bridge/index.d.ts +2 -0
- package/build/types/bridge/snowbridge.d.ts +14 -0
- package/build/types/bridge/wormhole.d.ts +30 -0
- package/build/types/chain/Chain.d.ts +75 -0
- package/build/types/chain/EvmChain.d.ts +22 -0
- package/build/types/chain/EvmParachain.d.ts +21 -0
- package/build/types/chain/Parachain.d.ts +75 -0
- package/build/types/chain/SolanaChain.d.ts +17 -0
- package/build/types/chain/SuiChain.d.ts +15 -0
- package/build/types/chain/dex/factory.d.ts +9 -0
- package/build/types/chain/dex/index.d.ts +2 -0
- package/build/types/chain/dex/types.d.ts +11 -0
- package/build/types/chain/index.d.ts +8 -0
- package/build/types/chain/types.d.ts +8 -0
- package/build/types/config/ConfigBuilder.d.ts +19 -0
- package/build/types/config/ConfigService.d.ts +25 -0
- package/build/types/config/definition/AssetRoute.d.ts +50 -0
- package/build/types/config/definition/ChainRoutes.d.ts +17 -0
- package/build/types/config/definition/balance/BalanceConfigBuilder.d.ts +12 -0
- package/build/types/config/definition/balance/index.d.ts +1 -0
- package/build/types/config/definition/base/BaseConfig.d.ts +13 -0
- package/build/types/config/definition/base/SolanaQueryConfig.d.ts +10 -0
- package/build/types/config/definition/base/SubstrateQueryConfig.d.ts +10 -0
- package/build/types/config/definition/base/SuiQueryConfig.d.ts +9 -0
- package/build/types/config/definition/base/index.d.ts +5 -0
- package/build/types/config/definition/base/types.d.ts +6 -0
- package/build/types/config/definition/contract/ContractConfig.d.ts +16 -0
- package/build/types/config/definition/contract/ContractConfigBuilder.d.ts +7 -0
- package/build/types/config/definition/contract/index.d.ts +2 -0
- package/build/types/config/definition/extrinsic/ExtrinsicConfig.d.ts +9 -0
- package/build/types/config/definition/extrinsic/ExtrinsicConfigBuilder.d.ts +22 -0
- package/build/types/config/definition/extrinsic/index.d.ts +2 -0
- package/build/types/config/definition/fee/FeeAmountConfigBuilder.d.ts +17 -0
- package/build/types/config/definition/fee/FeeAssetConfigBuilder.d.ts +9 -0
- package/build/types/config/definition/fee/FeeConfig.d.ts +20 -0
- package/build/types/config/definition/fee/index.d.ts +3 -0
- package/build/types/config/definition/index.d.ts +10 -0
- package/build/types/config/definition/min/MinConfigBuilder.d.ts +8 -0
- package/build/types/config/definition/min/index.d.ts +1 -0
- package/build/types/config/definition/move/MoveConfig.d.ts +9 -0
- package/build/types/config/definition/move/MoveConfigBuilder.d.ts +7 -0
- package/build/types/config/definition/move/index.d.ts +2 -0
- package/build/types/config/definition/program/ProgramConfig.d.ts +11 -0
- package/build/types/config/definition/program/ProgramConfigBuilder.d.ts +7 -0
- package/build/types/config/definition/program/index.d.ts +2 -0
- package/build/types/config/index.d.ts +5 -0
- package/build/types/config/types.d.ts +42 -0
- package/build/types/config/validation.d.ts +23 -0
- package/build/types/evm/Erc20Client.d.ts +13 -0
- package/build/types/evm/EvmClient.d.ts +13 -0
- package/build/types/evm/EvmResolver.d.ts +4 -0
- package/build/types/evm/abi/Batch.d.ts +87 -0
- package/build/types/evm/abi/Erc20.d.ts +150 -0
- package/build/types/evm/abi/Gmp.d.ts +11 -0
- package/build/types/evm/abi/Meta.d.ts +738 -0
- package/build/types/evm/abi/Snowbridge.d.ts +836 -0
- package/build/types/evm/abi/TokenBridge.d.ts +981 -0
- package/build/types/evm/abi/TokenRelayer.d.ts +83 -0
- package/build/types/evm/abi/Weth.d.ts +0 -0
- package/build/types/evm/abi/Xtokens.d.ts +72 -0
- package/build/types/evm/abi/index.d.ts +2 -0
- package/build/types/evm/index.d.ts +5 -0
- package/build/types/evm/precompile.d.ts +1 -0
- package/build/types/index.d.ts +7 -0
- package/build/types/substrate/SubstrateApis.d.ts +13 -0
- package/build/types/substrate/index.d.ts +1 -0
- package/build/types/utils/account.d.ts +24 -0
- package/build/types/utils/account.spec.d.ts +1 -0
- package/build/types/utils/address.d.ts +31 -0
- package/build/types/utils/address.spec.d.ts +1 -0
- package/build/types/utils/index.d.ts +4 -0
- package/build/types/utils/mrl.d.ts +18 -0
- package/build/types/utils/mrl.spec.d.ts +1 -0
- package/build/types/utils/multilocation.d.ts +5 -0
- package/build/types/utils/multilocation.spec.d.ts +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
export declare const TOKEN_RELAYER: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly internalType: "uint16";
|
|
4
|
+
readonly name: "targetChainId";
|
|
5
|
+
readonly type: "uint16";
|
|
6
|
+
}, {
|
|
7
|
+
readonly internalType: "address";
|
|
8
|
+
readonly name: "token";
|
|
9
|
+
readonly type: "address";
|
|
10
|
+
}, {
|
|
11
|
+
readonly internalType: "uint8";
|
|
12
|
+
readonly name: "decimals";
|
|
13
|
+
readonly type: "uint8";
|
|
14
|
+
}];
|
|
15
|
+
readonly name: "calculateRelayerFee";
|
|
16
|
+
readonly outputs: readonly [{
|
|
17
|
+
readonly internalType: "uint256";
|
|
18
|
+
readonly name: "feeInTokenDenomination";
|
|
19
|
+
readonly type: "uint256";
|
|
20
|
+
}];
|
|
21
|
+
readonly stateMutability: "view";
|
|
22
|
+
readonly type: "function";
|
|
23
|
+
}, {
|
|
24
|
+
readonly inputs: readonly [{
|
|
25
|
+
readonly internalType: "address";
|
|
26
|
+
readonly name: "token";
|
|
27
|
+
readonly type: "address";
|
|
28
|
+
}, {
|
|
29
|
+
readonly internalType: "uint256";
|
|
30
|
+
readonly name: "amount";
|
|
31
|
+
readonly type: "uint256";
|
|
32
|
+
}, {
|
|
33
|
+
readonly internalType: "uint256";
|
|
34
|
+
readonly name: "toNativeTokenAmount";
|
|
35
|
+
readonly type: "uint256";
|
|
36
|
+
}, {
|
|
37
|
+
readonly internalType: "uint16";
|
|
38
|
+
readonly name: "targetChain";
|
|
39
|
+
readonly type: "uint16";
|
|
40
|
+
}, {
|
|
41
|
+
readonly internalType: "bytes32";
|
|
42
|
+
readonly name: "targetRecipient";
|
|
43
|
+
readonly type: "bytes32";
|
|
44
|
+
}, {
|
|
45
|
+
readonly internalType: "uint32";
|
|
46
|
+
readonly name: "batchId";
|
|
47
|
+
readonly type: "uint32";
|
|
48
|
+
}];
|
|
49
|
+
readonly name: "transferTokensWithRelay";
|
|
50
|
+
readonly outputs: readonly [{
|
|
51
|
+
readonly internalType: "uint64";
|
|
52
|
+
readonly name: "messageSequence";
|
|
53
|
+
readonly type: "uint64";
|
|
54
|
+
}];
|
|
55
|
+
readonly stateMutability: "payable";
|
|
56
|
+
readonly type: "function";
|
|
57
|
+
}, {
|
|
58
|
+
readonly inputs: readonly [{
|
|
59
|
+
readonly internalType: "uint256";
|
|
60
|
+
readonly name: "toNativeTokenAmount";
|
|
61
|
+
readonly type: "uint256";
|
|
62
|
+
}, {
|
|
63
|
+
readonly internalType: "uint16";
|
|
64
|
+
readonly name: "targetChain";
|
|
65
|
+
readonly type: "uint16";
|
|
66
|
+
}, {
|
|
67
|
+
readonly internalType: "bytes32";
|
|
68
|
+
readonly name: "targetRecipient";
|
|
69
|
+
readonly type: "bytes32";
|
|
70
|
+
}, {
|
|
71
|
+
readonly internalType: "uint32";
|
|
72
|
+
readonly name: "batchId";
|
|
73
|
+
readonly type: "uint32";
|
|
74
|
+
}];
|
|
75
|
+
readonly name: "wrapAndTransferEthWithRelay";
|
|
76
|
+
readonly outputs: readonly [{
|
|
77
|
+
readonly internalType: "uint64";
|
|
78
|
+
readonly name: "messageSequence";
|
|
79
|
+
readonly type: "uint64";
|
|
80
|
+
}];
|
|
81
|
+
readonly stateMutability: "payable";
|
|
82
|
+
readonly type: "function";
|
|
83
|
+
}];
|
|
File without changes
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
export declare const XTOKENS: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly internalType: "address";
|
|
4
|
+
readonly name: "currencyAddress";
|
|
5
|
+
readonly type: "address";
|
|
6
|
+
}, {
|
|
7
|
+
readonly internalType: "uint256";
|
|
8
|
+
readonly name: "amount";
|
|
9
|
+
readonly type: "uint256";
|
|
10
|
+
}, {
|
|
11
|
+
readonly components: readonly [{
|
|
12
|
+
readonly internalType: "uint8";
|
|
13
|
+
readonly name: "parents";
|
|
14
|
+
readonly type: "uint8";
|
|
15
|
+
}, {
|
|
16
|
+
readonly internalType: "bytes[]";
|
|
17
|
+
readonly name: "interior";
|
|
18
|
+
readonly type: "bytes[]";
|
|
19
|
+
}];
|
|
20
|
+
readonly internalType: "struct Xtokens.Multilocation";
|
|
21
|
+
readonly name: "destination";
|
|
22
|
+
readonly type: "tuple";
|
|
23
|
+
}, {
|
|
24
|
+
readonly internalType: "uint64";
|
|
25
|
+
readonly name: "weight";
|
|
26
|
+
readonly type: "uint64";
|
|
27
|
+
}];
|
|
28
|
+
readonly name: "transfer";
|
|
29
|
+
readonly outputs: readonly [];
|
|
30
|
+
readonly stateMutability: "nonpayable";
|
|
31
|
+
readonly type: "function";
|
|
32
|
+
}, {
|
|
33
|
+
readonly inputs: readonly [{
|
|
34
|
+
readonly components: readonly [{
|
|
35
|
+
readonly internalType: "address";
|
|
36
|
+
readonly name: "currencyAddress";
|
|
37
|
+
readonly type: "address";
|
|
38
|
+
}, {
|
|
39
|
+
readonly internalType: "uint256";
|
|
40
|
+
readonly name: "amount";
|
|
41
|
+
readonly type: "uint256";
|
|
42
|
+
}];
|
|
43
|
+
readonly internalType: "struct Xtokens.Currency[]";
|
|
44
|
+
readonly name: "currencies";
|
|
45
|
+
readonly type: "tuple[]";
|
|
46
|
+
}, {
|
|
47
|
+
readonly internalType: "uint32";
|
|
48
|
+
readonly name: "feeItem";
|
|
49
|
+
readonly type: "uint32";
|
|
50
|
+
}, {
|
|
51
|
+
readonly components: readonly [{
|
|
52
|
+
readonly internalType: "uint8";
|
|
53
|
+
readonly name: "parents";
|
|
54
|
+
readonly type: "uint8";
|
|
55
|
+
}, {
|
|
56
|
+
readonly internalType: "bytes[]";
|
|
57
|
+
readonly name: "interior";
|
|
58
|
+
readonly type: "bytes[]";
|
|
59
|
+
}];
|
|
60
|
+
readonly internalType: "struct Xtokens.Multilocation";
|
|
61
|
+
readonly name: "destination";
|
|
62
|
+
readonly type: "tuple";
|
|
63
|
+
}, {
|
|
64
|
+
readonly internalType: "uint64";
|
|
65
|
+
readonly name: "weight";
|
|
66
|
+
readonly type: "uint64";
|
|
67
|
+
}];
|
|
68
|
+
readonly name: "transferMultiCurrencies";
|
|
69
|
+
readonly outputs: readonly [];
|
|
70
|
+
readonly stateMutability: "nonpayable";
|
|
71
|
+
readonly type: "function";
|
|
72
|
+
}];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const Precompile: Record<string, string>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PolkadotClient } from 'polkadot-api';
|
|
2
|
+
export declare class SubstrateApis {
|
|
3
|
+
private static _instance;
|
|
4
|
+
private dispose;
|
|
5
|
+
private _cache;
|
|
6
|
+
constructor();
|
|
7
|
+
static getInstance(): SubstrateApis;
|
|
8
|
+
createCacheKey(endpoints: string[]): string;
|
|
9
|
+
findCacheKey(endpoints: string[]): string | null;
|
|
10
|
+
createClient(endpoints: string[]): PolkadotClient;
|
|
11
|
+
api(ws: string | string[]): PolkadotClient;
|
|
12
|
+
release(): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SubstrateApis';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multilocation-derivative account - an account computed when executing remote calls
|
|
3
|
+
* via XCM.
|
|
4
|
+
*
|
|
5
|
+
* @param parachainId parachain id or undefined in case of relay
|
|
6
|
+
* @param address sender address
|
|
7
|
+
* @param parents describe family
|
|
8
|
+
* @returns multilocation derivated account address
|
|
9
|
+
*/
|
|
10
|
+
export declare function getMultilocationDerivatedAccount(parachainId: number | undefined, address: string, parents: number, isEthereumStyle?: boolean): string;
|
|
11
|
+
/**
|
|
12
|
+
* Sovereign account — an account each chain in the ecosystem has, one for the relay chain
|
|
13
|
+
* and the other for other parachains. The account is owned by root and can only be used
|
|
14
|
+
* through SUDO (if available) or democracy (technical committee or referenda). The sovereign
|
|
15
|
+
* account typically signs XCM messages in other chains in the ecosystem.
|
|
16
|
+
*
|
|
17
|
+
* @param parachainId parachain id
|
|
18
|
+
* @returns sovereign account addresses
|
|
19
|
+
*/
|
|
20
|
+
export declare function getSovereignAccounts(parachainId: number): {
|
|
21
|
+
generic: string;
|
|
22
|
+
moonbeam: string;
|
|
23
|
+
relay: string;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface Addr {
|
|
2
|
+
isValid(address: string): boolean;
|
|
3
|
+
/** Returns hex public key (0x...) */
|
|
4
|
+
getPubKey(address: string): string;
|
|
5
|
+
/** Encodes a hex public key (0x...) into an address string. */
|
|
6
|
+
encodePubKey(pubKey: string): string;
|
|
7
|
+
}
|
|
8
|
+
export declare class Ss58Addr {
|
|
9
|
+
/**
|
|
10
|
+
* Strict SS58 only to avoid confusing 0x32 (Sui/EVM-like) with SS58.
|
|
11
|
+
* Accept any prefix as long as it decodes to 32 bytes.
|
|
12
|
+
*
|
|
13
|
+
* @param addr - address
|
|
14
|
+
* @returns true if strict ss58, otherwise false
|
|
15
|
+
*/
|
|
16
|
+
private static isSs58Strict;
|
|
17
|
+
static isValid(address: string): boolean;
|
|
18
|
+
static getPubKey(address: string): string;
|
|
19
|
+
static encodePubKey(pubKey: string, ss58Prefix?: number): string;
|
|
20
|
+
}
|
|
21
|
+
export declare class EvmAddr {
|
|
22
|
+
static isValid(address: string): boolean;
|
|
23
|
+
}
|
|
24
|
+
export declare class SolanaAddr {
|
|
25
|
+
static isValid(address: string): boolean;
|
|
26
|
+
static getPubKey(address: string): string;
|
|
27
|
+
static encodePubKey(pubKey: string): string;
|
|
28
|
+
}
|
|
29
|
+
export declare class SuiAddr {
|
|
30
|
+
static isValid(address: string): boolean;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { XcmVersionedLocation } from '@galacticcouncil/descriptors';
|
|
2
|
+
import { Parachain } from '../chain';
|
|
3
|
+
type XcmRoutingUserAction = {
|
|
4
|
+
destination: XcmVersionedLocation;
|
|
5
|
+
};
|
|
6
|
+
type VersionedUserAction = {
|
|
7
|
+
tag: 'V1';
|
|
8
|
+
value: XcmRoutingUserAction;
|
|
9
|
+
};
|
|
10
|
+
interface EncodedPayload {
|
|
11
|
+
bytes: Uint8Array;
|
|
12
|
+
toHex(): string;
|
|
13
|
+
toU8a(): Uint8Array;
|
|
14
|
+
}
|
|
15
|
+
export declare function createPayload(parachain: Parachain, address: string, isEthereumStyle?: boolean): Promise<EncodedPayload>;
|
|
16
|
+
export declare function decodePayload(parachain: Parachain, payloadHex: string): Promise<VersionedUserAction>;
|
|
17
|
+
export declare function encodeDestination(parachain: Parachain, address: string, isEthereumStyle?: boolean): Promise<Uint8Array>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const findNestedKey: (multilocation: object, keyToFind: any) => any;
|
|
2
|
+
export declare const findGlobalConsensus: (multilocation: object) => any;
|
|
3
|
+
export declare const findParachain: (multilocation: object) => any;
|
|
4
|
+
export declare const findPalletInstance: (multilocation: object) => any;
|
|
5
|
+
export declare const findGeneralIndex: (multilocation: object) => any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@galacticcouncil/xc-core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Cross-chain sdk core",
|
|
5
|
+
"author": "GalacticCouncil",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"repository": {
|
|
8
|
+
"directory": "packages/xc-core",
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/galacticcouncil/sdk.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"evm",
|
|
14
|
+
"substrate",
|
|
15
|
+
"xcm",
|
|
16
|
+
"sdk"
|
|
17
|
+
],
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/galacticcouncil/sdk/issues"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"build"
|
|
23
|
+
],
|
|
24
|
+
"main": "./build/index.cjs",
|
|
25
|
+
"module": "./build/index.mjs",
|
|
26
|
+
"types": "./build/types/index.d.ts",
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "npm run clean && node ./esbuild.dist.mjs",
|
|
29
|
+
"build:watch": "node ./esbuild.dev.mjs",
|
|
30
|
+
"postbuild": "tsc --emitDeclarationOnly --outDir build/types",
|
|
31
|
+
"clean": "rimraf build",
|
|
32
|
+
"link": "npm ln",
|
|
33
|
+
"test": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-vm-modules jest"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@galacticcouncil/descriptors": "^1.5.1",
|
|
37
|
+
"@types/big.js": "^6.2.2",
|
|
38
|
+
"@types/lru-cache": "^7.10.9"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"@galacticcouncil/common": "^0.1.0",
|
|
42
|
+
"@noble/hashes": "^1.6.1",
|
|
43
|
+
"@wormhole-foundation/sdk-base": "3.2.0",
|
|
44
|
+
"@wormhole-foundation/sdk-connect": "3.2.0",
|
|
45
|
+
"@wormhole-foundation/sdk-definitions": "3.2.0",
|
|
46
|
+
"@wormhole-foundation/sdk-solana": "3.2.0",
|
|
47
|
+
"@wormhole-foundation/sdk-solana-core": "3.2.0",
|
|
48
|
+
"@wormhole-foundation/sdk-solana-tokenbridge": "3.2.0",
|
|
49
|
+
"@wormhole-foundation/sdk-sui": "3.2.0",
|
|
50
|
+
"@wormhole-foundation/sdk-sui-tokenbridge": "3.2.0",
|
|
51
|
+
"big.js": "^6.2.1",
|
|
52
|
+
"bigint-buffer": "^1.1.5",
|
|
53
|
+
"buffer": "^6.0.3",
|
|
54
|
+
"bs58": "^6.0.0",
|
|
55
|
+
"lru-cache": "^11.0.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"polkadot-api": ">=1.19.2 <1.20.0",
|
|
59
|
+
"viem": "^2.38.3"
|
|
60
|
+
}
|
|
61
|
+
}
|