@paraspell/sdk 1.1.11 → 1.1.13
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 +64 -10
- package/dist/index.d.ts +39 -3
- package/dist/index.mjs +60 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
require('@polkadot/api');
|
|
4
4
|
var ethers = require('ethers');
|
|
5
|
-
require('@polkadot/apps-config/endpoints');
|
|
5
|
+
var endpoints = require('@polkadot/apps-config/endpoints');
|
|
6
6
|
|
|
7
7
|
// derrived from https://github.com/kodadot/packages/blob/main/minimark/src/common/types.ts
|
|
8
|
+
exports.TType = void 0;
|
|
9
|
+
(function (TType) {
|
|
10
|
+
TType["CONSTS"] = "consts";
|
|
11
|
+
TType["QUERY"] = "query";
|
|
12
|
+
TType["TX"] = "tx";
|
|
13
|
+
})(exports.TType || (exports.TType = {}));
|
|
8
14
|
exports.Version = void 0;
|
|
9
15
|
(function (Version) {
|
|
10
16
|
Version[Version["V1"] = 0] = "V1";
|
|
@@ -3719,6 +3725,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3719
3725
|
}, {
|
|
3720
3726
|
key: "transfer",
|
|
3721
3727
|
value: function transfer(api, currencySymbol, currencyId, amount, to, destination) {
|
|
3728
|
+
var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
3722
3729
|
var scenario = destination ? 'ParaToPara' : 'ParaToRelay';
|
|
3723
3730
|
var paraId = destination ? getParaId(destination) : undefined;
|
|
3724
3731
|
if (supportsXTokens(this)) {
|
|
@@ -3728,7 +3735,8 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3728
3735
|
currencyID: currencyId,
|
|
3729
3736
|
amount: amount,
|
|
3730
3737
|
addressSelection: handleAddress(scenario, 'xTokens', api, to, this.version, paraId),
|
|
3731
|
-
fees: getFees(scenario)
|
|
3738
|
+
fees: getFees(scenario),
|
|
3739
|
+
serializedApiCallEnabled: serializedApiCallEnabled
|
|
3732
3740
|
});
|
|
3733
3741
|
} else if (supportsPolkadotXCM(this)) {
|
|
3734
3742
|
return this.transferPolkadotXCM({
|
|
@@ -3736,7 +3744,8 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3736
3744
|
header: createHeaderPolkadotXCM(scenario, this.version, paraId),
|
|
3737
3745
|
addressSelection: handleAddress(scenario, 'polkadotXCM', api, to, this.version, paraId),
|
|
3738
3746
|
currencySelection: createCurrencySpecification(amount, scenario, this.version, this._node, currencyId),
|
|
3739
|
-
scenario: scenario
|
|
3747
|
+
scenario: scenario,
|
|
3748
|
+
serializedApiCallEnabled: serializedApiCallEnabled
|
|
3740
3749
|
});
|
|
3741
3750
|
} else {
|
|
3742
3751
|
throw new NoXCMSupportImplementedError(this._node);
|
|
@@ -3755,10 +3764,20 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
|
3755
3764
|
value: function transferXTokens(_ref, currencySelection) {
|
|
3756
3765
|
var api = _ref.api,
|
|
3757
3766
|
amount = _ref.amount,
|
|
3758
|
-
addressSelection = _ref.addressSelection
|
|
3767
|
+
addressSelection = _ref.addressSelection,
|
|
3768
|
+
serializedApiCallEnabled = _ref.serializedApiCallEnabled;
|
|
3759
3769
|
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Unlimited';
|
|
3760
3770
|
var pallet = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'XTokens';
|
|
3761
|
-
|
|
3771
|
+
var module = lowercaseFirstLetter(pallet.toString());
|
|
3772
|
+
if (serializedApiCallEnabled) {
|
|
3773
|
+
return {
|
|
3774
|
+
type: exports.TType.TX,
|
|
3775
|
+
module: module,
|
|
3776
|
+
section: 'transfer',
|
|
3777
|
+
parameters: [currencySelection, amount, addressSelection, fees]
|
|
3778
|
+
};
|
|
3779
|
+
}
|
|
3780
|
+
return api.tx[module].transfer(currencySelection, amount, addressSelection, fees);
|
|
3762
3781
|
}
|
|
3763
3782
|
}]);
|
|
3764
3783
|
return XTokensTransferImpl;
|
|
@@ -4140,7 +4159,6 @@ var Basilisk$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4140
4159
|
key: "transferXTokens",
|
|
4141
4160
|
value: function transferXTokens(input) {
|
|
4142
4161
|
var currencyID = input.currencyID;
|
|
4143
|
-
input.fees;
|
|
4144
4162
|
return XTokensTransferImpl.transferXTokens(input, currencyID);
|
|
4145
4163
|
}
|
|
4146
4164
|
}]);
|
|
@@ -4491,7 +4509,6 @@ var Karura$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4491
4509
|
return Karura;
|
|
4492
4510
|
}(ParachainNode);
|
|
4493
4511
|
|
|
4494
|
-
// Contains basic structure of polkadotXCM call
|
|
4495
4512
|
var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
|
|
4496
4513
|
function PolkadotXCMTransferImpl() {
|
|
4497
4514
|
_classCallCheck(this, PolkadotXCMTransferImpl);
|
|
@@ -4502,8 +4519,17 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
|
|
|
4502
4519
|
var api = _ref.api,
|
|
4503
4520
|
header = _ref.header,
|
|
4504
4521
|
addressSelection = _ref.addressSelection,
|
|
4505
|
-
currencySelection = _ref.currencySelection
|
|
4522
|
+
currencySelection = _ref.currencySelection,
|
|
4523
|
+
serializedApiCallEnabled = _ref.serializedApiCallEnabled;
|
|
4506
4524
|
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
4525
|
+
if (serializedApiCallEnabled) {
|
|
4526
|
+
return {
|
|
4527
|
+
type: exports.TType.TX,
|
|
4528
|
+
module: 'polkadotXcm',
|
|
4529
|
+
section: method,
|
|
4530
|
+
parameters: [header, addressSelection, currencySelection, 0].concat(_toConsumableArray(fees ? [fees] : []))
|
|
4531
|
+
};
|
|
4532
|
+
}
|
|
4507
4533
|
return fees ? api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0, fees) : api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0);
|
|
4508
4534
|
}
|
|
4509
4535
|
}]);
|
|
@@ -5187,6 +5213,16 @@ function createHeaderPolkadotXCM(scenario, version, nodeId) {
|
|
|
5187
5213
|
function getNode(node) {
|
|
5188
5214
|
return nodes[node];
|
|
5189
5215
|
}
|
|
5216
|
+
function getNodeEndpointOption(node) {
|
|
5217
|
+
var _getNode = getNode(node),
|
|
5218
|
+
type = _getNode.type,
|
|
5219
|
+
name = _getNode.name;
|
|
5220
|
+
var _ref = type === 'polkadot' ? endpoints.prodRelayPolkadot : endpoints.prodRelayKusama,
|
|
5221
|
+
linked = _ref.linked;
|
|
5222
|
+
return linked ? linked.find(function (o) {
|
|
5223
|
+
return o.info === name;
|
|
5224
|
+
}) : undefined;
|
|
5225
|
+
}
|
|
5190
5226
|
var lowercaseFirstLetter = function lowercaseFirstLetter(str) {
|
|
5191
5227
|
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
5192
5228
|
};
|
|
@@ -5230,7 +5266,8 @@ var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
|
|
|
5230
5266
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
5231
5267
|
|
|
5232
5268
|
// Contains basic call formatting for different XCM Palletss
|
|
5233
|
-
function
|
|
5269
|
+
var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
5270
|
+
var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
5234
5271
|
var asset = getAssetBySymbolOrId(origin, currencySymbolOrId.toString());
|
|
5235
5272
|
if (!asset) {
|
|
5236
5273
|
throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency or currencyId ").concat(currencySymbolOrId, "."));
|
|
@@ -5240,7 +5277,13 @@ function send(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
|
5240
5277
|
}
|
|
5241
5278
|
var currencySymbol = asset.symbol,
|
|
5242
5279
|
currencyId = asset.assetId;
|
|
5243
|
-
return getNode(origin).transfer(api, currencySymbol, currencyId, amount, to, destination);
|
|
5280
|
+
return getNode(origin).transfer(api, currencySymbol, currencyId, amount, to, destination, serializedApiCallEnabled);
|
|
5281
|
+
};
|
|
5282
|
+
var sendSerializedApiCall = function sendSerializedApiCall(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
5283
|
+
return sendCommon(api, origin, currencySymbolOrId, amount, to, destination, true);
|
|
5284
|
+
};
|
|
5285
|
+
function send(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
5286
|
+
return sendCommon(api, origin, currencySymbolOrId, amount, to, destination);
|
|
5244
5287
|
}
|
|
5245
5288
|
function transferRelayToPara(api, destination, amount, to) {
|
|
5246
5289
|
var paraId = getParaId(destination);
|
|
@@ -5259,6 +5302,7 @@ function transferRelayToPara(api, destination, amount, to) {
|
|
|
5259
5302
|
var index$3 = /*#__PURE__*/Object.freeze({
|
|
5260
5303
|
__proto__: null,
|
|
5261
5304
|
send: send,
|
|
5305
|
+
sendSerializedApiCall: sendSerializedApiCall,
|
|
5262
5306
|
transferRelayToPara: transferRelayToPara
|
|
5263
5307
|
});
|
|
5264
5308
|
|
|
@@ -5651,6 +5695,11 @@ var SendBuilder = /*#__PURE__*/function () {
|
|
|
5651
5695
|
value: function build() {
|
|
5652
5696
|
return send(this.api, this.from, this.currency, this._amount, this._address, this.to);
|
|
5653
5697
|
}
|
|
5698
|
+
}, {
|
|
5699
|
+
key: "buildSerializedApiCall",
|
|
5700
|
+
value: function buildSerializedApiCall() {
|
|
5701
|
+
return sendSerializedApiCall(this.api, this.from, this.currency, this._amount, this._address, this.to);
|
|
5702
|
+
}
|
|
5654
5703
|
}], [{
|
|
5655
5704
|
key: "createParaToRelay",
|
|
5656
5705
|
value: function createParaToRelay(api, from, currency) {
|
|
@@ -6195,8 +6244,12 @@ var getSupportedPallets = function getSupportedPallets(node) {
|
|
|
6195
6244
|
};
|
|
6196
6245
|
|
|
6197
6246
|
exports.Builder = Builder;
|
|
6247
|
+
exports.InvalidCurrencyError = InvalidCurrencyError;
|
|
6198
6248
|
exports.NODE_NAMES = NODE_NAMES;
|
|
6249
|
+
exports.NoXCMSupportImplementedError = NoXCMSupportImplementedError;
|
|
6250
|
+
exports.NodeNotSupportedError = NodeNotSupportedError;
|
|
6199
6251
|
exports.SUPPORTED_PALLETS = SUPPORTED_PALLETS;
|
|
6252
|
+
exports.ScenarioNotSupportedError = ScenarioNotSupportedError;
|
|
6200
6253
|
exports.assets = index$4;
|
|
6201
6254
|
exports.closeChannels = index;
|
|
6202
6255
|
exports.getAllAssetsSymbols = getAllAssetsSymbols;
|
|
@@ -6205,6 +6258,7 @@ exports.getAssetId = getAssetId;
|
|
|
6205
6258
|
exports.getAssetsObject = getAssetsObject;
|
|
6206
6259
|
exports.getDefaultPallet = getDefaultPallet;
|
|
6207
6260
|
exports.getNativeAssets = getNativeAssets;
|
|
6261
|
+
exports.getNodeEndpointOption = getNodeEndpointOption;
|
|
6208
6262
|
exports.getOtherAssets = getOtherAssets;
|
|
6209
6263
|
exports.getParaId = getParaId;
|
|
6210
6264
|
exports.getRelayChainSymbol = getRelayChainSymbol;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApiPromise } from '@polkadot/api';
|
|
2
2
|
import { SubmittableExtrinsic } from '@polkadot/api-base/types';
|
|
3
|
+
import * as _polkadot_apps_config_endpoints_types from '@polkadot/apps-config/endpoints/types';
|
|
3
4
|
|
|
4
5
|
declare const NODE_NAMES: readonly ["Statemint", "Acala", "Astar", "BifrostPolkadot", "Bitgreen", "Centrifuge", "Clover", "ComposableFinance", "Darwinia", "HydraDX", "Interlay", "Kylin", "Litentry", "Moonbeam", "Parallel", "Statemine", "Encointer", "Altair", "Amplitude", "Bajun", "Basilisk", "BifrostKusama", "Pioneer", "Calamari", "CrustShadow", "Crab", "Dorafactory", "Imbue", "Integritee", "InvArchTinker", "Karura", "Kico", "Kintsugi", "Litmus", "Mangata", "Moonriver", "ParallelHeiko", "Picasso", "Pichiu", "Quartz", "Robonomics", "Shiden", "Turing", "Equilibrium", "Unique", "Crust", "Efinity", "Ipci"];
|
|
5
6
|
declare const SUPPORTED_PALLETS: readonly ["XTokens", "OrmlXTokens", "PolkadotXcm", "RelayerXcm"];
|
|
@@ -34,6 +35,17 @@ type TPalletMap = {
|
|
|
34
35
|
supportedPallets: TPallet[];
|
|
35
36
|
};
|
|
36
37
|
type TPalletJsonMap = Record<TNode, TPalletMap>;
|
|
38
|
+
declare enum TType {
|
|
39
|
+
CONSTS = "consts",
|
|
40
|
+
QUERY = "query",
|
|
41
|
+
TX = "tx"
|
|
42
|
+
}
|
|
43
|
+
type TSerializedApiCall = {
|
|
44
|
+
type: TType;
|
|
45
|
+
module: string;
|
|
46
|
+
section: string;
|
|
47
|
+
parameters: any[];
|
|
48
|
+
};
|
|
37
49
|
type XTokensTransferInput = {
|
|
38
50
|
api: ApiPromise;
|
|
39
51
|
currency: string;
|
|
@@ -41,9 +53,10 @@ type XTokensTransferInput = {
|
|
|
41
53
|
amount: any;
|
|
42
54
|
addressSelection: any;
|
|
43
55
|
fees: number;
|
|
56
|
+
serializedApiCallEnabled?: boolean;
|
|
44
57
|
};
|
|
45
58
|
interface IXTokensTransfer {
|
|
46
|
-
transferXTokens(input: XTokensTransferInput): Extrinsic;
|
|
59
|
+
transferXTokens(input: XTokensTransferInput): Extrinsic | TSerializedApiCall;
|
|
47
60
|
}
|
|
48
61
|
type PolkadotXCMTransferInput = {
|
|
49
62
|
api: ApiPromise;
|
|
@@ -51,23 +64,27 @@ type PolkadotXCMTransferInput = {
|
|
|
51
64
|
addressSelection: any;
|
|
52
65
|
currencySelection: any;
|
|
53
66
|
scenario: TScenario;
|
|
67
|
+
serializedApiCallEnabled?: boolean;
|
|
54
68
|
};
|
|
55
69
|
interface IPolkadotXCMTransfer {
|
|
56
|
-
transferPolkadotXCM(input: PolkadotXCMTransferInput): Extrinsic;
|
|
70
|
+
transferPolkadotXCM(input: PolkadotXCMTransferInput): Extrinsic | TSerializedApiCall;
|
|
57
71
|
}
|
|
58
72
|
declare enum Version {
|
|
59
73
|
V1 = 0,
|
|
60
74
|
V3 = 1
|
|
61
75
|
}
|
|
62
76
|
|
|
77
|
+
declare const sendSerializedApiCall: (api: ApiPromise, origin: TNode, currencySymbolOrId: string | number | bigint, amount: any, to: string, destination?: TNode) => TSerializedApiCall;
|
|
63
78
|
declare function send(api: ApiPromise, origin: TNode, currencySymbolOrId: string | number | bigint, amount: any, to: string, destination?: TNode): Extrinsic;
|
|
64
79
|
declare function transferRelayToPara(api: ApiPromise, destination: TNode, amount: any, to: string): Extrinsic | never;
|
|
65
80
|
|
|
66
81
|
declare const index$4_send: typeof send;
|
|
82
|
+
declare const index$4_sendSerializedApiCall: typeof sendSerializedApiCall;
|
|
67
83
|
declare const index$4_transferRelayToPara: typeof transferRelayToPara;
|
|
68
84
|
declare namespace index$4 {
|
|
69
85
|
export {
|
|
70
86
|
index$4_send as send,
|
|
87
|
+
index$4_sendSerializedApiCall as sendSerializedApiCall,
|
|
71
88
|
index$4_transferRelayToPara as transferRelayToPara,
|
|
72
89
|
};
|
|
73
90
|
}
|
|
@@ -262,6 +279,7 @@ interface MaxSizeOpenChannelBuilder {
|
|
|
262
279
|
|
|
263
280
|
interface FinalRelayToParaBuilder {
|
|
264
281
|
build(): Extrinsic | never;
|
|
282
|
+
buildSerializedApiCall(): TSerializedApiCall;
|
|
265
283
|
}
|
|
266
284
|
interface AddressSendBuilder {
|
|
267
285
|
address(address: string): FinalRelayToParaBuilder;
|
|
@@ -304,4 +322,22 @@ declare function Builder(api: ApiPromise): GeneralBuilder;
|
|
|
304
322
|
declare const getDefaultPallet: (node: TNode) => TPallet;
|
|
305
323
|
declare const getSupportedPallets: (node: TNode) => TPallet[];
|
|
306
324
|
|
|
307
|
-
|
|
325
|
+
declare function getNodeEndpointOption(node: TNode): _polkadot_apps_config_endpoints_types.EndpointOption | undefined;
|
|
326
|
+
|
|
327
|
+
declare class InvalidCurrencyError extends Error {
|
|
328
|
+
constructor(message: string);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
declare class NodeNotSupportedError extends Error {
|
|
332
|
+
constructor(message: string);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
declare class NoXCMSupportImplementedError extends Error {
|
|
336
|
+
constructor(node: TNode);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
declare class ScenarioNotSupportedError extends Error {
|
|
340
|
+
constructor(node: TNode, scenario: TScenario);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export { Bool, Builder, Extrinsic, ExtrinsicFunction, IPolkadotXCMTransfer, IXTokensTransfer, InvalidCurrencyError, NODE_NAMES, NoXCMSupportImplementedError, NodeNotSupportedError, PolkadotXCMTransferInput, SUPPORTED_PALLETS, ScenarioNotSupportedError, TAssetDetails, TAssetJsonMap, TNativeAssetDetails, TNode, TNodeAssets, TPallet, TPalletJsonMap, TPalletMap, TRelayChainType, TScenario, TSerializedApiCall, TType, UpdateFunction, Version, XTokensTransferInput, index as assets, index$1 as closeChannels, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssetsObject, getDefaultPallet, getNativeAssets, getNodeEndpointOption, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedPallets, getTNode, hasSupportForAsset, index$2 as openChannels, index$4 as xcmPallet, index$3 as xyk };
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import '@polkadot/api';
|
|
2
2
|
import { ethers } from 'ethers';
|
|
3
|
-
import '@polkadot/apps-config/endpoints';
|
|
3
|
+
import { prodRelayPolkadot, prodRelayKusama } from '@polkadot/apps-config/endpoints';
|
|
4
4
|
|
|
5
5
|
// derrived from https://github.com/kodadot/packages/blob/main/minimark/src/common/types.ts
|
|
6
|
+
var TType;
|
|
7
|
+
(function (TType) {
|
|
8
|
+
TType["CONSTS"] = "consts";
|
|
9
|
+
TType["QUERY"] = "query";
|
|
10
|
+
TType["TX"] = "tx";
|
|
11
|
+
})(TType || (TType = {}));
|
|
6
12
|
var Version;
|
|
7
13
|
(function (Version) {
|
|
8
14
|
Version[Version["V1"] = 0] = "V1";
|
|
@@ -3717,6 +3723,7 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3717
3723
|
}, {
|
|
3718
3724
|
key: "transfer",
|
|
3719
3725
|
value: function transfer(api, currencySymbol, currencyId, amount, to, destination) {
|
|
3726
|
+
var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
3720
3727
|
var scenario = destination ? 'ParaToPara' : 'ParaToRelay';
|
|
3721
3728
|
var paraId = destination ? getParaId(destination) : undefined;
|
|
3722
3729
|
if (supportsXTokens(this)) {
|
|
@@ -3726,7 +3733,8 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3726
3733
|
currencyID: currencyId,
|
|
3727
3734
|
amount: amount,
|
|
3728
3735
|
addressSelection: handleAddress(scenario, 'xTokens', api, to, this.version, paraId),
|
|
3729
|
-
fees: getFees(scenario)
|
|
3736
|
+
fees: getFees(scenario),
|
|
3737
|
+
serializedApiCallEnabled: serializedApiCallEnabled
|
|
3730
3738
|
});
|
|
3731
3739
|
} else if (supportsPolkadotXCM(this)) {
|
|
3732
3740
|
return this.transferPolkadotXCM({
|
|
@@ -3734,7 +3742,8 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
3734
3742
|
header: createHeaderPolkadotXCM(scenario, this.version, paraId),
|
|
3735
3743
|
addressSelection: handleAddress(scenario, 'polkadotXCM', api, to, this.version, paraId),
|
|
3736
3744
|
currencySelection: createCurrencySpecification(amount, scenario, this.version, this._node, currencyId),
|
|
3737
|
-
scenario: scenario
|
|
3745
|
+
scenario: scenario,
|
|
3746
|
+
serializedApiCallEnabled: serializedApiCallEnabled
|
|
3738
3747
|
});
|
|
3739
3748
|
} else {
|
|
3740
3749
|
throw new NoXCMSupportImplementedError(this._node);
|
|
@@ -3753,10 +3762,20 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
|
3753
3762
|
value: function transferXTokens(_ref, currencySelection) {
|
|
3754
3763
|
var api = _ref.api,
|
|
3755
3764
|
amount = _ref.amount,
|
|
3756
|
-
addressSelection = _ref.addressSelection
|
|
3765
|
+
addressSelection = _ref.addressSelection,
|
|
3766
|
+
serializedApiCallEnabled = _ref.serializedApiCallEnabled;
|
|
3757
3767
|
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Unlimited';
|
|
3758
3768
|
var pallet = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'XTokens';
|
|
3759
|
-
|
|
3769
|
+
var module = lowercaseFirstLetter(pallet.toString());
|
|
3770
|
+
if (serializedApiCallEnabled) {
|
|
3771
|
+
return {
|
|
3772
|
+
type: TType.TX,
|
|
3773
|
+
module: module,
|
|
3774
|
+
section: 'transfer',
|
|
3775
|
+
parameters: [currencySelection, amount, addressSelection, fees]
|
|
3776
|
+
};
|
|
3777
|
+
}
|
|
3778
|
+
return api.tx[module].transfer(currencySelection, amount, addressSelection, fees);
|
|
3760
3779
|
}
|
|
3761
3780
|
}]);
|
|
3762
3781
|
return XTokensTransferImpl;
|
|
@@ -4138,7 +4157,6 @@ var Basilisk$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4138
4157
|
key: "transferXTokens",
|
|
4139
4158
|
value: function transferXTokens(input) {
|
|
4140
4159
|
var currencyID = input.currencyID;
|
|
4141
|
-
input.fees;
|
|
4142
4160
|
return XTokensTransferImpl.transferXTokens(input, currencyID);
|
|
4143
4161
|
}
|
|
4144
4162
|
}]);
|
|
@@ -4489,7 +4507,6 @@ var Karura$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4489
4507
|
return Karura;
|
|
4490
4508
|
}(ParachainNode);
|
|
4491
4509
|
|
|
4492
|
-
// Contains basic structure of polkadotXCM call
|
|
4493
4510
|
var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
|
|
4494
4511
|
function PolkadotXCMTransferImpl() {
|
|
4495
4512
|
_classCallCheck(this, PolkadotXCMTransferImpl);
|
|
@@ -4500,8 +4517,17 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
|
|
|
4500
4517
|
var api = _ref.api,
|
|
4501
4518
|
header = _ref.header,
|
|
4502
4519
|
addressSelection = _ref.addressSelection,
|
|
4503
|
-
currencySelection = _ref.currencySelection
|
|
4520
|
+
currencySelection = _ref.currencySelection,
|
|
4521
|
+
serializedApiCallEnabled = _ref.serializedApiCallEnabled;
|
|
4504
4522
|
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
4523
|
+
if (serializedApiCallEnabled) {
|
|
4524
|
+
return {
|
|
4525
|
+
type: TType.TX,
|
|
4526
|
+
module: 'polkadotXcm',
|
|
4527
|
+
section: method,
|
|
4528
|
+
parameters: [header, addressSelection, currencySelection, 0].concat(_toConsumableArray(fees ? [fees] : []))
|
|
4529
|
+
};
|
|
4530
|
+
}
|
|
4505
4531
|
return fees ? api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0, fees) : api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0);
|
|
4506
4532
|
}
|
|
4507
4533
|
}]);
|
|
@@ -5185,6 +5211,16 @@ function createHeaderPolkadotXCM(scenario, version, nodeId) {
|
|
|
5185
5211
|
function getNode(node) {
|
|
5186
5212
|
return nodes[node];
|
|
5187
5213
|
}
|
|
5214
|
+
function getNodeEndpointOption(node) {
|
|
5215
|
+
var _getNode = getNode(node),
|
|
5216
|
+
type = _getNode.type,
|
|
5217
|
+
name = _getNode.name;
|
|
5218
|
+
var _ref = type === 'polkadot' ? prodRelayPolkadot : prodRelayKusama,
|
|
5219
|
+
linked = _ref.linked;
|
|
5220
|
+
return linked ? linked.find(function (o) {
|
|
5221
|
+
return o.info === name;
|
|
5222
|
+
}) : undefined;
|
|
5223
|
+
}
|
|
5188
5224
|
var lowercaseFirstLetter = function lowercaseFirstLetter(str) {
|
|
5189
5225
|
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
5190
5226
|
};
|
|
@@ -5228,7 +5264,8 @@ var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
|
|
|
5228
5264
|
}( /*#__PURE__*/_wrapNativeSuper(Error));
|
|
5229
5265
|
|
|
5230
5266
|
// Contains basic call formatting for different XCM Palletss
|
|
5231
|
-
function
|
|
5267
|
+
var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
5268
|
+
var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
5232
5269
|
var asset = getAssetBySymbolOrId(origin, currencySymbolOrId.toString());
|
|
5233
5270
|
if (!asset) {
|
|
5234
5271
|
throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency or currencyId ").concat(currencySymbolOrId, "."));
|
|
@@ -5238,7 +5275,13 @@ function send(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
|
5238
5275
|
}
|
|
5239
5276
|
var currencySymbol = asset.symbol,
|
|
5240
5277
|
currencyId = asset.assetId;
|
|
5241
|
-
return getNode(origin).transfer(api, currencySymbol, currencyId, amount, to, destination);
|
|
5278
|
+
return getNode(origin).transfer(api, currencySymbol, currencyId, amount, to, destination, serializedApiCallEnabled);
|
|
5279
|
+
};
|
|
5280
|
+
var sendSerializedApiCall = function sendSerializedApiCall(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
5281
|
+
return sendCommon(api, origin, currencySymbolOrId, amount, to, destination, true);
|
|
5282
|
+
};
|
|
5283
|
+
function send(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
5284
|
+
return sendCommon(api, origin, currencySymbolOrId, amount, to, destination);
|
|
5242
5285
|
}
|
|
5243
5286
|
function transferRelayToPara(api, destination, amount, to) {
|
|
5244
5287
|
var paraId = getParaId(destination);
|
|
@@ -5257,6 +5300,7 @@ function transferRelayToPara(api, destination, amount, to) {
|
|
|
5257
5300
|
var index$3 = /*#__PURE__*/Object.freeze({
|
|
5258
5301
|
__proto__: null,
|
|
5259
5302
|
send: send,
|
|
5303
|
+
sendSerializedApiCall: sendSerializedApiCall,
|
|
5260
5304
|
transferRelayToPara: transferRelayToPara
|
|
5261
5305
|
});
|
|
5262
5306
|
|
|
@@ -5649,6 +5693,11 @@ var SendBuilder = /*#__PURE__*/function () {
|
|
|
5649
5693
|
value: function build() {
|
|
5650
5694
|
return send(this.api, this.from, this.currency, this._amount, this._address, this.to);
|
|
5651
5695
|
}
|
|
5696
|
+
}, {
|
|
5697
|
+
key: "buildSerializedApiCall",
|
|
5698
|
+
value: function buildSerializedApiCall() {
|
|
5699
|
+
return sendSerializedApiCall(this.api, this.from, this.currency, this._amount, this._address, this.to);
|
|
5700
|
+
}
|
|
5652
5701
|
}], [{
|
|
5653
5702
|
key: "createParaToRelay",
|
|
5654
5703
|
value: function createParaToRelay(api, from, currency) {
|
|
@@ -6192,4 +6241,4 @@ var getSupportedPallets = function getSupportedPallets(node) {
|
|
|
6192
6241
|
return palletsMap[node].supportedPallets;
|
|
6193
6242
|
};
|
|
6194
6243
|
|
|
6195
|
-
export { Builder, NODE_NAMES, SUPPORTED_PALLETS, Version, index$4 as assets, index as closeChannels, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssetsObject, getDefaultPallet, getNativeAssets, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedPallets, getTNode, hasSupportForAsset, index$1 as openChannels, index$3 as xcmPallet, index$2 as xyk };
|
|
6244
|
+
export { Builder, InvalidCurrencyError, NODE_NAMES, NoXCMSupportImplementedError, NodeNotSupportedError, SUPPORTED_PALLETS, ScenarioNotSupportedError, TType, Version, index$4 as assets, index as closeChannels, getAllAssetsSymbols, getAssetDecimals, getAssetId, getAssetsObject, getDefaultPallet, getNativeAssets, getNodeEndpointOption, getOtherAssets, getParaId, getRelayChainSymbol, getSupportedPallets, getTNode, hasSupportForAsset, index$1 as openChannels, index$3 as xcmPallet, index$2 as xyk };
|