@moonbeam-network/mrl 1.0.0-dev.280 → 1.0.0-dev.281

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.mjs CHANGED
@@ -16808,6 +16808,7 @@ import {
16808
16808
  } from "@moonbeam-network/xcm-builder";
16809
16809
  import { EvmService as EvmService2 } from "@moonbeam-network/xcm-sdk";
16810
16810
  import { EvmChain } from "@moonbeam-network/xcm-types";
16811
+ import { isEthAddress } from "@moonbeam-network/xcm-utils";
16811
16812
  import { u8aToHex } from "@polkadot/util";
16812
16813
  import { decodeAddress } from "@polkadot/util-crypto";
16813
16814
  import { encodeFunctionData } from "viem";
@@ -16873,16 +16874,17 @@ var SnowbridgeService = class _SnowbridgeService {
16873
16874
  requiresApproval
16874
16875
  } = args;
16875
16876
  const value = requiresApproval ? bridgeFeeAmount : amount + bridgeFeeAmount;
16877
+ const isEthereumDestination = isEthAddress(destinationAddress);
16878
+ const destination = isEthereumDestination ? { kind: 2, data: destinationAddress } : { kind: 1, data: u8aToHex(decodeAddress(destinationAddress)) };
16876
16879
  const contractArgs = [
16877
16880
  tokenAddress,
16878
16881
  destinationParaId,
16879
- {
16880
- kind: 1,
16881
- data: u8aToHex(decodeAddress(destinationAddress))
16882
- },
16883
- 0n,
16882
+ destination,
16883
+ 10000000000000n,
16884
+ // TODO mjm get from config
16884
16885
  amount
16885
16886
  ];
16887
+ console.log("contractArgs", contractArgs);
16886
16888
  return new ContractConfig({
16887
16889
  address: this.#gatewayAddress,
16888
16890
  abi: GATEWAY_ABI,
@@ -16961,7 +16963,10 @@ var SnowbridgeService = class _SnowbridgeService {
16961
16963
  // src/getTransferData/getBridgeChainData.ts
16962
16964
  import { getBalance, getDestinationFee } from "@moonbeam-network/xcm-sdk";
16963
16965
  import { EvmParachain, Parachain } from "@moonbeam-network/xcm-types";
16964
- import { getMultilocationDerivedAddresses } from "@moonbeam-network/xcm-utils";
16966
+ import {
16967
+ getMultilocationDerivedAddresses,
16968
+ isEthAddress as isEthAddress2
16969
+ } from "@moonbeam-network/xcm-utils";
16965
16970
  import { evmToAddress } from "@polkadot/util-crypto";
16966
16971
  async function getBridgeChainData({
16967
16972
  route,
@@ -17018,6 +17023,10 @@ function getBridgeChainAddress({
17018
17023
  const isDestinationBridgeChain = bridgeChain.isEqual(destination);
17019
17024
  const isSourceBridgeChain = bridgeChain.isEqual(source);
17020
17025
  let bridgeChainAddress = isDestinationBridgeChain ? destinationAddress : sourceAddress;
17026
+ if (Parachain.isExactly(bridgeChain) && isEthAddress2(bridgeChainAddress)) {
17027
+ bridgeChainAddress = evmToAddress(bridgeChainAddress);
17028
+ return bridgeChainAddress;
17029
+ }
17021
17030
  if (Parachain.is(source) && !isSourceBridgeChain) {
17022
17031
  const isSourceEvmSigner = EvmParachain.is(source) && source.isEvmSigner;
17023
17032
  const { address20: computedOriginAccount } = getMultilocationDerivedAddresses({