@paraspell/sdk 4.1.0 → 5.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/dist/index.d.ts CHANGED
@@ -13,16 +13,16 @@ declare abstract class ParachainNode {
13
13
  get node(): TNode;
14
14
  get version(): Version;
15
15
  get assetCheckEnabled(): boolean;
16
- transfer(api: ApiPromise, currencySymbol: string | undefined, currencyId: string | undefined, amount: string, to: string, destination?: TNode, paraIdTo?: number, serializedApiCallEnabled?: boolean): Extrinsic | TSerializedApiCall;
17
- transferRelayToPara(options: TTransferRelayToParaOptions): TSerializedApiCall;
16
+ transfer(options: TSendInternalOptions): Extrinsic | TSerializedApiCall;
17
+ transferRelayToPara(options: TRelayToParaInternalOptions): TSerializedApiCall;
18
18
  getProvider(): string;
19
19
  createApiInstance(): Promise<ApiPromise>;
20
20
  createCurrencySpec(amount: string, scenario: TScenario, version: Version, currencyId?: string): any;
21
21
  createPolkadotXcmHeader(scenario: TScenario, paraId?: number): any;
22
22
  }
23
23
 
24
- declare const NODE_NAMES: readonly ["AssetHubPolkadot", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "Clover", "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", "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", "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", "Equilibrium", "Unique", "Crust", "Manta", "Genshiro", "Nodle", "OriginTrail", "Pendulum", "Polkadex", "Zeitgeist", "Collectives", "Khala", "Phala", "Polkadot", "Kusama"];
24
+ 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"];
25
+ 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", "Polkadot", "Kusama"];
26
26
  declare const SUPPORTED_PALLETS: readonly ["XTokens", "OrmlXTokens", "PolkadotXcm", "RelayerXcm", "XTransfer"];
27
27
 
28
28
  type UpdateFunction = (name: string, index: number) => string;
@@ -51,7 +51,6 @@ interface TNodeAssets {
51
51
  }
52
52
  type TAssetJsonMap = Record<TNode, TNodeAssets>;
53
53
  type TScenario = 'ParaToRelay' | 'ParaToPara' | 'RelayToPara';
54
- type Bool = 'Yes' | 'No';
55
54
  type TPallet = (typeof SUPPORTED_PALLETS)[number];
