@paraspell/sdk 3.1.1 → 4.0.1
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 +1814 -645
- package/dist/index.d.ts +65 -29
- package/dist/index.mjs +1811 -643
- package/package.json +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -21,9 +21,9 @@ declare abstract class ParachainNode {
|
|
|
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", "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"];
|
|
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", "Polkadot", "Kusama"];
|
|
26
|
-
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"];
|
|
27
27
|
|
|
28
28
|
type UpdateFunction = (name: string, index: number) => string;
|
|
29
29
|
type Extrinsic = SubmittableExtrinsic<'promise'>;
|
|
@@ -45,6 +45,7 @@ interface TNativeAssetDetails {
|
|
|
45
45
|
interface TNodeAssets {
|
|
46
46
|
paraId: number;
|
|
47
47
|
relayChainAssetSymbol: TRelayChainSymbol;
|
|
48
|
+
nativeAssetSymbol: string;
|
|
48
49
|
nativeAssets: TNativeAssetDetails[];
|
|
49
50
|
otherAssets: TAssetDetails[];
|
|
50
51
|
}
|
|
@@ -57,6 +58,7 @@ interface TPalletMap {
|
|
|
57
58
|
supportedPallets: TPallet[];
|
|
58
59
|
}
|
|
59
60
|
type TPalletJsonMap = Record<TNode, TPalletMap>;
|
|
61
|
+
type TEdJsonMap = Record<TNodeWithRelayChains, string | null>;
|
|
60
62
|
interface TSerializedApiCall {
|
|
61
63
|
module: string;
|
|
62
64
|
section: string;
|
|
@@ -70,11 +72,28 @@ interface XTokensTransferInput {
|
|
|
70
72
|
addressSelection: any;
|
|
71
73
|
fees: number;
|
|
72
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;
|
|
73
89
|
serializedApiCallEnabled?: boolean;
|
|
74
90
|
}
|
|
75
91
|
interface IXTokensTransfer {
|
|
76
92
|
transferXTokens: (input: XTokensTransferInput) => Extrinsic | TSerializedApiCall;
|
|
77
93
|
}
|
|
94
|
+
interface IXTransferTransfer {
|
|
95
|
+
transferXTransfer: (input: XTransferTransferInput) => Extrinsic | TSerializedApiCall;
|
|
96
|
+
}
|
|
78
97
|
interface PolkadotXCMTransferInput {
|
|
79
98
|
api: ApiPromise;
|
|
80
99
|
header: any;
|
|
@@ -90,6 +109,7 @@ interface TTransferRelayToParaOptions {
|
|
|
90
109
|
address: string;
|
|
91
110
|
amount: string;
|
|
92
111
|
paraIdTo?: number;
|
|
112
|
+
destApiForKeepAlive?: ApiPromise;
|
|
93
113
|
}
|
|
94
114
|
interface IPolkadotXCMTransfer {
|
|
95
115
|
transferPolkadotXCM: (input: PolkadotXCMTransferInput) => Extrinsic | TSerializedApiCall;
|
|
@@ -108,12 +128,21 @@ type PolkadotXCMHeader = {
|
|
|
108
128
|
interior: any;
|
|
109
129
|
};
|
|
110
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
|
+
}
|
|
111
140
|
|
|
112
|
-
declare const sendSerializedApiCall: (api: ApiPromise, origin: TNode, currencySymbolOrId: string | number | bigint, amount: string | number | bigint, to: string, destination?: TNode, paraIdTo?: number) => TSerializedApiCall
|
|
113
|
-
declare
|
|
114
|
-
declare const transferRelayToParaCommon: (api: ApiPromise, destination: TNode, amount: string, address: string, paraIdTo?: number, serializedApiCallEnabled?: boolean) => Extrinsic | TSerializedApiCall | never
|
|
115
|
-
declare
|
|
116
|
-
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>;
|
|
117
146
|
|
|
118
147
|
declare const index$4_send: typeof send;
|
|
119
148
|
declare const index$4_sendSerializedApiCall: typeof sendSerializedApiCall;
|
|
@@ -124,11 +153,11 @@ declare namespace index$4 {
|
|
|
124
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 };
|
|
125
154
|
}
|
|
126
155
|
|
|
127
|
-
declare
|
|
128
|
-
declare
|
|
129
|
-
declare
|
|
130
|
-
declare
|
|
131
|
-
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;
|
|
132
161
|
|
|
133
162
|
declare const index$3_addLiquidity: typeof addLiquidity;
|
|
134
163
|
declare const index$3_buy: typeof buy;
|
|
@@ -139,8 +168,8 @@ declare namespace index$3 {
|
|
|
139
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 };
|
|
140
169
|
}
|
|
141
170
|
|
|
142
|
-
declare
|
|
143
|
-
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;
|
|
144
173
|
|
|
145
174
|
declare const index$2_openChannel: typeof openChannel;
|
|
146
175
|
declare const index$2_openChannelSerializedApiCall: typeof openChannelSerializedApiCall;
|
|
@@ -148,8 +177,8 @@ declare namespace index$2 {
|
|
|
148
177
|
export { index$2_openChannel as openChannel, index$2_openChannelSerializedApiCall as openChannelSerializedApiCall };
|
|
149
178
|
}
|
|
150
179
|
|
|
151
|
-
declare
|
|
152
|
-
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;
|
|
153
182
|
|
|
154
183
|
declare const index$1_closeChannel: typeof closeChannel;
|
|
155
184
|
declare const index$1_closeChannelSerializedApiCall: typeof closeChannelSerializedApiCall;
|
|
@@ -182,6 +211,9 @@ declare namespace index {
|
|
|
182
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 };
|
|
183
212
|
}
|
|
184
213
|
|
|
214
|
+
declare const getDefaultPallet: (node: TNode) => TPallet;
|
|
215
|
+
declare const getSupportedPallets: (node: TNode) => TPallet[];
|
|
216
|
+
|
|
185
217
|
interface FinalAddLiquidityBuilder {
|
|
186
218
|
build: () => Extrinsic;
|
|
187
219
|
}
|
|
@@ -280,25 +312,25 @@ interface AssetInSellBuilder {
|
|
|
280
312
|
}
|
|
281
313
|
|
|
282
314
|
declare class ToGeneralBuilder {
|
|
283
|
-
private readonly api
|
|
315
|
+
private readonly api?;
|
|
284
316
|
private readonly from;
|
|
285
317
|
private readonly to;
|
|
286
318
|
private readonly paraIdTo?;
|
|
287
|
-
constructor(api: ApiPromise, from: TNode, to: TNode, paraIdTo?: number);
|
|
319
|
+
constructor(api: ApiPromise | undefined, from: TNode, to: TNode, paraIdTo?: number);
|
|
288
320
|
currency(currency: string | number | bigint): AmountBuilder;
|
|
289
321
|
openChannel(): MaxSizeOpenChannelBuilder;
|
|
290
322
|
}
|
|
291
323
|
declare class FromGeneralBuilder {
|
|
292
|
-
private readonly api
|
|
324
|
+
private readonly api?;
|
|
293
325
|
private readonly from;
|
|
294
|
-
constructor(api: ApiPromise, from: TNode);
|
|
326
|
+
constructor(api: ApiPromise | undefined, from: TNode);
|
|
295
327
|
to(node: TNode, paraIdTo?: number): ToGeneralBuilder;
|
|
296
328
|
amount(amount: string | number | bigint): AddressBuilder;
|
|
297
329
|
closeChannel(): InboundCloseChannelBuilder;
|
|
298
330
|
}
|
|
299
331
|
declare class GeneralBuilder {
|
|
300
|
-
private readonly api
|
|
301
|
-
constructor(api
|
|
332
|
+
private readonly api?;
|
|
333
|
+
constructor(api?: ApiPromise);
|
|
302
334
|
from(node: TNode): FromGeneralBuilder;
|
|
303
335
|
to(node: TNode, paraIdTo?: number): AmountBuilder;
|
|
304
336
|
addLiquidity(): AssetAAddLiquidityBuilder;
|
|
@@ -307,21 +339,23 @@ declare class GeneralBuilder {
|
|
|
307
339
|
sell(): AssetInSellBuilder;
|
|
308
340
|
createPool(): AssetACreatePoolBuilder;
|
|
309
341
|
}
|
|
310
|
-
declare const Builder: (api
|
|
342
|
+
declare const Builder: (api?: ApiPromise) => GeneralBuilder;
|
|
311
343
|
interface FinalBuilder {
|
|
312
344
|
build: () => Extrinsic | never;
|
|
313
345
|
buildSerializedApiCall: () => TSerializedApiCall;
|
|
314
346
|
}
|
|
347
|
+
interface UseKeepAliveFinalBuilder {
|
|
348
|
+
useKeepAlive: (destApi: ApiPromise) => UseKeepAliveFinalBuilder;
|
|
349
|
+
build: () => Promise<Extrinsic | never>;
|
|
350
|
+
buildSerializedApiCall: () => Promise<TSerializedApiCall>;
|
|
351
|
+
}
|
|
315
352
|
interface AddressBuilder {
|
|
316
|
-
address: (address: string) =>
|
|
353
|
+
address: (address: string) => UseKeepAliveFinalBuilder;
|
|
317
354
|
}
|
|
318
355
|
interface AmountBuilder {
|
|
319
356
|
amount: (amount: string | number | bigint) => AddressBuilder;
|
|
320
357
|
}
|
|
321
358
|
|
|
322
|
-
declare const getDefaultPallet: (node: TNode) => TPallet;
|
|
323
|
-
declare const getSupportedPallets: (node: TNode) => TPallet[];
|
|
324
|
-
|
|
325
359
|
declare const getNode: (node: TNode) => ParachainNode;
|
|
326
360
|
declare const getNodeEndpointOption: (node: TNode) => any;
|
|
327
361
|
declare const getAllNodeProviders: (node: TNode) => string[];
|
|
@@ -348,4 +382,6 @@ declare class IncompatibleNodesError extends Error {
|
|
|
348
382
|
constructor();
|
|
349
383
|
}
|
|
350
384
|
|
|
351
|
-
|
|
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 };
|