@moonbeam-network/xcm-builder 1.0.0-dev.276 → 1.0.0-dev.277

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
@@ -7229,8 +7229,8 @@ function TokenBridge() {
7229
7229
  build: ({ asset, destination, destinationAddress, bridgeChain }) => {
7230
7230
  const wh = wormholeFactory(bridgeChain);
7231
7231
  const whDestination = wh.getChain(destination.getWormholeName()).config.chainId;
7232
- const tokenAddressOnMoonChain = bridgeChain.getChainAsset(asset).address;
7233
- if (!tokenAddressOnMoonChain) {
7232
+ const tokenAddressOnBridgeChain = bridgeChain.getChainAsset(asset).address;
7233
+ if (!tokenAddressOnBridgeChain) {
7234
7234
  throw new Error(
7235
7235
  `Asset ${asset.symbol} does not have a token address on chain ${bridgeChain.name}`
7236
7236
  );
@@ -7238,7 +7238,7 @@ function TokenBridge() {
7238
7238
  const destinationAddress32bytes = convertAddressTo32Bytes(
7239
7239
  destinationAddress
7240
7240
  );
7241
- const tokenAmountOnMoonChain = asset.convertDecimals(
7241
+ const tokenAmountOnBridgeChain = asset.convertDecimals(
7242
7242
  bridgeChain.getChainAsset(asset).decimals
7243
7243
  ).amount;
7244
7244
  const contractAddress = wh.getChain("Moonbeam").config.contracts.tokenBridge;
@@ -7249,8 +7249,8 @@ function TokenBridge() {
7249
7249
  address: contractAddress,
7250
7250
  abi: TOKEN_BRIDGE_ABI,
7251
7251
  args: [
7252
- tokenAddressOnMoonChain,
7253
- tokenAmountOnMoonChain,
7252
+ tokenAddressOnBridgeChain,
7253
+ tokenAmountOnBridgeChain,
7254
7254
  whDestination,
7255
7255
  destinationAddress32bytes,
7256
7256
  0n,
@@ -7388,8 +7388,8 @@ function TokenBridgeRelayer() {
7388
7388
  build: ({ asset, destination, destinationAddress, bridgeChain }) => {
7389
7389
  const wh = wormholeFactory(bridgeChain);
7390
7390
  const whDestination = wh.getChain(destination.getWormholeName()).config.chainId;
7391
- const tokenAddressOnMoonChain = bridgeChain.getChainAsset(asset).address;
7392
- if (!tokenAddressOnMoonChain) {
7391
+ const tokenAddressOnBridgeChain = bridgeChain.getChainAsset(asset).address;
7392
+ if (!tokenAddressOnBridgeChain) {
7393
7393
  throw new Error(
7394
7394
  `Asset ${asset.symbol} does not have a token address on chain ${bridgeChain.name}`
7395
7395
  );
@@ -7397,7 +7397,7 @@ function TokenBridgeRelayer() {
7397
7397
  const destinationAddress32bytes = convertAddressTo32Bytes2(
7398
7398
  destinationAddress
7399
7399
  );
7400
- const tokenAmountOnMoonChain = asset.convertDecimals(
7400
+ const tokenAmountOnBridgeChain = asset.convertDecimals(
7401
7401
  bridgeChain.getChainAsset(asset).decimals
7402
7402
  ).amount;
7403
7403
  const contractAddress = wh.getChain("Moonbeam").config.contracts.tokenBridgeRelayer;
@@ -7408,8 +7408,8 @@ function TokenBridgeRelayer() {
7408
7408
  address: contractAddress,
7409
7409
  abi: TOKEN_BRIDGE_RELAYER_ABI,
7410
7410
  args: [
7411
- tokenAddressOnMoonChain,
7412
- tokenAmountOnMoonChain,
7411
+ tokenAddressOnBridgeChain,
7412
+ tokenAmountOnBridgeChain,
7413
7413
  0,
7414
7414
  whDestination,
7415
7415
  destinationAddress32bytes,
@@ -7559,26 +7559,26 @@ function ethereumXcm() {
7559
7559
  if (!bridgeChainGasLimit) {
7560
7560
  throw new Error("bridgeChainGasLimit must be defined");
7561
7561
  }
7562
- const tokenAddressOnMoonChain = bridgeChain.getChainAsset(asset).address;
7563
- if (!tokenAddressOnMoonChain) {
7562
+ const tokenAddressOnBridgeChain = bridgeChain.getChainAsset(asset).address;
7563
+ if (!tokenAddressOnBridgeChain) {
7564
7564
  throw new Error(
7565
7565
  `Asset ${asset.symbol} does not have a token address on chain ${bridgeChain.name}`
7566
7566
  );
7567
7567
  }
7568
- const tokenAmountOnMoonChain = asset.convertDecimals(
7568
+ const tokenAmountOnBridgeChain = asset.convertDecimals(
7569
7569
  bridgeChain.getChainAsset(asset).decimals
7570
7570
  ).amount;
7571
7571
  const contract3 = isAutomatic ? contract2().TokenBridgeRelayer().transferTokensWithRelay().build(params) : contract2().TokenBridge().transferTokens().build(params);
7572
7572
  const approveTx = encodeFunctionData3({
7573
7573
  abi: ERC20_ABI,
7574
7574
  functionName: "approve",
7575
- args: [contract3.address, tokenAmountOnMoonChain]
7575
+ args: [contract3.address, tokenAmountOnBridgeChain]
7576
7576
  });
7577
7577
  const batchAll = encodeFunctionData3({
7578
7578
  abi: BATCH_CONTRACT_ABI,
7579
7579
  functionName: "batchAll",
7580
7580
  args: [
7581
- [tokenAddressOnMoonChain, contract3.address],
7581
+ [tokenAddressOnBridgeChain, contract3.address],
7582
7582
  [0n, 0n],
7583
7583
  // Value to send for each call
7584
7584
  [approveTx, contract3.encodeFunctionData()],