@moonbeam-network/xcm-builder 1.0.0-dev.276 → 1.0.0-dev.278
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 +16 -16
- package/build/index.mjs.map +1 -1
- package/package.json +11 -11
package/build/index.mjs
CHANGED
|
@@ -3929,7 +3929,7 @@ function gateway() {
|
|
|
3929
3929
|
return new ContractConfig({
|
|
3930
3930
|
address: source.contracts.Gateway,
|
|
3931
3931
|
abi: GATEWAY_ABI,
|
|
3932
|
-
args: [asset.address, destination.parachainId,
|
|
3932
|
+
args: [asset.address, destination.parachainId, 10000000000000n],
|
|
3933
3933
|
func: "quoteSendTokenFee",
|
|
3934
3934
|
module: "Gateway"
|
|
3935
3935
|
});
|
|
@@ -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
|
|
7233
|
-
if (!
|
|
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
|
|
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
|
-
|
|
7253
|
-
|
|
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
|
|
7392
|
-
if (!
|
|
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
|
|
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
|
-
|
|
7412
|
-
|
|
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
|
|
7563
|
-
if (!
|
|
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
|
|
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,
|
|
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
|
-
[
|
|
7581
|
+
[tokenAddressOnBridgeChain, contract3.address],
|
|
7582
7582
|
[0n, 0n],
|
|
7583
7583
|
// Value to send for each call
|
|
7584
7584
|
[approveTx, contract3.encodeFunctionData()],
|