56
55
  interface TPalletMap {
57
56
  defaultPallet: TPallet;
@@ -103,14 +102,65 @@ interface PolkadotXCMTransferInput {
103
102
  currencySymbol: string | undefined;
104
103
  serializedApiCallEnabled?: boolean;
105
104
  }
106
- interface TTransferRelayToParaOptions {
105
+ type TAmount = string | number | bigint;
106
+ interface TSendBaseOptions {
107
+ address: string;
108
+ destination?: TNode;
109
+ paraIdTo?: number;
110
+ destApiForKeepAlive?: ApiPromise;
111
+ }
112
+ interface TSendOptions extends TSendBaseOptions {
113
+ api?: ApiPromise;
114
+ origin: TNode;
115
+ currency: string | number | bigint;
116
+ amount: TAmount;
117
+ }
118
+ interface TSendOptionsCommon extends TSendOptions {
119
+ serializedApiCallEnabled?: boolean;
120
+ }
121
+ interface TSendInternalOptions extends TSendBaseOptions {
107
122
  api: ApiPromise;
123
+ currencySymbol: string | undefined;
124
+ currencyId: string | undefined;
125
+ amount: string;
126
+ serializedApiCallEnabled?: boolean;
127
+ }
128
+ interface TRelayToParaBaseOptions {
108
129
  destination: TNode;
109
130
  address: string;
110
- amount: string;
111
131
  paraIdTo?: number;
112
132
  destApiForKeepAlive?: ApiPromise;
113
133
  }
134
+ interface TRelayToParaOptions extends TRelayToParaBaseOptions {
135
+ api?: ApiPromise;
136
+ amount: TAmount;
137
+ }
138
+ interface TRelayToParaInternalOptions extends TRelayToParaBaseOptions {
139
+ api: ApiPromise;
140
+ amount: string;
141
+ }
142
+ interface TRelayToParaCommonOptions extends TRelayToParaOptions {
143
+ serializedApiCallEnabled?: boolean;
144
+ }
145
+ interface TOpenChannelOptions {
146
+ api: ApiPromise;
147
+ origin: TNode;
148
+ destination: TNode;
149
+ maxSize: number;
150
+ maxMessageSize: number;
151
+ }
152
+ interface TOpenChannelInternalOptions extends TOpenChannelOptions {
153
+ serializedApiCallEnabled?: boolean;
154
+ }
155
+ interface TCloseChannelOptions {
156
+ api: ApiPromise;
157
+ origin: TNode;
158
+ inbound: number;
159
+ outbound: number;
160
+ }
161
+ interface TCloseChannelInternalOptions extends TCloseChannelOptions {
162
+ serializedApiCallEnabled?: boolean;
163
+ }
114
164
  interface IPolkadotXCMTransfer {
115
165
  transferPolkadotXCM: (input: PolkadotXCMTransferInput) => Extrinsic | TSerializedApiCall;
116
166
  }
@@ -138,38 +188,23 @@ interface CheckKeepAliveOptions {
138
188
  destNode?: TNode;
139
189
  }
140
190
 
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>;
146
-
147
- declare const index$4_send: typeof send;
148
- declare const index$4_sendSerializedApiCall: typeof sendSerializedApiCall;
149
- declare const index$4_transferRelayToPara: typeof transferRelayToPara;
150
- declare const index$4_transferRelayToParaCommon: typeof transferRelayToParaCommon;
151
- declare const index$4_transferRelayToParaSerializedApiCall: typeof transferRelayToParaSerializedApiCall;
152
- declare namespace index$4 {
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 };
154
- }
191
+ declare const sendSerializedApiCall: (options: TSendOptions) => Promise<TSerializedApiCall>;
192
+ declare const send: (options: TSendOptions) => Promise<Extrinsic>;
193
+ declare const transferRelayToParaCommon: (options: TRelayToParaCommonOptions) => Promise<Extrinsic | TSerializedApiCall | never>;
194
+ declare const transferRelayToPara: (options: TRelayToParaOptions) => Promise<Extrinsic | never>;
195
+ declare const transferRelayToParaSerializedApiCall: (options: TRelayToParaOptions) => Promise<TSerializedApiCall>;
155
196
 
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;
161
-
162
- declare const index$3_addLiquidity: typeof addLiquidity;
163
- declare const index$3_buy: typeof buy;
164
- declare const index$3_createPool: typeof createPool;
165
- declare const index$3_removeLiquidity: typeof removeLiquidity;
166
- declare const index$3_sell: typeof sell;
197
+ declare const index$3_send: typeof send;
198
+ declare const index$3_sendSerializedApiCall: typeof sendSerializedApiCall;
199
+ declare const index$3_transferRelayToPara: typeof transferRelayToPara;
200
+ declare const index$3_transferRelayToParaCommon: typeof transferRelayToParaCommon;
201
+ declare const index$3_transferRelayToParaSerializedApiCall: typeof transferRelayToParaSerializedApiCall;
167
202
  declare namespace index$3 {
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 };
203
+ export { index$3_send as send, index$3_sendSerializedApiCall as sendSerializedApiCall, index$3_transferRelayToPara as transferRelayToPara, index$3_transferRelayToParaCommon as transferRelayToParaCommon, index$3_transferRelayToParaSerializedApiCall as transferRelayToParaSerializedApiCall };
169
204
  }
170
205
 
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;
206
+ declare const openChannel: (options: TOpenChannelOptions) => Extrinsic;
207
+ declare const openChannelSerializedApiCall: (options: TOpenChannelOptions) => TSerializedApiCall;
173
208
 
174
209
  declare const index$2_openChannel: typeof openChannel;
175
210
  declare const index$2_openChannelSerializedApiCall: typeof openChannelSerializedApiCall;
@@ -177,8 +212,8 @@ declare namespace index$2 {
177
212
  export { index$2_openChannel as openChannel, index$2_openChannelSerializedApiCall as openChannelSerializedApiCall };
178
213
  }
179
214
 
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;
215
+ declare const closeChannel: (options: TCloseChannelOptions) => Extrinsic;
216
+ declare const closeChannelSerializedApiCall: (options: TCloseChannelOptions) => TSerializedApiCall;
182
217
 
183
218
  declare const index$1_closeChannel: typeof closeChannel;
184
219
  declare const index$1_closeChannelSerializedApiCall: typeof closeChannelSerializedApiCall;
