@paraspell/sdk 7.0.1 → 7.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -13
- package/dist/index.cjs +543 -185
- package/dist/index.d.ts +74 -57
- package/dist/index.mjs +543 -185
- package/dist/papi/index.cjs +541 -185
- package/dist/papi/index.d.ts +63 -46
- package/dist/papi/index.mjs +541 -185
- package/package.json +1 -1
package/dist/papi/index.cjs
CHANGED
|
@@ -494,8 +494,8 @@ function _superPropBase(t, o) {
|
|
|
494
494
|
return t;
|
|
495
495
|
}
|
|
496
496
|
function _superPropGet(t, o, e, r) {
|
|
497
|
-
var p = _get(_getPrototypeOf(t.prototype ), o, e);
|
|
498
|
-
return "function" == typeof p ? function (t) {
|
|
497
|
+
var p = _get(_getPrototypeOf(1 & r ? t.prototype : t), o, e);
|
|
498
|
+
return 2 & r && "function" == typeof p ? function (t) {
|
|
499
499
|
return p.apply(e, t);
|
|
500
500
|
} : p;
|
|
501
501
|
}
|
|
@@ -506,11 +506,11 @@ function _toPrimitive(t, r) {
|
|
|
506
506
|
if ("object" != typeof t || !t) return t;
|
|
507
507
|
var e = t[Symbol.toPrimitive];
|
|
508
508
|
if (void 0 !== e) {
|
|
509
|
-
var i = e.call(t, r);
|
|
509
|
+
var i = e.call(t, r || "default");
|
|
510
510
|
if ("object" != typeof i) return i;
|
|
511
511
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
512
512
|
}
|
|
513
|
-
return (String )(t);
|
|
513
|
+
return ("string" === r ? String : Number)(t);
|
|
514
514
|
}
|
|
515
515
|
function _toPropertyKey(t) {
|
|
516
516
|
var i = _toPrimitive(t, "string");
|
|
@@ -8617,6 +8617,14 @@ var findParachainJunction = function findParachainJunction(multilocation) {
|
|
|
8617
8617
|
};
|
|
8618
8618
|
|
|
8619
8619
|
var DEFAULT_FEE_ASSET = 0;
|
|
8620
|
+
var ETH_CHAIN_ID = BigInt(1);
|
|
8621
|
+
var ETHEREUM_JUNCTION = {
|
|
8622
|
+
GlobalConsensus: {
|
|
8623
|
+
Ethereum: {
|
|
8624
|
+
chain_id: ETH_CHAIN_ID
|
|
8625
|
+
}
|
|
8626
|
+
}
|
|
8627
|
+
};
|
|
8620
8628
|
|
|
8621
8629
|
var constructRelayToParaParameters = function constructRelayToParaParameters(_ref, version) {
|
|
8622
8630
|
var api = _ref.api,
|
|
@@ -8774,82 +8782,103 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
8774
8782
|
}, {
|
|
8775
8783
|
key: "transfer",
|
|
8776
8784
|
value: function transfer(options) {
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
8818
|
-
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
8829
|
-
|
|
8830
|
-
|
|
8831
|
-
|
|
8832
|
-
|
|
8833
|
-
|
|
8834
|
-
|
|
8835
|
-
|
|
8836
|
-
|
|
8837
|
-
|
|
8838
|
-
|
|
8839
|
-
|
|
8840
|
-
|
|
8841
|
-
|
|
8842
|
-
|
|
8843
|
-
|
|
8844
|
-
|
|
8845
|
-
|
|
8846
|
-
|
|
8785
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8786
|
+
var api, currencySymbol, currencyId, amount, address, destination, paraIdTo, overridedCurrencyMultiLocation, feeAsset, version, ahAddress, _options$serializedAp, serializedApiCallEnabled, scenario, paraId, versionOrDefault;
|
|
8787
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8788
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8789
|
+
case 0:
|
|
8790
|
+
api = options.api, currencySymbol = options.currencySymbol, currencyId = options.currencyId, amount = options.amount, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, overridedCurrencyMultiLocation = options.overridedCurrencyMultiLocation, feeAsset = options.feeAsset, version = options.version, ahAddress = options.ahAddress, _options$serializedAp = options.serializedApiCallEnabled, serializedApiCallEnabled = _options$serializedAp === void 0 ? false : _options$serializedAp;
|
|
8791
|
+
scenario = destination !== undefined ? 'ParaToPara' : 'ParaToRelay';
|
|
8792
|
+
paraId = destination !== undefined && _typeof(destination) !== 'object' && destination !== 'Ethereum' ? paraIdTo !== null && paraIdTo !== void 0 ? paraIdTo : getParaId(destination) : undefined;
|
|
8793
|
+
if (!(destination === 'Polimec' && this.node !== 'AssetHubPolkadot')) {
|
|
8794
|
+
_context.next = 5;
|
|
8795
|
+
break;
|
|
8796
|
+
}
|
|
8797
|
+
throw new Error('Sending assets to Polimec is supported only from AssetHubPolkadot');
|
|
8798
|
+
case 5:
|
|
8799
|
+
versionOrDefault = version !== null && version !== void 0 ? version : this.version;
|
|
8800
|
+
if (!(supportsXTokens(this) && this.canUseXTokens(options))) {
|
|
8801
|
+
_context.next = 10;
|
|
8802
|
+
break;
|
|
8803
|
+
}
|
|
8804
|
+
return _context.abrupt("return", this.transferXTokens({
|
|
8805
|
+
api: api,
|
|
8806
|
+
currency: currencySymbol,
|
|
8807
|
+
currencyID: currencyId,
|
|
8808
|
+
amount: amount,
|
|
8809
|
+
addressSelection: generateAddressPayload(api, scenario, 'XTokens', address, versionOrDefault, paraId),
|
|
8810
|
+
fees: getFees(scenario),
|
|
8811
|
+
origin: this.node,
|
|
8812
|
+
scenario: scenario,
|
|
8813
|
+
paraIdTo: paraId,
|
|
8814
|
+
destination: destination,
|
|
8815
|
+
overridedCurrencyMultiLocation: overridedCurrencyMultiLocation,
|
|
8816
|
+
feeAsset: feeAsset,
|
|
8817
|
+
serializedApiCallEnabled: serializedApiCallEnabled
|
|
8818
|
+
}));
|
|
8819
|
+
case 10:
|
|
8820
|
+
if (!supportsXTransfer(this)) {
|
|
8821
|
+
_context.next = 14;
|
|
8822
|
+
break;
|
|
8823
|
+
}
|
|
8824
|
+
return _context.abrupt("return", this.transferXTransfer({
|
|
8825
|
+
api: api,
|
|
8826
|
+
currency: currencySymbol,
|
|
8827
|
+
currencyID: currencyId,
|
|
8828
|
+
amount: amount,
|
|
8829
|
+
recipientAddress: address,
|
|
8830
|
+
paraId: paraId,
|
|
8831
|
+
origin: this.node,
|
|
8832
|
+
destination: destination,
|
|
8833
|
+
overridedCurrencyMultiLocation: overridedCurrencyMultiLocation,
|
|
8834
|
+
serializedApiCallEnabled: serializedApiCallEnabled
|
|
8835
|
+
}));
|
|
8836
|
+
case 14:
|
|
8837
|
+
if (!supportsPolkadotXCM(this)) {
|
|
8838
|
+
_context.next = 22;
|
|
8839
|
+
break;
|
|
8840
|
+
}
|
|
8841
|
+
if (!(isTMultiLocation(overridedCurrencyMultiLocation) && !verifyMultiLocation(this.node, overridedCurrencyMultiLocation))) {
|
|
8842
|
+
_context.next = 17;
|
|
8843
|
+
break;
|
|
8844
|
+
}
|
|
8845
|
+
throw new InvalidCurrencyError('Provided Multi-location is not a valid currency.');
|
|
8846
|
+
case 17:
|
|
8847
|
+
_context.next = 19;
|
|
8848
|
+
return this.transferPolkadotXCM({
|
|
8849
|
+
api: api,
|
|
8850
|
+
header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraId),
|
|
8851
|
+
addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, versionOrDefault, paraId),
|
|
8852
|
+
address: address,
|
|
8853
|
+
amount: amount,
|
|
8854
|
+
currencySelection: this.createCurrencySpec(amount, scenario, versionOrDefault, currencyId, overridedCurrencyMultiLocation),
|
|
8855
|
+
currencyId: currencyId,
|
|
8856
|
+
scenario: scenario,
|
|
8857
|
+
currencySymbol: currencySymbol,
|
|
8858
|
+
feeAsset: feeAsset,
|
|
8859
|
+
destination: destination,
|
|
8860
|
+
paraIdTo: paraId,
|
|
8861
|
+
overridedCurrency: overridedCurrencyMultiLocation,
|
|
8862
|
+
serializedApiCallEnabled: serializedApiCallEnabled,
|
|
8863
|
+
version: version,
|
|
8864
|
+
ahAddress: ahAddress
|
|
8865
|
+
});
|
|
8866
|
+
case 19:
|
|
8867
|
+
return _context.abrupt("return", _context.sent);
|
|
8868
|
+
case 22:
|
|
8869
|
+
throw new NoXCMSupportImplementedError(this._node);
|
|
8870
|
+
case 23:
|
|
8871
|
+
case "end":
|
|
8872
|
+
return _context.stop();
|
|
8873
|
+
}
|
|
8874
|
+
}, _callee, this);
|
|
8875
|
+
}));
|
|
8847
8876
|
}
|
|
8848
8877
|
}, {
|
|
8849
8878
|
key: "transferRelayToPara",
|
|
8850
8879
|
value: function transferRelayToPara(options) {
|
|
8851
|
-
var _options$
|
|
8852
|
-
version = _options$
|
|
8880
|
+
var _options$version = options.version,
|
|
8881
|
+
version = _options$version === void 0 ? exports.Version.V3 : _options$version;
|
|
8853
8882
|
return {
|
|
8854
8883
|
module: 'XcmPallet',
|
|
8855
8884
|
section: 'reserve_transfer_assets',
|
|
@@ -8864,21 +8893,21 @@ var ParachainNode = /*#__PURE__*/function () {
|
|
|
8864
8893
|
}, {
|
|
8865
8894
|
key: "createApiInstance",
|
|
8866
8895
|
value: function createApiInstance(api) {
|
|
8867
|
-
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8868
|
-
return _regeneratorRuntime().wrap(function
|
|
8869
|
-
while (1) switch (
|
|
8896
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
8897
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8898
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
8870
8899
|
case 0:
|
|
8871
|
-
return
|
|
8900
|
+
return _context2.abrupt("return", api.createApiInstance(this.getProvider()));
|
|
8872
8901
|
case 1:
|
|
8873
8902
|
case "end":
|
|
8874
|
-
return
|
|
8903
|
+
return _context2.stop();
|
|
8875
8904
|
}
|
|
8876
|
-
},
|
|
8905
|
+
}, _callee2, this);
|
|
8877
8906
|
}));
|
|
8878
8907
|
}
|
|
8879
8908
|
}, {
|
|
8880
8909
|
key: "createCurrencySpec",
|
|
8881
|
-
value: function createCurrencySpec$1(amount, scenario, version,
|
|
8910
|
+
value: function createCurrencySpec$1(amount, scenario, version, _currencyId, overridedMultiLocation) {
|
|
8882
8911
|
return createCurrencySpec(amount, version, scenario === 'ParaToRelay' ? exports.Parents.ONE : exports.Parents.ZERO, overridedMultiLocation);
|
|
8883
8912
|
}
|
|
8884
8913
|
}, {
|
|
@@ -8962,6 +8991,7 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
|
8962
8991
|
value: function transferXTokens(input, currencySelection) {
|
|
8963
8992
|
var fees = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Unlimited';
|
|
8964
8993
|
var api = input.api,
|
|
8994
|
+
origin = input.origin,
|
|
8965
8995
|
amount = input.amount,
|
|
8966
8996
|
addressSelection = input.addressSelection,
|
|
8967
8997
|
destination = input.destination,
|
|
@@ -8971,10 +9001,12 @@ var XTokensTransferImpl = /*#__PURE__*/function () {
|
|
|
8971
9001
|
if (isMultiLocationDestination) {
|
|
8972
9002
|
throw new Error('Multilocation destinations are not supported for specific transfer you are trying to create. In special cases such as xTokens or xTransfer pallet try using address multilocation instead (for both destination and address in same multilocation set (eg. X2 - Parachain, Address). For further assistance please open issue in our repository.');
|
|
8973
9003
|
}
|
|
8974
|
-
var
|
|
8975
|
-
var
|
|
8976
|
-
var
|
|
8977
|
-
var
|
|
9004
|
+
var isBifrostOrigin = origin === 'BifrostPolkadot' || origin === 'BifrostKusama';
|
|
9005
|
+
var isAssetHubDest = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
|
|
9006
|
+
var shouldUseMultiasset = isAssetHubDest && !isBifrostOrigin;
|
|
9007
|
+
var modifiedCurrencySelection = getCurrencySelection(input, shouldUseMultiasset, currencySelection);
|
|
9008
|
+
var section = shouldUseMultiasset ? feeAsset ? 'transfer_multiassets' : 'transfer_multiasset' : 'transfer';
|
|
9009
|
+
var parameters = getXTokensParameters(shouldUseMultiasset, modifiedCurrencySelection, addressSelection, amount, fees, feeAsset);
|
|
8978
9010
|
var call = {
|
|
8979
9011
|
module: 'XTokens',
|
|
8980
9012
|
section: section,
|
|
@@ -9158,23 +9190,15 @@ var BifrostPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9158
9190
|
var amount = input.amount,
|
|
9159
9191
|
overridedCurrency = input.overridedCurrency,
|
|
9160
9192
|
currencySymbol = input.currencySymbol;
|
|
9161
|
-
|
|
9162
|
-
var ethJunction = {
|
|
9163
|
-
GlobalConsensus: {
|
|
9164
|
-
Ethereum: {
|
|
9165
|
-
chain_id: ETH_CHAIN_ID
|
|
9166
|
-
}
|
|
9167
|
-
}
|
|
9168
|
-
};
|
|
9169
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(Object.assign(Object.assign({}, input), {
|
|
9193
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(Object.assign(Object.assign({}, input), {
|
|
9170
9194
|
currencySelection: createCurrencySpec(amount, this.version, currencySymbol === 'DOT' ? exports.Parents.ONE : exports.Parents.TWO, overridedCurrency, currencySymbol === 'WETH' ? {
|
|
9171
|
-
X2: [
|
|
9195
|
+
X2: [ETHEREUM_JUNCTION, {
|
|
9172
9196
|
AccountKey20: {
|
|
9173
9197
|
key: (_a = getAssetId('Ethereum', 'WETH')) !== null && _a !== void 0 ? _a : ''
|
|
9174
9198
|
}
|
|
9175
9199
|
}]
|
|
9176
9200
|
} : undefined)
|
|
9177
|
-
}), 'transfer_assets', 'Unlimited');
|
|
9201
|
+
}), 'transfer_assets', 'Unlimited'));
|
|
9178
9202
|
}
|
|
9179
9203
|
}, {
|
|
9180
9204
|
key: "canUseXTokens",
|
|
@@ -9229,6 +9253,134 @@ var ComposableFinance$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9229
9253
|
}]);
|
|
9230
9254
|
}(ParachainNode);
|
|
9231
9255
|
|
|
9256
|
+
var calculateFee = function calculateFee(api) {
|
|
9257
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9258
|
+
var DEFAULT_FEE, ahApi, feeStorageItem, leFeeHex, leFee, transfer_bridge_fee, transfer_assethub_execution_fee;
|
|
9259
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9260
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9261
|
+
case 0:
|
|
9262
|
+
DEFAULT_FEE = BigInt(2750872500000);
|
|
9263
|
+
_context.next = 3;
|
|
9264
|
+
return api.createApiForNode('AssetHubPolkadot');
|
|
9265
|
+
case 3:
|
|
9266
|
+
ahApi = _context.sent;
|
|
9267
|
+
_context.next = 6;
|
|
9268
|
+
return ahApi.getFromStorage('0x5fbc5c7ba58845ad1f1a9a7c5bc12fad');
|
|
9269
|
+
case 6:
|
|
9270
|
+
feeStorageItem = _context.sent;
|
|
9271
|
+
leFeeHex = feeStorageItem.replace('0x', '');
|
|
9272
|
+
leFee = BigInt('0x' + leFeeHex.split('').reverse().join(''));
|
|
9273
|
+
transfer_bridge_fee = leFee === BigInt(0) ? DEFAULT_FEE : BigInt(leFee.toString());
|
|
9274
|
+
transfer_assethub_execution_fee = BigInt(2200000000);
|
|
9275
|
+
return _context.abrupt("return", (transfer_bridge_fee + transfer_assethub_execution_fee).toString());
|
|
9276
|
+
case 12:
|
|
9277
|
+
case "end":
|
|
9278
|
+
return _context.stop();
|
|
9279
|
+
}
|
|
9280
|
+
}, _callee);
|
|
9281
|
+
}));
|
|
9282
|
+
};
|
|
9283
|
+
var createEthereumTokenLocation = function createEthereumTokenLocation(currencyId) {
|
|
9284
|
+
return {
|
|
9285
|
+
parents: exports.Parents.TWO,
|
|
9286
|
+
interior: {
|
|
9287
|
+
X2: [ETHEREUM_JUNCTION, {
|
|
9288
|
+
AccountKey20: {
|
|
9289
|
+
key: currencyId
|
|
9290
|
+
}
|
|
9291
|
+
}]
|
|
9292
|
+
}
|
|
9293
|
+
};
|
|
9294
|
+
};
|
|
9295
|
+
var createCustomXcmAh = function createCustomXcmAh(_ref, version) {
|
|
9296
|
+
var api = _ref.api,
|
|
9297
|
+
scenario = _ref.scenario,
|
|
9298
|
+
address = _ref.address;
|
|
9299
|
+
return _defineProperty({}, version, [{
|
|
9300
|
+
DepositAsset: {
|
|
9301
|
+
assets: {
|
|
9302
|
+
Wild: {
|
|
9303
|
+
AllCounted: 1
|
|
9304
|
+
}
|
|
9305
|
+
},
|
|
9306
|
+
beneficiary: Object.values(generateAddressPayload(api, scenario, 'PolkadotXcm', address, version, undefined))[0]
|
|
9307
|
+
}
|
|
9308
|
+
}]);
|
|
9309
|
+
};
|
|
9310
|
+
var createCustomXcmOnDest = function createCustomXcmOnDest(_ref3, version) {
|
|
9311
|
+
var api = _ref3.api,
|
|
9312
|
+
address = _ref3.address,
|
|
9313
|
+
currencyId = _ref3.currencyId,
|
|
9314
|
+
scenario = _ref3.scenario,
|
|
9315
|
+
ahAddress = _ref3.ahAddress;
|
|
9316
|
+
return _defineProperty({}, version, [{
|
|
9317
|
+
SetAppendix: [{
|
|
9318
|
+
DepositAsset: {
|
|
9319
|
+
assets: {
|
|
9320
|
+
Wild: 'All'
|
|
9321
|
+
},
|
|
9322
|
+
beneficiary: Object.values(generateAddressPayload(api, scenario, 'PolkadotXcm', ahAddress !== null && ahAddress !== void 0 ? ahAddress : '', version, undefined))[0]
|
|
9323
|
+
}
|
|
9324
|
+
}]
|
|
9325
|
+
}, {
|
|
9326
|
+
InitiateReserveWithdraw: {
|
|
9327
|
+
assets: {
|
|
9328
|
+
Wild: {
|
|
9329
|
+
AllOf: {
|
|
9330
|
+
id: createEthereumTokenLocation(currencyId !== null && currencyId !== void 0 ? currencyId : ''),
|
|
9331
|
+
fun: 'Fungible'
|
|
9332
|
+
}
|
|
9333
|
+
}
|
|
9334
|
+
},
|
|
9335
|
+
reserve: {
|
|
9336
|
+
parents: exports.Parents.TWO,
|
|
9337
|
+
interior: {
|
|
9338
|
+
X1: [ETHEREUM_JUNCTION]
|
|
9339
|
+
}
|
|
9340
|
+
},
|
|
9341
|
+
xcm: [{
|
|
9342
|
+
BuyExecution: {
|
|
9343
|
+
fees: {
|
|
9344
|
+
id: {
|
|
9345
|
+
parents: exports.Parents.ZERO,
|
|
9346
|
+
interior: {
|
|
9347
|
+
X1: [{
|
|
9348
|
+
AccountKey20: {
|
|
9349
|
+
network: null,
|
|
9350
|
+
key: currencyId
|
|
9351
|
+
}
|
|
9352
|
+
}]
|
|
9353
|
+
}
|
|
9354
|
+
},
|
|
9355
|
+
fun: {
|
|
9356
|
+
Fungible: BigInt(1)
|
|
9357
|
+
}
|
|
9358
|
+
},
|
|
9359
|
+
weight_limit: 'Unlimited'
|
|
9360
|
+
}
|
|
9361
|
+
}, {
|
|
9362
|
+
DepositAsset: {
|
|
9363
|
+
assets: {
|
|
9364
|
+
Wild: {
|
|
9365
|
+
AllCounted: 1
|
|
9366
|
+
}
|
|
9367
|
+
},
|
|
9368
|
+
beneficiary: {
|
|
9369
|
+
parents: exports.Parents.ZERO,
|
|
9370
|
+
interior: {
|
|
9371
|
+
X1: [{
|
|
9372
|
+
AccountKey20: {
|
|
9373
|
+
network: null,
|
|
9374
|
+
key: address
|
|
9375
|
+
}
|
|
9376
|
+
}]
|
|
9377
|
+
}
|
|
9378
|
+
}
|
|
9379
|
+
}
|
|
9380
|
+
}]
|
|
9381
|
+
}
|
|
9382
|
+
}]);
|
|
9383
|
+
};
|
|
9232
9384
|
var Hydration$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
9233
9385
|
function Hydration() {
|
|
9234
9386
|
_classCallCheck(this, Hydration);
|
|
@@ -9236,11 +9388,133 @@ var Hydration$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9236
9388
|
}
|
|
9237
9389
|
_inherits(Hydration, _ParachainNode);
|
|
9238
9390
|
return _createClass(Hydration, [{
|
|
9391
|
+
key: "transferToEthereum",
|
|
9392
|
+
value: function transferToEthereum(input) {
|
|
9393
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
9394
|
+
var api, address, currencySymbol, scenario, version, destination, amount, currencyId, ahAddress, versionOrDefault, ethMultiAsset, fee, call;
|
|
9395
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
9396
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
9397
|
+
case 0:
|
|
9398
|
+
api = input.api, address = input.address, currencySymbol = input.currencySymbol, scenario = input.scenario, version = input.version, destination = input.destination, amount = input.amount, currencyId = input.currencyId, ahAddress = input.ahAddress;
|
|
9399
|
+
if (ethers.ethers.isAddress(address)) {
|
|
9400
|
+
_context2.next = 3;
|
|
9401
|
+
break;
|
|
9402
|
+
}
|
|
9403
|
+
throw new Error('Only Ethereum addresses are supported for Ethereum transfers');
|
|
9404
|
+
case 3:
|
|
9405
|
+
if (!((currencySymbol === null || currencySymbol === void 0 ? void 0 : currencySymbol.toUpperCase()) !== 'WETH')) {
|
|
9406
|
+
_context2.next = 5;
|
|
9407
|
+
break;
|
|
9408
|
+
}
|
|
9409
|
+
throw new InvalidCurrencyError("Currency ".concat(currencySymbol, " is not supported for Ethereum transfers from Hydration"));
|
|
9410
|
+
case 5:
|
|
9411
|
+
if (!(ahAddress === undefined)) {
|
|
9412
|
+
_context2.next = 7;
|
|
9413
|
+
break;
|
|
9414
|
+
}
|
|
9415
|
+
throw new Error('AssetHub address is required for Ethereum transfers');
|
|
9416
|
+
case 7:
|
|
9417
|
+
versionOrDefault = version !== null && version !== void 0 ? version : exports.Version.V4;
|
|
9418
|
+
ethMultiAsset = Object.values(createCurrencySpec(amount, versionOrDefault, exports.Parents.TWO, createEthereumTokenLocation(currencyId !== null && currencyId !== void 0 ? currencyId : '')))[0][0];
|
|
9419
|
+
_context2.next = 11;
|
|
9420
|
+
return calculateFee(api);
|
|
9421
|
+
case 11:
|
|
9422
|
+
fee = _context2.sent;
|
|
9423
|
+
call = {
|
|
9424
|
+
module: 'PolkadotXcm',
|
|
9425
|
+
section: 'transfer_assets_using_type_and_then',
|
|
9426
|
+
parameters: {
|
|
9427
|
+
dest: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, getParaId('AssetHubPolkadot')),
|
|
9428
|
+
assets: _defineProperty({}, versionOrDefault, [Object.values(this.createCurrencySpec(fee, 'ParaToRelay', versionOrDefault))[0][0], ethMultiAsset]),
|
|
9429
|
+
assets_transfer_type: 'DestinationReserve',
|
|
9430
|
+
remote_fees_id: _defineProperty({}, versionOrDefault, {
|
|
9431
|
+
parents: exports.Parents.ONE,
|
|
9432
|
+
interior: 'Here'
|
|
9433
|
+
}),
|
|
9434
|
+
fees_transfer_type: 'DestinationReserve',
|
|
9435
|
+
custom_xcm_on_dest: createCustomXcmOnDest(input, versionOrDefault),
|
|
9436
|
+
weight_limit: 'Unlimited'
|
|
9437
|
+
}
|
|
9438
|
+
};
|
|
9439
|
+
return _context2.abrupt("return", api.callTxMethod(call));
|
|
9440
|
+
case 14:
|
|
9441
|
+
case "end":
|
|
9442
|
+
return _context2.stop();
|
|
9443
|
+
}
|
|
9444
|
+
}, _callee2, this);
|
|
9445
|
+
}));
|
|
9446
|
+
}
|
|
9447
|
+
}, {
|
|
9448
|
+
key: "transferToAssetHub",
|
|
9449
|
+
value: function transferToAssetHub(input) {
|
|
9450
|
+
var api = input.api,
|
|
9451
|
+
scenario = input.scenario,
|
|
9452
|
+
version = input.version,
|
|
9453
|
+
destination = input.destination,
|
|
9454
|
+
amount = input.amount;
|
|
9455
|
+
var versionOrDefault = version !== null && version !== void 0 ? version : exports.Version.V3;
|
|
9456
|
+
var call = {
|
|
9457
|
+
module: 'PolkadotXcm',
|
|
9458
|
+
section: 'transfer_assets_using_type_and_then',
|
|
9459
|
+
parameters: {
|
|
9460
|
+
dest: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, getParaId('AssetHubPolkadot')),
|
|
9461
|
+
assets: _defineProperty({}, versionOrDefault, [Object.values(this.createCurrencySpec(amount, 'ParaToRelay', versionOrDefault))[0][0]]),
|
|
9462
|
+
assets_transfer_type: 'DestinationReserve',
|
|
9463
|
+
remote_fees_id: _defineProperty({}, versionOrDefault, {
|
|
9464
|
+
Concrete: {
|
|
9465
|
+
parents: exports.Parents.ONE,
|
|
9466
|
+
interior: 'Here'
|
|
9467
|
+
}
|
|
9468
|
+
}),
|
|
9469
|
+
fees_transfer_type: 'DestinationReserve',
|
|
9470
|
+
custom_xcm_on_dest: createCustomXcmAh(input, versionOrDefault),
|
|
9471
|
+
weight_limit: 'Unlimited'
|
|
9472
|
+
}
|
|
9473
|
+
};
|
|
9474
|
+
return api.callTxMethod(call);
|
|
9475
|
+
}
|
|
9476
|
+
// Handles WETH Ethereum transfers
|
|
9477
|
+
}, {
|
|
9478
|
+
key: "transferPolkadotXCM",
|
|
9479
|
+
value: function transferPolkadotXCM(input) {
|
|
9480
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
9481
|
+
var destination;
|
|
9482
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
9483
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
9484
|
+
case 0:
|
|
9485
|
+
destination = input.destination;
|
|
9486
|
+
if (!(destination === 'Ethereum')) {
|
|
9487
|
+
_context3.next = 3;
|
|
9488
|
+
break;
|
|
9489
|
+
}
|
|
9490
|
+
return _context3.abrupt("return", this.transferToEthereum(input));
|
|
9491
|
+
case 3:
|
|
9492
|
+
return _context3.abrupt("return", this.transferToAssetHub(input));
|
|
9493
|
+
case 4:
|
|
9494
|
+
case "end":
|
|
9495
|
+
return _context3.stop();
|
|
9496
|
+
}
|
|
9497
|
+
}, _callee3, this);
|
|
9498
|
+
}));
|
|
9499
|
+
}
|
|
9500
|
+
}, {
|
|
9239
9501
|
key: "transferXTokens",
|
|
9240
9502
|
value: function transferXTokens(input) {
|
|
9241
9503
|
var currencyID = input.currencyID;
|
|
9242
9504
|
return XTokensTransferImpl.transferXTokens(input, currencyID);
|
|
9243
9505
|
}
|
|
9506
|
+
}, {
|
|
9507
|
+
key: "canUseXTokens",
|
|
9508
|
+
value: function canUseXTokens(_ref5) {
|
|
9509
|
+
var destination = _ref5.destination,
|
|
9510
|
+
currencySymbol = _ref5.currencySymbol,
|
|
9511
|
+
currencyId = _ref5.currencyId;
|
|
9512
|
+
var dotAsset = getOtherAssets(this.node).find(function (_ref6) {
|
|
9513
|
+
var symbol = _ref6.symbol;
|
|
9514
|
+
return symbol === 'DOT';
|
|
9515
|
+
});
|
|
9516
|
+
return destination !== 'Ethereum' && !(destination === 'AssetHubPolkadot' && (currencySymbol === (dotAsset === null || dotAsset === void 0 ? void 0 : dotAsset.symbol) || currencyId === (dotAsset === null || dotAsset === void 0 ? void 0 : dotAsset.assetId)));
|
|
9517
|
+
}
|
|
9244
9518
|
}]);
|
|
9245
9519
|
}(ParachainNode);
|
|
9246
9520
|
|
|
@@ -9711,21 +9985,13 @@ var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9711
9985
|
if (!ethAsset) {
|
|
9712
9986
|
throw new InvalidCurrencyError("Currency ".concat(currencySymbol, " is not supported for Ethereum transfers"));
|
|
9713
9987
|
}
|
|
9714
|
-
var ETH_CHAIN_ID = BigInt(1);
|
|
9715
|
-
var ethJunction = {
|
|
9716
|
-
GlobalConsensus: {
|
|
9717
|
-
Ethereum: {
|
|
9718
|
-
chain_id: ETH_CHAIN_ID
|
|
9719
|
-
}
|
|
9720
|
-
}
|
|
9721
|
-
};
|
|
9722
9988
|
var modifiedInput = Object.assign(Object.assign({}, input), {
|
|
9723
|
-
header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo,
|
|
9989
|
+
header: createPolkadotXcmHeader(scenario, this.version, destination, paraIdTo, ETHEREUM_JUNCTION, exports.Parents.TWO),
|
|
9724
9990
|
addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, this.version, paraIdTo),
|
|
9725
9991
|
currencySelection: createCurrencySpec(input.amount, exports.Version.V3, exports.Parents.TWO, {
|
|
9726
9992
|
parents: exports.Parents.TWO,
|
|
9727
9993
|
interior: {
|
|
9728
|
-
X2: [
|
|
9994
|
+
X2: [ETHEREUM_JUNCTION, {
|
|
9729
9995
|
AccountKey20: {
|
|
9730
9996
|
key: ethAsset.assetId
|
|
9731
9997
|
}
|
|
@@ -9763,29 +10029,65 @@ var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9763
10029
|
});
|
|
9764
10030
|
return PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, 'limited_teleport_assets', 'Unlimited');
|
|
9765
10031
|
}
|
|
10032
|
+
}, {
|
|
10033
|
+
key: "patchInput",
|
|
10034
|
+
value: function patchInput(input) {
|
|
10035
|
+
var _a;
|
|
10036
|
+
var currencySymbol = input.currencySymbol,
|
|
10037
|
+
currencyId = input.currencyId,
|
|
10038
|
+
destination = input.destination,
|
|
10039
|
+
paraIdTo = input.paraIdTo,
|
|
10040
|
+
amount = input.amount,
|
|
10041
|
+
overridedCurrency = input.overridedCurrency,
|
|
10042
|
+
scenario = input.scenario,
|
|
10043
|
+
api = input.api,
|
|
10044
|
+
version = input.version,
|
|
10045
|
+
address = input.address;
|
|
10046
|
+
if (((currencySymbol === null || currencySymbol === void 0 ? void 0 : currencySymbol.toUpperCase()) === 'USDT' || (currencySymbol === null || currencySymbol === void 0 ? void 0 : currencySymbol.toUpperCase()) === 'USDC') && destination === 'BifrostPolkadot') {
|
|
10047
|
+
var versionOrDefault = (_a = input.version) !== null && _a !== void 0 ? _a : exports.Version.V2;
|
|
10048
|
+
return Object.assign(Object.assign({}, input), {
|
|
10049
|
+
header: this.createPolkadotXcmHeader(scenario, versionOrDefault, destination, paraIdTo),
|
|
10050
|
+
addressSelection: generateAddressPayload(api, scenario, 'PolkadotXcm', address, versionOrDefault, paraIdTo),
|
|
10051
|
+
currencySelection: this.createCurrencySpec(amount, scenario, versionOrDefault, currencyId, overridedCurrency)
|
|
10052
|
+
});
|
|
10053
|
+
}
|
|
10054
|
+
var dotAsset = getOtherAssets(this.node).find(function (_ref) {
|
|
10055
|
+
var symbol = _ref.symbol;
|
|
10056
|
+
return symbol === 'DOT';
|
|
10057
|
+
});
|
|
10058
|
+
if (destination === 'Hydration' && (currencySymbol === (dotAsset === null || dotAsset === void 0 ? void 0 : dotAsset.symbol) || currencyId === (dotAsset === null || dotAsset === void 0 ? void 0 : dotAsset.assetId))) {
|
|
10059
|
+
var _versionOrDefault = version !== null && version !== void 0 ? version : this.version;
|
|
10060
|
+
return Object.assign(Object.assign({}, input), {
|
|
10061
|
+
currencySelection: _superPropGet(AssetHubPolkadot, "createCurrencySpec", this, 3)([amount, 'ParaToRelay', _versionOrDefault, currencyId, overridedCurrency])
|
|
10062
|
+
});
|
|
10063
|
+
}
|
|
10064
|
+
return input;
|
|
10065
|
+
}
|
|
9766
10066
|
}, {
|
|
9767
10067
|
key: "transferPolkadotXCM",
|
|
9768
10068
|
value: function transferPolkadotXCM(input) {
|
|
9769
10069
|
var scenario = input.scenario,
|
|
9770
10070
|
currencySymbol = input.currencySymbol,
|
|
9771
|
-
currencyId = input.currencyId
|
|
9772
|
-
|
|
9773
|
-
|
|
10071
|
+
currencyId = input.currencyId,
|
|
10072
|
+
destination = input.destination;
|
|
10073
|
+
if (destination === 'AssetHubKusama') {
|
|
10074
|
+
return Promise.resolve(this.handleBridgeTransfer(input, 'Kusama'));
|
|
9774
10075
|
}
|
|
9775
|
-
if (
|
|
9776
|
-
return this.handleEthBridgeTransfer(input);
|
|
10076
|
+
if (destination === 'Ethereum') {
|
|
10077
|
+
return Promise.resolve(this.handleEthBridgeTransfer(input));
|
|
9777
10078
|
}
|
|
9778
|
-
if (
|
|
9779
|
-
return this.handleMythosTransfer(input);
|
|
10079
|
+
if (destination === 'Mythos') {
|
|
10080
|
+
return Promise.resolve(this.handleMythosTransfer(input));
|
|
9780
10081
|
}
|
|
9781
|
-
if (scenario === 'ParaToPara' && currencySymbol === 'DOT' && currencyId === undefined) {
|
|
10082
|
+
if (scenario === 'ParaToPara' && currencySymbol === 'DOT' && currencyId === undefined && destination !== 'Hydration') {
|
|
9782
10083
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for DOT transfer from AssetHub are not supported, you have to transfer DOT to Relay chain and transfer to destination chain from Relay chain.');
|
|
9783
10084
|
}
|
|
9784
10085
|
if (scenario === 'ParaToPara' && currencySymbol === 'KSM' && currencyId === undefined) {
|
|
9785
10086
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Bridged KSM cannot currently be transfered from AssetHubPolkadot, if you are sending different KSM asset, please specify {id: <KSMID>}.');
|
|
9786
10087
|
}
|
|
9787
10088
|
var section = scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
|
|
9788
|
-
|
|
10089
|
+
var modifiedInput = this.patchInput(input);
|
|
10090
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(modifiedInput, section, 'Unlimited'));
|
|
9789
10091
|
}
|
|
9790
10092
|
}, {
|
|
9791
10093
|
key: "transferRelayToPara",
|
|
@@ -9812,7 +10114,7 @@ var AssetHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9812
10114
|
};
|
|
9813
10115
|
return createCurrencySpec(amount, version, exports.Parents.ZERO, overridedMultiLocation, interior);
|
|
9814
10116
|
} else {
|
|
9815
|
-
return _superPropGet(AssetHubPolkadot, "createCurrencySpec", this)([amount, scenario, version, currencyId]);
|
|
10117
|
+
return _superPropGet(AssetHubPolkadot, "createCurrencySpec", this, 3)([amount, scenario, version, currencyId]);
|
|
9816
10118
|
}
|
|
9817
10119
|
}
|
|
9818
10120
|
}]);
|
|
@@ -9834,7 +10136,7 @@ var AssetHubKusama$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9834
10136
|
// TESTED https://kusama.subscan.io/xcm_message/kusama-ddc2a48f0d8e0337832d7aae26f6c3053e1f4ffd
|
|
9835
10137
|
// TESTED https://kusama.subscan.io/xcm_message/kusama-8e423130a4d8b61679af95dbea18a55124f99672
|
|
9836
10138
|
if (destination === 'AssetHubPolkadot') {
|
|
9837
|
-
return getNode('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot');
|
|
10139
|
+
return Promise.resolve(getNode('AssetHubPolkadot').handleBridgeTransfer(input, 'Polkadot'));
|
|
9838
10140
|
}
|
|
9839
10141
|
if (scenario === 'ParaToPara' && currencySymbol === 'KSM' && currencyId === undefined) {
|
|
9840
10142
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Para to Para scenarios for KSM transfer from AssetHub are not supported, you have to transfer KSM to Relay chain and transfer to destination chain from Relay chain.');
|
|
@@ -9843,7 +10145,7 @@ var AssetHubKusama$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9843
10145
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Bridged DOT cannot currently be transfered from AssetHubKusama, if you are sending different DOT asset, please specify {id: <DOTID>}.');
|
|
9844
10146
|
}
|
|
9845
10147
|
var section = scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
|
|
9846
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10148
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
9847
10149
|
}
|
|
9848
10150
|
}, {
|
|
9849
10151
|
key: "transferRelayToPara",
|
|
@@ -9879,7 +10181,7 @@ var CoretimeKusama$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9879
10181
|
// TESTED block hash on Rococo: 0x78ace0f1bf7cac9a42e56143321b617d98327e2750f795efb0abb833025c9082
|
|
9880
10182
|
var scenario = input.scenario;
|
|
9881
10183
|
var section = scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
|
|
9882
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10184
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
9883
10185
|
}
|
|
9884
10186
|
}, {
|
|
9885
10187
|
key: "transferRelayToPara",
|
|
@@ -9911,7 +10213,7 @@ var CoretimePolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9911
10213
|
value: function transferPolkadotXCM(input) {
|
|
9912
10214
|
var scenario = input.scenario;
|
|
9913
10215
|
var section = scenario === 'ParaToPara' ? 'limited_reserve_transfer_assets' : 'limited_teleport_assets';
|
|
9914
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10216
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
9915
10217
|
}
|
|
9916
10218
|
}, {
|
|
9917
10219
|
key: "transferRelayToPara",
|
|
@@ -9939,7 +10241,7 @@ var Encointer$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9939
10241
|
// NO PARA TO PARA SCENARIOS ON SUBSCAN
|
|
9940
10242
|
// TESTED https://encointer.subscan.io/xcm_message/kusama-418501e86e947b16c4e4e9040694017e64f9b162
|
|
9941
10243
|
if (input.scenario === 'ParaToRelay') {
|
|
9942
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_teleport_assets', 'Unlimited');
|
|
10244
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_teleport_assets', 'Unlimited'));
|
|
9943
10245
|
}
|
|
9944
10246
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
9945
10247
|
}
|
|
@@ -9966,7 +10268,7 @@ var RobonomicsKusama$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9966
10268
|
return _createClass(RobonomicsKusama, [{
|
|
9967
10269
|
key: "transferPolkadotXCM",
|
|
9968
10270
|
value: function transferPolkadotXCM(input) {
|
|
9969
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
10271
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
|
|
9970
10272
|
}
|
|
9971
10273
|
}]);
|
|
9972
10274
|
}(ParachainNode);
|
|
@@ -9980,7 +10282,7 @@ var RobonomicsPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9980
10282
|
return _createClass(RobonomicsPolkadot, [{
|
|
9981
10283
|
key: "transferPolkadotXCM",
|
|
9982
10284
|
value: function transferPolkadotXCM(input) {
|
|
9983
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
10285
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
|
|
9984
10286
|
}
|
|
9985
10287
|
}]);
|
|
9986
10288
|
}(ParachainNode);
|
|
@@ -9999,7 +10301,7 @@ var PeoplePolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
9999
10301
|
throw new ScenarioNotSupportedError(this.node, scenario);
|
|
10000
10302
|
}
|
|
10001
10303
|
var section = 'limited_teleport_assets';
|
|
10002
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10304
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
10003
10305
|
}
|
|
10004
10306
|
}, {
|
|
10005
10307
|
key: "transferRelayToPara",
|
|
@@ -10029,7 +10331,7 @@ var PeopleKusama$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10029
10331
|
throw new ScenarioNotSupportedError(this.node, scenario);
|
|
10030
10332
|
}
|
|
10031
10333
|
var section = 'limited_teleport_assets';
|
|
10032
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10334
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
10033
10335
|
}
|
|
10034
10336
|
}, {
|
|
10035
10337
|
key: "transferRelayToPara",
|
|
@@ -10056,7 +10358,7 @@ var Astar$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10056
10358
|
value: function transferPolkadotXCM(input) {
|
|
10057
10359
|
// TESTED https://polkadot.subscan.io/xcm_message/polkadot-f2b697df74ebe4b62853fe81b8b7d0522464972d
|
|
10058
10360
|
var section = input.scenario === 'ParaToPara' ? 'reserve_transfer_assets' : 'reserve_withdraw_assets';
|
|
10059
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section);
|
|
10361
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section));
|
|
10060
10362
|
}
|
|
10061
10363
|
}, {
|
|
10062
10364
|
key: "transferXTokens",
|
|
@@ -10105,7 +10407,7 @@ var Darwinia$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10105
10407
|
};
|
|
10106
10408
|
return createCurrencySpec(amount, version, exports.Parents.ZERO, overridedMultiLocation, interior);
|
|
10107
10409
|
} else {
|
|
10108
|
-
return _superPropGet(Darwinia, "createCurrencySpec", this)([amount, scenario, version, currencyId]);
|
|
10410
|
+
return _superPropGet(Darwinia, "createCurrencySpec", this, 3)([amount, scenario, version, currencyId, overridedMultiLocation]);
|
|
10109
10411
|
}
|
|
10110
10412
|
}
|
|
10111
10413
|
}, {
|
|
@@ -10128,7 +10430,7 @@ var Crab$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10128
10430
|
value: function transferPolkadotXCM(input) {
|
|
10129
10431
|
// TESTED https://kusama.subscan.io/xcm_message/kusama-ce7396ec470ba0c6516a50075046ee65464572dc
|
|
10130
10432
|
if (input.scenario === 'ParaToPara') {
|
|
10131
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets');
|
|
10433
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets'));
|
|
10132
10434
|
}
|
|
10133
10435
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
10134
10436
|
}
|
|
@@ -10243,7 +10545,7 @@ var NeuroWeb$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10243
10545
|
return _createClass(NeuroWeb, [{
|
|
10244
10546
|
key: "transferPolkadotXCM",
|
|
10245
10547
|
value: function transferPolkadotXCM(input) {
|
|
10246
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
10548
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
|
|
10247
10549
|
}
|
|
10248
10550
|
}]);
|
|
10249
10551
|
}(ParachainNode);
|
|
@@ -10321,7 +10623,7 @@ var Collectives$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10321
10623
|
if (scenario === 'ParaToPara') {
|
|
10322
10624
|
throw new ScenarioNotSupportedError(this.node, scenario);
|
|
10323
10625
|
}
|
|
10324
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_teleport_assets', 'Unlimited');
|
|
10626
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_teleport_assets', 'Unlimited'));
|
|
10325
10627
|
}
|
|
10326
10628
|
}, {
|
|
10327
10629
|
key: "transferRelayToPara",
|
|
@@ -10340,7 +10642,7 @@ var Collectives$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10340
10642
|
if (scenario === 'ParaToPara') {
|
|
10341
10643
|
return {};
|
|
10342
10644
|
} else {
|
|
10343
|
-
return _superPropGet(Collectives, "createCurrencySpec", this)([amount, scenario, version, currencyId]);
|
|
10645
|
+
return _superPropGet(Collectives, "createCurrencySpec", this, 3)([amount, scenario, version, currencyId]);
|
|
10344
10646
|
}
|
|
10345
10647
|
}
|
|
10346
10648
|
}]);
|
|
@@ -10483,7 +10785,7 @@ var Subsocial$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10483
10785
|
if (currencySymbol !== this.getNativeAssetSymbol()) {
|
|
10484
10786
|
throw new InvalidCurrencyError("Asset ".concat(currencySymbol, " is not supported by node ").concat(this.node, "."));
|
|
10485
10787
|
}
|
|
10486
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
10788
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'limited_reserve_transfer_assets', 'Unlimited'));
|
|
10487
10789
|
}
|
|
10488
10790
|
}]);
|
|
10489
10791
|
}(ParachainNode);
|
|
@@ -10500,7 +10802,7 @@ var KiltSpiritnet$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10500
10802
|
if (input.scenario !== 'ParaToPara') {
|
|
10501
10803
|
throw new ScenarioNotSupportedError(this.node, input.scenario);
|
|
10502
10804
|
}
|
|
10503
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets');
|
|
10805
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, 'reserve_transfer_assets'));
|
|
10504
10806
|
}
|
|
10505
10807
|
}, {
|
|
10506
10808
|
key: "transferRelayToPara",
|
|
@@ -10554,7 +10856,7 @@ var BridgeHubPolkadot$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10554
10856
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Unable to use bridge hub for transfers to other Parachains. Please move your currency to AssetHub to transfer to other Parachains.');
|
|
10555
10857
|
}
|
|
10556
10858
|
var section = 'limited_teleport_assets';
|
|
10557
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10859
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
10558
10860
|
}
|
|
10559
10861
|
}, {
|
|
10560
10862
|
key: "transferRelayToPara",
|
|
@@ -10587,7 +10889,7 @@ var BridgeHubKusama$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10587
10889
|
throw new ScenarioNotSupportedError(this.node, scenario, 'Unable to use bridge hub for transfers to other Parachains. Please move your currency to AssetHub to transfer to other Parachains.');
|
|
10588
10890
|
}
|
|
10589
10891
|
var section = 'limited_teleport_assets';
|
|
10590
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited');
|
|
10892
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, section, 'Unlimited'));
|
|
10591
10893
|
}
|
|
10592
10894
|
}, {
|
|
10593
10895
|
key: "transferRelayToPara",
|
|
@@ -10631,7 +10933,7 @@ var Mythos$2 = /*#__PURE__*/function (_ParachainNode) {
|
|
|
10631
10933
|
if (currencySymbol !== nativeSymbol) {
|
|
10632
10934
|
throw new InvalidCurrencyError("Node ".concat(this.node, " does not support currency ").concat(currencySymbol));
|
|
10633
10935
|
}
|
|
10634
|
-
return PolkadotXCMTransferImpl.transferPolkadotXCM(input, destination === 'AssetHubPolkadot' ? 'limited_teleport_assets' : 'limited_reserve_transfer_assets', 'Unlimited');
|
|
10936
|
+
return Promise.resolve(PolkadotXCMTransferImpl.transferPolkadotXCM(input, destination === 'AssetHubPolkadot' ? 'limited_teleport_assets' : 'limited_reserve_transfer_assets', 'Unlimited'));
|
|
10635
10937
|
}
|
|
10636
10938
|
}, {
|
|
10637
10939
|
key: "transferRelayToPara",
|
|
@@ -12283,8 +12585,9 @@ var ParaToParaBuilder = /*#__PURE__*/function () {
|
|
|
12283
12585
|
*/
|
|
12284
12586
|
}, {
|
|
12285
12587
|
key: "address",
|
|
12286
|
-
value: function address(_address) {
|
|
12588
|
+
value: function address(_address, ahAddress) {
|
|
12287
12589
|
this._address = _address;
|
|
12590
|
+
this._ahAddress = ahAddress;
|
|
12288
12591
|
return this;
|
|
12289
12592
|
}
|
|
12290
12593
|
/**
|
|
@@ -12324,7 +12627,8 @@ var ParaToParaBuilder = /*#__PURE__*/function () {
|
|
|
12324
12627
|
paraIdTo: this.paraIdTo,
|
|
12325
12628
|
feeAsset: this._feeAsset,
|
|
12326
12629
|
destApiForKeepAlive: this._destApi,
|
|
12327
|
-
version: this._version
|
|
12630
|
+
version: this._version,
|
|
12631
|
+
ahAddress: this._ahAddress
|
|
12328
12632
|
};
|
|
12329
12633
|
}
|
|
12330
12634
|
/**
|
|
@@ -13399,7 +13703,8 @@ var getSupportedAssets = function getSupportedAssets(origin, destination) {
|
|
|
13399
13703
|
});
|
|
13400
13704
|
return [].concat(_toConsumableArray(polkadotAsset ? [polkadotAsset] : []), _toConsumableArray(kusamaAsset ? [kusamaAsset] : []));
|
|
13401
13705
|
}
|
|
13402
|
-
|
|
13706
|
+
var isBifrost = origin === 'BifrostPolkadot' || origin === 'BifrostKusama';
|
|
13707
|
+
if (!isRelayChain(origin) && getDefaultPallet(origin) === 'XTokens' && (destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama') && !isBifrost) {
|
|
13403
13708
|
return getOtherAssets(destination).filter(function (asset) {
|
|
13404
13709
|
return originAssets.some(function (a) {
|
|
13405
13710
|
return normalizeSymbol(a.symbol) === normalizeSymbol(asset.symbol);
|
|
@@ -13556,11 +13861,11 @@ var sendCommon = function sendCommon(options_1) {
|
|
|
13556
13861
|
return __awaiter(void 0, [options_1].concat(args_1), void 0, function (options) {
|
|
13557
13862
|
var serializedApiCallEnabled = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
13558
13863
|
return /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
13559
|
-
var _a, _b, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, isMultiLocationDestination, isBridge, isRelayDestination, originRelayChainSymbol, destinationRelayChainSymbol, originNode, assetCheckEnabled, isDestAssetHub, pallet, asset, nativeAssets, amountStr, currencyStr;
|
|
13864
|
+
var _a, _b, api, origin, currency, amount, address, destination, paraIdTo, destApiForKeepAlive, feeAsset, version, ahAddress, isMultiLocationDestination, isBridge, isRelayDestination, originRelayChainSymbol, destinationRelayChainSymbol, originNode, assetCheckEnabled, isDestAssetHub, pallet, isBifrost, asset, nativeAssets, amountStr, currencyStr;
|
|
13560
13865
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
13561
13866
|
while (1) switch (_context.prev = _context.next) {
|
|
13562
13867
|
case 0:
|
|
13563
|
-
api = options.api, origin = options.origin, currency = options.currency, amount = options.amount, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, feeAsset = options.feeAsset, version = options.version;
|
|
13868
|
+
api = options.api, origin = options.origin, currency = options.currency, amount = options.amount, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, destApiForKeepAlive = options.destApiForKeepAlive, feeAsset = options.feeAsset, version = options.version, ahAddress = options.ahAddress;
|
|
13564
13869
|
if (!((!('multiasset' in currency) || 'multilocation' in currency) && amount === null)) {
|
|
13565
13870
|
_context.next = 3;
|
|
13566
13871
|
break;
|
|
@@ -13610,11 +13915,11 @@ var sendCommon = function sendCommon(options_1) {
|
|
|
13610
13915
|
}
|
|
13611
13916
|
throw new InvalidCurrencyError('Fee asset index is out of bounds. Please provide a valid index.');
|
|
13612
13917
|
case 17:
|
|
13613
|
-
if (!(destination === 'Ethereum' && origin !== 'AssetHubPolkadot')) {
|
|
13918
|
+
if (!(destination === 'Ethereum' && origin !== 'AssetHubPolkadot' && origin !== 'Hydration')) {
|
|
13614
13919
|
_context.next = 19;
|
|
13615
13920
|
break;
|
|
13616
13921
|
}
|
|
13617
|
-
throw new IncompatibleNodesError('Transfers to Ethereum are only supported from AssetHubPolkadot.');
|
|
13922
|
+
throw new IncompatibleNodesError('Transfers to Ethereum are only supported from AssetHubPolkadot and Hydration.');
|
|
13618
13923
|
case 19:
|
|
13619
13924
|
isMultiLocationDestination = _typeof(destination) === 'object';
|
|
13620
13925
|
isBridge = origin === 'AssetHubPolkadot' && destination === 'AssetHubKusama' || origin === 'AssetHubKusama' && destination === 'AssetHubPolkadot';
|
|
@@ -13635,13 +13940,14 @@ var sendCommon = function sendCommon(options_1) {
|
|
|
13635
13940
|
assetCheckEnabled = 'multilocation' in currency || 'multiasset' in currency || isBridge ? false : originNode.assetCheckEnabled;
|
|
13636
13941
|
isDestAssetHub = destination === 'AssetHubPolkadot' || destination === 'AssetHubKusama';
|
|
13637
13942
|
pallet = getDefaultPallet(origin);
|
|
13638
|
-
|
|
13639
|
-
|
|
13943
|
+
isBifrost = origin === 'BifrostPolkadot' || origin === 'BifrostKusama';
|
|
13944
|
+
if (!(!isBridge && isDestAssetHub && pallet === 'XTokens' && !isBifrost)) {
|
|
13945
|
+
_context.next = 44;
|
|
13640
13946
|
break;
|
|
13641
13947
|
}
|
|
13642
13948
|
asset = getAssetBySymbolOrId(destination, currency, false, destination);
|
|
13643
13949
|
nativeAssets = getNativeAssets(destination);
|
|
13644
|
-
if (origin === '
|
|
13950
|
+
if (origin === 'Hydration') {
|
|
13645
13951
|
nativeAssets = nativeAssets.filter(function (nativeAsset) {
|
|
13646
13952
|
return nativeAsset.symbol !== 'DOT';
|
|
13647
13953
|
});
|
|
@@ -13649,76 +13955,76 @@ var sendCommon = function sendCommon(options_1) {
|
|
|
13649
13955
|
if (!('symbol' in currency && nativeAssets.some(function (nativeAsset) {
|
|
13650
13956
|
return nativeAsset.symbol.toLowerCase() === currency.symbol.toLowerCase();
|
|
13651
13957
|
}))) {
|
|
13652
|
-
_context.next =
|
|
13958
|
+
_context.next = 38;
|
|
13653
13959
|
break;
|
|
13654
13960
|
}
|
|
13655
13961
|
throw new InvalidCurrencyError("".concat(currency.symbol, " is not supported for transfers to ").concat(destination, "."));
|
|
13656
|
-
case
|
|
13962
|
+
case 38:
|
|
13657
13963
|
if (!(assetCheckEnabled && asset === null)) {
|
|
13658
|
-
_context.next =
|
|
13964
|
+
_context.next = 40;
|
|
13659
13965
|
break;
|
|
13660
13966
|
}
|
|
13661
13967
|
throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency), "."));
|
|
13662
|
-
case
|
|
13968
|
+
case 40:
|
|
13663
13969
|
if (!((asset === null || asset === void 0 ? void 0 : asset.symbol) && !hasSupportForAsset(origin, asset.symbol))) {
|
|
13664
|
-
_context.next =
|
|
13970
|
+
_context.next = 42;
|
|
13665
13971
|
break;
|
|
13666
13972
|
}
|
|
13667
13973
|
throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency ").concat(asset.symbol, "."));
|
|
13668
|
-
case
|
|
13669
|
-
_context.next =
|
|
13974
|
+
case 42:
|
|
13975
|
+
_context.next = 49;
|
|
13670
13976
|
break;
|
|
13671
|
-
case
|
|
13977
|
+
case 44:
|
|
13672
13978
|
asset = assetCheckEnabled ? getAssetBySymbolOrId(origin, currency, isRelayDestination, isTMultiLocation(destination) ? undefined : destination) : null;
|
|
13673
13979
|
if (!(!isBridge && asset === null && assetCheckEnabled)) {
|
|
13674
|
-
_context.next =
|
|
13980
|
+
_context.next = 47;
|
|
13675
13981
|
break;
|
|
13676
13982
|
}
|
|
13677
13983
|
throw new InvalidCurrencyError("Origin node ".concat(origin, " does not support currency ").concat(JSON.stringify(currency), "."));
|
|
13678
|
-
case
|
|
13984
|
+
case 47:
|
|
13679
13985
|
if (!(!isBridge && !isRelayDestination && !isMultiLocationDestination && (asset === null || asset === void 0 ? void 0 : asset.symbol) !== undefined && assetCheckEnabled && !('id' in currency) && !hasSupportForAsset(destination, asset.symbol))) {
|
|
13680
|
-
_context.next =
|
|
13986
|
+
_context.next = 49;
|
|
13681
13987
|
break;
|
|
13682
13988
|
}
|
|
13683
13989
|
throw new InvalidCurrencyError("Destination node ".concat(destination, " does not support currency ").concat(JSON.stringify(currency), "."));
|
|
13684
|
-
case
|
|
13685
|
-
_context.next =
|
|
13990
|
+
case 49:
|
|
13991
|
+
_context.next = 51;
|
|
13686
13992
|
return api.init(origin);
|
|
13687
|
-
case
|
|
13993
|
+
case 51:
|
|
13688
13994
|
amountStr = amount === null || amount === void 0 ? void 0 : amount.toString();
|
|
13689
13995
|
if (!('multilocation' in currency || 'multiasset' in currency)) {
|
|
13690
|
-
_context.next =
|
|
13996
|
+
_context.next = 56;
|
|
13691
13997
|
break;
|
|
13692
13998
|
}
|
|
13693
13999
|
console.warn('Keep alive check is not supported when using MultiLocation as currency.');
|
|
13694
|
-
_context.next =
|
|
14000
|
+
_context.next = 70;
|
|
13695
14001
|
break;
|
|
13696
|
-
case
|
|
14002
|
+
case 56:
|
|
13697
14003
|
if (!(_typeof(address) === 'object')) {
|
|
13698
|
-
_context.next =
|
|
14004
|
+
_context.next = 60;
|
|
13699
14005
|
break;
|
|
13700
14006
|
}
|
|
13701
14007
|
console.warn('Keep alive check is not supported when using MultiLocation as address.');
|
|
13702
|
-
_context.next =
|
|
14008
|
+
_context.next = 70;
|
|
13703
14009
|
break;
|
|
13704
|
-
case
|
|
14010
|
+
case 60:
|
|
13705
14011
|
if (!(_typeof(destination) === 'object')) {
|
|
13706
|
-
_context.next =
|
|
14012
|
+
_context.next = 64;
|
|
13707
14013
|
break;
|
|
13708
14014
|
}
|
|
13709
14015
|
console.warn('Keep alive check is not supported when using MultiLocation as destination.');
|
|
13710
|
-
_context.next =
|
|
14016
|
+
_context.next = 70;
|
|
13711
14017
|
break;
|
|
13712
|
-
case
|
|
14018
|
+
case 64:
|
|
13713
14019
|
if (!(origin === 'Ethereum' || destination === 'Ethereum')) {
|
|
13714
|
-
_context.next =
|
|
14020
|
+
_context.next = 68;
|
|
13715
14021
|
break;
|
|
13716
14022
|
}
|
|
13717
14023
|
console.warn('Keep alive check is not supported when using Ethereum as origin or destination.');
|
|
13718
|
-
_context.next =
|
|
14024
|
+
_context.next = 70;
|
|
13719
14025
|
break;
|
|
13720
|
-
case
|
|
13721
|
-
_context.next =
|
|
14026
|
+
case 68:
|
|
14027
|
+
_context.next = 70;
|
|
13722
14028
|
return checkKeepAlive({
|
|
13723
14029
|
originApi: api,
|
|
13724
14030
|
address: address,
|
|
@@ -13728,7 +14034,7 @@ var sendCommon = function sendCommon(options_1) {
|
|
|
13728
14034
|
currencySymbol: (_a = asset === null || asset === void 0 ? void 0 : asset.symbol) !== null && _a !== void 0 ? _a : 'symbol' in currency ? currency.symbol : undefined,
|
|
13729
14035
|
destNode: destination
|
|
13730
14036
|
});
|
|
13731
|
-
case
|
|
14037
|
+
case 70:
|
|
13732
14038
|
currencyStr = 'symbol' in currency ? currency.symbol : 'id' in currency ? currency.id.toString() : undefined;
|
|
13733
14039
|
return _context.abrupt("return", originNode.transfer({
|
|
13734
14040
|
api: api,
|
|
@@ -13742,9 +14048,10 @@ var sendCommon = function sendCommon(options_1) {
|
|
|
13742
14048
|
feeAsset: feeAsset,
|
|
13743
14049
|
version: version,
|
|
13744
14050
|
destApiForKeepAlive: destApiForKeepAlive,
|
|
13745
|
-
serializedApiCallEnabled: serializedApiCallEnabled
|
|
14051
|
+
serializedApiCallEnabled: serializedApiCallEnabled,
|
|
14052
|
+
ahAddress: ahAddress
|
|
13746
14053
|
}));
|
|
13747
|
-
case
|
|
14054
|
+
case 72:
|
|
13748
14055
|
case "end":
|
|
13749
14056
|
return _context.stop();
|
|
13750
14057
|
}
|
|
@@ -14118,21 +14425,32 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
14118
14425
|
}
|
|
14119
14426
|
throw new NodeNotSupportedError("The node ".concat(node, " is not yet supported by the Polkadot API."));
|
|
14120
14427
|
case 2:
|
|
14428
|
+
if (!(typeof this._api === 'string')) {
|
|
14429
|
+
_context.next = 8;
|
|
14430
|
+
break;
|
|
14431
|
+
}
|
|
14432
|
+
_context.next = 5;
|
|
14433
|
+
return this.createApiInstance(this._api);
|
|
14434
|
+
case 5:
|
|
14435
|
+
this.api = _context.sent;
|
|
14436
|
+
_context.next = 16;
|
|
14437
|
+
break;
|
|
14438
|
+
case 8:
|
|
14121
14439
|
if (!((_a = this._api) !== null && _a !== void 0)) {
|
|
14122
|
-
_context.next =
|
|
14440
|
+
_context.next = 12;
|
|
14123
14441
|
break;
|
|
14124
14442
|
}
|
|
14125
14443
|
_context.t0 = _a;
|
|
14126
|
-
_context.next =
|
|
14444
|
+
_context.next = 15;
|
|
14127
14445
|
break;
|
|
14128
|
-
case
|
|
14129
|
-
_context.next =
|
|
14446
|
+
case 12:
|
|
14447
|
+
_context.next = 14;
|
|
14130
14448
|
return createApiInstanceForNode$1(this, node);
|
|
14131
|
-
case
|
|
14449
|
+
case 14:
|
|
14132
14450
|
_context.t0 = _context.sent;
|
|
14133
|
-
case
|
|
14451
|
+
case 15:
|
|
14134
14452
|
this.api = _context.t0;
|
|
14135
|
-
case
|
|
14453
|
+
case 16:
|
|
14136
14454
|
case "end":
|
|
14137
14455
|
return _context.stop();
|
|
14138
14456
|
}
|
|
@@ -14343,11 +14661,49 @@ var PapiApi = /*#__PURE__*/function () {
|
|
|
14343
14661
|
}, _callee9, this);
|
|
14344
14662
|
}));
|
|
14345
14663
|
}
|
|
14664
|
+
}, {
|
|
14665
|
+
key: "getFromStorage",
|
|
14666
|
+
value: function getFromStorage(key) {
|
|
14667
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
14668
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
14669
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
14670
|
+
case 0:
|
|
14671
|
+
_context10.next = 2;
|
|
14672
|
+
return this.api._request('state_getStorage', [key]);
|
|
14673
|
+
case 2:
|
|
14674
|
+
return _context10.abrupt("return", _context10.sent);
|
|
14675
|
+
case 3:
|
|
14676
|
+
case "end":
|
|
14677
|
+
return _context10.stop();
|
|
14678
|
+
}
|
|
14679
|
+
}, _callee10, this);
|
|
14680
|
+
}));
|
|
14681
|
+
}
|
|
14346
14682
|
}, {
|
|
14347
14683
|
key: "clone",
|
|
14348
14684
|
value: function clone() {
|
|
14349
14685
|
return new PapiApi();
|
|
14350
14686
|
}
|
|
14687
|
+
}, {
|
|
14688
|
+
key: "createApiForNode",
|
|
14689
|
+
value: function createApiForNode(node) {
|
|
14690
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
14691
|
+
var api;
|
|
14692
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
14693
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
14694
|
+
case 0:
|
|
14695
|
+
api = new PapiApi();
|
|
14696
|
+
_context11.next = 3;
|
|
14697
|
+
return api.init(node);
|
|
14698
|
+
case 3:
|
|
14699
|
+
return _context11.abrupt("return", api);
|
|
14700
|
+
case 4:
|
|
14701
|
+
case "end":
|
|
14702
|
+
return _context11.stop();
|
|
14703
|
+
}
|
|
14704
|
+
}, _callee11);
|
|
14705
|
+
}));
|
|
14706
|
+
}
|
|
14351
14707
|
}]);
|
|
14352
14708
|
}();
|
|
14353
14709
|
|