@paraspell/sdk 5.2.1 → 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 +22 -11
- package/dist/index.cjs +343 -45
- package/dist/index.d.ts +37 -12
- package/dist/index.mjs +343 -45
- package/package.json +1 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { ApiPromise } from '@polkadot/api';
|
|
2
2
|
import { SubmittableExtrinsic } from '@polkadot/api/types';
|
|
3
3
|
|
|
4
|
+
interface TMultiAsset {
|
|
5
|
+
id: {
|
|
6
|
+
Concrete: TMultiLocation;
|
|
7
|
+
};
|
|
8
|
+
fun: {
|
|
9
|
+
Fungible: TAmount;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
4
13
|
type Extrinsic = SubmittableExtrinsic<'promise'>;
|
|
5
14
|
interface PolkadotXCMTransferInput {
|
|
6
15
|
api: ApiPromise;
|
|
@@ -23,7 +32,7 @@ interface XTokensTransferInput {
|
|
|
23
32
|
origin: TNode;
|
|
24
33
|
destination?: TDestination;
|
|
25
34
|
paraIdTo?: number;
|
|
26
|
-
overridedCurrencyMultiLocation?: TMultiLocation;
|
|
35
|
+
overridedCurrencyMultiLocation?: TMultiLocation | TMultiAsset[];
|
|
27
36
|
feeAsset?: TCurrency;
|
|
28
37
|
serializedApiCallEnabled?: boolean;
|
|
29
38
|
}
|
|
@@ -36,7 +45,7 @@ interface XTransferTransferInput {
|
|
|
36
45
|
origin: TNode;
|
|
37
46
|
paraId?: number;
|
|
38
47
|
destination?: TDestination;
|
|
39
|
-
overridedCurrencyMultiLocation?: TMultiLocation;
|
|
48
|
+
overridedCurrencyMultiLocation?: TMultiLocation | TMultiAsset[];
|
|
40
49
|
serializedApiCallEnabled?: boolean;
|
|
41
50
|
}
|
|
42
51
|
interface IPolkadotXCMTransfer {
|
|
@@ -54,13 +63,14 @@ declare enum Version {
|
|
|
54
63
|
V2 = "V2",
|
|
55
64
|
V3 = "V3"
|
|
56
65
|
}
|
|
66
|
+
type TVersionClaimAssets = Version.V3 | Version.V2;
|
|
57
67
|
declare enum Parents {
|
|
58
68
|
ONE = 1,
|
|
59
69
|
ZERO = 0
|
|
60
70
|
}
|
|
61
71
|
type TAmount = string | number | bigint;
|
|
62
72
|
type TCurrency = string | number | bigint;
|
|
63
|
-
type TCurrencyInput = string | number | bigint | TMultiLocation;
|
|
73
|
+
type TCurrencyInput = string | number | bigint | TMultiLocation | TMultiAsset[];
|
|
64
74
|
type TAddress = string | TMultiLocation;
|
|
65
75
|
type TDestination = TNode | TMultiLocation;
|
|
66
76
|
interface TSendBaseOptions {
|
|
@@ -74,7 +84,7 @@ interface TSendOptions extends TSendBaseOptions {
|
|
|
74
84
|
api?: ApiPromise;
|
|
75
85
|
origin: TNode;
|
|
76
86
|
currency: TCurrencyInput;
|
|
77
|
-
amount: TAmount;
|
|
87
|
+
amount: TAmount | null;
|
|
78
88
|
}
|
|
79
89
|
interface TSendOptionsCommon extends TSendOptions {
|
|
80
90
|
serializedApiCallEnabled?: boolean;
|
|
@@ -84,7 +94,7 @@ interface TSendInternalOptions extends TSendBaseOptions {
|
|
|
84
94
|
currencySymbol: string | undefined;
|
|
85
95
|
currencyId: string | undefined;
|
|
86
96
|
amount: string;
|
|
87
|
-
overridedCurrencyMultiLocation?: TMultiLocation;
|
|
97
|
+
overridedCurrencyMultiLocation?: TMultiLocation | TMultiAsset[];
|
|
88
98
|
serializedApiCallEnabled?: boolean;
|
|
89
99
|
}
|
|
90
100
|
interface TRelayToParaBaseOptions {
|
|
@@ -186,6 +196,7 @@ interface JunctionGlobalConsensus {
|
|
|
186
196
|
}
|
|
187
197
|
type TJunction = JunctionParachain | JunctionAccountId32 | JunctionAccountIndex64 | JunctionAccountKey20 | JunctionPalletInstance | JunctionGeneralIndex | JunctionGeneralKey | JunctionOnlyChild | JunctionPlurality | JunctionGlobalConsensus;
|
|
188
198
|
interface Junctions {
|
|
199
|
+
Here?: null;
|
|
189
200
|
X1?: TJunction;
|
|
190
201
|
X2?: [TJunction, TJunction];
|
|
191
202
|
X3?: [TJunction, TJunction, TJunction];
|
|
@@ -242,12 +253,12 @@ declare abstract class ParachainNode {
|
|
|
242
253
|
transferRelayToPara(options: TRelayToParaInternalOptions): TSerializedApiCall;
|
|
243
254
|
getProvider(): string;
|
|
244
255
|
createApiInstance(): Promise<ApiPromise>;
|
|
245
|
-
createCurrencySpec(amount: string, scenario: TScenario, version: Version, _?: string, overridedMultiLocation?: TMultiLocation): any;
|
|
256
|
+
createCurrencySpec(amount: string, scenario: TScenario, version: Version, _?: string, overridedMultiLocation?: TMultiLocation | TMultiAsset[]): any;
|
|
246
257
|
createPolkadotXcmHeader(scenario: TScenario, destination?: TDestination, paraId?: number): any;
|
|
247
258
|
}
|
|
248
259
|
|
|
249
|
-
declare const NODE_NAMES: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "ComposableFinance", "Darwinia", "HydraDX", "Interlay", "Litentry", "Moonbeam", "Parallel", "AssetHubKusama", "CoretimeKusama", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kintsugi", "Litmus", "Mangata", "Moonriver", "ParallelHeiko", "Picasso", "Quartz", "Robonomics", "Shiden", "Turing", "Unique", "Crust", "Manta", "Nodle", "NeuroWeb", "Pendulum", "Polkadex", "Zeitgeist", "Collectives", "Khala", "Phala", "Subsocial", "KiltSpiritnet"];
|
|
250
|
-
declare const NODES_WITH_RELAY_CHAINS: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "ComposableFinance", "Darwinia", "HydraDX", "Interlay", "Litentry", "Moonbeam", "Parallel", "AssetHubKusama", "CoretimeKusama", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kintsugi", "Litmus", "Mangata", "Moonriver", "ParallelHeiko", "Picasso", "Quartz", "Robonomics", "Shiden", "Turing", "Unique", "Crust", "Manta", "Nodle", "NeuroWeb", "Pendulum", "Polkadex", "Zeitgeist", "Collectives", "Khala", "Phala", "Subsocial", "KiltSpiritnet", "Polkadot", "Kusama"];
|
|
260
|
+
declare const NODE_NAMES: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "ComposableFinance", "Darwinia", "HydraDX", "Interlay", "Litentry", "Moonbeam", "Parallel", "AssetHubKusama", "CoretimeKusama", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kintsugi", "Litmus", "Mangata", "Moonriver", "ParallelHeiko", "Picasso", "Quartz", "Robonomics", "Shiden", "Turing", "Unique", "Crust", "Manta", "Nodle", "NeuroWeb", "Pendulum", "Polkadex", "Zeitgeist", "Collectives", "Khala", "Phala", "Subsocial", "KiltSpiritnet", "Curio"];
|
|
261
|
+
declare const NODES_WITH_RELAY_CHAINS: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "ComposableFinance", "Darwinia", "HydraDX", "Interlay", "Litentry", "Moonbeam", "Parallel", "AssetHubKusama", "CoretimeKusama", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kintsugi", "Litmus", "Mangata", "Moonriver", "ParallelHeiko", "Picasso", "Quartz", "Robonomics", "Shiden", "Turing", "Unique", "Crust", "Manta", "Nodle", "NeuroWeb", "Pendulum", "Polkadex", "Zeitgeist", "Collectives", "Khala", "Phala", "Subsocial", "KiltSpiritnet", "Curio", "Polkadot", "Kusama"];
|
|
251
262
|
declare const SUPPORTED_PALLETS: readonly ["XTokens", "OrmlXTokens", "PolkadotXcm", "RelayerXcm", "XTransfer"];
|
|
252
263
|
|
|
253
264
|
type TNode = (typeof NODE_NAMES)[number];
|
|
@@ -396,7 +407,7 @@ declare class FromGeneralBuilder {
|
|
|
396
407
|
constructor(api: ApiPromise | undefined, from: TNode);
|
|
397
408
|
to(node: TDestination, paraIdTo?: number): ToGeneralBuilder;
|
|
398
409
|
feeAsset(feeAsset: TCurrency): AmountBuilder;
|
|
399
|
-
amount(amount: TAmount): AddressBuilder;
|
|
410
|
+
amount(amount: TAmount | null): AddressBuilder;
|
|
400
411
|
closeChannel(): InboundCloseChannelBuilder;
|
|
401
412
|
}
|
|
402
413
|
declare class GeneralBuilder {
|
|
@@ -404,12 +415,17 @@ declare class GeneralBuilder {
|
|
|
404
415
|
constructor(api?: ApiPromise);
|
|
405
416
|
from(node: TNode): FromGeneralBuilder;
|
|
406
417
|
to(node: TDestination, paraIdTo?: number): AmountBuilder;
|
|
418
|
+
claimFrom(node: TNodeWithRelayChains): FungibleBuilder;
|
|
407
419
|
}
|
|
408
420
|
declare const Builder: (api?: ApiPromise) => GeneralBuilder;
|
|
409
421
|
interface FinalBuilder {
|
|
410
422
|
build: () => Extrinsic | never;
|
|
411
423
|
buildSerializedApiCall: () => TSerializedApiCall;
|
|
412
424
|
}
|
|
425
|
+
interface FinalBuilderAsync {
|
|
426
|
+
build: () => Promise<Extrinsic | never>;
|
|
427
|
+
buildSerializedApiCall: () => Promise<TSerializedApiCall>;
|
|
428
|
+
}
|
|
413
429
|
interface UseKeepAliveFinalBuilder {
|
|
414
430
|
useKeepAlive: (destApi: ApiPromise) => UseKeepAliveFinalBuilder;
|
|
415
431
|
build: () => Promise<Extrinsic | never>;
|
|
@@ -419,12 +435,21 @@ interface AddressBuilder {
|
|
|
419
435
|
address: (address: TAddress) => UseKeepAliveFinalBuilder;
|
|
420
436
|
}
|
|
421
437
|
interface AmountBuilder {
|
|
422
|
-
amount: (amount: TAmount) => AddressBuilder;
|
|
438
|
+
amount: (amount: TAmount | null) => AddressBuilder;
|
|
423
439
|
}
|
|
424
440
|
interface AmountOrFeeAssetBuilder {
|
|
425
|
-
amount: (amount: TAmount) => AddressBuilder;
|
|
441
|
+
amount: (amount: TAmount | null) => AddressBuilder;
|
|
426
442
|
feeAsset: (feeAsset: TCurrencyInput) => AmountBuilder;
|
|
427
443
|
}
|
|
444
|
+
interface FungibleBuilder {
|
|
445
|
+
fungible: (multiAssets: TMultiAsset[]) => AccountBuilder;
|
|
446
|
+
}
|
|
447
|
+
interface AccountBuilder {
|
|
448
|
+
account: (address: TAddress) => VersionBuilder;
|
|
449
|
+
}
|
|
450
|
+
interface VersionBuilder extends FinalBuilderAsync {
|
|
451
|
+
xcmVersion: (version: TVersionClaimAssets) => FinalBuilderAsync;
|
|
452
|
+
}
|
|
428
453
|
|
|
429
454
|
declare const getNode: (node: TNode) => ParachainNode;
|
|
430
455
|
declare const getNodeEndpointOption: (node: TNode) => any;
|
|
@@ -454,4 +479,4 @@ declare class IncompatibleNodesError extends Error {
|
|
|
454
479
|
|
|
455
480
|
declare const getExistentialDeposit: (node: TNodeWithRelayChains) => string | null;
|
|
456
481
|
|
|
457
|
-
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 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, Version, type XTokensTransferInput, type XTransferTransferInput, index as assets, index$1 as closeChannels, createApiInstanceForNode, getAllAssetsSymbols, getAllNodeProviders, getAssetDecimals, getAssetId, getAssetsObject, getDefaultPallet, getExistentialDeposit, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedPallets, getTNode, hasSupportForAsset, index$2 as openChannels, index$3 as xcmPallet };
|
|
482
|
+
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, getDefaultPallet, getExistentialDeposit, getNativeAssets, getNode, getNodeEndpointOption, getNodeProvider, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedPallets, getTNode, hasSupportForAsset, index$2 as openChannels, index$3 as xcmPallet };
|