@paraspell/sdk-core 11.8.4 → 11.8.6
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 +690 -318
- package/dist/index.d.ts +40 -8
- package/dist/index.mjs +692 -321
- package/package.json +11 -11
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { blake2b } from '@noble/hashes/blake2';
|
|
2
|
-
import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, findAssetInfoOrThrow, getNativeAssetSymbol, getOtherAssets, isAssetEqual, findAssetInfo, isTAsset,
|
|
2
|
+
import { isChainEvm, getAssetsObject, InvalidCurrencyError, isForeignAsset, extractAssetLocation, findAssetInfoOrThrow, getNativeAssetSymbol, getOtherAssets, isAssetEqual, findNativeAssetInfoOrThrow, findAssetInfo, isTAsset, getExistentialDepositOrThrow, isSymbolMatch, hasDryRunSupport, isOverrideLocationSpecifier, findAssetInfoByLoc, findAssetOnDestOrThrow, Native, hasXcmPaymentApiSupport, getRelayChainSymbol, getExistentialDeposit, 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';
|
|
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, PARACHAINS, deepEqual, isTrustedChain, isExternalChain, isDotKsmBridge } from '@paraspell/sdk-common';
|
|
8
|
+
import { replaceBigInt, isTLocation, Version, hasJunction, getJunctionValue, isRelayChain, Parents, PARACHAINS, deepEqual, isTrustedChain, isExternalChain, isDotKsmBridge, isSystemChain } from '@paraspell/sdk-common';
|
|
9
9
|
export * from '@paraspell/sdk-common';
|
|
10
10
|
import { moonbeam, moonriver, mainnet } from 'viem/chains';
|
|
11
11
|
|
|
@@ -772,6 +772,20 @@ var createVersionedAssets = function createVersionedAssets(version, amount, loca
|
|
|
772
772
|
return addXcmVersionHeader([asset], version);
|
|
773
773
|
};
|
|
774
774
|
|
|
775
|
+
var getCurrencySelection = function getCurrencySelection(asset) {
|
|
776
|
+
if (asset.location) return {
|
|
777
|
+
location: asset.location
|
|
778
|
+
};
|
|
779
|
+
if (isForeignAsset(asset) && asset.assetId) {
|
|
780
|
+
return {
|
|
781
|
+
id: asset.assetId
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
return {
|
|
785
|
+
symbol: asset.symbol
|
|
786
|
+
};
|
|
787
|
+
};
|
|
788
|
+
|
|
775
789
|
var maybeOverrideAssets = function maybeOverrideAssets(version, amount, assets, overriddenCurrency) {
|
|
776
790
|
if (!overriddenCurrency) {
|
|
777
791
|
return assets;
|
|
@@ -909,7 +923,7 @@ var getRelayChainOf = function getRelayChainOf(chain) {
|
|
|
909
923
|
};
|
|
910
924
|
|
|
911
925
|
var AssetHubPolkadot$1 = {
|
|
912
|
-
name: "
|
|
926
|
+
name: "Asset Hub",
|
|
913
927
|
info: "PolkadotAssetHub",
|
|
914
928
|
paraId: 1000,
|
|
915
929
|
providers: [
|
|
@@ -1010,10 +1024,6 @@ var Astar$1 = {
|
|
|
1010
1024
|
name: "Astar",
|
|
1011
1025
|
endpoint: "wss://rpc.astar.network"
|
|
1012
1026
|
},
|
|
1013
|
-
{
|
|
1014
|
-
name: "Automata 1RPC",
|
|
1015
|
-
endpoint: "wss://1rpc.io/astr"
|
|
1016
|
-
},
|
|
1017
1027
|
{
|
|
1018
1028
|
name: "Blast",
|
|
1019
1029
|
endpoint: "wss://astar.public.blastapi.io"
|
|
@@ -1052,15 +1062,11 @@ var BifrostPolkadot$1 = {
|
|
|
1052
1062
|
{
|
|
1053
1063
|
name: "LiebiEU",
|
|
1054
1064
|
endpoint: "wss://eu.bifrost-polkadot-rpc.liebi.com/ws"
|
|
1055
|
-
},
|
|
1056
|
-
{
|
|
1057
|
-
name: "RadiumBlock",
|
|
1058
|
-
endpoint: "wss://bifrost.public.curie.radiumblock.co/ws"
|
|
1059
1065
|
}
|
|
1060
1066
|
]
|
|
1061
1067
|
};
|
|
1062
1068
|
var BridgeHubPolkadot$1 = {
|
|
1063
|
-
name: "
|
|
1069
|
+
name: "Bridge Hub",
|
|
1064
1070
|
info: "polkadotBridgeHub",
|
|
1065
1071
|
paraId: 1002,
|
|
1066
1072
|
providers: [
|
|
@@ -1209,16 +1215,16 @@ var Interlay$1 = {
|
|
|
1209
1215
|
};
|
|
1210
1216
|
var Heima$1 = {
|
|
1211
1217
|
name: "Heima",
|
|
1212
|
-
info: "
|
|
1218
|
+
info: "heima",
|
|
1213
1219
|
paraId: 2013,
|
|
1214
1220
|
providers: [
|
|
1215
1221
|
{
|
|
1216
1222
|
name: "Dwellir",
|
|
1217
|
-
endpoint: "wss://
|
|
1223
|
+
endpoint: "wss://heima-rpc.n.dwellir.com"
|
|
1218
1224
|
},
|
|
1219
1225
|
{
|
|
1220
|
-
name: "
|
|
1221
|
-
endpoint: "wss://rpc.
|
|
1226
|
+
name: "Heima",
|
|
1227
|
+
endpoint: "wss://rpc.heima-parachain.heima.network"
|
|
1222
1228
|
}
|
|
1223
1229
|
]
|
|
1224
1230
|
};
|
|
@@ -1643,7 +1649,7 @@ var Xode$1 = {
|
|
|
1643
1649
|
]
|
|
1644
1650
|
};
|
|
1645
1651
|
var AssetHubKusama$1 = {
|
|
1646
|
-
name: "
|
|
1652
|
+
name: "Asset Hub",
|
|
1647
1653
|
info: "KusamaAssetHub",
|
|
1648
1654
|
paraId: 1000,
|
|
1649
1655
|
providers: [
|
|
@@ -1686,7 +1692,7 @@ var AssetHubKusama$1 = {
|
|
|
1686
1692
|
]
|
|
1687
1693
|
};
|
|
1688
1694
|
var BridgeHubKusama$1 = {
|
|
1689
|
-
name: "
|
|
1695
|
+
name: "Bridge Hub",
|
|
1690
1696
|
info: "kusamaBridgeHub",
|
|
1691
1697
|
paraId: 1002,
|
|
1692
1698
|
providers: [
|
|
@@ -1988,10 +1994,6 @@ var Quartz$1 = {
|
|
|
1988
1994
|
name: "Geo Load Balancer",
|
|
1989
1995
|
endpoint: "wss://ws-quartz.unique.network"
|
|
1990
1996
|
},
|
|
1991
|
-
{
|
|
1992
|
-
name: "Unique Asia",
|
|
1993
|
-
endpoint: "wss://asia-ws-quartz.unique.network"
|
|
1994
|
-
},
|
|
1995
1997
|
{
|
|
1996
1998
|
name: "Unique Europe",
|
|
1997
1999
|
endpoint: "wss://eu-ws-quartz.unique.network"
|
|
@@ -2083,7 +2085,7 @@ var Zeitgeist$1 = {
|
|
|
2083
2085
|
]
|
|
2084
2086
|
};
|
|
2085
2087
|
var AssetHubWestend$1 = {
|
|
2086
|
-
name: "
|
|
2088
|
+
name: "Asset Hub",
|
|
2087
2089
|
info: "WestendAssetHub",
|
|
2088
2090
|
paraId: 1000,
|
|
2089
2091
|
providers: [
|
|
@@ -2106,7 +2108,7 @@ var AssetHubWestend$1 = {
|
|
|
2106
2108
|
]
|
|
2107
2109
|
};
|
|
2108
2110
|
var BridgeHubWestend$1 = {
|
|
2109
|
-
name: "
|
|
2111
|
+
name: "Bridge Hub",
|
|
2110
2112
|
info: "westendBridgeHub",
|
|
2111
2113
|
paraId: 1002,
|
|
2112
2114
|
providers: [
|
|
@@ -2196,7 +2198,7 @@ var AjunaPaseo$1 = {
|
|
|
2196
2198
|
]
|
|
2197
2199
|
};
|
|
2198
2200
|
var AssetHubPaseo$1 = {
|
|
2199
|
-
name: "
|
|
2201
|
+
name: "Asset Hub",
|
|
2200
2202
|
info: "PaseoAssetHub",
|
|
2201
2203
|
paraId: 1000,
|
|
2202
2204
|
providers: [
|
|
@@ -2234,7 +2236,7 @@ var BifrostPaseo$1 = {
|
|
|
2234
2236
|
]
|
|
2235
2237
|
};
|
|
2236
2238
|
var BridgeHubPaseo$1 = {
|
|
2237
|
-
name: "
|
|
2239
|
+
name: "Bridge Hub",
|
|
2238
2240
|
info: "PaseoBridgeHub",
|
|
2239
2241
|
paraId: 1002,
|
|
2240
2242
|
providers: [
|
|
@@ -2401,7 +2403,7 @@ var ZeitgeistPaseo$1 = {
|
|
|
2401
2403
|
]
|
|
2402
2404
|
};
|
|
2403
2405
|
var Polkadot = {
|
|
2404
|
-
name: "Polkadot",
|
|
2406
|
+
name: "Polkadot Relay",
|
|
2405
2407
|
info: "polkadot",
|
|
2406
2408
|
paraId: 0,
|
|
2407
2409
|
providers: [
|
|
@@ -2464,7 +2466,7 @@ var Polkadot = {
|
|
|
2464
2466
|
]
|
|
2465
2467
|
};
|
|
2466
2468
|
var Kusama = {
|
|
2467
|
-
name: "Kusama",
|
|
2469
|
+
name: "Kusama Relay",
|
|
2468
2470
|
info: "kusama",
|
|
2469
2471
|
paraId: 0,
|
|
2470
2472
|
providers: [
|
|
@@ -2515,7 +2517,7 @@ var Kusama = {
|
|
|
2515
2517
|
]
|
|
2516
2518
|
};
|
|
2517
2519
|
var Westend = {
|
|
2518
|
-
name: "Westend",
|
|
2520
|
+
name: "Westend Relay",
|
|
2519
2521
|
info: "westend",
|
|
2520
2522
|
paraId: 0,
|
|
2521
2523
|
providers: [
|
|
@@ -2542,7 +2544,7 @@ var Westend = {
|
|
|
2542
2544
|
]
|
|
2543
2545
|
};
|
|
2544
2546
|
var Paseo = {
|
|
2545
|
-
name: "Paseo",
|
|
2547
|
+
name: "Paseo Relay",
|
|
2546
2548
|
info: "paseo",
|
|
2547
2549
|
paraId: 0,
|
|
2548
2550
|
providers: [
|
|
@@ -3292,6 +3294,7 @@ var getAssetReserveChain = function getAssetReserveChain(chain, destChain, asset
|
|
|
3292
3294
|
Here: null
|
|
3293
3295
|
}
|
|
3294
3296
|
})) {
|
|
3297
|
+
if (relaychain === 'Paseo') return ahChain;
|
|
3295
3298
|
return CHAINS_DOT_RESERVE_AH.has(destChain) ? ahChain : relaychain;
|
|
3296
3299
|
}
|
|
3297
3300
|
return chain;
|
|
@@ -3696,6 +3699,44 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
3696
3699
|
};
|
|
3697
3700
|
}();
|
|
3698
3701
|
|
|
3702
|
+
var getMythosOriginFee = /*#__PURE__*/function () {
|
|
3703
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api) {
|
|
3704
|
+
var ahApi, _yield$getParaEthTran, _yield$getParaEthTran2, bridgeFee, ahExecutionFee, nativeAsset, feeConverted;
|
|
3705
|
+
return _regenerator().w(function (_context) {
|
|
3706
|
+
while (1) switch (_context.n) {
|
|
3707
|
+
case 0:
|
|
3708
|
+
ahApi = api.clone();
|
|
3709
|
+
_context.n = 1;
|
|
3710
|
+
return ahApi.init('AssetHubPolkadot');
|
|
3711
|
+
case 1:
|
|
3712
|
+
_context.n = 2;
|
|
3713
|
+
return getParaEthTransferFees(ahApi);
|
|
3714
|
+
case 2:
|
|
3715
|
+
_yield$getParaEthTran = _context.v;
|
|
3716
|
+
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
3717
|
+
bridgeFee = _yield$getParaEthTran2[0];
|
|
3718
|
+
ahExecutionFee = _yield$getParaEthTran2[1];
|
|
3719
|
+
nativeAsset = findNativeAssetInfoOrThrow('Mythos');
|
|
3720
|
+
assertHasLocation(nativeAsset);
|
|
3721
|
+
_context.n = 3;
|
|
3722
|
+
return ahApi.quoteAhPrice(DOT_LOCATION, nativeAsset.location, bridgeFee + ahExecutionFee);
|
|
3723
|
+
case 3:
|
|
3724
|
+
feeConverted = _context.v;
|
|
3725
|
+
if (feeConverted) {
|
|
3726
|
+
_context.n = 4;
|
|
3727
|
+
break;
|
|
3728
|
+
}
|
|
3729
|
+
throw new InvalidParameterError("Pool DOT -> ".concat(nativeAsset.symbol, " not found."));
|
|
3730
|
+
case 4:
|
|
3731
|
+
return _context.a(2, padFeeBy(feeConverted, 10));
|
|
3732
|
+
}
|
|
3733
|
+
}, _callee);
|
|
3734
|
+
}));
|
|
3735
|
+
return function getMythosOriginFee(_x) {
|
|
3736
|
+
return _ref.apply(this, arguments);
|
|
3737
|
+
};
|
|
3738
|
+
}();
|
|
3739
|
+
|
|
3699
3740
|
var resolveFeeAsset = function resolveFeeAsset(feeAsset, origin, destination, currency) {
|
|
3700
3741
|
var asset = findAssetInfo(origin, feeAsset, !isTLocation(destination) ? destination : null);
|
|
3701
3742
|
var usesRawOverriddenMultiAssets = Array.isArray(currency) && currency.every(isTAsset);
|
|
@@ -3737,49 +3778,6 @@ var getReverseTxFee = /*#__PURE__*/function () {
|
|
|
3737
3778
|
};
|
|
3738
3779
|
}();
|
|
3739
3780
|
|
|
3740
|
-
var AssetsPallet = /*#__PURE__*/function () {
|
|
3741
|
-
function AssetsPallet() {
|
|
3742
|
-
_classCallCheck(this, AssetsPallet);
|
|
3743
|
-
}
|
|
3744
|
-
return _createClass(AssetsPallet, [{
|
|
3745
|
-
key: "mint",
|
|
3746
|
-
value: function mint(address, asset, _balance, chain) {
|
|
3747
|
-
assertHasId(asset);
|
|
3748
|
-
var assetId = asset.assetId,
|
|
3749
|
-
amount = asset.amount;
|
|
3750
|
-
var id = chain === 'Astar' || chain === 'Shiden' || chain === 'Moonbeam' ? BigInt(assetId) : Number(assetId);
|
|
3751
|
-
var addr = isChainEvm(chain) ? address : {
|
|
3752
|
-
Id: address
|
|
3753
|
-
};
|
|
3754
|
-
return Promise.resolve({
|
|
3755
|
-
assetStatusTx: {
|
|
3756
|
-
module: 'Assets',
|
|
3757
|
-
method: 'force_asset_status',
|
|
3758
|
-
parameters: {
|
|
3759
|
-
id: id,
|
|
3760
|
-
owner: addr,
|
|
3761
|
-
issuer: addr,
|
|
3762
|
-
admin: addr,
|
|
3763
|
-
freezer: addr,
|
|
3764
|
-
min_balance: 0n,
|
|
3765
|
-
is_sufficient: true,
|
|
3766
|
-
is_frozen: false
|
|
3767
|
-
}
|
|
3768
|
-
},
|
|
3769
|
-
balanceTx: {
|
|
3770
|
-
module: 'Assets',
|
|
3771
|
-
method: 'mint',
|
|
3772
|
-
parameters: {
|
|
3773
|
-
id: id,
|
|
3774
|
-
beneficiary: addr,
|
|
3775
|
-
amount: amount
|
|
3776
|
-
}
|
|
3777
|
-
}
|
|
3778
|
-
});
|
|
3779
|
-
}
|
|
3780
|
-
}]);
|
|
3781
|
-
}();
|
|
3782
|
-
|
|
3783
3781
|
// Inspired by Moonbeam XCM-SDK
|
|
3784
3782
|
// https://github.com/moonbeam-foundation/xcm-sdk/blob/ab835c15bf41612604b1c858d956a9f07705ed65/packages/utils/src/format/asset.ts#L1
|
|
3785
3783
|
var formatAssetIdToERC20 = function formatAssetIdToERC20(id) {
|
|
@@ -3860,7 +3858,7 @@ var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
|
|
|
3860
3858
|
assertHasLocation(asset);
|
|
3861
3859
|
return _context.a(2, api.getBalanceForeignAssetsPallet(address, asset.location));
|
|
3862
3860
|
case 3:
|
|
3863
|
-
if (!(
|
|
3861
|
+
if (!chain.startsWith('AssetHub')) {
|
|
3864
3862
|
_context.n = 5;
|
|
3865
3863
|
break;
|
|
3866
3864
|
}
|
|
@@ -3874,7 +3872,7 @@ var getBalanceForeignPolkadotXcm = /*#__PURE__*/function () {
|
|
|
3874
3872
|
case 4:
|
|
3875
3873
|
return _context.a(2, api.getBalanceForeignAssetsPallet(address, asset.location));
|
|
3876
3874
|
case 5:
|
|
3877
|
-
return _context.a(2, api.getBalanceForeignPolkadotXcm(address, asset
|
|
3875
|
+
return _context.a(2, api.getBalanceForeignPolkadotXcm(chain, address, asset));
|
|
3878
3876
|
}
|
|
3879
3877
|
}, _callee);
|
|
3880
3878
|
}));
|
|
@@ -4202,77 +4200,6 @@ var getAssetBalance = /*#__PURE__*/function () {
|
|
|
4202
4200
|
};
|
|
4203
4201
|
}();
|
|
4204
4202
|
|
|
4205
|
-
var getOriginFeeDetailsInternal = /*#__PURE__*/function () {
|
|
4206
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
4207
|
-
var _getExistentialDeposi;
|
|
4208
|
-
var api, account, accountDestination, ahAddress, currency, origin, destination, _ref$feeMarginPercent, feeMarginPercentage, tx, xcmFee, xcmFeeWithMargin, nativeBalance, existentialDeposit, sufficientForXCM;
|
|
4209
|
-
return _regenerator().w(function (_context) {
|
|
4210
|
-
while (1) switch (_context.n) {
|
|
4211
|
-
case 0:
|
|
4212
|
-
api = _ref.api, account = _ref.account, accountDestination = _ref.accountDestination, ahAddress = _ref.ahAddress, currency = _ref.currency, origin = _ref.origin, destination = _ref.destination, _ref$feeMarginPercent = _ref.feeMarginPercentage, feeMarginPercentage = _ref$feeMarginPercent === void 0 ? 10 : _ref$feeMarginPercent;
|
|
4213
|
-
_context.n = 1;
|
|
4214
|
-
return api.init(origin);
|
|
4215
|
-
case 1:
|
|
4216
|
-
_context.n = 2;
|
|
4217
|
-
return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination).senderAddress(account).ahAddress(ahAddress)['buildInternal']();
|
|
4218
|
-
case 2:
|
|
4219
|
-
tx = _context.v;
|
|
4220
|
-
_context.n = 3;
|
|
4221
|
-
return api.calculateTransactionFee(tx, account);
|
|
4222
|
-
case 3:
|
|
4223
|
-
xcmFee = _context.v;
|
|
4224
|
-
xcmFeeWithMargin = xcmFee + xcmFee / BigInt(feeMarginPercentage);
|
|
4225
|
-
_context.n = 4;
|
|
4226
|
-
return getBalanceNativeInternal({
|
|
4227
|
-
address: account,
|
|
4228
|
-
chain: origin,
|
|
4229
|
-
api: api
|
|
4230
|
-
});
|
|
4231
|
-
case 4:
|
|
4232
|
-
nativeBalance = _context.v;
|
|
4233
|
-
existentialDeposit = BigInt((_getExistentialDeposi = getExistentialDeposit(origin)) !== null && _getExistentialDeposi !== void 0 ? _getExistentialDeposi : '0');
|
|
4234
|
-
sufficientForXCM = nativeBalance - existentialDeposit - xcmFeeWithMargin > 0;
|
|
4235
|
-
return _context.a(2, {
|
|
4236
|
-
sufficientForXCM: sufficientForXCM,
|
|
4237
|
-
xcmFee: xcmFee
|
|
4238
|
-
});
|
|
4239
|
-
}
|
|
4240
|
-
}, _callee);
|
|
4241
|
-
}));
|
|
4242
|
-
return function getOriginFeeDetailsInternal(_x) {
|
|
4243
|
-
return _ref2.apply(this, arguments);
|
|
4244
|
-
};
|
|
4245
|
-
}();
|
|
4246
|
-
var getOriginFeeDetails = /*#__PURE__*/function () {
|
|
4247
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
4248
|
-
var api;
|
|
4249
|
-
return _regenerator().w(function (_context2) {
|
|
4250
|
-
while (1) switch (_context2.p = _context2.n) {
|
|
4251
|
-
case 0:
|
|
4252
|
-
api = options.api;
|
|
4253
|
-
api.setDisconnectAllowed(false);
|
|
4254
|
-
_context2.p = 1;
|
|
4255
|
-
_context2.n = 2;
|
|
4256
|
-
return getOriginFeeDetailsInternal(options);
|
|
4257
|
-
case 2:
|
|
4258
|
-
return _context2.a(2, _context2.v);
|
|
4259
|
-
case 3:
|
|
4260
|
-
_context2.p = 3;
|
|
4261
|
-
api.setDisconnectAllowed(true);
|
|
4262
|
-
_context2.n = 4;
|
|
4263
|
-
return api.disconnect();
|
|
4264
|
-
case 4:
|
|
4265
|
-
return _context2.f(3);
|
|
4266
|
-
case 5:
|
|
4267
|
-
return _context2.a(2);
|
|
4268
|
-
}
|
|
4269
|
-
}, _callee2, null, [[1,, 3, 5]]);
|
|
4270
|
-
}));
|
|
4271
|
-
return function getOriginFeeDetails(_x2) {
|
|
4272
|
-
return _ref3.apply(this, arguments);
|
|
4273
|
-
};
|
|
4274
|
-
}();
|
|
4275
|
-
|
|
4276
4203
|
var isSufficientOrigin = /*#__PURE__*/function () {
|
|
4277
4204
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, origin, destination, senderAddress, feeNative, currency, asset, feeAsset) {
|
|
4278
4205
|
var edNative, balanceNative, isNativeAssetToOrigin, isNativeAssetToDest, isSufficientNative, balanceAsset, edAsset, isSufficientAsset;
|
|
@@ -4460,7 +4387,7 @@ var getDestXcmFee = /*#__PURE__*/function () {
|
|
|
4460
4387
|
_context2.n = 5;
|
|
4461
4388
|
break;
|
|
4462
4389
|
}
|
|
4463
|
-
|
|
4390
|
+
return _context2.a(2, 0n);
|
|
4464
4391
|
case 5:
|
|
4465
4392
|
_context2.n = 6;
|
|
4466
4393
|
return attempt(swapConfig.exchangeChain, swapConfig.currencyTo, swapConfig.amountOut);
|
|
@@ -5309,7 +5236,7 @@ var getFailureInfo$1 = function getFailureInfo(results, hops) {
|
|
|
5309
5236
|
var dryRunInternal = /*#__PURE__*/function () {
|
|
5310
5237
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
5311
5238
|
var _traversalResult$brid;
|
|
5312
|
-
var api, origin, destination, currency, tx, senderAddress, feeAsset, swapConfig, bypassOptions, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, asset, amount, originDryRun, initialForwardedXcms, initialDestParaId, processHop, traversalResult, assetHubChain, bridgeHubChain, processedBridgeHub, bridgeHubHopIndex, bridgeHubWithCurrency, _getFailureInfo, failureReason, failureChain, _t;
|
|
5239
|
+
var api, origin, destination, currency, tx, senderAddress, feeAsset, swapConfig, bypassOptions, _options$useRootOrigi, useRootOrigin, resolvedFeeAsset, asset, amount, originDryRun, isMythosToEthereum, originDryModified, initialForwardedXcms, initialDestParaId, processHop, traversalResult, assetHubChain, bridgeHubChain, processedBridgeHub, bridgeHubHopIndex, bridgeHubWithCurrency, _getFailureInfo, failureReason, failureChain, _t, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9;
|
|
5313
5240
|
return _regenerator().w(function (_context2) {
|
|
5314
5241
|
while (1) switch (_context2.n) {
|
|
5315
5242
|
case 0:
|
|
@@ -5343,7 +5270,30 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5343
5270
|
hops: []
|
|
5344
5271
|
});
|
|
5345
5272
|
case 2:
|
|
5346
|
-
|
|
5273
|
+
isMythosToEthereum = origin === 'Mythos' && destination === 'Ethereum';
|
|
5274
|
+
if (!isMythosToEthereum) {
|
|
5275
|
+
_context2.n = 4;
|
|
5276
|
+
break;
|
|
5277
|
+
}
|
|
5278
|
+
_t2 = _objectSpread2;
|
|
5279
|
+
_t3 = _objectSpread2({}, originDryRun);
|
|
5280
|
+
_t4 = {};
|
|
5281
|
+
_t5 = originDryRun.fee;
|
|
5282
|
+
_context2.n = 3;
|
|
5283
|
+
return getMythosOriginFee(api);
|
|
5284
|
+
case 3:
|
|
5285
|
+
_t6 = _context2.v;
|
|
5286
|
+
_t7 = _t5 + _t6;
|
|
5287
|
+
_t = _t2(_t3, _t4, {
|
|
5288
|
+
fee: _t7
|
|
5289
|
+
});
|
|
5290
|
+
_context2.n = 5;
|
|
5291
|
+
break;
|
|
5292
|
+
case 4:
|
|
5293
|
+
_t = originDryRun;
|
|
5294
|
+
case 5:
|
|
5295
|
+
originDryModified = _t;
|
|
5296
|
+
initialForwardedXcms = originDryModified.forwardedXcms, initialDestParaId = originDryModified.destParaId;
|
|
5347
5297
|
processHop = /*#__PURE__*/function () {
|
|
5348
5298
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
5349
5299
|
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, isDestination, hopAsset, hopDryRun;
|
|
@@ -5380,7 +5330,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5380
5330
|
origin: currentOrigin,
|
|
5381
5331
|
asset: hopAsset,
|
|
5382
5332
|
feeAsset: resolvedFeeAsset,
|
|
5383
|
-
originFee:
|
|
5333
|
+
originFee: originDryModified.fee,
|
|
5384
5334
|
amount: amount
|
|
5385
5335
|
});
|
|
5386
5336
|
case 2:
|
|
@@ -5396,7 +5346,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5396
5346
|
return _ref2.apply(this, arguments);
|
|
5397
5347
|
};
|
|
5398
5348
|
}();
|
|
5399
|
-
_context2.n =
|
|
5349
|
+
_context2.n = 6;
|
|
5400
5350
|
return traverseXcmHops({
|
|
5401
5351
|
api: api,
|
|
5402
5352
|
origin: origin,
|
|
@@ -5416,25 +5366,35 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5416
5366
|
};
|
|
5417
5367
|
}
|
|
5418
5368
|
});
|
|
5419
|
-
case
|
|
5369
|
+
case 6:
|
|
5420
5370
|
traversalResult = _context2.v;
|
|
5421
5371
|
// Process Ethereum bridge fees
|
|
5422
5372
|
assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
|
|
5423
|
-
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
5373
|
+
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin)); // For Mythos → Ethereum, we skip additional Ethereum bridge fees (aligns with getXcmFeeInternal)
|
|
5374
|
+
if (!isMythosToEthereum) {
|
|
5375
|
+
_context2.n = 7;
|
|
5376
|
+
break;
|
|
5377
|
+
}
|
|
5378
|
+
_t8 = traversalResult.bridgeHub;
|
|
5379
|
+
_context2.n = 11;
|
|
5380
|
+
break;
|
|
5381
|
+
case 7:
|
|
5424
5382
|
if (!((_traversalResult$brid = traversalResult.bridgeHub) !== null && _traversalResult$brid !== void 0 && _traversalResult$brid.success)) {
|
|
5425
|
-
_context2.n =
|
|
5383
|
+
_context2.n = 9;
|
|
5426
5384
|
break;
|
|
5427
5385
|
}
|
|
5428
|
-
_context2.n =
|
|
5386
|
+
_context2.n = 8;
|
|
5429
5387
|
return addEthereumBridgeFees(api, traversalResult.bridgeHub, destination, assetHubChain);
|
|
5430
|
-
case
|
|
5431
|
-
|
|
5432
|
-
_context2.n =
|
|
5388
|
+
case 8:
|
|
5389
|
+
_t9 = _context2.v;
|
|
5390
|
+
_context2.n = 10;
|
|
5433
5391
|
break;
|
|
5434
|
-
case
|
|
5435
|
-
|
|
5436
|
-
case
|
|
5437
|
-
|
|
5392
|
+
case 9:
|
|
5393
|
+
_t9 = traversalResult.bridgeHub;
|
|
5394
|
+
case 10:
|
|
5395
|
+
_t8 = _t9;
|
|
5396
|
+
case 11:
|
|
5397
|
+
processedBridgeHub = _t8;
|
|
5438
5398
|
// Update bridge hub in hops if needed
|
|
5439
5399
|
if (processedBridgeHub && processedBridgeHub.success && traversalResult.bridgeHub && traversalResult.bridgeHub.success && processedBridgeHub.fee !== traversalResult.bridgeHub.fee) {
|
|
5440
5400
|
bridgeHubHopIndex = traversalResult.hops.findIndex(function (hop) {
|
|
@@ -5458,7 +5418,7 @@ var dryRunInternal = /*#__PURE__*/function () {
|
|
|
5458
5418
|
return _context2.a(2, {
|
|
5459
5419
|
failureReason: failureReason,
|
|
5460
5420
|
failureChain: failureChain,
|
|
5461
|
-
origin:
|
|
5421
|
+
origin: originDryModified,
|
|
5462
5422
|
assetHub: traversalResult.assetHub,
|
|
5463
5423
|
bridgeHub: bridgeHubWithCurrency,
|
|
5464
5424
|
destination: traversalResult.destination,
|
|
@@ -5862,20 +5822,15 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
5862
5822
|
while (1) switch (_context.n) {
|
|
5863
5823
|
case 0:
|
|
5864
5824
|
api = input.api, destination = input.destination, address = input.address, senderAddress = input.senderAddress, asset = input.assetInfo, currency = input.currency;
|
|
5865
|
-
|
|
5866
|
-
_context.n = 1;
|
|
5867
|
-
break;
|
|
5868
|
-
}
|
|
5869
|
-
throw new InvalidParameterError('Location destination is not supported for this scenario');
|
|
5870
|
-
case 1:
|
|
5825
|
+
assertToIsString(destination, 'Location destination is not supported for AH teleport.');
|
|
5871
5826
|
if (!isTLocation(address)) {
|
|
5872
|
-
_context.n =
|
|
5827
|
+
_context.n = 1;
|
|
5873
5828
|
break;
|
|
5874
5829
|
}
|
|
5875
5830
|
throw new InvalidParameterError('Location address is not supported for this scenario');
|
|
5876
|
-
case
|
|
5831
|
+
case 1:
|
|
5877
5832
|
assertSenderAddress(senderAddress);
|
|
5878
|
-
_context.n =
|
|
5833
|
+
_context.n = 2;
|
|
5879
5834
|
return dryRunInternal({
|
|
5880
5835
|
api: api,
|
|
5881
5836
|
tx: defaultTx,
|
|
@@ -5885,19 +5840,19 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
5885
5840
|
address: address,
|
|
5886
5841
|
currency: currency
|
|
5887
5842
|
});
|
|
5888
|
-
case
|
|
5843
|
+
case 2:
|
|
5889
5844
|
dryRunResult = _context.v;
|
|
5890
5845
|
if (!((_dryRunResult$destina = dryRunResult.destination) !== null && _dryRunResult$destina !== void 0 && _dryRunResult$destina.success)) {
|
|
5891
|
-
_context.n =
|
|
5846
|
+
_context.n = 3;
|
|
5892
5847
|
break;
|
|
5893
5848
|
}
|
|
5894
5849
|
return _context.a(2, defaultTx);
|
|
5895
|
-
case
|
|
5850
|
+
case 3:
|
|
5896
5851
|
// If the default tx dry run failed, we need to create execute transaction
|
|
5897
5852
|
dummyTx = createExecuteExchangeXcm(input, origin, MAX_WEIGHT,
|
|
5898
5853
|
// Enter dummy fee values just to get the dry run to pass
|
|
5899
5854
|
asset.amount, asset.amount / 2n);
|
|
5900
|
-
_context.n =
|
|
5855
|
+
_context.n = 4;
|
|
5901
5856
|
return getXcmFeeInternal({
|
|
5902
5857
|
api: api,
|
|
5903
5858
|
tx: dummyTx,
|
|
@@ -5909,7 +5864,7 @@ var handleToAhTeleport = /*#__PURE__*/function () {
|
|
|
5909
5864
|
disableFallback: false,
|
|
5910
5865
|
useRootOrigin: true
|
|
5911
5866
|
});
|
|
5912
|
-
case
|
|
5867
|
+
case 4:
|
|
5913
5868
|
feeResult = _context.v;
|
|
5914
5869
|
originExecutionFee = padFeeBy(feeResult.origin.fee, 20); // Pad by 20%
|
|
5915
5870
|
destinationExecutionFee = padFeeBy(
|
|
@@ -6132,7 +6087,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6132
6087
|
key: "transfer",
|
|
6133
6088
|
value: function () {
|
|
6134
6089
|
var _transfer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(sendOptions) {
|
|
6135
|
-
var api, asset, currency, feeAsset, feeCurrency, address, destination, paraIdTo, overriddenAsset, version, senderAddress, ahAddress, pallet, method, scenario, paraId, destChain, isLocalTransfer, isRelayAsset, supportsTypeThen, useTypeAndThen, isBifrostOrigin, isJamtonOrigin, isAssetHubDest, useMultiAssets, input, options, shouldUseTeleport, isAhToOtherPara, isOtherParaToAh, isAllowedAhTransfer, isAHPOrigin, isAHPDest, isExternalAsset, isEthDest, isExternalAssetViaAh, isExternalAssetToAh, call;
|
|
6090
|
+
var api, asset, currency, feeAsset, feeCurrency, address, destination, paraIdTo, overriddenAsset, version, senderAddress, ahAddress, pallet, method, scenario, paraId, destChain, isLocalTransfer, isRelayAsset, supportsTypeThen, useTypeAndThen, isBifrostOrigin, isJamtonOrigin, isAssetHubDest, useMultiAssets, input, options, shouldUseTeleport, isAhToOtherPara, isOtherParaToAh, isAllowedAhTransfer, isAHPOrigin, isAHPDest, isExternalAsset, isEthDest, isExternalAssetViaAh, isExternalAssetToAh, call, _t;
|
|
6136
6091
|
return _regenerator().w(function (_context) {
|
|
6137
6092
|
while (1) switch (_context.n) {
|
|
6138
6093
|
case 0:
|
|
@@ -6155,7 +6110,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6155
6110
|
case 2:
|
|
6156
6111
|
this.throwIfTempDisabled(sendOptions, destChain);
|
|
6157
6112
|
this.throwIfCantReceive(destChain);
|
|
6158
|
-
isRelayAsset = deepEqual(asset.location, RELAY_LOCATION);
|
|
6113
|
+
isRelayAsset = deepEqual(asset.location, RELAY_LOCATION) && isSymbolMatch(getRelayChainSymbol(this.chain), asset.symbol);
|
|
6159
6114
|
_context.n = 3;
|
|
6160
6115
|
return api.hasMethod('PolkadotXcm', 'transfer_assets_using_type_and_then');
|
|
6161
6116
|
case 3:
|
|
@@ -6166,7 +6121,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6166
6121
|
}
|
|
6167
6122
|
throw new InvalidParameterError('Relaychain assets can only be transferred using the type-and-then method which is not supported by this chain');
|
|
6168
6123
|
case 4:
|
|
6169
|
-
useTypeAndThen = isRelayAsset && supportsTypeThen && destChain && (!isTrustedChain(this.chain) || !isTrustedChain(destChain));
|
|
6124
|
+
useTypeAndThen = isRelayAsset && supportsTypeThen && destChain && !feeAsset && (!isTrustedChain(this.chain) || !isTrustedChain(destChain));
|
|
6170
6125
|
if (!(supportsXTokens(this) && this.canUseXTokens(sendOptions) && !useTypeAndThen)) {
|
|
6171
6126
|
_context.n = 6;
|
|
6172
6127
|
break;
|
|
@@ -6213,7 +6168,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6213
6168
|
}));
|
|
6214
6169
|
case 7:
|
|
6215
6170
|
if (!(supportsPolkadotXCM(this) || useTypeAndThen)) {
|
|
6216
|
-
_context.n =
|
|
6171
|
+
_context.n = 16;
|
|
6217
6172
|
break;
|
|
6218
6173
|
}
|
|
6219
6174
|
options = {
|
|
@@ -6266,7 +6221,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6266
6221
|
isExternalAssetViaAh = isExternalAsset && !isAHPOrigin && !isAHPDest && !isEthDest && !feeAsset; // External asset - Any origin to AHP - DestinationReserve - one DepositAsset instruction
|
|
6267
6222
|
isExternalAssetToAh = isExternalAsset && isAHPDest && !isAHPOrigin && !isEthDest && !feeAsset;
|
|
6268
6223
|
if (!(isExternalAssetViaAh || isExternalAssetToAh || useTypeAndThen)) {
|
|
6269
|
-
_context.n =
|
|
6224
|
+
_context.n = 15;
|
|
6270
6225
|
break;
|
|
6271
6226
|
}
|
|
6272
6227
|
if (!(useTypeAndThen && supportsPolkadotXCM(this))) {
|
|
@@ -6276,20 +6231,33 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6276
6231
|
_context.n = 10;
|
|
6277
6232
|
return this.transferPolkadotXCM(options);
|
|
6278
6233
|
case 10:
|
|
6234
|
+
if (!isRelayAsset) {
|
|
6235
|
+
_context.n = 12;
|
|
6236
|
+
break;
|
|
6237
|
+
}
|
|
6279
6238
|
_context.n = 11;
|
|
6280
|
-
return
|
|
6239
|
+
return createTypeThenAutoReserve(this.chain, options);
|
|
6281
6240
|
case 11:
|
|
6282
|
-
|
|
6283
|
-
|
|
6241
|
+
_t = _context.v;
|
|
6242
|
+
_context.n = 14;
|
|
6243
|
+
break;
|
|
6284
6244
|
case 12:
|
|
6245
|
+
_context.n = 13;
|
|
6246
|
+
return createTypeAndThenCall(this.chain, options);
|
|
6247
|
+
case 13:
|
|
6248
|
+
_t = _context.v;
|
|
6249
|
+
case 14:
|
|
6250
|
+
call = _t;
|
|
6251
|
+
return _context.a(2, api.callTxMethod(call));
|
|
6252
|
+
case 15:
|
|
6285
6253
|
if (!supportsPolkadotXCM(this)) {
|
|
6286
|
-
_context.n =
|
|
6254
|
+
_context.n = 16;
|
|
6287
6255
|
break;
|
|
6288
6256
|
}
|
|
6289
6257
|
return _context.a(2, this.transferPolkadotXCM(options));
|
|
6290
|
-
case
|
|
6258
|
+
case 16:
|
|
6291
6259
|
throw new NoXCMSupportImplementedError(this._chain);
|
|
6292
|
-
case
|
|
6260
|
+
case 17:
|
|
6293
6261
|
return _context.a(2);
|
|
6294
6262
|
}
|
|
6295
6263
|
}, _callee, this);
|
|
@@ -6316,7 +6284,8 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6316
6284
|
if (isSendingDisabled) {
|
|
6317
6285
|
throw new InvalidParameterError("Sending from ".concat(this.chain, " is temporarily disabled"));
|
|
6318
6286
|
}
|
|
6319
|
-
var
|
|
6287
|
+
var scenario = resolveScenario(this.chain, options.to);
|
|
6288
|
+
var isReceivingDisabled = destChain && !isRelayChain(destChain) && !isExternalChain(destChain) && getChain(destChain).isReceivingTempDisabled(scenario);
|
|
6320
6289
|
if (isReceivingDisabled) {
|
|
6321
6290
|
throw new InvalidParameterError("Receiving on ".concat(destChain, " is temporarily disabled"));
|
|
6322
6291
|
}
|
|
@@ -6328,7 +6297,7 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6328
6297
|
}
|
|
6329
6298
|
}, {
|
|
6330
6299
|
key: "isReceivingTempDisabled",
|
|
6331
|
-
value: function isReceivingTempDisabled(
|
|
6300
|
+
value: function isReceivingTempDisabled(_scenario) {
|
|
6332
6301
|
return false;
|
|
6333
6302
|
}
|
|
6334
6303
|
}, {
|
|
@@ -6364,39 +6333,46 @@ var Parachain = /*#__PURE__*/function () {
|
|
|
6364
6333
|
key: "transferRelayToPara",
|
|
6365
6334
|
value: function () {
|
|
6366
6335
|
var _transferRelayToPara = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
6367
|
-
var api, version, pallet, assetInfo, address, destination, paraIdTo, methodOverride, _this$getRelayToParaO, method, includeFee, customMethod, paraId, destChain, scenario;
|
|
6336
|
+
var api, version, pallet, assetInfo, address, senderAddress, destination, paraIdTo, methodOverride, _this$getRelayToParaO, method, includeFee, customMethod, paraId, destChain, scenario;
|
|
6368
6337
|
return _regenerator().w(function (_context2) {
|
|
6369
6338
|
while (1) switch (_context2.n) {
|
|
6370
6339
|
case 0:
|
|
6371
|
-
api = options.api, version = options.version, pallet = options.pallet, assetInfo = options.assetInfo, address = options.address, destination = options.destination, paraIdTo = options.paraIdTo, methodOverride = options.method;
|
|
6340
|
+
api = options.api, version = options.version, pallet = options.pallet, assetInfo = options.assetInfo, address = options.address, senderAddress = options.senderAddress, destination = options.destination, paraIdTo = options.paraIdTo, methodOverride = options.method;
|
|
6372
6341
|
_this$getRelayToParaO = this.getRelayToParaOverrides(), method = _this$getRelayToParaO.method, includeFee = _this$getRelayToParaO.includeFee;
|
|
6342
|
+
if (!this.isReceivingTempDisabled('RelayToPara')) {
|
|
6343
|
+
_context2.n = 1;
|
|
6344
|
+
break;
|
|
6345
|
+
}
|
|
6346
|
+
throw new InvalidParameterError("Receiving on ".concat(this.chain, " is temporarily disabled"));
|
|
6347
|
+
case 1:
|
|
6373
6348
|
customMethod = methodOverride !== null && methodOverride !== void 0 ? methodOverride : method;
|
|
6374
6349
|
if (!(customMethod === 'transfer_assets_using_type_and_then')) {
|
|
6375
|
-
_context2.n =
|
|
6350
|
+
_context2.n = 3;
|
|
6376
6351
|
break;
|
|
6377
6352
|
}
|
|
6378
6353
|
paraId = resolveParaId(paraIdTo, destination);
|
|
6379
6354
|
destChain = resolveDestChain(this.chain, paraId);
|
|
6380
6355
|
scenario = 'RelayToPara';
|
|
6381
6356
|
if (destChain) {
|
|
6382
|
-
_context2.n =
|
|
6357
|
+
_context2.n = 2;
|
|
6383
6358
|
break;
|
|
6384
6359
|
}
|
|
6385
6360
|
throw new InvalidParameterError('Cannot override destination when using type and then transfer.');
|
|
6386
|
-
case
|
|
6387
|
-
return _context2.a(2,
|
|
6361
|
+
case 2:
|
|
6362
|
+
return _context2.a(2, createTypeThenAutoReserve(getRelayChainOf(destChain), _objectSpread2(_objectSpread2({}, options), {}, {
|
|
6388
6363
|
beneficiaryLocation: createBeneficiaryLocation({
|
|
6389
6364
|
api: api,
|
|
6390
6365
|
address: address,
|
|
6391
6366
|
version: version
|
|
6392
6367
|
}),
|
|
6368
|
+
senderAddress: senderAddress,
|
|
6393
6369
|
asset: this.createCurrencySpec(assetInfo.amount, scenario, version, assetInfo, false),
|
|
6394
6370
|
destLocation: createDestination(version, this.chain, destination, paraId),
|
|
6395
6371
|
scenario: scenario,
|
|
6396
6372
|
destChain: destChain,
|
|
6397
6373
|
paraIdTo: paraId
|
|
6398
6374
|
})));
|
|
6399
|
-
case
|
|
6375
|
+
case 3:
|
|
6400
6376
|
return _context2.a(2, {
|
|
6401
6377
|
module: pallet !== null && pallet !== void 0 ? pallet : 'XcmPallet',
|
|
6402
6378
|
method: customMethod,
|
|
@@ -7660,11 +7636,21 @@ var ComposableFinance = /*#__PURE__*/function (_Parachain) {
|
|
|
7660
7636
|
assertHasId(asset);
|
|
7661
7637
|
return transferXTokens(input, BigInt(asset.assetId));
|
|
7662
7638
|
}
|
|
7663
|
-
}
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7639
|
+
}, {
|
|
7640
|
+
key: "isSendingTempDisabled",
|
|
7641
|
+
value: function isSendingTempDisabled(_options) {
|
|
7642
|
+
return true;
|
|
7643
|
+
}
|
|
7644
|
+
}, {
|
|
7645
|
+
key: "isReceivingTempDisabled",
|
|
7646
|
+
value: function isReceivingTempDisabled(_scenario) {
|
|
7647
|
+
return true;
|
|
7648
|
+
}
|
|
7649
|
+
}]);
|
|
7650
|
+
}(Parachain);
|
|
7651
|
+
|
|
7652
|
+
var CoretimeKusama = /*#__PURE__*/function (_Parachain) {
|
|
7653
|
+
function CoretimeKusama() {
|
|
7668
7654
|
_classCallCheck(this, CoretimeKusama);
|
|
7669
7655
|
return _callSuper(this, CoretimeKusama, ['CoretimeKusama', 'kusamaCoretime', 'Kusama', Version.V5]);
|
|
7670
7656
|
}
|
|
@@ -7672,10 +7658,11 @@ var CoretimeKusama = /*#__PURE__*/function (_Parachain) {
|
|
|
7672
7658
|
return _createClass(CoretimeKusama, [{
|
|
7673
7659
|
key: "transferPolkadotXCM",
|
|
7674
7660
|
value: function transferPolkadotXCM(input) {
|
|
7675
|
-
// TESTED block hash on Rococo: 0x78ace0f1bf7cac9a42e56143321b617d98327e2750f795efb0abb833025c9082
|
|
7676
7661
|
var scenario = input.scenario;
|
|
7677
|
-
|
|
7678
|
-
|
|
7662
|
+
if (scenario === 'ParaToPara') {
|
|
7663
|
+
throw new ScenarioNotSupportedError(this.chain, scenario);
|
|
7664
|
+
}
|
|
7665
|
+
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
7679
7666
|
}
|
|
7680
7667
|
}, {
|
|
7681
7668
|
key: "getRelayToParaOverrides",
|
|
@@ -7707,6 +7694,11 @@ var CoretimePolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
7707
7694
|
}
|
|
7708
7695
|
return transferPolkadotXcm(input, 'limited_teleport_assets', 'Unlimited');
|
|
7709
7696
|
}
|
|
7697
|
+
}, {
|
|
7698
|
+
key: "canReceiveFrom",
|
|
7699
|
+
value: function canReceiveFrom(origin) {
|
|
7700
|
+
return origin !== 'Hydration' && origin !== 'Moonbeam';
|
|
7701
|
+
}
|
|
7710
7702
|
}, {
|
|
7711
7703
|
key: "getRelayToParaOverrides",
|
|
7712
7704
|
value: function getRelayToParaOverrides() {
|
|
@@ -7874,6 +7866,16 @@ var Curio = /*#__PURE__*/function (_Parachain) {
|
|
|
7874
7866
|
};
|
|
7875
7867
|
return transferXTokens(input, currencySelection);
|
|
7876
7868
|
}
|
|
7869
|
+
}, {
|
|
7870
|
+
key: "isSendingTempDisabled",
|
|
7871
|
+
value: function isSendingTempDisabled(_options) {
|
|
7872
|
+
return true;
|
|
7873
|
+
}
|
|
7874
|
+
}, {
|
|
7875
|
+
key: "isReceivingTempDisabled",
|
|
7876
|
+
value: function isReceivingTempDisabled(_scenario) {
|
|
7877
|
+
return true;
|
|
7878
|
+
}
|
|
7877
7879
|
}]);
|
|
7878
7880
|
}(Parachain);
|
|
7879
7881
|
|
|
@@ -7996,7 +7998,7 @@ var EnergyWebXPaseo = /*#__PURE__*/function (_EnergyWebX) {
|
|
|
7996
7998
|
var Heima = /*#__PURE__*/function (_Parachain) {
|
|
7997
7999
|
function Heima() {
|
|
7998
8000
|
var chain = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'Heima';
|
|
7999
|
-
var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '
|
|
8001
|
+
var info = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'heima';
|
|
8000
8002
|
var ecosystem = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'Polkadot';
|
|
8001
8003
|
var version = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Version.V5;
|
|
8002
8004
|
_classCallCheck(this, Heima);
|
|
@@ -8168,6 +8170,12 @@ var Polimec = /*#__PURE__*/function (_Parachain) {
|
|
|
8168
8170
|
}
|
|
8169
8171
|
return transferPolkadotXCM;
|
|
8170
8172
|
}()
|
|
8173
|
+
}, {
|
|
8174
|
+
key: "isSendingTempDisabled",
|
|
8175
|
+
value: function isSendingTempDisabled(_ref3) {
|
|
8176
|
+
var assetInfo = _ref3.assetInfo;
|
|
8177
|
+
return isSymbolMatch(assetInfo.symbol, this.getNativeAssetSymbol());
|
|
8178
|
+
}
|
|
8171
8179
|
}, {
|
|
8172
8180
|
key: "transferRelayToPara",
|
|
8173
8181
|
value: function transferRelayToPara(options) {
|
|
@@ -8885,7 +8893,7 @@ var Moonriver = /*#__PURE__*/function (_Parachain) {
|
|
|
8885
8893
|
|
|
8886
8894
|
var createTypeAndThenTransfer = /*#__PURE__*/function () {
|
|
8887
8895
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, chain, version) {
|
|
8888
|
-
var api, asset, senderAddress, address, destination, messageId,
|
|
8896
|
+
var api, asset, senderAddress, address, destination, messageId, nativeMythAmount;
|
|
8889
8897
|
return _regenerator().w(function (_context) {
|
|
8890
8898
|
while (1) switch (_context.n) {
|
|
8891
8899
|
case 0:
|
|
@@ -8903,28 +8911,10 @@ var createTypeAndThenTransfer = /*#__PURE__*/function () {
|
|
|
8903
8911
|
return generateMessageId(api, senderAddress, getParaId(chain), asset.assetId, address, asset.amount);
|
|
8904
8912
|
case 2:
|
|
8905
8913
|
messageId = _context.v;
|
|
8906
|
-
ahApi = api.clone();
|
|
8907
8914
|
_context.n = 3;
|
|
8908
|
-
return
|
|
8915
|
+
return getMythosOriginFee(api);
|
|
8909
8916
|
case 3:
|
|
8910
|
-
|
|
8911
|
-
return getParaEthTransferFees(ahApi);
|
|
8912
|
-
case 4:
|
|
8913
|
-
_yield$getParaEthTran = _context.v;
|
|
8914
|
-
_yield$getParaEthTran2 = _slicedToArray(_yield$getParaEthTran, 2);
|
|
8915
|
-
bridgeFee = _yield$getParaEthTran2[0];
|
|
8916
|
-
ahExecutionFee = _yield$getParaEthTran2[1];
|
|
8917
|
-
_context.n = 5;
|
|
8918
|
-
return ahApi.quoteAhPrice(DOT_LOCATION, getNativeAssets(chain)[0].location, bridgeFee + ahExecutionFee);
|
|
8919
|
-
case 5:
|
|
8920
|
-
feeConverted = _context.v;
|
|
8921
|
-
if (feeConverted) {
|
|
8922
|
-
_context.n = 6;
|
|
8923
|
-
break;
|
|
8924
|
-
}
|
|
8925
|
-
throw new InvalidParameterError("Pool DOT -> ".concat(asset.symbol, " not found."));
|
|
8926
|
-
case 6:
|
|
8927
|
-
nativeMythAmount = padFeeBy(feeConverted, 10);
|
|
8917
|
+
nativeMythAmount = _context.v;
|
|
8928
8918
|
return _context.a(2, {
|
|
8929
8919
|
module: 'PolkadotXcm',
|
|
8930
8920
|
method: 'transfer_assets_using_type_and_then',
|
|
@@ -9122,7 +9112,17 @@ var PAssetHub = /*#__PURE__*/function (_PeoplePolkadot) {
|
|
|
9122
9112
|
return _callSuper(this, PAssetHub, ['PAssetHub', 'PAssetHub - Contracts', 'Paseo', Version.V5]);
|
|
9123
9113
|
}
|
|
9124
9114
|
_inherits(PAssetHub, _PeoplePolkadot);
|
|
9125
|
-
return _createClass(PAssetHub
|
|
9115
|
+
return _createClass(PAssetHub, [{
|
|
9116
|
+
key: "isSendingTempDisabled",
|
|
9117
|
+
value: function isSendingTempDisabled(_options) {
|
|
9118
|
+
return true;
|
|
9119
|
+
}
|
|
9120
|
+
}, {
|
|
9121
|
+
key: "isReceivingTempDisabled",
|
|
9122
|
+
value: function isReceivingTempDisabled(_scenario) {
|
|
9123
|
+
return true;
|
|
9124
|
+
}
|
|
9125
|
+
}]);
|
|
9126
9126
|
}(PeoplePolkadot);
|
|
9127
9127
|
|
|
9128
9128
|
var Peaq = /*#__PURE__*/function (_Parachain) {
|
|
@@ -9147,6 +9147,16 @@ var Peaq = /*#__PURE__*/function (_Parachain) {
|
|
|
9147
9147
|
value: function transferRelayToPara() {
|
|
9148
9148
|
throw new ChainNotSupportedError();
|
|
9149
9149
|
}
|
|
9150
|
+
}, {
|
|
9151
|
+
key: "isSendingTempDisabled",
|
|
9152
|
+
value: function isSendingTempDisabled(_options) {
|
|
9153
|
+
return true;
|
|
9154
|
+
}
|
|
9155
|
+
}, {
|
|
9156
|
+
key: "isReceivingTempDisabled",
|
|
9157
|
+
value: function isReceivingTempDisabled(_scenario) {
|
|
9158
|
+
return true;
|
|
9159
|
+
}
|
|
9150
9160
|
}, {
|
|
9151
9161
|
key: "transferLocalNonNativeAsset",
|
|
9152
9162
|
value: function transferLocalNonNativeAsset(options) {
|
|
@@ -9398,8 +9408,17 @@ var RobonomicsPolkadot = /*#__PURE__*/function (_Parachain) {
|
|
|
9398
9408
|
return _createClass(RobonomicsPolkadot, [{
|
|
9399
9409
|
key: "transferPolkadotXCM",
|
|
9400
9410
|
value: function transferPolkadotXCM(input) {
|
|
9411
|
+
var scenario = input.scenario;
|
|
9412
|
+
if (scenario === 'ParaToPara') {
|
|
9413
|
+
throw new ScenarioNotSupportedError(this.chain, scenario);
|
|
9414
|
+
}
|
|
9401
9415
|
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
9402
9416
|
}
|
|
9417
|
+
}, {
|
|
9418
|
+
key: "isReceivingTempDisabled",
|
|
9419
|
+
value: function isReceivingTempDisabled(scenario) {
|
|
9420
|
+
return scenario !== 'RelayToPara';
|
|
9421
|
+
}
|
|
9403
9422
|
}, {
|
|
9404
9423
|
key: "transferLocalNonNativeAsset",
|
|
9405
9424
|
value: function transferLocalNonNativeAsset(options) {
|
|
@@ -9473,6 +9492,16 @@ var Subsocial = /*#__PURE__*/function (_Parachain) {
|
|
|
9473
9492
|
}
|
|
9474
9493
|
return transferPolkadotXcm(input, 'limited_reserve_transfer_assets', 'Unlimited');
|
|
9475
9494
|
}
|
|
9495
|
+
}, {
|
|
9496
|
+
key: "isSendingTempDisabled",
|
|
9497
|
+
value: function isSendingTempDisabled(_options) {
|
|
9498
|
+
return true;
|
|
9499
|
+
}
|
|
9500
|
+
}, {
|
|
9501
|
+
key: "isReceivingTempDisabled",
|
|
9502
|
+
value: function isReceivingTempDisabled(_scenario) {
|
|
9503
|
+
return true;
|
|
9504
|
+
}
|
|
9476
9505
|
}]);
|
|
9477
9506
|
}(Parachain);
|
|
9478
9507
|
|
|
@@ -9555,6 +9584,11 @@ var Zeitgeist = /*#__PURE__*/function (_Parachain) {
|
|
|
9555
9584
|
var currencySelection = this.getCurrencySelection(asset);
|
|
9556
9585
|
return transferXTokens(input, currencySelection);
|
|
9557
9586
|
}
|
|
9587
|
+
}, {
|
|
9588
|
+
key: "canReceiveFrom",
|
|
9589
|
+
value: function canReceiveFrom(origin) {
|
|
9590
|
+
return origin !== 'Astar';
|
|
9591
|
+
}
|
|
9558
9592
|
}, {
|
|
9559
9593
|
key: "transferLocalNonNativeAsset",
|
|
9560
9594
|
value: function transferLocalNonNativeAsset(options) {
|
|
@@ -9858,10 +9892,17 @@ var dryRunOrigin = /*#__PURE__*/function () {
|
|
|
9858
9892
|
};
|
|
9859
9893
|
}();
|
|
9860
9894
|
|
|
9861
|
-
var
|
|
9895
|
+
var BaseAssetsPallet = /*#__PURE__*/_createClass(function BaseAssetsPallet(palletName) {
|
|
9896
|
+
_classCallCheck(this, BaseAssetsPallet);
|
|
9897
|
+
this.palletName = palletName;
|
|
9898
|
+
});
|
|
9899
|
+
|
|
9900
|
+
var AssetManagerPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
9862
9901
|
function AssetManagerPallet() {
|
|
9863
9902
|
_classCallCheck(this, AssetManagerPallet);
|
|
9903
|
+
return _callSuper(this, AssetManagerPallet, arguments);
|
|
9864
9904
|
}
|
|
9905
|
+
_inherits(AssetManagerPallet, _BaseAssetsPallet);
|
|
9865
9906
|
return _createClass(AssetManagerPallet, [{
|
|
9866
9907
|
key: "mint",
|
|
9867
9908
|
value: function mint(address, asset, balance) {
|
|
@@ -9870,7 +9911,7 @@ var AssetManagerPallet = /*#__PURE__*/function () {
|
|
|
9870
9911
|
amount = asset.amount;
|
|
9871
9912
|
return Promise.resolve({
|
|
9872
9913
|
balanceTx: {
|
|
9873
|
-
module:
|
|
9914
|
+
module: this.palletName,
|
|
9874
9915
|
method: 'updateBalance',
|
|
9875
9916
|
parameters: {
|
|
9876
9917
|
who: {
|
|
@@ -9885,12 +9926,59 @@ var AssetManagerPallet = /*#__PURE__*/function () {
|
|
|
9885
9926
|
});
|
|
9886
9927
|
}
|
|
9887
9928
|
}]);
|
|
9888
|
-
}();
|
|
9929
|
+
}(BaseAssetsPallet);
|
|
9889
9930
|
|
|
9890
|
-
var
|
|
9931
|
+
var AssetsPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
9932
|
+
function AssetsPallet() {
|
|
9933
|
+
_classCallCheck(this, AssetsPallet);
|
|
9934
|
+
return _callSuper(this, AssetsPallet, arguments);
|
|
9935
|
+
}
|
|
9936
|
+
_inherits(AssetsPallet, _BaseAssetsPallet);
|
|
9937
|
+
return _createClass(AssetsPallet, [{
|
|
9938
|
+
key: "mint",
|
|
9939
|
+
value: function mint(address, asset, _balance, chain) {
|
|
9940
|
+
assertHasId(asset);
|
|
9941
|
+
var assetId = asset.assetId,
|
|
9942
|
+
amount = asset.amount;
|
|
9943
|
+
var id = chain === 'Astar' || chain === 'Shiden' || chain === 'Moonbeam' ? BigInt(assetId) : Number(assetId);
|
|
9944
|
+
var addr = isChainEvm(chain) ? address : {
|
|
9945
|
+
Id: address
|
|
9946
|
+
};
|
|
9947
|
+
return Promise.resolve({
|
|
9948
|
+
assetStatusTx: {
|
|
9949
|
+
module: this.palletName,
|
|
9950
|
+
method: 'force_asset_status',
|
|
9951
|
+
parameters: {
|
|
9952
|
+
id: id,
|
|
9953
|
+
owner: addr,
|
|
9954
|
+
issuer: addr,
|
|
9955
|
+
admin: addr,
|
|
9956
|
+
freezer: addr,
|
|
9957
|
+
min_balance: 0n,
|
|
9958
|
+
is_sufficient: true,
|
|
9959
|
+
is_frozen: false
|
|
9960
|
+
}
|
|
9961
|
+
},
|
|
9962
|
+
balanceTx: {
|
|
9963
|
+
module: this.palletName,
|
|
9964
|
+
method: 'mint',
|
|
9965
|
+
parameters: {
|
|
9966
|
+
id: id,
|
|
9967
|
+
beneficiary: addr,
|
|
9968
|
+
amount: amount
|
|
9969
|
+
}
|
|
9970
|
+
}
|
|
9971
|
+
});
|
|
9972
|
+
}
|
|
9973
|
+
}]);
|
|
9974
|
+
}(BaseAssetsPallet);
|
|
9975
|
+
|
|
9976
|
+
var BalancesPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
9891
9977
|
function BalancesPallet() {
|
|
9892
9978
|
_classCallCheck(this, BalancesPallet);
|
|
9979
|
+
return _callSuper(this, BalancesPallet, arguments);
|
|
9893
9980
|
}
|
|
9981
|
+
_inherits(BalancesPallet, _BaseAssetsPallet);
|
|
9894
9982
|
return _createClass(BalancesPallet, [{
|
|
9895
9983
|
key: "mint",
|
|
9896
9984
|
value: function mint(address, assetInfo, balance, chain) {
|
|
@@ -9898,7 +9986,7 @@ var BalancesPallet = /*#__PURE__*/function () {
|
|
|
9898
9986
|
var notUseId = chain.startsWith('Hydration') || chain === 'Basilisk' || isChainEvm(chain);
|
|
9899
9987
|
return Promise.resolve({
|
|
9900
9988
|
balanceTx: {
|
|
9901
|
-
module:
|
|
9989
|
+
module: this.palletName,
|
|
9902
9990
|
method: 'force_set_balance',
|
|
9903
9991
|
parameters: {
|
|
9904
9992
|
who: notUseId ? address : {
|
|
@@ -9910,12 +9998,14 @@ var BalancesPallet = /*#__PURE__*/function () {
|
|
|
9910
9998
|
});
|
|
9911
9999
|
}
|
|
9912
10000
|
}]);
|
|
9913
|
-
}();
|
|
10001
|
+
}(BaseAssetsPallet);
|
|
9914
10002
|
|
|
9915
|
-
var CurrenciesPallet = /*#__PURE__*/function () {
|
|
10003
|
+
var CurrenciesPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
9916
10004
|
function CurrenciesPallet() {
|
|
9917
10005
|
_classCallCheck(this, CurrenciesPallet);
|
|
10006
|
+
return _callSuper(this, CurrenciesPallet, arguments);
|
|
9918
10007
|
}
|
|
10008
|
+
_inherits(CurrenciesPallet, _BaseAssetsPallet);
|
|
9919
10009
|
return _createClass(CurrenciesPallet, [{
|
|
9920
10010
|
key: "mint",
|
|
9921
10011
|
value: function mint(address, assetInfo, balance) {
|
|
@@ -9924,7 +10014,7 @@ var CurrenciesPallet = /*#__PURE__*/function () {
|
|
|
9924
10014
|
amount = assetInfo.amount;
|
|
9925
10015
|
return Promise.resolve({
|
|
9926
10016
|
balanceTx: {
|
|
9927
|
-
module:
|
|
10017
|
+
module: this.palletName,
|
|
9928
10018
|
method: 'update_balance',
|
|
9929
10019
|
parameters: {
|
|
9930
10020
|
who: address,
|
|
@@ -9935,12 +10025,14 @@ var CurrenciesPallet = /*#__PURE__*/function () {
|
|
|
9935
10025
|
});
|
|
9936
10026
|
}
|
|
9937
10027
|
}]);
|
|
9938
|
-
}();
|
|
10028
|
+
}(BaseAssetsPallet);
|
|
9939
10029
|
|
|
9940
|
-
var ForeignAssetsPallet = /*#__PURE__*/function () {
|
|
10030
|
+
var ForeignAssetsPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
9941
10031
|
function ForeignAssetsPallet() {
|
|
9942
10032
|
_classCallCheck(this, ForeignAssetsPallet);
|
|
10033
|
+
return _callSuper(this, ForeignAssetsPallet, arguments);
|
|
9943
10034
|
}
|
|
10035
|
+
_inherits(ForeignAssetsPallet, _BaseAssetsPallet);
|
|
9944
10036
|
return _createClass(ForeignAssetsPallet, [{
|
|
9945
10037
|
key: "mint",
|
|
9946
10038
|
value: function mint(address, asset) {
|
|
@@ -9949,7 +10041,7 @@ var ForeignAssetsPallet = /*#__PURE__*/function () {
|
|
|
9949
10041
|
amount = asset.amount;
|
|
9950
10042
|
return Promise.resolve({
|
|
9951
10043
|
assetStatusTx: {
|
|
9952
|
-
module:
|
|
10044
|
+
module: this.palletName,
|
|
9953
10045
|
method: 'force_asset_status',
|
|
9954
10046
|
parameters: {
|
|
9955
10047
|
id: location,
|
|
@@ -9971,7 +10063,7 @@ var ForeignAssetsPallet = /*#__PURE__*/function () {
|
|
|
9971
10063
|
}
|
|
9972
10064
|
},
|
|
9973
10065
|
balanceTx: {
|
|
9974
|
-
module:
|
|
10066
|
+
module: this.palletName,
|
|
9975
10067
|
method: 'mint',
|
|
9976
10068
|
parameters: {
|
|
9977
10069
|
id: location,
|
|
@@ -9984,7 +10076,7 @@ var ForeignAssetsPallet = /*#__PURE__*/function () {
|
|
|
9984
10076
|
});
|
|
9985
10077
|
}
|
|
9986
10078
|
}]);
|
|
9987
|
-
}();
|
|
10079
|
+
}(BaseAssetsPallet);
|
|
9988
10080
|
|
|
9989
10081
|
var SIZE = 32;
|
|
9990
10082
|
var BALANCE_SLOT = 0;
|
|
@@ -9999,10 +10091,12 @@ var calculateMappingSlot = function calculateMappingSlot(key) {
|
|
|
9999
10091
|
var encoded = concat([keyPadded, slotHex]);
|
|
10000
10092
|
return keccak256(encoded);
|
|
10001
10093
|
};
|
|
10002
|
-
var SystemPallet = /*#__PURE__*/function () {
|
|
10094
|
+
var SystemPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
10003
10095
|
function SystemPallet() {
|
|
10004
10096
|
_classCallCheck(this, SystemPallet);
|
|
10097
|
+
return _callSuper(this, SystemPallet, arguments);
|
|
10005
10098
|
}
|
|
10099
|
+
_inherits(SystemPallet, _BaseAssetsPallet);
|
|
10006
10100
|
return _createClass(SystemPallet, [{
|
|
10007
10101
|
key: "mint",
|
|
10008
10102
|
value: function () {
|
|
@@ -10023,7 +10117,7 @@ var SystemPallet = /*#__PURE__*/function () {
|
|
|
10023
10117
|
storageKey = _context.v;
|
|
10024
10118
|
return _context.a(2, {
|
|
10025
10119
|
balanceTx: {
|
|
10026
|
-
module:
|
|
10120
|
+
module: this.palletName,
|
|
10027
10121
|
method: 'set_storage',
|
|
10028
10122
|
parameters: {
|
|
10029
10123
|
items: [[storageKey, amountEncoded]]
|
|
@@ -10031,7 +10125,7 @@ var SystemPallet = /*#__PURE__*/function () {
|
|
|
10031
10125
|
}
|
|
10032
10126
|
});
|
|
10033
10127
|
}
|
|
10034
|
-
}, _callee);
|
|
10128
|
+
}, _callee, this);
|
|
10035
10129
|
}));
|
|
10036
10130
|
function mint(_x, _x2, _x3, _x4, _x5) {
|
|
10037
10131
|
return _mint.apply(this, arguments);
|
|
@@ -10039,12 +10133,14 @@ var SystemPallet = /*#__PURE__*/function () {
|
|
|
10039
10133
|
return mint;
|
|
10040
10134
|
}()
|
|
10041
10135
|
}]);
|
|
10042
|
-
}();
|
|
10136
|
+
}(BaseAssetsPallet);
|
|
10043
10137
|
|
|
10044
|
-
var TokensPallet = /*#__PURE__*/function () {
|
|
10138
|
+
var TokensPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
10045
10139
|
function TokensPallet() {
|
|
10046
10140
|
_classCallCheck(this, TokensPallet);
|
|
10141
|
+
return _callSuper(this, TokensPallet, arguments);
|
|
10047
10142
|
}
|
|
10143
|
+
_inherits(TokensPallet, _BaseAssetsPallet);
|
|
10048
10144
|
return _createClass(TokensPallet, [{
|
|
10049
10145
|
key: "mint",
|
|
10050
10146
|
value: function mint(address, asset, balance, chain) {
|
|
@@ -10054,7 +10150,7 @@ var TokensPallet = /*#__PURE__*/function () {
|
|
|
10054
10150
|
var amount = asset.amount;
|
|
10055
10151
|
return Promise.resolve({
|
|
10056
10152
|
balanceTx: {
|
|
10057
|
-
module:
|
|
10153
|
+
module: this.palletName,
|
|
10058
10154
|
method: 'set_balance',
|
|
10059
10155
|
parameters: {
|
|
10060
10156
|
who: {
|
|
@@ -10068,35 +10164,93 @@ var TokensPallet = /*#__PURE__*/function () {
|
|
|
10068
10164
|
});
|
|
10069
10165
|
}
|
|
10070
10166
|
}]);
|
|
10071
|
-
}();
|
|
10167
|
+
}(BaseAssetsPallet);
|
|
10072
10168
|
|
|
10073
10169
|
var palletRegistry = {
|
|
10074
|
-
Balances: BalancesPallet,
|
|
10075
|
-
Tokens: TokensPallet,
|
|
10076
|
-
Currencies: CurrenciesPallet,
|
|
10077
|
-
Assets: AssetsPallet,
|
|
10078
|
-
ForeignAssets: ForeignAssetsPallet,
|
|
10079
|
-
AssetManager: AssetManagerPallet,
|
|
10080
|
-
System: SystemPallet
|
|
10170
|
+
Balances: new BalancesPallet('Balances'),
|
|
10171
|
+
Tokens: new TokensPallet('Tokens'),
|
|
10172
|
+
Currencies: new CurrenciesPallet('Currencies'),
|
|
10173
|
+
Assets: new AssetsPallet('Assets'),
|
|
10174
|
+
ForeignAssets: new ForeignAssetsPallet('ForeignAssets'),
|
|
10175
|
+
AssetManager: new AssetManagerPallet('AssetManager'),
|
|
10176
|
+
System: new SystemPallet('System'),
|
|
10177
|
+
Fungibles: new AssetsPallet('Fungibles')
|
|
10081
10178
|
};
|
|
10082
10179
|
var getPalletInstance = function getPalletInstance(type) {
|
|
10083
|
-
|
|
10084
|
-
return new HandlerClass();
|
|
10180
|
+
return palletRegistry[type];
|
|
10085
10181
|
};
|
|
10086
10182
|
|
|
10087
|
-
var
|
|
10088
|
-
|
|
10089
|
-
|
|
10183
|
+
var getOriginFeeDetailsInternal = /*#__PURE__*/function () {
|
|
10184
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
10185
|
+
var _getExistentialDeposi;
|
|
10186
|
+
var api, account, accountDestination, ahAddress, currency, origin, destination, _ref$feeMarginPercent, feeMarginPercentage, tx, xcmFee, xcmFeeWithMargin, nativeBalance, existentialDeposit, sufficientForXCM;
|
|
10187
|
+
return _regenerator().w(function (_context) {
|
|
10188
|
+
while (1) switch (_context.n) {
|
|
10189
|
+
case 0:
|
|
10190
|
+
api = _ref.api, account = _ref.account, accountDestination = _ref.accountDestination, ahAddress = _ref.ahAddress, currency = _ref.currency, origin = _ref.origin, destination = _ref.destination, _ref$feeMarginPercent = _ref.feeMarginPercentage, feeMarginPercentage = _ref$feeMarginPercent === void 0 ? 10 : _ref$feeMarginPercent;
|
|
10191
|
+
_context.n = 1;
|
|
10192
|
+
return api.init(origin);
|
|
10193
|
+
case 1:
|
|
10194
|
+
_context.n = 2;
|
|
10195
|
+
return Builder(api).from(origin).to(destination).currency(currency).address(accountDestination).senderAddress(account).ahAddress(ahAddress)['buildInternal']();
|
|
10196
|
+
case 2:
|
|
10197
|
+
tx = _context.v;
|
|
10198
|
+
_context.n = 3;
|
|
10199
|
+
return api.calculateTransactionFee(tx, account);
|
|
10200
|
+
case 3:
|
|
10201
|
+
xcmFee = _context.v;
|
|
10202
|
+
xcmFeeWithMargin = xcmFee + xcmFee / BigInt(feeMarginPercentage);
|
|
10203
|
+
_context.n = 4;
|
|
10204
|
+
return getBalanceNativeInternal({
|
|
10205
|
+
address: account,
|
|
10206
|
+
chain: origin,
|
|
10207
|
+
api: api
|
|
10208
|
+
});
|
|
10209
|
+
case 4:
|
|
10210
|
+
nativeBalance = _context.v;
|
|
10211
|
+
existentialDeposit = BigInt((_getExistentialDeposi = getExistentialDeposit(origin)) !== null && _getExistentialDeposi !== void 0 ? _getExistentialDeposi : '0');
|
|
10212
|
+
sufficientForXCM = nativeBalance - existentialDeposit - xcmFeeWithMargin > 0;
|
|
10213
|
+
return _context.a(2, {
|
|
10214
|
+
sufficientForXCM: sufficientForXCM,
|
|
10215
|
+
xcmFee: xcmFee
|
|
10216
|
+
});
|
|
10217
|
+
}
|
|
10218
|
+
}, _callee);
|
|
10219
|
+
}));
|
|
10220
|
+
return function getOriginFeeDetailsInternal(_x) {
|
|
10221
|
+
return _ref2.apply(this, arguments);
|
|
10090
10222
|
};
|
|
10091
|
-
|
|
10092
|
-
|
|
10093
|
-
|
|
10094
|
-
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
|
|
10223
|
+
}();
|
|
10224
|
+
var getOriginFeeDetails = /*#__PURE__*/function () {
|
|
10225
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
10226
|
+
var api;
|
|
10227
|
+
return _regenerator().w(function (_context2) {
|
|
10228
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
10229
|
+
case 0:
|
|
10230
|
+
api = options.api;
|
|
10231
|
+
api.setDisconnectAllowed(false);
|
|
10232
|
+
_context2.p = 1;
|
|
10233
|
+
_context2.n = 2;
|
|
10234
|
+
return getOriginFeeDetailsInternal(options);
|
|
10235
|
+
case 2:
|
|
10236
|
+
return _context2.a(2, _context2.v);
|
|
10237
|
+
case 3:
|
|
10238
|
+
_context2.p = 3;
|
|
10239
|
+
api.setDisconnectAllowed(true);
|
|
10240
|
+
_context2.n = 4;
|
|
10241
|
+
return api.disconnect();
|
|
10242
|
+
case 4:
|
|
10243
|
+
return _context2.f(3);
|
|
10244
|
+
case 5:
|
|
10245
|
+
return _context2.a(2);
|
|
10246
|
+
}
|
|
10247
|
+
}, _callee2, null, [[1,, 3, 5]]);
|
|
10248
|
+
}));
|
|
10249
|
+
return function getOriginFeeDetails(_x2) {
|
|
10250
|
+
return _ref3.apply(this, arguments);
|
|
10098
10251
|
};
|
|
10099
|
-
};
|
|
10252
|
+
}();
|
|
10253
|
+
|
|
10100
10254
|
var pickOtherPallet = function pickOtherPallet(asset, pallets) {
|
|
10101
10255
|
if (isForeignAsset(asset) && (!asset.assetId || asset.assetId.startsWith('0x'))) {
|
|
10102
10256
|
var _pallets$find;
|
|
@@ -10804,7 +10958,7 @@ var getFailureInfo = function getFailureInfo(chains, hops) {
|
|
|
10804
10958
|
};
|
|
10805
10959
|
var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
10806
10960
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
10807
|
-
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, asset, amount, _yield$getOriginXcmFe,
|
|
10961
|
+
var api, tx, origin, destination, senderAddress, address, currency, feeAsset, disableFallback, swapConfig, useRootOrigin, asset, amount, _yield$getOriginXcmFe, originFeeRaw, originCurrency, originAsset, originFeeType, originDryRunError, initialForwardedXcm, initialDestParaId, originWeight, sufficientOriginFee, isMythosToEthereum, originFee, 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, _t, _t2, _t3, _t4;
|
|
10808
10962
|
return _regenerator().w(function (_context2) {
|
|
10809
10963
|
while (1) switch (_context2.p = _context2.n) {
|
|
10810
10964
|
case 0:
|
|
@@ -10825,7 +10979,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10825
10979
|
});
|
|
10826
10980
|
case 1:
|
|
10827
10981
|
_yield$getOriginXcmFe = _context2.v;
|
|
10828
|
-
|
|
10982
|
+
originFeeRaw = _yield$getOriginXcmFe.fee;
|
|
10829
10983
|
originCurrency = _yield$getOriginXcmFe.currency;
|
|
10830
10984
|
originAsset = _yield$getOriginXcmFe.asset;
|
|
10831
10985
|
originFeeType = _yield$getOriginXcmFe.feeType;
|
|
@@ -10834,17 +10988,34 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10834
10988
|
initialDestParaId = _yield$getOriginXcmFe.destParaId;
|
|
10835
10989
|
originWeight = _yield$getOriginXcmFe.weight;
|
|
10836
10990
|
sufficientOriginFee = _yield$getOriginXcmFe.sufficient;
|
|
10991
|
+
isMythosToEthereum = origin === 'Mythos' && destination === 'Ethereum';
|
|
10992
|
+
if (!isMythosToEthereum) {
|
|
10993
|
+
_context2.n = 3;
|
|
10994
|
+
break;
|
|
10995
|
+
}
|
|
10996
|
+
_context2.n = 2;
|
|
10997
|
+
return getMythosOriginFee(api);
|
|
10998
|
+
case 2:
|
|
10999
|
+
_t2 = _context2.v;
|
|
11000
|
+
_t3 = originFeeRaw !== null && originFeeRaw !== void 0 ? originFeeRaw : 0n;
|
|
11001
|
+
_t = _t2 + _t3;
|
|
11002
|
+
_context2.n = 4;
|
|
11003
|
+
break;
|
|
11004
|
+
case 3:
|
|
11005
|
+
_t = originFeeRaw;
|
|
11006
|
+
case 4:
|
|
11007
|
+
originFee = _t;
|
|
10837
11008
|
if (!(originDryRunError || originFeeType === 'paymentInfo')) {
|
|
10838
|
-
_context2.n =
|
|
11009
|
+
_context2.n = 10;
|
|
10839
11010
|
break;
|
|
10840
11011
|
}
|
|
10841
11012
|
destApi = api.clone();
|
|
10842
|
-
_context2.p =
|
|
10843
|
-
_context2.n =
|
|
11013
|
+
_context2.p = 5;
|
|
11014
|
+
_context2.n = 6;
|
|
10844
11015
|
return destApi.init(destination, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
10845
|
-
case
|
|
11016
|
+
case 6:
|
|
10846
11017
|
destApi.setDisconnectAllowed(false);
|
|
10847
|
-
_context2.n =
|
|
11018
|
+
_context2.n = 7;
|
|
10848
11019
|
return getDestXcmFee({
|
|
10849
11020
|
api: destApi,
|
|
10850
11021
|
forwardedXcms: undefined,
|
|
@@ -10863,7 +11034,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10863
11034
|
disableFallback: disableFallback,
|
|
10864
11035
|
swapConfig: swapConfig
|
|
10865
11036
|
});
|
|
10866
|
-
case
|
|
11037
|
+
case 7:
|
|
10867
11038
|
destFeeRes = _context2.v;
|
|
10868
11039
|
_result = {
|
|
10869
11040
|
origin: _objectSpread2(_objectSpread2(_objectSpread2({}, originFee && {
|
|
@@ -10899,14 +11070,14 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10899
11070
|
failureChain: _failureChain,
|
|
10900
11071
|
failureReason: _failureReason
|
|
10901
11072
|
}));
|
|
10902
|
-
case
|
|
10903
|
-
_context2.p =
|
|
11073
|
+
case 8:
|
|
11074
|
+
_context2.p = 8;
|
|
10904
11075
|
destApi.setDisconnectAllowed(true);
|
|
10905
|
-
_context2.n =
|
|
11076
|
+
_context2.n = 9;
|
|
10906
11077
|
return destApi.disconnect();
|
|
10907
|
-
case
|
|
10908
|
-
return _context2.f(
|
|
10909
|
-
case
|
|
11078
|
+
case 9:
|
|
11079
|
+
return _context2.f(8);
|
|
11080
|
+
case 10:
|
|
10910
11081
|
processHop = /*#__PURE__*/function () {
|
|
10911
11082
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(params) {
|
|
10912
11083
|
var hopApi, currentChain, currentOrigin, currentAsset, forwardedXcms, hasPassedExchange, hopAsset, hopResult;
|
|
@@ -10955,7 +11126,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10955
11126
|
return _ref3.apply(this, arguments);
|
|
10956
11127
|
};
|
|
10957
11128
|
}();
|
|
10958
|
-
_context2.n =
|
|
11129
|
+
_context2.n = 11;
|
|
10959
11130
|
return traverseXcmHops({
|
|
10960
11131
|
api: api,
|
|
10961
11132
|
origin: origin,
|
|
@@ -10975,14 +11146,14 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10975
11146
|
};
|
|
10976
11147
|
}
|
|
10977
11148
|
});
|
|
10978
|
-
case
|
|
11149
|
+
case 11:
|
|
10979
11150
|
traversalResult = _context2.v;
|
|
10980
11151
|
// Handle case where we failed before reaching destination
|
|
10981
11152
|
destFee = 0n;
|
|
10982
11153
|
destFeeType = destination === 'Ethereum' ? 'noFeeRequired' : 'paymentInfo';
|
|
10983
11154
|
destSufficient = undefined;
|
|
10984
11155
|
if (!traversalResult.destination) {
|
|
10985
|
-
_context2.n =
|
|
11156
|
+
_context2.n = 12;
|
|
10986
11157
|
break;
|
|
10987
11158
|
}
|
|
10988
11159
|
destResult = traversalResult.destination;
|
|
@@ -10992,19 +11163,19 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
10992
11163
|
destSufficient = destResult.sufficient;
|
|
10993
11164
|
destCurrency = destResult.currency;
|
|
10994
11165
|
destAsset = destResult.asset;
|
|
10995
|
-
_context2.n =
|
|
11166
|
+
_context2.n = 16;
|
|
10996
11167
|
break;
|
|
10997
|
-
case
|
|
11168
|
+
case 12:
|
|
10998
11169
|
if (!(traversalResult.hops.length > 0 && traversalResult.hops[traversalResult.hops.length - 1].result.dryRunError)) {
|
|
10999
|
-
_context2.n =
|
|
11170
|
+
_context2.n = 15;
|
|
11000
11171
|
break;
|
|
11001
11172
|
}
|
|
11002
11173
|
// We failed before reaching destination, use fallback
|
|
11003
11174
|
_destApi = api.clone();
|
|
11004
|
-
_context2.n =
|
|
11175
|
+
_context2.n = 13;
|
|
11005
11176
|
return _destApi.init(destination, DRY_RUN_CLIENT_TIMEOUT_MS);
|
|
11006
|
-
case
|
|
11007
|
-
_context2.n =
|
|
11177
|
+
case 13:
|
|
11178
|
+
_context2.n = 14;
|
|
11008
11179
|
return getDestXcmFee({
|
|
11009
11180
|
api: _destApi,
|
|
11010
11181
|
forwardedXcms: undefined,
|
|
@@ -11022,28 +11193,38 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11022
11193
|
disableFallback: disableFallback,
|
|
11023
11194
|
swapConfig: swapConfig
|
|
11024
11195
|
});
|
|
11025
|
-
case
|
|
11196
|
+
case 14:
|
|
11026
11197
|
destFallback = _context2.v;
|
|
11027
11198
|
destFee = destFallback.fee;
|
|
11028
11199
|
destFeeType = destFallback.feeType;
|
|
11029
11200
|
destSufficient = destFallback.sufficient;
|
|
11030
11201
|
destCurrency = getNativeAssetSymbol(destination);
|
|
11031
11202
|
destAsset = findNativeAssetInfoOrThrow(destination);
|
|
11032
|
-
_context2.n =
|
|
11203
|
+
_context2.n = 16;
|
|
11033
11204
|
break;
|
|
11034
|
-
case
|
|
11205
|
+
case 15:
|
|
11035
11206
|
destFee = 0n;
|
|
11036
11207
|
destFeeType = 'noFeeRequired';
|
|
11037
11208
|
destSufficient = true;
|
|
11038
11209
|
destCurrency = getNativeAssetSymbol(destination);
|
|
11039
11210
|
destAsset = findNativeAssetInfoOrThrow(destination);
|
|
11040
|
-
case
|
|
11211
|
+
case 16:
|
|
11041
11212
|
// Process Ethereum bridge fees
|
|
11042
11213
|
assetHubChain = "AssetHub".concat(getRelayChainOf(origin));
|
|
11043
|
-
|
|
11214
|
+
if (!isMythosToEthereum) {
|
|
11215
|
+
_context2.n = 17;
|
|
11216
|
+
break;
|
|
11217
|
+
}
|
|
11218
|
+
_t4 = traversalResult.bridgeHub;
|
|
11219
|
+
_context2.n = 19;
|
|
11220
|
+
break;
|
|
11221
|
+
case 17:
|
|
11222
|
+
_context2.n = 18;
|
|
11044
11223
|
return addEthereumBridgeFees(api, traversalResult.bridgeHub, destination, assetHubChain);
|
|
11045
|
-
case
|
|
11046
|
-
|
|
11224
|
+
case 18:
|
|
11225
|
+
_t4 = _context2.v;
|
|
11226
|
+
case 19:
|
|
11227
|
+
processedBridgeHub = _t4;
|
|
11047
11228
|
// Update bridge hub fee in hops if needed
|
|
11048
11229
|
if (processedBridgeHub && traversalResult.bridgeHub && processedBridgeHub.fee !== traversalResult.bridgeHub.fee) {
|
|
11049
11230
|
bridgeHubChain = "BridgeHub".concat(getRelayChainOf(origin));
|
|
@@ -11119,7 +11300,7 @@ var getXcmFeeInternal = /*#__PURE__*/function () {
|
|
|
11119
11300
|
failureReason: failureReason
|
|
11120
11301
|
}));
|
|
11121
11302
|
}
|
|
11122
|
-
}, _callee2, null, [[
|
|
11303
|
+
}, _callee2, null, [[5,, 8, 10]]);
|
|
11123
11304
|
}));
|
|
11124
11305
|
return function getXcmFeeInternal(_x) {
|
|
11125
11306
|
return _ref2.apply(this, arguments);
|
|
@@ -11425,6 +11606,7 @@ var send = /*#__PURE__*/function () {
|
|
|
11425
11606
|
origin: origin,
|
|
11426
11607
|
destination: destination,
|
|
11427
11608
|
address: address,
|
|
11609
|
+
senderAddress: senderAddress,
|
|
11428
11610
|
assetInfo: _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
11429
11611
|
amount: finalAmount
|
|
11430
11612
|
}),
|
|
@@ -12165,12 +12347,13 @@ var computeInstructionFee = /*#__PURE__*/function () {
|
|
|
12165
12347
|
}();
|
|
12166
12348
|
var computeAllFees = /*#__PURE__*/function () {
|
|
12167
12349
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref3, customXcm, isDotAsset, refundInstruction) {
|
|
12350
|
+
var _customXcm$DepositRes;
|
|
12168
12351
|
var reserve, dest, version, _t2, _t3, _t4, _t5, _t6, _t7, _t8, _t9, _t0;
|
|
12169
12352
|
return _regenerator().w(function (_context2) {
|
|
12170
12353
|
while (1) switch (_context2.n) {
|
|
12171
12354
|
case 0:
|
|
12172
12355
|
reserve = _ref3.reserve, dest = _ref3.dest, version = _ref3.options.version;
|
|
12173
|
-
if (!('DepositReserveAsset' in customXcm)) {
|
|
12356
|
+
if (!('DepositReserveAsset' in customXcm || 'InitiateTeleport' in customXcm)) {
|
|
12174
12357
|
_context2.n = 6;
|
|
12175
12358
|
break;
|
|
12176
12359
|
}
|
|
@@ -12193,7 +12376,7 @@ var computeAllFees = /*#__PURE__*/function () {
|
|
|
12193
12376
|
case 4:
|
|
12194
12377
|
_t5 = _t4;
|
|
12195
12378
|
_context2.n = 5;
|
|
12196
|
-
return computeInstructionFee(hasXcmPaymentApiSupport(dest.chain) ? dest : reserve, version, customXcm.DepositReserveAsset.xcm);
|
|
12379
|
+
return computeInstructionFee(hasXcmPaymentApiSupport(dest.chain) ? dest : reserve, version, ((_customXcm$DepositRes = customXcm === null || customXcm === void 0 ? void 0 : customXcm.DepositReserveAsset) !== null && _customXcm$DepositRes !== void 0 ? _customXcm$DepositRes : customXcm.InitiateTeleport).xcm);
|
|
12197
12380
|
case 5:
|
|
12198
12381
|
_t6 = _context2.v;
|
|
12199
12382
|
_t2 = {
|
|
@@ -12248,7 +12431,7 @@ var computeAllFees = /*#__PURE__*/function () {
|
|
|
12248
12431
|
}();
|
|
12249
12432
|
|
|
12250
12433
|
var createTypeAndThenCallContext = /*#__PURE__*/function () {
|
|
12251
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options) {
|
|
12434
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options, overrideReserve) {
|
|
12252
12435
|
var api, destChain, assetInfo, reserveChain, destApi, reserveApi;
|
|
12253
12436
|
return _regenerator().w(function (_context) {
|
|
12254
12437
|
while (1) switch (_context.n) {
|
|
@@ -12261,12 +12444,14 @@ var createTypeAndThenCallContext = /*#__PURE__*/function () {
|
|
|
12261
12444
|
}
|
|
12262
12445
|
throw new InvalidParameterError('Cannot override destination when using type and then transfer.');
|
|
12263
12446
|
case 1:
|
|
12264
|
-
reserveChain =
|
|
12447
|
+
reserveChain = overrideReserve !== undefined ? overrideReserve :
|
|
12448
|
+
// Paseo ecosystem migrated reserves to AssetHub
|
|
12449
|
+
getRelayChainOf(chain) === 'Paseo' ? getAssetReserveChain(chain, chain, assetInfo.location) : isRelayChain(destChain) ? destChain : getAssetReserveChain(chain, chain, assetInfo.location);
|
|
12265
12450
|
destApi = api.clone();
|
|
12266
12451
|
_context.n = 2;
|
|
12267
12452
|
return destApi.init(destChain);
|
|
12268
12453
|
case 2:
|
|
12269
|
-
reserveApi = reserveChain
|
|
12454
|
+
reserveApi = reserveChain === chain ? api : reserveChain === destChain ? destApi : api.clone();
|
|
12270
12455
|
_context.n = 3;
|
|
12271
12456
|
return reserveApi.init(reserveChain);
|
|
12272
12457
|
case 3:
|
|
@@ -12289,7 +12474,7 @@ var createTypeAndThenCallContext = /*#__PURE__*/function () {
|
|
|
12289
12474
|
}
|
|
12290
12475
|
}, _callee);
|
|
12291
12476
|
}));
|
|
12292
|
-
return function createTypeAndThenCallContext(_x, _x2) {
|
|
12477
|
+
return function createTypeAndThenCallContext(_x, _x2, _x3) {
|
|
12293
12478
|
return _ref.apply(this, arguments);
|
|
12294
12479
|
};
|
|
12295
12480
|
}();
|
|
@@ -12337,20 +12522,33 @@ var createCustomXcm = function createCustomXcm(_ref, isDotAsset) {
|
|
|
12337
12522
|
if (origin.chain !== reserve.chain && dest.chain !== reserve.chain) {
|
|
12338
12523
|
var buyExecutionAmount = !isDotAsset ? destFee : assetInfo.amount - reserveFee - refundFee;
|
|
12339
12524
|
if (buyExecutionAmount < 0n) throw new AmountTooLowError();
|
|
12525
|
+
var filter = fees.destFee === MIN_FEE ? {
|
|
12526
|
+
Wild: 'All'
|
|
12527
|
+
} : {
|
|
12528
|
+
Definite: assetsFilter
|
|
12529
|
+
};
|
|
12530
|
+
var buyExecution = {
|
|
12531
|
+
BuyExecution: {
|
|
12532
|
+
fees: createAsset(version, buyExecutionAmount, feeAssetLocation),
|
|
12533
|
+
weight_limit: 'Unlimited'
|
|
12534
|
+
}
|
|
12535
|
+
};
|
|
12536
|
+
var destLoc = createDestination(version, origin.chain, destination, paraIdTo);
|
|
12537
|
+
// If destination is a system chain, use teleport instead of reserve deposit
|
|
12538
|
+
if (isSystemChain(dest.chain)) {
|
|
12539
|
+
return {
|
|
12540
|
+
InitiateTeleport: {
|
|
12541
|
+
assets: filter,
|
|
12542
|
+
dest: destLoc,
|
|
12543
|
+
xcm: [buyExecution, depositInstruction]
|
|
12544
|
+
}
|
|
12545
|
+
};
|
|
12546
|
+
}
|
|
12340
12547
|
return {
|
|
12341
12548
|
DepositReserveAsset: {
|
|
12342
|
-
assets:
|
|
12343
|
-
|
|
12344
|
-
|
|
12345
|
-
Definite: assetsFilter
|
|
12346
|
-
},
|
|
12347
|
-
dest: createDestination(version, origin.chain, destination, paraIdTo),
|
|
12348
|
-
xcm: [{
|
|
12349
|
-
BuyExecution: {
|
|
12350
|
-
fees: createAsset(version, buyExecutionAmount, feeAssetLocation),
|
|
12351
|
-
weight_limit: 'Unlimited'
|
|
12352
|
-
}
|
|
12353
|
-
}, depositInstruction]
|
|
12549
|
+
assets: filter,
|
|
12550
|
+
dest: destLoc,
|
|
12551
|
+
xcm: [buyExecution, depositInstruction]
|
|
12354
12552
|
}
|
|
12355
12553
|
};
|
|
12356
12554
|
}
|
|
@@ -12388,14 +12586,14 @@ var buildAssets = function buildAssets(chain, asset, feeAmount, isDotAsset, vers
|
|
|
12388
12586
|
* Creates a type and then call for transferring assets using XCM. Works only for DOT and snowbridge assets so far.
|
|
12389
12587
|
*/
|
|
12390
12588
|
var createTypeAndThenCall = /*#__PURE__*/function () {
|
|
12391
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options) {
|
|
12589
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options, overrideReserve) {
|
|
12392
12590
|
var api, senderAddress, version, context, assetInfo, isDotAsset, customXcm, assetCount, refundInstruction, fees, finalCustomXcm, totalFee, assets;
|
|
12393
12591
|
return _regenerator().w(function (_context) {
|
|
12394
12592
|
while (1) switch (_context.n) {
|
|
12395
12593
|
case 0:
|
|
12396
12594
|
api = options.api, senderAddress = options.senderAddress, version = options.version;
|
|
12397
12595
|
_context.n = 1;
|
|
12398
|
-
return createTypeAndThenCallContext(chain, options);
|
|
12596
|
+
return createTypeAndThenCallContext(chain, options, overrideReserve);
|
|
12399
12597
|
case 1:
|
|
12400
12598
|
context = _context.v;
|
|
12401
12599
|
assetInfo = context.assetInfo;
|
|
@@ -12425,11 +12623,184 @@ var createTypeAndThenCall = /*#__PURE__*/function () {
|
|
|
12425
12623
|
}
|
|
12426
12624
|
}, _callee);
|
|
12427
12625
|
}));
|
|
12428
|
-
return function createTypeAndThenCall(_x, _x2) {
|
|
12626
|
+
return function createTypeAndThenCall(_x, _x2, _x3) {
|
|
12627
|
+
return _ref.apply(this, arguments);
|
|
12628
|
+
};
|
|
12629
|
+
}();
|
|
12630
|
+
|
|
12631
|
+
/**
|
|
12632
|
+
* Choose a reserve (AssetHub or Relay) by checking the beneficiary’s balance on each.
|
|
12633
|
+
* We resolve the beneficiary account on every candidate and return the first with
|
|
12634
|
+
* balance \>= amount, or undefined if none qualify.
|
|
12635
|
+
*/
|
|
12636
|
+
var selectReserveByBalance = /*#__PURE__*/function () {
|
|
12637
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, options) {
|
|
12638
|
+
var api, assetInfo, destination, version, paraIdTo, relay, candidates, _i, _candidates, reserve, reserveApi, location, resolvedAddress, balance;
|
|
12639
|
+
return _regenerator().w(function (_context) {
|
|
12640
|
+
while (1) switch (_context.n) {
|
|
12641
|
+
case 0:
|
|
12642
|
+
api = options.api, assetInfo = options.assetInfo, destination = options.destination, version = options.version, paraIdTo = options.paraIdTo;
|
|
12643
|
+
relay = getRelayChainOf(chain);
|
|
12644
|
+
candidates = ["AssetHub".concat(relay), relay];
|
|
12645
|
+
_i = 0, _candidates = candidates;
|
|
12646
|
+
case 1:
|
|
12647
|
+
if (!(_i < _candidates.length)) {
|
|
12648
|
+
_context.n = 7;
|
|
12649
|
+
break;
|
|
12650
|
+
}
|
|
12651
|
+
reserve = _candidates[_i];
|
|
12652
|
+
reserveApi = api.clone();
|
|
12653
|
+
_context.n = 2;
|
|
12654
|
+
return reserveApi.init(reserve);
|
|
12655
|
+
case 2:
|
|
12656
|
+
location = createDestination(version, chain, destination, paraIdTo);
|
|
12657
|
+
_context.n = 3;
|
|
12658
|
+
return reserveApi.convertLocationToAccount(location);
|
|
12659
|
+
case 3:
|
|
12660
|
+
resolvedAddress = _context.v;
|
|
12661
|
+
if (resolvedAddress) {
|
|
12662
|
+
_context.n = 4;
|
|
12663
|
+
break;
|
|
12664
|
+
}
|
|
12665
|
+
return _context.a(3, 6);
|
|
12666
|
+
case 4:
|
|
12667
|
+
assertAddressIsString(resolvedAddress);
|
|
12668
|
+
_context.n = 5;
|
|
12669
|
+
return getAssetBalanceInternal({
|
|
12670
|
+
api: reserveApi,
|
|
12671
|
+
chain: reserve,
|
|
12672
|
+
address: resolvedAddress,
|
|
12673
|
+
currency: getCurrencySelection(assetInfo)
|
|
12674
|
+
});
|
|
12675
|
+
case 5:
|
|
12676
|
+
balance = _context.v;
|
|
12677
|
+
if (!(balance >= assetInfo.amount)) {
|
|
12678
|
+
_context.n = 6;
|
|
12679
|
+
break;
|
|
12680
|
+
}
|
|
12681
|
+
return _context.a(2, reserve);
|
|
12682
|
+
case 6:
|
|
12683
|
+
_i++;
|
|
12684
|
+
_context.n = 1;
|
|
12685
|
+
break;
|
|
12686
|
+
case 7:
|
|
12687
|
+
return _context.a(2, undefined);
|
|
12688
|
+
}
|
|
12689
|
+
}, _callee);
|
|
12690
|
+
}));
|
|
12691
|
+
return function selectReserveByBalance(_x, _x2) {
|
|
12429
12692
|
return _ref.apply(this, arguments);
|
|
12430
12693
|
};
|
|
12431
12694
|
}();
|
|
12432
12695
|
|
|
12696
|
+
var createCallForReserve = /*#__PURE__*/function () {
|
|
12697
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, reserveChain, options) {
|
|
12698
|
+
var api, destination, address, senderAddress, currency, feeCurrency, serialized, tx, dryRunResult, success;
|
|
12699
|
+
return _regenerator().w(function (_context) {
|
|
12700
|
+
while (1) switch (_context.n) {
|
|
12701
|
+
case 0:
|
|
12702
|
+
api = options.api, destination = options.destination, address = options.address, senderAddress = options.senderAddress, currency = options.currency, feeCurrency = options.feeCurrency;
|
|
12703
|
+
_context.n = 1;
|
|
12704
|
+
return createTypeAndThenCall(chain, options, reserveChain);
|
|
12705
|
+
case 1:
|
|
12706
|
+
serialized = _context.v;
|
|
12707
|
+
assertAddressIsString(address);
|
|
12708
|
+
assertToIsString(destination, 'Location destination is not supported for reserve auto-selection.');
|
|
12709
|
+
assertSenderAddress(senderAddress);
|
|
12710
|
+
tx = api.callTxMethod(serialized);
|
|
12711
|
+
_context.n = 2;
|
|
12712
|
+
return dryRunInternal({
|
|
12713
|
+
api: api,
|
|
12714
|
+
tx: tx,
|
|
12715
|
+
origin: chain,
|
|
12716
|
+
destination: destination,
|
|
12717
|
+
address: address,
|
|
12718
|
+
senderAddress: senderAddress,
|
|
12719
|
+
currency: currency,
|
|
12720
|
+
feeAsset: feeCurrency,
|
|
12721
|
+
useRootOrigin: true
|
|
12722
|
+
});
|
|
12723
|
+
case 2:
|
|
12724
|
+
dryRunResult = _context.v;
|
|
12725
|
+
success = !dryRunResult.failureReason;
|
|
12726
|
+
return _context.a(2, {
|
|
12727
|
+
call: serialized,
|
|
12728
|
+
success: success
|
|
12729
|
+
});
|
|
12730
|
+
}
|
|
12731
|
+
}, _callee);
|
|
12732
|
+
}));
|
|
12733
|
+
return function createCallForReserve(_x, _x2, _x3) {
|
|
12734
|
+
return _ref.apply(this, arguments);
|
|
12735
|
+
};
|
|
12736
|
+
}();
|
|
12737
|
+
/**
|
|
12738
|
+
* Creates a type-and-then call but auto-selects the asset reserve between AssetHub and the Relay chain
|
|
12739
|
+
* by dry-running both variants and preferring the one that succeeds. If both fail, returns the
|
|
12740
|
+
* AssetHub variant. Supports only relaychain assets.
|
|
12741
|
+
*/
|
|
12742
|
+
var createTypeThenAutoReserve = /*#__PURE__*/function () {
|
|
12743
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(chain, options) {
|
|
12744
|
+
var originSupports, destSupports, reserve, relay, assetHubReserve, ahResult, relayResult;
|
|
12745
|
+
return _regenerator().w(function (_context2) {
|
|
12746
|
+
while (1) switch (_context2.n) {
|
|
12747
|
+
case 0:
|
|
12748
|
+
// Use dry-run path only when BOTH origin and destination support it
|
|
12749
|
+
originSupports = hasDryRunSupport(chain);
|
|
12750
|
+
destSupports = options.destChain ? hasDryRunSupport(options.destChain) : false;
|
|
12751
|
+
if (originSupports && destSupports) {
|
|
12752
|
+
_context2.n = 5;
|
|
12753
|
+
break;
|
|
12754
|
+
}
|
|
12755
|
+
_context2.n = 1;
|
|
12756
|
+
return selectReserveByBalance(chain, options);
|
|
12757
|
+
case 1:
|
|
12758
|
+
reserve = _context2.v;
|
|
12759
|
+
if (!reserve) {
|
|
12760
|
+
_context2.n = 3;
|
|
12761
|
+
break;
|
|
12762
|
+
}
|
|
12763
|
+
_context2.n = 2;
|
|
12764
|
+
return createTypeAndThenCall(chain, options, reserve);
|
|
12765
|
+
case 2:
|
|
12766
|
+
return _context2.a(2, _context2.v);
|
|
12767
|
+
case 3:
|
|
12768
|
+
_context2.n = 4;
|
|
12769
|
+
return createTypeAndThenCall(chain, options);
|
|
12770
|
+
case 4:
|
|
12771
|
+
return _context2.a(2, _context2.v);
|
|
12772
|
+
case 5:
|
|
12773
|
+
relay = getRelayChainOf(chain);
|
|
12774
|
+
assetHubReserve = "AssetHub".concat(relay);
|
|
12775
|
+
_context2.n = 6;
|
|
12776
|
+
return createCallForReserve(chain, assetHubReserve, options);
|
|
12777
|
+
case 6:
|
|
12778
|
+
ahResult = _context2.v;
|
|
12779
|
+
if (!ahResult.success) {
|
|
12780
|
+
_context2.n = 7;
|
|
12781
|
+
break;
|
|
12782
|
+
}
|
|
12783
|
+
return _context2.a(2, ahResult.call);
|
|
12784
|
+
case 7:
|
|
12785
|
+
_context2.n = 8;
|
|
12786
|
+
return createCallForReserve(chain, relay, options);
|
|
12787
|
+
case 8:
|
|
12788
|
+
relayResult = _context2.v;
|
|
12789
|
+
if (!relayResult.success) {
|
|
12790
|
+
_context2.n = 9;
|
|
12791
|
+
break;
|
|
12792
|
+
}
|
|
12793
|
+
return _context2.a(2, relayResult.call);
|
|
12794
|
+
case 9:
|
|
12795
|
+
return _context2.a(2, ahResult.call);
|
|
12796
|
+
}
|
|
12797
|
+
}, _callee2);
|
|
12798
|
+
}));
|
|
12799
|
+
return function createTypeThenAutoReserve(_x4, _x5) {
|
|
12800
|
+
return _ref2.apply(this, arguments);
|
|
12801
|
+
};
|
|
12802
|
+
}();
|
|
12803
|
+
|
|
12433
12804
|
var calculateTotalXcmFee = function calculateTotalXcmFee(feeResult) {
|
|
12434
12805
|
var _feeResult$assetHub;
|
|
12435
12806
|
var totalFee = 0n;
|
|
@@ -13487,4 +13858,4 @@ var Builder = function Builder(api) {
|
|
|
13487
13858
|
return new GeneralBuilder(api, new BatchTransactionManager());
|
|
13488
13859
|
};
|
|
13489
13860
|
|
|
13490
|
-
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, createTx, 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 };
|
|
13861
|
+
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, createTx, createTypeAndThenCall, createTypeThenAutoReserve, 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 };
|