@paraspell/sdk-core 14.4.4 → 14.5.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.d.ts +87 -48
- package/dist/index.mjs +1156 -1027
- package/package.json +10 -10
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { blake2b } from '@noble/hashes/blake2.js';
|
|
2
|
-
import { isChainEvm, getAssetsObject, InvalidCurrencyError, isAssetEqual, isSymbolMatch, isStableCoinAsset, isAdditionalSubstrateBridgeAsset, isBridgedSystemAsset, STABLECOIN_IDS, isSymbolSpecifier, normalizeLocation, getNativeAssetSymbol, extractAssetLocation,
|
|
2
|
+
import { isChainEvm, getAssetsObject, InvalidCurrencyError, isAssetEqual, isSymbolMatch, isStableCoinAsset, isAdditionalSubstrateBridgeAsset, isBridgedSystemAsset, STABLECOIN_IDS, isSymbolSpecifier, normalizeLocation, getNativeAssetSymbol, extractAssetLocation, normalizeSymbol, Native, getOtherAssets, canonicalizeLocation, getAssetsObjectImpl, getAssetsImpl, getNativeAssetsImpl, getOtherAssetsImpl, findAssetInfoImpl, findAssetInfoOrThrowImpl, findAssetInfoOnDestImpl, findAssetOnDestOrThrowImpl, findNativeAssetInfoImpl, findNativeAssetInfoOrThrowImpl, isChainEvmImpl, getNativeAssetSymbolImpl, getRelayChainSymbolImpl, hasDryRunSupportImpl, hasXcmPaymentApiSupportImpl, getExistentialDepositImpl, normalizeCustomAssets } from '@paraspell/assets';
|
|
3
3
|
export * from '@paraspell/assets';
|
|
4
4
|
import { base58 } from '@scure/base';
|
|
5
5
|
import { isAddress, isHex, createPublicClient, http, formatUnits as formatUnits$1, parseUnits as parseUnits$1, stringToHex, numberToBytes } from 'viem';
|
|
6
6
|
import { ParaSpellError, isTLocation, replaceBigInt, isExternalChain, CHAINS, Version, isRelayChain, isSubstrateBridge, Parents, deepEqual, isTrustedChain, isCustomChain, isSnowbridge, getJunctionValue, hasJunction, ETHEREUM_BRIDGE_ORIGINS, isBridge, isSubstrateChain, flattenJunctions, RELAYCHAINS, DEFAULT_SS58_PREFIX } from '@paraspell/sdk-common';
|
|
7
7
|
export * from '@paraspell/sdk-common';
|
|
8
|
-
import { getOtherAssetsPallets, getNativeAssetsPallet, BRIDGE_PALLETS, getPalletIndex,
|
|
8
|
+
import { getOtherAssetsPallets, getNativeAssetsPallet, BRIDGE_PALLETS, getPalletIndex, getSupportedPalletsDetails, getXcmPallet, ASSETS_PALLETS, NATIVE_ASSETS_PALLET_PRIORITY, OTHER_ASSETS_PALLET_PRIORITY, hasPalletImpl, getXcmPalletImpl } from '@paraspell/pallets';
|
|
9
9
|
export * from '@paraspell/pallets';
|
|
10
10
|
import { mainnet, sepolia } from 'viem/chains';
|
|
11
|
-
import {
|
|
11
|
+
import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js';
|
|
12
12
|
import { keccak_256 } from '@noble/hashes/sha3.js';
|
|
13
13
|
|
|
14
14
|
function _arrayLikeToArray(r, a) {
|
|
@@ -1041,13 +1041,13 @@ var Centrifuge$1 = {
|
|
|
1041
1041
|
info: "centrifuge",
|
|
1042
1042
|
paraId: 2031,
|
|
1043
1043
|
providers: [
|
|
1044
|
-
{
|
|
1045
|
-
name: "LuckyFriday",
|
|
1046
|
-
endpoint: "wss://rpc-centrifuge.luckyfriday.io"
|
|
1047
|
-
},
|
|
1048
1044
|
{
|
|
1049
1045
|
name: "OnFinality",
|
|
1050
1046
|
endpoint: "wss://centrifuge-parachain.api.onfinality.io/public-ws"
|
|
1047
|
+
},
|
|
1048
|
+
{
|
|
1049
|
+
name: "Centrifuge",
|
|
1050
|
+
endpoint: "wss://fullnode.centrifuge.io"
|
|
1051
1051
|
}
|
|
1052
1052
|
]
|
|
1053
1053
|
};
|
|
@@ -1679,6 +1679,17 @@ var PeoplePaseo$1 = {
|
|
|
1679
1679
|
}
|
|
1680
1680
|
]
|
|
1681
1681
|
};
|
|
1682
|
+
var Shibuya$1 = {
|
|
1683
|
+
name: "Shibuya Testnet (Astar)",
|
|
1684
|
+
info: "PaseoShibuyaChain",
|
|
1685
|
+
paraId: 2000,
|
|
1686
|
+
providers: [
|
|
1687
|
+
{
|
|
1688
|
+
name: "Astar",
|
|
1689
|
+
endpoint: "wss://rpc.shibuya.astar.network"
|
|
1690
|
+
}
|
|
1691
|
+
]
|
|
1692
|
+
};
|
|
1682
1693
|
var Polkadot$1 = {
|
|
1683
1694
|
name: "Polkadot Relay",
|
|
1684
1695
|
info: "polkadot",
|
|
@@ -1843,6 +1854,7 @@ var configs = {
|
|
|
1843
1854
|
HeimaPaseo: HeimaPaseo$1,
|
|
1844
1855
|
HydrationPaseo: HydrationPaseo$1,
|
|
1845
1856
|
PeoplePaseo: PeoplePaseo$1,
|
|
1857
|
+
Shibuya: Shibuya$1,
|
|
1846
1858
|
Polkadot: Polkadot$1,
|
|
1847
1859
|
Kusama: Kusama$1,
|
|
1848
1860
|
Westend: Westend$1,
|
|
@@ -2099,10 +2111,18 @@ var createTransactInstructions = /*#__PURE__*/function () {
|
|
|
2099
2111
|
};
|
|
2100
2112
|
}();
|
|
2101
2113
|
|
|
2102
|
-
var BaseAssetsPallet = /*#__PURE__*/
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2114
|
+
var BaseAssetsPallet = /*#__PURE__*/function () {
|
|
2115
|
+
function BaseAssetsPallet(palletName) {
|
|
2116
|
+
_classCallCheck(this, BaseAssetsPallet);
|
|
2117
|
+
this.palletName = palletName;
|
|
2118
|
+
}
|
|
2119
|
+
return _createClass(BaseAssetsPallet, [{
|
|
2120
|
+
key: "getAssetState",
|
|
2121
|
+
value: function getAssetState(_api, _asset) {
|
|
2122
|
+
throw new UnsupportedOperationError("getAssetState is not implemented for ".concat(this.palletName, " pallet"));
|
|
2123
|
+
}
|
|
2124
|
+
}]);
|
|
2125
|
+
}();
|
|
2106
2126
|
|
|
2107
2127
|
var AssetManagerPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
2108
2128
|
function AssetManagerPallet() {
|
|
@@ -2140,11 +2160,6 @@ var AssetManagerPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
|
2140
2160
|
}]);
|
|
2141
2161
|
}(BaseAssetsPallet);
|
|
2142
2162
|
|
|
2143
|
-
var resolveAssetId = function resolveAssetId(asset, config) {
|
|
2144
|
-
if (config.useLocationId) return asset.location;
|
|
2145
|
-
assertHasId(asset);
|
|
2146
|
-
return config.useBigIntId ? BigInt(asset.assetId) : Number(asset.assetId);
|
|
2147
|
-
};
|
|
2148
2163
|
var AssetsPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
2149
2164
|
function AssetsPallet() {
|
|
2150
2165
|
_classCallCheck(this, AssetsPallet);
|
|
@@ -2152,11 +2167,53 @@ var AssetsPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
|
2152
2167
|
}
|
|
2153
2168
|
_inherits(AssetsPallet, _BaseAssetsPallet);
|
|
2154
2169
|
return _createClass(AssetsPallet, [{
|
|
2170
|
+
key: "resolveMintId",
|
|
2171
|
+
value: function resolveMintId(asset, api, chain, config) {
|
|
2172
|
+
if (config.useLocationId) return api.localizeLocation(chain.chain, asset.location);
|
|
2173
|
+
assertHasId(asset);
|
|
2174
|
+
return config.useBigIntId ? BigInt(asset.assetId) : Number(asset.assetId);
|
|
2175
|
+
}
|
|
2176
|
+
}, {
|
|
2177
|
+
key: "queryWithAssetId",
|
|
2178
|
+
value: function () {
|
|
2179
|
+
var _queryWithAssetId = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(asset, query) {
|
|
2180
|
+
var _t;
|
|
2181
|
+
return _regenerator().w(function (_context) {
|
|
2182
|
+
while (1) switch (_context.p = _context.n) {
|
|
2183
|
+
case 0:
|
|
2184
|
+
assertHasId(asset);
|
|
2185
|
+
// Try with number ID first, if it fails, try with bigint ID
|
|
2186
|
+
_context.p = 1;
|
|
2187
|
+
_context.n = 2;
|
|
2188
|
+
return query(Number(asset.assetId));
|
|
2189
|
+
case 2:
|
|
2190
|
+
return _context.a(2, _context.v);
|
|
2191
|
+
case 3:
|
|
2192
|
+
_context.p = 3;
|
|
2193
|
+
_t = _context.v;
|
|
2194
|
+
if (!(_t instanceof Error && (_t.message.includes('Incompatible runtime entry') || _t.message.includes('API Compatibility Error') || _t.message.includes('Number needs to be an integer')))) {
|
|
2195
|
+
_context.n = 4;
|
|
2196
|
+
break;
|
|
2197
|
+
}
|
|
2198
|
+
return _context.a(2, query(BigInt(asset.assetId)));
|
|
2199
|
+
case 4:
|
|
2200
|
+
throw _t;
|
|
2201
|
+
case 5:
|
|
2202
|
+
return _context.a(2);
|
|
2203
|
+
}
|
|
2204
|
+
}, _callee, null, [[1, 3]]);
|
|
2205
|
+
}));
|
|
2206
|
+
function queryWithAssetId(_x, _x2) {
|
|
2207
|
+
return _queryWithAssetId.apply(this, arguments);
|
|
2208
|
+
}
|
|
2209
|
+
return queryWithAssetId;
|
|
2210
|
+
}()
|
|
2211
|
+
}, {
|
|
2155
2212
|
key: "mint",
|
|
2156
2213
|
value: function mint(api, address, asset, _balance, chain) {
|
|
2157
2214
|
var amount = asset.amount;
|
|
2158
2215
|
var config = chain.resolveMintConfig(api);
|
|
2159
|
-
var id =
|
|
2216
|
+
var id = this.resolveMintId(asset, api, chain, config);
|
|
2160
2217
|
var addr = config.useIdPrefix ? {
|
|
2161
2218
|
Id: address
|
|
2162
2219
|
} : address;
|
|
@@ -2175,6 +2232,7 @@ var AssetsPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
|
2175
2232
|
is_frozen: false
|
|
2176
2233
|
}
|
|
2177
2234
|
},
|
|
2235
|
+
forceOrigin: config.forceOrigin,
|
|
2178
2236
|
balanceTx: {
|
|
2179
2237
|
module: this.palletName,
|
|
2180
2238
|
method: 'mint',
|
|
@@ -2189,55 +2247,64 @@ var AssetsPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
|
2189
2247
|
}, {
|
|
2190
2248
|
key: "getBalance",
|
|
2191
2249
|
value: function () {
|
|
2192
|
-
var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function
|
|
2193
|
-
var _this = this
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
while (1) switch (_context.p = _context.n) {
|
|
2250
|
+
var _getBalance = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(api, address, asset) {
|
|
2251
|
+
var _this = this;
|
|
2252
|
+
var balance, value;
|
|
2253
|
+
return _regenerator().w(function (_context2) {
|
|
2254
|
+
while (1) switch (_context2.n) {
|
|
2198
2255
|
case 0:
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
var useBigInt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
2256
|
+
_context2.n = 1;
|
|
2257
|
+
return this.queryWithAssetId(asset, function (id) {
|
|
2202
2258
|
return api.queryState({
|
|
2203
2259
|
module: _this.palletName,
|
|
2204
2260
|
method: 'Account',
|
|
2205
|
-
params: [
|
|
2261
|
+
params: [id, address]
|
|
2206
2262
|
});
|
|
2207
|
-
};
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
balance = _context.v;
|
|
2213
|
-
_context.n = 6;
|
|
2214
|
-
break;
|
|
2215
|
-
case 3:
|
|
2216
|
-
_context.p = 3;
|
|
2217
|
-
_t = _context.v;
|
|
2218
|
-
if (!(_t instanceof Error && (_t.message.includes('Incompatible runtime entry') || _t.message.includes('API Compatibility Error') || _t.message.includes('Number needs to be an integer')))) {
|
|
2219
|
-
_context.n = 5;
|
|
2220
|
-
break;
|
|
2221
|
-
}
|
|
2222
|
-
_context.n = 4;
|
|
2223
|
-
return fetchBalance(true);
|
|
2224
|
-
case 4:
|
|
2225
|
-
balance = _context.v;
|
|
2226
|
-
_context.n = 6;
|
|
2227
|
-
break;
|
|
2228
|
-
case 5:
|
|
2229
|
-
throw _t;
|
|
2230
|
-
case 6:
|
|
2231
|
-
value = (_balance2 = balance) === null || _balance2 === void 0 ? void 0 : _balance2.balance;
|
|
2232
|
-
return _context.a(2, value !== undefined ? BigInt(value) : 0n);
|
|
2263
|
+
});
|
|
2264
|
+
case 1:
|
|
2265
|
+
balance = _context2.v;
|
|
2266
|
+
value = balance === null || balance === void 0 ? void 0 : balance.balance;
|
|
2267
|
+
return _context2.a(2, value !== undefined ? BigInt(value) : 0n);
|
|
2233
2268
|
}
|
|
2234
|
-
},
|
|
2269
|
+
}, _callee2, this);
|
|
2235
2270
|
}));
|
|
2236
|
-
function getBalance(
|
|
2271
|
+
function getBalance(_x3, _x4, _x5) {
|
|
2237
2272
|
return _getBalance.apply(this, arguments);
|
|
2238
2273
|
}
|
|
2239
2274
|
return getBalance;
|
|
2240
2275
|
}()
|
|
2276
|
+
}, {
|
|
2277
|
+
key: "getAssetState",
|
|
2278
|
+
value: function () {
|
|
2279
|
+
var _getAssetState = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(api, asset) {
|
|
2280
|
+
var _this2 = this,
|
|
2281
|
+
_ref,
|
|
2282
|
+
_details$is_sufficien;
|
|
2283
|
+
var details;
|
|
2284
|
+
return _regenerator().w(function (_context3) {
|
|
2285
|
+
while (1) switch (_context3.n) {
|
|
2286
|
+
case 0:
|
|
2287
|
+
_context3.n = 1;
|
|
2288
|
+
return this.queryWithAssetId(asset, function (id) {
|
|
2289
|
+
return api.queryState({
|
|
2290
|
+
module: _this2.palletName,
|
|
2291
|
+
method: 'Asset',
|
|
2292
|
+
params: [id]
|
|
2293
|
+
});
|
|
2294
|
+
});
|
|
2295
|
+
case 1:
|
|
2296
|
+
details = _context3.v;
|
|
2297
|
+
return _context3.a(2, details ? {
|
|
2298
|
+
isSufficient: (_ref = (_details$is_sufficien = details.is_sufficient) !== null && _details$is_sufficien !== void 0 ? _details$is_sufficien : details.isSufficient) !== null && _ref !== void 0 ? _ref : false
|
|
2299
|
+
} : undefined);
|
|
2300
|
+
}
|
|
2301
|
+
}, _callee3, this);
|
|
2302
|
+
}));
|
|
2303
|
+
function getAssetState(_x6, _x7) {
|
|
2304
|
+
return _getAssetState.apply(this, arguments);
|
|
2305
|
+
}
|
|
2306
|
+
return getAssetState;
|
|
2307
|
+
}()
|
|
2241
2308
|
}]);
|
|
2242
2309
|
}(BaseAssetsPallet);
|
|
2243
2310
|
|
|
@@ -2354,76 +2421,24 @@ var CurrenciesPallet = /*#__PURE__*/function (_BaseAssetsPallet) {
|
|
|
2354
2421
|
}]);
|
|
2355
2422
|
}(BaseAssetsPallet);
|
|
2356
2423
|
|
|
2357
|
-
var ForeignAssetsPallet = /*#__PURE__*/function (
|
|
2424
|
+
var ForeignAssetsPallet = /*#__PURE__*/function (_AssetsPallet) {
|
|
2358
2425
|
function ForeignAssetsPallet() {
|
|
2359
2426
|
_classCallCheck(this, ForeignAssetsPallet);
|
|
2360
2427
|
return _callSuper(this, ForeignAssetsPallet, arguments);
|
|
2361
2428
|
}
|
|
2362
|
-
_inherits(ForeignAssetsPallet,
|
|
2429
|
+
_inherits(ForeignAssetsPallet, _AssetsPallet);
|
|
2363
2430
|
return _createClass(ForeignAssetsPallet, [{
|
|
2364
|
-
key: "
|
|
2365
|
-
value: function
|
|
2366
|
-
|
|
2367
|
-
amount = asset.amount;
|
|
2368
|
-
var _chain$resolveMintCon = chain.resolveMintConfig(api),
|
|
2369
|
-
useIdPrefix = _chain$resolveMintCon.useIdPrefix;
|
|
2370
|
-
var addr = useIdPrefix ? {
|
|
2371
|
-
Id: address
|
|
2372
|
-
} : address;
|
|
2373
|
-
return Promise.resolve({
|
|
2374
|
-
assetStatusTx: {
|
|
2375
|
-
module: this.palletName,
|
|
2376
|
-
method: 'force_asset_status',
|
|
2377
|
-
params: {
|
|
2378
|
-
id: location,
|
|
2379
|
-
owner: addr,
|
|
2380
|
-
issuer: addr,
|
|
2381
|
-
admin: addr,
|
|
2382
|
-
freezer: addr,
|
|
2383
|
-
min_balance: 0n,
|
|
2384
|
-
is_sufficient: true,
|
|
2385
|
-
is_frozen: false
|
|
2386
|
-
}
|
|
2387
|
-
},
|
|
2388
|
-
balanceTx: {
|
|
2389
|
-
module: this.palletName,
|
|
2390
|
-
method: 'mint',
|
|
2391
|
-
params: {
|
|
2392
|
-
id: location,
|
|
2393
|
-
beneficiary: addr,
|
|
2394
|
-
amount: amount
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
});
|
|
2431
|
+
key: "resolveMintId",
|
|
2432
|
+
value: function resolveMintId(asset) {
|
|
2433
|
+
return asset.location;
|
|
2398
2434
|
}
|
|
2399
2435
|
}, {
|
|
2400
|
-
key: "
|
|
2401
|
-
value: function () {
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
return _regenerator().w(function (_context) {
|
|
2405
|
-
while (1) switch (_context.n) {
|
|
2406
|
-
case 0:
|
|
2407
|
-
_context.n = 1;
|
|
2408
|
-
return api.queryState({
|
|
2409
|
-
module: this.palletName,
|
|
2410
|
-
method: 'Account',
|
|
2411
|
-
params: [asset.location, address]
|
|
2412
|
-
});
|
|
2413
|
-
case 1:
|
|
2414
|
-
balance = _context.v;
|
|
2415
|
-
value = balance === null || balance === void 0 ? void 0 : balance.balance;
|
|
2416
|
-
return _context.a(2, value !== undefined ? BigInt(value) : 0n);
|
|
2417
|
-
}
|
|
2418
|
-
}, _callee, this);
|
|
2419
|
-
}));
|
|
2420
|
-
function getBalance(_x, _x2, _x3) {
|
|
2421
|
-
return _getBalance.apply(this, arguments);
|
|
2422
|
-
}
|
|
2423
|
-
return getBalance;
|
|
2424
|
-
}()
|
|
2436
|
+
key: "queryWithAssetId",
|
|
2437
|
+
value: function queryWithAssetId(asset, query) {
|
|
2438
|
+
return query(asset.location);
|
|
2439
|
+
}
|
|
2425
2440
|
}]);
|
|
2426
|
-
}(
|
|
2441
|
+
}(AssetsPallet);
|
|
2427
2442
|
|
|
2428
2443
|
var FungiblesPallet = /*#__PURE__*/function (_AssetsPallet) {
|
|
2429
2444
|
function FungiblesPallet() {
|
|
@@ -2432,31 +2447,10 @@ var FungiblesPallet = /*#__PURE__*/function (_AssetsPallet) {
|
|
|
2432
2447
|
}
|
|
2433
2448
|
_inherits(FungiblesPallet, _AssetsPallet);
|
|
2434
2449
|
return _createClass(FungiblesPallet, [{
|
|
2435
|
-
key: "
|
|
2436
|
-
value: function () {
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
var balance;
|
|
2440
|
-
return _regenerator().w(function (_context) {
|
|
2441
|
-
while (1) switch (_context.n) {
|
|
2442
|
-
case 0:
|
|
2443
|
-
_context.n = 1;
|
|
2444
|
-
return api.queryState({
|
|
2445
|
-
module: this.palletName,
|
|
2446
|
-
method: 'Account',
|
|
2447
|
-
params: [asset.location, address]
|
|
2448
|
-
});
|
|
2449
|
-
case 1:
|
|
2450
|
-
balance = _context.v;
|
|
2451
|
-
return _context.a(2, (_balance$balance = balance === null || balance === void 0 ? void 0 : balance.balance) !== null && _balance$balance !== void 0 ? _balance$balance : 0n);
|
|
2452
|
-
}
|
|
2453
|
-
}, _callee, this);
|
|
2454
|
-
}));
|
|
2455
|
-
function getBalance(_x, _x2, _x3) {
|
|
2456
|
-
return _getBalance.apply(this, arguments);
|
|
2457
|
-
}
|
|
2458
|
-
return getBalance;
|
|
2459
|
-
}()
|
|
2450
|
+
key: "queryWithAssetId",
|
|
2451
|
+
value: function queryWithAssetId(asset, query) {
|
|
2452
|
+
return query(asset.location);
|
|
2453
|
+
}
|
|
2460
2454
|
}]);
|
|
2461
2455
|
}(AssetsPallet);
|
|
2462
2456
|
|
|
@@ -2912,11 +2906,11 @@ var SubstrateChain = /*#__PURE__*/function (_Chain) {
|
|
|
2912
2906
|
key: "transferLocal",
|
|
2913
2907
|
value: function () {
|
|
2914
2908
|
var _transferLocal = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(options) {
|
|
2915
|
-
var api, asset, feeAsset, recipient, sender, isAmountAll, keepAlive, validatedOptions, isNativeAsset, balance, localOptions;
|
|
2909
|
+
var api, asset, feeAsset, recipient, sender, isAmountAll, isDryRunBypass, keepAlive, validatedOptions, isNativeAsset, balance, localOptions;
|
|
2916
2910
|
return _regenerator().w(function (_context2) {
|
|
2917
2911
|
while (1) switch (_context2.n) {
|
|
2918
2912
|
case 0:
|
|
2919
|
-
api = options.api, asset = options.assetInfo, feeAsset = options.feeAsset, recipient = options.recipient, sender = options.sender, isAmountAll = options.isAmountAll, keepAlive = options.keepAlive;
|
|
2913
|
+
api = options.api, asset = options.assetInfo, feeAsset = options.feeAsset, recipient = options.recipient, sender = options.sender, isAmountAll = options.isAmountAll, isDryRunBypass = options.isDryRunBypass, keepAlive = options.keepAlive;
|
|
2920
2914
|
if (!isTLocation(recipient)) {
|
|
2921
2915
|
_context2.n = 1;
|
|
2922
2916
|
break;
|
|
@@ -2942,6 +2936,9 @@ var SubstrateChain = /*#__PURE__*/function (_Chain) {
|
|
|
2942
2936
|
return this.getBalance(api, sender, asset);
|
|
2943
2937
|
case 3:
|
|
2944
2938
|
balance = _context2.v;
|
|
2939
|
+
if (isDryRunBypass && !isAmountAll) {
|
|
2940
|
+
balance += calcSentAssetPreviewMint(asset, balance, keepAlive);
|
|
2941
|
+
}
|
|
2945
2942
|
_context2.n = 5;
|
|
2946
2943
|
break;
|
|
2947
2944
|
case 4:
|
|
@@ -3531,11 +3528,11 @@ var resolveTransferParams = function resolveTransferParams(options) {
|
|
|
3531
3528
|
};
|
|
3532
3529
|
var createTransfer = /*#__PURE__*/function () {
|
|
3533
3530
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
3534
|
-
var api, origin, currency, feeAsset, recipient, destination, paraIdTo, sender, ahAddress, pallet, method, transactOptions, isAmountAll, keepAlive, _resolveTransferParam, resolvedFeeAsset, resolvedVersion, overriddenAsset, normalizedAsset, customCtx, chainInstance;
|
|
3531
|
+
var api, origin, currency, feeAsset, recipient, destination, paraIdTo, sender, ahAddress, pallet, method, transactOptions, isAmountAll, isDryRunBypass, keepAlive, _resolveTransferParam, resolvedFeeAsset, resolvedVersion, overriddenAsset, normalizedAsset, customCtx, chainInstance;
|
|
3535
3532
|
return _regenerator().w(function (_context) {
|
|
3536
3533
|
while (1) switch (_context.n) {
|
|
3537
3534
|
case 0:
|
|
3538
|
-
api = options.api, origin = options.from, currency = options.currency, feeAsset = options.feeAsset, recipient = options.recipient, destination = options.to, paraIdTo = options.paraIdTo, sender = options.sender, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method, transactOptions = options.transactOptions, isAmountAll = options.isAmountAll, keepAlive = options.keepAlive;
|
|
3535
|
+
api = options.api, origin = options.from, currency = options.currency, feeAsset = options.feeAsset, recipient = options.recipient, destination = options.to, paraIdTo = options.paraIdTo, sender = options.sender, ahAddress = options.ahAddress, pallet = options.pallet, method = options.method, transactOptions = options.transactOptions, isAmountAll = options.isAmountAll, isDryRunBypass = options.isDryRunBypass, keepAlive = options.keepAlive;
|
|
3539
3536
|
validateCurrency(currency, feeAsset);
|
|
3540
3537
|
_context.n = 1;
|
|
3541
3538
|
return api.init(origin, TX_CLIENT_TIMEOUT_MS, destination);
|
|
@@ -3560,6 +3557,7 @@ var createTransfer = /*#__PURE__*/function () {
|
|
|
3560
3557
|
method: method,
|
|
3561
3558
|
transactOptions: transactOptions,
|
|
3562
3559
|
isAmountAll: isAmountAll,
|
|
3560
|
+
isDryRunBypass: isDryRunBypass,
|
|
3563
3561
|
keepAlive: keepAlive
|
|
3564
3562
|
}));
|
|
3565
3563
|
}
|
|
@@ -4532,7 +4530,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4532
4530
|
key: "dryRunPreview",
|
|
4533
4531
|
value: function () {
|
|
4534
4532
|
var _dryRunPreview = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee0(dryRunOptions) {
|
|
4535
|
-
var _this$_options6, from, senderSource, swapOptions, _yield$
|
|
4533
|
+
var _this$_options6, from, senderSource, swapOptions, _yield$GeneralBuilder, tx, options;
|
|
4536
4534
|
return _regenerator().w(function (_context0) {
|
|
4537
4535
|
while (1) switch (_context0.n) {
|
|
4538
4536
|
case 0:
|
|
@@ -4551,11 +4549,13 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4551
4549
|
}));
|
|
4552
4550
|
case 1:
|
|
4553
4551
|
_context0.n = 2;
|
|
4554
|
-
return this.
|
|
4552
|
+
return new GeneralBuilder(this.api, this.batchManager, _objectSpread2(_objectSpread2({}, this._options), {}, {
|
|
4553
|
+
isDryRunBypass: true
|
|
4554
|
+
})).buildInternal();
|
|
4555
4555
|
case 2:
|
|
4556
|
-
_yield$
|
|
4557
|
-
tx = _yield$
|
|
4558
|
-
options = _yield$
|
|
4556
|
+
_yield$GeneralBuilder = _context0.v;
|
|
4557
|
+
tx = _yield$GeneralBuilder.tx;
|
|
4558
|
+
options = _yield$GeneralBuilder.options;
|
|
4559
4559
|
return _context0.a(2, buildDryRun(this.api, tx, _objectSpread2(_objectSpread2({}, options), {}, {
|
|
4560
4560
|
from: from
|
|
4561
4561
|
}), {
|
|
@@ -4574,10 +4574,13 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4574
4574
|
key: "createTxFactory",
|
|
4575
4575
|
value: function createTxFactory() {
|
|
4576
4576
|
var _this = this;
|
|
4577
|
-
return function (amount, relative) {
|
|
4577
|
+
return function (amount, relative, isDryRunBypass) {
|
|
4578
|
+
var builder = isDryRunBypass ? new GeneralBuilder(_this.api, _this.batchManager, _objectSpread2(_objectSpread2({}, _this._options), {}, {
|
|
4579
|
+
isDryRunBypass: isDryRunBypass
|
|
4580
|
+
})) : _this;
|
|
4578
4581
|
return createTxOverrideAmount(_objectSpread2(_objectSpread2({}, _this._options), {}, {
|
|
4579
4582
|
api: _this.api
|
|
4580
|
-
}),
|
|
4583
|
+
}), builder, amount, relative);
|
|
4581
4584
|
};
|
|
4582
4585
|
}
|
|
4583
4586
|
/**
|
|
@@ -4955,7 +4958,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4955
4958
|
key: "signAndSubmit",
|
|
4956
4959
|
value: function () {
|
|
4957
4960
|
var _signAndSubmit = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee17() {
|
|
4958
|
-
var _this$_options8, from, senderSource, swapOptions, txHashes, _yield$this$
|
|
4961
|
+
var _this$_options8, from, senderSource, swapOptions, txHashes, _yield$this$buildInte2, tx;
|
|
4959
4962
|
return _regenerator().w(function (_context17) {
|
|
4960
4963
|
while (1) switch (_context17.n) {
|
|
4961
4964
|
case 0:
|
|
@@ -4993,8 +4996,8 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
4993
4996
|
_context17.n = 5;
|
|
4994
4997
|
return this.buildInternal();
|
|
4995
4998
|
case 5:
|
|
4996
|
-
_yield$this$
|
|
4997
|
-
tx = _yield$this$
|
|
4999
|
+
_yield$this$buildInte2 = _context17.v;
|
|
5000
|
+
tx = _yield$this$buildInte2.tx;
|
|
4998
5001
|
return _context17.a(2, this.api.signAndSubmit(tx, senderSource));
|
|
4999
5002
|
}
|
|
5000
5003
|
}, _callee17, this);
|
|
@@ -5008,7 +5011,7 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
5008
5011
|
key: "signAndSubmitAll",
|
|
5009
5012
|
value: function () {
|
|
5010
5013
|
var _signAndSubmitAll = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee18() {
|
|
5011
|
-
var _this$_options9, from, senderSource, swapOptions, hash, _yield$this$
|
|
5014
|
+
var _this$_options9, from, senderSource, swapOptions, hash, _yield$this$buildInte3, tx, txHash;
|
|
5012
5015
|
return _regenerator().w(function (_context18) {
|
|
5013
5016
|
while (1) switch (_context18.n) {
|
|
5014
5017
|
case 0:
|
|
@@ -5046,8 +5049,8 @@ var GeneralBuilder = /*#__PURE__*/function () {
|
|
|
5046
5049
|
_context18.n = 5;
|
|
5047
5050
|
return this.buildInternal();
|
|
5048
5051
|
case 5:
|
|
5049
|
-
_yield$this$
|
|
5050
|
-
tx = _yield$this$
|
|
5052
|
+
_yield$this$buildInte3 = _context18.v;
|
|
5053
|
+
tx = _yield$this$buildInte3.tx;
|
|
5051
5054
|
_context18.n = 6;
|
|
5052
5055
|
return this.api.signAndSubmit(tx, senderSource);
|
|
5053
5056
|
case 6:
|
|
@@ -6080,83 +6083,430 @@ var dryRunOrigin = /*#__PURE__*/function () {
|
|
|
6080
6083
|
};
|
|
6081
6084
|
}();
|
|
6082
6085
|
|
|
6083
|
-
var parseUnits = parseUnits$1;
|
|
6084
|
-
var formatUnits = formatUnits$1;
|
|
6085
|
-
|
|
6086
|
-
var resolveBypassMintAmount = function resolveBypassMintAmount(chain) {
|
|
6087
|
-
return HIGH_BYPASS_MINT_CHAINS.some(function (c) {
|
|
6088
|
-
return c === chain;
|
|
6089
|
-
}) ? HIGH_BYPASS_MINT_AMOUNT : BYPASS_MINT_AMOUNT;
|
|
6090
|
-
};
|
|
6091
|
-
var createMintTxs = function createMintTxs(chain, asset, balance, address, api) {
|
|
6092
|
-
return getSubstrateChainImpl(chain, api._customCtx).mint(api, address, asset, balance);
|
|
6093
|
-
};
|
|
6094
|
-
var createRequiredMintTxs = function createRequiredMintTxs(chain, asset, amountHuman, balance, address, api) {
|
|
6095
|
-
var amount = parseUnits(amountHuman, asset.decimals);
|
|
6096
|
-
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
6097
|
-
amount: amount
|
|
6098
|
-
}), balance, address, api);
|
|
6099
|
-
};
|
|
6100
|
-
var createOptionalMintTxs = function createOptionalMintTxs(chain, currency, amountHuman, balance, address, api) {
|
|
6101
|
-
var asset = api.findAssetInfo(chain, currency);
|
|
6102
|
-
if (!asset) return null;
|
|
6103
|
-
var amount = parseUnits(amountHuman, asset.decimals);
|
|
6104
|
-
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
6105
|
-
amount: amount
|
|
6106
|
-
}), balance, address, api);
|
|
6107
|
-
};
|
|
6108
|
-
var resultToExtrinsics = function resultToExtrinsics(api, address, _ref) {
|
|
6109
|
-
var assetStatusTx = _ref.assetStatusTx,
|
|
6110
|
-
balanceTx = _ref.balanceTx;
|
|
6111
|
-
return [].concat(_toConsumableArray(assetStatusTx ? [api.deserializeExtrinsics(assetStatusTx)] : []), _toConsumableArray(assetStatusTx ? [api.callDispatchAsMethod(api.deserializeExtrinsics(balanceTx), address)] : [api.deserializeExtrinsics(balanceTx)]));
|
|
6112
|
-
};
|
|
6113
6086
|
var calcPreviewMintAmount = function calcPreviewMintAmount(balance, desired) {
|
|
6114
|
-
// Ensure mint amount is at least 2 to avoid Rust panic
|
|
6115
6087
|
if (desired <= 0n) return null;
|
|
6116
6088
|
var missing = desired - balance;
|
|
6117
6089
|
return missing > 0n ? missing : null;
|
|
6118
6090
|
};
|
|
6119
|
-
var
|
|
6120
|
-
|
|
6121
|
-
var
|
|
6122
|
-
var
|
|
6123
|
-
|
|
6124
|
-
parents: Parents.ONE,
|
|
6125
|
-
interior: {
|
|
6126
|
-
Here: null
|
|
6127
|
-
}
|
|
6128
|
-
}
|
|
6129
|
-
}, null);
|
|
6130
|
-
var seen = new Set();
|
|
6131
|
-
var preminted = [_native, relay, feeAsset].filter(function (a) {
|
|
6132
|
-
return !!a;
|
|
6133
|
-
}).filter(function (a) {
|
|
6134
|
-
var k = JSON.stringify(a.location, replaceBigInt);
|
|
6135
|
-
if (seen.has(k)) return false;
|
|
6136
|
-
seen.add(k);
|
|
6137
|
-
return true;
|
|
6138
|
-
});
|
|
6139
|
-
return preminted.some(function (a) {
|
|
6140
|
-
return isAssetEqual(a, sent);
|
|
6141
|
-
}) ? parseUnits(resolveBypassMintAmount(chain), sent.decimals) : 0n;
|
|
6091
|
+
var calcSentAssetPreviewMint = function calcSentAssetPreviewMint(asset, balance) {
|
|
6092
|
+
var _calcPreviewMintAmoun;
|
|
6093
|
+
var keepAlive = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
6094
|
+
var keepAliveBuffer = keepAlive ? BigInt(asset.existentialDeposit) : 0n;
|
|
6095
|
+
return (_calcPreviewMintAmoun = calcPreviewMintAmount(balance, asset.amount + keepAliveBuffer)) !== null && _calcPreviewMintAmoun !== void 0 ? _calcPreviewMintAmoun : 0n;
|
|
6142
6096
|
};
|
|
6143
|
-
|
|
6144
|
-
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6097
|
+
|
|
6098
|
+
var createX1Payload = function createX1Payload(version, junction) {
|
|
6099
|
+
return version === Version.V3 ? {
|
|
6100
|
+
X1: junction
|
|
6101
|
+
} : {
|
|
6102
|
+
X1: [junction]
|
|
6103
|
+
};
|
|
6104
|
+
};
|
|
6105
|
+
|
|
6106
|
+
var createAccountPayload = function createAccountPayload(api, address) {
|
|
6107
|
+
return isAddress(address) ? {
|
|
6108
|
+
AccountKey20: {
|
|
6109
|
+
key: address
|
|
6110
|
+
}
|
|
6111
|
+
} : {
|
|
6112
|
+
AccountId32: {
|
|
6113
|
+
id: api.accountToHex(address)
|
|
6114
|
+
}
|
|
6115
|
+
};
|
|
6116
|
+
};
|
|
6117
|
+
var createBeneficiaryLocXTokens = function createBeneficiaryLocXTokens(_ref) {
|
|
6118
|
+
var api = _ref.api,
|
|
6119
|
+
recipient = _ref.recipient,
|
|
6120
|
+
origin = _ref.origin,
|
|
6121
|
+
destination = _ref.destination,
|
|
6122
|
+
version = _ref.version,
|
|
6123
|
+
paraId = _ref.paraId;
|
|
6124
|
+
if (isTLocation(recipient)) {
|
|
6125
|
+
return recipient;
|
|
6126
|
+
}
|
|
6127
|
+
var scenario = resolveScenario(origin, destination);
|
|
6128
|
+
var accountPayload = createAccountPayload(api, recipient);
|
|
6129
|
+
if (scenario === 'ParaToRelay') {
|
|
6130
|
+
return {
|
|
6131
|
+
parents: Parents.ONE,
|
|
6132
|
+
interior: createX1Payload(version, {
|
|
6133
|
+
AccountId32: {
|
|
6134
|
+
id: api.accountToHex(recipient)
|
|
6135
|
+
}
|
|
6136
|
+
})
|
|
6137
|
+
};
|
|
6138
|
+
} else if (scenario === 'ParaToPara') {
|
|
6139
|
+
return {
|
|
6140
|
+
parents: Parents.ONE,
|
|
6141
|
+
interior: {
|
|
6142
|
+
X2: [{
|
|
6143
|
+
Parachain: paraId
|
|
6144
|
+
}, accountPayload]
|
|
6145
|
+
}
|
|
6146
|
+
};
|
|
6147
|
+
}
|
|
6148
|
+
return {
|
|
6149
|
+
parents: Parents.ZERO,
|
|
6150
|
+
interior: createX1Payload(version, accountPayload)
|
|
6151
|
+
};
|
|
6152
|
+
};
|
|
6153
|
+
var createBeneficiaryLocation = function createBeneficiaryLocation(_ref2) {
|
|
6154
|
+
var api = _ref2.api,
|
|
6155
|
+
address = _ref2.address,
|
|
6156
|
+
version = _ref2.version;
|
|
6157
|
+
if (isTLocation(address)) return address;
|
|
6158
|
+
var accountPayload = createAccountPayload(api, address);
|
|
6159
|
+
return {
|
|
6160
|
+
parents: Parents.ZERO,
|
|
6161
|
+
interior: createX1Payload(version, accountPayload)
|
|
6162
|
+
};
|
|
6163
|
+
};
|
|
6164
|
+
|
|
6165
|
+
var createDestination = function createDestination(api, version, origin, destination, chainId, junction, parents) {
|
|
6166
|
+
var isLocDestination = isTLocation(destination);
|
|
6167
|
+
var isSubBridge = !isLocDestination && !isExternalChain(destination) && isSubstrateBridge(origin, destination);
|
|
6168
|
+
if (isSubBridge) {
|
|
6169
|
+
return {
|
|
6170
|
+
parents: Parents.TWO,
|
|
6171
|
+
interior: {
|
|
6172
|
+
X2: [{
|
|
6173
|
+
GlobalConsensus: api.getRelayChainOf(destination)
|
|
6174
|
+
}, {
|
|
6175
|
+
Parachain: chainId
|
|
6176
|
+
}]
|
|
6177
|
+
}
|
|
6178
|
+
};
|
|
6179
|
+
}
|
|
6180
|
+
var isExternalDestination = !isLocDestination && isExternalChain(destination);
|
|
6181
|
+
if (isExternalDestination) {
|
|
6182
|
+
return {
|
|
6183
|
+
parents: Parents.TWO,
|
|
6184
|
+
interior: {
|
|
6185
|
+
X1: [getEthereumJunction(api, origin)]
|
|
6186
|
+
}
|
|
6187
|
+
};
|
|
6188
|
+
}
|
|
6189
|
+
var scenario = resolveScenario(origin, destination);
|
|
6190
|
+
var parentsResolved = parents !== null && parents !== void 0 ? parents : scenario === 'RelayToPara' ? Parents.ZERO : Parents.ONE;
|
|
6191
|
+
var interior = scenario === 'ParaToRelay' ? 'Here' : createX1Payload(version, junction !== null && junction !== void 0 ? junction : {
|
|
6192
|
+
Parachain: chainId
|
|
6193
|
+
});
|
|
6194
|
+
return isLocDestination ? destination : {
|
|
6195
|
+
parents: parentsResolved,
|
|
6196
|
+
interior: interior
|
|
6197
|
+
};
|
|
6198
|
+
};
|
|
6199
|
+
var createVersionedDestination = function createVersionedDestination(api, version, origin, destination, chainId, junction, parents) {
|
|
6200
|
+
var plainDestination = createDestination(api, version, origin, destination, chainId, junction, parents);
|
|
6201
|
+
return addXcmVersionHeader(plainDestination, version);
|
|
6202
|
+
};
|
|
6203
|
+
|
|
6204
|
+
var getChainLocation = function getChainLocation(chain, destChain, customCtx) {
|
|
6205
|
+
var fromRelay = isRelayChain(chain);
|
|
6206
|
+
var toRelay = isRelayChain(destChain);
|
|
6207
|
+
var parents = fromRelay ? Parents.ZERO : Parents.ONE;
|
|
6208
|
+
var interior = toRelay ? 'Here' : {
|
|
6209
|
+
X1: [{
|
|
6210
|
+
Parachain: getParaIdImpl(destChain, customCtx)
|
|
6211
|
+
}]
|
|
6212
|
+
};
|
|
6213
|
+
return {
|
|
6214
|
+
parents: parents,
|
|
6215
|
+
interior: interior
|
|
6216
|
+
};
|
|
6217
|
+
};
|
|
6218
|
+
|
|
6219
|
+
/**
|
|
6220
|
+
* This function localizes a location by removing the `Parachain` junction
|
|
6221
|
+
* if it exists. The `parents` field is set to `0` either if a `Parachain` was removed
|
|
6222
|
+
* or if the resulting interior is `'Here'` and the chain is a relay chain.
|
|
6223
|
+
*
|
|
6224
|
+
* @param chain - The current chain
|
|
6225
|
+
* @param location - The location to localize
|
|
6226
|
+
* @returns The localized location
|
|
6227
|
+
*/
|
|
6228
|
+
var localizeLocationInner = function localizeLocationInner(chain, location, origin, resolveRelay, resolveParaId) {
|
|
6229
|
+
var _Object$keys$;
|
|
6230
|
+
var targetRelay = isExternalChain(chain) ? undefined : resolveRelay(chain).toLowerCase();
|
|
6231
|
+
var originRelay = origin && !isExternalChain(origin) ? resolveRelay(origin).toLowerCase() : undefined;
|
|
6232
|
+
var locationConsensus = getJunctionValue(location, 'GlobalConsensus');
|
|
6233
|
+
var locationRelay = locationConsensus ? (_Object$keys$ = Object.keys(locationConsensus)[0]) === null || _Object$keys$ === void 0 ? void 0 : _Object$keys$.toLowerCase() : undefined;
|
|
6234
|
+
var ecosystemDiffers = targetRelay && originRelay && originRelay !== targetRelay;
|
|
6235
|
+
var junctions = location.interior === 'Here' ? [] : flattenJunctions(location.interior);
|
|
6236
|
+
var junctionCount = junctions.length;
|
|
6237
|
+
var isLocationOnTargetRelay = targetRelay !== undefined && locationRelay === targetRelay;
|
|
6238
|
+
// Check if target is an external chain and location's GlobalConsensus matches it
|
|
6239
|
+
var isLocationOnTargetExternal = isExternalChain(chain) && locationRelay === chain.toLowerCase();
|
|
6240
|
+
var isConsensusAnchored = junctions.findIndex(function (junction) {
|
|
6241
|
+
return 'GlobalConsensus' in junction;
|
|
6242
|
+
}) === 0;
|
|
6243
|
+
if (locationRelay && targetRelay && locationRelay !== targetRelay && (!origin || !ecosystemDiffers && isConsensusAnchored)) {
|
|
6244
|
+
return location;
|
|
6245
|
+
}
|
|
6246
|
+
if (origin && ecosystemDiffers && location.parents === Parents.TWO && originRelay !== undefined && targetRelay !== undefined && deepEqual(getJunctionValue(location, 'GlobalConsensus'), _defineProperty({}, targetRelay, null)) && junctionCount === 1) {
|
|
6247
|
+
return RELAY_LOCATION;
|
|
6248
|
+
}
|
|
6249
|
+
var newInterior = location.interior === 'Here' ? {
|
|
6250
|
+
Here: null
|
|
6251
|
+
} : location.interior;
|
|
6252
|
+
var parachainRemoved = false;
|
|
6253
|
+
if (location.interior !== 'Here') {
|
|
6254
|
+
var paraId = resolveParaId(chain);
|
|
6255
|
+
var filteredJunctions = junctions.filter(function (junction) {
|
|
6256
|
+
if ('GlobalConsensus' in junction && (isLocationOnTargetRelay || isLocationOnTargetExternal)) {
|
|
6257
|
+
return false;
|
|
6258
|
+
}
|
|
6259
|
+
if ('Parachain' in junction && (!ecosystemDiffers || isLocationOnTargetRelay)) {
|
|
6260
|
+
var paraJunctionId = getJunctionValue(location, 'Parachain');
|
|
6261
|
+
if (paraJunctionId === paraId) {
|
|
6262
|
+
parachainRemoved = true;
|
|
6263
|
+
return false;
|
|
6264
|
+
}
|
|
6265
|
+
}
|
|
6266
|
+
return true;
|
|
6267
|
+
});
|
|
6268
|
+
if (filteredJunctions.length === 0) {
|
|
6269
|
+
newInterior = {
|
|
6270
|
+
Here: null
|
|
6271
|
+
};
|
|
6272
|
+
} else {
|
|
6273
|
+
newInterior = _defineProperty({}, "X".concat(filteredJunctions.length), filteredJunctions);
|
|
6274
|
+
}
|
|
6275
|
+
}
|
|
6276
|
+
var isOriginRelayHere = deepEqual(location, RELAY_LOCATION);
|
|
6277
|
+
var hasGlobalConsensus = hasJunction(location, 'GlobalConsensus');
|
|
6278
|
+
if (origin && isExternalChain(chain) && originRelay !== undefined && isOriginRelayHere && !hasGlobalConsensus) {
|
|
6279
|
+
return {
|
|
6280
|
+
parents: Parents.ONE,
|
|
6281
|
+
interior: {
|
|
6282
|
+
X1: [{
|
|
6283
|
+
GlobalConsensus: _defineProperty({}, originRelay, null)
|
|
6284
|
+
}]
|
|
6285
|
+
}
|
|
6286
|
+
};
|
|
6287
|
+
}
|
|
6288
|
+
if (isExternalChain(chain) && location.parents === Parents.TWO && RELAYCHAINS.some(function (relay) {
|
|
6289
|
+
return deepEqual(getJunctionValue(location, 'GlobalConsensus'), _defineProperty({}, relay.toLowerCase(), null));
|
|
6290
|
+
})) {
|
|
6291
|
+
return _objectSpread2(_objectSpread2({}, location), {}, {
|
|
6292
|
+
parents: Parents.ONE
|
|
6293
|
+
});
|
|
6294
|
+
}
|
|
6295
|
+
if (origin && ecosystemDiffers && isOriginRelayHere && !hasGlobalConsensus && originRelay !== undefined) {
|
|
6296
|
+
return {
|
|
6297
|
+
parents: Parents.TWO,
|
|
6298
|
+
interior: {
|
|
6299
|
+
X1: [{
|
|
6300
|
+
GlobalConsensus: _defineProperty({}, originRelay, null)
|
|
6301
|
+
}]
|
|
6302
|
+
}
|
|
6303
|
+
};
|
|
6304
|
+
}
|
|
6305
|
+
if (origin && ecosystemDiffers && newInterior.Here === undefined && !hasGlobalConsensus && originRelay !== undefined) {
|
|
6306
|
+
var _junctions = flattenJunctions(newInterior);
|
|
6307
|
+
var updatedJunctions = [{
|
|
6308
|
+
GlobalConsensus: _defineProperty({}, originRelay, null)
|
|
6309
|
+
}].concat(_toConsumableArray(_junctions));
|
|
6310
|
+
return {
|
|
6311
|
+
parents: Parents.TWO,
|
|
6312
|
+
interior: _defineProperty({}, "X".concat(updatedJunctions.length), updatedJunctions)
|
|
6313
|
+
};
|
|
6314
|
+
}
|
|
6315
|
+
var shouldSetParentsToZero = parachainRemoved || newInterior.Here !== undefined && isRelayChain(chain) || isLocationOnTargetExternal;
|
|
6316
|
+
return {
|
|
6317
|
+
parents: shouldSetParentsToZero ? Parents.ZERO : location.parents,
|
|
6318
|
+
interior: newInterior
|
|
6319
|
+
};
|
|
6320
|
+
};
|
|
6321
|
+
var localizeLocation = function localizeLocation(chain, location, origin) {
|
|
6322
|
+
return localizeLocationInner(chain, location, origin, function (c) {
|
|
6323
|
+
return getRelayChainOf(c);
|
|
6324
|
+
}, function (c) {
|
|
6325
|
+
return getParaId(c);
|
|
6326
|
+
});
|
|
6327
|
+
};
|
|
6328
|
+
var localizeLocationImpl = function localizeLocationImpl(api, chain, location, origin) {
|
|
6329
|
+
return localizeLocationInner(chain, location, origin, function (c) {
|
|
6330
|
+
return getRelayChainOfImpl(api, c);
|
|
6331
|
+
}, function (c) {
|
|
6332
|
+
return getParaIdImpl(c, api._customCtx);
|
|
6333
|
+
});
|
|
6334
|
+
};
|
|
6335
|
+
|
|
6336
|
+
var reverseTransformLocation = function reverseTransformLocation(location) {
|
|
6337
|
+
var parachainJunction = {
|
|
6338
|
+
Parachain: 1000
|
|
6339
|
+
};
|
|
6340
|
+
var alreadyHasP1000 = location.interior !== 'Here' && Object.values(location.interior).flat().some(function (j) {
|
|
6341
|
+
return _typeof(j) === 'object' && j !== null && 'Parachain' in j && j.Parachain === 1000;
|
|
6342
|
+
});
|
|
6343
|
+
if (alreadyHasP1000) {
|
|
6344
|
+
return _objectSpread2(_objectSpread2({}, location), {}, {
|
|
6345
|
+
parents: Parents.ONE
|
|
6346
|
+
});
|
|
6347
|
+
}
|
|
6348
|
+
var existingJunctions = location.interior === 'Here' ? [] // no other junctions
|
|
6349
|
+
: Object.values(location.interior).flat();
|
|
6350
|
+
var allJunctions = [parachainJunction].concat(_toConsumableArray(existingJunctions));
|
|
6351
|
+
return _objectSpread2(_objectSpread2({}, location), {}, {
|
|
6352
|
+
parents: Parents.ONE,
|
|
6353
|
+
interior: _defineProperty({}, "X".concat(allJunctions.length), allJunctions)
|
|
6354
|
+
});
|
|
6355
|
+
};
|
|
6356
|
+
|
|
6357
|
+
var createBridgedXcmPrefix = function createBridgedXcmPrefix(version, _ref) {
|
|
6358
|
+
var palletIndex = _ref.palletIndex,
|
|
6359
|
+
relay = _ref.relay,
|
|
6360
|
+
paraId = _ref.paraId;
|
|
6361
|
+
return [{
|
|
6362
|
+
DescendOrigin: createX1Payload(version, {
|
|
6363
|
+
PalletInstance: palletIndex
|
|
6364
|
+
})
|
|
6365
|
+
}, {
|
|
6366
|
+
UniversalOrigin: {
|
|
6367
|
+
GlobalConsensus: _defineProperty({}, relay.toLowerCase(), null)
|
|
6368
|
+
}
|
|
6369
|
+
}, {
|
|
6370
|
+
DescendOrigin: createX1Payload(version, {
|
|
6371
|
+
Parachain: paraId
|
|
6372
|
+
})
|
|
6373
|
+
}];
|
|
6374
|
+
};
|
|
6375
|
+
|
|
6376
|
+
var getErrorInstruction = function getErrorInstruction(message, index) {
|
|
6377
|
+
if (index === undefined || _typeof(message) !== 'object' || message === null) {
|
|
6378
|
+
return undefined;
|
|
6379
|
+
}
|
|
6380
|
+
var instructions = message;
|
|
6381
|
+
if (!Array.isArray(instructions)) {
|
|
6382
|
+
instructions = 'value' in message && Array.isArray(message.value) ? message.value : Object.values(message)[0];
|
|
6383
|
+
}
|
|
6384
|
+
if (!Array.isArray(instructions)) return undefined;
|
|
6385
|
+
var instruction = instructions[index];
|
|
6386
|
+
return _typeof(instruction) === 'object' && instruction !== null ? instruction : undefined;
|
|
6387
|
+
};
|
|
6388
|
+
var buildDryRunError = function buildDryRunError(error, message) {
|
|
6389
|
+
return _objectSpread2(_objectSpread2({}, error), {}, {
|
|
6390
|
+
instruction: getErrorInstruction(message, error.instructionIndex)
|
|
6391
|
+
});
|
|
6392
|
+
};
|
|
6393
|
+
|
|
6394
|
+
var resolveModuleError = function resolveModuleError(chain, error) {
|
|
6395
|
+
var palletDetails = getSupportedPalletsDetails(chain).find(function (p) {
|
|
6396
|
+
return p.index === Number(error.index);
|
|
6397
|
+
});
|
|
6398
|
+
if (!palletDetails) {
|
|
6399
|
+
throw new RoutingResolutionError("Pallet with index ".concat(error.index, " not found"));
|
|
6400
|
+
}
|
|
6401
|
+
// Use only the first byte of the error to get the error index
|
|
6402
|
+
// Including 0x prefix
|
|
6403
|
+
var errorIndex = Number(error.error.slice(0, 4));
|
|
6404
|
+
var name = palletDetails.name;
|
|
6405
|
+
if (name !== 'XTokens' && name !== 'PolkadotXcm' && name !== 'XcmPallet') {
|
|
6406
|
+
throw new UnsupportedOperationError("Pallet ".concat(name, " is not supported"));
|
|
6407
|
+
}
|
|
6408
|
+
var reason = name === 'XTokens' ? Object.values(XTokensError)[errorIndex] : Object.values(PolkadotXcmError)[errorIndex];
|
|
6409
|
+
if (!reason) {
|
|
6410
|
+
throw new RoutingResolutionError("Error index ".concat(errorIndex, " not found in ").concat(name, " pallet"));
|
|
6411
|
+
}
|
|
6412
|
+
if (reason === PolkadotXcmError.LocalExecutionIncompleteWithError) {
|
|
6413
|
+
// Byte layout: [pallet error variant][instruction index][xcm sub-error]
|
|
6414
|
+
var instructionIndex = Number("0x".concat(error.error.slice(4, 6)));
|
|
6415
|
+
var subErrorIndex = Number("0x".concat(error.error.slice(6, 8)));
|
|
6416
|
+
var subReason = Object.values(PolkadotXcmExecutionError)[subErrorIndex];
|
|
6417
|
+
if (!subReason) {
|
|
6418
|
+
throw new RoutingResolutionError("Sub-error index ".concat(subErrorIndex, " not found in PolkadotXcm pallet"));
|
|
6419
|
+
}
|
|
6420
|
+
return {
|
|
6421
|
+
reason: reason,
|
|
6422
|
+
subReason: subReason,
|
|
6423
|
+
instructionIndex: instructionIndex
|
|
6424
|
+
};
|
|
6425
|
+
}
|
|
6426
|
+
return {
|
|
6427
|
+
reason: reason
|
|
6428
|
+
};
|
|
6429
|
+
};
|
|
6430
|
+
|
|
6431
|
+
var parseUnits = parseUnits$1;
|
|
6432
|
+
var formatUnits = formatUnits$1;
|
|
6433
|
+
|
|
6434
|
+
var resolveBypassMintAmount = function resolveBypassMintAmount(chain) {
|
|
6435
|
+
return HIGH_BYPASS_MINT_CHAINS.some(function (c) {
|
|
6436
|
+
return c === chain;
|
|
6437
|
+
}) ? HIGH_BYPASS_MINT_AMOUNT : BYPASS_MINT_AMOUNT;
|
|
6438
|
+
};
|
|
6439
|
+
var createMintTxs = function createMintTxs(chain, asset, balance, address, api) {
|
|
6440
|
+
return getSubstrateChainImpl(chain, api._customCtx).mint(api, address, asset, balance);
|
|
6441
|
+
};
|
|
6442
|
+
var createRequiredMintTxs = function createRequiredMintTxs(chain, asset, amountHuman, balance, address, api) {
|
|
6443
|
+
var amount = parseUnits(amountHuman, asset.decimals);
|
|
6444
|
+
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
6445
|
+
amount: amount
|
|
6446
|
+
}), balance, address, api);
|
|
6447
|
+
};
|
|
6448
|
+
var createOptionalMintTxs = function createOptionalMintTxs(chain, currency, amountHuman, balance, address, api) {
|
|
6449
|
+
var asset = api.findAssetInfo(chain, currency);
|
|
6450
|
+
if (!asset) return null;
|
|
6451
|
+
var amount = parseUnits(amountHuman, asset.decimals);
|
|
6452
|
+
return createMintTxs(chain, _objectSpread2(_objectSpread2({}, asset), {}, {
|
|
6453
|
+
amount: amount
|
|
6454
|
+
}), balance, address, api);
|
|
6455
|
+
};
|
|
6456
|
+
var toTxWithOrigin = function toTxWithOrigin(api, tx, origin) {
|
|
6457
|
+
var call = api.deserializeExtrinsics(tx);
|
|
6458
|
+
return origin ? api.dispatchAs(call, origin) : call;
|
|
6459
|
+
};
|
|
6460
|
+
var resultToExtrinsics = function resultToExtrinsics(api, address, _ref) {
|
|
6461
|
+
var assetStatusTx = _ref.assetStatusTx,
|
|
6462
|
+
balanceTx = _ref.balanceTx,
|
|
6463
|
+
forceOrigin = _ref.forceOrigin;
|
|
6464
|
+
return [].concat(_toConsumableArray(assetStatusTx ? [toTxWithOrigin(api, assetStatusTx, forceOrigin)] : []), [toTxWithOrigin(api, balanceTx, assetStatusTx ? {
|
|
6465
|
+
type: 'signed',
|
|
6466
|
+
address: address
|
|
6467
|
+
} : undefined)]);
|
|
6468
|
+
};
|
|
6469
|
+
var mintBonusForSent = function mintBonusForSent(chain, sent, feeAsset, mintFeeAssets, api) {
|
|
6470
|
+
if (!mintFeeAssets) return 0n;
|
|
6471
|
+
var _native = api.findNativeAssetInfo(chain);
|
|
6472
|
+
var relay = api.findAssetInfo(chain, {
|
|
6473
|
+
location: {
|
|
6474
|
+
parents: Parents.ONE,
|
|
6475
|
+
interior: {
|
|
6476
|
+
Here: null
|
|
6477
|
+
}
|
|
6478
|
+
}
|
|
6479
|
+
}, null);
|
|
6480
|
+
var seen = new Set();
|
|
6481
|
+
var preminted = [_native, relay, feeAsset].filter(function (a) {
|
|
6482
|
+
return !!a;
|
|
6483
|
+
}).filter(function (a) {
|
|
6484
|
+
var k = JSON.stringify(a.location, replaceBigInt);
|
|
6485
|
+
if (seen.has(k)) return false;
|
|
6486
|
+
seen.add(k);
|
|
6487
|
+
return true;
|
|
6488
|
+
});
|
|
6489
|
+
return preminted.some(function (a) {
|
|
6490
|
+
return isAssetEqual(a, sent);
|
|
6491
|
+
}) ? parseUnits(resolveBypassMintAmount(chain), sent.decimals) : 0n;
|
|
6492
|
+
};
|
|
6493
|
+
var wrapTxBypass = /*#__PURE__*/function () {
|
|
6494
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(dryRunOptions) {
|
|
6495
|
+
var _dryRunOptions$assets;
|
|
6496
|
+
var options,
|
|
6497
|
+
api,
|
|
6498
|
+
chain,
|
|
6499
|
+
address,
|
|
6500
|
+
asset,
|
|
6501
|
+
feeAsset,
|
|
6502
|
+
tx,
|
|
6503
|
+
mintFeeAssets,
|
|
6504
|
+
bypassMintAmount,
|
|
6505
|
+
relayCurrency,
|
|
6506
|
+
nativeInfo,
|
|
6507
|
+
relayInfo,
|
|
6508
|
+
sameNativeRelay,
|
|
6509
|
+
mintNativeAssetRes,
|
|
6160
6510
|
mintRelayAssetRes,
|
|
6161
6511
|
mintFeeAssetRes,
|
|
6162
6512
|
amount,
|
|
@@ -6229,7 +6579,7 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
6229
6579
|
case 8:
|
|
6230
6580
|
mintSentAsset = /*#__PURE__*/function () {
|
|
6231
6581
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(sentAsset) {
|
|
6232
|
-
var balance, bonus, mintAmount,
|
|
6582
|
+
var balance, bonus, mintAmount, missing, total;
|
|
6233
6583
|
return _regenerator().w(function (_context) {
|
|
6234
6584
|
while (1) switch (_context.n) {
|
|
6235
6585
|
case 0:
|
|
@@ -6244,11 +6594,9 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
6244
6594
|
balance = _context.v;
|
|
6245
6595
|
bonus = mintBonusForSent(chain, sentAsset, feeAsset, !!mintFeeAssets, api);
|
|
6246
6596
|
if ((options === null || options === void 0 ? void 0 : options.sentAssetMintMode) === 'bypass') {
|
|
6247
|
-
mintAmount = parseUnits(bypassMintAmount, sentAsset.decimals) + sentAsset.amount;
|
|
6597
|
+
mintAmount = parseUnits(bypassMintAmount, sentAsset.decimals) + sentAsset.amount + BigInt(sentAsset.existentialDeposit);
|
|
6248
6598
|
} else {
|
|
6249
|
-
|
|
6250
|
-
desiredBalance = sentAsset.amount + keepAliveBuffer;
|
|
6251
|
-
missing = (_calcPreviewMintAmoun = calcPreviewMintAmount(balance, desiredBalance)) !== null && _calcPreviewMintAmoun !== void 0 ? _calcPreviewMintAmoun : 0n;
|
|
6599
|
+
missing = calcSentAssetPreviewMint(sentAsset, balance, dryRunOptions.keepAlive);
|
|
6252
6600
|
total = missing + bonus;
|
|
6253
6601
|
mintAmount = total > 0n ? total : null;
|
|
6254
6602
|
}
|
|
@@ -6269,7 +6617,10 @@ var wrapTxBypass = /*#__PURE__*/function () {
|
|
|
6269
6617
|
mintAssetResults = _context2.v;
|
|
6270
6618
|
return _context2.a(2, api.callBatchMethod([].concat(_toConsumableArray([mintNativeAssetRes, mintRelayAssetRes, mintFeeAssetRes].concat(_toConsumableArray(mintAssetResults)).flatMap(function (tx) {
|
|
6271
6619
|
return tx ? resultToExtrinsics(api, address, tx) : [];
|
|
6272
|
-
})), [api.
|
|
6620
|
+
})), [api.dispatchAs(tx, {
|
|
6621
|
+
type: 'signed',
|
|
6622
|
+
address: address
|
|
6623
|
+
})]), BatchMode.BATCH_ALL));
|
|
6273
6624
|
}
|
|
6274
6625
|
}, _callee2);
|
|
6275
6626
|
}));
|
|
@@ -6325,7 +6676,7 @@ var getBypassResultWithRetries = /*#__PURE__*/function () {
|
|
|
6325
6676
|
while (1) switch (_context.n) {
|
|
6326
6677
|
case 0:
|
|
6327
6678
|
_context.n = 1;
|
|
6328
|
-
return options.buildTx(amount, relative);
|
|
6679
|
+
return options.buildTx(amount, relative, true);
|
|
6329
6680
|
case 1:
|
|
6330
6681
|
tx = _context.v;
|
|
6331
6682
|
return _context.a(2, internalFn(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
@@ -7549,11 +7900,11 @@ var sumHopFees = function sumHopFees(result, _ref) {
|
|
|
7549
7900
|
};
|
|
7550
7901
|
var computeAllFees = /*#__PURE__*/function () {
|
|
7551
7902
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(context, buildTx) {
|
|
7552
|
-
var origin, dest, feeAssetInfo, _context$options, sender, recipient, currency, feeCurrency, version, overriddenAsset, result, hopFees, destFee;
|
|
7903
|
+
var origin, dest, feeAssetInfo, edDeposit, _context$options, sender, recipient, currency, feeCurrency, version, overriddenAsset, result, hopFees, destFee;
|
|
7553
7904
|
return _regenerator().w(function (_context) {
|
|
7554
7905
|
while (1) switch (_context.n) {
|
|
7555
7906
|
case 0:
|
|
7556
|
-
origin = context.origin, dest = context.dest, feeAssetInfo = context.feeAssetInfo, _context$options = context.options, sender = _context$options.sender, recipient = _context$options.recipient, currency = _context$options.currency, feeCurrency = _context$options.feeCurrency, version = _context$options.version, overriddenAsset = _context$options.overriddenAsset;
|
|
7907
|
+
origin = context.origin, dest = context.dest, feeAssetInfo = context.feeAssetInfo, edDeposit = context.edDeposit, _context$options = context.options, sender = _context$options.sender, recipient = _context$options.recipient, currency = _context$options.currency, feeCurrency = _context$options.feeCurrency, version = _context$options.version, overriddenAsset = _context$options.overriddenAsset;
|
|
7557
7908
|
assertSender(sender);
|
|
7558
7909
|
assertAddressIsString(recipient);
|
|
7559
7910
|
if (origin.api.hasDryRunSupport(context.origin.chain)) {
|
|
@@ -7588,7 +7939,7 @@ var computeAllFees = /*#__PURE__*/function () {
|
|
|
7588
7939
|
destFee = result.destination.fee;
|
|
7589
7940
|
return _context.a(2, {
|
|
7590
7941
|
hopFees: padValueBy(hopFees, FEE_PADDING),
|
|
7591
|
-
destFee: padValueBy(destFee, FEE_PADDING)
|
|
7942
|
+
destFee: padValueBy(destFee, FEE_PADDING) + (edDeposit !== null && edDeposit !== void 0 ? edDeposit : 0n)
|
|
7592
7943
|
});
|
|
7593
7944
|
}
|
|
7594
7945
|
}, _callee);
|
|
@@ -7641,7 +7992,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
7641
7992
|
_context3.n = 3;
|
|
7642
7993
|
return Promise.all(assets.map(/*#__PURE__*/function () {
|
|
7643
7994
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(asset, index) {
|
|
7644
|
-
var destAsset, destBalance, destEd, paysOriginInSendingAsset, originFee, hopFeeTotal, destinationFee, edComponent;
|
|
7995
|
+
var destAsset, destBalance, destEd, paysOriginInSendingAsset, originFee, originChainAsset, hopFeeTotal, destinationFee, edComponent;
|
|
7645
7996
|
return _regenerator().w(function (_context) {
|
|
7646
7997
|
while (1) switch (_context.n) {
|
|
7647
7998
|
case 0:
|
|
@@ -7658,11 +8009,24 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
7658
8009
|
destEd = BigInt(destAsset.existentialDeposit);
|
|
7659
8010
|
paysOriginInSendingAsset = !resolvedFeeAsset && isAssetEqual(nativeAssetInfo, asset) || resolvedFeeAsset && isAssetEqual(resolvedFeeAsset, asset);
|
|
7660
8011
|
originFee = result.origin && paysOriginInSendingAsset && isAssetEqual(result.origin.asset, asset) ? result.origin.fee : 0n;
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
8012
|
+
originChainAsset = {
|
|
8013
|
+
chain: origin,
|
|
8014
|
+
asset: asset
|
|
8015
|
+
};
|
|
8016
|
+
hopFeeTotal = result.hops.reduce(function (acc, _ref4) {
|
|
8017
|
+
var chain = _ref4.chain,
|
|
8018
|
+
_ref4$result = _ref4.result,
|
|
8019
|
+
hopAsset = _ref4$result.asset,
|
|
8020
|
+
fee = _ref4$result.fee;
|
|
8021
|
+
return api.isAssetXcEqual(originChainAsset, {
|
|
8022
|
+
chain: chain,
|
|
8023
|
+
asset: hopAsset
|
|
8024
|
+
}) ? acc + fee : acc;
|
|
7664
8025
|
}, 0n);
|
|
7665
|
-
destinationFee = result.destination &&
|
|
8026
|
+
destinationFee = result.destination && api.isAssetXcEqual(originChainAsset, {
|
|
8027
|
+
chain: destination,
|
|
8028
|
+
asset: result.destination.asset
|
|
8029
|
+
}) ? result.destination.fee : 0n;
|
|
7666
8030
|
edComponent = destBalance === 0n ? destEd : 0n;
|
|
7667
8031
|
return _context.a(2, hopFeeTotal + destinationFee + originFee + edComponent + 1n);
|
|
7668
8032
|
}
|
|
@@ -7684,7 +8048,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
7684
8048
|
});
|
|
7685
8049
|
};
|
|
7686
8050
|
createTx = /*#__PURE__*/function () {
|
|
7687
|
-
var
|
|
8051
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(amounts) {
|
|
7688
8052
|
var _yield$builder$curren, tx;
|
|
7689
8053
|
return _regenerator().w(function (_context2) {
|
|
7690
8054
|
while (1) switch (_context2.n) {
|
|
@@ -7699,7 +8063,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
7699
8063
|
}, _callee2);
|
|
7700
8064
|
}));
|
|
7701
8065
|
return function createTx(_x4) {
|
|
7702
|
-
return
|
|
8066
|
+
return _ref5.apply(this, arguments);
|
|
7703
8067
|
};
|
|
7704
8068
|
}();
|
|
7705
8069
|
amounts = minAmounts;
|
|
@@ -7764,7 +8128,7 @@ var getMinTransferableAmountInternal = /*#__PURE__*/function () {
|
|
|
7764
8128
|
};
|
|
7765
8129
|
}();
|
|
7766
8130
|
var getMinTransferableAmount = /*#__PURE__*/function () {
|
|
7767
|
-
var
|
|
8131
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(options) {
|
|
7768
8132
|
var api;
|
|
7769
8133
|
return _regenerator().w(function (_context4) {
|
|
7770
8134
|
while (1) switch (_context4.p = _context4.n) {
|
|
@@ -7789,7 +8153,7 @@ var getMinTransferableAmount = /*#__PURE__*/function () {
|
|
|
7789
8153
|
}, _callee4, null, [[1,, 3, 5]]);
|
|
7790
8154
|
}));
|
|
7791
8155
|
return function getMinTransferableAmount(_x5) {
|
|
7792
|
-
return
|
|
8156
|
+
return _ref6.apply(this, arguments);
|
|
7793
8157
|
};
|
|
7794
8158
|
}();
|
|
7795
8159
|
|
|
@@ -7950,272 +8314,130 @@ var getTransferableAmount = /*#__PURE__*/function () {
|
|
|
7950
8314
|
api.disconnectAllowed = true;
|
|
7951
8315
|
_context6.n = 4;
|
|
7952
8316
|
return api.disconnect();
|
|
7953
|
-
case 4:
|
|
7954
|
-
return _context6.f(3);
|
|
7955
|
-
case 5:
|
|
7956
|
-
return _context6.a(2);
|
|
7957
|
-
}
|
|
7958
|
-
}, _callee6, null, [[1,, 3, 5]]);
|
|
7959
|
-
}));
|
|
7960
|
-
return function getTransferableAmount(_x11) {
|
|
7961
|
-
return _ref7.apply(this, arguments);
|
|
7962
|
-
};
|
|
7963
|
-
}();
|
|
7964
|
-
|
|
7965
|
-
var createX1Payload = function createX1Payload(version, junction) {
|
|
7966
|
-
return version === Version.V3 ? {
|
|
7967
|
-
X1: junction
|
|
7968
|
-
} : {
|
|
7969
|
-
X1: [junction]
|
|
7970
|
-
};
|
|
7971
|
-
};
|
|
7972
|
-
|
|
7973
|
-
var createAccountPayload = function createAccountPayload(api, address) {
|
|
7974
|
-
return isAddress(address) ? {
|
|
7975
|
-
AccountKey20: {
|
|
7976
|
-
key: address
|
|
7977
|
-
}
|
|
7978
|
-
} : {
|
|
7979
|
-
AccountId32: {
|
|
7980
|
-
id: api.accountToHex(address)
|
|
7981
|
-
}
|
|
7982
|
-
};
|
|
7983
|
-
};
|
|
7984
|
-
var createBeneficiaryLocXTokens = function createBeneficiaryLocXTokens(_ref) {
|
|
7985
|
-
var api = _ref.api,
|
|
7986
|
-
recipient = _ref.recipient,
|
|
7987
|
-
origin = _ref.origin,
|
|
7988
|
-
destination = _ref.destination,
|
|
7989
|
-
version = _ref.version,
|
|
7990
|
-
paraId = _ref.paraId;
|
|
7991
|
-
if (isTLocation(recipient)) {
|
|
7992
|
-
return recipient;
|
|
7993
|
-
}
|
|
7994
|
-
var scenario = resolveScenario(origin, destination);
|
|
7995
|
-
var accountPayload = createAccountPayload(api, recipient);
|
|
7996
|
-
if (scenario === 'ParaToRelay') {
|
|
7997
|
-
return {
|
|
7998
|
-
parents: Parents.ONE,
|
|
7999
|
-
interior: createX1Payload(version, {
|
|
8000
|
-
AccountId32: {
|
|
8001
|
-
id: api.accountToHex(recipient)
|
|
8002
|
-
}
|
|
8003
|
-
})
|
|
8004
|
-
};
|
|
8005
|
-
} else if (scenario === 'ParaToPara') {
|
|
8006
|
-
return {
|
|
8007
|
-
parents: Parents.ONE,
|
|
8008
|
-
interior: {
|
|
8009
|
-
X2: [{
|
|
8010
|
-
Parachain: paraId
|
|
8011
|
-
}, accountPayload]
|
|
8012
|
-
}
|
|
8013
|
-
};
|
|
8014
|
-
}
|
|
8015
|
-
return {
|
|
8016
|
-
parents: Parents.ZERO,
|
|
8017
|
-
interior: createX1Payload(version, accountPayload)
|
|
8018
|
-
};
|
|
8019
|
-
};
|
|
8020
|
-
var createBeneficiaryLocation = function createBeneficiaryLocation(_ref2) {
|
|
8021
|
-
var api = _ref2.api,
|
|
8022
|
-
address = _ref2.address,
|
|
8023
|
-
version = _ref2.version;
|
|
8024
|
-
if (isTLocation(address)) return address;
|
|
8025
|
-
var accountPayload = createAccountPayload(api, address);
|
|
8026
|
-
return {
|
|
8027
|
-
parents: Parents.ZERO,
|
|
8028
|
-
interior: createX1Payload(version, accountPayload)
|
|
8029
|
-
};
|
|
8030
|
-
};
|
|
8031
|
-
|
|
8032
|
-
var createDestination = function createDestination(api, version, origin, destination, chainId, junction, parents) {
|
|
8033
|
-
var isLocDestination = isTLocation(destination);
|
|
8034
|
-
var isSubBridge = !isLocDestination && !isExternalChain(destination) && isSubstrateBridge(origin, destination);
|
|
8035
|
-
if (isSubBridge) {
|
|
8036
|
-
return {
|
|
8037
|
-
parents: Parents.TWO,
|
|
8038
|
-
interior: {
|
|
8039
|
-
X2: [{
|
|
8040
|
-
GlobalConsensus: api.getRelayChainOf(destination)
|
|
8041
|
-
}, {
|
|
8042
|
-
Parachain: chainId
|
|
8043
|
-
}]
|
|
8044
|
-
}
|
|
8045
|
-
};
|
|
8046
|
-
}
|
|
8047
|
-
var isExternalDestination = !isLocDestination && isExternalChain(destination);
|
|
8048
|
-
if (isExternalDestination) {
|
|
8049
|
-
return {
|
|
8050
|
-
parents: Parents.TWO,
|
|
8051
|
-
interior: {
|
|
8052
|
-
X1: [getEthereumJunction(api, origin)]
|
|
8053
|
-
}
|
|
8054
|
-
};
|
|
8055
|
-
}
|
|
8056
|
-
var scenario = resolveScenario(origin, destination);
|
|
8057
|
-
var parentsResolved = parents !== null && parents !== void 0 ? parents : scenario === 'RelayToPara' ? Parents.ZERO : Parents.ONE;
|
|
8058
|
-
var interior = scenario === 'ParaToRelay' ? 'Here' : createX1Payload(version, junction !== null && junction !== void 0 ? junction : {
|
|
8059
|
-
Parachain: chainId
|
|
8060
|
-
});
|
|
8061
|
-
return isLocDestination ? destination : {
|
|
8062
|
-
parents: parentsResolved,
|
|
8063
|
-
interior: interior
|
|
8064
|
-
};
|
|
8065
|
-
};
|
|
8066
|
-
var createVersionedDestination = function createVersionedDestination(api, version, origin, destination, chainId, junction, parents) {
|
|
8067
|
-
var plainDestination = createDestination(api, version, origin, destination, chainId, junction, parents);
|
|
8068
|
-
return addXcmVersionHeader(plainDestination, version);
|
|
8069
|
-
};
|
|
8070
|
-
|
|
8071
|
-
var getChainLocation = function getChainLocation(chain, destChain, customCtx) {
|
|
8072
|
-
var fromRelay = isRelayChain(chain);
|
|
8073
|
-
var toRelay = isRelayChain(destChain);
|
|
8074
|
-
var parents = fromRelay ? Parents.ZERO : Parents.ONE;
|
|
8075
|
-
var interior = toRelay ? 'Here' : {
|
|
8076
|
-
X1: [{
|
|
8077
|
-
Parachain: getParaIdImpl(destChain, customCtx)
|
|
8078
|
-
}]
|
|
8079
|
-
};
|
|
8080
|
-
return {
|
|
8081
|
-
parents: parents,
|
|
8082
|
-
interior: interior
|
|
8083
|
-
};
|
|
8084
|
-
};
|
|
8085
|
-
|
|
8086
|
-
/**
|
|
8087
|
-
* This function localizes a location by removing the `Parachain` junction
|
|
8088
|
-
* if it exists. The `parents` field is set to `0` either if a `Parachain` was removed
|
|
8089
|
-
* or if the resulting interior is `'Here'` and the chain is a relay chain.
|
|
8090
|
-
*
|
|
8091
|
-
* @param chain - The current chain
|
|
8092
|
-
* @param location - The location to localize
|
|
8093
|
-
* @returns The localized location
|
|
8094
|
-
*/
|
|
8095
|
-
var localizeLocationInner = function localizeLocationInner(chain, location, origin, resolveRelay, resolveParaId) {
|
|
8096
|
-
var _Object$keys$;
|
|
8097
|
-
var targetRelay = isExternalChain(chain) ? undefined : resolveRelay(chain).toLowerCase();
|
|
8098
|
-
var originRelay = origin && !isExternalChain(origin) ? resolveRelay(origin).toLowerCase() : undefined;
|
|
8099
|
-
var locationConsensus = getJunctionValue(location, 'GlobalConsensus');
|
|
8100
|
-
var locationRelay = locationConsensus ? (_Object$keys$ = Object.keys(locationConsensus)[0]) === null || _Object$keys$ === void 0 ? void 0 : _Object$keys$.toLowerCase() : undefined;
|
|
8101
|
-
var ecosystemDiffers = targetRelay && originRelay && originRelay !== targetRelay;
|
|
8102
|
-
var junctions = location.interior === 'Here' ? [] : flattenJunctions(location.interior);
|
|
8103
|
-
var junctionCount = junctions.length;
|
|
8104
|
-
var isLocationOnTargetRelay = targetRelay !== undefined && locationRelay === targetRelay;
|
|
8105
|
-
// Check if target is an external chain and location's GlobalConsensus matches it
|
|
8106
|
-
var isLocationOnTargetExternal = isExternalChain(chain) && locationRelay === chain.toLowerCase();
|
|
8107
|
-
var isConsensusAnchored = junctions.findIndex(function (junction) {
|
|
8108
|
-
return 'GlobalConsensus' in junction;
|
|
8109
|
-
}) === 0;
|
|
8110
|
-
if (locationRelay && targetRelay && locationRelay !== targetRelay && (!origin || !ecosystemDiffers && isConsensusAnchored)) {
|
|
8111
|
-
return location;
|
|
8112
|
-
}
|
|
8113
|
-
if (origin && ecosystemDiffers && location.parents === Parents.TWO && originRelay !== undefined && targetRelay !== undefined && deepEqual(getJunctionValue(location, 'GlobalConsensus'), _defineProperty({}, targetRelay, null)) && junctionCount === 1) {
|
|
8114
|
-
return RELAY_LOCATION;
|
|
8115
|
-
}
|
|
8116
|
-
var newInterior = location.interior;
|
|
8117
|
-
var parachainRemoved = false;
|
|
8118
|
-
if (location.interior !== 'Here') {
|
|
8119
|
-
var paraId = resolveParaId(chain);
|
|
8120
|
-
var filteredJunctions = junctions.filter(function (junction) {
|
|
8121
|
-
if ('GlobalConsensus' in junction && (isLocationOnTargetRelay || isLocationOnTargetExternal)) {
|
|
8122
|
-
return false;
|
|
8123
|
-
}
|
|
8124
|
-
if ('Parachain' in junction && (!ecosystemDiffers || isLocationOnTargetRelay)) {
|
|
8125
|
-
var paraJunctionId = getJunctionValue(location, 'Parachain');
|
|
8126
|
-
if (paraJunctionId === paraId) {
|
|
8127
|
-
parachainRemoved = true;
|
|
8128
|
-
return false;
|
|
8129
|
-
}
|
|
8130
|
-
}
|
|
8131
|
-
return true;
|
|
8132
|
-
});
|
|
8133
|
-
if (filteredJunctions.length === 0) {
|
|
8134
|
-
newInterior = 'Here';
|
|
8135
|
-
} else {
|
|
8136
|
-
newInterior = _defineProperty({}, "X".concat(filteredJunctions.length), filteredJunctions);
|
|
8137
|
-
}
|
|
8138
|
-
}
|
|
8139
|
-
var isOriginRelayHere = deepEqual(location, RELAY_LOCATION);
|
|
8140
|
-
var hasGlobalConsensus = hasJunction(location, 'GlobalConsensus');
|
|
8141
|
-
if (origin && isExternalChain(chain) && originRelay !== undefined && isOriginRelayHere && !hasGlobalConsensus) {
|
|
8142
|
-
return {
|
|
8143
|
-
parents: Parents.ONE,
|
|
8144
|
-
interior: {
|
|
8145
|
-
X1: [{
|
|
8146
|
-
GlobalConsensus: _defineProperty({}, originRelay, null)
|
|
8147
|
-
}]
|
|
8317
|
+
case 4:
|
|
8318
|
+
return _context6.f(3);
|
|
8319
|
+
case 5:
|
|
8320
|
+
return _context6.a(2);
|
|
8148
8321
|
}
|
|
8149
|
-
};
|
|
8150
|
-
}
|
|
8151
|
-
|
|
8152
|
-
return
|
|
8153
|
-
}
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
return {
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8322
|
+
}, _callee6, null, [[1,, 3, 5]]);
|
|
8323
|
+
}));
|
|
8324
|
+
return function getTransferableAmount(_x11) {
|
|
8325
|
+
return _ref7.apply(this, arguments);
|
|
8326
|
+
};
|
|
8327
|
+
}();
|
|
8328
|
+
|
|
8329
|
+
var isAssetSufficient = /*#__PURE__*/function () {
|
|
8330
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, chain, asset) {
|
|
8331
|
+
var pallets, _state$isSufficient, state;
|
|
8332
|
+
return _regenerator().w(function (_context) {
|
|
8333
|
+
while (1) switch (_context.p = _context.n) {
|
|
8334
|
+
case 0:
|
|
8335
|
+
pallets = getOtherAssetsPallets(chain, api._customCtx);
|
|
8336
|
+
if (!(asset.isNative || pallets.length === 0)) {
|
|
8337
|
+
_context.n = 1;
|
|
8338
|
+
break;
|
|
8339
|
+
}
|
|
8340
|
+
return _context.a(2, true);
|
|
8341
|
+
case 1:
|
|
8342
|
+
_context.p = 1;
|
|
8343
|
+
_context.n = 2;
|
|
8344
|
+
return getPalletInstance(pickOtherMintPallet(asset, pallets)).getAssetState(api, asset);
|
|
8345
|
+
case 2:
|
|
8346
|
+
state = _context.v;
|
|
8347
|
+
return _context.a(2, (_state$isSufficient = state === null || state === void 0 ? void 0 : state.isSufficient) !== null && _state$isSufficient !== void 0 ? _state$isSufficient : true);
|
|
8348
|
+
case 3:
|
|
8349
|
+
_context.p = 3;
|
|
8350
|
+
_context.v;
|
|
8351
|
+
return _context.a(2, true);
|
|
8165
8352
|
}
|
|
8166
|
-
};
|
|
8167
|
-
}
|
|
8168
|
-
|
|
8169
|
-
|
|
8170
|
-
var updatedJunctions = [{
|
|
8171
|
-
GlobalConsensus: _defineProperty({}, originRelay, null)
|
|
8172
|
-
}].concat(_toConsumableArray(_junctions));
|
|
8173
|
-
return {
|
|
8174
|
-
parents: Parents.TWO,
|
|
8175
|
-
interior: _defineProperty({}, "X".concat(updatedJunctions.length), updatedJunctions)
|
|
8176
|
-
};
|
|
8177
|
-
}
|
|
8178
|
-
var shouldSetParentsToZero = parachainRemoved || newInterior === 'Here' && isRelayChain(chain) || isLocationOnTargetExternal;
|
|
8179
|
-
return {
|
|
8180
|
-
parents: shouldSetParentsToZero ? Parents.ZERO : location.parents,
|
|
8181
|
-
interior: newInterior
|
|
8353
|
+
}, _callee, null, [[1, 3]]);
|
|
8354
|
+
}));
|
|
8355
|
+
return function isAssetSufficient(_x, _x2, _x3) {
|
|
8356
|
+
return _ref.apply(this, arguments);
|
|
8182
8357
|
};
|
|
8183
|
-
};
|
|
8184
|
-
var localizeLocation = function localizeLocation(chain, location, origin) {
|
|
8185
|
-
return localizeLocationInner(chain, location, origin, function (c) {
|
|
8186
|
-
return getRelayChainOf(c);
|
|
8187
|
-
}, function (c) {
|
|
8188
|
-
return getParaId(c);
|
|
8189
|
-
});
|
|
8190
|
-
};
|
|
8191
|
-
var localizeLocationImpl = function localizeLocationImpl(api, chain, location, origin) {
|
|
8192
|
-
return localizeLocationInner(chain, location, origin, function (c) {
|
|
8193
|
-
return getRelayChainOfImpl(api, c);
|
|
8194
|
-
}, function (c) {
|
|
8195
|
-
return getParaIdImpl(c, api._customCtx);
|
|
8196
|
-
});
|
|
8197
|
-
};
|
|
8358
|
+
}();
|
|
8198
8359
|
|
|
8199
|
-
var
|
|
8200
|
-
var
|
|
8201
|
-
|
|
8360
|
+
var resolveEdDeposit = /*#__PURE__*/function () {
|
|
8361
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
|
|
8362
|
+
var _overriddenAsset$map;
|
|
8363
|
+
var origin, _ref$dest, destApi, destChain, assetInfo, overriddenAsset, feeAssetLocation, recipient, nativeAsset, nativeLocation, feeLocation, isFeeNative, _yield$destApi$queryS, providers, destAssets, sufficiency, ed, feeAmount;
|
|
8364
|
+
return _regenerator().w(function (_context) {
|
|
8365
|
+
while (1) switch (_context.n) {
|
|
8366
|
+
case 0:
|
|
8367
|
+
origin = _ref.origin, _ref$dest = _ref.dest, destApi = _ref$dest.api, destChain = _ref$dest.chain, assetInfo = _ref.assetInfo, overriddenAsset = _ref.overriddenAsset, feeAssetLocation = _ref.feeAssetLocation, recipient = _ref.recipient;
|
|
8368
|
+
if (!(isExternalChain(destChain) || typeof recipient !== 'string')) {
|
|
8369
|
+
_context.n = 1;
|
|
8370
|
+
break;
|
|
8371
|
+
}
|
|
8372
|
+
return _context.a(2, undefined);
|
|
8373
|
+
case 1:
|
|
8374
|
+
nativeAsset = destApi.findNativeAssetInfoOrThrow(destChain);
|
|
8375
|
+
nativeLocation = origin.api.localizeLocation(destChain, nativeAsset.location);
|
|
8376
|
+
feeLocation = origin.api.localizeLocation(destChain, feeAssetLocation, origin.chain);
|
|
8377
|
+
isFeeNative = deepEqual(feeLocation, nativeLocation);
|
|
8378
|
+
if (!(!isFeeNative && !destChain.startsWith('AssetHub'))) {
|
|
8379
|
+
_context.n = 2;
|
|
8380
|
+
break;
|
|
8381
|
+
}
|
|
8382
|
+
return _context.a(2, undefined);
|
|
8383
|
+
case 2:
|
|
8384
|
+
_context.n = 3;
|
|
8385
|
+
return destApi.queryState({
|
|
8386
|
+
module: 'System',
|
|
8387
|
+
method: 'Account',
|
|
8388
|
+
params: [recipient]
|
|
8389
|
+
});
|
|
8390
|
+
case 3:
|
|
8391
|
+
_yield$destApi$queryS = _context.v;
|
|
8392
|
+
providers = _yield$destApi$queryS.providers;
|
|
8393
|
+
if (!(providers > 0)) {
|
|
8394
|
+
_context.n = 4;
|
|
8395
|
+
break;
|
|
8396
|
+
}
|
|
8397
|
+
return _context.a(2, undefined);
|
|
8398
|
+
case 4:
|
|
8399
|
+
destAssets = ((_overriddenAsset$map = overriddenAsset === null || overriddenAsset === void 0 ? void 0 : overriddenAsset.map(function (asset) {
|
|
8400
|
+
return extractAssetLocation(asset);
|
|
8401
|
+
})) !== null && _overriddenAsset$map !== void 0 ? _overriddenAsset$map : [assetInfo.location]).map(function (location) {
|
|
8402
|
+
return origin.api.findAssetOnDestOrThrow(origin.chain, destChain, {
|
|
8403
|
+
location: location
|
|
8404
|
+
});
|
|
8405
|
+
});
|
|
8406
|
+
_context.n = 5;
|
|
8407
|
+
return Promise.all(destAssets.map(function (asset) {
|
|
8408
|
+
return isAssetSufficient(destApi, destChain, asset);
|
|
8409
|
+
}));
|
|
8410
|
+
case 5:
|
|
8411
|
+
sufficiency = _context.v;
|
|
8412
|
+
if (!sufficiency.every(Boolean)) {
|
|
8413
|
+
_context.n = 6;
|
|
8414
|
+
break;
|
|
8415
|
+
}
|
|
8416
|
+
return _context.a(2, undefined);
|
|
8417
|
+
case 6:
|
|
8418
|
+
ed = BigInt(nativeAsset.existentialDeposit);
|
|
8419
|
+
if (!isFeeNative) {
|
|
8420
|
+
_context.n = 7;
|
|
8421
|
+
break;
|
|
8422
|
+
}
|
|
8423
|
+
return _context.a(2, ed);
|
|
8424
|
+
case 7:
|
|
8425
|
+
_context.n = 8;
|
|
8426
|
+
return destApi.queryRuntimeApi({
|
|
8427
|
+
module: 'AssetConversionApi',
|
|
8428
|
+
method: 'quote_price_tokens_for_exact_tokens',
|
|
8429
|
+
params: [feeLocation, nativeLocation, ed, true]
|
|
8430
|
+
});
|
|
8431
|
+
case 8:
|
|
8432
|
+
feeAmount = _context.v;
|
|
8433
|
+
return _context.a(2, feeAmount == null ? undefined : padValueBy(BigInt(feeAmount), FEE_PADDING));
|
|
8434
|
+
}
|
|
8435
|
+
}, _callee);
|
|
8436
|
+
}));
|
|
8437
|
+
return function resolveEdDeposit(_x) {
|
|
8438
|
+
return _ref2.apply(this, arguments);
|
|
8202
8439
|
};
|
|
8203
|
-
|
|
8204
|
-
return _typeof(j) === 'object' && j !== null && 'Parachain' in j && j.Parachain === 1000;
|
|
8205
|
-
});
|
|
8206
|
-
if (alreadyHasP1000) {
|
|
8207
|
-
return _objectSpread2(_objectSpread2({}, location), {}, {
|
|
8208
|
-
parents: Parents.ONE
|
|
8209
|
-
});
|
|
8210
|
-
}
|
|
8211
|
-
var existingJunctions = location.interior === 'Here' ? [] // no other junctions
|
|
8212
|
-
: Object.values(location.interior).flat();
|
|
8213
|
-
var allJunctions = [parachainJunction].concat(_toConsumableArray(existingJunctions));
|
|
8214
|
-
return _objectSpread2(_objectSpread2({}, location), {}, {
|
|
8215
|
-
parents: Parents.ONE,
|
|
8216
|
-
interior: _defineProperty({}, "X".concat(allJunctions.length), allJunctions)
|
|
8217
|
-
});
|
|
8218
|
-
};
|
|
8440
|
+
}();
|
|
8219
8441
|
|
|
8220
8442
|
var PINK_LOCATION = {
|
|
8221
8443
|
parents: 1,
|
|
@@ -8241,8 +8463,9 @@ var getFeeAssetLocation = function getFeeAssetLocation(_ref) {
|
|
|
8241
8463
|
var _feeAssetInfo$locatio;
|
|
8242
8464
|
var feeAssetInfo = _ref.feeAssetInfo,
|
|
8243
8465
|
isRelayAsset = _ref.isRelayAsset,
|
|
8244
|
-
assetInfo = _ref.assetInfo
|
|
8245
|
-
|
|
8466
|
+
assetInfo = _ref.assetInfo,
|
|
8467
|
+
overriddenAsset = _ref.options.overriddenAsset;
|
|
8468
|
+
return (_feeAssetInfo$locatio = feeAssetInfo === null || feeAssetInfo === void 0 ? void 0 : feeAssetInfo.location) !== null && _feeAssetInfo$locatio !== void 0 ? _feeAssetInfo$locatio : isRelayAsset || overriddenAsset ? assetInfo.location : RELAY_LOCATION;
|
|
8246
8469
|
};
|
|
8247
8470
|
var getBridgeReserve = function getBridgeReserve(api, chain, destination, location) {
|
|
8248
8471
|
var assetConsensus = getJunctionValue(location, 'GlobalConsensus');
|
|
@@ -8253,19 +8476,16 @@ var getBridgeReserve = function getBridgeReserve(api, chain, destination, locati
|
|
|
8253
8476
|
var expectedConsensus = isExternalChain(destination) ? ethereumConsensus : _defineProperty({}, getRelayChainOf(destination).toLowerCase(), null);
|
|
8254
8477
|
return deepEqual(assetConsensus, expectedConsensus) ? destination : chain;
|
|
8255
8478
|
};
|
|
8256
|
-
var resolveReserveChain = function resolveReserveChain(api, chain, destination, assetLocation, isSubBridge
|
|
8479
|
+
var resolveReserveChain = function resolveReserveChain(api, chain, destination, assetLocation, isSubBridge) {
|
|
8257
8480
|
if (isSubBridge) {
|
|
8258
8481
|
return getBridgeReserve(api, chain, destination, assetLocation);
|
|
8259
8482
|
}
|
|
8260
|
-
if (overrideReserve !== undefined) {
|
|
8261
|
-
return overrideReserve;
|
|
8262
|
-
}
|
|
8263
8483
|
return api.getAssetReserveChain(chain, assetLocation, isExternalChain(destination));
|
|
8264
8484
|
};
|
|
8265
8485
|
var createTypeAndThenCallContext = /*#__PURE__*/function () {
|
|
8266
8486
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options, overrides) {
|
|
8267
8487
|
var _overrides$noFeeAsset;
|
|
8268
|
-
var api, chain, destination, assetInfo, overriddenAsset, isSubBridge, isSb, transferredAsset, reserveChain, feeAssetInfo, feeAssetLocation, feeReserveChain, NO_FEE_ASSET_LOCS, systemAsset, assetGlobalConsensus, originRelayChain, isExternalDestination, isSnowbridgeAsset, requiresSystemAsset, isAssetHubToExternal, isForeignRelayToExternal, isRelayAsset, assetHubChain, bridgeHopChain, routedChain, destApi, reserveApi;
|
|
8488
|
+
var api, chain, destination, assetInfo, overriddenAsset, isSubBridge, isSb, transferredAsset, reserveChain, feeAssetInfo, feeAssetLocation, feeReserveChain, NO_FEE_ASSET_LOCS, systemAsset, assetGlobalConsensus, originRelayChain, isExternalDestination, isSnowbridgeAsset, requiresSystemAsset, isAssetHubToExternal, isForeignRelayToExternal, isRelayAsset, assetHubChain, bridgeHopChain, routedChain, destApi, reserveApi, context, edDeposit;
|
|
8269
8489
|
return _regenerator().w(function (_context) {
|
|
8270
8490
|
while (1) switch (_context.n) {
|
|
8271
8491
|
case 0:
|
|
@@ -8276,7 +8496,7 @@ var createTypeAndThenCallContext = /*#__PURE__*/function () {
|
|
|
8276
8496
|
transferredAsset = overriddenAsset === null || overriddenAsset === void 0 ? void 0 : overriddenAsset.find(function (asset) {
|
|
8277
8497
|
return !asset.isFeeAsset;
|
|
8278
8498
|
});
|
|
8279
|
-
reserveChain = resolveReserveChain(api, chain, destination, transferredAsset ? extractAssetLocation(transferredAsset) : assetInfo.location, isSubBridge
|
|
8499
|
+
reserveChain = resolveReserveChain(api, chain, destination, transferredAsset ? extractAssetLocation(transferredAsset) : assetInfo.location, isSubBridge);
|
|
8280
8500
|
feeAssetInfo = getFeeAssetInfo(assetInfo, options.feeAssetInfo);
|
|
8281
8501
|
feeAssetLocation = transferredAsset ? assetInfo.location : feeAssetInfo === null || feeAssetInfo === void 0 ? void 0 : feeAssetInfo.location;
|
|
8282
8502
|
feeReserveChain = feeAssetLocation && resolveReserveChain(api, chain, destination, feeAssetLocation, isSubBridge);
|
|
@@ -8336,7 +8556,7 @@ var createTypeAndThenCallContext = /*#__PURE__*/function () {
|
|
|
8336
8556
|
_context.n = 3;
|
|
8337
8557
|
return reserveApi.init(reserveChain);
|
|
8338
8558
|
case 3:
|
|
8339
|
-
|
|
8559
|
+
context = {
|
|
8340
8560
|
origin: {
|
|
8341
8561
|
api: api,
|
|
8342
8562
|
chain: chain
|
|
@@ -8358,7 +8578,21 @@ var createTypeAndThenCallContext = /*#__PURE__*/function () {
|
|
|
8358
8578
|
options: options,
|
|
8359
8579
|
systemAsset: systemAsset,
|
|
8360
8580
|
bridgeHopChain: bridgeHopChain
|
|
8581
|
+
};
|
|
8582
|
+
_context.n = 4;
|
|
8583
|
+
return resolveEdDeposit({
|
|
8584
|
+
origin: context.origin,
|
|
8585
|
+
dest: context.dest,
|
|
8586
|
+
assetInfo: assetInfo,
|
|
8587
|
+
overriddenAsset: overriddenAsset,
|
|
8588
|
+
feeAssetLocation: getFeeAssetLocation(context),
|
|
8589
|
+
recipient: options.recipient
|
|
8361
8590
|
});
|
|
8591
|
+
case 4:
|
|
8592
|
+
edDeposit = _context.v;
|
|
8593
|
+
return _context.a(2, _objectSpread2(_objectSpread2({}, context), {}, {
|
|
8594
|
+
edDeposit: edDeposit
|
|
8595
|
+
}));
|
|
8362
8596
|
}
|
|
8363
8597
|
}, _callee);
|
|
8364
8598
|
}));
|
|
@@ -8448,6 +8682,28 @@ var generateMessageId = /*#__PURE__*/function () {
|
|
|
8448
8682
|
};
|
|
8449
8683
|
}();
|
|
8450
8684
|
|
|
8685
|
+
var createEdExchangeInstructions = function createEdExchangeInstructions(api, destChain, version, feeLocation, isFeeTransferred) {
|
|
8686
|
+
var _api$findNativeAssetI = api.findNativeAssetInfoOrThrow(destChain),
|
|
8687
|
+
location = _api$findNativeAssetI.location,
|
|
8688
|
+
existentialDeposit = _api$findNativeAssetI.existentialDeposit;
|
|
8689
|
+
var nativeLocation = api.localizeLocation(destChain, location);
|
|
8690
|
+
if (deepEqual(feeLocation, nativeLocation)) return [];
|
|
8691
|
+
return [{
|
|
8692
|
+
ExchangeAsset: {
|
|
8693
|
+
give: {
|
|
8694
|
+
Wild: {
|
|
8695
|
+
AllOf: {
|
|
8696
|
+
id: createAssetId(version, feeLocation),
|
|
8697
|
+
fun: 'Fungible'
|
|
8698
|
+
}
|
|
8699
|
+
}
|
|
8700
|
+
},
|
|
8701
|
+
want: [createAsset(version, BigInt(existentialDeposit), nativeLocation)],
|
|
8702
|
+
maximal: !isFeeTransferred
|
|
8703
|
+
}
|
|
8704
|
+
}];
|
|
8705
|
+
};
|
|
8706
|
+
|
|
8451
8707
|
var resolveBuyExecutionAmount = function resolveBuyExecutionAmount(_ref, isForFeeCalc, _ref2, systemAssetAmount) {
|
|
8452
8708
|
var isRelayAsset = _ref.isRelayAsset,
|
|
8453
8709
|
assetInfo = _ref.assetInfo;
|
|
@@ -8481,6 +8737,7 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
8481
8737
|
isRelayAsset,
|
|
8482
8738
|
assetInfo,
|
|
8483
8739
|
bridgeHopChain,
|
|
8740
|
+
edDeposit,
|
|
8484
8741
|
options,
|
|
8485
8742
|
destination,
|
|
8486
8743
|
version,
|
|
@@ -8499,11 +8756,12 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
8499
8756
|
assetLocLocalized,
|
|
8500
8757
|
transferredAsset,
|
|
8501
8758
|
depositLocLocalized,
|
|
8502
|
-
|
|
8503
|
-
allOfSelector,
|
|
8759
|
+
createAllOf,
|
|
8504
8760
|
isFeeLeftoverAboveEd,
|
|
8505
|
-
|
|
8761
|
+
isFeeTransferred,
|
|
8762
|
+
resolveDepositAssets,
|
|
8506
8763
|
depositInstruction,
|
|
8764
|
+
depositInstructions,
|
|
8507
8765
|
localizeFilterAsset,
|
|
8508
8766
|
assetsFilter,
|
|
8509
8767
|
isAssetEthereumNative,
|
|
@@ -8524,7 +8782,7 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
8524
8782
|
hopFees: 0n,
|
|
8525
8783
|
destFee: 0n
|
|
8526
8784
|
};
|
|
8527
|
-
origin = context.origin, dest = context.dest, reserve = context.reserve, isSubBridge = context.isSubBridge, isRelayAsset = context.isRelayAsset, assetInfo = context.assetInfo, bridgeHopChain = context.bridgeHopChain, options = context.options;
|
|
8785
|
+
origin = context.origin, dest = context.dest, reserve = context.reserve, isSubBridge = context.isSubBridge, isRelayAsset = context.isRelayAsset, assetInfo = context.assetInfo, bridgeHopChain = context.bridgeHopChain, edDeposit = context.edDeposit, options = context.options;
|
|
8528
8786
|
destination = options.destination, version = options.version, recipient = options.recipient, paraIdTo = options.paraIdTo, sender = options.sender, ahAddress = options.ahAddress, overriddenAsset = options.overriddenAsset;
|
|
8529
8787
|
buildRefundInstruction = function buildRefundInstruction() {
|
|
8530
8788
|
if (!sender || isSubBridge) return null;
|
|
@@ -8566,12 +8824,15 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
8566
8824
|
return !asset.isFeeAsset;
|
|
8567
8825
|
});
|
|
8568
8826
|
depositLocLocalized = transferredAsset ? origin.api.localizeLocation(dest.chain, extractAssetLocation(transferredAsset), origin.chain) : assetLocLocalized;
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8827
|
+
createAllOf = function createAllOf(location) {
|
|
8828
|
+
return {
|
|
8829
|
+
Wild: {
|
|
8830
|
+
AllOf: {
|
|
8831
|
+
id: createAssetId(version, location),
|
|
8832
|
+
fun: 'Fungible'
|
|
8833
|
+
}
|
|
8834
|
+
}
|
|
8835
|
+
};
|
|
8575
8836
|
};
|
|
8576
8837
|
isFeeLeftoverAboveEd = function isFeeLeftoverAboveEd() {
|
|
8577
8838
|
var destFeeAsset = origin.api.findAssetInfoOnDest(origin.chain, dest.chain, {
|
|
@@ -8579,14 +8840,25 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
8579
8840
|
}, assetInfo);
|
|
8580
8841
|
return destFeeAsset !== null && assetInfo.amount - hopFees - destFee >= BigInt(destFeeAsset.existentialDeposit);
|
|
8581
8842
|
};
|
|
8582
|
-
|
|
8843
|
+
isFeeTransferred = deepEqual(feeLocLocalized, depositLocLocalized);
|
|
8844
|
+
resolveDepositAssets = function resolveDepositAssets() {
|
|
8845
|
+
if (edDeposit !== undefined) {
|
|
8846
|
+
return {
|
|
8847
|
+
Wild: {
|
|
8848
|
+
AllCounted: isFeeTransferred ? assetCount + 1 : assetCount
|
|
8849
|
+
}
|
|
8850
|
+
};
|
|
8851
|
+
}
|
|
8852
|
+
var depositsFeeAsset = overriddenAsset !== undefined && (isForFeeCalc || isExternalChain(dest.chain) || isFeeLeftoverAboveEd());
|
|
8853
|
+
return assetCount > 1 && !depositsFeeAsset ? createAllOf(depositLocLocalized) : {
|
|
8854
|
+
Wild: {
|
|
8855
|
+
AllCounted: assetCount
|
|
8856
|
+
}
|
|
8857
|
+
};
|
|
8858
|
+
};
|
|
8583
8859
|
depositInstruction = {
|
|
8584
8860
|
DepositAsset: {
|
|
8585
|
-
assets:
|
|
8586
|
-
Wild: assetCount > 1 && !depositsFeeAsset ? allOfSelector : {
|
|
8587
|
-
AllCounted: assetCount
|
|
8588
|
-
}
|
|
8589
|
-
},
|
|
8861
|
+
assets: resolveDepositAssets(),
|
|
8590
8862
|
beneficiary: createBeneficiaryLocation({
|
|
8591
8863
|
api: isSubBridge ? dest.api : origin.api,
|
|
8592
8864
|
address: recipient,
|
|
@@ -8594,6 +8866,7 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
8594
8866
|
})
|
|
8595
8867
|
}
|
|
8596
8868
|
};
|
|
8869
|
+
depositInstructions = [].concat(_toConsumableArray(edDeposit === undefined ? [] : createEdExchangeInstructions(origin.api, dest.chain, version, feeLocLocalized, isFeeTransferred)), [depositInstruction]);
|
|
8597
8870
|
localizeFilterAsset = function localizeFilterAsset(amount, location) {
|
|
8598
8871
|
return createAsset(version, amount, normalizeLocation(origin.api.localizeLocation(reserve.chain, location), version));
|
|
8599
8872
|
};
|
|
@@ -8636,7 +8909,7 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
8636
8909
|
_context.n = 3;
|
|
8637
8910
|
break;
|
|
8638
8911
|
}
|
|
8639
|
-
return _context.a(2, [buyExecution
|
|
8912
|
+
return _context.a(2, [buyExecution].concat(_toConsumableArray(depositInstructions)));
|
|
8640
8913
|
case 3:
|
|
8641
8914
|
destLoc = createDestination(origin.api, version, origin.chain, destination, paraIdTo); // If both reserve (B) and destination (C) are trusted chains,
|
|
8642
8915
|
// use teleport instead of DepositReserveAsset
|
|
@@ -8649,7 +8922,7 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
8649
8922
|
InitiateTeleport: {
|
|
8650
8923
|
assets: filter,
|
|
8651
8924
|
dest: destLoc,
|
|
8652
|
-
xcm: [buyExecution
|
|
8925
|
+
xcm: [buyExecution].concat(_toConsumableArray(depositInstructions), setTopic)
|
|
8653
8926
|
}
|
|
8654
8927
|
}], setTopic));
|
|
8655
8928
|
case 4:
|
|
@@ -8684,11 +8957,11 @@ var createCustomXcm = /*#__PURE__*/function () {
|
|
|
8684
8957
|
DepositReserveAsset: {
|
|
8685
8958
|
assets: filter,
|
|
8686
8959
|
dest: destLoc,
|
|
8687
|
-
xcm: [buyExecution
|
|
8960
|
+
xcm: [buyExecution].concat(_toConsumableArray(depositInstructions), setTopic)
|
|
8688
8961
|
}
|
|
8689
8962
|
}], setTopic));
|
|
8690
8963
|
case 6:
|
|
8691
|
-
return _context.a(2, [
|
|
8964
|
+
return _context.a(2, [].concat(_toConsumableArray(depositInstructions), setTopic));
|
|
8692
8965
|
}
|
|
8693
8966
|
}, _callee);
|
|
8694
8967
|
}));
|
|
@@ -8790,7 +9063,6 @@ var createTypeAndThenCall = /*#__PURE__*/function () {
|
|
|
8790
9063
|
while (1) switch (_context3.n) {
|
|
8791
9064
|
case 0:
|
|
8792
9065
|
overrides = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : {
|
|
8793
|
-
reserveChain: undefined,
|
|
8794
9066
|
noFeeAsset: false
|
|
8795
9067
|
};
|
|
8796
9068
|
_context3.n = 1;
|
|
@@ -8815,132 +9087,36 @@ var createTypeAndThenCall = /*#__PURE__*/function () {
|
|
|
8815
9087
|
_context3.n = 4;
|
|
8816
9088
|
return computeAllFees(context, /*#__PURE__*/function () {
|
|
8817
9089
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(amount, relative) {
|
|
8818
|
-
var overridenAmount, _t, _t2;
|
|
8819
|
-
return _regenerator().w(function (_context2) {
|
|
8820
|
-
while (1) switch (_context2.n) {
|
|
8821
|
-
case 0:
|
|
8822
|
-
overridenAmount = amount ? relative ? assetInfo.amount + parseUnits(amount, assetInfo.decimals) : parseUnits(amount, assetInfo.decimals) : assetInfo.amount;
|
|
8823
|
-
_t = Promise;
|
|
8824
|
-
_t2 = origin.api;
|
|
8825
|
-
_context2.n = 1;
|
|
8826
|
-
return constructTypeAndThenCall(_objectSpread2(_objectSpread2({}, context), {}, {
|
|
8827
|
-
assetInfo: _objectSpread2(_objectSpread2({}, assetInfo), {}, {
|
|
8828
|
-
amount: overridenAmount
|
|
8829
|
-
})
|
|
8830
|
-
}));
|
|
8831
|
-
case 1:
|
|
8832
|
-
return _context2.a(2, _t.resolve.call(_t, _t2.deserializeExtrinsics.call(_t2, _context2.v)));
|
|
8833
|
-
}
|
|
8834
|
-
}, _callee2);
|
|
8835
|
-
}));
|
|
8836
|
-
return function (_x3, _x4) {
|
|
8837
|
-
return _ref4.apply(this, arguments);
|
|
8838
|
-
};
|
|
8839
|
-
}());
|
|
8840
|
-
case 4:
|
|
8841
|
-
fees = _context3.v;
|
|
8842
|
-
return _context3.a(2, constructTypeAndThenCall(context, fees));
|
|
8843
|
-
}
|
|
8844
|
-
}, _callee3);
|
|
8845
|
-
}));
|
|
8846
|
-
return function createTypeAndThenCall(_x2) {
|
|
8847
|
-
return _ref3.apply(this, arguments);
|
|
8848
|
-
};
|
|
8849
|
-
}();
|
|
8850
|
-
|
|
8851
|
-
var createCallForReserve = /*#__PURE__*/function () {
|
|
8852
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(chain, reserveChain, options) {
|
|
8853
|
-
var api, destination, sender, recipient, currency, feeCurrency, version, serialized, tx, dryRunResult;
|
|
8854
|
-
return _regenerator().w(function (_context) {
|
|
8855
|
-
while (1) switch (_context.n) {
|
|
8856
|
-
case 0:
|
|
8857
|
-
api = options.api, destination = options.destination, sender = options.sender, recipient = options.recipient, currency = options.currency, feeCurrency = options.feeCurrency, version = options.version;
|
|
8858
|
-
_context.n = 1;
|
|
8859
|
-
return createTypeAndThenCall(options, {
|
|
8860
|
-
reserveChain: reserveChain
|
|
8861
|
-
});
|
|
8862
|
-
case 1:
|
|
8863
|
-
serialized = _context.v;
|
|
8864
|
-
assertSender(sender);
|
|
8865
|
-
assertAddressIsString(recipient);
|
|
8866
|
-
assertToIsString(destination, 'Location destination is not supported for reserve auto-selection.');
|
|
8867
|
-
tx = api.deserializeExtrinsics(serialized);
|
|
8868
|
-
_context.n = 2;
|
|
8869
|
-
return dryRunInternal({
|
|
8870
|
-
api: api,
|
|
8871
|
-
tx: tx,
|
|
8872
|
-
origin: chain,
|
|
8873
|
-
destination: destination,
|
|
8874
|
-
sender: sender,
|
|
8875
|
-
currency: currency,
|
|
8876
|
-
version: version,
|
|
8877
|
-
feeAsset: feeCurrency,
|
|
8878
|
-
useRootOrigin: true
|
|
8879
|
-
});
|
|
8880
|
-
case 2:
|
|
8881
|
-
dryRunResult = _context.v;
|
|
8882
|
-
return _context.a(2, {
|
|
8883
|
-
call: serialized,
|
|
8884
|
-
success: dryRunResult.success
|
|
8885
|
-
});
|
|
8886
|
-
}
|
|
8887
|
-
}, _callee);
|
|
8888
|
-
}));
|
|
8889
|
-
return function createCallForReserve(_x, _x2, _x3) {
|
|
8890
|
-
return _ref.apply(this, arguments);
|
|
8891
|
-
};
|
|
8892
|
-
}();
|
|
8893
|
-
/**
|
|
8894
|
-
* Creates a type-and-then call but auto-selects the asset reserve between AssetHub and the Relay chain
|
|
8895
|
-
* by dry-running both variants and preferring the one that succeeds. If both fail, returns the
|
|
8896
|
-
* AssetHub variant. Supports only relaychain assets.
|
|
8897
|
-
*/
|
|
8898
|
-
var createTypeThenAutoReserve = /*#__PURE__*/function () {
|
|
8899
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(chain, options) {
|
|
8900
|
-
var originSupports, destSupports, relay, assetHubReserve, ahResult, relayResult;
|
|
8901
|
-
return _regenerator().w(function (_context2) {
|
|
8902
|
-
while (1) switch (_context2.n) {
|
|
8903
|
-
case 0:
|
|
8904
|
-
// Use dry-run path only when BOTH origin and destination support it
|
|
8905
|
-
originSupports = hasDryRunSupport(chain);
|
|
8906
|
-
destSupports = options.destChain ? hasDryRunSupport(options.destChain) : false;
|
|
8907
|
-
if (originSupports && destSupports) {
|
|
8908
|
-
_context2.n = 2;
|
|
8909
|
-
break;
|
|
8910
|
-
}
|
|
8911
|
-
_context2.n = 1;
|
|
8912
|
-
return createTypeAndThenCall(options);
|
|
8913
|
-
case 1:
|
|
8914
|
-
return _context2.a(2, _context2.v);
|
|
8915
|
-
case 2:
|
|
8916
|
-
relay = getRelayChainOf(chain);
|
|
8917
|
-
assetHubReserve = "AssetHub".concat(relay);
|
|
8918
|
-
_context2.n = 3;
|
|
8919
|
-
return createCallForReserve(chain, assetHubReserve, options);
|
|
8920
|
-
case 3:
|
|
8921
|
-
ahResult = _context2.v;
|
|
8922
|
-
if (!ahResult.success) {
|
|
8923
|
-
_context2.n = 4;
|
|
8924
|
-
break;
|
|
8925
|
-
}
|
|
8926
|
-
return _context2.a(2, ahResult.call);
|
|
9090
|
+
var overridenAmount, _t, _t2;
|
|
9091
|
+
return _regenerator().w(function (_context2) {
|
|
9092
|
+
while (1) switch (_context2.n) {
|
|
9093
|
+
case 0:
|
|
9094
|
+
overridenAmount = amount ? relative ? assetInfo.amount + parseUnits(amount, assetInfo.decimals) : parseUnits(amount, assetInfo.decimals) : assetInfo.amount;
|
|
9095
|
+
_t = Promise;
|
|
9096
|
+
_t2 = origin.api;
|
|
9097
|
+
_context2.n = 1;
|
|
9098
|
+
return constructTypeAndThenCall(_objectSpread2(_objectSpread2({}, context), {}, {
|
|
9099
|
+
assetInfo: _objectSpread2(_objectSpread2({}, assetInfo), {}, {
|
|
9100
|
+
amount: overridenAmount
|
|
9101
|
+
})
|
|
9102
|
+
}));
|
|
9103
|
+
case 1:
|
|
9104
|
+
return _context2.a(2, _t.resolve.call(_t, _t2.deserializeExtrinsics.call(_t2, _context2.v)));
|
|
9105
|
+
}
|
|
9106
|
+
}, _callee2);
|
|
9107
|
+
}));
|
|
9108
|
+
return function (_x3, _x4) {
|
|
9109
|
+
return _ref4.apply(this, arguments);
|
|
9110
|
+
};
|
|
9111
|
+
}());
|
|
8927
9112
|
case 4:
|
|
8928
|
-
|
|
8929
|
-
return
|
|
8930
|
-
case 5:
|
|
8931
|
-
relayResult = _context2.v;
|
|
8932
|
-
if (!relayResult.success) {
|
|
8933
|
-
_context2.n = 6;
|
|
8934
|
-
break;
|
|
8935
|
-
}
|
|
8936
|
-
return _context2.a(2, relayResult.call);
|
|
8937
|
-
case 6:
|
|
8938
|
-
return _context2.a(2, ahResult.call);
|
|
9113
|
+
fees = _context3.v;
|
|
9114
|
+
return _context3.a(2, constructTypeAndThenCall(context, fees));
|
|
8939
9115
|
}
|
|
8940
|
-
},
|
|
9116
|
+
}, _callee3);
|
|
8941
9117
|
}));
|
|
8942
|
-
return function
|
|
8943
|
-
return
|
|
9118
|
+
return function createTypeAndThenCall(_x2) {
|
|
9119
|
+
return _ref3.apply(this, arguments);
|
|
8944
9120
|
};
|
|
8945
9121
|
}();
|
|
8946
9122
|
|
|
@@ -9262,27 +9438,38 @@ var abstractDecimals = function abstractDecimals(amount, decimals, api) {
|
|
|
9262
9438
|
var abstractDecimals = !(isConfig(config) && config.abstractDecimals === false);
|
|
9263
9439
|
return applyDecimalAbstraction(amount, decimals, abstractDecimals);
|
|
9264
9440
|
};
|
|
9441
|
+
var toDecimalString = function toDecimalString(amount) {
|
|
9442
|
+
if (typeof amount !== 'number') return amount.toString();
|
|
9443
|
+
var _amount$toString$spli = amount.toString().split('e'),
|
|
9444
|
+
_amount$toString$spli2 = _slicedToArray(_amount$toString$spli, 2),
|
|
9445
|
+
mantissa = _amount$toString$spli2[0],
|
|
9446
|
+
exponent = _amount$toString$spli2[1];
|
|
9447
|
+
if (exponent === undefined) return mantissa;
|
|
9448
|
+
var sign = amount < 0 ? '-' : '';
|
|
9449
|
+
var digits = mantissa.replace(/[-.]/g, '');
|
|
9450
|
+
var point = Number(exponent) + 1;
|
|
9451
|
+
return sign + (point > 0 ? digits.padEnd(point, '0') : "0.".concat('0'.repeat(-point)).concat(digits));
|
|
9452
|
+
};
|
|
9265
9453
|
var applyDecimalAbstraction = function applyDecimalAbstraction(amount, decimals, shouldAbstract) {
|
|
9266
9454
|
// If amount is already bigint, return as-is
|
|
9267
9455
|
if (typeof amount === 'bigint') {
|
|
9268
9456
|
return amount;
|
|
9269
9457
|
}
|
|
9458
|
+
var strAmount = toDecimalString(amount);
|
|
9270
9459
|
if (!shouldAbstract) {
|
|
9271
|
-
var strAmount = amount.toString();
|
|
9272
9460
|
if (strAmount.includes('.')) {
|
|
9273
9461
|
throw new NumberFormatError("Non-abstracted amount cannot have decimals: ".concat(strAmount));
|
|
9274
9462
|
}
|
|
9275
9463
|
return BigInt(strAmount);
|
|
9276
9464
|
}
|
|
9277
9465
|
if (decimals === undefined) {
|
|
9278
|
-
|
|
9279
|
-
if (_strAmount.includes('.')) {
|
|
9466
|
+
if (strAmount.includes('.')) {
|
|
9280
9467
|
// Return integer part only as fallback
|
|
9281
|
-
return BigInt(
|
|
9468
|
+
return BigInt(strAmount.split('.')[0]);
|
|
9282
9469
|
}
|
|
9283
|
-
return BigInt(
|
|
9470
|
+
return BigInt(strAmount);
|
|
9284
9471
|
}
|
|
9285
|
-
return parseUnits(
|
|
9472
|
+
return parseUnits(strAmount, decimals);
|
|
9286
9473
|
};
|
|
9287
9474
|
|
|
9288
9475
|
var createAllCountedFilter = function createAllCountedFilter(count) {
|
|
@@ -9527,101 +9714,13 @@ xcm, maxWeight) {
|
|
|
9527
9714
|
};
|
|
9528
9715
|
};
|
|
9529
9716
|
|
|
9530
|
-
var createExecuteExchangeXcm = function createExecuteExchangeXcm(input, origin, weight, originExecutionFee, destExecutionFee) {
|
|
9531
|
-
var api = input.api,
|
|
9532
|
-
version = input.version,
|
|
9533
|
-
asset = input.assetInfo,
|
|
9534
|
-
destination = input.destination,
|
|
9535
|
-
paraIdTo = input.paraIdTo,
|
|
9536
|
-
recipient = input.recipient;
|
|
9537
|
-
var dest = createDestination(api, version, origin, destination, paraIdTo);
|
|
9538
|
-
var beneficiary = createBeneficiaryLocation({
|
|
9539
|
-
api: api,
|
|
9540
|
-
address: recipient,
|
|
9541
|
-
version: version
|
|
9542
|
-
});
|
|
9543
|
-
var transformedLocation = localizeLocation(origin, asset.location);
|
|
9544
|
-
var call = {
|
|
9545
|
-
module: 'PolkadotXcm',
|
|
9546
|
-
method: 'execute',
|
|
9547
|
-
params: {
|
|
9548
|
-
message: _defineProperty({}, version, [{
|
|
9549
|
-
WithdrawAsset: [{
|
|
9550
|
-
id: transformedLocation,
|
|
9551
|
-
fun: {
|
|
9552
|
-
Fungible: asset.amount
|
|
9553
|
-
}
|
|
9554
|
-
}]
|
|
9555
|
-
}, {
|
|
9556
|
-
BuyExecution: {
|
|
9557
|
-
fees: {
|
|
9558
|
-
id: transformedLocation,
|
|
9559
|
-
fun: {
|
|
9560
|
-
Fungible: originExecutionFee
|
|
9561
|
-
}
|
|
9562
|
-
},
|
|
9563
|
-
weight_limit: 'Unlimited'
|
|
9564
|
-
}
|
|
9565
|
-
}, {
|
|
9566
|
-
InitiateTeleport: {
|
|
9567
|
-
assets: {
|
|
9568
|
-
Wild: {
|
|
9569
|
-
AllCounted: 1
|
|
9570
|
-
}
|
|
9571
|
-
},
|
|
9572
|
-
dest: dest,
|
|
9573
|
-
xcm: [{
|
|
9574
|
-
BuyExecution: {
|
|
9575
|
-
fees: {
|
|
9576
|
-
id: asset.location,
|
|
9577
|
-
fun: {
|
|
9578
|
-
Fungible: destExecutionFee
|
|
9579
|
-
}
|
|
9580
|
-
},
|
|
9581
|
-
weight_limit: 'Unlimited'
|
|
9582
|
-
}
|
|
9583
|
-
}, {
|
|
9584
|
-
ExchangeAsset: {
|
|
9585
|
-
give: {
|
|
9586
|
-
Wild: {
|
|
9587
|
-
AllCounted: 1
|
|
9588
|
-
}
|
|
9589
|
-
},
|
|
9590
|
-
want: [{
|
|
9591
|
-
id: DOT_LOCATION,
|
|
9592
|
-
fun: {
|
|
9593
|
-
Fungible: 100000000n
|
|
9594
|
-
} // 0.01 DOT
|
|
9595
|
-
}],
|
|
9596
|
-
maximal: false
|
|
9597
|
-
}
|
|
9598
|
-
}, {
|
|
9599
|
-
DepositAsset: {
|
|
9600
|
-
assets: {
|
|
9601
|
-
Wild: {
|
|
9602
|
-
AllCounted: 2
|
|
9603
|
-
}
|
|
9604
|
-
},
|
|
9605
|
-
beneficiary: beneficiary
|
|
9606
|
-
}
|
|
9607
|
-
}]
|
|
9608
|
-
}
|
|
9609
|
-
}]),
|
|
9610
|
-
max_weight: {
|
|
9611
|
-
ref_time: weight.refTime,
|
|
9612
|
-
proof_size: weight.proofSize
|
|
9613
|
-
}
|
|
9614
|
-
}
|
|
9615
|
-
};
|
|
9616
|
-
return api.deserializeExtrinsics(call);
|
|
9617
|
-
};
|
|
9618
|
-
|
|
9619
9717
|
var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToDeposit) {
|
|
9620
9718
|
var depositFeeAsset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
9621
9719
|
var api = options.api,
|
|
9622
9720
|
useJitWithdraw = options.useJitWithdraw,
|
|
9623
9721
|
recipient = options.recipient,
|
|
9624
|
-
version = options.version
|
|
9722
|
+
version = options.version,
|
|
9723
|
+
edDeposit = options.edDeposit;
|
|
9625
9724
|
var context = prepareExecuteContext(options);
|
|
9626
9725
|
var assetLocalized = context.assetLocalized,
|
|
9627
9726
|
assetLocalizedToDest = context.assetLocalizedToDest,
|
|
@@ -9647,7 +9746,7 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
|
|
|
9647
9746
|
});
|
|
9648
9747
|
var depositInstruction = {
|
|
9649
9748
|
DepositAsset: {
|
|
9650
|
-
assets: depositFeeAsset ? createAllCountedFilter(2) : createAssetsFilter(assetToDeposit !== null && assetToDeposit !== void 0 ? assetToDeposit : assetLocalizedToDest, version),
|
|
9749
|
+
assets: depositFeeAsset || edDeposit !== undefined ? createAllCountedFilter(2) : createAssetsFilter(assetToDeposit !== null && assetToDeposit !== void 0 ? assetToDeposit : assetLocalizedToDest, version),
|
|
9651
9750
|
beneficiary: beneficiary
|
|
9652
9751
|
}
|
|
9653
9752
|
};
|
|
@@ -9659,11 +9758,11 @@ var prepareCommonExecuteXcm = function prepareCommonExecuteXcm(options, assetToD
|
|
|
9659
9758
|
|
|
9660
9759
|
var createDirectExecuteXcm = /*#__PURE__*/function () {
|
|
9661
9760
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
9662
|
-
var api, version, transactOptions, destChain, recipient, _prepareCommonExecute, prefix, depositInstruction, transact, baseXcm, fullXcm, _t;
|
|
9761
|
+
var api, version, transactOptions, destChain, recipient, assetInfo, feeAssetInfo, edDeposit, _prepareCommonExecute, prefix, depositInstruction, transact, resolvedFeeAssetInfo, edExchangeInstructions, baseXcm, fullXcm, _t;
|
|
9663
9762
|
return _regenerator().w(function (_context) {
|
|
9664
9763
|
while (1) switch (_context.n) {
|
|
9665
9764
|
case 0:
|
|
9666
|
-
api = options.api, version = options.version, transactOptions = options.transactOptions, destChain = options.destChain, recipient = options.recipient;
|
|
9765
|
+
api = options.api, version = options.version, transactOptions = options.transactOptions, destChain = options.destChain, recipient = options.recipient, assetInfo = options.assetInfo, feeAssetInfo = options.feeAssetInfo, edDeposit = options.edDeposit;
|
|
9667
9766
|
_prepareCommonExecute = prepareCommonExecuteXcm(options), prefix = _prepareCommonExecute.prefix, depositInstruction = _prepareCommonExecute.depositInstruction;
|
|
9668
9767
|
if (!(transactOptions !== null && transactOptions !== void 0 && transactOptions.call)) {
|
|
9669
9768
|
_context.n = 2;
|
|
@@ -9679,8 +9778,10 @@ var createDirectExecuteXcm = /*#__PURE__*/function () {
|
|
|
9679
9778
|
_t = [];
|
|
9680
9779
|
case 3:
|
|
9681
9780
|
transact = _t;
|
|
9781
|
+
resolvedFeeAssetInfo = getFeeAssetInfo(assetInfo, feeAssetInfo);
|
|
9782
|
+
edExchangeInstructions = edDeposit === undefined ? [] : createEdExchangeInstructions(api, destChain, version, api.localizeLocation(destChain, (resolvedFeeAssetInfo !== null && resolvedFeeAssetInfo !== void 0 ? resolvedFeeAssetInfo : assetInfo).location), !resolvedFeeAssetInfo);
|
|
9682
9783
|
baseXcm = createBaseExecuteXcm(_objectSpread2(_objectSpread2({}, options), {}, {
|
|
9683
|
-
suffixXcm:
|
|
9784
|
+
suffixXcm: [].concat(_toConsumableArray(transact), _toConsumableArray(edExchangeInstructions), [depositInstruction])
|
|
9684
9785
|
}));
|
|
9685
9786
|
fullXcm = [].concat(_toConsumableArray(prefix), _toConsumableArray(baseXcm));
|
|
9686
9787
|
return _context.a(2, addXcmVersionHeader(fullXcm, version));
|
|
@@ -9699,7 +9800,7 @@ var FEE_PADDING_PERCENTAGE$1 = 40;
|
|
|
9699
9800
|
var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
9700
9801
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
9701
9802
|
var _dryRunResult$hops$at;
|
|
9702
|
-
var api, chain, sender, paraIdTo, destChain, assetInfo, currency, feeCurrency, recipient, feeAssetInfo, version, transactOptions, checkAmount, internalOptions, FEE_ASSET_AMOUNT, feeAssetAmount,
|
|
9803
|
+
var api, chain, sender, paraIdTo, destChain, assetInfo, currency, feeCurrency, recipient, feeAssetInfo, version, transactOptions, checkAmount, resolvedFeeAssetInfo, destApi, edDeposit, internalOptions, FEE_ASSET_AMOUNT, feeAssetAmount, hopFeeAmount, call, dryRunResult, originFee, reserveFee, destFee, xcm, weight, _t, _t2;
|
|
9703
9804
|
return _regenerator().w(function (_context) {
|
|
9704
9805
|
while (1) switch (_context.n) {
|
|
9705
9806
|
case 0:
|
|
@@ -9722,6 +9823,30 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
9722
9823
|
}
|
|
9723
9824
|
throw new RoutingResolutionError('Could not determine destination chain for execute transfer');
|
|
9724
9825
|
case 2:
|
|
9826
|
+
resolvedFeeAssetInfo = getFeeAssetInfo(assetInfo, feeAssetInfo);
|
|
9827
|
+
destApi = api.clone();
|
|
9828
|
+
_context.n = 3;
|
|
9829
|
+
return destApi.init(destChain);
|
|
9830
|
+
case 3:
|
|
9831
|
+
_context.n = 4;
|
|
9832
|
+
return resolveEdDeposit({
|
|
9833
|
+
origin: {
|
|
9834
|
+
api: api,
|
|
9835
|
+
chain: chain
|
|
9836
|
+
},
|
|
9837
|
+
dest: {
|
|
9838
|
+
api: destApi,
|
|
9839
|
+
chain: destChain
|
|
9840
|
+
},
|
|
9841
|
+
assetInfo: assetInfo,
|
|
9842
|
+
feeAssetLocation: (resolvedFeeAssetInfo !== null && resolvedFeeAssetInfo !== void 0 ? resolvedFeeAssetInfo : assetInfo).location,
|
|
9843
|
+
recipient: recipient
|
|
9844
|
+
});
|
|
9845
|
+
case 4:
|
|
9846
|
+
edDeposit = _context.v;
|
|
9847
|
+
_context.n = 5;
|
|
9848
|
+
return destApi.disconnect();
|
|
9849
|
+
case 5:
|
|
9725
9850
|
internalOptions = {
|
|
9726
9851
|
api: api,
|
|
9727
9852
|
chain: chain,
|
|
@@ -9734,15 +9859,15 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
9734
9859
|
recipient: recipient,
|
|
9735
9860
|
version: version,
|
|
9736
9861
|
paraIdTo: paraIdTo,
|
|
9737
|
-
transactOptions: transactOptions
|
|
9862
|
+
transactOptions: transactOptions,
|
|
9863
|
+
edDeposit: edDeposit
|
|
9738
9864
|
}; // We mint 1000 units of feeAsset and use 100
|
|
9739
9865
|
FEE_ASSET_AMOUNT = 100;
|
|
9740
9866
|
feeAssetAmount = feeAssetInfo ? parseUnits(FEE_ASSET_AMOUNT.toString(), feeAssetInfo.decimals) : MIN_FEE;
|
|
9741
|
-
resolvedFeeAssetInfo = getFeeAssetInfo(assetInfo, feeAssetInfo);
|
|
9742
9867
|
hopFeeAmount = resolvedFeeAssetInfo ? feeAssetAmount : MIN_FEE;
|
|
9743
9868
|
_t = createExecuteCall;
|
|
9744
9869
|
_t2 = chain;
|
|
9745
|
-
_context.n =
|
|
9870
|
+
_context.n = 6;
|
|
9746
9871
|
return createDirectExecuteXcm(_objectSpread2(_objectSpread2({}, internalOptions), {}, {
|
|
9747
9872
|
fees: {
|
|
9748
9873
|
originFee: feeAssetAmount,
|
|
@@ -9750,9 +9875,9 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
9750
9875
|
destFee: hopFeeAmount
|
|
9751
9876
|
}
|
|
9752
9877
|
}));
|
|
9753
|
-
case
|
|
9878
|
+
case 6:
|
|
9754
9879
|
call = _t(_t2, _context.v, MAX_WEIGHT);
|
|
9755
|
-
_context.n =
|
|
9880
|
+
_context.n = 7;
|
|
9756
9881
|
return dryRunInternal({
|
|
9757
9882
|
api: api,
|
|
9758
9883
|
tx: api.deserializeExtrinsics(call),
|
|
@@ -9764,22 +9889,22 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
9764
9889
|
feeAsset: feeCurrency,
|
|
9765
9890
|
useRootOrigin: true
|
|
9766
9891
|
});
|
|
9767
|
-
case
|
|
9892
|
+
case 7:
|
|
9768
9893
|
dryRunResult = _context.v;
|
|
9769
9894
|
if (dryRunResult.origin.success) {
|
|
9770
|
-
_context.n =
|
|
9895
|
+
_context.n = 8;
|
|
9771
9896
|
break;
|
|
9772
9897
|
}
|
|
9773
9898
|
throw new DryRunFailedError(_objectSpread2(_objectSpread2({}, dryRunResult.origin.dryRunError), {}, {
|
|
9774
9899
|
chainKind: 'origin',
|
|
9775
9900
|
chain: chain
|
|
9776
9901
|
}));
|
|
9777
|
-
case
|
|
9902
|
+
case 8:
|
|
9778
9903
|
originFee = padValueBy(dryRunResult.origin.fee, FEE_PADDING_PERCENTAGE$1);
|
|
9779
9904
|
reserveFee = padValueBy(getFeeFromResult((_dryRunResult$hops$at = dryRunResult.hops.at(0)) === null || _dryRunResult$hops$at === void 0 ? void 0 : _dryRunResult$hops$at.result), FEE_PADDING_PERCENTAGE$1);
|
|
9780
|
-
destFee = padValueBy(getFeeFromResult(dryRunResult.destination), FEE_PADDING_PERCENTAGE$1);
|
|
9905
|
+
destFee = padValueBy(getFeeFromResult(dryRunResult.destination), FEE_PADDING_PERCENTAGE$1) + (edDeposit !== null && edDeposit !== void 0 ? edDeposit : 0n);
|
|
9781
9906
|
if (!resolvedFeeAssetInfo) checkAmount(reserveFee);
|
|
9782
|
-
_context.n =
|
|
9907
|
+
_context.n = 9;
|
|
9783
9908
|
return createDirectExecuteXcm(_objectSpread2(_objectSpread2({}, internalOptions), {}, {
|
|
9784
9909
|
fees: {
|
|
9785
9910
|
originFee: originFee,
|
|
@@ -9787,11 +9912,11 @@ var handleExecuteTransfer = /*#__PURE__*/function () {
|
|
|
9787
9912
|
destFee: destFee
|
|
9788
9913
|
}
|
|
9789
9914
|
}));
|
|
9790
|
-
case
|
|
9915
|
+
case 9:
|
|
9791
9916
|
xcm = _context.v;
|
|
9792
|
-
_context.n =
|
|
9917
|
+
_context.n = 10;
|
|
9793
9918
|
return api.getXcmWeight(xcm);
|
|
9794
|
-
case
|
|
9919
|
+
case 10:
|
|
9795
9920
|
weight = _context.v;
|
|
9796
9921
|
return _context.a(2, createExecuteCall(chain, xcm, weight));
|
|
9797
9922
|
}
|
|
@@ -10498,72 +10623,6 @@ var getLocalTransferAmount = function getLocalTransferAmount(_ref) {
|
|
|
10498
10623
|
return amount;
|
|
10499
10624
|
};
|
|
10500
10625
|
|
|
10501
|
-
var handleToAhTeleport = /*#__PURE__*/function () {
|
|
10502
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(origin, input, defaultTx) {
|
|
10503
|
-
var _dryRunResult$destina, _feeResult$origin$wei;
|
|
10504
|
-
var api, destination, sender, recipient, asset, currency, version, dryRunResult, dummyTx, feeResult, originExecutionFee, destinationExecutionFee;
|
|
10505
|
-
return _regenerator().w(function (_context) {
|
|
10506
|
-
while (1) switch (_context.n) {
|
|
10507
|
-
case 0:
|
|
10508
|
-
api = input.api, destination = input.destination, sender = input.sender, recipient = input.recipient, asset = input.assetInfo, currency = input.currency, version = input.version;
|
|
10509
|
-
assertToIsString(destination, 'Location destination is not supported for AH teleport.');
|
|
10510
|
-
if (!isTLocation(recipient)) {
|
|
10511
|
-
_context.n = 1;
|
|
10512
|
-
break;
|
|
10513
|
-
}
|
|
10514
|
-
throw new InvalidAddressError('Location address is not supported for this scenario');
|
|
10515
|
-
case 1:
|
|
10516
|
-
assertSender(sender);
|
|
10517
|
-
_context.n = 2;
|
|
10518
|
-
return dryRunInternal({
|
|
10519
|
-
api: api,
|
|
10520
|
-
tx: defaultTx,
|
|
10521
|
-
origin: origin,
|
|
10522
|
-
destination: destination,
|
|
10523
|
-
sender: sender,
|
|
10524
|
-
currency: currency,
|
|
10525
|
-
version: version
|
|
10526
|
-
});
|
|
10527
|
-
case 2:
|
|
10528
|
-
dryRunResult = _context.v;
|
|
10529
|
-
if (!((_dryRunResult$destina = dryRunResult.destination) !== null && _dryRunResult$destina !== void 0 && _dryRunResult$destina.success)) {
|
|
10530
|
-
_context.n = 3;
|
|
10531
|
-
break;
|
|
10532
|
-
}
|
|
10533
|
-
return _context.a(2, defaultTx);
|
|
10534
|
-
case 3:
|
|
10535
|
-
// If the default tx dry run failed, we need to create execute transaction
|
|
10536
|
-
dummyTx = createExecuteExchangeXcm(input, origin, MAX_WEIGHT,
|
|
10537
|
-
// Enter dummy fee values just to get the dry run to pass
|
|
10538
|
-
asset.amount, asset.amount / 2n);
|
|
10539
|
-
_context.n = 4;
|
|
10540
|
-
return getXcmFeeOnce({
|
|
10541
|
-
api: api,
|
|
10542
|
-
tx: dummyTx,
|
|
10543
|
-
origin: origin,
|
|
10544
|
-
destination: destination,
|
|
10545
|
-
sender: sender,
|
|
10546
|
-
recipient: recipient,
|
|
10547
|
-
version: version,
|
|
10548
|
-
currency: currency,
|
|
10549
|
-
disableFallback: false,
|
|
10550
|
-
useRootOrigin: true
|
|
10551
|
-
});
|
|
10552
|
-
case 4:
|
|
10553
|
-
feeResult = _context.v;
|
|
10554
|
-
originExecutionFee = padValueBy(feeResult.origin.fee, 20); // Pad by 20%
|
|
10555
|
-
destinationExecutionFee = padValueBy(
|
|
10556
|
-
// Pad by 20%
|
|
10557
|
-
feeResult.destination.feeType === 'paymentInfo' ? feeResult.origin.fee : feeResult.destination.fee, 20);
|
|
10558
|
-
return _context.a(2, createExecuteExchangeXcm(input, origin, (_feeResult$origin$wei = feeResult.origin.weight) !== null && _feeResult$origin$wei !== void 0 ? _feeResult$origin$wei : MAX_WEIGHT, originExecutionFee, destinationExecutionFee));
|
|
10559
|
-
}
|
|
10560
|
-
}, _callee);
|
|
10561
|
-
}));
|
|
10562
|
-
return function handleToAhTeleport(_x, _x2, _x3) {
|
|
10563
|
-
return _ref.apply(this, arguments);
|
|
10564
|
-
};
|
|
10565
|
-
}();
|
|
10566
|
-
|
|
10567
10626
|
var throwUnsupportedCurrency = function throwUnsupportedCurrency(currency, chain) {
|
|
10568
10627
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
10569
10628
|
isDestination: false
|
|
@@ -10595,50 +10654,6 @@ var Acala = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
10595
10654
|
value: function isRelayToParaEnabled() {
|
|
10596
10655
|
return false;
|
|
10597
10656
|
}
|
|
10598
|
-
}, {
|
|
10599
|
-
key: "transferLocalNativeAsset",
|
|
10600
|
-
value: function () {
|
|
10601
|
-
var _transferLocalNativeAsset = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(options) {
|
|
10602
|
-
var api, recipient, sender, isAmountAll, keepAlive, createTx, fee, _yield$api$getPayment, partialFee, amount;
|
|
10603
|
-
return _regenerator().w(function (_context) {
|
|
10604
|
-
while (1) switch (_context.n) {
|
|
10605
|
-
case 0:
|
|
10606
|
-
api = options.api, recipient = options.recipient, sender = options.sender, isAmountAll = options.isAmountAll, keepAlive = options.keepAlive;
|
|
10607
|
-
createTx = function createTx(amount) {
|
|
10608
|
-
return api.deserializeExtrinsics({
|
|
10609
|
-
module: 'Currencies',
|
|
10610
|
-
method: 'transfer_native_currency',
|
|
10611
|
-
params: {
|
|
10612
|
-
dest: {
|
|
10613
|
-
Id: recipient
|
|
10614
|
-
},
|
|
10615
|
-
amount: amount
|
|
10616
|
-
}
|
|
10617
|
-
});
|
|
10618
|
-
};
|
|
10619
|
-
fee = 0n;
|
|
10620
|
-
if (!(isAmountAll || keepAlive)) {
|
|
10621
|
-
_context.n = 2;
|
|
10622
|
-
break;
|
|
10623
|
-
}
|
|
10624
|
-
assertSender(sender);
|
|
10625
|
-
_context.n = 1;
|
|
10626
|
-
return api.getPaymentInfo(createTx(MIN_AMOUNT), sender);
|
|
10627
|
-
case 1:
|
|
10628
|
-
_yield$api$getPayment = _context.v;
|
|
10629
|
-
partialFee = _yield$api$getPayment.partialFee;
|
|
10630
|
-
fee = BigInt(partialFee);
|
|
10631
|
-
case 2:
|
|
10632
|
-
amount = getLocalTransferAmount(options, fee);
|
|
10633
|
-
return _context.a(2, createTx(amount));
|
|
10634
|
-
}
|
|
10635
|
-
}, _callee);
|
|
10636
|
-
}));
|
|
10637
|
-
function transferLocalNativeAsset(_x) {
|
|
10638
|
-
return _transferLocalNativeAsset.apply(this, arguments);
|
|
10639
|
-
}
|
|
10640
|
-
return transferLocalNativeAsset;
|
|
10641
|
-
}()
|
|
10642
10657
|
}, {
|
|
10643
10658
|
key: "transferLocalNonNativeAsset",
|
|
10644
10659
|
value: function transferLocalNonNativeAsset(options) {
|
|
@@ -10646,7 +10661,7 @@ var Acala = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
10646
10661
|
asset = options.assetInfo,
|
|
10647
10662
|
recipient = options.recipient;
|
|
10648
10663
|
if (asset.symbol.toLowerCase() === 'lcdot') {
|
|
10649
|
-
throw new
|
|
10664
|
+
throw new ScenarioNotSupportedError('LcDOT local transfers are not supported');
|
|
10650
10665
|
}
|
|
10651
10666
|
var amount = getLocalTransferAmount(options);
|
|
10652
10667
|
return api.deserializeExtrinsics({
|
|
@@ -10664,6 +10679,7 @@ var Acala = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
10664
10679
|
}, {
|
|
10665
10680
|
key: "getCustomCurrencyId",
|
|
10666
10681
|
value: function getCustomCurrencyId(_api, asset) {
|
|
10682
|
+
// aSEED is registered as Token(AUSD) on Acala
|
|
10667
10683
|
var symbol = asset.symbol === 'aSEED' ? 'AUSD' : asset.symbol;
|
|
10668
10684
|
return asset.isNative ? {
|
|
10669
10685
|
Token: symbol
|
|
@@ -10964,7 +10980,7 @@ var Astar = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
10964
10980
|
isAmountAll = options.isAmountAll,
|
|
10965
10981
|
keepAlive = options.keepAlive;
|
|
10966
10982
|
assertHasId(asset);
|
|
10967
|
-
var assetId =
|
|
10983
|
+
var assetId = BigInt(asset.assetId);
|
|
10968
10984
|
var dest = {
|
|
10969
10985
|
Id: recipient
|
|
10970
10986
|
};
|
|
@@ -11097,19 +11113,17 @@ var Hydration = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
11097
11113
|
asset = options.assetInfo,
|
|
11098
11114
|
recipient = options.recipient,
|
|
11099
11115
|
isAmountAll = options.isAmountAll,
|
|
11100
|
-
keepAlive = options.keepAlive
|
|
11101
|
-
balance = options.balance;
|
|
11116
|
+
keepAlive = options.keepAlive;
|
|
11102
11117
|
assertHasId(asset);
|
|
11103
11118
|
var currencyId = Number(asset.assetId);
|
|
11104
11119
|
if (asset.erc20) {
|
|
11105
|
-
var amount = isAmountAll ? balance - (keepAlive ? BigInt(asset.existentialDeposit) : 0n) : asset.amount;
|
|
11106
11120
|
return api.deserializeExtrinsics({
|
|
11107
11121
|
module: 'Currencies',
|
|
11108
11122
|
method: 'transfer',
|
|
11109
11123
|
params: {
|
|
11110
11124
|
dest: recipient,
|
|
11111
11125
|
currency_id: currencyId,
|
|
11112
|
-
amount:
|
|
11126
|
+
amount: getLocalTransferAmount(options)
|
|
11113
11127
|
}
|
|
11114
11128
|
});
|
|
11115
11129
|
}
|
|
@@ -11716,6 +11730,39 @@ var EnergyWebX = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
11716
11730
|
useLocationId: true
|
|
11717
11731
|
};
|
|
11718
11732
|
}
|
|
11733
|
+
}, {
|
|
11734
|
+
key: "transferLocalNonNativeAsset",
|
|
11735
|
+
value: function transferLocalNonNativeAsset(options) {
|
|
11736
|
+
var api = options.api,
|
|
11737
|
+
asset = options.assetInfo,
|
|
11738
|
+
recipient = options.recipient,
|
|
11739
|
+
isAmountAll = options.isAmountAll,
|
|
11740
|
+
keepAlive = options.keepAlive;
|
|
11741
|
+
var id = api.localizeLocation(this.chain, asset.location);
|
|
11742
|
+
var dest = {
|
|
11743
|
+
Id: recipient
|
|
11744
|
+
};
|
|
11745
|
+
if (isAmountAll) {
|
|
11746
|
+
return api.deserializeExtrinsics({
|
|
11747
|
+
module: 'Assets',
|
|
11748
|
+
method: 'transfer_all',
|
|
11749
|
+
params: {
|
|
11750
|
+
id: id,
|
|
11751
|
+
dest: dest,
|
|
11752
|
+
keep_alive: keepAlive
|
|
11753
|
+
}
|
|
11754
|
+
});
|
|
11755
|
+
}
|
|
11756
|
+
return api.deserializeExtrinsics({
|
|
11757
|
+
module: 'Assets',
|
|
11758
|
+
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
11759
|
+
params: {
|
|
11760
|
+
id: id,
|
|
11761
|
+
target: dest,
|
|
11762
|
+
amount: asset.amount
|
|
11763
|
+
}
|
|
11764
|
+
});
|
|
11765
|
+
}
|
|
11719
11766
|
}, {
|
|
11720
11767
|
key: "getBalanceForeign",
|
|
11721
11768
|
value: function () {
|
|
@@ -11729,13 +11776,13 @@ var EnergyWebX = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
11729
11776
|
return api.queryState({
|
|
11730
11777
|
module: 'Assets',
|
|
11731
11778
|
method: 'Account',
|
|
11732
|
-
params: [asset.location, address]
|
|
11779
|
+
params: [api.localizeLocation(this.chain, asset.location), address]
|
|
11733
11780
|
});
|
|
11734
11781
|
case 1:
|
|
11735
11782
|
balance = _context.v;
|
|
11736
11783
|
return _context.a(2, (_balance$balance = balance === null || balance === void 0 ? void 0 : balance.balance) !== null && _balance$balance !== void 0 ? _balance$balance : 0n);
|
|
11737
11784
|
}
|
|
11738
|
-
}, _callee);
|
|
11785
|
+
}, _callee, this);
|
|
11739
11786
|
}));
|
|
11740
11787
|
function getBalanceForeign(_x, _x2, _x3) {
|
|
11741
11788
|
return _getBalanceForeign.apply(this, arguments);
|
|
@@ -11828,6 +11875,7 @@ var HydrationPaseo = /*#__PURE__*/function (_Hydration) {
|
|
|
11828
11875
|
return _createClass(HydrationPaseo);
|
|
11829
11876
|
}(Hydration);
|
|
11830
11877
|
|
|
11878
|
+
var HERCULIS_GOLD_BALANCES_PREFIX = 'b5288313a908b05b8e6dc4c999b69de9c2261276cc9d1f8598ea4b6a74b15c2f';
|
|
11831
11879
|
var Jamton = /*#__PURE__*/function (_SubstrateChain) {
|
|
11832
11880
|
function Jamton() {
|
|
11833
11881
|
_classCallCheck(this, Jamton);
|
|
@@ -11857,16 +11905,86 @@ var Jamton = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
11857
11905
|
};
|
|
11858
11906
|
}
|
|
11859
11907
|
}, {
|
|
11860
|
-
key: "transferPolkadotXCM",
|
|
11861
|
-
value: function transferPolkadotXCM(input) {
|
|
11862
|
-
var assetInfo = input.assetInfo,
|
|
11863
|
-
scenario = input.scenario,
|
|
11864
|
-
destination = input.destination;
|
|
11865
|
-
if (assetInfo.isNative) return transferPolkadotXcm(input);
|
|
11866
|
-
if (scenario === 'ParaToPara' && destination !== 'AssetHubPolkadot') {
|
|
11867
|
-
throw new ScenarioNotSupportedError("Transfer from ".concat(this.chain, " to ").concat(JSON.stringify(destination, replaceBigInt), " is not yet supported"));
|
|
11908
|
+
key: "transferPolkadotXCM",
|
|
11909
|
+
value: function transferPolkadotXCM(input) {
|
|
11910
|
+
var assetInfo = input.assetInfo,
|
|
11911
|
+
scenario = input.scenario,
|
|
11912
|
+
destination = input.destination;
|
|
11913
|
+
if (assetInfo.isNative) return transferPolkadotXcm(input);
|
|
11914
|
+
if (scenario === 'ParaToPara' && destination !== 'AssetHubPolkadot') {
|
|
11915
|
+
throw new ScenarioNotSupportedError("Transfer from ".concat(this.chain, " to ").concat(JSON.stringify(destination, replaceBigInt), " is not yet supported"));
|
|
11916
|
+
}
|
|
11917
|
+
return transferPolkadotXcm(input);
|
|
11918
|
+
}
|
|
11919
|
+
}, {
|
|
11920
|
+
key: "transferLocalNonNativeAsset",
|
|
11921
|
+
value: function transferLocalNonNativeAsset(options) {
|
|
11922
|
+
var api = options.api,
|
|
11923
|
+
asset = options.assetInfo,
|
|
11924
|
+
recipient = options.recipient;
|
|
11925
|
+
if (!this.isHerculisGoldAsset(api, asset)) return _superPropGet(Jamton, "transferLocalNonNativeAsset", this, 3)([options]);
|
|
11926
|
+
return api.deserializeExtrinsics({
|
|
11927
|
+
module: 'Currencies',
|
|
11928
|
+
method: 'transfer',
|
|
11929
|
+
params: {
|
|
11930
|
+
dest: {
|
|
11931
|
+
Id: recipient
|
|
11932
|
+
},
|
|
11933
|
+
currency_id: this.getCustomCurrencyId(api, asset),
|
|
11934
|
+
amount: getLocalTransferAmount(options)
|
|
11935
|
+
}
|
|
11936
|
+
});
|
|
11937
|
+
}
|
|
11938
|
+
}, {
|
|
11939
|
+
key: "getBalanceForeign",
|
|
11940
|
+
value: function () {
|
|
11941
|
+
var _getBalanceForeign = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(api, address, asset) {
|
|
11942
|
+
var balance;
|
|
11943
|
+
return _regenerator().w(function (_context) {
|
|
11944
|
+
while (1) switch (_context.n) {
|
|
11945
|
+
case 0:
|
|
11946
|
+
if (this.isHerculisGoldAsset(api, asset)) {
|
|
11947
|
+
_context.n = 1;
|
|
11948
|
+
break;
|
|
11949
|
+
}
|
|
11950
|
+
return _context.a(2, _superPropGet(Jamton, "getBalanceForeign", this, 3)([api, address, asset]));
|
|
11951
|
+
case 1:
|
|
11952
|
+
_context.n = 2;
|
|
11953
|
+
return api.queryRuntimeApi({
|
|
11954
|
+
module: 'Currencies',
|
|
11955
|
+
method: 'free_balance',
|
|
11956
|
+
params: [this.getCustomCurrencyId(api, asset), address]
|
|
11957
|
+
});
|
|
11958
|
+
case 2:
|
|
11959
|
+
balance = _context.v;
|
|
11960
|
+
return _context.a(2, BigInt(balance));
|
|
11961
|
+
}
|
|
11962
|
+
}, _callee, this);
|
|
11963
|
+
}));
|
|
11964
|
+
function getBalanceForeign(_x, _x2, _x3) {
|
|
11965
|
+
return _getBalanceForeign.apply(this, arguments);
|
|
11868
11966
|
}
|
|
11869
|
-
return
|
|
11967
|
+
return getBalanceForeign;
|
|
11968
|
+
}()
|
|
11969
|
+
}, {
|
|
11970
|
+
key: "mint",
|
|
11971
|
+
value: function mint(api, address, assetInfo, balance) {
|
|
11972
|
+
if (!this.isHerculisGoldAsset(api, assetInfo)) return _superPropGet(Jamton, "mint", this, 3)([api, address, assetInfo, balance]);
|
|
11973
|
+
var accountKey = blake2128Concat(bytesToHex(api.accountToUint8a(address)));
|
|
11974
|
+
return Promise.resolve({
|
|
11975
|
+
balanceTx: {
|
|
11976
|
+
module: 'System',
|
|
11977
|
+
method: 'set_storage',
|
|
11978
|
+
params: {
|
|
11979
|
+
items: [['0x' + HERCULIS_GOLD_BALANCES_PREFIX + accountKey, '0x' + toLeHex(balance + assetInfo.amount, 16)]]
|
|
11980
|
+
}
|
|
11981
|
+
}
|
|
11982
|
+
});
|
|
11983
|
+
}
|
|
11984
|
+
}, {
|
|
11985
|
+
key: "isHerculisGoldAsset",
|
|
11986
|
+
value: function isHerculisGoldAsset(api, asset) {
|
|
11987
|
+
return asset.isNative && !isAssetEqual(asset, api.findNativeAssetInfoOrThrow(this.chain));
|
|
11870
11988
|
}
|
|
11871
11989
|
}]);
|
|
11872
11990
|
}(SubstrateChain);
|
|
@@ -11877,7 +11995,15 @@ var Karura = /*#__PURE__*/function (_Acala) {
|
|
|
11877
11995
|
return _callSuper(this, Karura, ['Karura', 'karura', 'Kusama', Version.V5]);
|
|
11878
11996
|
}
|
|
11879
11997
|
_inherits(Karura, _Acala);
|
|
11880
|
-
return _createClass(Karura
|
|
11998
|
+
return _createClass(Karura, [{
|
|
11999
|
+
key: "getCustomCurrencyId",
|
|
12000
|
+
value: function getCustomCurrencyId(api, asset) {
|
|
12001
|
+
// aSEED is registered as Token(KUSD) on Karura
|
|
12002
|
+
return asset.symbol === 'aSEED' ? {
|
|
12003
|
+
Token: 'KUSD'
|
|
12004
|
+
} : _superPropGet(Karura, "getCustomCurrencyId", this, 3)([api, asset]);
|
|
12005
|
+
}
|
|
12006
|
+
}]);
|
|
11881
12007
|
}(Acala);
|
|
11882
12008
|
|
|
11883
12009
|
var Relaychain = /*#__PURE__*/function (_SubstrateChain) {
|
|
@@ -11992,22 +12118,16 @@ var Mythos = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
11992
12118
|
return transferPolkadotXcm(input);
|
|
11993
12119
|
case 2:
|
|
11994
12120
|
defaultTx = _context2.v;
|
|
11995
|
-
if (!(destination === 'AssetHubPolkadot')) {
|
|
11996
|
-
_context2.n = 3;
|
|
11997
|
-
break;
|
|
11998
|
-
}
|
|
11999
|
-
return _context2.a(2, handleToAhTeleport('Mythos', input, defaultTx));
|
|
12000
|
-
case 3:
|
|
12001
12121
|
if (!(destination == 'Ethereum')) {
|
|
12002
|
-
_context2.n =
|
|
12122
|
+
_context2.n = 4;
|
|
12003
12123
|
break;
|
|
12004
12124
|
}
|
|
12005
12125
|
_t = api;
|
|
12006
|
-
_context2.n =
|
|
12126
|
+
_context2.n = 3;
|
|
12007
12127
|
return createTypeAndThenTransfer(input, this.chain, this.version);
|
|
12008
|
-
case
|
|
12128
|
+
case 3:
|
|
12009
12129
|
return _context2.a(2, _t.deserializeExtrinsics.call(_t, _context2.v));
|
|
12010
|
-
case
|
|
12130
|
+
case 4:
|
|
12011
12131
|
return _context2.a(2, defaultTx);
|
|
12012
12132
|
}
|
|
12013
12133
|
}, _callee2, this);
|
|
@@ -12017,6 +12137,11 @@ var Mythos = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
12017
12137
|
}
|
|
12018
12138
|
return transferPolkadotXCM;
|
|
12019
12139
|
}()
|
|
12140
|
+
}, {
|
|
12141
|
+
key: "shouldUseNativeAssetTeleport",
|
|
12142
|
+
value: function shouldUseNativeAssetTeleport() {
|
|
12143
|
+
return false;
|
|
12144
|
+
}
|
|
12020
12145
|
}, {
|
|
12021
12146
|
key: "isRelayToParaEnabled",
|
|
12022
12147
|
value: function isRelayToParaEnabled() {
|
|
@@ -12081,19 +12206,28 @@ var NeuroWeb = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
12081
12206
|
var api = options.api,
|
|
12082
12207
|
asset = options.assetInfo,
|
|
12083
12208
|
recipient = options.recipient,
|
|
12084
|
-
balance = options.balance,
|
|
12085
12209
|
isAmountAll = options.isAmountAll,
|
|
12086
12210
|
keepAlive = options.keepAlive;
|
|
12087
|
-
|
|
12088
|
-
var
|
|
12089
|
-
|
|
12211
|
+
var module = asset.assetId === undefined ? 'ForeignAssets' : 'Assets';
|
|
12212
|
+
var id = asset.assetId === undefined ? asset.location : BigInt(asset.assetId);
|
|
12213
|
+
if (isAmountAll) {
|
|
12214
|
+
return api.deserializeExtrinsics({
|
|
12215
|
+
module: module,
|
|
12216
|
+
method: 'transfer_all',
|
|
12217
|
+
params: {
|
|
12218
|
+
id: id,
|
|
12219
|
+
dest: recipient,
|
|
12220
|
+
keep_alive: keepAlive
|
|
12221
|
+
}
|
|
12222
|
+
});
|
|
12223
|
+
}
|
|
12090
12224
|
return api.deserializeExtrinsics({
|
|
12091
|
-
module:
|
|
12225
|
+
module: module,
|
|
12092
12226
|
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
12093
12227
|
params: {
|
|
12094
|
-
id:
|
|
12228
|
+
id: id,
|
|
12095
12229
|
target: recipient,
|
|
12096
|
-
amount: amount
|
|
12230
|
+
amount: asset.amount
|
|
12097
12231
|
}
|
|
12098
12232
|
});
|
|
12099
12233
|
}
|
|
@@ -12112,7 +12246,7 @@ var Paseo = /*#__PURE__*/function (_Polkadot) {
|
|
|
12112
12246
|
var Peaq = /*#__PURE__*/function (_SubstrateChain) {
|
|
12113
12247
|
function Peaq() {
|
|
12114
12248
|
_classCallCheck(this, Peaq);
|
|
12115
|
-
return _callSuper(this, Peaq, ['Peaq', 'peaq', 'Polkadot', Version.
|
|
12249
|
+
return _callSuper(this, Peaq, ['Peaq', 'peaq', 'Polkadot', Version.V5]);
|
|
12116
12250
|
}
|
|
12117
12251
|
_inherits(Peaq, _SubstrateChain);
|
|
12118
12252
|
return _createClass(Peaq, [{
|
|
@@ -12199,23 +12333,9 @@ var Pendulum = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
12199
12333
|
}), currencySelection);
|
|
12200
12334
|
}
|
|
12201
12335
|
}, {
|
|
12202
|
-
key: "
|
|
12203
|
-
value: function
|
|
12204
|
-
|
|
12205
|
-
asset = options.assetInfo,
|
|
12206
|
-
recipient = options.recipient;
|
|
12207
|
-
var amount = getLocalTransferAmount(options);
|
|
12208
|
-
return api.deserializeExtrinsics({
|
|
12209
|
-
module: 'Currencies',
|
|
12210
|
-
method: 'transfer',
|
|
12211
|
-
params: {
|
|
12212
|
-
dest: {
|
|
12213
|
-
Id: recipient
|
|
12214
|
-
},
|
|
12215
|
-
currency_id: this.getCustomCurrencyId(api, asset),
|
|
12216
|
-
amount: amount
|
|
12217
|
-
}
|
|
12218
|
-
});
|
|
12336
|
+
key: "getLocalCurrencyId",
|
|
12337
|
+
value: function getLocalCurrencyId(api, asset) {
|
|
12338
|
+
return this.getCustomCurrencyId(api, asset);
|
|
12219
12339
|
}
|
|
12220
12340
|
}]);
|
|
12221
12341
|
}(SubstrateChain);
|
|
@@ -12223,7 +12343,7 @@ var Pendulum = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
12223
12343
|
var Penpal = /*#__PURE__*/function (_SubstrateChain) {
|
|
12224
12344
|
function Penpal() {
|
|
12225
12345
|
_classCallCheck(this, Penpal);
|
|
12226
|
-
return _callSuper(this, Penpal, ['Penpal', 'westendPenpal', 'Westend', Version.
|
|
12346
|
+
return _callSuper(this, Penpal, ['Penpal', 'westendPenpal', 'Westend', Version.V5]);
|
|
12227
12347
|
}
|
|
12228
12348
|
_inherits(Penpal, _SubstrateChain);
|
|
12229
12349
|
return _createClass(Penpal, [{
|
|
@@ -12280,7 +12400,7 @@ var PeoplePolkadot = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
12280
12400
|
value: function transferPolkadotXCM(input) {
|
|
12281
12401
|
var scenario = input.scenario,
|
|
12282
12402
|
destChain = input.destChain;
|
|
12283
|
-
if (scenario === 'ParaToPara' && !(destChain !== null && destChain !== void 0 && destChain.startsWith('AssetHub'))) {
|
|
12403
|
+
if (scenario === 'ParaToPara' && !(destChain !== null && destChain !== void 0 && destChain.startsWith('AssetHub')) && destChain !== 'Hydration') {
|
|
12284
12404
|
throw new ScenarioNotSupportedError("Unable to use ".concat(this.chain, " for transfers to other Parachains."));
|
|
12285
12405
|
}
|
|
12286
12406
|
return transferPolkadotXcm(input);
|
|
@@ -12354,6 +12474,15 @@ var RobonomicsPolkadot = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
12354
12474
|
}]);
|
|
12355
12475
|
}(SubstrateChain);
|
|
12356
12476
|
|
|
12477
|
+
var Shibuya = /*#__PURE__*/function (_Astar) {
|
|
12478
|
+
function Shibuya() {
|
|
12479
|
+
_classCallCheck(this, Shibuya);
|
|
12480
|
+
return _callSuper(this, Shibuya, ['Shibuya', 'PaseoShibuyaChain', 'Paseo', Version.V5]);
|
|
12481
|
+
}
|
|
12482
|
+
_inherits(Shibuya, _Astar);
|
|
12483
|
+
return _createClass(Shibuya);
|
|
12484
|
+
}(Astar);
|
|
12485
|
+
|
|
12357
12486
|
var Shiden = /*#__PURE__*/function (_Astar) {
|
|
12358
12487
|
function Shiden() {
|
|
12359
12488
|
_classCallCheck(this, Shiden);
|
|
@@ -12367,11 +12496,6 @@ var FUNGIBLE_ITEM_ID = 0;
|
|
|
12367
12496
|
var FUNGIBLE_BALANCE_PREFIX = 'b6f8df5e96e2c932e9bd00274d53a26f4ea8ea0c01faa42b6eb344a85c47b387';
|
|
12368
12497
|
var FUNGIBLE_TOTAL_SUPPLY_PREFIX = 'b6f8df5e96e2c932e9bd00274d53a26f5994cfda14cd67e1586647d40008abaa';
|
|
12369
12498
|
var SUBSTRATE_CROSS_ACCOUNT_PREFIX = '00';
|
|
12370
|
-
var toLeHex = function toLeHex(value, size) {
|
|
12371
|
-
return bytesToHex(numberToBytes(value, {
|
|
12372
|
-
size: size
|
|
12373
|
-
}).reverse());
|
|
12374
|
-
};
|
|
12375
12499
|
var Unique = /*#__PURE__*/function (_SubstrateChain) {
|
|
12376
12500
|
function Unique() {
|
|
12377
12501
|
_classCallCheck(this, Unique);
|
|
@@ -12485,6 +12609,49 @@ var Xode = /*#__PURE__*/function (_SubstrateChain) {
|
|
|
12485
12609
|
value: function canReceiveFrom(origin) {
|
|
12486
12610
|
return origin === 'AssetHubPolkadot';
|
|
12487
12611
|
}
|
|
12612
|
+
}, {
|
|
12613
|
+
key: "getMintConfig",
|
|
12614
|
+
value: function getMintConfig() {
|
|
12615
|
+
return {
|
|
12616
|
+
forceOrigin: {
|
|
12617
|
+
type: 'treasuryCouncil'
|
|
12618
|
+
}
|
|
12619
|
+
};
|
|
12620
|
+
}
|
|
12621
|
+
}, {
|
|
12622
|
+
key: "transferLocalNonNativeAsset",
|
|
12623
|
+
value: function transferLocalNonNativeAsset(options) {
|
|
12624
|
+
var api = options.api,
|
|
12625
|
+
asset = options.assetInfo,
|
|
12626
|
+
recipient = options.recipient,
|
|
12627
|
+
isAmountAll = options.isAmountAll,
|
|
12628
|
+
keepAlive = options.keepAlive;
|
|
12629
|
+
assertHasId(asset);
|
|
12630
|
+
var assetId = Number(asset.assetId);
|
|
12631
|
+
var dest = {
|
|
12632
|
+
Id: recipient
|
|
12633
|
+
};
|
|
12634
|
+
if (isAmountAll) {
|
|
12635
|
+
return api.deserializeExtrinsics({
|
|
12636
|
+
module: 'Assets',
|
|
12637
|
+
method: 'transfer_all',
|
|
12638
|
+
params: {
|
|
12639
|
+
id: assetId,
|
|
12640
|
+
dest: dest,
|
|
12641
|
+
keep_alive: keepAlive
|
|
12642
|
+
}
|
|
12643
|
+
});
|
|
12644
|
+
}
|
|
12645
|
+
return api.deserializeExtrinsics({
|
|
12646
|
+
module: 'Assets',
|
|
12647
|
+
method: keepAlive ? 'transfer_keep_alive' : 'transfer',
|
|
12648
|
+
params: {
|
|
12649
|
+
id: assetId,
|
|
12650
|
+
target: dest,
|
|
12651
|
+
amount: asset.amount
|
|
12652
|
+
}
|
|
12653
|
+
});
|
|
12654
|
+
}
|
|
12488
12655
|
}]);
|
|
12489
12656
|
}(SubstrateChain);
|
|
12490
12657
|
|
|
@@ -12541,6 +12708,7 @@ var chains = function chains() {
|
|
|
12541
12708
|
PeoplePaseo: new PeoplePaseo(),
|
|
12542
12709
|
HeimaPaseo: new HeimaPaseo(),
|
|
12543
12710
|
HydrationPaseo: new HydrationPaseo(),
|
|
12711
|
+
Shibuya: new Shibuya(),
|
|
12544
12712
|
// External chains
|
|
12545
12713
|
Ethereum: new Ethereum(),
|
|
12546
12714
|
EthereumTestnet: new EthereumTestnet()
|
|
@@ -12768,6 +12936,17 @@ var formatAssetIdToERC20 = function formatAssetIdToERC20(id) {
|
|
|
12768
12936
|
return "0xffffffff".concat(BigInt(id).toString(16).padStart(32, '0'));
|
|
12769
12937
|
};
|
|
12770
12938
|
|
|
12939
|
+
var blake2128Concat = function blake2128Concat(hex) {
|
|
12940
|
+
return bytesToHex(blake2b(hexToBytes(hex), {
|
|
12941
|
+
dkLen: 16
|
|
12942
|
+
})) + hex;
|
|
12943
|
+
};
|
|
12944
|
+
var toLeHex = function toLeHex(value, size) {
|
|
12945
|
+
return bytesToHex(numberToBytes(value, {
|
|
12946
|
+
size: size
|
|
12947
|
+
}).reverse());
|
|
12948
|
+
};
|
|
12949
|
+
|
|
12771
12950
|
// twox128("EVM") ++ twox128("AccountStorages") — the pallet_evm::AccountStorages storage prefix.
|
|
12772
12951
|
var ACCOUNT_STORAGES_PREFIX = '1da53b775b270400e7e61ed5cbc5a146ab1160471b1418779239ba8e2b847e42';
|
|
12773
12952
|
// "ETH\0" — prefix of account ids that Hydration derives from an EVM address
|
|
@@ -12775,11 +12954,6 @@ var EVM_ACCOUNT_PREFIX = '45544800';
|
|
|
12775
12954
|
var word = function word(hex) {
|
|
12776
12955
|
return hex.padStart(64, '0');
|
|
12777
12956
|
};
|
|
12778
|
-
var blake2128Concat = function blake2128Concat(hex) {
|
|
12779
|
-
return bytesToHex(blake2b(hexToBytes(hex), {
|
|
12780
|
-
dkLen: 16
|
|
12781
|
-
})) + hex;
|
|
12782
|
-
};
|
|
12783
12957
|
// Mirrors pallet_evm_accounts::evm_address
|
|
12784
12958
|
var toEvmAddress = function toEvmAddress(accountId) {
|
|
12785
12959
|
return accountId.startsWith(EVM_ACCOUNT_PREFIX) && accountId.endsWith('0'.repeat(16)) ? accountId.slice(8, 48) : accountId.slice(0, 40);
|
|
@@ -12801,6 +12975,10 @@ var buildErc20StorageMint = function buildErc20StorageMint(api, address, asset,
|
|
|
12801
12975
|
};
|
|
12802
12976
|
};
|
|
12803
12977
|
|
|
12978
|
+
var isAssetXcEqualImpl = function isAssetXcEqualImpl(api, a, b) {
|
|
12979
|
+
return deepEqual(api.localizeLocation(a.chain, a.asset.location, a.chain), api.localizeLocation(a.chain, b.asset.location, b.chain));
|
|
12980
|
+
};
|
|
12981
|
+
|
|
12804
12982
|
var maybeOverrideAssets = function maybeOverrideAssets(version, amount, assets, overriddenCurrency) {
|
|
12805
12983
|
if (!overriddenCurrency) {
|
|
12806
12984
|
return assets;
|
|
@@ -13172,80 +13350,6 @@ var createChainClient = /*#__PURE__*/function () {
|
|
|
13172
13350
|
};
|
|
13173
13351
|
}();
|
|
13174
13352
|
|
|
13175
|
-
var createBridgedXcmPrefix = function createBridgedXcmPrefix(version, _ref) {
|
|
13176
|
-
var palletIndex = _ref.palletIndex,
|
|
13177
|
-
relay = _ref.relay,
|
|
13178
|
-
paraId = _ref.paraId;
|
|
13179
|
-
return [{
|
|
13180
|
-
DescendOrigin: createX1Payload(version, {
|
|
13181
|
-
PalletInstance: palletIndex
|
|
13182
|
-
})
|
|
13183
|
-
}, {
|
|
13184
|
-
UniversalOrigin: {
|
|
13185
|
-
GlobalConsensus: _defineProperty({}, relay.toLowerCase(), null)
|
|
13186
|
-
}
|
|
13187
|
-
}, {
|
|
13188
|
-
DescendOrigin: createX1Payload(version, {
|
|
13189
|
-
Parachain: paraId
|
|
13190
|
-
})
|
|
13191
|
-
}];
|
|
13192
|
-
};
|
|
13193
|
-
|
|
13194
|
-
var getErrorInstruction = function getErrorInstruction(message, index) {
|
|
13195
|
-
if (index === undefined || _typeof(message) !== 'object' || message === null) {
|
|
13196
|
-
return undefined;
|
|
13197
|
-
}
|
|
13198
|
-
var instructions = message;
|
|
13199
|
-
if (!Array.isArray(instructions)) {
|
|
13200
|
-
instructions = 'value' in message && Array.isArray(message.value) ? message.value : Object.values(message)[0];
|
|
13201
|
-
}
|
|
13202
|
-
if (!Array.isArray(instructions)) return undefined;
|
|
13203
|
-
var instruction = instructions[index];
|
|
13204
|
-
return _typeof(instruction) === 'object' && instruction !== null ? instruction : undefined;
|
|
13205
|
-
};
|
|
13206
|
-
var buildDryRunError = function buildDryRunError(error, message) {
|
|
13207
|
-
return _objectSpread2(_objectSpread2({}, error), {}, {
|
|
13208
|
-
instruction: getErrorInstruction(message, error.instructionIndex)
|
|
13209
|
-
});
|
|
13210
|
-
};
|
|
13211
|
-
|
|
13212
|
-
var resolveModuleError = function resolveModuleError(chain, error) {
|
|
13213
|
-
var palletDetails = getSupportedPalletsDetails(chain).find(function (p) {
|
|
13214
|
-
return p.index === Number(error.index);
|
|
13215
|
-
});
|
|
13216
|
-
if (!palletDetails) {
|
|
13217
|
-
throw new RoutingResolutionError("Pallet with index ".concat(error.index, " not found"));
|
|
13218
|
-
}
|
|
13219
|
-
// Use only the first byte of the error to get the error index
|
|
13220
|
-
// Including 0x prefix
|
|
13221
|
-
var errorIndex = Number(error.error.slice(0, 4));
|
|
13222
|
-
var name = palletDetails.name;
|
|
13223
|
-
if (name !== 'XTokens' && name !== 'PolkadotXcm' && name !== 'XcmPallet') {
|
|
13224
|
-
throw new UnsupportedOperationError("Pallet ".concat(name, " is not supported"));
|
|
13225
|
-
}
|
|
13226
|
-
var reason = name === 'XTokens' ? Object.values(XTokensError)[errorIndex] : Object.values(PolkadotXcmError)[errorIndex];
|
|
13227
|
-
if (!reason) {
|
|
13228
|
-
throw new RoutingResolutionError("Error index ".concat(errorIndex, " not found in ").concat(name, " pallet"));
|
|
13229
|
-
}
|
|
13230
|
-
if (reason === PolkadotXcmError.LocalExecutionIncompleteWithError) {
|
|
13231
|
-
// Byte layout: [pallet error variant][instruction index][xcm sub-error]
|
|
13232
|
-
var instructionIndex = Number("0x".concat(error.error.slice(4, 6)));
|
|
13233
|
-
var subErrorIndex = Number("0x".concat(error.error.slice(6, 8)));
|
|
13234
|
-
var subReason = Object.values(PolkadotXcmExecutionError)[subErrorIndex];
|
|
13235
|
-
if (!subReason) {
|
|
13236
|
-
throw new RoutingResolutionError("Sub-error index ".concat(subErrorIndex, " not found in PolkadotXcm pallet"));
|
|
13237
|
-
}
|
|
13238
|
-
return {
|
|
13239
|
-
reason: reason,
|
|
13240
|
-
subReason: subReason,
|
|
13241
|
-
instructionIndex: instructionIndex
|
|
13242
|
-
};
|
|
13243
|
-
}
|
|
13244
|
-
return {
|
|
13245
|
-
reason: reason
|
|
13246
|
-
};
|
|
13247
|
-
};
|
|
13248
|
-
|
|
13249
13353
|
var getEvmPrivateKeyHex = function getEvmPrivateKeyHex(path) {
|
|
13250
13354
|
var name = path.slice(2).toLowerCase();
|
|
13251
13355
|
if (name in EVM_DEV_PRIVATE_KEYS) {
|
|
@@ -13679,6 +13783,31 @@ var PolkadotApi = /*#__PURE__*/function () {
|
|
|
13679
13783
|
var resolveExternalReserve = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
13680
13784
|
return getAssetReserveChainImpl(this, chain, assetLocation, resolveExternalReserve);
|
|
13681
13785
|
}
|
|
13786
|
+
}, {
|
|
13787
|
+
key: "isAssetXcEqual",
|
|
13788
|
+
value: function isAssetXcEqual(a, b) {
|
|
13789
|
+
return isAssetXcEqualImpl(this, a, b);
|
|
13790
|
+
}
|
|
13791
|
+
}, {
|
|
13792
|
+
key: "dispatchAs",
|
|
13793
|
+
value: function dispatchAs(call, origin) {
|
|
13794
|
+
return this.deserializeExtrinsics({
|
|
13795
|
+
module: 'Utility',
|
|
13796
|
+
method: 'dispatch_as',
|
|
13797
|
+
params: {
|
|
13798
|
+
as_origin: origin.type === 'treasuryCouncil' ? {
|
|
13799
|
+
TreasuryCouncil: {
|
|
13800
|
+
Members: [1, 1]
|
|
13801
|
+
}
|
|
13802
|
+
} : {
|
|
13803
|
+
system: {
|
|
13804
|
+
Signed: origin.address
|
|
13805
|
+
}
|
|
13806
|
+
},
|
|
13807
|
+
call: call
|
|
13808
|
+
}
|
|
13809
|
+
});
|
|
13810
|
+
}
|
|
13682
13811
|
}, {
|
|
13683
13812
|
key: "init",
|
|
13684
13813
|
value: function () {
|
|
@@ -14056,4 +14185,4 @@ var createClientCache = function createClientCache(maxSize, pingClient, onEvicti
|
|
|
14056
14185
|
};
|
|
14057
14186
|
};
|
|
14058
14187
|
|
|
14059
|
-
export { API_TYPES, AmountTooLowError, ApiNotInitializedError, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, CustomChainConflictError, CustomChainInvalidError, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotApi, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, aggregateHopFees, applyDecimalAbstraction, assertAddressIsString, assertCurrencyCore, assertEvmAddress, assertExtensionInstalled, assertHasId, assertNotEvmTransfer, assertSender, assertSenderSource, assertSubstrateOrigin, assertSwapSupport, assertToIsString, blake2128Concat, blake2b256, blake2b512, buildCustomChainAssetsInfo, buildCustomChainConfig, buildDestInfo, buildDryRunError, buildErc20StorageMint, buildHopInfo, buildOriginInfo, calcPreviewMintAmount, compareAddresses, compareLocationOrder, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAllCountedFilter, createAsset, createAssetId, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createBridgedXcmPrefix, createChainClient, createClientCache, createClientPoolHelpers, createCustomXcmOnDest, createDestination, createDirectExecuteXcm, createEthereumBridgeInstructions, createExecuteCall,
|
|
14188
|
+
export { API_TYPES, AmountTooLowError, ApiNotInitializedError, BaseAssetsPallet, BatchMode, BatchValidationError, BridgeHaltedError, Builder, CustomChainConflictError, CustomChainInvalidError, DEFAULT_TTL_MS, DRY_RUN_CLIENT_TIMEOUT_MS, DryRunFailedError, ETH_MAINNET_CHAIN_ID, ETH_TESTNET_CHAIN_ID, EXCHANGE_CHAINS, EXTENSION_MS, ExtensionNotInstalledError, FeatureTemporarilyDisabledError, GeneralBuilder, InvalidAddressError, MAX_CLIENTS, MissingChainApiError, MissingParameterError, NoXCMSupportImplementedError, NumberFormatError, OverrideConflictError, PolkadotApi, PolkadotXcmError, PolkadotXcmExecutionError, ProviderUnavailableError, RELAY_LOCATION, RoutingResolutionError, RuntimeApiError, RuntimeApiUnavailableError, ScenarioNotSupportedError, SubmitTransactionError, TRANSACT_ORIGINS, TX_CLIENT_TIMEOUT_MS, TypeAndThenUnavailableError, UnableToComputeError, UnsupportedOperationError, ValidationError, XTokensError, abstractDecimals, addEthereumBridgeFees, addXcmVersionHeader, aggregateHopFees, applyDecimalAbstraction, assertAddressIsString, assertCurrencyCore, assertEvmAddress, assertExtensionInstalled, assertHasId, assertNotEvmTransfer, assertSender, assertSenderSource, assertSubstrateOrigin, assertSwapSupport, assertToIsString, blake2128Concat, blake2b256, blake2b512, buildCustomChainAssetsInfo, buildCustomChainConfig, buildDestInfo, buildDryRunError, buildErc20StorageMint, buildHopInfo, buildOriginInfo, calcPreviewMintAmount, calcSentAssetPreviewMint, compareAddresses, compareLocationOrder, computeOverridenAmount, constructTypeAndThenCall, convertBuilderConfig, convertSs58, createAllCountedFilter, createAsset, createAssetId, createAssetsFilter, createBaseExecuteXcm, createBeneficiaryLocXTokens, createBeneficiaryLocation, createBridgedXcmPrefix, createChainClient, createClientCache, createClientPoolHelpers, createCustomXcmOnDest, createDestination, createDirectExecuteXcm, createEthereumBridgeInstructions, createExecuteCall, createSwapBuilder, createTransfer, createTransferOrSwap, createTransferOrSwapAll, createTxOverrideAmount, createTypeAndThenCall, createVersionedAssets, createVersionedDestination, createX1Payload, deriveAccountId, dryRun, dryRunInternal, dryRunOrigin, encodeSs58, executeWithSwap, formatAssetIdToERC20, formatUnits, generateMessageId, getAssetBalanceInternal, getAssetReserveChain, getAssetReserveChainImpl, getBalance, getBalanceInternal, getBridgeStatus, getChain, getChainConfig, getChainConfigImpl, getChainLocation, getChainProviders, getChainProvidersImpl, getChainVersion, getDryRunError, getErrorInstruction, getEthErc20Balance, getEvmExtensionOrThrow, getEvmPrivateKeyHex, getEvmSnowbridgeExtensionOrThrow, getLocalTransferAmount, getMinTransferableAmount, getMinTransferableAmountInternal, getOriginXcmFee, getOriginXcmFeeInternal, getParaEthTransferFees, getParaId, getParaIdImpl, getRelayChainOf, getRelayChainOfImpl, getRelayChainSymbolOf, getSwapExtensionOrThrow, getTChain, getTSubstrateChain, getTransferInfo, getTransferableAmount, getTransferableAmountInternal, getXcmFee, getXcmFeeInternal, getXcmFeeOnce, handleExecuteTransfer, handleSwapExecuteTransfer, isAssetXcEqualImpl, isConfig, isExchange, isNativeAssetTeleport, isSenderSigner, isViemSigner, keyFromWs, localizeLocation, localizeLocationImpl, maybeOverrideAsset, maybeOverrideAssets, normalizeAmount, normalizeCustomChains, normalizeExchange, overrideTxAmount, padFee, padValueBy, parseUnits, pickCompatibleXcmVersion, pickOtherMintPallet, pickRouterCompatibleXcmVersion, registerEvmExtension, registerEvmSnowbridgeExtension, registerSwapExtension, resolveAssetCount, resolveDestChain, resolveModuleError, resolveParaId, resolveTransferParams, reverseTransformLocation, selectXcmVersion, sortAssets, throwUnsupportedCurrency, toLeHex, traverseXcmHops, validateAddress, validateAssetSpecifiers, validateCurrency, validateDestination, validateDestinationAddress, validateFeeAssetSupport, validateTransact, verifyEdOnDestination, wrapTxBypass };
|