@paraspell/sdk 3.0.11 → 4.0.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 +34 -55
- package/dist/index.cjs +1865 -703
- package/dist/index.d.ts +72 -29
- package/dist/index.mjs +1862 -701
- package/package.json +7 -6
package/dist/index.d.ts
CHANGED
|
@@ -18,11 +18,12 @@ declare abstract class ParachainNode {
|
|
|
18
18
|
getProvider(): string;
|
|
19
19
|
createApiInstance(): Promise<ApiPromise>;
|
|
20
20
|
createCurrencySpec(amount: string, scenario: TScenario, version: Version, currencyId?: string): any;
|
|
21
|
+
createPolkadotXcmHeader(scenario: TScenario, paraId?: number): any;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
declare const NODE_NAMES: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "Clover", "ComposableFinance", "Darwinia", "HydraDX", "Interlay", "Litentry", "Moonbeam", "Parallel", "AssetHubKusama", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kintsugi", "Litmus", "Mangata", "Moonriver", "ParallelHeiko", "Picasso", "Quartz", "Robonomics", "Shiden", "Turing", "Equilibrium", "Unique", "Crust", "Manta", "Genshiro", "Nodle", "OriginTrail", "Pendulum", "Polkadex", "Zeitgeist"];
|
|
24
|
-
declare const NODES_WITH_RELAY_CHAINS: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "Clover", "ComposableFinance", "Darwinia", "HydraDX", "Interlay", "Litentry", "Moonbeam", "Parallel", "AssetHubKusama", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kintsugi", "Litmus", "Mangata", "Moonriver", "ParallelHeiko", "Picasso", "Quartz", "Robonomics", "Shiden", "Turing", "Equilibrium", "Unique", "Crust", "Manta", "Genshiro", "Nodle", "OriginTrail", "Pendulum", "Polkadex", "Zeitgeist", "Polkadot", "Kusama"];
|
|
25
|
-
declare const SUPPORTED_PALLETS: readonly ["XTokens", "OrmlXTokens", "PolkadotXcm", "RelayerXcm"];
|
|
24
|
+
declare const NODE_NAMES: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "Clover", "ComposableFinance", "Darwinia", "HydraDX", "Interlay", "Litentry", "Moonbeam", "Parallel", "AssetHubKusama", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kintsugi", "Litmus", "Mangata", "Moonriver", "ParallelHeiko", "Picasso", "Quartz", "Robonomics", "Shiden", "Turing", "Equilibrium", "Unique", "Crust", "Manta", "Genshiro", "Nodle", "OriginTrail", "Pendulum", "Polkadex", "Zeitgeist", "Collectives", "Khala", "Phala"];
|
|
25
|
+
declare const NODES_WITH_RELAY_CHAINS: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "Clover", "ComposableFinance", "Darwinia", "HydraDX", "Interlay", "Litentry", "Moonbeam", "Parallel", "AssetHubKusama", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kintsugi", "Litmus", "Mangata", "Moonriver", "ParallelHeiko", "Picasso", "Quartz", "Robonomics", "Shiden", "Turing", "Equilibrium", "Unique", "Crust", "Manta", "Genshiro", "Nodle", "OriginTrail", "Pendulum", "Polkadex", "Zeitgeist", "Collectives", "Khala", "Phala", "Polkadot", "Kusama"];
|
|
26
|
+
declare const SUPPORTED_PALLETS: readonly ["XTokens", "OrmlXTokens", "PolkadotXcm", "RelayerXcm", "XTransfer"];
|
|
26
27
|
|
|
27
28
|
type UpdateFunction = (name: string, index: number) => string;
|
|
28
29
|
type Extrinsic = SubmittableExtrinsic<'promise'>;
|
|
@@ -44,6 +45,7 @@ interface TNativeAssetDetails {
|
|
|
44
45
|
interface TNodeAssets {
|
|
45
46
|
paraId: number;
|
|
46
47
|
relayChainAssetSymbol: TRelayChainSymbol;
|
|
48
|
+
nativeAssetSymbol: string;
|
|
47
49
|
nativeAssets: TNativeAssetDetails[];
|
|
48
50
|
otherAssets: TAssetDetails[];
|
|
49
51
|
}
|
|
@@ -56,6 +58,7 @@ interface TPalletMap {
|
|
|
56
58
|
supportedPallets: TPallet[];
|
|
57
59
|
}
|
|
58
60
|
type TPalletJsonMap = Record<TNode, TPalletMap>;
|
|
61
|
+
type TEdJsonMap = Record<TNodeWithRelayChains, string | null>;
|
|
59
62
|
interface TSerializedApiCall {
|
|
60
63
|
module: string;
|
|
61
64
|
section: string;
|
|
@@ -69,11 +72,28 @@ interface XTokensTransferInput {
|
|
|
69
72
|
addressSelection: any;
|
|
70
73
|
fees: number;
|
|
71
74
|
scenario: TScenario;
|
|
75
|
+
origin: TNode;
|
|
76
|
+
destination?: TNode;
|
|
77
|
+
paraIdTo?: number;
|
|
78
|
+
serializedApiCallEnabled?: boolean;
|
|
79
|
+
}
|
|
80
|
+
interface XTransferTransferInput {
|
|
81
|
+
api: ApiPromise;
|
|
82
|
+
currency: string | undefined;
|
|
83
|
+
currencyID: string | undefined;
|
|
84
|
+
amount: string;
|
|
85
|
+
recipientAddress: string;
|
|
86
|
+
origin: TNode;
|
|
87
|
+
paraId?: number;
|
|
88
|
+
destination?: TNode;
|
|
72
89
|
serializedApiCallEnabled?: boolean;
|
|
73
90
|
}
|
|
74
91
|
interface IXTokensTransfer {
|
|
75
92
|
transferXTokens: (input: XTokensTransferInput) => Extrinsic | TSerializedApiCall;
|
|
76
93
|
}
|
|
94
|
+
interface IXTransferTransfer {
|
|
95
|
+
transferXTransfer: (input: XTransferTransferInput) => Extrinsic | TSerializedApiCall;
|
|
96
|
+
}
|
|
77
97
|
interface PolkadotXCMTransferInput {
|
|
78
98
|
api: ApiPromise;
|
|
79
99
|
header: any;
|
|
@@ -89,6 +109,7 @@ interface TTransferRelayToParaOptions {
|
|
|
89
109
|
address: string;
|
|
90
110
|
amount: string;
|
|
91
111
|
paraIdTo?: number;
|
|
112
|
+
destApiForKeepAlive?: ApiPromise;
|
|
92
113
|
}
|
|
93
114
|
interface IPolkadotXCMTransfer {
|
|
94
115
|
transferPolkadotXCM: (input: PolkadotXCMTransferInput) => Extrinsic | TSerializedApiCall;
|
|
@@ -101,12 +122,27 @@ declare enum Parents {
|
|
|
101
122
|
ONE = 1,
|
|
102
123
|
ZERO = 0
|
|
103
124
|
}
|
|
125
|
+
type PolkadotXCMHeader = {
|
|
126
|
+
[K in Version]?: {
|
|
127
|
+
parents: Parents;
|
|
128
|
+
interior: any;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
interface CheckKeepAliveOptions {
|
|
132
|
+
originApi: ApiPromise;
|
|
133
|
+
address: string;
|
|
134
|
+
amount: string;
|
|
135
|
+
originNode?: TNode;
|
|
136
|
+
destApi?: ApiPromise;
|
|
137
|
+
currencySymbol?: string;
|
|
138
|
+
destNode?: TNode;
|
|
139
|
+
}
|
|
104
140
|
|
|
105
|
-
declare const sendSerializedApiCall: (api: ApiPromise, origin: TNode, currencySymbolOrId: string | number | bigint, amount: string | number | bigint, to: string, destination?: TNode, paraIdTo?: number) => TSerializedApiCall
|
|
106
|
-
declare
|
|
107
|
-
declare const transferRelayToParaCommon: (api: ApiPromise, destination: TNode, amount: string, address: string, paraIdTo?: number, serializedApiCallEnabled?: boolean) => Extrinsic | TSerializedApiCall | never
|
|
108
|
-
declare
|
|
109
|
-
declare const transferRelayToParaSerializedApiCall: (api: ApiPromise, destination: TNode, amount: string | number | bigint, to: string, paraIdTo?: number) => TSerializedApiCall
|
|
141
|
+
declare const sendSerializedApiCall: (api: ApiPromise | undefined, origin: TNode, currencySymbolOrId: string | number | bigint, amount: string | number | bigint, to: string, destination?: TNode, paraIdTo?: number, destApiForKeepAlive?: ApiPromise) => Promise<TSerializedApiCall>;
|
|
142
|
+
declare const send: (api: ApiPromise | undefined, origin: TNode, currencySymbolOrId: string | number | bigint, amount: string | number | bigint, to: string, destination?: TNode, paraIdTo?: number, destApiForKeepAlive?: ApiPromise) => Promise<Extrinsic>;
|
|
143
|
+
declare const transferRelayToParaCommon: (api: ApiPromise | undefined, destination: TNode, amount: string, address: string, paraIdTo?: number, destApiForKeepAlive?: ApiPromise, serializedApiCallEnabled?: boolean) => Promise<Extrinsic | TSerializedApiCall | never>;
|
|
144
|
+
declare const transferRelayToPara: (api: ApiPromise | undefined, destination: TNode, amount: string | number | bigint, to: string, paraIdTo?: number, destApiForKeepAlive?: ApiPromise) => Promise<Extrinsic | never>;
|
|
145
|
+
declare const transferRelayToParaSerializedApiCall: (api: ApiPromise | undefined, destination: TNode, amount: string | number | bigint, to: string, paraIdTo?: number, destApiForKeepAlive?: ApiPromise) => Promise<TSerializedApiCall>;
|
|
110
146
|
|
|
111
147
|
declare const index$4_send: typeof send;
|
|
112
148
|
declare const index$4_sendSerializedApiCall: typeof sendSerializedApiCall;
|
|
@@ -117,11 +153,11 @@ declare namespace index$4 {
|
|
|
117
153
|
export { index$4_send as send, index$4_sendSerializedApiCall as sendSerializedApiCall, index$4_transferRelayToPara as transferRelayToPara, index$4_transferRelayToParaCommon as transferRelayToParaCommon, index$4_transferRelayToParaSerializedApiCall as transferRelayToParaSerializedApiCall };
|
|
118
154
|
}
|
|
119
155
|
|
|
120
|
-
declare
|
|
121
|
-
declare
|
|
122
|
-
declare
|
|
123
|
-
declare
|
|
124
|
-
declare
|
|
156
|
+
declare const addLiquidity: (api: ApiPromise, assetA: number, assetB: number, amountA: any, amountBMaxLimit: any) => Extrinsic;
|
|
157
|
+
declare const buy: (api: ApiPromise, assetOut: number, assetIn: number, amount: any, maxLimit: any, discount: Bool) => Extrinsic;
|
|
158
|
+
declare const createPool: (api: ApiPromise, assetA: number, amountA: any, assetB: number, amountB: any) => Extrinsic;
|
|
159
|
+
declare const removeLiquidity: (api: ApiPromise, assetA: number, assetB: number, liquidityAmount: any) => Extrinsic;
|
|
160
|
+
declare const sell: (api: ApiPromise, assetIn: number, assetOut: number, amount: any, maxLimit: any, discount: Bool) => Extrinsic;
|
|
125
161
|
|
|
126
162
|
declare const index$3_addLiquidity: typeof addLiquidity;
|
|
127
163
|
declare const index$3_buy: typeof buy;
|
|
@@ -132,8 +168,8 @@ declare namespace index$3 {
|
|
|
132
168
|
export { index$3_addLiquidity as addLiquidity, index$3_buy as buy, index$3_createPool as createPool, index$3_removeLiquidity as removeLiquidity, index$3_sell as sell };
|
|
133
169
|
}
|
|
134
170
|
|
|
135
|
-
declare
|
|
136
|
-
declare
|
|
171
|
+
declare const openChannel: (api: ApiPromise, origin: TNode, destination: TNode, maxSize: number, maxMessageSize: number) => Extrinsic;
|
|
172
|
+
declare const openChannelSerializedApiCall: (api: ApiPromise, origin: TNode, destination: TNode, maxSize: number, maxMessageSize: number) => TSerializedApiCall;
|
|
137
173
|
|
|
138
174
|
declare const index$2_openChannel: typeof openChannel;
|
|
139
175
|
declare const index$2_openChannelSerializedApiCall: typeof openChannelSerializedApiCall;
|
|
@@ -141,8 +177,8 @@ declare namespace index$2 {
|
|
|
141
177
|
export { index$2_openChannel as openChannel, index$2_openChannelSerializedApiCall as openChannelSerializedApiCall };
|
|
142
178
|
}
|
|
143
179
|
|
|
144
|
-
declare
|
|
145
|
-
declare
|
|
180
|
+
declare const closeChannel: (api: ApiPromise, origin: TNode, inbound: number, outbound: number) => Extrinsic;
|
|
181
|
+
declare const closeChannelSerializedApiCall: (api: ApiPromise, origin: TNode, inbound: number, outbound: number) => TSerializedApiCall;
|
|
146
182
|
|
|
147
183
|
declare const index$1_closeChannel: typeof closeChannel;
|
|
148
184
|
declare const index$1_closeChannelSerializedApiCall: typeof closeChannelSerializedApiCall;
|
|
@@ -175,6 +211,9 @@ declare namespace index {
|
|
|
175
211
|
export { index_getAllAssetsSymbols as getAllAssetsSymbols, index_getAssetDecimals as getAssetDecimals, index_getAssetId as getAssetId, index_getAssetsObject as getAssetsObject, index_getNativeAssets as getNativeAssets, index_getOtherAssets as getOtherAssets, index_getParaId as getParaId, index_getRelayChainSymbol as getRelayChainSymbol, index_getTNode as getTNode, index_hasSupportForAsset as hasSupportForAsset };
|
|
176
212
|
}
|
|
177
213
|
|
|
214
|
+
declare const getDefaultPallet: (node: TNode) => TPallet;
|
|
215
|
+
declare const getSupportedPallets: (node: TNode) => TPallet[];
|
|
216
|
+
|
|
178
217
|
interface FinalAddLiquidityBuilder {
|
|
179
218
|
build: () => Extrinsic;
|
|
180
219
|
}
|
|
@@ -273,25 +312,25 @@ interface AssetInSellBuilder {
|
|
|
273
312
|
}
|
|
274
313
|
|
|
275
314
|
declare class ToGeneralBuilder {
|
|
276
|
-
private readonly api
|
|
315
|
+
private readonly api?;
|
|
277
316
|
private readonly from;
|
|
278
317
|
private readonly to;
|
|
279
318
|
private readonly paraIdTo?;
|
|
280
|
-
constructor(api: ApiPromise, from: TNode, to: TNode, paraIdTo?: number);
|
|
319
|
+
constructor(api: ApiPromise | undefined, from: TNode, to: TNode, paraIdTo?: number);
|
|
281
320
|
currency(currency: string | number | bigint): AmountBuilder;
|
|
282
321
|
openChannel(): MaxSizeOpenChannelBuilder;
|
|
283
322
|
}
|
|
284
323
|
declare class FromGeneralBuilder {
|
|
285
|
-
private readonly api
|
|
324
|
+
private readonly api?;
|
|
286
325
|
private readonly from;
|
|
287
|
-
constructor(api: ApiPromise, from: TNode);
|
|
326
|
+
constructor(api: ApiPromise | undefined, from: TNode);
|
|
288
327
|
to(node: TNode, paraIdTo?: number): ToGeneralBuilder;
|
|
289
328
|
amount(amount: string | number | bigint): AddressBuilder;
|
|
290
329
|
closeChannel(): InboundCloseChannelBuilder;
|
|
291
330
|
}
|
|
292
331
|
declare class GeneralBuilder {
|
|
293
|
-
private readonly api
|
|
294
|
-
constructor(api
|
|
332
|
+
private readonly api?;
|
|
333
|
+
constructor(api?: ApiPromise);
|
|
295
334
|
from(node: TNode): FromGeneralBuilder;
|
|
296
335
|
to(node: TNode, paraIdTo?: number): AmountBuilder;
|
|
297
336
|
addLiquidity(): AssetAAddLiquidityBuilder;
|
|
@@ -300,21 +339,23 @@ declare class GeneralBuilder {
|
|
|
300
339
|
sell(): AssetInSellBuilder;
|
|
301
340
|
createPool(): AssetACreatePoolBuilder;
|
|
302
341
|
}
|
|
303
|
-
declare const Builder: (api
|
|
342
|
+
declare const Builder: (api?: ApiPromise) => GeneralBuilder;
|
|
304
343
|
interface FinalBuilder {
|
|
305
344
|
build: () => Extrinsic | never;
|
|
306
345
|
buildSerializedApiCall: () => TSerializedApiCall;
|
|
307
346
|
}
|
|
347
|
+
interface UseKeepAliveFinalBuilder {
|
|
348
|
+
useKeepAlive: (destApi: ApiPromise) => UseKeepAliveFinalBuilder;
|
|
349
|
+
build: () => Promise<Extrinsic | never>;
|
|
350
|
+
buildSerializedApiCall: () => Promise<TSerializedApiCall>;
|
|
351
|
+
}
|
|
308
352
|
interface AddressBuilder {
|
|
309
|
-
address: (address: string) =>
|
|
353
|
+
address: (address: string) => UseKeepAliveFinalBuilder;
|
|
310
354
|
}
|
|
311
355
|
interface AmountBuilder {
|
|
312
356
|
amount: (amount: string | number | bigint) => AddressBuilder;
|
|
313
357
|
}
|
|
314
358
|
|
|
315
|
-
declare const getDefaultPallet: (node: TNode) => TPallet;
|
|
316
|
-
declare const getSupportedPallets: (node: TNode) => TPallet[];
|
|
317
|
-
|
|
318
359
|
declare const getNode: (node: TNode) => ParachainNode;
|
|
319
360
|
declare const getNodeEndpointOption: (node: TNode) => any;
|
|
320
361
|
declare const getAllNodeProviders: (node: TNode) => string[];
|
|
@@ -341,4 +382,6 @@ declare class IncompatibleNodesError extends Error {
|
|
|
341
382
|
constructor();
|
|
342
383
|
}
|
|
343
384
|
|
|
344
|
-
|
|
385
|
+
declare const getExistentialDeposit: (node: TNodeWithRelayChains) => string | null;
|
|
386
|
+
|
|
387
|
+
export { type Bool, 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 TAssetDetails, type TAssetJsonMap, type TEdJsonMap, type TNativeAssetDetails, type TNode, type TNodeAssets, type TNodeWithRelayChains, type TPallet, type TPalletJsonMap, type TPalletMap, type TRelayChainSymbol, type TRelayChainType, type TScenario, type TSerializedApiCall, type TTransferRelayToParaOptions, 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$4 as xcmPallet, index$3 as xyk };
|