@paraspell/sdk-core 11.6.1 → 11.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +498 -354
- package/dist/index.d.ts +50 -24
- package/dist/index.mjs +495 -356
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -726,6 +726,11 @@ var assertAddressIsString = function assertAddressIsString(address) {
|
|
|
726
726
|
throw new InvalidParameterError('Location address is not supported for this transfer type.');
|
|
727
727
|
}
|
|
728
728
|
};
|
|
729
|
+
var assertSenderAddress = function assertSenderAddress(address) {
|
|
730
|
+
if (!address) {
|
|
731
|
+
throw new InvalidParameterError('Sender address parameter is required for this transfer.');
|
|
732
|
+
}
|
|
733
|
+
};
|
|
729
734
|
var assertHasLocation = function assertHasLocation(asset) {
|
|
730
735
|
if (!asset.location) {
|
|
731
736
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, sdkCommon.replaceBigInt), " is missing location"));
|
|
@@ -823,9 +828,55 @@ var sortAssets = function sortAssets(assets$1) {
|
|
|
823
828
|
var isConfig = function isConfig(value) {
|
|
824
829
|
return _typeof(value) === 'object' && value !== null && !Array.isArray(value) && (
|
|
825
830
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
826
|
-
Object.keys(value).length < 3 || 'apiOverrides' in value || 'development' in value || 'abstractDecimals' in value);
|
|
831
|
+
Object.keys(value).length < 3 || 'apiOverrides' in value || 'development' in value || 'abstractDecimals' in value || 'xcmFormatCheck' in value);
|
|
827
832
|
};
|
|
828
833
|
|
|
834
|
+
var computeOverridenAmount = function computeOverridenAmount(options) {
|
|
835
|
+
var from = options.from,
|
|
836
|
+
to = options.to,
|
|
837
|
+
currency = options.currency,
|
|
838
|
+
api = options.api;
|
|
839
|
+
var config = api.getConfig();
|
|
840
|
+
if (isConfig(config) && config.abstractDecimals) {
|
|
841
|
+
return BYPASS_CURRENCY_AMOUNT;
|
|
842
|
+
} else {
|
|
843
|
+
assertToIsString(to);
|
|
844
|
+
var asset = assets.findAssetInfoOrThrow(from, currency, to);
|
|
845
|
+
return viem.parseUnits(BYPASS_CURRENCY_AMOUNT, asset.decimals);
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
var overrideTxAmount = function overrideTxAmount(options, builder) {
|
|
849
|
+
var modifiedBuilder = builder.currency(_objectSpread2(_objectSpread2({}, options.currency), {}, {
|
|
850
|
+
amount: computeOverridenAmount(options)
|
|
851
|
+
}));
|
|
852
|
+
return modifiedBuilder['buildInternal']();
|
|
853
|
+
};
|
|
854
|
+
var createTxs = /*#__PURE__*/function () {
|
|
855
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, builder) {
|
|
856
|
+
var tx, txBypass;
|
|
857
|
+
return _regenerator().w(function (_context) {
|
|
858
|
+
while (1) switch (_context.n) {
|
|
859
|
+
case 0:
|
|
860
|
+
_context.n = 1;
|
|
861
|
+
return builder['buildInternal']();
|
|
862
|
+
case 1:
|
|
863
|
+
tx = _context.v;
|
|
864
|
+
_context.n = 2;
|
|
865
|
+
return overrideTxAmount(options, builder);
|
|
866
|
+
case 2:
|
|
867
|
+
txBypass = _context.v;
|
|
868
|
+
return _context.a(2, {
|
|
869
|
+
tx: tx,
|
|
870
|
+
txBypass: txBypass
|
|
871
|
+
});
|
|
872
|
+
}
|
|
873
|
+
}, _callee);
|
|
874
|
+
}));
|
|
875
|
+
return function createTxs(_x, _x2) {
|
|
876
|
+
return _ref.apply(this, arguments);
|
|
877
|
+
};
|
|
878
|
+
}();
|
|
879
|
+
|
|
829
880
|
/**
|
|
830
881
|
* Retrieves the chain instance for a given chain.
|
|
831
882
|
*
|
|
@@ -3552,12 +3603,7 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
3552
3603
|
while (1) switch (_context.n) {
|
|
3553
3604
|
case 0:
|
|
3554
3605
|
api = options.api, senderAddress = options.senderAddress, paraIdTo = options.paraIdTo, assetInfo = options.assetInfo, currency = options.currency, feeCurrency = options.feeCurrency, address = options.address, feeAssetInfo = options.feeAssetInfo, version = options.version;
|
|
3555
|
-
|
|
3556
|
-
_context.n = 1;
|
|
3557
|
-
break;
|
|
3558
|
-
}
|
|
3559
|
-
throw new InvalidParameterError('Please provide senderAddress');
|
|
3560
|
-
case 1:
|
|
3606
|
+
assertSenderAddress(senderAddress);
|
|
3561
3607
|
assertAddressIsString(address);
|
|
3562
3608
|
checkAmount = function checkAmount(fee) {
|
|
3563
3609
|
if (assetInfo.amount <= fee) {
|
|
@@ -3588,7 +3634,7 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
3588
3634
|
reserveFee: MIN_FEE
|
|
3589
3635
|
}
|
|
3590
3636
|
})), MAX_WEIGHT);
|
|
3591
|
-
_context.n =
|
|
3637
|
+
_context.n = 1;
|
|
3592
3638
|
return dryRunInternal({
|
|
3593
3639
|
api: api,
|
|
3594
3640
|
tx: api.callTxMethod(call),
|
|
@@ -3600,14 +3646,14 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
3600
3646
|
feeAsset: feeCurrency,
|
|
3601
3647
|
useRootOrigin: true
|
|
3602
3648
|
});
|
|
3603
|
-
case
|
|
3649
|
+
case 1:
|
|
3604
3650
|
dryRunResult = _context.v;
|
|
3605
3651
|
if (dryRunResult.origin.success) {
|
|
3606
|
-
_context.n =
|
|
3652
|
+
_context.n = 2;
|
|
3607
3653
|
break;
|
|
3608
3654
|
}
|
|
3609
3655
|
throw new DryRunFailedError(dryRunResult.failureReason);
|
|
3610
|
-
case
|
|
3656
|
+
case 2:
|
|
3611
3657
|
originFeeEstimate = dryRunResult.origin.fee;
|
|
3612
3658
|
originFee = padFeeBy(originFeeEstimate, FEE_PADDING_PERCENTAGE$2);
|
|
3613
3659
|
reserveFeeEstimate = getReserveFeeFromHops(dryRunResult.hops);
|
|
@@ -3619,9 +3665,9 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
3619
3665
|
reserveFee: reserveFee
|
|
3620
3666
|
}
|
|
3621
3667
|
}));
|
|
3622
|
-
_context.n =
|
|
3668
|
+
_context.n = 3;
|
|
3623
3669
|
return api.getXcmWeight(xcm);
|
|
3624
|
-
case
|
|
3670
|
+
case 3:
|
|
3625
3671
|
weight = _context.v;
|
|
3626
3672
|
return _context.a(2, createExecuteCall(chain, xcm, weight));
|
|
3627
3673
|
}
|
|
@@ -3659,7 +3705,7 @@ var getReverseTxFee = /*#__PURE__*/function () {
|
|
|
3659
3705
|
_context.n = 1;
|
|
3660
3706
|
return Builder(api).from(destination).to(origin).address(toAddress).senderAddress(fromAddress).currency(_objectSpread2(_objectSpread2({}, currencyInput), {}, {
|
|
3661
3707
|
amount: currency.amount
|
|
3662
|
-
}))
|
|
3708
|
+
}))['buildInternal']();
|
|
3663
3709
|
case 1:
|
|
3664
3710
|
tx = _context.v;
|
|
3665
3711
|
_context.n = 2;
|
|
@@ -4152,7 +4198,7 @@ var getOriginFeeDetailsInternal = /*#__PURE__*/function () {
|
|
|
4152
4198
|
return api.init(origin);
|
|
4153
4199
|
case 1:
|
|
4154
4200
|
_context.n = 2;
|
|
4155
|
-
return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination).senderAddress(account).ahAddress(ahAddress)
|
|
4201
|
+
return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination).senderAddress(account).ahAddress(ahAddress)['buildInternal']();
|
|
4156
4202
|
case 2:
|
|
4157
4203
|
tx = _context.v;
|
|
4158
4204
|
_context.n = 3;
|
|
@@ -4694,9 +4740,7 @@ var createCustomXcmOnDest = function createCustomXcmOnDest(_ref, origin, message
|
|
|
4694
4740
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, sdkCommon.replaceBigInt), " is not a foreign asset"));
|
|
4695
4741
|
}
|
|
4696
4742
|
assertHasLocation(asset);
|
|
4697
|
-
|
|
4698
|
-
throw new InvalidParameterError("Please provide senderAddress");
|
|
4699
|
-
}
|
|
4743
|
+
assertSenderAddress(senderAddress);
|
|
4700
4744
|
if (assets.isChainEvm(origin) && !ahAddress) {
|
|
4701
4745
|
throw new InvalidParameterError("Please provide ahAddress");
|
|
4702
4746
|
}
|
|
@@ -4966,18 +5010,13 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
4966
5010
|
}
|
|
4967
5011
|
});
|
|
4968
5012
|
senderAddress = (_signer$account = signer.account) === null || _signer$account === void 0 ? void 0 : _signer$account.address;
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
}
|
|
4973
|
-
throw new InvalidParameterError('Unable to get sender address');
|
|
5013
|
+
assertSenderAddress(senderAddress);
|
|
5014
|
+
_context.n = 8;
|
|
5015
|
+
return api.init(from, TX_CLIENT_TIMEOUT_MS);
|
|
4974
5016
|
case 8:
|
|
4975
5017
|
_context.n = 9;
|
|
4976
|
-
return api.init(from, TX_CLIENT_TIMEOUT_MS);
|
|
4977
|
-
case 9:
|
|
4978
|
-
_context.n = 10;
|
|
4979
5018
|
return generateMessageId(api, senderAddress, getParaId(from), ethAsset.assetId, address, amount);
|
|
4980
|
-
case
|
|
5019
|
+
case 9:
|
|
4981
5020
|
messageId = _context.v;
|
|
4982
5021
|
customXcm = createCustomXcmOnDest({
|
|
4983
5022
|
api: api,
|
|
@@ -4989,17 +5028,17 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
4989
5028
|
}),
|
|
4990
5029
|
version: sdkCommon.Version.V4
|
|
4991
5030
|
}, from, messageId);
|
|
4992
|
-
_context.n =
|
|
5031
|
+
_context.n = 10;
|
|
4993
5032
|
return api.objectToHex(customXcm, 'XcmVersionedXcm');
|
|
4994
|
-
case
|
|
5033
|
+
case 10:
|
|
4995
5034
|
customXcmOnDest = _context.v;
|
|
4996
|
-
_context.n =
|
|
5035
|
+
_context.n = 11;
|
|
4997
5036
|
return api.createApiForChain('AssetHubPolkadot');
|
|
4998
|
-
case
|
|
5037
|
+
case 11:
|
|
4999
5038
|
assetHubApi = _context.v;
|
|
5000
|
-
_context.n =
|
|
5039
|
+
_context.n = 12;
|
|
5001
5040
|
return getParaEthTransferFees(assetHubApi);
|
|
5002
|
-
case
|
|
5041
|
+
case 12:
|
|
5003
5042
|
_yield$getParaEthTran = _context.v;
|
|
5004
5043
|
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
5005
5044
|
bridgeFee = _yield$getParaEthTran2[0];
|
|
@@ -5014,7 +5053,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
5014
5053
|
throw new InvalidParameterError('Input must be a valid number');
|
|
5015
5054
|
}() : "0x".concat((num >>> 0).toString(16).padStart(8, '0'));
|
|
5016
5055
|
}; // Execute the custom XCM message with the precompile
|
|
5017
|
-
_context.n =
|
|
5056
|
+
_context.n = 13;
|
|
5018
5057
|
return createTx('transferAssetsUsingTypeAndThenAddress', [
|
|
5019
5058
|
// This represents (1,X1(Parachain(1000)))
|
|
5020
5059
|
[1, ['0x00' + numberToHex32(getParaId('AssetHubPolkadot')).slice(2)]],
|
|
@@ -5026,7 +5065,7 @@ var transferMoonbeamToEth = /*#__PURE__*/function () {
|
|
|
5026
5065
|
0,
|
|
5027
5066
|
// The TransferType corresponding to fee asset
|
|
5028
5067
|
2, customXcmOnDest]);
|
|
5029
|
-
case
|
|
5068
|
+
case 13:
|
|
5030
5069
|
tx = _context.v;
|
|
5031
5070
|
return _context.a(2, tx);
|
|
5032
5071
|
}
|
|
@@ -5765,13 +5804,8 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
5765
5804
|
}
|
|
5766
5805
|
throw new InvalidParameterError('Location address is not supported for this scenario');
|
|
5767
5806
|
case 2:
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
break;
|
|
5771
|
-
}
|
|
5772
|
-
throw new InvalidParameterError("Please provide senderAddress");
|
|
5773
|
-
case 3:
|
|
5774
|
-
_context.n = 4;
|
|
5807
|
+
assertSenderAddress(senderAddress);
|
|
5808
|
+
_context.n = 3;
|
|
5775
5809
|
return dryRunInternal({
|
|
5776
5810
|
api: api,
|
|
5777
5811
|
tx: defaultTx,
|
|
@@ -5781,20 +5815,20 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
5781
5815
|
address: address,
|
|
5782
5816
|
currency: currency
|
|
5783
5817
|
});
|
|
5784
|
-
case
|
|
5818
|
+
case 3:
|
|
5785
5819
|
dryRunResult = _context.v;
|
|
5786
5820
|
if (!((_dryRunResult$destina = dryRunResult.destination) !== null && _dryRunResult$destina !== void 0 && _dryRunResult$destina.success)) {
|
|
5787
|
-
_context.n =
|
|
5821
|
+
_context.n = 4;
|
|
5788
5822
|
break;
|
|
5789
5823
|
}
|
|
5790
5824
|
return _context.a(2, defaultTx);
|
|
5791
|
-
case
|
|
5825
|
+
case 4:
|
|
5792
5826
|
// If the default tx dry run failed, we need to create execute transaction
|
|
5793
5827
|
dummyTx = createExecuteExchangeXcm(input, origin, MAX_WEIGHT,
|
|
5794
5828
|
// Enter dummy fee values just to get the dry run to pass
|
|
5795
5829
|
asset.amount, asset.amount / 2n);
|
|
5796
|
-
_context.n =
|
|
5797
|
-
return
|
|
5830
|
+
_context.n = 5;
|
|
5831
|
+
return getXcmFeeInternal({
|
|
5798
5832
|
api: api,
|
|
5799
5833
|
tx: dummyTx,
|
|
5800
5834
|
origin: origin,
|
|
@@ -5802,9 +5836,10 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
5802
5836
|
senderAddress: senderAddress,
|
|
5803
5837
|
address: address,
|
|
5804
5838
|
currency: currency,
|
|
5805
|
-
disableFallback: false
|
|
5839
|
+
disableFallback: false,
|
|
5840
|
+
useRootOrigin: true
|
|
5806
5841
|
});
|
|
5807
|
-
case
|
|
5842
|
+
case 5:
|
|
5808
5843
|
feeResult = _context.v;
|
|
5809
5844
|
originExecutionFee = padFeeBy(feeResult.origin.fee, 20); // Pad by 20%
|
|
5810
5845
|
destinationExecutionFee = padFeeBy(
|
|
@@ -6396,20 +6431,15 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6396
6431
|
case 2:
|
|
6397
6432
|
assertHasLocation(asset);
|
|
6398
6433
|
assertAddressIsString(address);
|
|
6399
|
-
|
|
6400
|
-
_context3.n = 3;
|
|
6401
|
-
break;
|
|
6402
|
-
}
|
|
6403
|
-
throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
|
|
6404
|
-
case 3:
|
|
6434
|
+
assertSenderAddress(senderAddress);
|
|
6405
6435
|
ethAsset = createAsset(version, asset.amount, asset.location);
|
|
6406
|
-
_context3.n =
|
|
6436
|
+
_context3.n = 3;
|
|
6407
6437
|
return api.createApiForChain('AssetHubPolkadot');
|
|
6408
|
-
case
|
|
6438
|
+
case 3:
|
|
6409
6439
|
ahApi = _context3.v;
|
|
6410
|
-
_context3.n =
|
|
6440
|
+
_context3.n = 4;
|
|
6411
6441
|
return getParaEthTransferFees(ahApi);
|
|
6412
|
-
case
|
|
6442
|
+
case 4:
|
|
6413
6443
|
_yield$getParaEthTran = _context3.v;
|
|
6414
6444
|
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
6415
6445
|
bridgeFee = _yield$getParaEthTran2[0];
|
|
@@ -6418,13 +6448,13 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6418
6448
|
fee = useOnlyDepositInstruction ? PARA_TO_PARA_FEE_DOT : bridgeFee + executionFee;
|
|
6419
6449
|
ethAssetInfo = assets.findAssetInfoByLoc(assets.getOtherAssets('Ethereum'), asset.location);
|
|
6420
6450
|
if (ethAssetInfo) {
|
|
6421
|
-
_context3.n =
|
|
6451
|
+
_context3.n = 5;
|
|
6422
6452
|
break;
|
|
6423
6453
|
}
|
|
6424
6454
|
throw new assets.InvalidCurrencyError("Could not obtain Ethereum asset address for ".concat(JSON.stringify(asset, sdkCommon.replaceBigInt)));
|
|
6425
|
-
case
|
|
6455
|
+
case 5:
|
|
6426
6456
|
if (!useOnlyDepositInstruction) {
|
|
6427
|
-
_context3.n =
|
|
6457
|
+
_context3.n = 6;
|
|
6428
6458
|
break;
|
|
6429
6459
|
}
|
|
6430
6460
|
customXcmOnDest = addXcmVersionHeader([{
|
|
@@ -6441,16 +6471,16 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6441
6471
|
})
|
|
6442
6472
|
}
|
|
6443
6473
|
}], version);
|
|
6444
|
-
_context3.n =
|
|
6474
|
+
_context3.n = 8;
|
|
6445
6475
|
break;
|
|
6446
|
-
case
|
|
6476
|
+
case 6:
|
|
6447
6477
|
assertHasId(ethAssetInfo);
|
|
6448
|
-
_context3.n =
|
|
6478
|
+
_context3.n = 7;
|
|
6449
6479
|
return generateMessageId(api, senderAddress, getParaId(this.chain), ethAssetInfo.assetId, address, asset.amount);
|
|
6450
|
-
case
|
|
6480
|
+
case 7:
|
|
6451
6481
|
messageId = _context3.v;
|
|
6452
6482
|
customXcmOnDest = createCustomXcmOnDest(input, this.chain, messageId);
|
|
6453
|
-
case
|
|
6483
|
+
case 8:
|
|
6454
6484
|
call = {
|
|
6455
6485
|
module: 'PolkadotXcm',
|
|
6456
6486
|
method: 'transfer_assets_using_type_and_then',
|
|
@@ -6863,23 +6893,18 @@ var AssetHubPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
6863
6893
|
}
|
|
6864
6894
|
throw new BridgeHaltedError();
|
|
6865
6895
|
case 2:
|
|
6866
|
-
|
|
6867
|
-
_context.n = 3;
|
|
6868
|
-
break;
|
|
6869
|
-
}
|
|
6870
|
-
throw new InvalidParameterError('Sender address is required for transfers to Ethereum');
|
|
6871
|
-
case 3:
|
|
6896
|
+
assertSenderAddress(senderAddress);
|
|
6872
6897
|
if (!sdkCommon.isTLocation(address)) {
|
|
6873
|
-
_context.n =
|
|
6898
|
+
_context.n = 3;
|
|
6874
6899
|
break;
|
|
6875
6900
|
}
|
|
6876
6901
|
throw new InvalidParameterError('Location address is not supported for Ethereum transfers');
|
|
6877
|
-
case
|
|
6902
|
+
case 3:
|
|
6878
6903
|
assertIsForeign(asset);
|
|
6879
6904
|
assertHasLocation(asset);
|
|
6880
|
-
_context.n =
|
|
6905
|
+
_context.n = 4;
|
|
6881
6906
|
return generateMessageId(api, senderAddress, getParaId(this.chain), JSON.stringify(asset.location), address, asset.amount);
|
|
6882
|
-
case
|
|
6907
|
+
case 4:
|
|
6883
6908
|
messageId = _context.v;
|
|
6884
6909
|
location = asset.symbol === this.getNativeAssetSymbol() ? DOT_LOCATION : asset.location;
|
|
6885
6910
|
call = {
|
|
@@ -8825,43 +8850,38 @@ var createTypeAndThenTransfer = /*#__PURE__*/function () {
|
|
|
8825
8850
|
api = options.api, asset = options.assetInfo, senderAddress = options.senderAddress, address = options.address, destination = options.destination;
|
|
8826
8851
|
assertHasLocation(asset);
|
|
8827
8852
|
assertAddressIsString(address);
|
|
8828
|
-
|
|
8829
|
-
_context.n = 1;
|
|
8830
|
-
break;
|
|
8831
|
-
}
|
|
8832
|
-
throw new assets.InvalidCurrencyError("Sender address is required for Mythos transfer");
|
|
8833
|
-
case 1:
|
|
8853
|
+
assertSenderAddress(senderAddress);
|
|
8834
8854
|
if (!(!assets.isForeignAsset(asset) || !asset.assetId)) {
|
|
8835
|
-
_context.n =
|
|
8855
|
+
_context.n = 1;
|
|
8836
8856
|
break;
|
|
8837
8857
|
}
|
|
8838
8858
|
throw new assets.InvalidCurrencyError("Asset ".concat(JSON.stringify(asset, sdkCommon.replaceBigInt), " is not a foreign asset"));
|
|
8839
|
-
case
|
|
8840
|
-
_context.n =
|
|
8859
|
+
case 1:
|
|
8860
|
+
_context.n = 2;
|
|
8841
8861
|
return generateMessageId(api, senderAddress, getParaId(chain), asset.assetId, address, asset.amount);
|
|
8842
|
-
case
|
|
8862
|
+
case 2:
|
|
8843
8863
|
messageId = _context.v;
|
|
8844
8864
|
ahApi = api.clone();
|
|
8845
|
-
_context.n =
|
|
8865
|
+
_context.n = 3;
|
|
8846
8866
|
return ahApi.init('AssetHubPolkadot');
|
|
8847
|
-
case
|
|
8848
|
-
_context.n =
|
|
8867
|
+
case 3:
|
|
8868
|
+
_context.n = 4;
|
|
8849
8869
|
return getParaEthTransferFees(ahApi);
|
|
8850
|
-
case
|
|
8870
|
+
case 4:
|
|
8851
8871
|
_yield$getParaEthTran = _context.v;
|
|
8852
8872
|
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
8853
8873
|
bridgeFee = _yield$getParaEthTran2[0];
|
|
8854
8874
|
ahExecutionFee = _yield$getParaEthTran2[1];
|
|
8855
|
-
_context.n =
|
|
8875
|
+
_context.n = 5;
|
|
8856
8876
|
return ahApi.quoteAhPrice(DOT_LOCATION, assets.getNativeAssets(chain)[0].location, bridgeFee + ahExecutionFee);
|
|
8857
|
-
case
|
|
8877
|
+
case 5:
|
|
8858
8878
|
feeConverted = _context.v;
|
|
8859
8879
|
if (feeConverted) {
|
|
8860
|
-
_context.n =
|
|
8880
|
+
_context.n = 6;
|
|
8861
8881
|
break;
|
|
8862
8882
|
}
|
|
8863
8883
|
throw new InvalidParameterError("Pool DOT -> ".concat(asset.symbol, " not found."));
|
|
8864
|
-
case
|
|
8884
|
+
case 6:
|
|
8865
8885
|
nativeMythAmount = padFeeBy(feeConverted, 10);
|
|
8866
8886
|
return _context.a(2, {
|
|
8867
8887
|
module: 'PolkadotXcm',
|
|
@@ -10309,18 +10329,21 @@ var getOriginXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10309
10329
|
|
|
10310
10330
|
var getOriginXcmFee = /*#__PURE__*/function () {
|
|
10311
10331
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
10312
|
-
var forced, real;
|
|
10332
|
+
var _options$txs, tx, txBypass, forced, real;
|
|
10313
10333
|
return _regenerator().w(function (_context) {
|
|
10314
10334
|
while (1) switch (_context.n) {
|
|
10315
10335
|
case 0:
|
|
10336
|
+
_options$txs = options.txs, tx = _options$txs.tx, txBypass = _options$txs.txBypass;
|
|
10316
10337
|
_context.n = 1;
|
|
10317
10338
|
return getOriginXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10339
|
+
tx: txBypass,
|
|
10318
10340
|
useRootOrigin: true
|
|
10319
10341
|
}));
|
|
10320
10342
|
case 1:
|
|
10321
10343
|
forced = _context.v;
|
|
10322
10344
|
_context.n = 2;
|
|
10323
10345
|
return getOriginXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10346
|
+
tx: tx,
|
|
10324
10347
|
useRootOrigin: false
|
|
10325
10348
|
}));
|
|
10326
10349
|
case 2:
|
|
@@ -10559,12 +10582,12 @@ var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
|
10559
10582
|
return {};
|
|
10560
10583
|
};
|
|
10561
10584
|
var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
10562
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref
|
|
10563
|
-
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, asset, amount, _yield$getOriginXcmFe, originFee, originCurrency, originAsset, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, originWeight, sufficientOriginFee, destApi, destFeeRes, _result, _getFailureInfo, _failureChain, _failureReason, processHop, traversalResult, destFee, destCurrency, destAsset, destFeeType, destDryRunError, destSufficient, destResult, _destApi, destFallback, assetHubChain, processedBridgeHub, bridgeHubChain, bridgeHubHopIndex, convertToFeeDetail, result, _getFailureInfo2, failureChain, failureReason;
|
|
10585
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
10586
|
+
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, asset, amount, _yield$getOriginXcmFe, originFee, originCurrency, originAsset, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, originWeight, sufficientOriginFee, destApi, destFeeRes, _result, _getFailureInfo, _failureChain, _failureReason, processHop, traversalResult, destFee, destCurrency, destAsset, destFeeType, destDryRunError, destSufficient, destResult, _destApi, destFallback, assetHubChain, processedBridgeHub, bridgeHubChain, bridgeHubHopIndex, convertToFeeDetail, result, _getFailureInfo2, failureChain, failureReason;
|
|
10564
10587
|
return _regenerator().w(function (_context2) {
|
|
10565
10588
|
while (1) switch (_context2.p = _context2.n) {
|
|
10566
10589
|
case 0:
|
|
10567
|
-
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, currency = _ref.currency, feeAsset = _ref.feeAsset, disableFallback = _ref.disableFallback, swapConfig = _ref.swapConfig;
|
|
10590
|
+
api = _ref.api, tx = _ref.tx, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, currency = _ref.currency, feeAsset = _ref.feeAsset, disableFallback = _ref.disableFallback, swapConfig = _ref.swapConfig, useRootOrigin = _ref.useRootOrigin;
|
|
10568
10591
|
asset = assets.findAssetInfoOrThrow(origin, currency, destination);
|
|
10569
10592
|
amount = abstractDecimals(currency.amount, asset.decimals, api);
|
|
10570
10593
|
_context2.n = 1;
|
|
@@ -10708,7 +10731,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10708
10731
|
}
|
|
10709
10732
|
}, _callee);
|
|
10710
10733
|
}));
|
|
10711
|
-
return function processHop(
|
|
10734
|
+
return function processHop(_x2) {
|
|
10712
10735
|
return _ref3.apply(this, arguments);
|
|
10713
10736
|
};
|
|
10714
10737
|
}();
|
|
@@ -10881,7 +10904,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10881
10904
|
}
|
|
10882
10905
|
}, _callee2, null, [[2,, 5, 7]]);
|
|
10883
10906
|
}));
|
|
10884
|
-
return function getXcmFeeInternal(_x
|
|
10907
|
+
return function getXcmFeeInternal(_x) {
|
|
10885
10908
|
return _ref2.apply(this, arguments);
|
|
10886
10909
|
};
|
|
10887
10910
|
}();
|
|
@@ -10889,16 +10912,23 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10889
10912
|
var getXcmFee = /*#__PURE__*/function () {
|
|
10890
10913
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
10891
10914
|
var _real$assetHub, _real$bridgeHub;
|
|
10892
|
-
var forced, real, api;
|
|
10915
|
+
var _options$txs, tx, txBypass, forced, real, api;
|
|
10893
10916
|
return _regenerator().w(function (_context) {
|
|
10894
10917
|
while (1) switch (_context.n) {
|
|
10895
10918
|
case 0:
|
|
10919
|
+
_options$txs = options.txs, tx = _options$txs.tx, txBypass = _options$txs.txBypass;
|
|
10896
10920
|
_context.n = 1;
|
|
10897
|
-
return getXcmFeeInternal(options,
|
|
10921
|
+
return getXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10922
|
+
tx: txBypass,
|
|
10923
|
+
useRootOrigin: true
|
|
10924
|
+
}));
|
|
10898
10925
|
case 1:
|
|
10899
10926
|
forced = _context.v;
|
|
10900
10927
|
_context.n = 2;
|
|
10901
|
-
return getXcmFeeInternal(options,
|
|
10928
|
+
return getXcmFeeInternal(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
10929
|
+
tx: tx,
|
|
10930
|
+
useRootOrigin: false
|
|
10931
|
+
}));
|
|
10902
10932
|
case 2:
|
|
10903
10933
|
real = _context.v;
|
|
10904
10934
|
api = options.api;
|
|
@@ -11375,11 +11405,11 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
11375
11405
|
|
|
11376
11406
|
var getTransferInfo = /*#__PURE__*/function () {
|
|
11377
11407
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
11378
|
-
var api,
|
|
11408
|
+
var api, txs, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$getXcmFee, _yield$getXcmFee$orig, originFee, originFeeCurrency, originFeeAsset, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, hops, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubChain, builtHops, totalHopFee, destinationInfo, _t;
|
|
11379
11409
|
return _regenerator().w(function (_context2) {
|
|
11380
11410
|
while (1) switch (_context2.p = _context2.n) {
|
|
11381
11411
|
case 0:
|
|
11382
|
-
api = _ref.api,
|
|
11412
|
+
api = _ref.api, txs = _ref.txs, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, ahAddress = _ref.ahAddress, address = _ref.address, currency = _ref.currency, feeAsset = _ref.feeAsset;
|
|
11383
11413
|
if (!(assets.isChainEvm(origin) && !ahAddress)) {
|
|
11384
11414
|
_context2.n = 1;
|
|
11385
11415
|
break;
|
|
@@ -11433,7 +11463,7 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
11433
11463
|
_context2.n = 9;
|
|
11434
11464
|
return getXcmFee({
|
|
11435
11465
|
api: api,
|
|
11436
|
-
|
|
11466
|
+
txs: txs,
|
|
11437
11467
|
origin: origin,
|
|
11438
11468
|
destination: destination,
|
|
11439
11469
|
senderAddress: senderAddress,
|
|
@@ -11601,11 +11631,11 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
11601
11631
|
|
|
11602
11632
|
var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
11603
11633
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
11604
|
-
var api, origin, senderAddress, address, chain, destination, currency,
|
|
11634
|
+
var api, origin, senderAddress, address, chain, destination, currency, feeAsset, txs, builder, resolvedFeeAsset, asset, destAsset, destCurrency, destApi, destBalance, destEd, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, amount, result, originFee, hopFeeTotal, destinationFee, edComponent, minAmount, modifiedBuilder, dryRunResult, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
11605
11635
|
return _regenerator().w(function (_context) {
|
|
11606
11636
|
while (1) switch (_context.n) {
|
|
11607
11637
|
case 0:
|
|
11608
|
-
api = _ref.api, origin = _ref.origin, senderAddress = _ref.senderAddress, address = _ref.address, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency,
|
|
11638
|
+
api = _ref.api, origin = _ref.origin, senderAddress = _ref.senderAddress, address = _ref.address, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, feeAsset = _ref.feeAsset, txs = _ref.txs, builder = _ref.builder;
|
|
11609
11639
|
validateAddress(senderAddress, chain, false);
|
|
11610
11640
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
|
|
11611
11641
|
asset = assets.findAssetInfoOrThrow(chain, currency, null);
|
|
@@ -11634,11 +11664,11 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
11634
11664
|
paysOriginInSendingAsset = !resolvedFeeAsset && isNativeAsset || resolvedFeeAsset && assets.isAssetEqual(resolvedFeeAsset, asset);
|
|
11635
11665
|
amount = abstractDecimals(currency.amount, asset.decimals, api);
|
|
11636
11666
|
_context.n = 3;
|
|
11637
|
-
return
|
|
11667
|
+
return getXcmFee({
|
|
11638
11668
|
api: api,
|
|
11639
11669
|
origin: origin,
|
|
11640
11670
|
destination: destination,
|
|
11641
|
-
|
|
11671
|
+
txs: txs,
|
|
11642
11672
|
senderAddress: senderAddress,
|
|
11643
11673
|
address: address,
|
|
11644
11674
|
currency: _objectSpread2(_objectSpread2({}, currency), {}, {
|
|
@@ -11646,9 +11676,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
11646
11676
|
}),
|
|
11647
11677
|
feeAsset: feeAsset,
|
|
11648
11678
|
disableFallback: false
|
|
11649
|
-
}
|
|
11650
|
-
// Use dryRun bypass
|
|
11651
|
-
true);
|
|
11679
|
+
});
|
|
11652
11680
|
case 3:
|
|
11653
11681
|
result = _context.v;
|
|
11654
11682
|
originFee = result.origin && paysOriginInSendingAsset && assets.isAssetEqual(result.origin.asset, asset) ? result.origin.fee : 0n;
|
|
@@ -11665,7 +11693,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
11665
11693
|
_t = dryRunInternal;
|
|
11666
11694
|
_t2 = api;
|
|
11667
11695
|
_context.n = 4;
|
|
11668
|
-
return modifiedBuilder
|
|
11696
|
+
return modifiedBuilder['buildInternal']();
|
|
11669
11697
|
case 4:
|
|
11670
11698
|
_t3 = _context.v;
|
|
11671
11699
|
_t4 = chain;
|
|
@@ -11735,11 +11763,11 @@ var getMinTransferableAmount = /*#__PURE__*/function () {
|
|
|
11735
11763
|
|
|
11736
11764
|
var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
11737
11765
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
11738
|
-
var api, senderAddress, chain, destination, currency,
|
|
11766
|
+
var api, senderAddress, chain, destination, currency, txs, feeAsset, resolvedFeeAsset, asset, amount, balance, ed, nativeAssetInfo, isNativeAsset, paysOriginInSendingAsset, feeToSubtract, _yield$getOriginXcmFe, fee, transferable;
|
|
11739
11767
|
return _regenerator().w(function (_context) {
|
|
11740
11768
|
while (1) switch (_context.n) {
|
|
11741
11769
|
case 0:
|
|
11742
|
-
api = _ref.api, senderAddress = _ref.senderAddress, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency,
|
|
11770
|
+
api = _ref.api, senderAddress = _ref.senderAddress, chain = _ref.origin, destination = _ref.destination, currency = _ref.currency, txs = _ref.txs, feeAsset = _ref.feeAsset;
|
|
11743
11771
|
validateAddress(senderAddress, chain, false);
|
|
11744
11772
|
resolvedFeeAsset = feeAsset ? resolveFeeAsset(feeAsset, chain, destination, currency) : undefined;
|
|
11745
11773
|
asset = assets.findAssetInfoOrThrow(chain, currency, null);
|
|
@@ -11765,7 +11793,7 @@ var getTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
11765
11793
|
_context.n = 2;
|
|
11766
11794
|
return getOriginXcmFee({
|
|
11767
11795
|
api: api,
|
|
11768
|
-
|
|
11796
|
+
txs: txs,
|
|
11769
11797
|
origin: chain,
|
|
11770
11798
|
destination: chain,
|
|
11771
11799
|
senderAddress: senderAddress,
|
|
@@ -11852,7 +11880,7 @@ var buildTypeAndThenCall = function buildTypeAndThenCall(_ref, isDotAsset, custo
|
|
|
11852
11880
|
};
|
|
11853
11881
|
|
|
11854
11882
|
var FEE_PADDING_PERCENTAGE = 20;
|
|
11855
|
-
var FEE_PADDING_HYDRATION =
|
|
11883
|
+
var FEE_PADDING_HYDRATION = 500;
|
|
11856
11884
|
var computeInstructionFee = /*#__PURE__*/function () {
|
|
11857
11885
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, version, xcm) {
|
|
11858
11886
|
var chain, api, _t;
|
|
@@ -12150,12 +12178,12 @@ var calculateTotalXcmFee = function calculateTotalXcmFee(feeResult) {
|
|
|
12150
12178
|
return totalFee;
|
|
12151
12179
|
};
|
|
12152
12180
|
var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
12153
|
-
var
|
|
12154
|
-
var api,
|
|
12181
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
12182
|
+
var api, txs, origin, destination, currency, address, senderAddress, feeAsset, destApi, asset, amount, destCurrency, ed, balance, tx, txBypass, xcmFeeResult, dryRunError, assetHubFeeResult, bridgeHubFeeResult, _xcmFeeResult$destina, destFee, destFeeCurrency, destDryRunError, hopDryRunError, totalFee, method, feeToSubtract;
|
|
12155
12183
|
return _regenerator().w(function (_context) {
|
|
12156
12184
|
while (1) switch (_context.n) {
|
|
12157
12185
|
case 0:
|
|
12158
|
-
api =
|
|
12186
|
+
api = options.api, txs = options.txs, origin = options.origin, destination = options.destination, currency = options.currency, address = options.address, senderAddress = options.senderAddress, feeAsset = options.feeAsset;
|
|
12159
12187
|
if (!(destination === 'Ethereum')) {
|
|
12160
12188
|
_context.n = 1;
|
|
12161
12189
|
break;
|
|
@@ -12196,10 +12224,11 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
12196
12224
|
});
|
|
12197
12225
|
case 5:
|
|
12198
12226
|
balance = _context.v;
|
|
12227
|
+
tx = txs.tx, txBypass = txs.txBypass;
|
|
12199
12228
|
_context.n = 6;
|
|
12200
|
-
return
|
|
12229
|
+
return getXcmFeeInternal({
|
|
12201
12230
|
api: api,
|
|
12202
|
-
tx:
|
|
12231
|
+
tx: txBypass,
|
|
12203
12232
|
origin: origin,
|
|
12204
12233
|
destination: destination,
|
|
12205
12234
|
senderAddress: senderAddress,
|
|
@@ -12208,42 +12237,37 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
12208
12237
|
amount: amount
|
|
12209
12238
|
}),
|
|
12210
12239
|
feeAsset: feeAsset,
|
|
12211
|
-
disableFallback: false
|
|
12240
|
+
disableFallback: false,
|
|
12241
|
+
useRootOrigin: true
|
|
12212
12242
|
});
|
|
12213
12243
|
case 6:
|
|
12214
12244
|
xcmFeeResult = _context.v;
|
|
12215
12245
|
dryRunError = xcmFeeResult.origin.dryRunError, assetHubFeeResult = xcmFeeResult.assetHub, bridgeHubFeeResult = xcmFeeResult.bridgeHub, _xcmFeeResult$destina = xcmFeeResult.destination, destFee = _xcmFeeResult$destina.fee, destFeeCurrency = _xcmFeeResult$destina.currency, destDryRunError = _xcmFeeResult$destina.dryRunError;
|
|
12216
|
-
if (!(destFee === undefined)) {
|
|
12217
|
-
_context.n = 7;
|
|
12218
|
-
break;
|
|
12219
|
-
}
|
|
12220
|
-
throw new InvalidParameterError("Cannot get destination xcm fee for currency ".concat(JSON.stringify(currency, sdkCommon.replaceBigInt), " on chain ").concat(destination, "."));
|
|
12221
|
-
case 7:
|
|
12222
12246
|
if (!dryRunError) {
|
|
12223
|
-
_context.n =
|
|
12247
|
+
_context.n = 7;
|
|
12224
12248
|
break;
|
|
12225
12249
|
}
|
|
12226
12250
|
throw new DryRunFailedError(dryRunError, 'origin');
|
|
12227
|
-
case
|
|
12251
|
+
case 7:
|
|
12228
12252
|
hopDryRunError = (assetHubFeeResult === null || assetHubFeeResult === void 0 ? void 0 : assetHubFeeResult.dryRunError) || (bridgeHubFeeResult === null || bridgeHubFeeResult === void 0 ? void 0 : bridgeHubFeeResult.dryRunError);
|
|
12229
12253
|
if (!hopDryRunError) {
|
|
12230
|
-
_context.n =
|
|
12254
|
+
_context.n = 8;
|
|
12231
12255
|
break;
|
|
12232
12256
|
}
|
|
12233
12257
|
throw new DryRunFailedError(hopDryRunError, assetHubFeeResult !== null && assetHubFeeResult !== void 0 && assetHubFeeResult.dryRunError ? 'assetHub' : 'bridgeHub');
|
|
12234
|
-
case
|
|
12258
|
+
case 8:
|
|
12235
12259
|
if (!destDryRunError) {
|
|
12236
|
-
_context.n =
|
|
12260
|
+
_context.n = 9;
|
|
12237
12261
|
break;
|
|
12238
12262
|
}
|
|
12239
12263
|
throw new UnableToComputeError("Unable to compute fee for the destination asset. Destination dry run error: ".concat(destDryRunError));
|
|
12240
|
-
case
|
|
12264
|
+
case 9:
|
|
12241
12265
|
if (!(assets.normalizeSymbol(asset.symbol) !== assets.normalizeSymbol(destFeeCurrency))) {
|
|
12242
|
-
_context.n =
|
|
12266
|
+
_context.n = 10;
|
|
12243
12267
|
break;
|
|
12244
12268
|
}
|
|
12245
12269
|
throw new UnableToComputeError("The XCM fee could not be calculated because the origin or destination chain does not support DryRun.\n As a result, fee estimation is only available through PaymentInfo, which provides the cost in the native asset.\n This limitation restricts support to transfers involving the native asset of the Destination chain only.");
|
|
12246
|
-
case
|
|
12270
|
+
case 10:
|
|
12247
12271
|
totalFee = calculateTotalXcmFee(xcmFeeResult);
|
|
12248
12272
|
method = api.getMethod(tx);
|
|
12249
12273
|
if (method === 'transfer_assets_using_type_and_then' || method === 'transferAssetsUsingTypeAndThen') {
|
|
@@ -12256,7 +12280,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
12256
12280
|
}, _callee);
|
|
12257
12281
|
}));
|
|
12258
12282
|
return function verifyEdOnDestinationInternal(_x) {
|
|
12259
|
-
return
|
|
12283
|
+
return _ref.apply(this, arguments);
|
|
12260
12284
|
};
|
|
12261
12285
|
}();
|
|
12262
12286
|
|
|
@@ -12651,85 +12675,131 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12651
12675
|
return _buildBatch.apply(this, arguments);
|
|
12652
12676
|
}
|
|
12653
12677
|
return buildBatch;
|
|
12654
|
-
}()
|
|
12678
|
+
}())
|
|
12679
|
+
}, {
|
|
12680
|
+
key: "buildInternal",
|
|
12681
|
+
value: function buildInternal() {
|
|
12682
|
+
return this.buildCommon(true);
|
|
12683
|
+
}
|
|
12655
12684
|
/**
|
|
12656
12685
|
* Builds and returns the transfer extrinsic.
|
|
12657
12686
|
*
|
|
12658
12687
|
* @returns A Promise that resolves to the transfer extrinsic.
|
|
12659
12688
|
*/
|
|
12660
|
-
)
|
|
12661
12689
|
}, {
|
|
12662
12690
|
key: "build",
|
|
12663
12691
|
value: (function () {
|
|
12664
12692
|
var _build = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
12665
|
-
var _this$_options, from, to;
|
|
12666
12693
|
return _regenerator().w(function (_context2) {
|
|
12667
12694
|
while (1) switch (_context2.n) {
|
|
12668
12695
|
case 0:
|
|
12696
|
+
return _context2.a(2, this.buildCommon());
|
|
12697
|
+
}
|
|
12698
|
+
}, _callee2, this);
|
|
12699
|
+
}));
|
|
12700
|
+
function build() {
|
|
12701
|
+
return _build.apply(this, arguments);
|
|
12702
|
+
}
|
|
12703
|
+
return build;
|
|
12704
|
+
}())
|
|
12705
|
+
}, {
|
|
12706
|
+
key: "buildCommon",
|
|
12707
|
+
value: function () {
|
|
12708
|
+
var _buildCommon = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
12709
|
+
var isCalledInternally,
|
|
12710
|
+
_this$_options,
|
|
12711
|
+
from,
|
|
12712
|
+
to,
|
|
12713
|
+
tx,
|
|
12714
|
+
_args3 = arguments;
|
|
12715
|
+
return _regenerator().w(function (_context3) {
|
|
12716
|
+
while (1) switch (_context3.n) {
|
|
12717
|
+
case 0:
|
|
12718
|
+
isCalledInternally = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
|
|
12669
12719
|
if (this.batchManager.isEmpty()) {
|
|
12670
|
-
|
|
12720
|
+
_context3.n = 1;
|
|
12671
12721
|
break;
|
|
12672
12722
|
}
|
|
12673
12723
|
throw new InvalidParameterError('Transaction manager contains batched items. Use buildBatch() to process them.');
|
|
12674
12724
|
case 1:
|
|
12675
12725
|
_this$_options = this._options, from = _this$_options.from, to = _this$_options.to;
|
|
12676
12726
|
if (!(!sdkCommon.isTLocation(to) && sdkCommon.isRelayChain(from) && sdkCommon.isRelayChain(to) && from !== to)) {
|
|
12677
|
-
|
|
12727
|
+
_context3.n = 2;
|
|
12678
12728
|
break;
|
|
12679
12729
|
}
|
|
12680
12730
|
throw new InvalidParameterError('Transfers between relay chains are not yet supported.');
|
|
12681
12731
|
case 2:
|
|
12682
|
-
|
|
12732
|
+
_context3.n = 3;
|
|
12733
|
+
return send(_objectSpread2({
|
|
12683
12734
|
api: this.api
|
|
12684
|
-
}, this._options))
|
|
12735
|
+
}, this._options));
|
|
12736
|
+
case 3:
|
|
12737
|
+
tx = _context3.v;
|
|
12738
|
+
_context3.n = 4;
|
|
12739
|
+
return this.maybePerformXcmFormatCheck(tx, this._options, isCalledInternally);
|
|
12740
|
+
case 4:
|
|
12741
|
+
return _context3.a(2, tx);
|
|
12685
12742
|
}
|
|
12686
|
-
},
|
|
12743
|
+
}, _callee3, this);
|
|
12687
12744
|
}));
|
|
12688
|
-
function
|
|
12689
|
-
return
|
|
12745
|
+
function buildCommon() {
|
|
12746
|
+
return _buildCommon.apply(this, arguments);
|
|
12690
12747
|
}
|
|
12691
|
-
return
|
|
12692
|
-
}()
|
|
12693
|
-
}, {
|
|
12694
|
-
key: "computeOverridenAmount",
|
|
12695
|
-
value: function computeOverridenAmount() {
|
|
12696
|
-
var _this$_options2 = this._options,
|
|
12697
|
-
from = _this$_options2.from,
|
|
12698
|
-
to = _this$_options2.to,
|
|
12699
|
-
currency = _this$_options2.currency;
|
|
12700
|
-
var config = this.api.getConfig();
|
|
12701
|
-
if (isConfig(config) && config.abstractDecimals) {
|
|
12702
|
-
return BYPASS_CURRENCY_AMOUNT;
|
|
12703
|
-
} else {
|
|
12704
|
-
assertToIsString(to);
|
|
12705
|
-
var asset = assets.findAssetInfoOrThrow(from, currency, to);
|
|
12706
|
-
return viem.parseUnits(BYPASS_CURRENCY_AMOUNT, asset.decimals);
|
|
12707
|
-
}
|
|
12708
|
-
}
|
|
12748
|
+
return buildCommon;
|
|
12749
|
+
}()
|
|
12709
12750
|
}, {
|
|
12710
|
-
key: "
|
|
12711
|
-
value: function
|
|
12712
|
-
var
|
|
12713
|
-
|
|
12714
|
-
|
|
12751
|
+
key: "maybePerformXcmFormatCheck",
|
|
12752
|
+
value: function () {
|
|
12753
|
+
var _maybePerformXcmFormatCheck = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(tx, options, isCalledInternally) {
|
|
12754
|
+
var senderAddress, config, dryRunResult;
|
|
12755
|
+
return _regenerator().w(function (_context4) {
|
|
12756
|
+
while (1) switch (_context4.n) {
|
|
12757
|
+
case 0:
|
|
12758
|
+
senderAddress = options.senderAddress;
|
|
12759
|
+
config = this.api.getConfig();
|
|
12760
|
+
if (!(isConfig(config) && config.xcmFormatCheck && !isCalledInternally)) {
|
|
12761
|
+
_context4.n = 2;
|
|
12762
|
+
break;
|
|
12763
|
+
}
|
|
12764
|
+
assertSenderAddress(senderAddress);
|
|
12765
|
+
_context4.n = 1;
|
|
12766
|
+
return buildDryRun(this.api, tx, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
12767
|
+
senderAddress: senderAddress
|
|
12768
|
+
}), {
|
|
12769
|
+
sentAssetMintMode: 'bypass'
|
|
12770
|
+
});
|
|
12771
|
+
case 1:
|
|
12772
|
+
dryRunResult = _context4.v;
|
|
12773
|
+
if (!dryRunResult.failureReason) {
|
|
12774
|
+
_context4.n = 2;
|
|
12775
|
+
break;
|
|
12776
|
+
}
|
|
12777
|
+
throw new DryRunFailedError(dryRunResult.failureReason, dryRunResult.failureChain);
|
|
12778
|
+
case 2:
|
|
12779
|
+
return _context4.a(2);
|
|
12780
|
+
}
|
|
12781
|
+
}, _callee4, this);
|
|
12715
12782
|
}));
|
|
12716
|
-
|
|
12717
|
-
|
|
12783
|
+
function maybePerformXcmFormatCheck(_x2, _x3, _x4) {
|
|
12784
|
+
return _maybePerformXcmFormatCheck.apply(this, arguments);
|
|
12785
|
+
}
|
|
12786
|
+
return maybePerformXcmFormatCheck;
|
|
12787
|
+
}()
|
|
12718
12788
|
}, {
|
|
12719
12789
|
key: "dryRun",
|
|
12720
12790
|
value: function () {
|
|
12721
|
-
var _dryRun = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12791
|
+
var _dryRun = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
12722
12792
|
var tx;
|
|
12723
|
-
return _regenerator().w(function (
|
|
12724
|
-
while (1) switch (
|
|
12793
|
+
return _regenerator().w(function (_context5) {
|
|
12794
|
+
while (1) switch (_context5.n) {
|
|
12725
12795
|
case 0:
|
|
12726
|
-
|
|
12727
|
-
return this.
|
|
12796
|
+
_context5.n = 1;
|
|
12797
|
+
return this.buildInternal();
|
|
12728
12798
|
case 1:
|
|
12729
|
-
tx =
|
|
12730
|
-
return
|
|
12799
|
+
tx = _context5.v;
|
|
12800
|
+
return _context5.a(2, buildDryRun(this.api, tx, this._options));
|
|
12731
12801
|
}
|
|
12732
|
-
},
|
|
12802
|
+
}, _callee5, this);
|
|
12733
12803
|
}));
|
|
12734
12804
|
function dryRun() {
|
|
12735
12805
|
return _dryRun.apply(this, arguments);
|
|
@@ -12739,27 +12809,34 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12739
12809
|
}, {
|
|
12740
12810
|
key: "dryRunPreview",
|
|
12741
12811
|
value: function () {
|
|
12742
|
-
var _dryRunPreview = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12812
|
+
var _dryRunPreview = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(options) {
|
|
12743
12813
|
var tx;
|
|
12744
|
-
return _regenerator().w(function (
|
|
12745
|
-
while (1) switch (
|
|
12814
|
+
return _regenerator().w(function (_context6) {
|
|
12815
|
+
while (1) switch (_context6.n) {
|
|
12746
12816
|
case 0:
|
|
12747
|
-
|
|
12748
|
-
return this.
|
|
12817
|
+
_context6.n = 1;
|
|
12818
|
+
return this.buildInternal();
|
|
12749
12819
|
case 1:
|
|
12750
|
-
tx =
|
|
12751
|
-
return
|
|
12820
|
+
tx = _context6.v;
|
|
12821
|
+
return _context6.a(2, buildDryRun(this.api, tx, this._options, {
|
|
12752
12822
|
sentAssetMintMode: 'preview',
|
|
12753
12823
|
mintFeeAssets: options === null || options === void 0 ? void 0 : options.mintFeeAssets
|
|
12754
12824
|
}));
|
|
12755
12825
|
}
|
|
12756
|
-
},
|
|
12826
|
+
}, _callee6, this);
|
|
12757
12827
|
}));
|
|
12758
|
-
function dryRunPreview(
|
|
12828
|
+
function dryRunPreview(_x5) {
|
|
12759
12829
|
return _dryRunPreview.apply(this, arguments);
|
|
12760
12830
|
}
|
|
12761
12831
|
return dryRunPreview;
|
|
12762
12832
|
}()
|
|
12833
|
+
}, {
|
|
12834
|
+
key: "createTxs",
|
|
12835
|
+
value: function createTxs$1() {
|
|
12836
|
+
return createTxs(_objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
12837
|
+
api: this.api
|
|
12838
|
+
}), this);
|
|
12839
|
+
}
|
|
12763
12840
|
/**
|
|
12764
12841
|
* Returns the XCM fee for the transfer using dryRun or paymentInfo function.
|
|
12765
12842
|
*
|
|
@@ -12768,47 +12845,56 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12768
12845
|
}, {
|
|
12769
12846
|
key: "getXcmFee",
|
|
12770
12847
|
value: (function () {
|
|
12771
|
-
var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12848
|
+
var _getXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7(options) {
|
|
12772
12849
|
var _options$disableFallb;
|
|
12773
|
-
var _this$
|
|
12774
|
-
return _regenerator().w(function (
|
|
12775
|
-
while (1) switch (
|
|
12850
|
+
var _this$_options2, from, to, address, senderAddress, feeAsset, currency, disableFallback, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
|
|
12851
|
+
return _regenerator().w(function (_context7) {
|
|
12852
|
+
while (1) switch (_context7.p = _context7.n) {
|
|
12776
12853
|
case 0:
|
|
12777
|
-
_this$
|
|
12854
|
+
_this$_options2 = this._options, from = _this$_options2.from, to = _this$_options2.to, address = _this$_options2.address, senderAddress = _this$_options2.senderAddress, feeAsset = _this$_options2.feeAsset, currency = _this$_options2.currency;
|
|
12778
12855
|
assertToIsString(to);
|
|
12779
12856
|
assertAddressIsString(address);
|
|
12780
|
-
_context5.n = 1;
|
|
12781
|
-
return this.overrideTxAmount();
|
|
12782
|
-
case 1:
|
|
12783
|
-
tx = _context5.v;
|
|
12784
12857
|
disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
|
|
12785
|
-
|
|
12786
|
-
|
|
12787
|
-
|
|
12788
|
-
|
|
12789
|
-
|
|
12790
|
-
|
|
12791
|
-
|
|
12792
|
-
|
|
12793
|
-
|
|
12794
|
-
|
|
12795
|
-
|
|
12796
|
-
|
|
12858
|
+
_context7.p = 1;
|
|
12859
|
+
_t = getXcmFee;
|
|
12860
|
+
_t2 = this.api;
|
|
12861
|
+
_context7.n = 2;
|
|
12862
|
+
return this.createTxs();
|
|
12863
|
+
case 2:
|
|
12864
|
+
_t3 = _context7.v;
|
|
12865
|
+
_t4 = from;
|
|
12866
|
+
_t5 = to;
|
|
12867
|
+
_t6 = senderAddress;
|
|
12868
|
+
_t7 = address;
|
|
12869
|
+
_t8 = currency;
|
|
12870
|
+
_t9 = feeAsset;
|
|
12871
|
+
_t0 = disableFallback;
|
|
12872
|
+
_context7.n = 3;
|
|
12873
|
+
return _t({
|
|
12874
|
+
api: _t2,
|
|
12875
|
+
txs: _t3,
|
|
12876
|
+
origin: _t4,
|
|
12877
|
+
destination: _t5,
|
|
12878
|
+
senderAddress: _t6,
|
|
12879
|
+
address: _t7,
|
|
12880
|
+
currency: _t8,
|
|
12881
|
+
feeAsset: _t9,
|
|
12882
|
+
disableFallback: _t0
|
|
12797
12883
|
});
|
|
12798
12884
|
case 3:
|
|
12799
|
-
return
|
|
12885
|
+
return _context7.a(2, _context7.v);
|
|
12800
12886
|
case 4:
|
|
12801
|
-
|
|
12802
|
-
|
|
12887
|
+
_context7.p = 4;
|
|
12888
|
+
_context7.n = 5;
|
|
12803
12889
|
return this.api.disconnect();
|
|
12804
12890
|
case 5:
|
|
12805
|
-
return
|
|
12891
|
+
return _context7.f(4);
|
|
12806
12892
|
case 6:
|
|
12807
|
-
return
|
|
12893
|
+
return _context7.a(2);
|
|
12808
12894
|
}
|
|
12809
|
-
},
|
|
12895
|
+
}, _callee7, this, [[1,, 4, 6]]);
|
|
12810
12896
|
}));
|
|
12811
|
-
function getXcmFee$1(
|
|
12897
|
+
function getXcmFee$1(_x6) {
|
|
12812
12898
|
return _getXcmFee2.apply(this, arguments);
|
|
12813
12899
|
}
|
|
12814
12900
|
return getXcmFee$1;
|
|
@@ -12822,53 +12908,71 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12822
12908
|
}, {
|
|
12823
12909
|
key: "getOriginXcmFee",
|
|
12824
12910
|
value: (function () {
|
|
12825
|
-
var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12911
|
+
var _getOriginXcmFee2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee8() {
|
|
12826
12912
|
var _ref,
|
|
12827
12913
|
disableFallback,
|
|
12828
|
-
_this$
|
|
12914
|
+
_this$_options3,
|
|
12829
12915
|
from,
|
|
12830
12916
|
to,
|
|
12831
12917
|
senderAddress,
|
|
12832
12918
|
currency,
|
|
12833
12919
|
feeAsset,
|
|
12834
|
-
|
|
12835
|
-
|
|
12836
|
-
|
|
12837
|
-
|
|
12920
|
+
api,
|
|
12921
|
+
_args8 = arguments,
|
|
12922
|
+
_t1,
|
|
12923
|
+
_t10,
|
|
12924
|
+
_t11,
|
|
12925
|
+
_t12,
|
|
12926
|
+
_t13,
|
|
12927
|
+
_t14,
|
|
12928
|
+
_t15,
|
|
12929
|
+
_t16,
|
|
12930
|
+
_t17;
|
|
12931
|
+
return _regenerator().w(function (_context8) {
|
|
12932
|
+
while (1) switch (_context8.p = _context8.n) {
|
|
12838
12933
|
case 0:
|
|
12839
|
-
_ref =
|
|
12934
|
+
_ref = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {
|
|
12840
12935
|
disableFallback: false
|
|
12841
12936
|
}, disableFallback = _ref.disableFallback;
|
|
12842
|
-
_this$
|
|
12937
|
+
_this$_options3 = this._options, from = _this$_options3.from, to = _this$_options3.to, senderAddress = _this$_options3.senderAddress, currency = _this$_options3.currency, feeAsset = _this$_options3.feeAsset;
|
|
12843
12938
|
assertToIsString(to);
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
|
|
12855
|
-
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
|
|
12939
|
+
api = this.api;
|
|
12940
|
+
_context8.p = 1;
|
|
12941
|
+
_t1 = getOriginXcmFee;
|
|
12942
|
+
_t10 = api;
|
|
12943
|
+
_context8.n = 2;
|
|
12944
|
+
return this.createTxs();
|
|
12945
|
+
case 2:
|
|
12946
|
+
_t11 = _context8.v;
|
|
12947
|
+
_t12 = from;
|
|
12948
|
+
_t13 = to;
|
|
12949
|
+
_t14 = senderAddress;
|
|
12950
|
+
_t15 = currency;
|
|
12951
|
+
_t16 = feeAsset;
|
|
12952
|
+
_t17 = disableFallback;
|
|
12953
|
+
_context8.n = 3;
|
|
12954
|
+
return _t1({
|
|
12955
|
+
api: _t10,
|
|
12956
|
+
txs: _t11,
|
|
12957
|
+
origin: _t12,
|
|
12958
|
+
destination: _t13,
|
|
12959
|
+
senderAddress: _t14,
|
|
12960
|
+
currency: _t15,
|
|
12961
|
+
feeAsset: _t16,
|
|
12962
|
+
disableFallback: _t17
|
|
12859
12963
|
});
|
|
12860
12964
|
case 3:
|
|
12861
|
-
return
|
|
12965
|
+
return _context8.a(2, _context8.v);
|
|
12862
12966
|
case 4:
|
|
12863
|
-
|
|
12864
|
-
|
|
12967
|
+
_context8.p = 4;
|
|
12968
|
+
_context8.n = 5;
|
|
12865
12969
|
return this.api.disconnect();
|
|
12866
12970
|
case 5:
|
|
12867
|
-
return
|
|
12971
|
+
return _context8.f(4);
|
|
12868
12972
|
case 6:
|
|
12869
|
-
return
|
|
12973
|
+
return _context8.a(2);
|
|
12870
12974
|
}
|
|
12871
|
-
},
|
|
12975
|
+
}, _callee8, this, [[1,, 4, 6]]);
|
|
12872
12976
|
}));
|
|
12873
12977
|
function getOriginXcmFee$1() {
|
|
12874
12978
|
return _getOriginXcmFee2.apply(this, arguments);
|
|
@@ -12884,20 +12988,20 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12884
12988
|
}, {
|
|
12885
12989
|
key: "getXcmFeeEstimate",
|
|
12886
12990
|
value: (function () {
|
|
12887
|
-
var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12888
|
-
var _this$
|
|
12889
|
-
return _regenerator().w(function (
|
|
12890
|
-
while (1) switch (
|
|
12991
|
+
var _getXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee9() {
|
|
12992
|
+
var _this$_options4, from, to, address, senderAddress, currency, tx;
|
|
12993
|
+
return _regenerator().w(function (_context9) {
|
|
12994
|
+
while (1) switch (_context9.p = _context9.n) {
|
|
12891
12995
|
case 0:
|
|
12892
|
-
_this$
|
|
12996
|
+
_this$_options4 = this._options, from = _this$_options4.from, to = _this$_options4.to, address = _this$_options4.address, senderAddress = _this$_options4.senderAddress, currency = _this$_options4.currency;
|
|
12893
12997
|
assertToIsString(to);
|
|
12894
12998
|
assertAddressIsString(address);
|
|
12895
|
-
|
|
12896
|
-
return this.
|
|
12999
|
+
_context9.n = 1;
|
|
13000
|
+
return this.buildInternal();
|
|
12897
13001
|
case 1:
|
|
12898
|
-
tx =
|
|
12899
|
-
|
|
12900
|
-
|
|
13002
|
+
tx = _context9.v;
|
|
13003
|
+
_context9.p = 2;
|
|
13004
|
+
_context9.n = 3;
|
|
12901
13005
|
return getXcmFeeEstimate({
|
|
12902
13006
|
api: this.api,
|
|
12903
13007
|
tx: tx,
|
|
@@ -12908,17 +13012,17 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12908
13012
|
currency: currency
|
|
12909
13013
|
});
|
|
12910
13014
|
case 3:
|
|
12911
|
-
return
|
|
13015
|
+
return _context9.a(2, _context9.v);
|
|
12912
13016
|
case 4:
|
|
12913
|
-
|
|
12914
|
-
|
|
13017
|
+
_context9.p = 4;
|
|
13018
|
+
_context9.n = 5;
|
|
12915
13019
|
return this.api.disconnect();
|
|
12916
13020
|
case 5:
|
|
12917
|
-
return
|
|
13021
|
+
return _context9.f(4);
|
|
12918
13022
|
case 6:
|
|
12919
|
-
return
|
|
13023
|
+
return _context9.a(2);
|
|
12920
13024
|
}
|
|
12921
|
-
},
|
|
13025
|
+
}, _callee9, this, [[2,, 4, 6]]);
|
|
12922
13026
|
}));
|
|
12923
13027
|
function getXcmFeeEstimate$1() {
|
|
12924
13028
|
return _getXcmFeeEstimate2.apply(this, arguments);
|
|
@@ -12934,19 +13038,19 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12934
13038
|
}, {
|
|
12935
13039
|
key: "getOriginXcmFeeEstimate",
|
|
12936
13040
|
value: (function () {
|
|
12937
|
-
var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12938
|
-
var _this$
|
|
12939
|
-
return _regenerator().w(function (
|
|
12940
|
-
while (1) switch (
|
|
13041
|
+
var _getOriginXcmFeeEstimate2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0() {
|
|
13042
|
+
var _this$_options5, from, to, senderAddress, currency, tx;
|
|
13043
|
+
return _regenerator().w(function (_context0) {
|
|
13044
|
+
while (1) switch (_context0.p = _context0.n) {
|
|
12941
13045
|
case 0:
|
|
12942
|
-
_this$
|
|
13046
|
+
_this$_options5 = this._options, from = _this$_options5.from, to = _this$_options5.to, senderAddress = _this$_options5.senderAddress, currency = _this$_options5.currency;
|
|
12943
13047
|
assertToIsString(to);
|
|
12944
|
-
|
|
12945
|
-
return this.
|
|
13048
|
+
_context0.n = 1;
|
|
13049
|
+
return this.buildInternal();
|
|
12946
13050
|
case 1:
|
|
12947
|
-
tx =
|
|
12948
|
-
|
|
12949
|
-
|
|
13051
|
+
tx = _context0.v;
|
|
13052
|
+
_context0.p = 2;
|
|
13053
|
+
_context0.n = 3;
|
|
12950
13054
|
return getOriginXcmFeeEstimate({
|
|
12951
13055
|
api: this.api,
|
|
12952
13056
|
tx: tx,
|
|
@@ -12956,17 +13060,17 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12956
13060
|
senderAddress: senderAddress
|
|
12957
13061
|
});
|
|
12958
13062
|
case 3:
|
|
12959
|
-
return
|
|
13063
|
+
return _context0.a(2, _context0.v);
|
|
12960
13064
|
case 4:
|
|
12961
|
-
|
|
12962
|
-
|
|
13065
|
+
_context0.p = 4;
|
|
13066
|
+
_context0.n = 5;
|
|
12963
13067
|
return this.api.disconnect();
|
|
12964
13068
|
case 5:
|
|
12965
|
-
return
|
|
13069
|
+
return _context0.f(4);
|
|
12966
13070
|
case 6:
|
|
12967
|
-
return
|
|
13071
|
+
return _context0.a(2);
|
|
12968
13072
|
}
|
|
12969
|
-
},
|
|
13073
|
+
}, _callee0, this, [[2,, 4, 6]]);
|
|
12970
13074
|
}));
|
|
12971
13075
|
function getOriginXcmFeeEstimate$1() {
|
|
12972
13076
|
return _getOriginXcmFeeEstimate2.apply(this, arguments);
|
|
@@ -12982,28 +13086,36 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
12982
13086
|
}, {
|
|
12983
13087
|
key: "getTransferableAmount",
|
|
12984
13088
|
value: (function () {
|
|
12985
|
-
var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
12986
|
-
var _this$
|
|
12987
|
-
return _regenerator().w(function (
|
|
12988
|
-
while (1) switch (
|
|
13089
|
+
var _getTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee1() {
|
|
13090
|
+
var _this$_options6, from, to, senderAddress, currency, feeAsset, api, _t18, _t19, _t20, _t21, _t22, _t23, _t24, _t25;
|
|
13091
|
+
return _regenerator().w(function (_context1) {
|
|
13092
|
+
while (1) switch (_context1.n) {
|
|
12989
13093
|
case 0:
|
|
12990
|
-
_this$
|
|
13094
|
+
_this$_options6 = this._options, from = _this$_options6.from, to = _this$_options6.to, senderAddress = _this$_options6.senderAddress, currency = _this$_options6.currency, feeAsset = _this$_options6.feeAsset;
|
|
12991
13095
|
assertToIsString(to);
|
|
12992
|
-
|
|
12993
|
-
|
|
13096
|
+
api = this.api;
|
|
13097
|
+
_t18 = getTransferableAmount;
|
|
13098
|
+
_t19 = api;
|
|
13099
|
+
_context1.n = 1;
|
|
13100
|
+
return this.createTxs();
|
|
12994
13101
|
case 1:
|
|
12995
|
-
|
|
12996
|
-
|
|
12997
|
-
|
|
12998
|
-
|
|
12999
|
-
|
|
13000
|
-
|
|
13001
|
-
|
|
13002
|
-
|
|
13003
|
-
|
|
13102
|
+
_t20 = _context1.v;
|
|
13103
|
+
_t21 = from;
|
|
13104
|
+
_t22 = to;
|
|
13105
|
+
_t23 = senderAddress;
|
|
13106
|
+
_t24 = feeAsset;
|
|
13107
|
+
_t25 = currency;
|
|
13108
|
+
return _context1.a(2, _t18({
|
|
13109
|
+
api: _t19,
|
|
13110
|
+
txs: _t20,
|
|
13111
|
+
origin: _t21,
|
|
13112
|
+
destination: _t22,
|
|
13113
|
+
senderAddress: _t23,
|
|
13114
|
+
feeAsset: _t24,
|
|
13115
|
+
currency: _t25
|
|
13004
13116
|
}));
|
|
13005
13117
|
}
|
|
13006
|
-
},
|
|
13118
|
+
}, _callee1, this);
|
|
13007
13119
|
}));
|
|
13008
13120
|
function getTransferableAmount$1() {
|
|
13009
13121
|
return _getTransferableAmount2.apply(this, arguments);
|
|
@@ -13019,31 +13131,41 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13019
13131
|
}, {
|
|
13020
13132
|
key: "getMinTransferableAmount",
|
|
13021
13133
|
value: (function () {
|
|
13022
|
-
var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
13023
|
-
var _this$
|
|
13024
|
-
return _regenerator().w(function (
|
|
13025
|
-
while (1) switch (
|
|
13134
|
+
var _getMinTransferableAmount2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee10() {
|
|
13135
|
+
var _this$_options7, from, to, senderAddress, address, currency, feeAsset, api, _t26, _t27, _t28, _t29, _t30, _t31, _t32, _t33, _t34, _t35;
|
|
13136
|
+
return _regenerator().w(function (_context10) {
|
|
13137
|
+
while (1) switch (_context10.n) {
|
|
13026
13138
|
case 0:
|
|
13027
|
-
_this$
|
|
13139
|
+
_this$_options7 = this._options, from = _this$_options7.from, to = _this$_options7.to, senderAddress = _this$_options7.senderAddress, address = _this$_options7.address, currency = _this$_options7.currency, feeAsset = _this$_options7.feeAsset;
|
|
13028
13140
|
assertToIsString(to);
|
|
13029
13141
|
assertAddressIsString(address);
|
|
13030
|
-
|
|
13031
|
-
|
|
13142
|
+
api = this.api;
|
|
13143
|
+
_t26 = getMinTransferableAmount;
|
|
13144
|
+
_t27 = api;
|
|
13145
|
+
_context10.n = 1;
|
|
13146
|
+
return this.createTxs();
|
|
13032
13147
|
case 1:
|
|
13033
|
-
|
|
13034
|
-
|
|
13035
|
-
|
|
13036
|
-
|
|
13037
|
-
|
|
13038
|
-
|
|
13039
|
-
|
|
13040
|
-
|
|
13041
|
-
|
|
13042
|
-
|
|
13043
|
-
|
|
13148
|
+
_t28 = _context10.v;
|
|
13149
|
+
_t29 = from;
|
|
13150
|
+
_t30 = to;
|
|
13151
|
+
_t31 = senderAddress;
|
|
13152
|
+
_t32 = address;
|
|
13153
|
+
_t33 = feeAsset;
|
|
13154
|
+
_t34 = currency;
|
|
13155
|
+
_t35 = this;
|
|
13156
|
+
return _context10.a(2, _t26({
|
|
13157
|
+
api: _t27,
|
|
13158
|
+
txs: _t28,
|
|
13159
|
+
origin: _t29,
|
|
13160
|
+
destination: _t30,
|
|
13161
|
+
senderAddress: _t31,
|
|
13162
|
+
address: _t32,
|
|
13163
|
+
feeAsset: _t33,
|
|
13164
|
+
currency: _t34,
|
|
13165
|
+
builder: _t35
|
|
13044
13166
|
}));
|
|
13045
13167
|
}
|
|
13046
|
-
},
|
|
13168
|
+
}, _callee10, this);
|
|
13047
13169
|
}));
|
|
13048
13170
|
function getMinTransferableAmount$1() {
|
|
13049
13171
|
return _getMinTransferableAmount2.apply(this, arguments);
|
|
@@ -13059,30 +13181,38 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13059
13181
|
}, {
|
|
13060
13182
|
key: "verifyEdOnDestination",
|
|
13061
13183
|
value: (function () {
|
|
13062
|
-
var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
13063
|
-
var _this$
|
|
13064
|
-
return _regenerator().w(function (
|
|
13065
|
-
while (1) switch (
|
|
13184
|
+
var _verifyEdOnDestination2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee11() {
|
|
13185
|
+
var _this$_options8, from, to, address, currency, senderAddress, feeAsset, _t36, _t37, _t38, _t39, _t40, _t41, _t42, _t43, _t44;
|
|
13186
|
+
return _regenerator().w(function (_context11) {
|
|
13187
|
+
while (1) switch (_context11.n) {
|
|
13066
13188
|
case 0:
|
|
13067
|
-
_this$
|
|
13189
|
+
_this$_options8 = this._options, from = _this$_options8.from, to = _this$_options8.to, address = _this$_options8.address, currency = _this$_options8.currency, senderAddress = _this$_options8.senderAddress, feeAsset = _this$_options8.feeAsset;
|
|
13068
13190
|
assertToIsString(to);
|
|
13069
13191
|
assertAddressIsString(address);
|
|
13070
|
-
|
|
13071
|
-
|
|
13192
|
+
_t36 = verifyEdOnDestination;
|
|
13193
|
+
_t37 = this.api;
|
|
13194
|
+
_context11.n = 1;
|
|
13195
|
+
return this.createTxs();
|
|
13072
13196
|
case 1:
|
|
13073
|
-
|
|
13074
|
-
|
|
13075
|
-
|
|
13076
|
-
|
|
13077
|
-
|
|
13078
|
-
|
|
13079
|
-
|
|
13080
|
-
|
|
13081
|
-
|
|
13082
|
-
|
|
13197
|
+
_t38 = _context11.v;
|
|
13198
|
+
_t39 = from;
|
|
13199
|
+
_t40 = to;
|
|
13200
|
+
_t41 = address;
|
|
13201
|
+
_t42 = senderAddress;
|
|
13202
|
+
_t43 = feeAsset;
|
|
13203
|
+
_t44 = currency;
|
|
13204
|
+
return _context11.a(2, _t36({
|
|
13205
|
+
api: _t37,
|
|
13206
|
+
txs: _t38,
|
|
13207
|
+
origin: _t39,
|
|
13208
|
+
destination: _t40,
|
|
13209
|
+
address: _t41,
|
|
13210
|
+
senderAddress: _t42,
|
|
13211
|
+
feeAsset: _t43,
|
|
13212
|
+
currency: _t44
|
|
13083
13213
|
}));
|
|
13084
13214
|
}
|
|
13085
|
-
},
|
|
13215
|
+
}, _callee11, this);
|
|
13086
13216
|
}));
|
|
13087
13217
|
function verifyEdOnDestination$1() {
|
|
13088
13218
|
return _verifyEdOnDestination2.apply(this, arguments);
|
|
@@ -13098,31 +13228,40 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13098
13228
|
}, {
|
|
13099
13229
|
key: "getTransferInfo",
|
|
13100
13230
|
value: (function () {
|
|
13101
|
-
var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
13102
|
-
var _this$
|
|
13103
|
-
return _regenerator().w(function (
|
|
13104
|
-
while (1) switch (
|
|
13231
|
+
var _getTransferInfo2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee12() {
|
|
13232
|
+
var _this$_options9, from, to, address, currency, ahAddress, senderAddress, feeAsset, _t45, _t46, _t47, _t48, _t49, _t50, _t51, _t52, _t53, _t54;
|
|
13233
|
+
return _regenerator().w(function (_context12) {
|
|
13234
|
+
while (1) switch (_context12.n) {
|
|
13105
13235
|
case 0:
|
|
13106
|
-
_this$
|
|
13236
|
+
_this$_options9 = this._options, from = _this$_options9.from, to = _this$_options9.to, address = _this$_options9.address, currency = _this$_options9.currency, ahAddress = _this$_options9.ahAddress, senderAddress = _this$_options9.senderAddress, feeAsset = _this$_options9.feeAsset;
|
|
13107
13237
|
assertToIsString(to);
|
|
13108
13238
|
assertAddressIsString(address);
|
|
13109
|
-
|
|
13110
|
-
|
|
13239
|
+
_t45 = getTransferInfo;
|
|
13240
|
+
_t46 = this.api;
|
|
13241
|
+
_context12.n = 1;
|
|
13242
|
+
return this.createTxs();
|
|
13111
13243
|
case 1:
|
|
13112
|
-
|
|
13113
|
-
|
|
13114
|
-
|
|
13115
|
-
|
|
13116
|
-
|
|
13117
|
-
|
|
13118
|
-
|
|
13119
|
-
|
|
13120
|
-
|
|
13121
|
-
|
|
13122
|
-
|
|
13244
|
+
_t47 = _context12.v;
|
|
13245
|
+
_t48 = from;
|
|
13246
|
+
_t49 = to;
|
|
13247
|
+
_t50 = address;
|
|
13248
|
+
_t51 = senderAddress;
|
|
13249
|
+
_t52 = ahAddress;
|
|
13250
|
+
_t53 = currency;
|
|
13251
|
+
_t54 = feeAsset;
|
|
13252
|
+
return _context12.a(2, _t45({
|
|
13253
|
+
api: _t46,
|
|
13254
|
+
txs: _t47,
|
|
13255
|
+
origin: _t48,
|
|
13256
|
+
destination: _t49,
|
|
13257
|
+
address: _t50,
|
|
13258
|
+
senderAddress: _t51,
|
|
13259
|
+
ahAddress: _t52,
|
|
13260
|
+
currency: _t53,
|
|
13261
|
+
feeAsset: _t54
|
|
13123
13262
|
}));
|
|
13124
13263
|
}
|
|
13125
|
-
},
|
|
13264
|
+
}, _callee12, this);
|
|
13126
13265
|
}));
|
|
13127
13266
|
function getTransferInfo$1() {
|
|
13128
13267
|
return _getTransferInfo2.apply(this, arguments);
|
|
@@ -13190,6 +13329,7 @@ exports.assertAddressIsString = assertAddressIsString;
|
|
|
13190
13329
|
exports.assertHasId = assertHasId;
|
|
13191
13330
|
exports.assertHasLocation = assertHasLocation;
|
|
13192
13331
|
exports.assertIsForeign = assertIsForeign;
|
|
13332
|
+
exports.assertSenderAddress = assertSenderAddress;
|
|
13193
13333
|
exports.assertToIsString = assertToIsString;
|
|
13194
13334
|
exports.blake2b256 = blake2b256;
|
|
13195
13335
|
exports.blake2b512 = blake2b512;
|
|
@@ -13197,6 +13337,7 @@ exports.calcPreviewMintAmount = calcPreviewMintAmount;
|
|
|
13197
13337
|
exports.claimAssets = claimAssets;
|
|
13198
13338
|
exports.computeFeeFromDryRun = computeFeeFromDryRun;
|
|
13199
13339
|
exports.computeFeeFromDryRunPjs = computeFeeFromDryRunPjs;
|
|
13340
|
+
exports.computeOverridenAmount = computeOverridenAmount;
|
|
13200
13341
|
exports.convertSs58 = convertSs58;
|
|
13201
13342
|
exports.createAsset = createAsset;
|
|
13202
13343
|
exports.createAssetsFilter = createAssetsFilter;
|
|
@@ -13207,6 +13348,7 @@ exports.createChainClient = createChainClient;
|
|
|
13207
13348
|
exports.createDirectExecuteXcm = createDirectExecuteXcm;
|
|
13208
13349
|
exports.createExecuteCall = createExecuteCall;
|
|
13209
13350
|
exports.createExecuteExchangeXcm = createExecuteExchangeXcm;
|
|
13351
|
+
exports.createTxs = createTxs;
|
|
13210
13352
|
exports.createTypeAndThenCall = createTypeAndThenCall;
|
|
13211
13353
|
exports.createVersionedAssets = createVersionedAssets;
|
|
13212
13354
|
exports.createX1Payload = createX1Payload;
|
|
@@ -13245,6 +13387,7 @@ exports.getTransferableAmount = getTransferableAmount;
|
|
|
13245
13387
|
exports.getTransferableAmountInternal = getTransferableAmountInternal;
|
|
13246
13388
|
exports.getXcmFee = getXcmFee;
|
|
13247
13389
|
exports.getXcmFeeEstimate = getXcmFeeEstimate;
|
|
13390
|
+
exports.getXcmFeeInternal = getXcmFeeInternal;
|
|
13248
13391
|
exports.handleExecuteTransfer = handleExecuteTransfer;
|
|
13249
13392
|
exports.handleSwapExecuteTransfer = handleSwapExecuteTransfer;
|
|
13250
13393
|
exports.handleToAhTeleport = handleToAhTeleport;
|
|
@@ -13252,6 +13395,7 @@ exports.isConfig = isConfig;
|
|
|
13252
13395
|
exports.localizeLocation = localizeLocation;
|
|
13253
13396
|
exports.maybeOverrideAsset = maybeOverrideAsset;
|
|
13254
13397
|
exports.maybeOverrideAssets = maybeOverrideAssets;
|
|
13398
|
+
exports.overrideTxAmount = overrideTxAmount;
|
|
13255
13399
|
exports.padFee = padFee;
|
|
13256
13400
|
exports.padFeeBy = padFeeBy;
|
|
13257
13401
|
exports.resolveDestChain = resolveDestChain;
|