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