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