@moonbeam-network/mrl 1.0.0-dev.278 → 1.0.0-dev.280
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 +6 -18
- package/build/index.mjs.map +1 -1
- package/package.json +6 -6
package/build/index.mjs
CHANGED
|
@@ -16808,7 +16808,6 @@ 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";
|
|
16812
16811
|
import { u8aToHex } from "@polkadot/util";
|
|
16813
16812
|
import { decodeAddress } from "@polkadot/util-crypto";
|
|
16814
16813
|
import { encodeFunctionData } from "viem";
|
|
@@ -16874,17 +16873,16 @@ var SnowbridgeService = class _SnowbridgeService {
|
|
|
16874
16873
|
requiresApproval
|
|
16875
16874
|
} = args;
|
|
16876
16875
|
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)) };
|
|
16879
16876
|
const contractArgs = [
|
|
16880
16877
|
tokenAddress,
|
|
16881
16878
|
destinationParaId,
|
|
16882
|
-
|
|
16883
|
-
|
|
16884
|
-
|
|
16879
|
+
{
|
|
16880
|
+
kind: 1,
|
|
16881
|
+
data: u8aToHex(decodeAddress(destinationAddress))
|
|
16882
|
+
},
|
|
16883
|
+
0n,
|
|
16885
16884
|
amount
|
|
16886
16885
|
];
|
|
16887
|
-
console.log("contractArgs", contractArgs);
|
|
16888
16886
|
return new ContractConfig({
|
|
16889
16887
|
address: this.#gatewayAddress,
|
|
16890
16888
|
abi: GATEWAY_ABI,
|
|
@@ -16963,10 +16961,7 @@ var SnowbridgeService = class _SnowbridgeService {
|
|
|
16963
16961
|
// src/getTransferData/getBridgeChainData.ts
|
|
16964
16962
|
import { getBalance, getDestinationFee } from "@moonbeam-network/xcm-sdk";
|
|
16965
16963
|
import { EvmParachain, Parachain } from "@moonbeam-network/xcm-types";
|
|
16966
|
-
import {
|
|
16967
|
-
getMultilocationDerivedAddresses,
|
|
16968
|
-
isEthAddress as isEthAddress2
|
|
16969
|
-
} from "@moonbeam-network/xcm-utils";
|
|
16964
|
+
import { getMultilocationDerivedAddresses } from "@moonbeam-network/xcm-utils";
|
|
16970
16965
|
import { evmToAddress } from "@polkadot/util-crypto";
|
|
16971
16966
|
async function getBridgeChainData({
|
|
16972
16967
|
route,
|
|
@@ -16984,7 +16979,6 @@ async function getBridgeChainData({
|
|
|
16984
16979
|
sourceAddress,
|
|
16985
16980
|
destinationAddress
|
|
16986
16981
|
});
|
|
16987
|
-
console.log("bridgeChain bridgeChainAddress", bridgeChainAddress);
|
|
16988
16982
|
const fee = await getDestinationFee({
|
|
16989
16983
|
address: bridgeChainAddress,
|
|
16990
16984
|
asset: route.source.asset,
|
|
@@ -16993,21 +16987,18 @@ async function getBridgeChainData({
|
|
|
16993
16987
|
feeAsset: route.mrl.bridgeChain.fee.asset,
|
|
16994
16988
|
source: route.source.chain
|
|
16995
16989
|
});
|
|
16996
|
-
console.log("bridgeChain fee", fee);
|
|
16997
16990
|
const balance = await getBalance({
|
|
16998
16991
|
address: bridgeChainAddress,
|
|
16999
16992
|
asset: bridgeChain.getChainAsset(route.mrl.bridgeChain.asset),
|
|
17000
16993
|
builder: route.mrl.bridgeChain.balance,
|
|
17001
16994
|
chain: bridgeChain
|
|
17002
16995
|
});
|
|
17003
|
-
console.log("bridgeChain balance", balance);
|
|
17004
16996
|
const feeBalance = await getBalance({
|
|
17005
16997
|
address: bridgeChainAddress,
|
|
17006
16998
|
asset: bridgeChain.getChainAsset(route.mrl.bridgeChain.fee.asset),
|
|
17007
16999
|
builder: route.mrl.bridgeChain.fee.balance,
|
|
17008
17000
|
chain: bridgeChain
|
|
17009
17001
|
});
|
|
17010
|
-
console.log("bridgeChain feeBalance", feeBalance);
|
|
17011
17002
|
return {
|
|
17012
17003
|
address: bridgeChainAddress,
|
|
17013
17004
|
balance,
|
|
@@ -17027,9 +17018,6 @@ function getBridgeChainAddress({
|
|
|
17027
17018
|
const isDestinationBridgeChain = bridgeChain.isEqual(destination);
|
|
17028
17019
|
const isSourceBridgeChain = bridgeChain.isEqual(source);
|
|
17029
17020
|
let bridgeChainAddress = isDestinationBridgeChain ? destinationAddress : sourceAddress;
|
|
17030
|
-
if (Parachain.isExactly(bridgeChain) && isEthAddress2(bridgeChainAddress)) {
|
|
17031
|
-
bridgeChainAddress = evmToAddress(bridgeChainAddress);
|
|
17032
|
-
}
|
|
17033
17021
|
if (Parachain.is(source) && !isSourceBridgeChain) {
|
|
17034
17022
|
const isSourceEvmSigner = EvmParachain.is(source) && source.isEvmSigner;
|
|
17035
17023
|
const { address20: computedOriginAccount } = getMultilocationDerivedAddresses({
|