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