@moonbeam-network/xcm-builder 3.0.9 → 3.1.0

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 CHANGED
@@ -80,6 +80,10 @@ declare class ContractConfig extends BaseConfig {
80
80
 
81
81
  type ContractConfigBuilder = ConfigBuilder<ContractConfig>;
82
82
 
83
+ declare function XcmPrecompile(): {
84
+ transferAssetsToPara20: () => ContractConfigBuilder;
85
+ };
86
+
83
87
  declare function Xtokens(): {
84
88
  transfer: (weight?: bigint) => ContractConfigBuilder;
85
89
  transferMultiCurrencies: (shouldTransferAssetPrecedeFeeAsset?: boolean, weight?: bigint) => ContractConfigBuilder;
@@ -88,6 +92,7 @@ declare function Xtokens(): {
88
92
 
89
93
  declare function ContractBuilder(): {
90
94
  Xtokens: typeof Xtokens;
95
+ XcmPrecompile: typeof XcmPrecompile;
91
96
  };
92
97
 
93
98
  type EvmQueryFunctions = 'getBalance';
package/build/index.mjs CHANGED
@@ -218,6 +218,550 @@ var ContractConfig = class _ContractConfig extends BaseConfig {
218
218
  }
219
219
  };
220
220
 
221
+ // src/types/evm/EvmQueryConfig.ts
222
+ var EvmQueryConfig = class _EvmQueryConfig {
223
+ args;
224
+ func;
225
+ static is(obj) {
226
+ return obj instanceof _EvmQueryConfig;
227
+ }
228
+ constructor({ args, func }) {
229
+ this.args = args;
230
+ this.func = func;
231
+ }
232
+ };
233
+
234
+ // src/types/substrate/ExtrinsicConfig.ts
235
+ var ExtrinsicConfig = class _ExtrinsicConfig extends BaseConfig {
236
+ // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
237
+ getArgs;
238
+ static is(obj) {
239
+ return obj instanceof _ExtrinsicConfig;
240
+ }
241
+ constructor({ getArgs, ...other }) {
242
+ super({ ...other });
243
+ this.getArgs = getArgs;
244
+ }
245
+ };
246
+
247
+ // src/types/substrate/SubstrateCallConfig.ts
248
+ var SubstrateCallConfig = class _SubstrateCallConfig {
249
+ api;
250
+ // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
251
+ call;
252
+ static is(obj) {
253
+ return obj instanceof _SubstrateCallConfig;
254
+ }
255
+ constructor({ api, call }) {
256
+ this.api = api;
257
+ this.call = call;
258
+ }
259
+ };
260
+
261
+ // src/contract/contracts/XcmPrecompile/XcmPrecompileAbi.ts
262
+ var XCM_ABI = [
263
+ {
264
+ inputs: [
265
+ {
266
+ components: [
267
+ {
268
+ internalType: "uint8",
269
+ name: "parents",
270
+ type: "uint8"
271
+ },
272
+ {
273
+ internalType: "bytes[]",
274
+ name: "interior",
275
+ type: "bytes[]"
276
+ }
277
+ ],
278
+ internalType: "struct XCM.Location",
279
+ name: "dest",
280
+ type: "tuple"
281
+ },
282
+ {
283
+ components: [
284
+ {
285
+ internalType: "uint8",
286
+ name: "parents",
287
+ type: "uint8"
288
+ },
289
+ {
290
+ internalType: "bytes[]",
291
+ name: "interior",
292
+ type: "bytes[]"
293
+ }
294
+ ],
295
+ internalType: "struct XCM.Location",
296
+ name: "beneficiary",
297
+ type: "tuple"
298
+ },
299
+ {
300
+ components: [
301
+ {
302
+ components: [
303
+ {
304
+ internalType: "uint8",
305
+ name: "parents",
306
+ type: "uint8"
307
+ },
308
+ {
309
+ internalType: "bytes[]",
310
+ name: "interior",
311
+ type: "bytes[]"
312
+ }
313
+ ],
314
+ internalType: "struct XCM.Location",
315
+ name: "location",
316
+ type: "tuple"
317
+ },
318
+ {
319
+ internalType: "uint256",
320
+ name: "amount",
321
+ type: "uint256"
322
+ }
323
+ ],
324
+ internalType: "struct XCM.AssetLocationInfo[]",
325
+ name: "assets",
326
+ type: "tuple[]"
327
+ },
328
+ {
329
+ internalType: "uint32",
330
+ name: "feeAssetItem",
331
+ type: "uint32"
332
+ }
333
+ ],
334
+ name: "transferAssetsLocation",
335
+ outputs: [],
336
+ stateMutability: "nonpayable",
337
+ type: "function"
338
+ },
339
+ {
340
+ inputs: [
341
+ {
342
+ internalType: "uint32",
343
+ name: "paraId",
344
+ type: "uint32"
345
+ },
346
+ {
347
+ internalType: "address",
348
+ name: "beneficiary",
349
+ type: "address"
350
+ },
351
+ {
352
+ components: [
353
+ {
354
+ internalType: "address",
355
+ name: "asset",
356
+ type: "address"
357
+ },
358
+ {
359
+ internalType: "uint256",
360
+ name: "amount",
361
+ type: "uint256"
362
+ }
363
+ ],
364
+ internalType: "struct XCM.AssetAddressInfo[]",
365
+ name: "assets",
366
+ type: "tuple[]"
367
+ },
368
+ {
369
+ internalType: "uint32",
370
+ name: "feeAssetItem",
371
+ type: "uint32"
372
+ }
373
+ ],
374
+ name: "transferAssetsToPara20",
375
+ outputs: [],
376
+ stateMutability: "nonpayable",
377
+ type: "function"
378
+ },
379
+ {
380
+ inputs: [
381
+ {
382
+ internalType: "uint32",
383
+ name: "paraId",
384
+ type: "uint32"
385
+ },
386
+ {
387
+ internalType: "bytes32",
388
+ name: "beneficiary",
389
+ type: "bytes32"
390
+ },
391
+ {
392
+ components: [
393
+ {
394
+ internalType: "address",
395
+ name: "asset",
396
+ type: "address"
397
+ },
398
+ {
399
+ internalType: "uint256",
400
+ name: "amount",
401
+ type: "uint256"
402
+ }
403
+ ],
404
+ internalType: "struct XCM.AssetAddressInfo[]",
405
+ name: "assets",
406
+ type: "tuple[]"
407
+ },
408
+ {
409
+ internalType: "uint32",
410
+ name: "feeAssetItem",
411
+ type: "uint32"
412
+ }
413
+ ],
414
+ name: "transferAssetsToPara32",
415
+ outputs: [],
416
+ stateMutability: "nonpayable",
417
+ type: "function"
418
+ },
419
+ {
420
+ inputs: [
421
+ {
422
+ internalType: "bytes32",
423
+ name: "beneficiary",
424
+ type: "bytes32"
425
+ },
426
+ {
427
+ components: [
428
+ {
429
+ internalType: "address",
430
+ name: "asset",
431
+ type: "address"
432
+ },
433
+ {
434
+ internalType: "uint256",
435
+ name: "amount",
436
+ type: "uint256"
437
+ }
438
+ ],
439
+ internalType: "struct XCM.AssetAddressInfo[]",
440
+ name: "assets",
441
+ type: "tuple[]"
442
+ },
443
+ {
444
+ internalType: "uint32",
445
+ name: "feeAssetItem",
446
+ type: "uint32"
447
+ }
448
+ ],
449
+ name: "transferAssetsToRelay",
450
+ outputs: [],
451
+ stateMutability: "nonpayable",
452
+ type: "function"
453
+ },
454
+ {
455
+ inputs: [
456
+ {
457
+ components: [
458
+ {
459
+ internalType: "uint8",
460
+ name: "parents",
461
+ type: "uint8"
462
+ },
463
+ {
464
+ internalType: "bytes[]",
465
+ name: "interior",
466
+ type: "bytes[]"
467
+ }
468
+ ],
469
+ internalType: "struct XCM.Location",
470
+ name: "dest",
471
+ type: "tuple"
472
+ },
473
+ {
474
+ components: [
475
+ {
476
+ internalType: "address",
477
+ name: "asset",
478
+ type: "address"
479
+ },
480
+ {
481
+ internalType: "uint256",
482
+ name: "amount",
483
+ type: "uint256"
484
+ }
485
+ ],
486
+ internalType: "struct XCM.AssetAddressInfo[]",
487
+ name: "assets",
488
+ type: "tuple[]"
489
+ },
490
+ {
491
+ internalType: "enum XCM.TransferType",
492
+ name: "assetsTransferType",
493
+ type: "uint8"
494
+ },
495
+ {
496
+ internalType: "uint8",
497
+ name: "remoteFeesIdIndex",
498
+ type: "uint8"
499
+ },
500
+ {
501
+ internalType: "enum XCM.TransferType",
502
+ name: "feesTransferType",
503
+ type: "uint8"
504
+ },
505
+ {
506
+ internalType: "bytes",
507
+ name: "customXcmOnDest",
508
+ type: "bytes"
509
+ }
510
+ ],
511
+ name: "transferAssetsUsingTypeAndThenAddress",
512
+ outputs: [],
513
+ stateMutability: "nonpayable",
514
+ type: "function"
515
+ },
516
+ {
517
+ inputs: [
518
+ {
519
+ components: [
520
+ {
521
+ internalType: "uint8",
522
+ name: "parents",
523
+ type: "uint8"
524
+ },
525
+ {
526
+ internalType: "bytes[]",
527
+ name: "interior",
528
+ type: "bytes[]"
529
+ }
530
+ ],
531
+ internalType: "struct XCM.Location",
532
+ name: "dest",
533
+ type: "tuple"
534
+ },
535
+ {
536
+ components: [
537
+ {
538
+ internalType: "address",
539
+ name: "asset",
540
+ type: "address"
541
+ },
542
+ {
543
+ internalType: "uint256",
544
+ name: "amount",
545
+ type: "uint256"
546
+ }
547
+ ],
548
+ internalType: "struct XCM.AssetAddressInfo[]",
549
+ name: "assets",
550
+ type: "tuple[]"
551
+ },
552
+ {
553
+ internalType: "uint8",
554
+ name: "remoteFeesIdIndex",
555
+ type: "uint8"
556
+ },
557
+ {
558
+ internalType: "bytes",
559
+ name: "customXcmOnDest",
560
+ type: "bytes"
561
+ },
562
+ {
563
+ components: [
564
+ {
565
+ internalType: "uint8",
566
+ name: "parents",
567
+ type: "uint8"
568
+ },
569
+ {
570
+ internalType: "bytes[]",
571
+ name: "interior",
572
+ type: "bytes[]"
573
+ }
574
+ ],
575
+ internalType: "struct XCM.Location",
576
+ name: "remoteReserve",
577
+ type: "tuple"
578
+ }
579
+ ],
580
+ name: "transferAssetsUsingTypeAndThenAddress",
581
+ outputs: [],
582
+ stateMutability: "nonpayable",
583
+ type: "function"
584
+ },
585
+ {
586
+ inputs: [
587
+ {
588
+ components: [
589
+ {
590
+ internalType: "uint8",
591
+ name: "parents",
592
+ type: "uint8"
593
+ },
594
+ {
595
+ internalType: "bytes[]",
596
+ name: "interior",
597
+ type: "bytes[]"
598
+ }
599
+ ],
600
+ internalType: "struct XCM.Location",
601
+ name: "dest",
602
+ type: "tuple"
603
+ },
604
+ {
605
+ components: [
606
+ {
607
+ components: [
608
+ {
609
+ internalType: "uint8",
610
+ name: "parents",
611
+ type: "uint8"
612
+ },
613
+ {
614
+ internalType: "bytes[]",
615
+ name: "interior",
616
+ type: "bytes[]"
617
+ }
618
+ ],
619
+ internalType: "struct XCM.Location",
620
+ name: "location",
621
+ type: "tuple"
622
+ },
623
+ {
624
+ internalType: "uint256",
625
+ name: "amount",
626
+ type: "uint256"
627
+ }
628
+ ],
629
+ internalType: "struct XCM.AssetLocationInfo[]",
630
+ name: "assets",
631
+ type: "tuple[]"
632
+ },
633
+ {
634
+ internalType: "enum XCM.TransferType",
635
+ name: "assetsTransferType",
636
+ type: "uint8"
637
+ },
638
+ {
639
+ internalType: "uint8",
640
+ name: "remoteFeesIdIndex",
641
+ type: "uint8"
642
+ },
643
+ {
644
+ internalType: "enum XCM.TransferType",
645
+ name: "feesTransferType",
646
+ type: "uint8"
647
+ },
648
+ {
649
+ internalType: "bytes",
650
+ name: "customXcmOnDest",
651
+ type: "bytes"
652
+ }
653
+ ],
654
+ name: "transferAssetsUsingTypeAndThenLocation",
655
+ outputs: [],
656
+ stateMutability: "nonpayable",
657
+ type: "function"
658
+ },
659
+ {
660
+ inputs: [
661
+ {
662
+ components: [
663
+ {
664
+ internalType: "uint8",
665
+ name: "parents",
666
+ type: "uint8"
667
+ },
668
+ {
669
+ internalType: "bytes[]",
670
+ name: "interior",
671
+ type: "bytes[]"
672
+ }
673
+ ],
674
+ internalType: "struct XCM.Location",
675
+ name: "dest",
676
+ type: "tuple"
677
+ },
678
+ {
679
+ components: [
680
+ {
681
+ components: [
682
+ {
683
+ internalType: "uint8",
684
+ name: "parents",
685
+ type: "uint8"
686
+ },
687
+ {
688
+ internalType: "bytes[]",
689
+ name: "interior",
690
+ type: "bytes[]"
691
+ }
692
+ ],
693
+ internalType: "struct XCM.Location",
694
+ name: "location",
695
+ type: "tuple"
696
+ },
697
+ {
698
+ internalType: "uint256",
699
+ name: "amount",
700
+ type: "uint256"
701
+ }
702
+ ],
703
+ internalType: "struct XCM.AssetLocationInfo[]",
704
+ name: "assets",
705
+ type: "tuple[]"
706
+ },
707
+ {
708
+ internalType: "uint8",
709
+ name: "remoteFeesIdIndex",
710
+ type: "uint8"
711
+ },
712
+ {
713
+ internalType: "bytes",
714
+ name: "customXcmOnDest",
715
+ type: "bytes"
716
+ },
717
+ {
718
+ components: [
719
+ {
720
+ internalType: "uint8",
721
+ name: "parents",
722
+ type: "uint8"
723
+ },
724
+ {
725
+ internalType: "bytes[]",
726
+ name: "interior",
727
+ type: "bytes[]"
728
+ }
729
+ ],
730
+ internalType: "struct XCM.Location",
731
+ name: "remoteReserve",
732
+ type: "tuple"
733
+ }
734
+ ],
735
+ name: "transferAssetsUsingTypeAndThenLocation",
736
+ outputs: [],
737
+ stateMutability: "nonpayable",
738
+ type: "function"
739
+ }
740
+ ];
741
+
742
+ // src/contract/contracts/XcmPrecompile/XcmPrecompile.ts
743
+ var XCM_PRECOMPILE_ADDRESS = "0x000000000000000000000000000000000000081A";
744
+ function XcmPrecompile() {
745
+ return {
746
+ transferAssetsToPara20: () => ({
747
+ build: ({ destinationAddress, asset, destination }) => {
748
+ return new ContractConfig({
749
+ address: XCM_PRECOMPILE_ADDRESS,
750
+ abi: XCM_ABI,
751
+ args: [
752
+ destination.parachainId,
753
+ destinationAddress,
754
+ [[asset.address, asset.amount]],
755
+ 0
756
+ ],
757
+ func: "transferAssetsToPara20",
758
+ module: "Xcm"
759
+ });
760
+ }
761
+ })
762
+ };
763
+ }
764
+
221
765
  // src/contract/contracts/Xtokens/Xtokens.ts
222
766
  import { formatAssetIdToERC20 } from "@moonbeam-network/xcm-utils";
223
767
  import { u8aToHex as u8aToHex3 } from "@polkadot/util";
@@ -424,23 +968,11 @@ function getDestinationMultilocation(address, destination) {
424
968
  // src/contract/ContractBuilder.ts
425
969
  function ContractBuilder() {
426
970
  return {
427
- Xtokens
971
+ Xtokens,
972
+ XcmPrecompile
428
973
  };
429
974
  }
430
975
 
431
- // src/types/evm/EvmQueryConfig.ts
432
- var EvmQueryConfig = class _EvmQueryConfig {
433
- args;
434
- func;
435
- static is(obj) {
436
- return obj instanceof _EvmQueryConfig;
437
- }
438
- constructor({ args, func }) {
439
- this.args = args;
440
- this.func = func;
441
- }
442
- };
443
-
444
976
  // src/balance/Erc20Abi.ts
445
977
  var ERC20_ABI = [
446
978
  {
@@ -829,19 +1361,6 @@ async function calculateSystemAccountBalance(response) {
829
1361
  return free - locked;
830
1362
  }
831
1363
 
832
- // src/types/substrate/ExtrinsicConfig.ts
833
- var ExtrinsicConfig = class _ExtrinsicConfig extends BaseConfig {
834
- // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
835
- getArgs;
836
- static is(obj) {
837
- return obj instanceof _ExtrinsicConfig;
838
- }
839
- constructor({ getArgs, ...other }) {
840
- super({ ...other });
841
- this.getArgs = getArgs;
842
- }
843
- };
844
-
845
1364
  // src/extrinsic/pallets/eqBalances/eqBalances.ts
846
1365
  var pallet = "eqBalances";
847
1366
  function eqBalances() {
@@ -1691,20 +2210,6 @@ function ExtrinsicBuilder() {
1691
2210
  };
1692
2211
  }
1693
2212
 
1694
- // src/types/substrate/SubstrateCallConfig.ts
1695
- var SubstrateCallConfig = class _SubstrateCallConfig {
1696
- api;
1697
- // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
1698
- call;
1699
- static is(obj) {
1700
- return obj instanceof _SubstrateCallConfig;
1701
- }
1702
- constructor({ api, call }) {
1703
- this.api = api;
1704
- this.call = call;
1705
- }
1706
- };
1707
-
1708
2213
  // src/fee/FeeBuilder.utils.ts
1709
2214
  var DEFAULT_AMOUNT = 10 ** 6;
1710
2215
  var DEFAULT_HEX_STRING = "0xabcdef1234567890fedcba0987654321abcdef1234567890fedcba0987654321";