@paraspell/sdk 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/dist/index.cjs +306 -114
- package/dist/index.d.ts +103 -18
- package/dist/index.mjs +306 -114
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,85 @@
|
|
|
1
1
|
import { ApiPromise } from '@polkadot/api';
|
|
2
2
|
import { SubmittableExtrinsic } from '@polkadot/api/types';
|
|
3
3
|
|
|
4
|
+
type NetworkId = string | null;
|
|
5
|
+
type BodyId = string | null;
|
|
6
|
+
type BodyPart = string | null;
|
|
7
|
+
type StringOrNumber = string | number;
|
|
8
|
+
type HexString = string;
|
|
9
|
+
interface JunctionParachain {
|
|
10
|
+
Parachain: StringOrNumber;
|
|
11
|
+
}
|
|
12
|
+
interface JunctionAccountId32 {
|
|
13
|
+
AccountId32: {
|
|
14
|
+
network: NetworkId;
|
|
15
|
+
id: HexString;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
interface JunctionAccountIndex64 {
|
|
19
|
+
AccountIndex64: {
|
|
20
|
+
network: NetworkId;
|
|
21
|
+
index: StringOrNumber;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
interface JunctionAccountKey20 {
|
|
25
|
+
AccountKey20: {
|
|
26
|
+
network: NetworkId;
|
|
27
|
+
key: HexString;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
interface JunctionPalletInstance {
|
|
31
|
+
PalletInstance: StringOrNumber;
|
|
32
|
+
}
|
|
33
|
+
interface JunctionGeneralIndex {
|
|
34
|
+
GeneralIndex: StringOrNumber;
|
|
35
|
+
}
|
|
36
|
+
interface JunctionGeneralKey {
|
|
37
|
+
GeneralKey: {
|
|
38
|
+
length: StringOrNumber;
|
|
39
|
+
data: HexString;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
interface JunctionOnlyChild {
|
|
43
|
+
OnlyChild: string;
|
|
44
|
+
}
|
|
45
|
+
interface JunctionPlurality {
|
|
46
|
+
Plurality: {
|
|
47
|
+
id: BodyId;
|
|
48
|
+
part: BodyPart;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
interface JunctionGlobalConsensus {
|
|
52
|
+
GlobalConsensus: NetworkId;
|
|
53
|
+
}
|
|
54
|
+
type Junction = JunctionParachain | JunctionAccountId32 | JunctionAccountIndex64 | JunctionAccountKey20 | JunctionPalletInstance | JunctionGeneralIndex | JunctionGeneralKey | JunctionOnlyChild | JunctionPlurality | JunctionGlobalConsensus;
|
|
55
|
+
interface Junctions {
|
|
56
|
+
X1?: Junction;
|
|
57
|
+
X2?: [Junction, Junction];
|
|
58
|
+
X3?: [Junction, Junction, Junction];
|
|
59
|
+
X4?: [Junction, Junction, Junction, Junction];
|
|
60
|
+
X5?: [Junction, Junction, Junction, Junction, Junction];
|
|
61
|
+
X6?: [Junction, Junction, Junction, Junction, Junction, Junction];
|
|
62
|
+
X7?: [Junction, Junction, Junction, Junction, Junction, Junction, Junction];
|
|
63
|
+
X8?: [Junction, Junction, Junction, Junction, Junction, Junction, Junction, Junction];
|
|
64
|
+
X9?: [Junction, Junction, Junction, Junction, Junction, Junction, Junction, Junction, Junction];
|
|
65
|
+
X10?: [
|
|
66
|
+
Junction,
|
|
67
|
+
Junction,
|
|
68
|
+
Junction,
|
|
69
|
+
Junction,
|
|
70
|
+
Junction,
|
|
71
|
+
Junction,
|
|
72
|
+
Junction,
|
|
73
|
+
Junction,
|
|
74
|
+
Junction,
|
|
75
|
+
Junction
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
interface TMultiLocation {
|
|
79
|
+
parents: StringOrNumber;
|
|
80
|
+
interior: Junctions;
|
|
81
|
+
}
|
|
82
|
+
|
|
4
83
|
declare abstract class ParachainNode {
|
|
5
84
|
private readonly _node;
|
|
6
85
|
private readonly _name;
|
|
@@ -17,8 +96,8 @@ declare abstract class ParachainNode {
|
|
|
17
96
|
transferRelayToPara(options: TRelayToParaInternalOptions): TSerializedApiCall;
|
|
18
97
|
getProvider(): string;
|
|
19
98
|
createApiInstance(): Promise<ApiPromise>;
|
|
20
|
-
createCurrencySpec(amount: string, scenario: TScenario, version: Version, currencyId?: string): any;
|
|
21
|
-
createPolkadotXcmHeader(scenario: TScenario, paraId?: number): any;
|
|
99
|
+
createCurrencySpec(amount: string, scenario: TScenario, version: Version, currencyId?: string, overridedMultiLocation?: TMultiLocation): any;
|
|
100
|
+
createPolkadotXcmHeader(scenario: TScenario, destination?: TDestination, paraId?: number): any;
|
|
22
101
|
}
|
|
23
102
|
|
|
24
103
|
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"];
|
|
@@ -72,8 +151,9 @@ interface XTokensTransferInput {
|
|
|
72
151
|
fees: number;
|
|
73
152
|
scenario: TScenario;
|
|
74
153
|
origin: TNode;
|
|
75
|
-
destination?:
|
|
154
|
+
destination?: TDestination;
|
|
76
155
|
paraIdTo?: number;
|
|
156
|
+
overridedCurrencyMultiLocation?: TMultiLocation;
|
|
77
157
|
serializedApiCallEnabled?: boolean;
|
|
78
158
|
}
|
|
79
159
|
interface XTransferTransferInput {
|
|
@@ -81,10 +161,11 @@ interface XTransferTransferInput {
|
|
|
81
161
|
currency: string | undefined;
|
|
82
162
|
currencyID: string | undefined;
|
|
83
163
|
amount: string;
|
|
84
|
-
recipientAddress:
|
|
164
|
+
recipientAddress: TAddress;
|
|
85
165
|
origin: TNode;
|
|
86
166
|
paraId?: number;
|
|
87
|
-
destination?:
|
|
167
|
+
destination?: TDestination;
|
|
168
|
+
overridedCurrencyMultiLocation?: TMultiLocation;
|
|
88
169
|
serializedApiCallEnabled?: boolean;
|
|
89
170
|
}
|
|
90
171
|
interface IXTokensTransfer {
|
|
@@ -103,16 +184,19 @@ interface PolkadotXCMTransferInput {
|
|
|
103
184
|
serializedApiCallEnabled?: boolean;
|
|
104
185
|
}
|
|
105
186
|
type TAmount = string | number | bigint;
|
|
187
|
+
type TCurrency = string | number | bigint | TMultiLocation;
|
|
188
|
+
type TAddress = string | TMultiLocation;
|
|
189
|
+
type TDestination = TNode | TMultiLocation;
|
|
106
190
|
interface TSendBaseOptions {
|
|
107
|
-
address:
|
|
108
|
-
destination?:
|
|
191
|
+
address: TAddress;
|
|
192
|
+
destination?: TDestination;
|
|
109
193
|
paraIdTo?: number;
|
|
110
194
|
destApiForKeepAlive?: ApiPromise;
|
|
111
195
|
}
|
|
112
196
|
interface TSendOptions extends TSendBaseOptions {
|
|
113
197
|
api?: ApiPromise;
|
|
114
198
|
origin: TNode;
|
|
115
|
-
currency:
|
|
199
|
+
currency: TCurrency;
|
|
116
200
|
amount: TAmount;
|
|
117
201
|
}
|
|
118
202
|
interface TSendOptionsCommon extends TSendOptions {
|
|
@@ -123,11 +207,12 @@ interface TSendInternalOptions extends TSendBaseOptions {
|
|
|
123
207
|
currencySymbol: string | undefined;
|
|
124
208
|
currencyId: string | undefined;
|
|
125
209
|
amount: string;
|
|
210
|
+
overridedCurrencyMultiLocation?: TMultiLocation;
|
|
126
211
|
serializedApiCallEnabled?: boolean;
|
|
127
212
|
}
|
|
128
213
|
interface TRelayToParaBaseOptions {
|
|
129
|
-
destination:
|
|
130
|
-
address:
|
|
214
|
+
destination: TDestination;
|
|
215
|
+
address: TAddress;
|
|
131
216
|
paraIdTo?: number;
|
|
132
217
|
destApiForKeepAlive?: ApiPromise;
|
|
133
218
|
}
|
|
@@ -268,23 +353,23 @@ declare class ToGeneralBuilder {
|
|
|
268
353
|
private readonly from;
|
|
269
354
|
private readonly to;
|
|
270
355
|
private readonly paraIdTo?;
|
|
271
|
-
constructor(api: ApiPromise | undefined, from: TNode, to:
|
|
272
|
-
currency(currency:
|
|
356
|
+
constructor(api: ApiPromise | undefined, from: TNode, to: TDestination, paraIdTo?: number);
|
|
357
|
+
currency(currency: TCurrency): AmountBuilder;
|
|
273
358
|
openChannel(): MaxSizeOpenChannelBuilder;
|
|
274
359
|
}
|
|
275
360
|
declare class FromGeneralBuilder {
|
|
276
361
|
private readonly api?;
|
|
277
362
|
private readonly from;
|
|
278
363
|
constructor(api: ApiPromise | undefined, from: TNode);
|
|
279
|
-
to(node:
|
|
280
|
-
amount(amount:
|
|
364
|
+
to(node: TDestination, paraIdTo?: number): ToGeneralBuilder;
|
|
365
|
+
amount(amount: TAmount): AddressBuilder;
|
|
281
366
|
closeChannel(): InboundCloseChannelBuilder;
|
|
282
367
|
}
|
|
283
368
|
declare class GeneralBuilder {
|
|
284
369
|
private readonly api?;
|
|
285
370
|
constructor(api?: ApiPromise);
|
|
286
371
|
from(node: TNode): FromGeneralBuilder;
|
|
287
|
-
to(node:
|
|
372
|
+
to(node: TDestination, paraIdTo?: number): AmountBuilder;
|
|
288
373
|
}
|
|
289
374
|
declare const Builder: (api?: ApiPromise) => GeneralBuilder;
|
|
290
375
|
interface FinalBuilder {
|
|
@@ -297,10 +382,10 @@ interface UseKeepAliveFinalBuilder {
|
|
|
297
382
|
buildSerializedApiCall: () => Promise<TSerializedApiCall>;
|
|
298
383
|
}
|
|
299
384
|
interface AddressBuilder {
|
|
300
|
-
address: (address:
|
|
385
|
+
address: (address: TAddress) => UseKeepAliveFinalBuilder;
|
|
301
386
|
}
|
|
302
387
|
interface AmountBuilder {
|
|
303
|
-
amount: (amount:
|
|
388
|
+
amount: (amount: TAmount) => AddressBuilder;
|
|
304
389
|
}
|
|
305
390
|
|
|
306
391
|
declare const getNode: (node: TNode) => ParachainNode;
|
|
@@ -331,4 +416,4 @@ declare class IncompatibleNodesError extends Error {
|
|
|
331
416
|
|
|
332
417
|
declare const getExistentialDeposit: (node: TNodeWithRelayChains) => string | null;
|
|
333
418
|
|
|
334
|
-
export { Builder, type CheckKeepAliveOptions, type Extrinsic, type ExtrinsicFunction, type IPolkadotXCMTransfer, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODE_NAMES, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, type PolkadotXCMHeader, type PolkadotXCMTransferInput, SUPPORTED_PALLETS, ScenarioNotSupportedError, type TAmount, type TAssetDetails, type TAssetJsonMap, type TCloseChannelInternalOptions, type TCloseChannelOptions, type TEdJsonMap, type TNativeAssetDetails, type TNode, type TNodeAssets, 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 UpdateFunction, 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 };
|
|
419
|
+
export { Builder, type CheckKeepAliveOptions, type Extrinsic, type ExtrinsicFunction, type IPolkadotXCMTransfer, type IXTokensTransfer, type IXTransferTransfer, IncompatibleNodesError, InvalidCurrencyError, NODES_WITH_RELAY_CHAINS, NODE_NAMES, NoXCMSupportImplementedError, NodeNotSupportedError, Parents, type PolkadotXCMHeader, type PolkadotXCMTransferInput, SUPPORTED_PALLETS, ScenarioNotSupportedError, type TAddress, type TAmount, type TAssetDetails, type TAssetJsonMap, type TCloseChannelInternalOptions, type TCloseChannelOptions, type TCurrency, type TDestination, type TEdJsonMap, type TNativeAssetDetails, type TNode, type TNodeAssets, 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 UpdateFunction, 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 };
|