@@ -214,41 +249,6 @@ declare namespace index {
214
249
  declare const getDefaultPallet: (node: TNode) => TPallet;
215
250
  declare const getSupportedPallets: (node: TNode) => TPallet[];
216
251
 
217
- interface FinalAddLiquidityBuilder {
218
- build: () => Extrinsic;
219
- }
220
- interface AmountBMaxLimitAddLiquidityBuilder {
221
- amountBMaxLimit: (amountBMaxLimit: number) => FinalAddLiquidityBuilder;
222
- }
223
- interface AmountAAddLiquidityBuilder {
224
- amountA: (amountA: number) => AmountBMaxLimitAddLiquidityBuilder;
225
- }
226
- interface AssetBAddLiquidityBuilder {
227
- assetB: (assetB: number) => AmountAAddLiquidityBuilder;
228
- }
229
- interface AssetAAddLiquidityBuilder {
230
- assetA: (assetA: number) => AssetBAddLiquidityBuilder;
231
- }
232
-
233
- interface FinalBuyBuilder {
234
- build: () => Extrinsic;
235
- }
236
- interface DiscountBuyBuilder {
237
- discount: (discount: Bool) => FinalBuyBuilder;
238
- }
239
- interface MaxLimitBuyBuilder {
240
- maxLimit: (maxLimit: number) => DiscountBuyBuilder;
241
- }
242
- interface AmountBuyBuilder {
243
- amount: (amount: number) => MaxLimitBuyBuilder;
244
- }
245
- interface AssetInBuyBuilder {
246
- assetIn: (assetIn: number) => AmountBuyBuilder;
247
- }
248
- interface AssetOutBuyBuilder {
249
- assetOut: (assetOut: number) => AssetInBuyBuilder;
250
- }
251
-
252
252
  interface OutboundCloseChannelBuilder {
253
253
  outbound: (inbound: number) => FinalBuilder;
254
254
  }
@@ -256,22 +256,6 @@ interface InboundCloseChannelBuilder {
256
256
  inbound: (inbound: number) => OutboundCloseChannelBuilder;
257
257
  }
258
258
 
259
- interface FinalCreatePoolBuilder {
260
- build: () => Extrinsic;
261
- }
262
- interface AmountBCreatePoolBuilder {
263
- amountB: (amountB: number) => FinalCreatePoolBuilder;
264
- }
265
- interface AssetBCreatePoolBuilder {
266
- assetB: (assetB: number) => AmountBCreatePoolBuilder;
267
- }
268
- interface AmountACreatePoolBuilder {
269
- amountA: (amountA: number) => AssetBCreatePoolBuilder;
270
- }
271
- interface AssetACreatePoolBuilder {
272
- assetA: (assetA: number) => AmountACreatePoolBuilder;
273
- }
274
-
275
259
  interface MaxMessageSizeOpenChannelBuilder {
276
260
  maxMessageSize: (size: number) => FinalBuilder;
277
261
  }
@@ -279,38 +263,6 @@ interface MaxSizeOpenChannelBuilder {
279
263
  maxSize: (size: number) => MaxMessageSizeOpenChannelBuilder;
280
264
  }
281
265
 
282
- interface FinalRemoveLiquidityBuilder {
283
- build: () => Extrinsic;
284
- }
285
- interface LiquidityAmountRemoveLiquidityBuilder {
286
- liquidityAmount: (liquidityAmount: number) => FinalRemoveLiquidityBuilder;
287
- }
288
- interface AssetBRemoveLiquidityBuilder {
289
- assetB: (assetB: number) => LiquidityAmountRemoveLiquidityBuilder;
290
- }
291
- interface AssetARemoveLiquidityBuilder {
292
- assetA: (assetA: number) => AssetBRemoveLiquidityBuilder;
293
- }
294
-
295
- interface FinalSellBuilder {
296
- build: () => Extrinsic;
297
- }
298
- interface DiscountSellBuilder {
299
- discount: (discount: Bool) => FinalSellBuilder;
300
- }
301
- interface MaxLimitSellBuilder {
302
- maxLimit: (maxLimit: number) => DiscountSellBuilder;
303
- }
304
- interface AmountSellBuilder {
305
- amount: (amount: number) => MaxLimitSellBuilder;
306
- }
307
- interface AssetOutSellBuilder {
308
- assetOut: (assetOut: number) => AmountSellBuilder;
309
- }
310
- interface AssetInSellBuilder {
311
- assetIn: (assetIn: number) => AssetOutSellBuilder;
312
- }
313
-
314
266
  declare class ToGeneralBuilder {
315
267
  private readonly api?;
316
268
  private readonly from;
@@ -333,11 +285,6 @@ declare class GeneralBuilder {
333
285
  constructor(api?: ApiPromise);
334
286
  from(node: TNode): FromGeneralBuilder;
335
287
  to(node: TNode, paraIdTo?: number): AmountBuilder;
336
- addLiquidity(): AssetAAddLiquidityBuilder;
337
- removeLiquidity(): AssetARemoveLiquidityBuilder;
338
- buy(): AssetOutBuyBuilder;
339
- sell(): AssetInSellBuilder;
340
- createPool(): AssetACreatePoolBuilder;
341
288
  }
342
289
  declare const Builder: (api?: ApiPromise) => GeneralBuilder;
343
290
  interface FinalBuilder {
@@ -384,4 +331,4 @@ declare class IncompatibleNodesError extends Error {
384
331
 
385
332
  declare const getExistentialDeposit: (node: TNodeWithRelayChains) => string | null;
386
333
 
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 };
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 };