@paraspell/sdk 3.0.5 → 3.0.6
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 +3 -3
- package/dist/index.cjs +254 -225
- package/dist/index.d.ts +132 -170
- package/dist/index.mjs +254 -225
- package/package.json +32 -28
package/dist/index.cjs
CHANGED
|
@@ -4,13 +4,20 @@ require('@polkadot/api');
|
|
|
4
4
|
var ethers = require('ethers');
|
|
5
5
|
var endpoints = require('@polkadot/apps-config/endpoints');
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
function _toPrimitive(t, r) {
|
|
8
|
+
if ("object" != typeof t || !t) return t;
|
|
9
|
+
var e = t[Symbol.toPrimitive];
|
|
10
|
+
if (void 0 !== e) {
|
|
11
|
+
var i = e.call(t, r || "default");
|
|
12
|
+
if ("object" != typeof i) return i;
|
|
13
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
14
|
+
}
|
|
15
|
+
return ("string" === r ? String : Number)(t);
|
|
16
|
+
}
|
|
17
|
+
function _toPropertyKey(t) {
|
|
18
|
+
var i = _toPrimitive(t, "string");
|
|
19
|
+
return "symbol" == typeof i ? i : String(i);
|
|
20
|
+
}
|
|
14
21
|
function _classCallCheck(instance, Constructor) {
|
|
15
22
|
if (!(instance instanceof Constructor)) {
|
|
16
23
|
throw new TypeError("Cannot call a class as a function");
|
|
@@ -188,71 +195,6 @@ function _arrayLikeToArray(arr, len) {
|
|
|
188
195
|
function _nonIterableSpread() {
|
|
189
196
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
190
197
|
}
|
|
191
|
-
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
192
|
-
var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
|
|
193
|
-
if (!it) {
|
|
194
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
195
|
-
if (it) o = it;
|
|
196
|
-
var i = 0;
|
|
197
|
-
var F = function () {};
|
|
198
|
-
return {
|
|
199
|
-
s: F,
|
|
200
|
-
n: function () {
|
|
201
|
-
if (i >= o.length) return {
|
|
202
|
-
done: true
|
|
203
|
-
};
|
|
204
|
-
return {
|
|
205
|
-
done: false,
|
|
206
|
-
value: o[i++]
|
|
207
|
-
};
|
|
208
|
-
},
|
|
209
|
-
e: function (e) {
|
|
210
|
-
throw e;
|
|
211
|
-
},
|
|
212
|
-
f: F
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
216
|
-
}
|
|
217
|
-
var normalCompletion = true,
|
|
218
|
-
didErr = false,
|
|
219
|
-
err;
|
|
220
|
-
return {
|
|
221
|
-
s: function () {
|
|
222
|
-
it = it.call(o);
|
|
223
|
-
},
|
|
224
|
-
n: function () {
|
|
225
|
-
var step = it.next();
|
|
226
|
-
normalCompletion = step.done;
|
|
227
|
-
return step;
|
|
228
|
-
},
|
|
229
|
-
e: function (e) {
|
|
230
|
-
didErr = true;
|
|
231
|
-
err = e;
|
|
232
|
-
},
|
|
233
|
-
f: function () {
|
|
234
|
-
try {
|
|
235
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
236
|
-
} finally {
|
|
237
|
-
if (didErr) throw err;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
function _toPrimitive(input, hint) {
|
|
243
|
-
if (typeof input !== "object" || input === null) return input;
|
|
244
|
-
var prim = input[Symbol.toPrimitive];
|
|
245
|
-
if (prim !== undefined) {
|
|
246
|
-
var res = prim.call(input, hint || "default");
|
|
247
|
-
if (typeof res !== "object") return res;
|
|
248
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
249
|
-
}
|
|
250
|
-
return (hint === "string" ? String : Number)(input);
|
|
251
|
-
}
|
|
252
|
-
function _toPropertyKey(arg) {
|
|
253
|
-
var key = _toPrimitive(arg, "string");
|
|
254
|
-
return typeof key === "symbol" ? key : String(key);
|
|
255
|
-
}
|
|
256
198
|
|
|
257
199
|
/******************************************************************************
|
|
258
200
|
Copyright (c) Microsoft Corporation.
|
|
@@ -276,6 +218,13 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
|
|
|
276
218
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
277
219
|
};
|
|
278
220
|
|
|
221
|
+
// derrived from https://github.com/kodadot/packages/blob/main/minimark/src/common/types.ts
|
|
222
|
+
exports.Version = void 0;
|
|
223
|
+
(function (Version) {
|
|
224
|
+
Version["V1"] = "V1";
|
|
225
|
+
Version["V3"] = "V3";
|
|
226
|
+
})(exports.Version || (exports.Version = {}));
|
|
227
|
+
|
|
279
228
|
// Used to inform user, that Parachain they wish to use has not yet implemented full XCM Support
|
|
280
229
|
var NoXCMSupportImplementedError = /*#__PURE__*/function (_Error) {
|
|
281
230
|
_inherits(NoXCMSupportImplementedError, _Error);
|
|
@@ -4670,69 +4619,62 @@ var assetsMapJson = /*#__PURE__*/Object.freeze({
|
|
|
4670
4619
|
});
|
|
4671
4620
|
|
|
4672
4621
|
var assetsMap = assetsMapJson;
|
|
4673
|
-
function getAssetsObject(node) {
|
|
4622
|
+
var getAssetsObject = function getAssetsObject(node) {
|
|
4674
4623
|
return assetsMap[node];
|
|
4675
|
-
}
|
|
4676
|
-
function getAssetId(node, symbol) {
|
|
4624
|
+
};
|
|
4625
|
+
var getAssetId = function getAssetId(node, symbol) {
|
|
4677
4626
|
var info = getAssetsObject(node).otherAssets.find(function (o) {
|
|
4678
4627
|
return o.symbol === symbol;
|
|
4679
4628
|
});
|
|
4680
|
-
return info ? info.assetId : null;
|
|
4681
|
-
}
|
|
4682
|
-
function getRelayChainSymbol(node) {
|
|
4629
|
+
return info != null ? info.assetId : null;
|
|
4630
|
+
};
|
|
4631
|
+
var getRelayChainSymbol = function getRelayChainSymbol(node) {
|
|
4683
4632
|
return getAssetsObject(node).relayChainAssetSymbol;
|
|
4684
|
-
}
|
|
4685
|
-
function getNativeAssets(node) {
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
function getOtherAssets(node) {
|
|
4633
|
+
};
|
|
4634
|
+
var getNativeAssets = function getNativeAssets(node) {
|
|
4635
|
+
return getAssetsObject(node).nativeAssets;
|
|
4636
|
+
};
|
|
4637
|
+
var getOtherAssets = function getOtherAssets(node) {
|
|
4690
4638
|
return getAssetsObject(node).otherAssets;
|
|
4691
|
-
}
|
|
4692
|
-
function getAllAssetsSymbols(node) {
|
|
4639
|
+
};
|
|
4640
|
+
var getAllAssetsSymbols = function getAllAssetsSymbols(node) {
|
|
4693
4641
|
var _getAssetsObject = getAssetsObject(node),
|
|
4694
4642
|
relayChainAssetSymbol = _getAssetsObject.relayChainAssetSymbol,
|
|
4695
4643
|
nativeAssets = _getAssetsObject.nativeAssets,
|
|
4696
4644
|
otherAssets = _getAssetsObject.otherAssets;
|
|
4697
|
-
|
|
4645
|
+
var nativeAssetsSymbols = nativeAssets.map(function (_ref) {
|
|
4698
4646
|
var symbol = _ref.symbol;
|
|
4699
4647
|
return symbol;
|
|
4700
|
-
})
|
|
4701
|
-
|
|
4648
|
+
});
|
|
4649
|
+
var otherAssetsSymbols = otherAssets.filter(function (asset) {
|
|
4650
|
+
return asset.symbol !== undefined;
|
|
4702
4651
|
}).map(function (_ref2) {
|
|
4703
4652
|
var symbol = _ref2.symbol;
|
|
4704
4653
|
return symbol;
|
|
4705
|
-
})
|
|
4706
|
-
|
|
4707
|
-
|
|
4654
|
+
});
|
|
4655
|
+
return [relayChainAssetSymbol].concat(_toConsumableArray(nativeAssetsSymbols), _toConsumableArray(otherAssetsSymbols));
|
|
4656
|
+
};
|
|
4657
|
+
var hasSupportForAsset = function hasSupportForAsset(node, symbol) {
|
|
4708
4658
|
return getAllAssetsSymbols(node).includes(symbol);
|
|
4709
|
-
}
|
|
4710
|
-
function getAssetDecimals(node, symbol) {
|
|
4659
|
+
};
|
|
4660
|
+
var getAssetDecimals = function getAssetDecimals(node, symbol) {
|
|
4711
4661
|
var _getAssetsObject2 = getAssetsObject(node),
|
|
4712
4662
|
otherAssets = _getAssetsObject2.otherAssets,
|
|
4713
4663
|
nativeAssets = _getAssetsObject2.nativeAssets;
|
|
4714
4664
|
var asset = [].concat(_toConsumableArray(otherAssets), _toConsumableArray(nativeAssets)).find(function (o) {
|
|
4715
4665
|
return o.symbol === symbol;
|
|
4716
4666
|
});
|
|
4717
|
-
return asset ? asset.decimals : null;
|
|
4718
|
-
}
|
|
4719
|
-
function getParaId(node) {
|
|
4667
|
+
return (asset === null || asset === void 0 ? void 0 : asset.decimals) !== undefined ? asset.decimals : null;
|
|
4668
|
+
};
|
|
4669
|
+
var getParaId = function getParaId(node) {
|
|
4720
4670
|
return getAssetsObject(node).paraId;
|
|
4721
|
-
}
|
|
4722
|
-
function getTNode(nodeID) {
|
|
4723
|
-
var
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
if (getParaId(node) === nodeID) return node;
|
|
4729
|
-
}
|
|
4730
|
-
} catch (err) {
|
|
4731
|
-
_iterator.e(err);
|
|
4732
|
-
} finally {
|
|
4733
|
-
_iterator.f();
|
|
4734
|
-
}
|
|
4735
|
-
}
|
|
4671
|
+
};
|
|
4672
|
+
var getTNode = function getTNode(nodeID) {
|
|
4673
|
+
var _a;
|
|
4674
|
+
return (_a = NODE_NAMES.find(function (node) {
|
|
4675
|
+
return getParaId(node) === nodeID;
|
|
4676
|
+
})) !== null && _a !== void 0 ? _a : null;
|
|
4677
|
+
};
|
|
4736
4678
|
|
|
4737
4679
|
var index$4 = /*#__PURE__*/Object.freeze({
|
|
4738
4680
|
__proto__: null,
|
|
@@ -4748,6 +4690,20 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
4748
4690
|
hasSupportForAsset: hasSupportForAsset
|
|
4749
4691
|
});
|
|
4750
4692
|
|
|
4693
|
+
var constructRelayToParaParameters = function constructRelayToParaParameters(_ref, version) {
|
|
4694
|
+
var api = _ref.api,
|
|
4695
|
+
destination = _ref.destination,
|
|
4696
|
+
address = _ref.address,
|
|
4697
|
+
amount = _ref.amount;
|
|
4698
|
+
var includeFee = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
4699
|
+
var paraId = getParaId(destination);
|
|
4700
|
+
var parameters = [createHeaderPolkadotXCM('RelayToPara', version, paraId), generateAddressPayload(api, 'RelayToPara', null, address, version, paraId), createCurrencySpecification(amount, 'RelayToPara', version, destination), 0];
|
|
4701
|
+
if (includeFee) {
|
|
4702
|
+
parameters.push('Unlimited');
|
|
4703
|
+
}
|
|
4704
|
+
return parameters;
|
|
4705
|
+
};
|
|
4706
|
+
|
|
4751
4707
|
var supportsXTokens = function supportsXTokens(obj) {
|
|
4752
4708
|
return 'transferXTokens' in obj;
|
|
4753
4709
|
};
|
|
@@ -4757,6 +4713,7 @@ var supportsPolkadotXCM = function supportsPolkadotXCM(obj) {
|
|
|
4757
4713
|
var ParachainNode = /*#__PURE__*/function () {
|
|
4758
4714
|
function ParachainNode(node, name, type, version) {
|
|
4759
4715
|
_classCallCheck(this, ParachainNode);
|
|
4716
|
+
this._assetCheckEnabled = true;
|
|
4760
4717
|
this._name = name;
|
|
4761
4718
|
this._type = type;
|
|
4762
4719
|
this._node = node;
|
|
@@ -4782,12 +4739,17 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
4782
4739
|
get: function get() {
|
|
4783
4740
|
return this._version;
|
|
4784
4741
|
}
|
|
4742
|
+
}, {
|
|
4743
|
+
key: "assetCheckEnabled",
|
|
4744
|
+
get: function get() {
|
|
4745
|
+
return this._assetCheckEnabled;
|
|
4746
|
+
}
|
|
4785
4747
|
}, {
|
|
4786
4748
|
key: "transfer",
|
|
4787
4749
|
value: function transfer(api, currencySymbol, currencyId, amount, to, destination) {
|
|
4788
4750
|
var serializedApiCallEnabled = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : false;
|
|
4789
|
-
var scenario = destination ? 'ParaToPara' : 'ParaToRelay';
|
|
4790
|
-
var paraId = destination ? getParaId(destination) : undefined;
|
|
4751
|
+
var scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
|
|
4752
|
+
var paraId = destination !== undefined ? getParaId(destination) : undefined;
|
|
4791
4753
|
if (supportsXTokens(this)) {
|
|
4792
4754
|
return this.transferXTokens({
|
|
4793
4755
|
api: api,
|
|
@@ -4813,10 +4775,20 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
4813
4775
|
throw new NoXCMSupportImplementedError(this._node);
|
|
4814
4776
|
}
|
|
4815
4777
|
}
|
|
4778
|
+
}, {
|
|
4779
|
+
key: "transferRelayToPara",
|
|
4780
|
+
value: function transferRelayToPara(options) {
|
|
4781
|
+
return {
|
|
4782
|
+
module: 'xcmPallet',
|
|
4783
|
+
section: 'reserveTransferAssets',
|
|
4784
|
+
parameters: constructRelayToParaParameters(options, exports.Version.V3)
|
|
4785
|
+
};
|
|
4786
|
+
}
|
|
4816
4787
|
}]);
|
|
4817
4788
|
return ParachainNode;
|
|
4818
4789
|
}();
|
|
4819
4790
|
|
|
4791
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
4820
4792
|
var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
4821
4793
|
function XTokensTransferImpl() {
|
|
4822
4794
|
_classCallCheck(this, XTokensTransferImpl);
|
|
@@ -4831,7 +4803,7 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
|
4831
4803
|
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Unlimited';
|
|
4832
4804
|
var pallet = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'XTokens';
|
|
4833
4805
|
var module = lowercaseFirstLetter(pallet.toString());
|
|
4834
|
-
if (serializedApiCallEnabled) {
|
|
4806
|
+
if (serializedApiCallEnabled === true) {
|
|
4835
4807
|
return {
|
|
4836
4808
|
module: module,
|
|
4837
4809
|
section: 'transfer',
|
|
@@ -4856,7 +4828,7 @@ var Acala$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4856
4828
|
value: function transferXTokens(input) {
|
|
4857
4829
|
var currency = input.currency,
|
|
4858
4830
|
currencyID = input.currencyID;
|
|
4859
|
-
var currencySelection = currencyID ? {
|
|
4831
|
+
var currencySelection = currencyID !== undefined ? {
|
|
4860
4832
|
ForeignAsset: currencyID
|
|
4861
4833
|
} : {
|
|
4862
4834
|
Token: currency
|
|
@@ -4914,7 +4886,7 @@ var Crust$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4914
4886
|
if (currency === 'CRU') {
|
|
4915
4887
|
return 'SelfReserve';
|
|
4916
4888
|
}
|
|
4917
|
-
if (
|
|
4889
|
+
if (currencyID === undefined) {
|
|
4918
4890
|
throw new InvalidCurrencyError("Asset ".concat(currency, " is not supported by node ").concat(this.node, "."));
|
|
4919
4891
|
}
|
|
4920
4892
|
return {
|
|
@@ -4942,7 +4914,7 @@ var BifrostPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4942
4914
|
value: function transferXTokens(input) {
|
|
4943
4915
|
// Multiple asset options need addressing
|
|
4944
4916
|
var currencySelection = {
|
|
4945
|
-
|
|
4917
|
+
Native: input.currency
|
|
4946
4918
|
};
|
|
4947
4919
|
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
4948
4920
|
}
|
|
@@ -4996,7 +4968,7 @@ var Clover$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
4996
4968
|
if (currency === 'CLV') {
|
|
4997
4969
|
return 'SelfReserve';
|
|
4998
4970
|
}
|
|
4999
|
-
if (
|
|
4971
|
+
if (currencyID === undefined) {
|
|
5000
4972
|
throw new InvalidCurrencyError("Asset ".concat(currency, " is not supported by node ").concat(this.node, "."));
|
|
5001
4973
|
}
|
|
5002
4974
|
return {
|
|
@@ -5019,7 +4991,14 @@ var ComposableFinance$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5019
4991
|
_classCallCheck(this, ComposableFinance);
|
|
5020
4992
|
return _super.call(this, 'ComposableFinance', 'composable', 'polkadot', exports.Version.V3);
|
|
5021
4993
|
}
|
|
5022
|
-
|
|
4994
|
+
_createClass(ComposableFinance, [{
|
|
4995
|
+
key: "transferXTokens",
|
|
4996
|
+
value: function transferXTokens(input) {
|
|
4997
|
+
var currencyID = input.currencyID;
|
|
4998
|
+
return XTokensTransferImpl.transferXTokens(input, currencyID);
|
|
4999
|
+
}
|
|
5000
|
+
}]);
|
|
5001
|
+
return ComposableFinance;
|
|
5023
5002
|
}(ParachainNode);
|
|
5024
5003
|
|
|
5025
5004
|
var HydraDX$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
@@ -5051,7 +5030,7 @@ var Interlay$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5051
5030
|
value: function transferXTokens(input) {
|
|
5052
5031
|
var currency = input.currency,
|
|
5053
5032
|
currencyID = input.currencyID;
|
|
5054
|
-
var currencySelection = currencyID ? {
|
|
5033
|
+
var currencySelection = currencyID !== undefined ? {
|
|
5055
5034
|
ForeignAsset: currencyID
|
|
5056
5035
|
} : {
|
|
5057
5036
|
Token: currency
|
|
@@ -5113,6 +5092,15 @@ var Moonbeam$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5113
5092
|
};
|
|
5114
5093
|
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
5115
5094
|
}
|
|
5095
|
+
}, {
|
|
5096
|
+
key: "transferRelayToPara",
|
|
5097
|
+
value: function transferRelayToPara(options) {
|
|
5098
|
+
return {
|
|
5099
|
+
module: 'xcmPallet',
|
|
5100
|
+
section: 'limitedReserveTransferAssets',
|
|
5101
|
+
parameters: constructRelayToParaParameters(options, exports.Version.V3, true)
|
|
5102
|
+
};
|
|
5103
|
+
}
|
|
5116
5104
|
}]);
|
|
5117
5105
|
return Moonbeam;
|
|
5118
5106
|
}(ParachainNode);
|
|
@@ -5217,9 +5205,10 @@ var BifrostKusama$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5217
5205
|
key: "transferXTokens",
|
|
5218
5206
|
value: function transferXTokens(input) {
|
|
5219
5207
|
// Multiple asset options need addressing
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
}
|
|
5208
|
+
var currencySelection = {
|
|
5209
|
+
Native: input.currency
|
|
5210
|
+
};
|
|
5211
|
+
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
5223
5212
|
}
|
|
5224
5213
|
}]);
|
|
5225
5214
|
return BifrostKusama;
|
|
@@ -5230,7 +5219,7 @@ var Pioneer$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5230
5219
|
var _super = _createSuper(Pioneer);
|
|
5231
5220
|
function Pioneer() {
|
|
5232
5221
|
_classCallCheck(this, Pioneer);
|
|
5233
|
-
return _super.call(this, 'Pioneer', '
|
|
5222
|
+
return _super.call(this, 'Pioneer', 'pioneer', 'kusama', exports.Version.V1);
|
|
5234
5223
|
}
|
|
5235
5224
|
_createClass(Pioneer, [{
|
|
5236
5225
|
key: "transferXTokens",
|
|
@@ -5308,6 +5297,15 @@ var Moonriver$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5308
5297
|
};
|
|
5309
5298
|
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
5310
5299
|
}
|
|
5300
|
+
}, {
|
|
5301
|
+
key: "transferRelayToPara",
|
|
5302
|
+
value: function transferRelayToPara(options) {
|
|
5303
|
+
return {
|
|
5304
|
+
module: 'xcmPallet',
|
|
5305
|
+
section: 'limitedReserveTransferAssets',
|
|
5306
|
+
parameters: constructRelayToParaParameters(options, exports.Version.V3, true)
|
|
5307
|
+
};
|
|
5308
|
+
}
|
|
5311
5309
|
}]);
|
|
5312
5310
|
return Moonriver;
|
|
5313
5311
|
}(ParachainNode);
|
|
@@ -5357,7 +5355,7 @@ var Kintsugi$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5357
5355
|
value: function transferXTokens(input) {
|
|
5358
5356
|
var currency = input.currency,
|
|
5359
5357
|
currencyID = input.currencyID;
|
|
5360
|
-
var currencySelection = currencyID ? {
|
|
5358
|
+
var currencySelection = currencyID !== undefined ? {
|
|
5361
5359
|
ForeignAsset: currencyID
|
|
5362
5360
|
} : {
|
|
5363
5361
|
Token: currency
|
|
@@ -5404,7 +5402,7 @@ var CrustShadow$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5404
5402
|
if (currency === 'CSM') {
|
|
5405
5403
|
return 'SelfReserve';
|
|
5406
5404
|
}
|
|
5407
|
-
if (
|
|
5405
|
+
if (currencyID === undefined) {
|
|
5408
5406
|
throw new InvalidCurrencyError("Asset ".concat(currency, " is not supported by node ").concat(this.node, "."));
|
|
5409
5407
|
}
|
|
5410
5408
|
return {
|
|
@@ -5444,7 +5442,7 @@ var NodeNotSupportedError = /*#__PURE__*/function (_Error) {
|
|
|
5444
5442
|
function NodeNotSupportedError(message) {
|
|
5445
5443
|
var _this;
|
|
5446
5444
|
_classCallCheck(this, NodeNotSupportedError);
|
|
5447
|
-
_this = _super.call(this, message);
|
|
5445
|
+
_this = _super.call(this, message !== null && message !== void 0 ? message : 'These nodes do not support XCM transfers from Relay / to Relay chain.');
|
|
5448
5446
|
_this.name = 'NodeNotSupported';
|
|
5449
5447
|
return _this;
|
|
5450
5448
|
}
|
|
@@ -5491,6 +5489,11 @@ var Integritee$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5491
5489
|
if (input.currency === 'KSM') throw new InvalidCurrencyError("Node ".concat(this.node, " does not support currency KSM"));
|
|
5492
5490
|
return XTokensTransferImpl.transferXTokens(input, input.currency);
|
|
5493
5491
|
}
|
|
5492
|
+
}, {
|
|
5493
|
+
key: "transferRelayToPara",
|
|
5494
|
+
value: function transferRelayToPara() {
|
|
5495
|
+
throw new NodeNotSupportedError();
|
|
5496
|
+
}
|
|
5494
5497
|
}]);
|
|
5495
5498
|
return Integritee;
|
|
5496
5499
|
}(ParachainNode);
|
|
@@ -5524,7 +5527,7 @@ var Karura$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5524
5527
|
value: function transferXTokens(input) {
|
|
5525
5528
|
var currency = input.currency,
|
|
5526
5529
|
currencyID = input.currencyID;
|
|
5527
|
-
var currencySelection = currencyID ? {
|
|
5530
|
+
var currencySelection = currencyID !== undefined ? {
|
|
5528
5531
|
ForeignAsset: currencyID
|
|
5529
5532
|
} : {
|
|
5530
5533
|
Token: currency
|
|
@@ -5536,6 +5539,7 @@ var Karura$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5536
5539
|
}(ParachainNode);
|
|
5537
5540
|
|
|
5538
5541
|
// Contains basic structure of polkadotXCM call
|
|
5542
|
+
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
5539
5543
|
var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
|
|
5540
5544
|
function PolkadotXCMTransferImpl() {
|
|
5541
5545
|
_classCallCheck(this, PolkadotXCMTransferImpl);
|
|
@@ -5549,14 +5553,14 @@ var PolkadotXCMTransferImpl = /*#__PURE__*/function () {
|
|
|
5549
5553
|
currencySelection = _ref.currencySelection,
|
|
5550
5554
|
serializedApiCallEnabled = _ref.serializedApiCallEnabled;
|
|
5551
5555
|
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
|
|
5552
|
-
if (serializedApiCallEnabled) {
|
|
5556
|
+
if (serializedApiCallEnabled === true) {
|
|
5553
5557
|
return {
|
|
5554
5558
|
module: 'polkadotXcm',
|
|
5555
5559
|
section: method,
|
|
5556
|
-
parameters: [header, addressSelection, currencySelection, 0].concat(_toConsumableArray(fees ? [fees] : []))
|
|
5560
|
+
parameters: [header, addressSelection, currencySelection, 0].concat(_toConsumableArray(fees !== undefined ? [fees] : []))
|
|
5557
5561
|
};
|
|
5558
5562
|
}
|
|
5559
|
-
return fees ? api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0, fees) : api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0);
|
|
5563
|
+
return fees !== undefined ? api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0, fees) : api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0);
|
|
5560
5564
|
}
|
|
5561
5565
|
}]);
|
|
5562
5566
|
return PolkadotXCMTransferImpl;
|
|
@@ -5576,6 +5580,15 @@ var AssetHubPolkadot$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5576
5580
|
// TESTED https://polkadot.subscan.io/xcm_message/polkadot-c01158ff1a5c5a596138ed9d0f0f2bccc1d9c51d
|
|
5577
5581
|
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limitedTeleportAssets', 'Unlimited');
|
|
5578
5582
|
}
|
|
5583
|
+
}, {
|
|
5584
|
+
key: "transferRelayToPara",
|
|
5585
|
+
value: function transferRelayToPara(options) {
|
|
5586
|
+
return {
|
|
5587
|
+
module: 'xcmPallet',
|
|
5588
|
+
section: 'limitedTeleportAssets',
|
|
5589
|
+
parameters: constructRelayToParaParameters(options, exports.Version.V3, true)
|
|
5590
|
+
};
|
|
5591
|
+
}
|
|
5579
5592
|
}]);
|
|
5580
5593
|
return AssetHubPolkadot;
|
|
5581
5594
|
}(ParachainNode);
|
|
@@ -5594,6 +5607,15 @@ var AssetHubKusama$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5594
5607
|
// TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
|
|
5595
5608
|
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limitedTeleportAssets', 'Unlimited');
|
|
5596
5609
|
}
|
|
5610
|
+
}, {
|
|
5611
|
+
key: "transferRelayToPara",
|
|
5612
|
+
value: function transferRelayToPara(options) {
|
|
5613
|
+
return {
|
|
5614
|
+
module: 'xcmPallet',
|
|
5615
|
+
section: 'limitedTeleportAssets',
|
|
5616
|
+
parameters: constructRelayToParaParameters(options, exports.Version.V3, true)
|
|
5617
|
+
};
|
|
5618
|
+
}
|
|
5597
5619
|
}]);
|
|
5598
5620
|
return AssetHubKusama;
|
|
5599
5621
|
}(ParachainNode);
|
|
@@ -5615,6 +5637,15 @@ var Encointer$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5615
5637
|
}
|
|
5616
5638
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
5617
5639
|
}
|
|
5640
|
+
}, {
|
|
5641
|
+
key: "transferRelayToPara",
|
|
5642
|
+
value: function transferRelayToPara(options) {
|
|
5643
|
+
return {
|
|
5644
|
+
module: 'xcmPallet',
|
|
5645
|
+
section: 'limitedTeleportAssets',
|
|
5646
|
+
parameters: constructRelayToParaParameters(options, exports.Version.V1, true)
|
|
5647
|
+
};
|
|
5648
|
+
}
|
|
5618
5649
|
}]);
|
|
5619
5650
|
return Encointer;
|
|
5620
5651
|
}(ParachainNode);
|
|
@@ -5628,20 +5659,18 @@ var Robonomics$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5628
5659
|
}
|
|
5629
5660
|
_createClass(Robonomics, [{
|
|
5630
5661
|
key: "transferPolkadotXCM",
|
|
5631
|
-
value: function transferPolkadotXCM(
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
// TESTED https://robonomics.subscan.io/xcm_message/kusama-20b03208c99f2ef29d2d4b4cd4bc5659e54311ea
|
|
5639
|
-
var method = scenario === 'ParaToPara' ? 'reserveTransferAssets' : 'reserveWithdrawAssets';
|
|
5640
|
-
return api.tx.polkadotXcm[method](header, addressSelection, currencySelection, 0);
|
|
5662
|
+
value: function transferPolkadotXCM(input) {
|
|
5663
|
+
if (input.scenario === 'ParaToPara') {
|
|
5664
|
+
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limitedReserveTransferAssets', {
|
|
5665
|
+
Limited: Robonomics.FEE
|
|
5666
|
+
});
|
|
5667
|
+
}
|
|
5668
|
+
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserveWithdrawAssets');
|
|
5641
5669
|
}
|
|
5642
5670
|
}]);
|
|
5643
5671
|
return Robonomics;
|
|
5644
5672
|
}(ParachainNode);
|
|
5673
|
+
Robonomics$1.FEE = '400000000';
|
|
5645
5674
|
|
|
5646
5675
|
var Astar$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
5647
5676
|
_inherits(Astar, _ParachainNode);
|
|
@@ -5694,6 +5723,11 @@ var Darwinia$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5694
5723
|
}
|
|
5695
5724
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
5696
5725
|
}
|
|
5726
|
+
}, {
|
|
5727
|
+
key: "transferRelayToPara",
|
|
5728
|
+
value: function transferRelayToPara() {
|
|
5729
|
+
throw new NodeNotSupportedError();
|
|
5730
|
+
}
|
|
5697
5731
|
}]);
|
|
5698
5732
|
return Darwinia;
|
|
5699
5733
|
}(ParachainNode);
|
|
@@ -5714,6 +5748,11 @@ var Crab$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5714
5748
|
}
|
|
5715
5749
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
5716
5750
|
}
|
|
5751
|
+
}, {
|
|
5752
|
+
key: "transferRelayToPara",
|
|
5753
|
+
value: function transferRelayToPara() {
|
|
5754
|
+
throw new NodeNotSupportedError();
|
|
5755
|
+
}
|
|
5717
5756
|
}]);
|
|
5718
5757
|
return Crab;
|
|
5719
5758
|
}(ParachainNode);
|
|
@@ -5722,17 +5761,19 @@ var Quartz$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5722
5761
|
_inherits(Quartz, _ParachainNode);
|
|
5723
5762
|
var _super = _createSuper(Quartz);
|
|
5724
5763
|
function Quartz() {
|
|
5764
|
+
var _this;
|
|
5725
5765
|
_classCallCheck(this, Quartz);
|
|
5726
|
-
|
|
5766
|
+
_this = _super.call(this, 'Quartz', 'quartz', 'kusama', exports.Version.V3);
|
|
5767
|
+
_this._assetCheckEnabled = false;
|
|
5768
|
+
return _this;
|
|
5727
5769
|
}
|
|
5728
5770
|
_createClass(Quartz, [{
|
|
5729
|
-
key: "
|
|
5730
|
-
value: function
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
}
|
|
5735
|
-
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
5771
|
+
key: "transferXTokens",
|
|
5772
|
+
value: function transferXTokens(input) {
|
|
5773
|
+
var currencyID = input.currencyID;
|
|
5774
|
+
return XTokensTransferImpl.transferXTokens(input, {
|
|
5775
|
+
ForeignAssetId: currencyID
|
|
5776
|
+
});
|
|
5736
5777
|
}
|
|
5737
5778
|
}]);
|
|
5738
5779
|
return Quartz;
|
|
@@ -5762,13 +5803,13 @@ var Manta$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5762
5803
|
var _super = _createSuper(Manta);
|
|
5763
5804
|
function Manta() {
|
|
5764
5805
|
_classCallCheck(this, Manta);
|
|
5765
|
-
return _super.call(this, 'Manta', 'manta', 'polkadot', exports.Version.
|
|
5806
|
+
return _super.call(this, 'Manta', 'manta', 'polkadot', exports.Version.V1);
|
|
5766
5807
|
}
|
|
5767
5808
|
_createClass(Manta, [{
|
|
5768
5809
|
key: "transferXTokens",
|
|
5769
5810
|
value: function transferXTokens(input) {
|
|
5770
5811
|
return XTokensTransferImpl.transferXTokens(input, {
|
|
5771
|
-
|
|
5812
|
+
MantaCurrency: input.currencyID
|
|
5772
5813
|
});
|
|
5773
5814
|
}
|
|
5774
5815
|
}]);
|
|
@@ -5812,6 +5853,11 @@ var Nodle$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5812
5853
|
}
|
|
5813
5854
|
return XTokensTransferImpl.transferXTokens(input, 'NodleNative');
|
|
5814
5855
|
}
|
|
5856
|
+
}, {
|
|
5857
|
+
key: "transferRelayToPara",
|
|
5858
|
+
value: function transferRelayToPara() {
|
|
5859
|
+
throw new NodeNotSupportedError();
|
|
5860
|
+
}
|
|
5815
5861
|
}]);
|
|
5816
5862
|
return Nodle;
|
|
5817
5863
|
}(ParachainNode);
|
|
@@ -5852,6 +5898,11 @@ var Pendulum$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5852
5898
|
XCM: input.currencyID
|
|
5853
5899
|
});
|
|
5854
5900
|
}
|
|
5901
|
+
}, {
|
|
5902
|
+
key: "transferRelayToPara",
|
|
5903
|
+
value: function transferRelayToPara() {
|
|
5904
|
+
throw new NodeNotSupportedError();
|
|
5905
|
+
}
|
|
5855
5906
|
}]);
|
|
5856
5907
|
return Pendulum;
|
|
5857
5908
|
}(ParachainNode);
|
|
@@ -5882,9 +5933,10 @@ var Zeitgeist$1 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
5882
5933
|
_createClass(Zeitgeist, [{
|
|
5883
5934
|
key: "transferXTokens",
|
|
5884
5935
|
value: function transferXTokens(input) {
|
|
5885
|
-
|
|
5936
|
+
var currencySelection = input.currency === 'ZTG' ? 'Ztg' : {
|
|
5886
5937
|
ForeignAsset: input.currencyID
|
|
5887
|
-
}
|
|
5938
|
+
};
|
|
5939
|
+
return XTokensTransferImpl.transferXTokens(input, currencySelection);
|
|
5888
5940
|
}
|
|
5889
5941
|
}]);
|
|
5890
5942
|
return Zeitgeist;
|
|
@@ -6019,6 +6071,7 @@ var generateAddressPayload = function generateAddressPayload(api, scenario, pall
|
|
|
6019
6071
|
}
|
|
6020
6072
|
};
|
|
6021
6073
|
};
|
|
6074
|
+
// TODO: Refactor this function
|
|
6022
6075
|
var createCurrencySpecification = function createCurrencySpecification(amount, scenario, version, node, cur) {
|
|
6023
6076
|
if (scenario === 'ParaToRelay') {
|
|
6024
6077
|
return _defineProperty({}, version, [{
|
|
@@ -6076,6 +6129,19 @@ var createCurrencySpecification = function createCurrencySpecification(amount, s
|
|
|
6076
6129
|
}]
|
|
6077
6130
|
};
|
|
6078
6131
|
}
|
|
6132
|
+
if (scenario === 'ParaToPara' && node === 'Robonomics') {
|
|
6133
|
+
return _defineProperty({}, version, [{
|
|
6134
|
+
id: {
|
|
6135
|
+
Concrete: {
|
|
6136
|
+
parents: 0,
|
|
6137
|
+
interior: 'Here'
|
|
6138
|
+
}
|
|
6139
|
+
},
|
|
6140
|
+
fun: {
|
|
6141
|
+
Fungible: amount
|
|
6142
|
+
}
|
|
6143
|
+
}]);
|
|
6144
|
+
}
|
|
6079
6145
|
// Otherwise
|
|
6080
6146
|
return {
|
|
6081
6147
|
V3: [{
|
|
@@ -6127,37 +6193,26 @@ var getNodeEndpointOption = function getNodeEndpointOption(node) {
|
|
|
6127
6193
|
var _getNode = getNode(node),
|
|
6128
6194
|
type = _getNode.type,
|
|
6129
6195
|
name = _getNode.name;
|
|
6130
|
-
var
|
|
6131
|
-
linked =
|
|
6196
|
+
var _ref9 = type === 'polkadot' ? endpoints.prodRelayPolkadot : endpoints.prodRelayKusama,
|
|
6197
|
+
linked = _ref9.linked;
|
|
6132
6198
|
// TMP Fix because some nodes don't have providers in endpoint options
|
|
6133
|
-
if (node === '
|
|
6134
|
-
return {
|
|
6135
|
-
info: 'imbue',
|
|
6136
|
-
paraId: 2121,
|
|
6137
|
-
providers: {
|
|
6138
|
-
'Imbue Network 0': 'wss://kusama.imbuenetwork.com'
|
|
6139
|
-
}
|
|
6140
|
-
};
|
|
6141
|
-
}
|
|
6142
|
-
if (node === 'Polkadex') {
|
|
6199
|
+
if (node === 'Kylin') {
|
|
6143
6200
|
return {
|
|
6144
|
-
info: '
|
|
6145
|
-
paraId:
|
|
6201
|
+
info: 'kylin',
|
|
6202
|
+
paraId: 2052,
|
|
6146
6203
|
providers: {
|
|
6147
|
-
|
|
6148
|
-
OnFinality: 'wss://polkadex-parachain.api.onfinality.io/public-ws',
|
|
6149
|
-
RadiumBlock: 'wss://polkadex-parachain.public.curie.radiumblock.co/ws'
|
|
6204
|
+
'Kylin Network': 'wss://polkadot.kylin-node.co.uk'
|
|
6150
6205
|
}
|
|
6151
6206
|
};
|
|
6152
6207
|
}
|
|
6153
|
-
return linked ? linked.find(function (o) {
|
|
6208
|
+
return linked !== undefined ? linked.find(function (o) {
|
|
6154
6209
|
return o.info === name;
|
|
6155
6210
|
}) : undefined;
|
|
6156
6211
|
};
|
|
6157
6212
|
var getAllNodeProviders = function getAllNodeProviders(node) {
|
|
6158
6213
|
var _a;
|
|
6159
|
-
var
|
|
6160
|
-
providers =
|
|
6214
|
+
var _ref10 = (_a = getNodeEndpointOption(node)) !== null && _a !== void 0 ? _a : {},
|
|
6215
|
+
providers = _ref10.providers;
|
|
6161
6216
|
return Object.values(providers !== null && providers !== void 0 ? providers : []);
|
|
6162
6217
|
};
|
|
6163
6218
|
var getNodeProvider = function getNodeProvider(node) {
|
|
@@ -6167,11 +6222,11 @@ var getNodeProvider = function getNodeProvider(node) {
|
|
|
6167
6222
|
var lowercaseFirstLetter = function lowercaseFirstLetter(str) {
|
|
6168
6223
|
return str.charAt(0).toLowerCase() + str.slice(1);
|
|
6169
6224
|
};
|
|
6170
|
-
var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api,
|
|
6225
|
+
var callPolkadotJsTxFunction = function callPolkadotJsTxFunction(api, _ref11) {
|
|
6171
6226
|
var _api$tx$module;
|
|
6172
|
-
var module =
|
|
6173
|
-
section =
|
|
6174
|
-
parameters =
|
|
6227
|
+
var module = _ref11.module,
|
|
6228
|
+
section = _ref11.section,
|
|
6229
|
+
parameters = _ref11.parameters;
|
|
6175
6230
|
return (_api$tx$module = api.tx[module])[section].apply(_api$tx$module, _toConsumableArray(parameters));
|
|
6176
6231
|
};
|
|
6177
6232
|
|
|
@@ -6185,7 +6240,7 @@ var getAssetBySymbolOrId = function getAssetBySymbolOrId(node, symbolOrId) {
|
|
|
6185
6240
|
assetId = _ref.assetId;
|
|
6186
6241
|
return symbol === symbolOrId || assetId === symbolOrId;
|
|
6187
6242
|
});
|
|
6188
|
-
if (asset) {
|
|
6243
|
+
if (asset !== undefined) {
|
|
6189
6244
|
var symbol = asset.symbol,
|
|
6190
6245
|
assetId = asset.assetId;
|
|
6191
6246
|
return {
|
|
@@ -6206,73 +6261,47 @@ var sendCommon = function sendCommon(api, origin, currencySymbolOrId, amount, to
|
|
|
6206
6261
|
throw new InvalidCurrencyError('The provided asset ID is larger than the maximum safe integer value. Please provide it as a string.');
|
|
6207
6262
|
}
|
|
6208
6263
|
var asset = getAssetBySymbolOrId(origin, currencySymbolOrId.toString());
|
|
6209
|
-
if (destination) {
|
|
6264
|
+
if (destination !== undefined) {
|
|
6210
6265
|
var originRelayChainSymbol = getRelayChainSymbol(origin);
|
|
6211
6266
|
var destinationRelayChainSymbol = getRelayChainSymbol(destination);
|
|
6212
6267
|
if (originRelayChainSymbol !== destinationRelayChainSymbol) {
|
|
6213
6268
|
throw new IncompatibleNodesError();
|
|
6214
6269
|
}
|
|
6215
6270
|
}
|
|
6216
|
-
|
|
6271
|
+
var originNode = getNode(origin);
|
|
6272
|
+
if (asset === null && originNode.assetCheckEnabled) {
|
|
6217
6273
|
throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency or currencyId ").concat(currencySymbolOrId, "."));
|
|
6218
6274
|
}
|
|
6219
|
-
if (destination && asset.symbol && !hasSupportForAsset(destination, asset.symbol)) {
|
|
6275
|
+
if (destination !== undefined && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && getNode(destination).assetCheckEnabled && !hasSupportForAsset(destination, asset.symbol)) {
|
|
6220
6276
|
throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency or currencyId ").concat(currencySymbolOrId, "."));
|
|
6221
6277
|
}
|
|
6222
|
-
var
|
|
6223
|
-
|
|
6224
|
-
return getNode(origin).transfer(api, currencySymbol, currencyId, amount, to, destination, serializedApiCallEnabled);
|
|
6278
|
+
var currencyId = originNode.assetCheckEnabled ? asset === null || asset === void 0 ? void 0 : asset.assetId : currencySymbolOrId.toString();
|
|
6279
|
+
return originNode.transfer(api, asset === null || asset === void 0 ? void 0 : asset.symbol, currencyId, amount, to, destination, serializedApiCallEnabled);
|
|
6225
6280
|
};
|
|
6226
6281
|
var sendSerializedApiCall = function sendSerializedApiCall(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
6227
|
-
return sendCommon(api, origin, currencySymbolOrId, amount, to, destination, true);
|
|
6282
|
+
return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination, true);
|
|
6228
6283
|
};
|
|
6229
6284
|
function send(api, origin, currencySymbolOrId, amount, to, destination) {
|
|
6230
|
-
return sendCommon(api, origin, currencySymbolOrId, amount, to, destination);
|
|
6285
|
+
return sendCommon(api, origin, currencySymbolOrId, amount.toString(), to, destination);
|
|
6231
6286
|
}
|
|
6232
|
-
|
|
6233
|
-
var transferRelayToParaCommon = function transferRelayToParaCommon(api, destination, amount, to) {
|
|
6287
|
+
var transferRelayToParaCommon = function transferRelayToParaCommon(api, destination, amount, address) {
|
|
6234
6288
|
var serializedApiCallEnabled = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
6235
|
-
var
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
parameters: [createHeaderPolkadotXCM('RelayToPara', exports.Version.V3, paraId), generateAddressPayload(api, 'RelayToPara', null, to, exports.Version.V3, paraId), createCurrencySpecification(amount, 'RelayToPara', exports.Version.V3, destination), 0, 'Unlimited']
|
|
6242
|
-
};
|
|
6243
|
-
if (serializedApiCallEnabled) {
|
|
6244
|
-
return _serializedApiCall;
|
|
6245
|
-
}
|
|
6246
|
-
return callPolkadotJsTxFunction(api, _serializedApiCall);
|
|
6247
|
-
} else if (destination === 'Encointer') {
|
|
6248
|
-
var _serializedApiCall2 = {
|
|
6249
|
-
module: 'xcmPallet',
|
|
6250
|
-
section: 'limitedTeleportAssets',
|
|
6251
|
-
parameters: [createHeaderPolkadotXCM('RelayToPara', exports.Version.V1, paraId), generateAddressPayload(api, 'RelayToPara', null, to, exports.Version.V1, paraId), createCurrencySpecification(amount, 'RelayToPara', exports.Version.V1, destination), 0, 'Unlimited']
|
|
6252
|
-
};
|
|
6253
|
-
if (serializedApiCallEnabled) {
|
|
6254
|
-
return _serializedApiCall2;
|
|
6255
|
-
}
|
|
6256
|
-
return callPolkadotJsTxFunction(api, _serializedApiCall2);
|
|
6257
|
-
} else if (destination === 'Darwinia' || destination === 'Crab' || destination === 'Integritee' || destination === 'Nodle' || destination === 'Pendulum') {
|
|
6258
|
-
// Do not do anything because Darwinia and Crab does not have DOT and KSM registered
|
|
6259
|
-
throw new NodeNotSupportedError('These nodes do not support XCM transfers from Relay / to Relay chain.');
|
|
6260
|
-
}
|
|
6261
|
-
var serializedApiCall = {
|
|
6262
|
-
module: 'xcmPallet',
|
|
6263
|
-
section: 'reserveTransferAssets',
|
|
6264
|
-
parameters: [createHeaderPolkadotXCM('RelayToPara', exports.Version.V3, paraId), generateAddressPayload(api, 'RelayToPara', null, to, exports.Version.V3, paraId), createCurrencySpecification(amount, 'RelayToPara', exports.Version.V3, destination), 0]
|
|
6265
|
-
};
|
|
6289
|
+
var serializedApiCall = getNode(destination).transferRelayToPara({
|
|
6290
|
+
api: api,
|
|
6291
|
+
destination: destination,
|
|
6292
|
+
address: address,
|
|
6293
|
+
amount: amount
|
|
6294
|
+
});
|
|
6266
6295
|
if (serializedApiCallEnabled) {
|
|
6267
6296
|
return serializedApiCall;
|
|
6268
6297
|
}
|
|
6269
6298
|
return callPolkadotJsTxFunction(api, serializedApiCall);
|
|
6270
6299
|
};
|
|
6271
6300
|
function transferRelayToPara(api, destination, amount, to) {
|
|
6272
|
-
return transferRelayToParaCommon(api, destination, amount, to);
|
|
6301
|
+
return transferRelayToParaCommon(api, destination, amount.toString(), to);
|
|
6273
6302
|
}
|
|
6274
6303
|
var transferRelayToParaSerializedApiCall = function transferRelayToParaSerializedApiCall(api, destination, amount, to) {
|
|
6275
|
-
return transferRelayToParaCommon(api, destination, amount, to, true);
|
|
6304
|
+
return transferRelayToParaCommon(api, destination, amount.toString(), to, true);
|
|
6276
6305
|
};
|
|
6277
6306
|
|
|
6278
6307
|
var index$3 = /*#__PURE__*/Object.freeze({
|
|
@@ -6284,7 +6313,7 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
6284
6313
|
transferRelayToParaSerializedApiCall: transferRelayToParaSerializedApiCall
|
|
6285
6314
|
});
|
|
6286
6315
|
|
|
6287
|
-
//Contains XYK Decentralized exchange functions implemented in collaboration with Basilisk team
|
|
6316
|
+
// Contains XYK Decentralized exchange functions implemented in collaboration with Basilisk team
|
|
6288
6317
|
function addLiquidity(api, assetA, assetB, amountA, amountBMaxLimit) {
|
|
6289
6318
|
return api.tx.xyk.addLiquidity(assetA, assetB, amountA, amountBMaxLimit);
|
|
6290
6319
|
}
|
|
@@ -6861,9 +6890,9 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
6861
6890
|
}]);
|
|
6862
6891
|
return GeneralBuilder;
|
|
6863
6892
|
}();
|
|
6864
|
-
function Builder(api) {
|
|
6893
|
+
var Builder = function Builder(api) {
|
|
6865
6894
|
return new GeneralBuilder(api);
|
|
6866
|
-
}
|
|
6895
|
+
};
|
|
6867
6896
|
|
|
6868
6897
|
var AssetHubPolkadot = {
|
|
6869
6898
|
defaultPallet: "PolkadotXcm",
|