@paraspell/sdk-core 11.14.0 → 11.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +374 -277
- package/dist/index.d.ts +21 -7
- package/dist/index.mjs +373 -279
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { base58 } from '@scure/base';
|
|
|
5
5
|
import { isAddress, parseUnits as parseUnits$1, formatUnits as formatUnits$1, createPublicClient, http, getContract, pad, toHex, getAddress, concat, keccak256 } from 'viem';
|
|
6
6
|
import { getSupportedPalletsDetails, getDefaultPallet, getSupportedPallets, getNativeAssetsPallet, getOtherAssetsPallets } from '@paraspell/pallets';
|
|
7
7
|
export * from '@paraspell/pallets';
|
|
8
|
-
import { replaceBigInt, isTLocation, Version, hasJunction, getJunctionValue, isRelayChain, Parents, isExternalChain,
|
|
8
|
+
import { replaceBigInt, isTLocation, Version, hasJunction, getJunctionValue, isRelayChain, deepEqual, Parents, isExternalChain, PARACHAINS, isSubstrateBridge, isTrustedChain, isSystemChain } from '@paraspell/sdk-common';
|
|
9
9
|
export * from '@paraspell/sdk-common';
|
|
10
10
|
import { moonbeam, moonriver, mainnet } from 'viem/chains';
|
|
11
11
|
|
|
@@ -772,11 +772,11 @@ var createVersionedAssets = function createVersionedAssets(version, amount, loca
|
|
|
772
772
|
return addXcmVersionHeader([asset], version);
|
|
773
773
|
};
|
|
774
774
|
|
|
775
|
-
var getCurrencySelection = function getCurrencySelection(asset) {
|
|
775
|
+
var getCurrencySelection = function getCurrencySelection(chain, asset) {
|
|
776
776
|
if (asset.location) return {
|
|
777
777
|
location: asset.location
|
|
778
778
|
};
|
|
779
|
-
if (isForeignAsset(asset) && asset.assetId) {
|
|
779
|
+
if (isForeignAsset(asset) && asset.assetId && !chain.startsWith('Bifrost')) {
|
|
780
780
|
return {
|
|
781
781
|
id: asset.assetId
|
|
782
782
|
};
|
|
@@ -918,6 +918,33 @@ var createTx = /*#__PURE__*/function () {
|
|
|
918
918
|
};
|
|
919
919
|
}();
|
|
920
920
|
|
|
921
|
+
var getAssetReserveChain = function getAssetReserveChain(chain, assetLocation) {
|
|
922
|
+
var hasGlobalConsensusJunction = hasJunction(assetLocation, 'GlobalConsensus');
|
|
923
|
+
var paraId = getJunctionValue(assetLocation, 'Parachain');
|
|
924
|
+
if (paraId) {
|
|
925
|
+
var resolvedChain = getTChain(paraId, getRelayChainOf(chain));
|
|
926
|
+
if (!resolvedChain) {
|
|
927
|
+
throw new InvalidParameterError("Chain with paraId ".concat(paraId, " not found"));
|
|
928
|
+
}
|
|
929
|
+
return resolvedChain;
|
|
930
|
+
}
|
|
931
|
+
if (isRelayChain(chain)) return chain;
|
|
932
|
+
var relaychain = getRelayChainOf(chain);
|
|
933
|
+
var ahChain = "AssetHub".concat(relaychain);
|
|
934
|
+
if (hasGlobalConsensusJunction) {
|
|
935
|
+
return ahChain;
|
|
936
|
+
}
|
|
937
|
+
if (deepEqual(assetLocation, {
|
|
938
|
+
parents: Parents.ONE,
|
|
939
|
+
interior: {
|
|
940
|
+
Here: null
|
|
941
|
+
}
|
|
942
|
+
})) {
|
|
943
|
+
return ahChain;
|
|
944
|
+
}
|
|
945
|
+
return chain;
|
|
946
|
+
};
|
|
947
|
+
|
|
921
948
|
/**
|
|
922
949
|
* Retrieves the chain instance for a given chain.
|
|
923
950
|
*
|
|
@@ -3307,33 +3334,6 @@ var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, chain
|
|
|
3307
3334
|
throw new InvalidCurrencyError("".concat(isDestination ? 'Destination' : 'Origin', " chain ").concat(chain, " does not support currency ").concat(JSON.stringify(currency, replaceBigInt), "."));
|
|
3308
3335
|
};
|
|
3309
3336
|
|
|
3310
|
-
var getAssetReserveChain = function getAssetReserveChain(chain, assetLocation) {
|
|
3311
|
-
var hasGlobalConsensusJunction = hasJunction(assetLocation, 'GlobalConsensus');
|
|
3312
|
-
var paraId = getJunctionValue(assetLocation, 'Parachain');
|
|
3313
|
-
if (paraId) {
|
|
3314
|
-
var resolvedChain = getTChain(paraId, getRelayChainOf(chain));
|
|
3315
|
-
if (!resolvedChain) {
|
|
3316
|
-
throw new InvalidParameterError("Chain with paraId ".concat(paraId, " not found"));
|
|
3317
|
-
}
|
|
3318
|
-
return resolvedChain;
|
|
3319
|
-
}
|
|
3320
|
-
if (isRelayChain(chain)) return chain;
|
|
3321
|
-
var relaychain = getRelayChainOf(chain);
|
|
3322
|
-
var ahChain = "AssetHub".concat(relaychain);
|
|
3323
|
-
if (hasGlobalConsensusJunction) {
|
|
3324
|
-
return ahChain;
|
|
3325
|
-
}
|
|
3326
|
-
if (deepEqual(assetLocation, {
|
|
3327
|
-
parents: Parents.ONE,
|
|
3328
|
-
interior: {
|
|
3329
|
-
Here: null
|
|
3330
|
-
}
|
|
3331
|
-
})) {
|
|
3332
|
-
return ahChain;
|
|
3333
|
-
}
|
|
3334
|
-
return chain;
|
|
3335
|
-
};
|
|
3336
|
-
|
|
3337
3337
|
var prepareExecuteContext = function prepareExecuteContext(_ref) {
|
|
3338
3338
|
var chain = _ref.chain,
|
|
3339
3339
|
destChain = _ref.destChain,
|
|
@@ -3650,7 +3650,7 @@ var getReserveFeeFromHops = function getReserveFeeFromHops(hops) {
|
|
|
3650
3650
|
}
|
|
3651
3651
|
return hops[0].result.fee;
|
|
3652
3652
|
};
|
|
3653
|
-
var FEE_PADDING_PERCENTAGE$
|
|
3653
|
+
var FEE_PADDING_PERCENTAGE$1 = 40;
|
|
3654
3654
|
var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
3655
3655
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options) {
|
|
3656
3656
|
var api, senderAddress, paraIdTo, assetInfo, currency, feeCurrency, address, feeAssetInfo, version, checkAmount, destChain, internalOptions, FEE_ASSET_AMOUNT, feeAssetAmount, call, dryRunResult, originFeeEstimate, originFee, reserveFeeEstimate, reserveFee, xcm, weight;
|
|
@@ -3708,9 +3708,9 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
3708
3708
|
throw new DryRunFailedError(dryRunResult.failureReason);
|
|
3709
3709
|
case 2:
|
|
3710
3710
|
originFeeEstimate = dryRunResult.origin.fee;
|
|
3711
|
-
originFee = padValueBy(originFeeEstimate, FEE_PADDING_PERCENTAGE$
|
|
3711
|
+
originFee = padValueBy(originFeeEstimate, FEE_PADDING_PERCENTAGE$1);
|
|
3712
3712
|
reserveFeeEstimate = getReserveFeeFromHops(dryRunResult.hops);
|
|
3713
|
-
reserveFee = padValueBy(reserveFeeEstimate, FEE_PADDING_PERCENTAGE$
|
|
3713
|
+
reserveFee = padValueBy(reserveFeeEstimate, FEE_PADDING_PERCENTAGE$1);
|
|
3714
3714
|
checkAmount(feeAssetInfo && !isAssetEqual(assetInfo, feeAssetInfo) ? reserveFee : originFee + reserveFee);
|
|
3715
3715
|
xcm = createDirectExecuteXcm(_objectSpread2(_objectSpread2({}, internalOptions), {}, {
|
|
3716
3716
|
fees: {
|
|
@@ -3786,21 +3786,27 @@ var determineAddress = function determineAddress(chain, address, senderAddress)
|
|
|
3786
3786
|
};
|
|
3787
3787
|
var getReverseTxFee = /*#__PURE__*/function () {
|
|
3788
3788
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref, currencyInput) {
|
|
3789
|
-
var api, origin, destination, senderAddress, address, toAddress, fromAddress, _yield$Builder$from$t, tx, rawFee;
|
|
3789
|
+
var api, origin, destination, senderAddress, address, skipReverseFeeCalculation, toAddress, fromAddress, _yield$Builder$from$t, tx, rawFee;
|
|
3790
3790
|
return _regenerator().w(function (_context) {
|
|
3791
3791
|
while (1) switch (_context.n) {
|
|
3792
3792
|
case 0:
|
|
3793
|
-
api = _ref.api, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address;
|
|
3793
|
+
api = _ref.api, origin = _ref.origin, destination = _ref.destination, senderAddress = _ref.senderAddress, address = _ref.address, skipReverseFeeCalculation = _ref.skipReverseFeeCalculation;
|
|
3794
|
+
if (!skipReverseFeeCalculation) {
|
|
3795
|
+
_context.n = 1;
|
|
3796
|
+
break;
|
|
3797
|
+
}
|
|
3798
|
+
return _context.a(2, 0n);
|
|
3799
|
+
case 1:
|
|
3794
3800
|
toAddress = determineAddress(origin, address, senderAddress);
|
|
3795
3801
|
fromAddress = determineAddress(destination, address, senderAddress);
|
|
3796
|
-
_context.n =
|
|
3802
|
+
_context.n = 2;
|
|
3797
3803
|
return Builder(api).from(destination).to(origin).address(toAddress).senderAddress(fromAddress).currency(currencyInput)['buildInternal']();
|
|
3798
|
-
case
|
|
3804
|
+
case 2:
|
|
3799
3805
|
_yield$Builder$from$t = _context.v;
|
|
3800
3806
|
tx = _yield$Builder$from$t.tx;
|
|
3801
|
-
_context.n =
|
|
3807
|
+
_context.n = 3;
|
|
3802
3808
|
return api.calculateTransactionFee(tx, fromAddress);
|
|
3803
|
-
case
|
|
3809
|
+
case 3:
|
|
3804
3810
|
rawFee = _context.v;
|
|
3805
3811
|
return _context.a(2, padFee(rawFee, origin, destination, 'destination'));
|
|
3806
3812
|
}
|
|
@@ -3912,7 +3918,7 @@ var getBalanceForeignXTokens = /*#__PURE__*/function () {
|
|
|
3912
3918
|
return _regenerator().w(function (_context) {
|
|
3913
3919
|
while (1) switch (_context.n) {
|
|
3914
3920
|
case 0:
|
|
3915
|
-
if (!(chain === 'Astar' || chain === 'Shiden' || chain.startsWith('Integritee'))) {
|
|
3921
|
+
if (!(chain === 'Astar' || chain === 'Shiden' || chain === 'CrustShadow' || chain.startsWith('Integritee'))) {
|
|
3916
3922
|
_context.n = 1;
|
|
3917
3923
|
break;
|
|
3918
3924
|
}
|
|
@@ -5796,7 +5802,7 @@ var createSwapExecuteXcm = /*#__PURE__*/function () {
|
|
|
5796
5802
|
};
|
|
5797
5803
|
}();
|
|
5798
5804
|
|
|
5799
|
-
var FEE_PADDING_PERCENTAGE
|
|
5805
|
+
var FEE_PADDING_PERCENTAGE = 20;
|
|
5800
5806
|
var validateAmount = function validateAmount(amount, requiredFee) {
|
|
5801
5807
|
if (amount <= requiredFee) {
|
|
5802
5808
|
throw new AmountTooLowError("Asset amount is too low, please increase the amount or use a different fee asset.");
|
|
@@ -5862,7 +5868,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5862
5868
|
throw new DryRunFailedError("Exchange (destination) failed: ".concat(dryRunResult.destination.failureReason || 'Unknown reason'));
|
|
5863
5869
|
}
|
|
5864
5870
|
if (dryRunResult.destination && dryRunResult.destination.success) {
|
|
5865
|
-
fees.exchangeFee = padValueBy(dryRunResult.destination.fee, FEE_PADDING_PERCENTAGE
|
|
5871
|
+
fees.exchangeFee = padValueBy(dryRunResult.destination.fee, FEE_PADDING_PERCENTAGE);
|
|
5866
5872
|
}
|
|
5867
5873
|
} else {
|
|
5868
5874
|
// Normal case: exchange is an intermediate hop
|
|
@@ -5871,7 +5877,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5871
5877
|
throw new DryRunFailedError("Exchange hop failed: ".concat(exchangeHop.result.failureReason || 'Unknown reason'));
|
|
5872
5878
|
}
|
|
5873
5879
|
if (exchangeHop.result.success) {
|
|
5874
|
-
fees.exchangeFee = padValueBy(exchangeHop.result.fee, FEE_PADDING_PERCENTAGE
|
|
5880
|
+
fees.exchangeFee = padValueBy(exchangeHop.result.fee, FEE_PADDING_PERCENTAGE);
|
|
5875
5881
|
}
|
|
5876
5882
|
}
|
|
5877
5883
|
} else {
|
|
@@ -5888,7 +5894,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5888
5894
|
throw new DryRunFailedError("Hop before exchange failed: ".concat(hopBeforeExchange.result.failureReason || 'Unknown reason'));
|
|
5889
5895
|
}
|
|
5890
5896
|
if (hopBeforeExchange.result.success) {
|
|
5891
|
-
fees.originReserveFee = padValueBy(hopBeforeExchange.result.fee, FEE_PADDING_PERCENTAGE
|
|
5897
|
+
fees.originReserveFee = padValueBy(hopBeforeExchange.result.fee, FEE_PADDING_PERCENTAGE);
|
|
5892
5898
|
}
|
|
5893
5899
|
} else if (!destChain && hops.length > 0) {
|
|
5894
5900
|
// Special case: when destChain is undefined and we have hops,
|
|
@@ -5898,7 +5904,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5898
5904
|
throw new DryRunFailedError("Origin reserve hop failed: ".concat(lastHop.result.failureReason || 'Unknown reason'));
|
|
5899
5905
|
}
|
|
5900
5906
|
if (lastHop.result.success) {
|
|
5901
|
-
fees.originReserveFee = padValueBy(lastHop.result.fee, FEE_PADDING_PERCENTAGE
|
|
5907
|
+
fees.originReserveFee = padValueBy(lastHop.result.fee, FEE_PADDING_PERCENTAGE);
|
|
5902
5908
|
}
|
|
5903
5909
|
}
|
|
5904
5910
|
// Handle destination reserve fee (hop after exchange)
|
|
@@ -5909,7 +5915,7 @@ var extractFeesFromDryRun = function extractFeesFromDryRun(chain, dryRunResult,
|
|
|
5909
5915
|
throw new DryRunFailedError("Hop after exchange failed: ".concat(hopAfterExchange.result.failureReason || 'Unknown reason'));
|
|
5910
5916
|
}
|
|
5911
5917
|
if (hopAfterExchange.result.success) {
|
|
5912
|
-
fees.destReserveFee = padValueBy(hopAfterExchange.result.fee, FEE_PADDING_PERCENTAGE
|
|
5918
|
+
fees.destReserveFee = padValueBy(hopAfterExchange.result.fee, FEE_PADDING_PERCENTAGE);
|
|
5913
5919
|
}
|
|
5914
5920
|
}
|
|
5915
5921
|
return fees;
|
|
@@ -6095,7 +6101,7 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
6095
6101
|
// Enter dummy fee values just to get the dry run to pass
|
|
6096
6102
|
asset.amount, asset.amount / 2n);
|
|
6097
6103
|
_context.n = 4;
|
|
6098
|
-
return
|
|
6104
|
+
return getXcmFeeOnce({
|
|
6099
6105
|
api: api,
|
|
6100
6106
|
tx: dummyTx,
|
|
6101
6107
|
origin: origin,
|
|
@@ -6698,7 +6704,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6698
6704
|
}
|
|
6699
6705
|
throw new InvalidParameterError('Cannot override destination when using type and then transfer.');
|
|
6700
6706
|
case 2:
|
|
6701
|
-
return _context2.a(2,
|
|
6707
|
+
return _context2.a(2, createTypeThenAutoReserve(getRelayChainOf(destChain), _objectSpread2(_objectSpread2({}, options), {}, {
|
|
6702
6708
|
beneficiaryLocation: createBeneficiaryLocation({
|
|
6703
6709
|
api: api,
|
|
6704
6710
|
address: address,
|
|
@@ -7012,6 +7018,11 @@ var Acala = /*#__PURE__*/function (_Parachain) {
|
|
|
7012
7018
|
var currencySelection = this.getCurrencySelection(asset);
|
|
7013
7019
|
return transferXTokens(input, currencySelection);
|
|
7014
7020
|
}
|
|
7021
|
+
}, {
|
|
7022
|
+
key: "transferRelayToPara",
|
|
7023
|
+
value: function transferRelayToPara() {
|
|
7024
|
+
throw new ChainNotSupportedError();
|
|
7025
|
+
}
|
|
7015
7026
|
}, {
|
|
7016
7027
|
key: "transferLocalNativeAsset",
|
|
7017
7028
|
value: function () {
|
|
@@ -7704,6 +7715,11 @@ var Astar = /*#__PURE__*/function (_Parachain) {
|
|
|
7704
7715
|
var assetInfo = _ref.assetInfo;
|
|
7705
7716
|
return assetInfo.symbol !== this.getNativeAssetSymbol();
|
|
7706
7717
|
}
|
|
7718
|
+
}, {
|
|
7719
|
+
key: "transferRelayToPara",
|
|
7720
|
+
value: function transferRelayToPara() {
|
|
7721
|
+
throw new ChainNotSupportedError();
|
|
7722
|
+
}
|
|
7707
7723
|
}, {
|
|
7708
7724
|
key: "transferLocalNonNativeAsset",
|
|
7709
7725
|
value: function transferLocalNonNativeAsset(options) {
|
|
@@ -9761,6 +9777,11 @@ var Shiden = /*#__PURE__*/function (_Parachain) {
|
|
|
9761
9777
|
var assetInfo = _ref.assetInfo;
|
|
9762
9778
|
return assetInfo.symbol !== this.getNativeAssetSymbol();
|
|
9763
9779
|
}
|
|
9780
|
+
}, {
|
|
9781
|
+
key: "transferRelayToPara",
|
|
9782
|
+
value: function transferRelayToPara() {
|
|
9783
|
+
throw new ChainNotSupportedError();
|
|
9784
|
+
}
|
|
9764
9785
|
}, {
|
|
9765
9786
|
key: "transferLocalNonNativeAsset",
|
|
9766
9787
|
value: function transferLocalNonNativeAsset(options) {
|
|
@@ -10577,7 +10598,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
10577
10598
|
api: api,
|
|
10578
10599
|
chain: chain,
|
|
10579
10600
|
address: address,
|
|
10580
|
-
currency: getCurrencySelection(asset)
|
|
10601
|
+
currency: getCurrencySelection(chain, asset)
|
|
10581
10602
|
});
|
|
10582
10603
|
case 9:
|
|
10583
10604
|
balance = _context.v;
|
|
@@ -11061,13 +11082,13 @@ var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
|
11061
11082
|
}
|
|
11062
11083
|
return {};
|
|
11063
11084
|
};
|
|
11064
|
-
var
|
|
11085
|
+
var getXcmFeeOnce = /*#__PURE__*/function () {
|
|
11065
11086
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
11066
|
-
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, asset, amount, _yield$getOriginXcmFe, originFeeRaw,
|
|
11087
|
+
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, skipReverseFeeCalculation, asset, amount, _yield$getOriginXcmFe, originFeeRaw, originAsset, originFeeType, originDryRunError, originDryRunSubError, initialForwardedXcm, initialDestParaId, originWeight, sufficientOriginFee, isMythosToEthereum, originFee, destApi, destFeeRes, _result, _getFailureInfo, _failureChain, _failureReason, processHop, traversalResult, destFee, destCurrency, destAsset, destFeeType, destDryRunError, destDryRunSubError, destSufficient, destResult, _destApi, destFallback, assetHubChain, processedBridgeHub, bridgeHubChain, bridgeHubHopIndex, convertToFeeDetail, result, _getFailureInfo2, failureChain, failureReason, _t, _t2, _t3, _t4;
|
|
11067
11088
|
return _regenerator().w(function (_context2) {
|
|
11068
11089
|
while (1) switch (_context2.p = _context2.n) {
|
|
11069
11090
|
case 0:
|
|
11070
|
-
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;
|
|
11091
|
+
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, skipReverseFeeCalculation = _ref.skipReverseFeeCalculation;
|
|
11071
11092
|
asset = findAssetInfoOrThrow(origin, currency, destination);
|
|
11072
11093
|
amount = abstractDecimals(currency.amount, asset.decimals, api);
|
|
11073
11094
|
_context2.n = 1;
|
|
@@ -11085,7 +11106,6 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11085
11106
|
case 1:
|
|
11086
11107
|
_yield$getOriginXcmFe = _context2.v;
|
|
11087
11108
|
originFeeRaw = _yield$getOriginXcmFe.fee;
|
|
11088
|
-
originCurrency = _yield$getOriginXcmFe.currency;
|
|
11089
11109
|
originAsset = _yield$getOriginXcmFe.asset;
|
|
11090
11110
|
originFeeType = _yield$getOriginXcmFe.feeType;
|
|
11091
11111
|
originDryRunError = _yield$getOriginXcmFe.dryRunError;
|
|
@@ -11138,7 +11158,8 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11138
11158
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
11139
11159
|
senderAddress: senderAddress,
|
|
11140
11160
|
disableFallback: disableFallback,
|
|
11141
|
-
swapConfig: swapConfig
|
|
11161
|
+
swapConfig: swapConfig,
|
|
11162
|
+
skipReverseFeeCalculation: skipReverseFeeCalculation
|
|
11142
11163
|
});
|
|
11143
11164
|
case 7:
|
|
11144
11165
|
destFeeRes = _context2.v;
|
|
@@ -11149,7 +11170,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11149
11170
|
feeType: originFeeType
|
|
11150
11171
|
}), {}, {
|
|
11151
11172
|
sufficient: sufficientOriginFee,
|
|
11152
|
-
currency:
|
|
11173
|
+
currency: originAsset.symbol,
|
|
11153
11174
|
asset: originAsset
|
|
11154
11175
|
}, originDryRunError && {
|
|
11155
11176
|
dryRunError: originDryRunError
|
|
@@ -11222,7 +11243,8 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11222
11243
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
11223
11244
|
disableFallback: disableFallback,
|
|
11224
11245
|
hasPassedExchange: hasPassedExchange,
|
|
11225
|
-
swapConfig: swapConfig
|
|
11246
|
+
swapConfig: swapConfig,
|
|
11247
|
+
skipReverseFeeCalculation: skipReverseFeeCalculation
|
|
11226
11248
|
});
|
|
11227
11249
|
case 1:
|
|
11228
11250
|
hopResult = _context.v;
|
|
@@ -11300,7 +11322,8 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11300
11322
|
originFee: originFee !== null && originFee !== void 0 ? originFee : 0n,
|
|
11301
11323
|
senderAddress: senderAddress,
|
|
11302
11324
|
disableFallback: disableFallback,
|
|
11303
|
-
swapConfig: swapConfig
|
|
11325
|
+
swapConfig: swapConfig,
|
|
11326
|
+
skipReverseFeeCalculation: skipReverseFeeCalculation
|
|
11304
11327
|
});
|
|
11305
11328
|
case 14:
|
|
11306
11329
|
destFallback = _context2.v;
|
|
@@ -11372,7 +11395,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11372
11395
|
}), sufficientOriginFee !== undefined && {
|
|
11373
11396
|
sufficient: sufficientOriginFee
|
|
11374
11397
|
}), {}, {
|
|
11375
|
-
currency:
|
|
11398
|
+
currency: originAsset.symbol,
|
|
11376
11399
|
asset: originAsset
|
|
11377
11400
|
}, originDryRunError && {
|
|
11378
11401
|
dryRunError: originDryRunError
|
|
@@ -11417,32 +11440,32 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11417
11440
|
}
|
|
11418
11441
|
}, _callee2, null, [[5,, 8, 10]]);
|
|
11419
11442
|
}));
|
|
11420
|
-
return function
|
|
11443
|
+
return function getXcmFeeOnce(_x) {
|
|
11421
11444
|
return _ref2.apply(this, arguments);
|
|
11422
11445
|
};
|
|
11423
11446
|
}();
|
|
11424
11447
|
|
|
11425
|
-
var
|
|
11448
|
+
var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
11426
11449
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
11427
|
-
var buildTx,
|
|
11450
|
+
var buildTx, _real$assetHub, _real$bridgeHub, tx, real, forced, _forced, _t;
|
|
11428
11451
|
return _regenerator().w(function (_context) {
|
|
11429
11452
|
while (1) switch (_context.p = _context.n) {
|
|
11430
11453
|
case 0:
|
|
11431
|
-
buildTx = options.buildTx
|
|
11454
|
+
buildTx = options.buildTx;
|
|
11432
11455
|
_context.p = 1;
|
|
11433
11456
|
_context.n = 2;
|
|
11434
11457
|
return buildTx();
|
|
11435
11458
|
case 2:
|
|
11436
11459
|
tx = _context.v;
|
|
11437
11460
|
_context.n = 3;
|
|
11438
|
-
return
|
|
11461
|
+
return getXcmFeeOnce(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
11439
11462
|
tx: tx,
|
|
11440
11463
|
useRootOrigin: false
|
|
11441
11464
|
}));
|
|
11442
11465
|
case 3:
|
|
11443
11466
|
real = _context.v;
|
|
11444
11467
|
_context.n = 4;
|
|
11445
|
-
return getBypassResultWithRetries(options,
|
|
11468
|
+
return getBypassResultWithRetries(options, getXcmFeeOnce, tx);
|
|
11446
11469
|
case 4:
|
|
11447
11470
|
forced = _context.v;
|
|
11448
11471
|
return _context.a(2, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, forced), {}, {
|
|
@@ -11480,7 +11503,7 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
11480
11503
|
throw _t;
|
|
11481
11504
|
case 6:
|
|
11482
11505
|
_context.n = 7;
|
|
11483
|
-
return getBypassResultWithRetries(options,
|
|
11506
|
+
return getBypassResultWithRetries(options, getXcmFeeOnce);
|
|
11484
11507
|
case 7:
|
|
11485
11508
|
_forced = _context.v;
|
|
11486
11509
|
return _context.a(2, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, _forced), {}, {
|
|
@@ -11507,21 +11530,40 @@ var getXcmFee = /*#__PURE__*/function () {
|
|
|
11507
11530
|
});
|
|
11508
11531
|
})
|
|
11509
11532
|
}));
|
|
11510
|
-
case 8:
|
|
11511
|
-
_context.p = 8;
|
|
11512
|
-
_context.n = 9;
|
|
11513
|
-
return api.disconnect();
|
|
11514
|
-
case 9:
|
|
11515
|
-
return _context.f(8);
|
|
11516
|
-
case 10:
|
|
11517
|
-
return _context.a(2);
|
|
11518
11533
|
}
|
|
11519
|
-
}, _callee, null, [[1, 5
|
|
11534
|
+
}, _callee, null, [[1, 5]]);
|
|
11520
11535
|
}));
|
|
11521
|
-
return function
|
|
11536
|
+
return function getXcmFeeInternal(_x) {
|
|
11522
11537
|
return _ref.apply(this, arguments);
|
|
11523
11538
|
};
|
|
11524
11539
|
}();
|
|
11540
|
+
var getXcmFee = /*#__PURE__*/function () {
|
|
11541
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
11542
|
+
var api;
|
|
11543
|
+
return _regenerator().w(function (_context2) {
|
|
11544
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
11545
|
+
case 0:
|
|
11546
|
+
api = options.api;
|
|
11547
|
+
_context2.p = 1;
|
|
11548
|
+
_context2.n = 2;
|
|
11549
|
+
return getXcmFeeInternal(options);
|
|
11550
|
+
case 2:
|
|
11551
|
+
return _context2.a(2, _context2.v);
|
|
11552
|
+
case 3:
|
|
11553
|
+
_context2.p = 3;
|
|
11554
|
+
_context2.n = 4;
|
|
11555
|
+
return api.disconnect();
|
|
11556
|
+
case 4:
|
|
11557
|
+
return _context2.f(3);
|
|
11558
|
+
case 5:
|
|
11559
|
+
return _context2.a(2);
|
|
11560
|
+
}
|
|
11561
|
+
}, _callee2, null, [[1,, 3, 5]]);
|
|
11562
|
+
}));
|
|
11563
|
+
return function getXcmFee(_x2) {
|
|
11564
|
+
return _ref2.apply(this, arguments);
|
|
11565
|
+
};
|
|
11566
|
+
}();
|
|
11525
11567
|
|
|
11526
11568
|
var BRIDGE_FEE_DOT = 682395810n; // 0.068239581 DOT
|
|
11527
11569
|
var BRIDGE_FEE_KSM = 12016807000n; // 0.012016807 KSM
|
|
@@ -11946,7 +11988,7 @@ var buildHopInfo = /*#__PURE__*/function () {
|
|
|
11946
11988
|
|
|
11947
11989
|
var getTransferInfo = /*#__PURE__*/function () {
|
|
11948
11990
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
11949
|
-
var api, buildTx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$
|
|
11991
|
+
var api, buildTx, origin, destination, senderAddress, ahAddress, address, currency, feeAsset, resolvedFeeAsset, originAsset, amount, originBalanceFee, originBalance, edOrigin, _yield$getXcmFeeInter, _yield$getXcmFeeInter2, originFee, originFeeCurrency, originFeeAsset, assetHubFeeResult, bridgeHubFeeResult, destFeeDetail, hops, isFeeAssetAh, originBalanceAfter, originBalanceFeeAfter, originBalanceNativeSufficient, originBalanceSufficient, assetHub, bridgeHub, bridgeHubChain, builtHops, totalHopFee, destinationInfo, _t;
|
|
11950
11992
|
return _regenerator().w(function (_context2) {
|
|
11951
11993
|
while (1) switch (_context2.p = _context2.n) {
|
|
11952
11994
|
case 0:
|
|
@@ -12014,15 +12056,15 @@ var getTransferInfo = /*#__PURE__*/function () {
|
|
|
12014
12056
|
disableFallback: false
|
|
12015
12057
|
});
|
|
12016
12058
|
case 9:
|
|
12017
|
-
_yield$
|
|
12018
|
-
_yield$
|
|
12019
|
-
originFee = _yield$
|
|
12020
|
-
originFeeCurrency = _yield$
|
|
12021
|
-
originFeeAsset = _yield$
|
|
12022
|
-
assetHubFeeResult = _yield$
|
|
12023
|
-
bridgeHubFeeResult = _yield$
|
|
12024
|
-
destFeeDetail = _yield$
|
|
12025
|
-
hops = _yield$
|
|
12059
|
+
_yield$getXcmFeeInter = _context2.v;
|
|
12060
|
+
_yield$getXcmFeeInter2 = _yield$getXcmFeeInter.origin;
|
|
12061
|
+
originFee = _yield$getXcmFeeInter2.fee;
|
|
12062
|
+
originFeeCurrency = _yield$getXcmFeeInter2.currency;
|
|
12063
|
+
originFeeAsset = _yield$getXcmFeeInter2.asset;
|
|
12064
|
+
assetHubFeeResult = _yield$getXcmFeeInter.assetHub;
|
|
12065
|
+
bridgeHubFeeResult = _yield$getXcmFeeInter.bridgeHub;
|
|
12066
|
+
destFeeDetail = _yield$getXcmFeeInter.destination;
|
|
12067
|
+
hops = _yield$getXcmFeeInter.hops;
|
|
12026
12068
|
isFeeAssetAh = origin === 'AssetHubPolkadot' && resolvedFeeAsset && isAssetEqual(resolvedFeeAsset, originAsset);
|
|
12027
12069
|
originBalanceAfter = originBalance - amount;
|
|
12028
12070
|
originBalanceFeeAfter = isFeeAssetAh ? originBalanceFee - amount : originBalanceFee - originFee;
|
|
@@ -12392,15 +12434,20 @@ var buildTypeAndThenCall = function buildTypeAndThenCall(_ref, isDotAsset, custo
|
|
|
12392
12434
|
reserve = _ref.reserve,
|
|
12393
12435
|
dest = _ref.dest,
|
|
12394
12436
|
assetInfo = _ref.assetInfo,
|
|
12395
|
-
|
|
12437
|
+
_ref$options = _ref.options,
|
|
12438
|
+
version = _ref$options.version,
|
|
12439
|
+
pallet = _ref$options.pallet,
|
|
12440
|
+
method = _ref$options.method;
|
|
12396
12441
|
var feeAssetLocation = !isDotAsset ? RELAY_LOCATION : assetInfo.location;
|
|
12397
12442
|
var finalDest = origin.chain === reserve.chain ? dest.chain : reserve.chain;
|
|
12398
12443
|
var destLocation = createDestination(version, origin.chain, finalDest, getParaId(finalDest));
|
|
12399
12444
|
var reserveType = origin.chain === reserve.chain ? 'LocalReserve' : 'DestinationReserve';
|
|
12400
12445
|
var feeMultiAsset = createAsset(version, assetInfo.amount, isRelayChain(origin.chain) ? localizeLocation(origin.chain, feeAssetLocation) : feeAssetLocation);
|
|
12446
|
+
var module = pallet !== null && pallet !== void 0 ? pallet : isRelayChain(origin.chain) ? 'XcmPallet' : 'PolkadotXcm';
|
|
12447
|
+
var methodName = method !== null && method !== void 0 ? method : 'transfer_assets_using_type_and_then';
|
|
12401
12448
|
return {
|
|
12402
|
-
module:
|
|
12403
|
-
method:
|
|
12449
|
+
module: module,
|
|
12450
|
+
method: methodName,
|
|
12404
12451
|
parameters: {
|
|
12405
12452
|
dest: addXcmVersionHeader(destLocation, version),
|
|
12406
12453
|
assets: addXcmVersionHeader(assets, version),
|
|
@@ -12413,130 +12460,76 @@ var buildTypeAndThenCall = function buildTypeAndThenCall(_ref, isDotAsset, custo
|
|
|
12413
12460
|
};
|
|
12414
12461
|
};
|
|
12415
12462
|
|
|
12416
|
-
var
|
|
12417
|
-
var
|
|
12418
|
-
|
|
12419
|
-
|
|
12420
|
-
|
|
12421
|
-
|
|
12422
|
-
|
|
12423
|
-
|
|
12424
|
-
|
|
12425
|
-
|
|
12426
|
-
};
|
|
12427
|
-
var computeInstructionFee = /*#__PURE__*/function () {
|
|
12428
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref2, version, xcm, context) {
|
|
12429
|
-
var chain, api, padding, _t;
|
|
12463
|
+
var FEE_PADDING = 30;
|
|
12464
|
+
var sumHopFees = function sumHopFees(result, asset) {
|
|
12465
|
+
return result.hops.reduce(function (acc, hop) {
|
|
12466
|
+
// only add if asset is equal
|
|
12467
|
+
return isAssetEqual(hop.result.asset, asset) ? acc + hop.result.fee : acc;
|
|
12468
|
+
}, 0n);
|
|
12469
|
+
};
|
|
12470
|
+
var computeAllFees = /*#__PURE__*/function () {
|
|
12471
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context, buildTx) {
|
|
12472
|
+
var origin, dest, assetInfo, _context$options, senderAddress, address, currency, feeCurrency, result, hopFees, destFee;
|
|
12430
12473
|
return _regenerator().w(function (_context) {
|
|
12431
12474
|
while (1) switch (_context.n) {
|
|
12432
12475
|
case 0:
|
|
12433
|
-
|
|
12434
|
-
|
|
12435
|
-
|
|
12436
|
-
|
|
12437
|
-
|
|
12438
|
-
location: DOT_LOCATION
|
|
12439
|
-
}, true);
|
|
12440
|
-
case 1:
|
|
12441
|
-
return _context.a(2, _t(_context.v, padding));
|
|
12442
|
-
}
|
|
12443
|
-
}, _callee);
|
|
12444
|
-
}));
|
|
12445
|
-
return function computeInstructionFee(_x, _x2, _x3, _x4) {
|
|
12446
|
-
return _ref3.apply(this, arguments);
|
|
12447
|
-
};
|
|
12448
|
-
}();
|
|
12449
|
-
var computeAllFees = /*#__PURE__*/function () {
|
|
12450
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(context, customXcm, isDotAsset, refundInstruction) {
|
|
12451
|
-
var reserve, dest, version, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
|
|
12452
|
-
return _regenerator().w(function (_context2) {
|
|
12453
|
-
while (1) switch (_context2.n) {
|
|
12454
|
-
case 0:
|
|
12455
|
-
reserve = context.reserve, dest = context.dest, version = context.options.version;
|
|
12456
|
-
if (!customXcm.some(function (x) {
|
|
12457
|
-
return 'DepositReserveAsset' in x || 'InitiateTeleport' in x;
|
|
12458
|
-
})) {
|
|
12459
|
-
_context2.n = 6;
|
|
12476
|
+
origin = context.origin, dest = context.dest, assetInfo = context.assetInfo, _context$options = context.options, senderAddress = _context$options.senderAddress, address = _context$options.address, currency = _context$options.currency, feeCurrency = _context$options.feeCurrency;
|
|
12477
|
+
assertSenderAddress(senderAddress);
|
|
12478
|
+
assertAddressIsString(address);
|
|
12479
|
+
if (hasDryRunSupport(context.origin.chain)) {
|
|
12480
|
+
_context.n = 1;
|
|
12460
12481
|
break;
|
|
12461
12482
|
}
|
|
12462
|
-
|
|
12463
|
-
return computeInstructionFee(reserve, version, customXcm, context);
|
|
12483
|
+
return _context.a(2, null);
|
|
12464
12484
|
case 1:
|
|
12465
|
-
|
|
12466
|
-
|
|
12467
|
-
|
|
12468
|
-
|
|
12469
|
-
|
|
12470
|
-
|
|
12471
|
-
|
|
12485
|
+
_context.n = 2;
|
|
12486
|
+
return getXcmFeeInternal({
|
|
12487
|
+
api: origin.api,
|
|
12488
|
+
buildTx: buildTx,
|
|
12489
|
+
origin: origin.chain,
|
|
12490
|
+
destination: dest.chain,
|
|
12491
|
+
senderAddress: senderAddress,
|
|
12492
|
+
address: address,
|
|
12493
|
+
currency: currency,
|
|
12494
|
+
feeAsset: feeCurrency,
|
|
12495
|
+
disableFallback: false,
|
|
12496
|
+
skipReverseFeeCalculation: true
|
|
12497
|
+
});
|
|
12472
12498
|
case 2:
|
|
12473
|
-
|
|
12474
|
-
|
|
12475
|
-
|
|
12476
|
-
|
|
12477
|
-
|
|
12478
|
-
|
|
12479
|
-
|
|
12480
|
-
_context2.n = 5;
|
|
12481
|
-
return computeInstructionFee(hasXcmPaymentApiSupport(dest.chain) ? dest : reserve, version, function () {
|
|
12482
|
-
var instr = customXcm.find(function (j) {
|
|
12483
|
-
return 'DepositReserveAsset' in j || 'InitiateTeleport' in j;
|
|
12484
|
-
});
|
|
12485
|
-
return instr ? 'DepositReserveAsset' in instr ? instr.DepositReserveAsset.xcm : instr.InitiateTeleport.xcm : undefined;
|
|
12486
|
-
}(), context);
|
|
12487
|
-
case 5:
|
|
12488
|
-
_t6 = _context2.v;
|
|
12489
|
-
_t2 = {
|
|
12490
|
-
reserveFee: _t3,
|
|
12491
|
-
refundFee: _t5,
|
|
12492
|
-
destFee: _t6
|
|
12493
|
-
};
|
|
12494
|
-
_context2.n = 13;
|
|
12495
|
-
break;
|
|
12496
|
-
case 6:
|
|
12497
|
-
if (isDotAsset) {
|
|
12498
|
-
_context2.n = 8;
|
|
12499
|
-
break;
|
|
12500
|
-
}
|
|
12501
|
-
_context2.n = 7;
|
|
12502
|
-
return computeInstructionFee(hasXcmPaymentApiSupport(dest.chain) ? dest : reserve, version, customXcm, context);
|
|
12503
|
-
case 7:
|
|
12504
|
-
_t7 = _context2.v;
|
|
12505
|
-
_context2.n = 9;
|
|
12506
|
-
break;
|
|
12507
|
-
case 8:
|
|
12508
|
-
_t7 = 0n;
|
|
12509
|
-
case 9:
|
|
12510
|
-
_t8 = _t7;
|
|
12511
|
-
if (isDotAsset) {
|
|
12512
|
-
_context2.n = 11;
|
|
12513
|
-
break;
|
|
12514
|
-
}
|
|
12515
|
-
_context2.n = 10;
|
|
12516
|
-
return computeInstructionFee(hasXcmPaymentApiSupport(reserve.chain) ? reserve : dest, version, [refundInstruction], context);
|
|
12517
|
-
case 10:
|
|
12518
|
-
_t9 = _context2.v;
|
|
12519
|
-
_context2.n = 12;
|
|
12520
|
-
break;
|
|
12521
|
-
case 11:
|
|
12522
|
-
_t9 = 0n;
|
|
12523
|
-
case 12:
|
|
12524
|
-
_t0 = _t9;
|
|
12525
|
-
_t2 = {
|
|
12526
|
-
reserveFee: 0n,
|
|
12527
|
-
destFee: _t8,
|
|
12528
|
-
refundFee: _t0
|
|
12529
|
-
};
|
|
12530
|
-
case 13:
|
|
12531
|
-
return _context2.a(2, _t2);
|
|
12499
|
+
result = _context.v;
|
|
12500
|
+
hopFees = sumHopFees(result, assetInfo);
|
|
12501
|
+
destFee = result.destination.fee;
|
|
12502
|
+
return _context.a(2, {
|
|
12503
|
+
hopFees: padValueBy(hopFees, FEE_PADDING),
|
|
12504
|
+
destFee: padValueBy(destFee, FEE_PADDING)
|
|
12505
|
+
});
|
|
12532
12506
|
}
|
|
12533
|
-
},
|
|
12507
|
+
}, _callee);
|
|
12534
12508
|
}));
|
|
12535
|
-
return function computeAllFees(
|
|
12536
|
-
return
|
|
12509
|
+
return function computeAllFees(_x, _x2) {
|
|
12510
|
+
return _ref.apply(this, arguments);
|
|
12537
12511
|
};
|
|
12538
12512
|
}();
|
|
12539
12513
|
|
|
12514
|
+
var RELAY_ASSET_LOCATIONS = [RELAY_LOCATION, {
|
|
12515
|
+
parents: 2,
|
|
12516
|
+
interior: {
|
|
12517
|
+
X1: [{
|
|
12518
|
+
GlobalConsensus: {
|
|
12519
|
+
Kusama: null
|
|
12520
|
+
}
|
|
12521
|
+
}]
|
|
12522
|
+
}
|
|
12523
|
+
}, {
|
|
12524
|
+
parents: 2,
|
|
12525
|
+
interior: {
|
|
12526
|
+
X1: [{
|
|
12527
|
+
GlobalConsensus: {
|
|
12528
|
+
Polkadot: null
|
|
12529
|
+
}
|
|
12530
|
+
}]
|
|
12531
|
+
}
|
|
12532
|
+
}];
|
|
12540
12533
|
var getSubBridgeReserve = function getSubBridgeReserve(chain, destination, location) {
|
|
12541
12534
|
if (deepEqual(location, RELAY_LOCATION)) return chain;
|
|
12542
12535
|
return destination;
|
|
@@ -12552,29 +12545,27 @@ var resolveReserveChain = function resolveReserveChain(chain, destination, asset
|
|
|
12552
12545
|
};
|
|
12553
12546
|
var createTypeAndThenCallContext = /*#__PURE__*/function () {
|
|
12554
12547
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options, overrideReserve) {
|
|
12555
|
-
var api, destination, assetInfo, destinationChain, isSubBridge, reserveChain, destApi, reserveApi;
|
|
12548
|
+
var api, destination, assetInfo, destinationChain, isSubBridge, reserveChain, isRelayAsset, destApi, reserveApi;
|
|
12556
12549
|
return _regenerator().w(function (_context) {
|
|
12557
12550
|
while (1) switch (_context.n) {
|
|
12558
12551
|
case 0:
|
|
12559
12552
|
api = options.api, destination = options.destination, assetInfo = options.assetInfo;
|
|
12560
12553
|
assertHasLocation(assetInfo);
|
|
12561
|
-
|
|
12562
|
-
_context.n = 1;
|
|
12563
|
-
break;
|
|
12564
|
-
}
|
|
12565
|
-
throw new InvalidParameterError('Cannot override destination when using type and then transfer.');
|
|
12566
|
-
case 1:
|
|
12554
|
+
assertToIsString(destination);
|
|
12567
12555
|
destinationChain = destination;
|
|
12568
12556
|
isSubBridge = isSubstrateBridge(chain, destinationChain);
|
|
12569
12557
|
reserveChain = resolveReserveChain(chain, destinationChain, assetInfo.location, isSubBridge, overrideReserve);
|
|
12558
|
+
isRelayAsset = RELAY_ASSET_LOCATIONS.some(function (loc) {
|
|
12559
|
+
return deepEqual(assetInfo.location, loc);
|
|
12560
|
+
});
|
|
12570
12561
|
destApi = api.clone();
|
|
12571
|
-
_context.n =
|
|
12562
|
+
_context.n = 1;
|
|
12572
12563
|
return destApi.init(destinationChain);
|
|
12573
|
-
case
|
|
12564
|
+
case 1:
|
|
12574
12565
|
reserveApi = reserveChain === chain ? api : reserveChain === destinationChain ? destApi : api.clone();
|
|
12575
|
-
_context.n =
|
|
12566
|
+
_context.n = 2;
|
|
12576
12567
|
return reserveApi.init(reserveChain);
|
|
12577
|
-
case
|
|
12568
|
+
case 2:
|
|
12578
12569
|
return _context.a(2, {
|
|
12579
12570
|
origin: {
|
|
12580
12571
|
api: api,
|
|
@@ -12589,6 +12580,7 @@ var createTypeAndThenCallContext = /*#__PURE__*/function () {
|
|
|
12589
12580
|
chain: reserveChain
|
|
12590
12581
|
},
|
|
12591
12582
|
isSubBridge: isSubBridge,
|
|
12583
|
+
isRelayAsset: isRelayAsset,
|
|
12592
12584
|
assetInfo: assetInfo,
|
|
12593
12585
|
options: options
|
|
12594
12586
|
});
|
|
@@ -12600,26 +12592,37 @@ var createTypeAndThenCallContext = /*#__PURE__*/function () {
|
|
|
12600
12592
|
};
|
|
12601
12593
|
}();
|
|
12602
12594
|
|
|
12603
|
-
var
|
|
12604
|
-
var
|
|
12605
|
-
|
|
12606
|
-
|
|
12607
|
-
|
|
12608
|
-
|
|
12609
|
-
|
|
12595
|
+
var resolveBuyExecutionAmount = function resolveBuyExecutionAmount(_ref, isForFeeCalc, _ref2, systemAssetAmount) {
|
|
12596
|
+
var isRelayAsset = _ref.isRelayAsset,
|
|
12597
|
+
assetInfo = _ref.assetInfo;
|
|
12598
|
+
var hopFees = _ref2.hopFees,
|
|
12599
|
+
destFee = _ref2.destFee;
|
|
12600
|
+
if (isForFeeCalc) {
|
|
12601
|
+
// Rough estimates for dummy XCM call, that is later dryRunned
|
|
12602
|
+
return isRelayAsset ? assetInfo.amount / 2n : systemAssetAmount / 2n;
|
|
12603
|
+
}
|
|
12604
|
+
// We have actual fees, calculate exact buy execution amount
|
|
12605
|
+
return isRelayAsset ? assetInfo.amount - hopFees : destFee;
|
|
12606
|
+
};
|
|
12607
|
+
var createCustomXcm = function createCustomXcm(context, assetCount, isForFeeCalc, systemAssetAmount) {
|
|
12610
12608
|
var fees = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {
|
|
12611
|
-
|
|
12612
|
-
refundFee: 0n,
|
|
12609
|
+
hopFees: 0n,
|
|
12613
12610
|
destFee: 0n
|
|
12614
12611
|
};
|
|
12612
|
+
var origin = context.origin,
|
|
12613
|
+
dest = context.dest,
|
|
12614
|
+
reserve = context.reserve,
|
|
12615
|
+
isSubBridge = context.isSubBridge,
|
|
12616
|
+
isRelayAsset = context.isRelayAsset,
|
|
12617
|
+
assetInfo = context.assetInfo,
|
|
12618
|
+
options = context.options;
|
|
12615
12619
|
var destination = options.destination,
|
|
12616
12620
|
version = options.version,
|
|
12617
12621
|
address = options.address,
|
|
12618
12622
|
paraIdTo = options.paraIdTo;
|
|
12619
|
-
var
|
|
12620
|
-
refundFee = fees.refundFee,
|
|
12623
|
+
var hopFees = fees.hopFees,
|
|
12621
12624
|
destFee = fees.destFee;
|
|
12622
|
-
var feeAssetLocation = !
|
|
12625
|
+
var feeAssetLocation = !isRelayAsset ? RELAY_LOCATION : assetInfo.location;
|
|
12623
12626
|
var feeLocLocalized = localizeLocation(dest.chain, feeAssetLocation, origin.chain);
|
|
12624
12627
|
var asset = createAsset(version, assetInfo.amount, localizeLocation(dest.chain, assetInfo.location, origin.chain));
|
|
12625
12628
|
var depositInstruction = {
|
|
@@ -12642,10 +12645,10 @@ var createCustomXcm = function createCustomXcm(_ref, isDotAsset, assetCount, isF
|
|
|
12642
12645
|
}
|
|
12643
12646
|
};
|
|
12644
12647
|
var assetsFilter = [];
|
|
12645
|
-
if (!
|
|
12648
|
+
if (!isRelayAsset) assetsFilter.push(createAsset(version, hopFees + destFee, localizeLocation(reserve.chain, RELAY_LOCATION)));
|
|
12646
12649
|
assetsFilter.push(createAsset(version, assetInfo.amount, localizeLocation(reserve.chain, assetInfo.location)));
|
|
12647
12650
|
if (isSubBridge || origin.chain !== reserve.chain && dest.chain !== reserve.chain) {
|
|
12648
|
-
var buyExecutionAmount =
|
|
12651
|
+
var buyExecutionAmount = resolveBuyExecutionAmount(context, isForFeeCalc, fees, systemAssetAmount);
|
|
12649
12652
|
if (buyExecutionAmount < 0n && !isForFeeCalc) throw new AmountTooLowError();
|
|
12650
12653
|
var filter = isForFeeCalc ? {
|
|
12651
12654
|
Wild: 'All'
|
|
@@ -12710,63 +12713,166 @@ var buildAssets = function buildAssets(chain, asset, feeAmount, isDotAsset, vers
|
|
|
12710
12713
|
assets.push(createAsset(version, asset.amount, isRelayChain(chain) ? localizeLocation(chain, asset.location) : asset.location));
|
|
12711
12714
|
return assets;
|
|
12712
12715
|
};
|
|
12716
|
+
var DEFAULT_SYSTEM_ASSET_AMOUNT = '1';
|
|
12717
|
+
var resolveSystemAssetAmount = function resolveSystemAssetAmount(_ref, isForFeeCalc, fees) {
|
|
12718
|
+
var origin = _ref.origin;
|
|
12719
|
+
if (isForFeeCalc) {
|
|
12720
|
+
var systemAsset = findNativeAssetInfoOrThrow(getRelayChainOf(origin.chain));
|
|
12721
|
+
return parseUnits(DEFAULT_SYSTEM_ASSET_AMOUNT, systemAsset.decimals);
|
|
12722
|
+
}
|
|
12723
|
+
return fees.destFee + fees.hopFees;
|
|
12724
|
+
};
|
|
12725
|
+
var constructTypeAndThenCall = function constructTypeAndThenCall(context) {
|
|
12726
|
+
var fees = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
12727
|
+
var origin = context.origin,
|
|
12728
|
+
assetInfo = context.assetInfo,
|
|
12729
|
+
isSubBridge = context.isSubBridge,
|
|
12730
|
+
isRelayAsset = context.isRelayAsset,
|
|
12731
|
+
_context$options = context.options,
|
|
12732
|
+
senderAddress = _context$options.senderAddress,
|
|
12733
|
+
version = _context$options.version;
|
|
12734
|
+
var assetCount = isRelayAsset ? 1 : 2;
|
|
12735
|
+
var refundInstruction = senderAddress ? createRefundInstruction(origin.api, senderAddress, version, assetCount) : null;
|
|
12736
|
+
var finalCustomXcm = [];
|
|
12737
|
+
if (refundInstruction && !isSubBridge) finalCustomXcm.push(refundInstruction);
|
|
12738
|
+
var resolvedFees = fees !== null && fees !== void 0 ? fees : {
|
|
12739
|
+
hopFees: 0n,
|
|
12740
|
+
destFee: 0n
|
|
12741
|
+
};
|
|
12742
|
+
var isForFeeCalc = fees === null;
|
|
12743
|
+
var systemAssetAmount = resolveSystemAssetAmount(context, isForFeeCalc, resolvedFees);
|
|
12744
|
+
finalCustomXcm.push.apply(finalCustomXcm, _toConsumableArray(createCustomXcm(context, assetCount, isForFeeCalc, systemAssetAmount, resolvedFees)));
|
|
12745
|
+
var assets = buildAssets(origin.chain, assetInfo, systemAssetAmount, isRelayAsset, version);
|
|
12746
|
+
return buildTypeAndThenCall(context, isRelayAsset, finalCustomXcm, assets);
|
|
12747
|
+
};
|
|
12713
12748
|
/**
|
|
12714
12749
|
* Creates a type and then call for transferring assets using XCM. Works only for DOT and snowbridge assets so far.
|
|
12715
12750
|
*/
|
|
12716
12751
|
var createTypeAndThenCall = /*#__PURE__*/function () {
|
|
12717
|
-
var
|
|
12718
|
-
var
|
|
12752
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options, overrideReserve) {
|
|
12753
|
+
var context, origin, assetInfo, fees;
|
|
12719
12754
|
return _regenerator().w(function (_context) {
|
|
12720
12755
|
while (1) switch (_context.n) {
|
|
12721
12756
|
case 0:
|
|
12722
|
-
api = options.api, senderAddress = options.senderAddress, version = options.version;
|
|
12723
12757
|
_context.n = 1;
|
|
12724
12758
|
return createTypeAndThenCallContext(chain, options, overrideReserve);
|
|
12725
12759
|
case 1:
|
|
12726
12760
|
context = _context.v;
|
|
12727
|
-
|
|
12728
|
-
LOCATIONS = [RELAY_LOCATION, {
|
|
12729
|
-
parents: 2,
|
|
12730
|
-
interior: {
|
|
12731
|
-
X1: [{
|
|
12732
|
-
GlobalConsensus: {
|
|
12733
|
-
Kusama: null
|
|
12734
|
-
}
|
|
12735
|
-
}]
|
|
12736
|
-
}
|
|
12737
|
-
}, {
|
|
12738
|
-
parents: 2,
|
|
12739
|
-
interior: {
|
|
12740
|
-
X1: [{
|
|
12741
|
-
GlobalConsensus: {
|
|
12742
|
-
Polkadot: null
|
|
12743
|
-
}
|
|
12744
|
-
}]
|
|
12745
|
-
}
|
|
12746
|
-
}];
|
|
12747
|
-
isRelayAsset = LOCATIONS.some(function (loc) {
|
|
12748
|
-
return deepEqual(assetInfo.location, loc);
|
|
12749
|
-
});
|
|
12750
|
-
assetCount = isRelayAsset ? 1 : 2;
|
|
12751
|
-
customXcm = createCustomXcm(context, isRelayAsset, assetCount, true);
|
|
12752
|
-
refundInstruction = senderAddress ? createRefundInstruction(api, senderAddress, version, assetCount) : null;
|
|
12761
|
+
origin = context.origin, assetInfo = context.assetInfo;
|
|
12753
12762
|
_context.n = 2;
|
|
12754
|
-
return computeAllFees(context,
|
|
12763
|
+
return computeAllFees(context, function (amount, relative) {
|
|
12764
|
+
var overridenAmount = amount ? relative ? assetInfo.amount + parseUnits(amount, assetInfo.decimals) : parseUnits(amount, assetInfo.decimals) : assetInfo.amount;
|
|
12765
|
+
return Promise.resolve(origin.api.callTxMethod(constructTypeAndThenCall(_objectSpread2(_objectSpread2({}, context), {}, {
|
|
12766
|
+
assetInfo: _objectSpread2(_objectSpread2({}, assetInfo), {}, {
|
|
12767
|
+
amount: overridenAmount
|
|
12768
|
+
})
|
|
12769
|
+
}))));
|
|
12770
|
+
});
|
|
12755
12771
|
case 2:
|
|
12756
12772
|
fees = _context.v;
|
|
12757
|
-
|
|
12758
|
-
if (refundInstruction && !isSubBridge) finalCustomXcm.push(refundInstruction);
|
|
12759
|
-
finalCustomXcm.push.apply(finalCustomXcm, _toConsumableArray(createCustomXcm(context, isRelayAsset, assetCount, false, fees)));
|
|
12760
|
-
totalFee = fees.reserveFee + fees.destFee + fees.refundFee;
|
|
12761
|
-
assets = buildAssets(chain, assetInfo, totalFee, isRelayAsset, version);
|
|
12762
|
-
return _context.a(2, buildTypeAndThenCall(context, isRelayAsset, finalCustomXcm, assets));
|
|
12773
|
+
return _context.a(2, constructTypeAndThenCall(context, fees));
|
|
12763
12774
|
}
|
|
12764
12775
|
}, _callee);
|
|
12765
12776
|
}));
|
|
12766
12777
|
return function createTypeAndThenCall(_x, _x2, _x3) {
|
|
12778
|
+
return _ref2.apply(this, arguments);
|
|
12779
|
+
};
|
|
12780
|
+
}();
|
|
12781
|
+
|
|
12782
|
+
var createCallForReserve = /*#__PURE__*/function () {
|
|
12783
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, reserveChain, options) {
|
|
12784
|
+
var api, destination, address, senderAddress, currency, feeCurrency, serialized, tx, dryRunResult, success;
|
|
12785
|
+
return _regenerator().w(function (_context) {
|
|
12786
|
+
while (1) switch (_context.n) {
|
|
12787
|
+
case 0:
|
|
12788
|
+
api = options.api, destination = options.destination, address = options.address, senderAddress = options.senderAddress, currency = options.currency, feeCurrency = options.feeCurrency;
|
|
12789
|
+
_context.n = 1;
|
|
12790
|
+
return createTypeAndThenCall(chain, options, reserveChain);
|
|
12791
|
+
case 1:
|
|
12792
|
+
serialized = _context.v;
|
|
12793
|
+
assertAddressIsString(address);
|
|
12794
|
+
assertToIsString(destination, 'Location destination is not supported for reserve auto-selection.');
|
|
12795
|
+
assertSenderAddress(senderAddress);
|
|
12796
|
+
tx = api.callTxMethod(serialized);
|
|
12797
|
+
_context.n = 2;
|
|
12798
|
+
return dryRunInternal({
|
|
12799
|
+
api: api,
|
|
12800
|
+
tx: tx,
|
|
12801
|
+
origin: chain,
|
|
12802
|
+
destination: destination,
|
|
12803
|
+
address: address,
|
|
12804
|
+
senderAddress: senderAddress,
|
|
12805
|
+
currency: currency,
|
|
12806
|
+
feeAsset: feeCurrency,
|
|
12807
|
+
useRootOrigin: true
|
|
12808
|
+
});
|
|
12809
|
+
case 2:
|
|
12810
|
+
dryRunResult = _context.v;
|
|
12811
|
+
success = !dryRunResult.failureReason;
|
|
12812
|
+
return _context.a(2, {
|
|
12813
|
+
call: serialized,
|
|
12814
|
+
success: success
|
|
12815
|
+
});
|
|
12816
|
+
}
|
|
12817
|
+
}, _callee);
|
|
12818
|
+
}));
|
|
12819
|
+
return function createCallForReserve(_x, _x2, _x3) {
|
|
12767
12820
|
return _ref.apply(this, arguments);
|
|
12768
12821
|
};
|
|
12769
12822
|
}();
|
|
12823
|
+
/**
|
|
12824
|
+
* Creates a type-and-then call but auto-selects the asset reserve between AssetHub and the Relay chain
|
|
12825
|
+
* by dry-running both variants and preferring the one that succeeds. If both fail, returns the
|
|
12826
|
+
* AssetHub variant. Supports only relaychain assets.
|
|
12827
|
+
*/
|
|
12828
|
+
var createTypeThenAutoReserve = /*#__PURE__*/function () {
|
|
12829
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(chain, options) {
|
|
12830
|
+
var originSupports, destSupports, relay, assetHubReserve, ahResult, relayResult;
|
|
12831
|
+
return _regenerator().w(function (_context2) {
|
|
12832
|
+
while (1) switch (_context2.n) {
|
|
12833
|
+
case 0:
|
|
12834
|
+
// Use dry-run path only when BOTH origin and destination support it
|
|
12835
|
+
originSupports = hasDryRunSupport(chain);
|
|
12836
|
+
destSupports = options.destChain ? hasDryRunSupport(options.destChain) : false;
|
|
12837
|
+
if (originSupports && destSupports) {
|
|
12838
|
+
_context2.n = 2;
|
|
12839
|
+
break;
|
|
12840
|
+
}
|
|
12841
|
+
_context2.n = 1;
|
|
12842
|
+
return createTypeAndThenCall(chain, options);
|
|
12843
|
+
case 1:
|
|
12844
|
+
return _context2.a(2, _context2.v);
|
|
12845
|
+
case 2:
|
|
12846
|
+
relay = getRelayChainOf(chain);
|
|
12847
|
+
assetHubReserve = "AssetHub".concat(relay);
|
|
12848
|
+
_context2.n = 3;
|
|
12849
|
+
return createCallForReserve(chain, assetHubReserve, options);
|
|
12850
|
+
case 3:
|
|
12851
|
+
ahResult = _context2.v;
|
|
12852
|
+
if (!ahResult.success) {
|
|
12853
|
+
_context2.n = 4;
|
|
12854
|
+
break;
|
|
12855
|
+
}
|
|
12856
|
+
return _context2.a(2, ahResult.call);
|
|
12857
|
+
case 4:
|
|
12858
|
+
_context2.n = 5;
|
|
12859
|
+
return createCallForReserve(chain, relay, options);
|
|
12860
|
+
case 5:
|
|
12861
|
+
relayResult = _context2.v;
|
|
12862
|
+
if (!relayResult.success) {
|
|
12863
|
+
_context2.n = 6;
|
|
12864
|
+
break;
|
|
12865
|
+
}
|
|
12866
|
+
return _context2.a(2, relayResult.call);
|
|
12867
|
+
case 6:
|
|
12868
|
+
return _context2.a(2, ahResult.call);
|
|
12869
|
+
}
|
|
12870
|
+
}, _callee2);
|
|
12871
|
+
}));
|
|
12872
|
+
return function createTypeThenAutoReserve(_x4, _x5) {
|
|
12873
|
+
return _ref2.apply(this, arguments);
|
|
12874
|
+
};
|
|
12875
|
+
}();
|
|
12770
12876
|
|
|
12771
12877
|
var calculateTotalXcmFee = function calculateTotalXcmFee(feeResult) {
|
|
12772
12878
|
var _feeResult$assetHub;
|
|
@@ -12827,7 +12933,7 @@ var verifyEdOnDestinationInternal = /*#__PURE__*/function () {
|
|
|
12827
12933
|
case 5:
|
|
12828
12934
|
balance = _context.v;
|
|
12829
12935
|
_context.n = 6;
|
|
12830
|
-
return
|
|
12936
|
+
return getXcmFeeInternal({
|
|
12831
12937
|
api: api,
|
|
12832
12938
|
buildTx: buildTx,
|
|
12833
12939
|
origin: origin,
|
|
@@ -13571,7 +13677,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13571
13677
|
var _options$disableFallb;
|
|
13572
13678
|
var disableFallback, _yield$this$prepareNo2, normalizedOptions, buildTx, api, from, to, senderAddress, address, currency, feeAsset;
|
|
13573
13679
|
return _regenerator().w(function (_context8) {
|
|
13574
|
-
while (1) switch (_context8.
|
|
13680
|
+
while (1) switch (_context8.n) {
|
|
13575
13681
|
case 0:
|
|
13576
13682
|
disableFallback = (_options$disableFallb = options === null || options === void 0 ? void 0 : options.disableFallback) !== null && _options$disableFallb !== void 0 ? _options$disableFallb : false;
|
|
13577
13683
|
_context8.n = 1;
|
|
@@ -13583,9 +13689,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13583
13689
|
api = normalizedOptions.api, from = normalizedOptions.from, to = normalizedOptions.to, senderAddress = normalizedOptions.senderAddress, address = normalizedOptions.address, currency = normalizedOptions.currency, feeAsset = normalizedOptions.feeAsset;
|
|
13584
13690
|
assertToIsString(to);
|
|
13585
13691
|
assertAddressIsString(address);
|
|
13586
|
-
_context8.
|
|
13587
|
-
_context8.n = 3;
|
|
13588
|
-
return getXcmFee({
|
|
13692
|
+
return _context8.a(2, getXcmFee({
|
|
13589
13693
|
api: api,
|
|
13590
13694
|
buildTx: buildTx,
|
|
13591
13695
|
origin: from,
|
|
@@ -13595,19 +13699,9 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
13595
13699
|
currency: currency,
|
|
13596
13700
|
feeAsset: feeAsset,
|
|
13597
13701
|
disableFallback: disableFallback
|
|
13598
|
-
});
|
|
13599
|
-
case 3:
|
|
13600
|
-
return _context8.a(2, _context8.v);
|
|
13601
|
-
case 4:
|
|
13602
|
-
_context8.p = 4;
|
|
13603
|
-
_context8.n = 5;
|
|
13604
|
-
return this.api.disconnect();
|
|
13605
|
-
case 5:
|
|
13606
|
-
return _context8.f(4);
|
|
13607
|
-
case 6:
|
|
13608
|
-
return _context8.a(2);
|
|
13702
|
+
}));
|
|
13609
13703
|
}
|
|
13610
|
-
}, _callee8, this
|
|
13704
|
+
}, _callee8, this);
|
|
13611
13705
|
}));
|
|
13612
13706
|
function getXcmFee$1(_x7) {
|
|
13613
13707
|
return _getXcmFee2.apply(this, arguments);
|
|
@@ -14022,4 +14116,4 @@ var Builder = function Builder(api) {
|
|
|
14022
14116
|
return new GeneralBuilder(api, new BatchTransactionManager());
|
|
14023
14117
|
};
|
|
14024
14118
|
|
|
14025
|
-
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, PolkadotXcmExecutionError, 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, createTx, createTypeAndThenCall, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, formatUnits, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getFailureInfo$1 as getFailureInfo, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, overrideTxAmount, padFee, padValueBy, parseUnits, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, verifyEdOnDestination, wrapTxBypass };
|
|
14119
|
+
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, PolkadotXcmExecutionError, 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, constructTypeAndThenCall, convertSs58, createAsset, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createChainClient, createDirectExecuteXcm, createExecuteCall, createExecuteExchangeXcm, createTx, createTypeAndThenCall, createTypeThenAutoReserve, createVersionedAssets, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, formatUnits, getAssetBalance, getAssetBalanceInternal, getAssetReserveChain, getBalanceForeign, getBalanceForeignInternal, getBalanceNative, getBalanceNativeInternal, getBridgeStatus, getChain, getChainConfig, getChainLocation, getChainProviders, getChainVersion, getCurrencySelection, getFailureInfo$1 as getFailureInfo, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginFeeDetails, getOriginFeeDetailsInternal, getOriginXcmFee, getOriginXcmFeeEstimate, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getRelayChainOf, getTChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeEstimate, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, handleToAhTeleport, isConfig, localizeLocation, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, overrideTxAmount, padFee, padValueBy, parseUnits, resolveDestChain, resolveModuleError, resolveParaId, reverseTransformLocation, send, sortAssets, transferMoonbeamEvm, transferMoonbeamToEth, transferRelayToPara, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, verifyEdOnDestination, wrapTxBypass };
|