@paraspell/sdk 5.4.2 → 5.6.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 +6 -0
- package/dist/index.cjs +937 -797
- package/dist/index.d.ts +29 -10
- package/dist/index.mjs +937 -797
- package/package.json +20 -21
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ApiPromise } from '@polkadot/api';
|
|
2
2
|
import { SubmittableExtrinsic } from '@polkadot/api/types';
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
type TMultiAsset = TMultiAssetV3 | TMultiAssetV4;
|
|
5
|
+
interface TMultiAssetV3 {
|
|
5
6
|
id: {
|
|
6
7
|
Concrete: TMultiLocation;
|
|
7
8
|
};
|
|
@@ -9,16 +10,28 @@ interface TMultiAsset {
|
|
|
9
10
|
Fungible: TAmount;
|
|
10
11
|
};
|
|
11
12
|
}
|
|
13
|
+
interface TMultiAssetV4 {
|
|
14
|
+
id: TMultiLocation;
|
|
15
|
+
fun: {
|
|
16
|
+
Fungible: TAmount;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
12
19
|
|
|
13
20
|
type Extrinsic = SubmittableExtrinsic<'promise'>;
|
|
14
21
|
interface PolkadotXCMTransferInput {
|
|
15
22
|
api: ApiPromise;
|
|
16
23
|
header: any;
|
|
17
24
|
addressSelection: any;
|
|
25
|
+
amount: string;
|
|
26
|
+
address: TAddress;
|
|
18
27
|
currencySelection: any;
|
|
19
28
|
scenario: TScenario;
|
|
20
29
|
currencySymbol: string | undefined;
|
|
30
|
+
currencyId: string | undefined;
|
|
31
|
+
destination?: TDestination;
|
|
32
|
+
paraIdTo?: number;
|
|
21
33
|
feeAsset?: TCurrency;
|
|
34
|
+
overridedCurrency?: TMultiLocation | TMultiAsset[];
|
|
22
35
|
serializedApiCallEnabled?: boolean;
|
|
23
36
|
}
|
|
24
37
|
interface XTokensTransferInput {
|
|
@@ -61,12 +74,14 @@ type TScenario = 'ParaToRelay' | 'ParaToPara' | 'RelayToPara';
|
|
|
61
74
|
declare enum Version {
|
|
62
75
|
V1 = "V1",
|
|
63
76
|
V2 = "V2",
|
|
64
|
-
V3 = "V3"
|
|
77
|
+
V3 = "V3",
|
|
78
|
+
V4 = "V4"
|
|
65
79
|
}
|
|
66
80
|
type TVersionClaimAssets = Version.V3 | Version.V2;
|
|
67
81
|
declare enum Parents {
|
|
82
|
+
ZERO = 0,
|
|
68
83
|
ONE = 1,
|
|
69
|
-
|
|
84
|
+
TWO = 2
|
|
70
85
|
}
|
|
71
86
|
type TAmount = string | number | bigint;
|
|
72
87
|
type TCurrency = string | number | bigint;
|
|
@@ -79,6 +94,7 @@ interface TSendBaseOptions {
|
|
|
79
94
|
paraIdTo?: number;
|
|
80
95
|
feeAsset?: TCurrency;
|
|
81
96
|
destApiForKeepAlive?: ApiPromise;
|
|
97
|
+
version?: Version;
|
|
82
98
|
}
|
|
83
99
|
interface TSendOptions extends TSendBaseOptions {
|
|
84
100
|
api?: ApiPromise;
|
|
@@ -102,6 +118,7 @@ interface TRelayToParaBaseOptions {
|
|
|
102
118
|
address: TAddress;
|
|
103
119
|
paraIdTo?: number;
|
|
104
120
|
destApiForKeepAlive?: ApiPromise;
|
|
121
|
+
version?: Version;
|
|
105
122
|
}
|
|
106
123
|
interface TRelayToParaOptions extends TRelayToParaBaseOptions {
|
|
107
124
|
api?: ApiPromise;
|
|
@@ -197,7 +214,7 @@ interface JunctionGlobalConsensus {
|
|
|
197
214
|
type TJunction = JunctionParachain | JunctionAccountId32 | JunctionAccountIndex64 | JunctionAccountKey20 | JunctionPalletInstance | JunctionGeneralIndex | JunctionGeneralKey | JunctionOnlyChild | JunctionPlurality | JunctionGlobalConsensus;
|
|
198
215
|
interface Junctions {
|
|
199
216
|
Here?: null;
|
|
200
|
-
X1?: TJunction;
|
|
217
|
+
X1?: TJunction | [TJunction];
|
|
201
218
|
X2?: [TJunction, TJunction];
|
|
202
219
|
X3?: [TJunction, TJunction, TJunction];
|
|
203
220
|
X4?: [TJunction, TJunction, TJunction, TJunction];
|
|
@@ -231,7 +248,7 @@ interface Junctions {
|
|
|
231
248
|
}
|
|
232
249
|
interface TMultiLocation {
|
|
233
250
|
parents: StringOrNumber;
|
|
234
|
-
interior: Junctions;
|
|
251
|
+
interior: Junctions | 'Here';
|
|
235
252
|
}
|
|
236
253
|
type TMultiLocationHeader = {
|
|
237
254
|
[key in Version]?: TMultiLocation;
|
|
@@ -249,16 +266,17 @@ declare abstract class ParachainNode {
|
|
|
249
266
|
get node(): TNode;
|
|
250
267
|
get version(): Version;
|
|
251
268
|
get assetCheckEnabled(): boolean;
|
|
269
|
+
protected canUseXTokens(_: TSendInternalOptions): boolean;
|
|
252
270
|
transfer(options: TSendInternalOptions): Extrinsic | TSerializedApiCall;
|
|
253
271
|
transferRelayToPara(options: TRelayToParaInternalOptions): TSerializedApiCall;
|
|
254
272
|
getProvider(): string;
|
|
255
273
|
createApiInstance(): Promise<ApiPromise>;
|
|
256
274
|
createCurrencySpec(amount: string, scenario: TScenario, version: Version, _?: string, overridedMultiLocation?: TMultiLocation | TMultiAsset[]): any;
|
|
257
|
-
createPolkadotXcmHeader(scenario: TScenario, destination?: TDestination, paraId?: number): any;
|
|
275
|
+
createPolkadotXcmHeader(scenario: TScenario, version: Version, destination?: TDestination, paraId?: number): any;
|
|
258
276
|
}
|
|
259
277
|
|
|
260
|
-
declare const NODE_NAMES: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "ComposableFinance", "Darwinia", "
|
|
261
|
-
declare const NODES_WITH_RELAY_CHAINS: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "ComposableFinance", "Darwinia", "
|
|
278
|
+
declare const NODE_NAMES: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "BridgeHubPolkadot", "BridgeHubKusama", "Centrifuge", "ComposableFinance", "Darwinia", "Hydration", "Interlay", "Litentry", "Moonbeam", "Parallel", "AssetHubKusama", "CoretimeKusama", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kintsugi", "Litmus", "Moonriver", "ParallelHeiko", "Picasso", "Quartz", "Robonomics", "Shiden", "Turing", "Unique", "Crust", "Manta", "Nodle", "NeuroWeb", "Pendulum", "Polkadex", "Zeitgeist", "Collectives", "Khala", "Phala", "Subsocial", "KiltSpiritnet", "Curio"];
|
|
279
|
+
declare const NODES_WITH_RELAY_CHAINS: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "BridgeHubPolkadot", "BridgeHubKusama", "Centrifuge", "ComposableFinance", "Darwinia", "Hydration", "Interlay", "Litentry", "Moonbeam", "Parallel", "AssetHubKusama", "CoretimeKusama", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kintsugi", "Litmus", "Moonriver", "ParallelHeiko", "Picasso", "Quartz", "Robonomics", "Shiden", "Turing", "Unique", "Crust", "Manta", "Nodle", "NeuroWeb", "Pendulum", "Polkadex", "Zeitgeist", "Collectives", "Khala", "Phala", "Subsocial", "KiltSpiritnet", "Curio", "Polkadot", "Kusama"];
|
|
262
280
|
declare const SUPPORTED_PALLETS: readonly ["XTokens", "OrmlXTokens", "PolkadotXcm", "RelayerXcm", "XTransfer"];
|
|
263
281
|
|
|
264
282
|
type TNode = (typeof NODE_NAMES)[number];
|
|
@@ -465,6 +483,7 @@ interface FinalBuilderAsync {
|
|
|
465
483
|
}
|
|
466
484
|
interface UseKeepAliveFinalBuilder {
|
|
467
485
|
useKeepAlive: (destApi: ApiPromise) => UseKeepAliveFinalBuilder;
|
|
486
|
+
xcmVersion: (version: Version) => UseKeepAliveFinalBuilder;
|
|
468
487
|
build: () => Promise<Extrinsic | never>;
|
|
469
488
|
buildSerializedApiCall: () => Promise<TSerializedApiCall>;
|
|
470
489
|
}
|
|
@@ -507,7 +526,7 @@ declare class NoXCMSupportImplementedError extends Error {
|
|
|
507
526
|
}
|
|
508
527
|
|
|
509
528
|
declare class ScenarioNotSupportedError extends Error {
|
|
510
|
-
constructor(node: TNode, scenario: TScenario);
|
|
529
|
+
constructor(node: TNode, scenario: TScenario, message?: string);
|
|
511
530
|
}
|
|
512
531
|
|
|
513
532
|
declare class IncompatibleNodesError extends Error {
|
|
@@ -516,4 +535,4 @@ declare class IncompatibleNodesError extends Error {
|
|
|
516
535
|
|
|
517
536
|
declare const getExistentialDeposit: (node: TNodeWithRelayChains) => string | null;
|
|
518
537
|
|
|
519
|
-
export { Builder, type CheckKeepAliveOptions, type Extrinsic, type IPolkadotXCMTransfer, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidCurrencyError, type JunctionType, NODES_WITH_RELAY_CHAINS, NODE_NAMES, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, type PolkadotXCMTransferInput, SUPPORTED_PALLETS, ScenarioNotSupportedError, type TAddress, type TAmount, type TAssetDetails, type TAssetJsonMap, type TCloseChannelInternalOptions, type TCloseChannelOptions, type TCurrency, type TCurrencyInput, type TCurrencySelection, type TCurrencySelectionHeader, type TCurrencySelectionHeaderArr, type TDestination, type TEdJsonMap, type TJunction, type TMultiAsset, type TMultiLocation, type TMultiLocationHeader, type TNativeAssetDetails, type TNode, type TNodeAssets, type TNodeToAssetModuleMap, type TNodeWithRelayChains, type TOpenChannelInternalOptions, type TOpenChannelOptions, type TPallet, type TPalletJsonMap, type TPalletMap, type TRelayChainSymbol, type TRelayChainType, type TRelayToParaCommonOptions, type TRelayToParaInternalOptions, type TRelayToParaOptions, type TScenario, type TSendBaseOptions, type TSendInternalOptions, type TSendOptions, type TSendOptionsCommon, type TSerializedApiCall, type TVersionClaimAssets, Version, type XTokensTransferInput, type XTransferTransferInput, index as assets, index$1 as closeChannels, createApiInstanceForNode, getAllAssetsSymbols, getAllNodeProviders, getAssetDecimals, getAssetId, getAssetsObject, getBalanceForeign, getBalanceNative, getDefaultPallet, getExistentialDeposit, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedPallets, getTNode, getTransferInfo, hasSupportForAsset, index$2 as openChannels, index$3 as xcmPallet };
|
|
538
|
+
export { Builder, type CheckKeepAliveOptions, type Extrinsic, type IPolkadotXCMTransfer, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidCurrencyError, type JunctionType, type Junctions, NODES_WITH_RELAY_CHAINS, NODE_NAMES, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, type PolkadotXCMTransferInput, SUPPORTED_PALLETS, ScenarioNotSupportedError, type TAddress, type TAmount, type TAssetDetails, type TAssetJsonMap, type TCloseChannelInternalOptions, type TCloseChannelOptions, type TCurrency, type TCurrencyInput, type TCurrencySelection, type TCurrencySelectionHeader, type TCurrencySelectionHeaderArr, type TDestination, type TEdJsonMap, type TJunction, type TMultiAsset, type TMultiAssetV3, type TMultiAssetV4, type TMultiLocation, type TMultiLocationHeader, type TNativeAssetDetails, type TNode, type TNodeAssets, type TNodeToAssetModuleMap, type TNodeWithRelayChains, type TOpenChannelInternalOptions, type TOpenChannelOptions, type TPallet, type TPalletJsonMap, type TPalletMap, type TRelayChainSymbol, type TRelayChainType, type TRelayToParaCommonOptions, type TRelayToParaInternalOptions, type TRelayToParaOptions, type TScenario, type TSendBaseOptions, type TSendInternalOptions, type TSendOptions, type TSendOptionsCommon, type TSerializedApiCall, type TVersionClaimAssets, Version, type XTokensTransferInput, type XTransferTransferInput, index as assets, index$1 as closeChannels, createApiInstanceForNode, getAllAssetsSymbols, getAllNodeProviders, getAssetDecimals, getAssetId, getAssetsObject, getBalanceForeign, getBalanceNative, getDefaultPallet, getExistentialDeposit, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedPallets, getTNode, getTransferInfo, hasSupportForAsset, index$2 as openChannels, index$3 as xcmPallet };
|