@moonbeam-network/xcm-builder 1.0.0-dev.254 → 1.0.0-dev.256
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/build/index.d.ts +2 -9
- package/build/index.mjs +125 -291
- package/build/index.mjs.map +1 -1
- package/package.json +9 -9
package/build/index.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ type DestinationMultilocation = [
|
|
|
85
85
|
/**
|
|
86
86
|
* 1 - if transaction is going through or to a relay chain
|
|
87
87
|
*/
|
|
88
|
-
|
|
88
|
+
1,
|
|
89
89
|
([
|
|
90
90
|
/**
|
|
91
91
|
* example '0x00000007DC'
|
|
@@ -120,18 +120,11 @@ declare enum TransferType {
|
|
|
120
120
|
LocalReserve = 1,
|
|
121
121
|
DestinationReserve = 2
|
|
122
122
|
}
|
|
123
|
-
type AssetMultilocation = (bigint | (number | string[])[])[];
|
|
124
123
|
|
|
125
124
|
declare function XcmPrecompile(): {
|
|
126
125
|
transferAssetsToPara20: (shouldTransferAssetPrecedeFeeAsset?: boolean) => ContractConfigBuilder;
|
|
127
126
|
transferAssetsToPara32: (shouldTransferAssetPrecedeFeeAsset?: boolean) => ContractConfigBuilder;
|
|
128
127
|
transferAssetsToRelay: () => ContractConfigBuilder;
|
|
129
|
-
transferAssetsLocation: () => {
|
|
130
|
-
nativeAsset: () => ContractConfigBuilder;
|
|
131
|
-
localErc20: () => ContractConfigBuilder;
|
|
132
|
-
foreignAsset: () => ContractConfigBuilder;
|
|
133
|
-
foreignErc20: () => ContractConfigBuilder;
|
|
134
|
-
};
|
|
135
128
|
transferAssetsUsingTypeAndThenAddress: (shouldTransferAssetPrecedeFeeAsset?: boolean) => ContractConfigBuilder;
|
|
136
129
|
};
|
|
137
130
|
|
|
@@ -759,4 +752,4 @@ declare function MrlBuilder(): {
|
|
|
759
752
|
|
|
760
753
|
declare const BATCH_CONTRACT_ADDRESS = "0x0000000000000000000000000000000000000808";
|
|
761
754
|
|
|
762
|
-
export { type AssetAddressFormat, AssetMinBuilder, type AssetMinConfigBuilder, type AssetMinConfigBuilderParams,
|
|
755
|
+
export { type AssetAddressFormat, AssetMinBuilder, type AssetMinConfigBuilder, type AssetMinConfigBuilderParams, BATCH_CONTRACT_ABI, BATCH_CONTRACT_ADDRESS, BalanceBuilder, type BalanceBuilderParams, type BalanceConfigBuilder, type BuilderParams, type ConfigBuilder, ContractBuilder, ContractConfig, type ContractConfigBuilder, type ContractConfigConstructorParams, type DestinationMultilocation, ERC20_ABI, type EquilibriumSystemBalanceData, type EventMonitoringConfig, type EvmFunctionArgs, EvmQueryConfig, type EvmQueryConfigParams, type EvmQueryFunctions, ExtrinsicBuilder, ExtrinsicConfig, type ExtrinsicConfigBuilder, type ExtrinsicConfigConstructorParams, FeeBuilder, type FeeConfigBuilder, type FeeConfigBuilderParams, type GetVersionedAssetId, MonitoringBuilder, type MonitoringBuilderConfig, type MoonbeamRuntimeXcmConfigAssetType, MrlBuilder, type MrlBuilderParams, type MrlConfigBuilder, type MrlExecuteBuilderParams, type MrlExecuteConfigBuilder, type PalletBalancesAccountDataOld, type Parents, Protocols, type QueryConfigConstructorParams, SubstrateCallConfig, type SubstrateCallConfigConstructorParams, SubstrateQueryConfig, type TokensPalletAccountData, type Transact, TransferType, WormholeConfig, type WormholeConfigConstructorParams, type WormholeFunctionArgs, type WormholeTransferFunctions, type XcmPaymentFeeProps, XcmVersion, calculateSystemAccountBalance, evm, substrate, wormhole, wormholeFactory };
|
package/build/index.mjs
CHANGED
|
@@ -283,131 +283,17 @@ var TransferType = /* @__PURE__ */ ((TransferType2) => {
|
|
|
283
283
|
import { EvmParachain } from "@moonbeam-network/xcm-types";
|
|
284
284
|
import { u8aToHex as u8aToHex2 } from "@polkadot/util";
|
|
285
285
|
import { decodeAddress as decodeAddress2 } from "@polkadot/util-crypto";
|
|
286
|
-
|
|
287
|
-
// src/extrinsic/pallets/polkadotXcm/polkadotXcm.util.ts
|
|
288
|
-
import { Ecosystem } from "@moonbeam-network/xcm-types";
|
|
289
|
-
function getPolkadotXcmExtrinsicArgs({
|
|
290
|
-
assets: assets3,
|
|
291
|
-
destinationAddress,
|
|
292
|
-
destination,
|
|
293
|
-
func,
|
|
294
|
-
parents = 1,
|
|
295
|
-
feeIndex = 0
|
|
296
|
-
}) {
|
|
297
|
-
const version = getExtrinsicArgumentVersion(func);
|
|
298
|
-
return [
|
|
299
|
-
// dest
|
|
300
|
-
{
|
|
301
|
-
[version]: normalizeX1(version, {
|
|
302
|
-
parents,
|
|
303
|
-
interior: {
|
|
304
|
-
X1: {
|
|
305
|
-
Parachain: destination.parachainId
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
})
|
|
309
|
-
},
|
|
310
|
-
// beneficiary
|
|
311
|
-
{
|
|
312
|
-
[version]: normalizeX1(version, {
|
|
313
|
-
parents: 0,
|
|
314
|
-
interior: {
|
|
315
|
-
X1: getExtrinsicAccount(destinationAddress)
|
|
316
|
-
}
|
|
317
|
-
})
|
|
318
|
-
},
|
|
319
|
-
// assets
|
|
320
|
-
{
|
|
321
|
-
[version]: assets3
|
|
322
|
-
},
|
|
323
|
-
// feeAssetItem
|
|
324
|
-
feeIndex,
|
|
325
|
-
// weightLimit
|
|
326
|
-
"Unlimited"
|
|
327
|
-
];
|
|
328
|
-
}
|
|
329
|
-
function isKusamaDestination(destination) {
|
|
330
|
-
return destination.ecosystem === Ecosystem.Kusama || destination.ecosystem === Ecosystem.MoonsamaRelay;
|
|
331
|
-
}
|
|
332
|
-
function isPolkadotDestination(destination) {
|
|
333
|
-
return destination.ecosystem === Ecosystem.Polkadot || destination.ecosystem === Ecosystem.MoonlamaRelay;
|
|
334
|
-
}
|
|
335
|
-
function getGlobalConsensus(destination) {
|
|
336
|
-
if (isKusamaDestination(destination)) {
|
|
337
|
-
return "Kusama";
|
|
338
|
-
}
|
|
339
|
-
if (isPolkadotDestination(destination)) {
|
|
340
|
-
return "Polkadot";
|
|
341
|
-
}
|
|
342
|
-
return {
|
|
343
|
-
ByGenesis: destination.relayGenesisHash
|
|
344
|
-
};
|
|
345
|
-
}
|
|
346
|
-
function getEcosystemTransferExtrinsicArgs({
|
|
347
|
-
assets: assets3,
|
|
348
|
-
destinationAddress,
|
|
349
|
-
destination,
|
|
350
|
-
func,
|
|
351
|
-
feeIndex = 0
|
|
352
|
-
}) {
|
|
353
|
-
const version = getExtrinsicArgumentVersion(func);
|
|
354
|
-
const globalConsensus = getGlobalConsensus(destination);
|
|
355
|
-
return [
|
|
356
|
-
// dest
|
|
357
|
-
{
|
|
358
|
-
[version]: normalizeX1(version, {
|
|
359
|
-
parents: 2,
|
|
360
|
-
interior: {
|
|
361
|
-
X2: [
|
|
362
|
-
{ GlobalConsensus: globalConsensus },
|
|
363
|
-
{
|
|
364
|
-
Parachain: destination.parachainId
|
|
365
|
-
}
|
|
366
|
-
]
|
|
367
|
-
}
|
|
368
|
-
})
|
|
369
|
-
},
|
|
370
|
-
// beneficiary
|
|
371
|
-
{
|
|
372
|
-
[version]: normalizeX1(version, {
|
|
373
|
-
parents: 0,
|
|
374
|
-
interior: {
|
|
375
|
-
X1: getExtrinsicAccount(destinationAddress)
|
|
376
|
-
}
|
|
377
|
-
})
|
|
378
|
-
},
|
|
379
|
-
// assets
|
|
380
|
-
{
|
|
381
|
-
[version]: assets3
|
|
382
|
-
},
|
|
383
|
-
// feeAssetItem
|
|
384
|
-
feeIndex,
|
|
385
|
-
// weightLimit
|
|
386
|
-
"Unlimited"
|
|
387
|
-
];
|
|
388
|
-
}
|
|
389
|
-
function shouldFeeAssetPrecedeAsset({
|
|
390
|
-
asset,
|
|
391
|
-
fee
|
|
392
|
-
}) {
|
|
393
|
-
const assetIdNumber = Number(asset.getAssetId());
|
|
394
|
-
const feeAssetIdNumber = Number(fee.getAssetId());
|
|
395
|
-
if (Number.isNaN(assetIdNumber) || Number.isNaN(feeAssetIdNumber)) {
|
|
396
|
-
return false;
|
|
397
|
-
}
|
|
398
|
-
return assetIdNumber > feeAssetIdNumber;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
// src/contract/ContractBuilder.utils.ts
|
|
402
286
|
function getPrecompileDestinationInterior(destination, address) {
|
|
403
287
|
if (!address) {
|
|
404
|
-
return [
|
|
288
|
+
return [`0x0000000${destination.parachainId.toString(16)}`];
|
|
405
289
|
}
|
|
406
|
-
const
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
290
|
+
const accountType = EvmParachain.is(destination) ? "03" : "01";
|
|
291
|
+
const acc = `0x${accountType}${u8aToHex2(
|
|
292
|
+
decodeAddress2(address),
|
|
293
|
+
-1,
|
|
294
|
+
false
|
|
295
|
+
)}00`;
|
|
296
|
+
return destination.parachainId ? [`0x0000000${destination.parachainId.toString(16)}`, acc] : [acc];
|
|
411
297
|
}
|
|
412
298
|
function getDestinationMultilocation(address, destination) {
|
|
413
299
|
const interior = getPrecompileDestinationInterior(destination, address);
|
|
@@ -417,86 +303,7 @@ function getDestinationParachainMultilocation(destination) {
|
|
|
417
303
|
if (destination.isRelay) {
|
|
418
304
|
return [1, []];
|
|
419
305
|
}
|
|
420
|
-
return [1, [
|
|
421
|
-
}
|
|
422
|
-
function getGlobalConsensusDestination(sourceApi, destination) {
|
|
423
|
-
return [
|
|
424
|
-
2,
|
|
425
|
-
[
|
|
426
|
-
encodeGlobalConsensus(sourceApi, destination),
|
|
427
|
-
encodeParachain(destination.parachainId)
|
|
428
|
-
]
|
|
429
|
-
];
|
|
430
|
-
}
|
|
431
|
-
function getPalletInstanceMultilocation({
|
|
432
|
-
sourceApi,
|
|
433
|
-
asset
|
|
434
|
-
}) {
|
|
435
|
-
return [
|
|
436
|
-
[0, [encodePalletInstance(sourceApi, asset.getAssetPalletInstance())]],
|
|
437
|
-
asset.amount
|
|
438
|
-
];
|
|
439
|
-
}
|
|
440
|
-
function getAssetAddressMultilocation({
|
|
441
|
-
sourceApi,
|
|
442
|
-
asset,
|
|
443
|
-
destination
|
|
444
|
-
}) {
|
|
445
|
-
if (!asset.address) {
|
|
446
|
-
throw new Error(`Asset address is required for ${asset.key}`);
|
|
447
|
-
}
|
|
448
|
-
return [
|
|
449
|
-
[
|
|
450
|
-
0,
|
|
451
|
-
[
|
|
452
|
-
encodePalletInstance(sourceApi, asset.getAssetPalletInstance()),
|
|
453
|
-
encodeAddress(destination, asset.address)
|
|
454
|
-
]
|
|
455
|
-
],
|
|
456
|
-
asset.amount
|
|
457
|
-
];
|
|
458
|
-
}
|
|
459
|
-
function getGlobalConsensusAssetMultilocation({
|
|
460
|
-
sourceApi,
|
|
461
|
-
asset,
|
|
462
|
-
destination
|
|
463
|
-
}) {
|
|
464
|
-
const assetInDestination = destination.getChainAsset(asset);
|
|
465
|
-
return [
|
|
466
|
-
[
|
|
467
|
-
2,
|
|
468
|
-
[
|
|
469
|
-
encodeGlobalConsensus(sourceApi, destination),
|
|
470
|
-
encodeParachain(destination.parachainId),
|
|
471
|
-
encodePalletInstance(
|
|
472
|
-
sourceApi,
|
|
473
|
-
assetInDestination.getAssetPalletInstance()
|
|
474
|
-
)
|
|
475
|
-
]
|
|
476
|
-
],
|
|
477
|
-
asset.amount
|
|
478
|
-
];
|
|
479
|
-
}
|
|
480
|
-
function getAddressGlobalConsensusAssetMultilocation({
|
|
481
|
-
sourceApi,
|
|
482
|
-
asset,
|
|
483
|
-
destination
|
|
484
|
-
}) {
|
|
485
|
-
if (!asset.address) {
|
|
486
|
-
throw new Error(`Asset address is required for ${asset.key}`);
|
|
487
|
-
}
|
|
488
|
-
return [
|
|
489
|
-
[
|
|
490
|
-
2,
|
|
491
|
-
[
|
|
492
|
-
encodeGlobalConsensus(sourceApi, destination),
|
|
493
|
-
encodeParachain(destination.parachainId),
|
|
494
|
-
encodePalletInstance(sourceApi, asset.getAssetPalletInstance()),
|
|
495
|
-
encodeAddress(destination, asset.address)
|
|
496
|
-
]
|
|
497
|
-
],
|
|
498
|
-
asset.amount
|
|
499
|
-
];
|
|
306
|
+
return [1, [`0x00${destination.parachainId.toString(16).padStart(8, "0")}`]];
|
|
500
307
|
}
|
|
501
308
|
function encodeXcmMessageToBytes(xcmMessage, api) {
|
|
502
309
|
if (!api) {
|
|
@@ -510,35 +317,6 @@ function encodeXcmMessageToBytes(xcmMessage, api) {
|
|
|
510
317
|
throw error;
|
|
511
318
|
}
|
|
512
319
|
}
|
|
513
|
-
function encodeParachain(paraId) {
|
|
514
|
-
return `0x00${paraId.toString(16).padStart(8, "0")}`;
|
|
515
|
-
}
|
|
516
|
-
function encodeGlobalConsensus(api, destination) {
|
|
517
|
-
const globalConsensus = getGlobalConsensus(destination);
|
|
518
|
-
return encodeXcmJunction(api, {
|
|
519
|
-
GlobalConsensus: globalConsensus
|
|
520
|
-
});
|
|
521
|
-
}
|
|
522
|
-
function encodePalletInstance(api, palletInstance) {
|
|
523
|
-
return encodeXcmJunction(api, {
|
|
524
|
-
PalletInstance: palletInstance
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
function encodeXcmJunction(api, junction) {
|
|
528
|
-
if (!api) {
|
|
529
|
-
throw new Error("API is required to encode XCM junction");
|
|
530
|
-
}
|
|
531
|
-
const junctionType = api.createType("XcmV3Junction", junction);
|
|
532
|
-
return junctionType.toHex();
|
|
533
|
-
}
|
|
534
|
-
function encodeAddress(destination, address) {
|
|
535
|
-
const accountType = EvmParachain.is(destination) ? "03" : "01";
|
|
536
|
-
return `0x${accountType}${u8aToHex2(
|
|
537
|
-
decodeAddress2(address),
|
|
538
|
-
-1,
|
|
539
|
-
false
|
|
540
|
-
)}00`;
|
|
541
|
-
}
|
|
542
320
|
|
|
543
321
|
// src/contract/contracts/XcmPrecompile/XcmPrecompileAbi.ts
|
|
544
322
|
var XCM_ABI = [
|
|
@@ -1077,45 +855,6 @@ function XcmPrecompile() {
|
|
|
1077
855
|
});
|
|
1078
856
|
}
|
|
1079
857
|
}),
|
|
1080
|
-
transferAssetsLocation: () => ({
|
|
1081
|
-
nativeAsset: () => ({
|
|
1082
|
-
build: (params) => {
|
|
1083
|
-
return buildTransferAssetsLocation({
|
|
1084
|
-
...params,
|
|
1085
|
-
assetsMultilocations: [getPalletInstanceMultilocation(params)]
|
|
1086
|
-
});
|
|
1087
|
-
}
|
|
1088
|
-
}),
|
|
1089
|
-
localErc20: () => ({
|
|
1090
|
-
build: (params) => {
|
|
1091
|
-
return buildTransferAssetsLocation({
|
|
1092
|
-
...params,
|
|
1093
|
-
assetsMultilocations: [getAssetAddressMultilocation(params)]
|
|
1094
|
-
});
|
|
1095
|
-
}
|
|
1096
|
-
}),
|
|
1097
|
-
foreignAsset: () => ({
|
|
1098
|
-
build: (params) => {
|
|
1099
|
-
return buildTransferAssetsLocation({
|
|
1100
|
-
...params,
|
|
1101
|
-
assetsMultilocations: [
|
|
1102
|
-
getGlobalConsensusAssetMultilocation(params)
|
|
1103
|
-
]
|
|
1104
|
-
});
|
|
1105
|
-
}
|
|
1106
|
-
}),
|
|
1107
|
-
foreignErc20: () => ({
|
|
1108
|
-
build: (params) => {
|
|
1109
|
-
return buildTransferAssetsLocation({
|
|
1110
|
-
...params,
|
|
1111
|
-
assetsMultilocations: [
|
|
1112
|
-
getGlobalConsensusAssetMultilocation(params),
|
|
1113
|
-
getAddressGlobalConsensusAssetMultilocation(params)
|
|
1114
|
-
]
|
|
1115
|
-
});
|
|
1116
|
-
}
|
|
1117
|
-
})
|
|
1118
|
-
}),
|
|
1119
858
|
transferAssetsUsingTypeAndThenAddress: (shouldTransferAssetPrecedeFeeAsset = false) => ({
|
|
1120
859
|
build: ({
|
|
1121
860
|
destinationAddress,
|
|
@@ -1130,6 +869,7 @@ function XcmPrecompile() {
|
|
|
1130
869
|
fee,
|
|
1131
870
|
shouldTransferAssetPrecedeFeeAsset
|
|
1132
871
|
);
|
|
872
|
+
const destLocation = getDestinationParachainMultilocation(destination);
|
|
1133
873
|
const xcmMessage = buildXcmMessage(
|
|
1134
874
|
assets3,
|
|
1135
875
|
destinationAddress,
|
|
@@ -1144,7 +884,7 @@ function XcmPrecompile() {
|
|
|
1144
884
|
address: XCM_PRECOMPILE_ADDRESS,
|
|
1145
885
|
abi: XCM_ABI,
|
|
1146
886
|
args: [
|
|
1147
|
-
|
|
887
|
+
destLocation,
|
|
1148
888
|
assets3,
|
|
1149
889
|
2 /* DestinationReserve */,
|
|
1150
890
|
feeIndex,
|
|
@@ -1196,26 +936,6 @@ function buildXcmMessage(assets3, destinationAddress, sourceApi) {
|
|
|
1196
936
|
[xcmVersion]: [instruction]
|
|
1197
937
|
};
|
|
1198
938
|
}
|
|
1199
|
-
function buildTransferAssetsLocation({
|
|
1200
|
-
assetsMultilocations,
|
|
1201
|
-
feeAssetItem = 0,
|
|
1202
|
-
destinationAddress,
|
|
1203
|
-
destination,
|
|
1204
|
-
sourceApi
|
|
1205
|
-
}) {
|
|
1206
|
-
return new ContractConfig({
|
|
1207
|
-
address: XCM_PRECOMPILE_ADDRESS,
|
|
1208
|
-
abi: XCM_ABI,
|
|
1209
|
-
args: [
|
|
1210
|
-
getGlobalConsensusDestination(sourceApi, destination),
|
|
1211
|
-
getBeneficiaryMultilocation(destinationAddress, destination),
|
|
1212
|
-
assetsMultilocations,
|
|
1213
|
-
feeAssetItem
|
|
1214
|
-
],
|
|
1215
|
-
func: "transferAssetsLocation",
|
|
1216
|
-
module: "Xcm"
|
|
1217
|
-
});
|
|
1218
|
-
}
|
|
1219
939
|
|
|
1220
940
|
// src/contract/contracts/Xtokens/Xtokens.ts
|
|
1221
941
|
import { formatAssetIdToERC20 } from "@moonbeam-network/xcm-utils";
|
|
@@ -1851,6 +1571,120 @@ function eqBalances() {
|
|
|
1851
1571
|
};
|
|
1852
1572
|
}
|
|
1853
1573
|
|
|
1574
|
+
// src/extrinsic/pallets/polkadotXcm/polkadotXcm.util.ts
|
|
1575
|
+
import { Ecosystem } from "@moonbeam-network/xcm-types";
|
|
1576
|
+
function getPolkadotXcmExtrinsicArgs({
|
|
1577
|
+
assets: assets3,
|
|
1578
|
+
destinationAddress,
|
|
1579
|
+
destination,
|
|
1580
|
+
func,
|
|
1581
|
+
parents = 1,
|
|
1582
|
+
feeIndex = 0
|
|
1583
|
+
}) {
|
|
1584
|
+
const version = getExtrinsicArgumentVersion(func);
|
|
1585
|
+
return [
|
|
1586
|
+
// dest
|
|
1587
|
+
{
|
|
1588
|
+
[version]: normalizeX1(version, {
|
|
1589
|
+
parents,
|
|
1590
|
+
interior: {
|
|
1591
|
+
X1: {
|
|
1592
|
+
Parachain: destination.parachainId
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
})
|
|
1596
|
+
},
|
|
1597
|
+
// beneficiary
|
|
1598
|
+
{
|
|
1599
|
+
[version]: normalizeX1(version, {
|
|
1600
|
+
parents: 0,
|
|
1601
|
+
interior: {
|
|
1602
|
+
X1: getExtrinsicAccount(destinationAddress)
|
|
1603
|
+
}
|
|
1604
|
+
})
|
|
1605
|
+
},
|
|
1606
|
+
// assets
|
|
1607
|
+
{
|
|
1608
|
+
[version]: assets3
|
|
1609
|
+
},
|
|
1610
|
+
// feeAssetItem
|
|
1611
|
+
feeIndex,
|
|
1612
|
+
// weightLimit
|
|
1613
|
+
"Unlimited"
|
|
1614
|
+
];
|
|
1615
|
+
}
|
|
1616
|
+
function isKusamaDestination(destination) {
|
|
1617
|
+
return destination.ecosystem === Ecosystem.Kusama || destination.ecosystem === Ecosystem.MoonsamaRelay;
|
|
1618
|
+
}
|
|
1619
|
+
function isPolkadotDestination(destination) {
|
|
1620
|
+
return destination.ecosystem === Ecosystem.Polkadot || destination.ecosystem === Ecosystem.MoonlamaRelay;
|
|
1621
|
+
}
|
|
1622
|
+
function getGlobalConsensus(destination) {
|
|
1623
|
+
if (isKusamaDestination(destination)) {
|
|
1624
|
+
return "Kusama";
|
|
1625
|
+
}
|
|
1626
|
+
if (isPolkadotDestination(destination)) {
|
|
1627
|
+
return "Polkadot";
|
|
1628
|
+
}
|
|
1629
|
+
return {
|
|
1630
|
+
ByGenesis: destination.relayGenesisHash
|
|
1631
|
+
};
|
|
1632
|
+
}
|
|
1633
|
+
function getEcosystemTransferExtrinsicArgs({
|
|
1634
|
+
assets: assets3,
|
|
1635
|
+
destinationAddress,
|
|
1636
|
+
destination,
|
|
1637
|
+
func,
|
|
1638
|
+
feeIndex = 0
|
|
1639
|
+
}) {
|
|
1640
|
+
const version = getExtrinsicArgumentVersion(func);
|
|
1641
|
+
const globalConsensus = getGlobalConsensus(destination);
|
|
1642
|
+
return [
|
|
1643
|
+
// dest
|
|
1644
|
+
{
|
|
1645
|
+
[version]: normalizeX1(version, {
|
|
1646
|
+
parents: 2,
|
|
1647
|
+
interior: {
|
|
1648
|
+
X2: [
|
|
1649
|
+
{ GlobalConsensus: globalConsensus },
|
|
1650
|
+
{
|
|
1651
|
+
Parachain: destination.parachainId
|
|
1652
|
+
}
|
|
1653
|
+
]
|
|
1654
|
+
}
|
|
1655
|
+
})
|
|
1656
|
+
},
|
|
1657
|
+
// beneficiary
|
|
1658
|
+
{
|
|
1659
|
+
[version]: normalizeX1(version, {
|
|
1660
|
+
parents: 0,
|
|
1661
|
+
interior: {
|
|
1662
|
+
X1: getExtrinsicAccount(destinationAddress)
|
|
1663
|
+
}
|
|
1664
|
+
})
|
|
1665
|
+
},
|
|
1666
|
+
// assets
|
|
1667
|
+
{
|
|
1668
|
+
[version]: assets3
|
|
1669
|
+
},
|
|
1670
|
+
// feeAssetItem
|
|
1671
|
+
feeIndex,
|
|
1672
|
+
// weightLimit
|
|
1673
|
+
"Unlimited"
|
|
1674
|
+
];
|
|
1675
|
+
}
|
|
1676
|
+
function shouldFeeAssetPrecedeAsset({
|
|
1677
|
+
asset,
|
|
1678
|
+
fee
|
|
1679
|
+
}) {
|
|
1680
|
+
const assetIdNumber = Number(asset.getAssetId());
|
|
1681
|
+
const feeAssetIdNumber = Number(fee.getAssetId());
|
|
1682
|
+
if (Number.isNaN(assetIdNumber) || Number.isNaN(feeAssetIdNumber)) {
|
|
1683
|
+
return false;
|
|
1684
|
+
}
|
|
1685
|
+
return assetIdNumber > feeAssetIdNumber;
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1854
1688
|
// src/extrinsic/pallets/polkadotXcm/polkadotXcm.ts
|
|
1855
1689
|
var pallet2 = "polkadotXcm";
|
|
1856
1690
|
function polkadotXcm() {
|