@moonbeam-network/xcm-builder 3.1.0 → 3.1.2

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
@@ -56,6 +56,7 @@ declare function AssetMinBuilder(): {
56
56
  declare function assetRegistry(): {
57
57
  assetMetadatas: () => AssetMinConfigBuilder;
58
58
  currencyMetadatas: () => AssetMinConfigBuilder;
59
+ metadata: () => AssetMinConfigBuilder;
59
60
  };
60
61
  declare function assets$1(): {
61
62
  asset: () => AssetMinConfigBuilder;
@@ -82,6 +83,7 @@ type ContractConfigBuilder = ConfigBuilder<ContractConfig>;
82
83
 
83
84
  declare function XcmPrecompile(): {
84
85
  transferAssetsToPara20: () => ContractConfigBuilder;
86
+ transferAssetsToPara32: () => ContractConfigBuilder;
85
87
  };
86
88
 
87
89
  declare function Xtokens(): {
package/build/index.mjs CHANGED
@@ -135,6 +135,15 @@ function assetRegistry() {
135
135
  // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
136
136
  transform: async (response) => response.unwrapOrDefault().minimalBalance.toBigInt()
137
137
  })
138
+ }),
139
+ metadata: () => ({
140
+ build: ({ asset }) => new SubstrateQueryConfig({
141
+ module: pallet6,
142
+ func: "metadata",
143
+ args: [asset],
144
+ // biome-ignore lint/suspicious/noExplicitAny: not sure how to fix this
145
+ transform: async (response) => response.unwrapOrDefault().existentialDeposit.toBigInt()
146
+ })
138
147
  })
139
148
  };
140
149
  }
@@ -218,6 +227,10 @@ var ContractConfig = class _ContractConfig extends BaseConfig {
218
227
  }
219
228
  };
220
229
 
230
+ // src/contract/contracts/XcmPrecompile/XcmPrecompile.ts
231
+ import { u8aToHex as u8aToHex2 } from "@polkadot/util";
232
+ import { decodeAddress as decodeAddress2 } from "@polkadot/util-crypto";
233
+
221
234
  // src/types/evm/EvmQueryConfig.ts
222
235
  var EvmQueryConfig = class _EvmQueryConfig {
223
236
  args;
@@ -758,26 +771,42 @@ function XcmPrecompile() {
758
771
  module: "Xcm"
759
772
  });
760
773
  }
774
+ }),
775
+ transferAssetsToPara32: () => ({
776
+ build: ({ destinationAddress, asset, destination }) => {
777
+ return new ContractConfig({
778
+ address: XCM_PRECOMPILE_ADDRESS,
779
+ abi: XCM_ABI,
780
+ args: [
781
+ destination.parachainId,
782
+ u8aToHex2(decodeAddress2(destinationAddress)),
783
+ [[asset.address, asset.amount]],
784
+ 0
785
+ ],
786
+ func: "transferAssetsToPara32",
787
+ module: "Xcm"
788
+ });
789
+ }
761
790
  })
762
791
  };
763
792
  }
764
793
 
765
794
  // src/contract/contracts/Xtokens/Xtokens.ts
766
795
  import { formatAssetIdToERC20 } from "@moonbeam-network/xcm-utils";
767
- import { u8aToHex as u8aToHex3 } from "@polkadot/util";
768
- import { decodeAddress as decodeAddress3, evmToAddress } from "@polkadot/util-crypto";
796
+ import { u8aToHex as u8aToHex4 } from "@polkadot/util";
797
+ import { decodeAddress as decodeAddress4, evmToAddress } from "@polkadot/util-crypto";
769
798
 
770
799
  // src/builder.utils.ts
771
800
  import { EvmParachain } from "@moonbeam-network/xcm-types";
772
- import { u8aToHex as u8aToHex2 } from "@polkadot/util";
773
- import { decodeAddress as decodeAddress2 } from "@polkadot/util-crypto";
801
+ import { u8aToHex as u8aToHex3 } from "@polkadot/util";
802
+ import { decodeAddress as decodeAddress3 } from "@polkadot/util-crypto";
774
803
  function getPrecompileDestinationInterior(destination, address) {
775
804
  if (!address) {
776
805
  return [`0x0000000${destination.parachainId.toString(16)}`];
777
806
  }
778
807
  const accountType = EvmParachain.is(destination) ? "03" : "01";
779
- const acc = `0x${accountType}${u8aToHex2(
780
- decodeAddress2(address),
808
+ const acc = `0x${accountType}${u8aToHex3(
809
+ decodeAddress3(address),
781
810
  -1,
782
811
  false
783
812
  )}00`;
@@ -950,8 +979,8 @@ function Xtokens() {
950
979
  function getDestinationMultilocationForPrecompileDestination(address, destination) {
951
980
  const accountType = "01";
952
981
  const substrateAddress = evmToAddress(address);
953
- const acc = `0x${accountType}${u8aToHex3(
954
- decodeAddress3(substrateAddress),
982
+ const acc = `0x${accountType}${u8aToHex4(
983
+ decodeAddress4(substrateAddress),
955
984
  -1,
956
985
  false
957
986
  )}00`;
@@ -3320,7 +3349,7 @@ function getCurrencies({ source, moonAsset, asset }) {
3320
3349
  }
3321
3350
 
3322
3351
  // src/mrl/providers/wormhole/contract/Gmp/Gmp.ts
3323
- import { u8aToHex as u8aToHex4 } from "@polkadot/util";
3352
+ import { u8aToHex as u8aToHex5 } from "@polkadot/util";
3324
3353
 
3325
3354
  // src/mrl/providers/wormhole/contract/Gmp/GmpAbi.ts
3326
3355
  var GMP_ABI = [
@@ -3346,7 +3375,7 @@ function Gmp() {
3346
3375
  return {
3347
3376
  wormholeTransferERC20: () => ({
3348
3377
  build: ({ bytes }) => {
3349
- const hex = u8aToHex4(bytes);
3378
+ const hex = u8aToHex5(bytes);
3350
3379
  return new ContractConfig({
3351
3380
  address: GMP_CONTRACT_ADDRESS,
3352
3381
  abi: GMP_ABI,
@@ -3385,7 +3414,20 @@ var WormholeConfig = class _WormholeConfig {
3385
3414
  import { Wormhole } from "@wormhole-foundation/sdk-connect";
3386
3415
  import { EvmPlatform } from "@wormhole-foundation/sdk-evm";
3387
3416
  function wormholeFactory(chain) {
3388
- return new Wormhole(chain.isTestChain ? "Testnet" : "Mainnet", [EvmPlatform]);
3417
+ return new Wormhole(
3418
+ chain.isTestChain ? "Testnet" : "Mainnet",
3419
+ [EvmPlatform],
3420
+ {
3421
+ chains: {
3422
+ Ethereum: {
3423
+ rpc: "https://eth.llamarpc.com"
3424
+ },
3425
+ Moonbeam: {
3426
+ rpc: "https://rpc.api.moonbeam.network"
3427
+ }
3428
+ }
3429
+ }
3430
+ );
3389
3431
  }
3390
3432
 
3391
3433
  // src/mrl/providers/wormhole/wormhole/wormhole.ts