@paraspell/sdk 5.2.1 → 5.4.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
@@ -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];
@@ -349,18 +360,55 @@ declare const getAssetDecimals: (node: TNode, symbol: string) => number | null;
349
360
  declare const getParaId: (node: TNode) => number;
350
361
  declare const getTNode: (paraId: number) => TNode | null;
351
362
 
363
+ declare const getBalanceNative: (address: string, node: TNodeWithRelayChains, api?: ApiPromise) => Promise<bigint>;
364
+
365
+ declare const getBalanceForeign: (address: string, node: TNode, symbolOrId: string, api?: ApiPromise) => Promise<bigint | null>;
366
+
367
+ interface TTransferInfo {
368
+ chain: {
369
+ origin: TNodeWithRelayChains;
370
+ destination: TNodeWithRelayChains;
371
+ ecosystem: string;
372
+ };
373
+ currencyBalanceOrigin: {
374
+ balance: bigint;
375
+ currency: string;
376
+ };
377
+ originFeeBalance: {
378
+ balance: bigint;
379
+ expectedBalanceAfterXCMFee: bigint;
380
+ xcmFee: {
381
+ sufficientForXCM: boolean;
382
+ xcmFee: bigint;
383
+ };
384
+ existentialDeposit: bigint;
385
+ asset: string;
386
+ minNativeTransferableAmount: bigint;
387
+ maxNativeTransferableAmount: bigint;
388
+ };
389
+ destinationFeeBalance: {
390
+ balance: bigint;
391
+ currency: string;
392
+ existentialDeposit: bigint;
393
+ };
394
+ }
395
+ declare const getTransferInfo: (origin: TNodeWithRelayChains, destination: TNodeWithRelayChains, accountOrigin: string, accountDestination: string, assetSymbolOrId: string, amount: string) => Promise<TTransferInfo>;
396
+
352
397
  declare const index_getAllAssetsSymbols: typeof getAllAssetsSymbols;
353
398
  declare const index_getAssetDecimals: typeof getAssetDecimals;
354
399
  declare const index_getAssetId: typeof getAssetId;
355
400
  declare const index_getAssetsObject: typeof getAssetsObject;
401
+ declare const index_getBalanceForeign: typeof getBalanceForeign;
402
+ declare const index_getBalanceNative: typeof getBalanceNative;
356
403
  declare const index_getNativeAssets: typeof getNativeAssets;
357
404
  declare const index_getOtherAssets: typeof getOtherAssets;
358
405
  declare const index_getParaId: typeof getParaId;
359
406
  declare const index_getRelayChainSymbol: typeof getRelayChainSymbol;
360
407
  declare const index_getTNode: typeof getTNode;
408
+ declare const index_getTransferInfo: typeof getTransferInfo;
361
409
  declare const index_hasSupportForAsset: typeof hasSupportForAsset;
362
410
  declare namespace index {
363
- 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 };
411
+ export { index_getAllAssetsSymbols as getAllAssetsSymbols, index_getAssetDecimals as getAssetDecimals, index_getAssetId as getAssetId, index_getAssetsObject as getAssetsObject, index_getBalanceForeign as getBalanceForeign, index_getBalanceNative as getBalanceNative, index_getNativeAssets as getNativeAssets, index_getOtherAssets as getOtherAssets, index_getParaId as getParaId, index_getRelayChainSymbol as getRelayChainSymbol, index_getTNode as getTNode, index_getTransferInfo as getTransferInfo, index_hasSupportForAsset as hasSupportForAsset };
364
412
  }
365
413
 
366
414
  declare const getDefaultPallet: (node: TNode) => TPallet;
@@ -396,7 +444,7 @@ declare class FromGeneralBuilder {
396
444
  constructor(api: ApiPromise | undefined, from: TNode);
397
445
  to(node: TDestination, paraIdTo?: number): ToGeneralBuilder;
398
446
  feeAsset(feeAsset: TCurrency): AmountBuilder;
399
- amount(amount: TAmount): AddressBuilder;
447
+ amount(amount: TAmount | null): AddressBuilder;
400
448
  closeChannel(): InboundCloseChannelBuilder;
401
449
  }
402
450
  declare class GeneralBuilder {
@@ -404,12 +452,17 @@ declare class GeneralBuilder {
404
452
  constructor(api?: ApiPromise);
405
453
  from(node: TNode): FromGeneralBuilder;
406
454
  to(node: TDestination, paraIdTo?: number): AmountBuilder;
455
+ claimFrom(node: TNodeWithRelayChains): FungibleBuilder;
407
456
  }
408
457
  declare const Builder: (api?: ApiPromise) => GeneralBuilder;
409
458
  interface FinalBuilder {
410
459
  build: () => Extrinsic | never;
411
460
  buildSerializedApiCall: () => TSerializedApiCall;
412
461
  }
462
+ interface FinalBuilderAsync {
463
+ build: () => Promise<Extrinsic | never>;
464
+ buildSerializedApiCall: () => Promise<TSerializedApiCall>;
465
+ }
413
466
  interface UseKeepAliveFinalBuilder {
414
467
  useKeepAlive: (destApi: ApiPromise) => UseKeepAliveFinalBuilder;
415
468
  build: () => Promise<Extrinsic | never>;
@@ -419,12 +472,21 @@ interface AddressBuilder {
419
472
  address: (address: TAddress) => UseKeepAliveFinalBuilder;
420
473
  }
421
474
  interface AmountBuilder {
422
- amount: (amount: TAmount) => AddressBuilder;
475
+ amount: (amount: TAmount | null) => AddressBuilder;
423
476
  }
424
477
  interface AmountOrFeeAssetBuilder {
425
- amount: (amount: TAmount) => AddressBuilder;
478
+ amount: (amount: TAmount | null) => AddressBuilder;
426
479
  feeAsset: (feeAsset: TCurrencyInput) => AmountBuilder;
427
480
  }
481
+ interface FungibleBuilder {
482
+ fungible: (multiAssets: TMultiAsset[]) => AccountBuilder;
483
+ }
484
+ interface AccountBuilder {
485
+ account: (address: TAddress) => VersionBuilder;
486
+ }
487
+ interface VersionBuilder extends FinalBuilderAsync {
488
+ xcmVersion: (version: TVersionClaimAssets) => FinalBuilderAsync;
489
+ }
428
490
 
429
491
  declare const getNode: (node: TNode) => ParachainNode;
430
492
  declare const getNodeEndpointOption: (node: TNode) => any;
@@ -454,4 +516,4 @@ declare class IncompatibleNodesError extends Error {
454
516
 
455
517
  declare const getExistentialDeposit: (node: TNodeWithRelayChains) => string | null;
456
518
 
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 };
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 };