@moonbeam-network/xcm-builder 1.0.0-dev.281 → 1.0.0-dev.282
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 +3 -0
- package/build/index.mjs +40 -9
- package/build/index.mjs.map +1 -1
- package/package.json +3 -3
package/build/index.d.ts
CHANGED
|
@@ -511,6 +511,7 @@ interface BridgeFeeConfigBuilderParams {
|
|
|
511
511
|
balance?: AssetAmount;
|
|
512
512
|
destination: AnyChain;
|
|
513
513
|
source: AnyChain;
|
|
514
|
+
bridgeChainFee: AssetAmount;
|
|
514
515
|
}
|
|
515
516
|
interface XcmPaymentFeeProps {
|
|
516
517
|
isAssetReserveChain: boolean;
|
|
@@ -607,6 +608,7 @@ interface SnowbridgeFunctionArgs {
|
|
|
607
608
|
destinationParaId: number;
|
|
608
609
|
amount: bigint;
|
|
609
610
|
bridgeFeeAmount: bigint;
|
|
611
|
+
bridgeChainFee: bigint;
|
|
610
612
|
requiresApproval: boolean;
|
|
611
613
|
}
|
|
612
614
|
interface SnowbridgeConfigConstructorParams {
|
|
@@ -1739,6 +1741,7 @@ type MrlExecuteConfigBuilder = ConfigBuilder<ContractConfig, MrlExecuteBuilderPa
|
|
|
1739
1741
|
interface MrlBuilderParams extends BuilderParams<AnyChain> {
|
|
1740
1742
|
isAutomatic: boolean;
|
|
1741
1743
|
protocolFee?: AssetAmount;
|
|
1744
|
+
bridgeChainFee?: AssetAmount;
|
|
1742
1745
|
moonApi: ApiPromise;
|
|
1743
1746
|
moonAsset: ChainAsset;
|
|
1744
1747
|
bridgeChain: AnyParachain;
|
package/build/index.mjs
CHANGED
|
@@ -3912,7 +3912,7 @@ function gateway() {
|
|
|
3912
3912
|
return {
|
|
3913
3913
|
quoteSendTokenFee() {
|
|
3914
3914
|
return {
|
|
3915
|
-
build: ({ asset, destination, source }) => {
|
|
3915
|
+
build: ({ asset, destination, source, bridgeChainFee }) => {
|
|
3916
3916
|
if (!asset.address) {
|
|
3917
3917
|
throw new Error(`Asset ${asset.key} has no address`);
|
|
3918
3918
|
}
|
|
@@ -3932,8 +3932,7 @@ function gateway() {
|
|
|
3932
3932
|
args: [
|
|
3933
3933
|
asset.address,
|
|
3934
3934
|
destination.parachainId,
|
|
3935
|
-
|
|
3936
|
-
// TODO mjm get from config? if not possible, we could default this, as it doesn't affect when sending to relay chain
|
|
3935
|
+
bridgeChainFee.amount
|
|
3937
3936
|
],
|
|
3938
3937
|
func: "quoteSendTokenFee",
|
|
3939
3938
|
module: "Gateway"
|
|
@@ -4720,27 +4719,49 @@ function Gateway() {
|
|
|
4720
4719
|
return {
|
|
4721
4720
|
sendToken: () => ({
|
|
4722
4721
|
provider,
|
|
4723
|
-
build: ({
|
|
4722
|
+
build: ({
|
|
4723
|
+
asset,
|
|
4724
|
+
destinationAddress,
|
|
4725
|
+
protocolFee,
|
|
4726
|
+
destination,
|
|
4727
|
+
bridgeChainFee
|
|
4728
|
+
}) => callSendToken(
|
|
4729
|
+
asset,
|
|
4730
|
+
protocolFee,
|
|
4731
|
+
destination,
|
|
4732
|
+
destinationAddress,
|
|
4733
|
+
bridgeChainFee
|
|
4734
|
+
)
|
|
4724
4735
|
}),
|
|
4725
4736
|
approveAndSendToken: () => ({
|
|
4726
4737
|
provider,
|
|
4727
|
-
build: ({
|
|
4738
|
+
build: ({
|
|
4739
|
+
asset,
|
|
4740
|
+
destinationAddress,
|
|
4741
|
+
protocolFee,
|
|
4742
|
+
destination,
|
|
4743
|
+
bridgeChainFee
|
|
4744
|
+
}) => {
|
|
4728
4745
|
const requiresApproval = protocolFee && !protocolFee.isSame(asset);
|
|
4729
4746
|
return callSendToken(
|
|
4730
4747
|
asset,
|
|
4731
4748
|
protocolFee,
|
|
4732
4749
|
destination,
|
|
4733
4750
|
destinationAddress,
|
|
4751
|
+
bridgeChainFee,
|
|
4734
4752
|
requiresApproval
|
|
4735
4753
|
);
|
|
4736
4754
|
}
|
|
4737
4755
|
})
|
|
4738
4756
|
};
|
|
4739
4757
|
}
|
|
4740
|
-
function callSendToken(asset, protocolFee, destination, destinationAddress, requiresApproval = false) {
|
|
4758
|
+
function callSendToken(asset, protocolFee, destination, destinationAddress, bridgeChainFee, requiresApproval = false) {
|
|
4741
4759
|
if (!protocolFee) {
|
|
4742
4760
|
throw new Error("Protocol fee is required for Gateway module");
|
|
4743
4761
|
}
|
|
4762
|
+
if (!bridgeChainFee) {
|
|
4763
|
+
throw new Error("Bridge chain fee is required for Gateway module");
|
|
4764
|
+
}
|
|
4744
4765
|
if (!EvmParachain4.isAnyParachain(destination)) {
|
|
4745
4766
|
throw new Error(
|
|
4746
4767
|
"Destination must be a Parachain or EvmParachain for sending token with Gateway module"
|
|
@@ -4753,6 +4774,7 @@ function callSendToken(asset, protocolFee, destination, destinationAddress, requ
|
|
|
4753
4774
|
destinationParaId: destination.parachainId,
|
|
4754
4775
|
amount: asset.amount,
|
|
4755
4776
|
bridgeFeeAmount: protocolFee.amount,
|
|
4777
|
+
bridgeChainFee: bridgeChainFee.amount,
|
|
4756
4778
|
requiresApproval
|
|
4757
4779
|
},
|
|
4758
4780
|
func: "sendToken"
|
|
@@ -4797,12 +4819,22 @@ function polkadotXcm2() {
|
|
|
4797
4819
|
// TODO mjm rename ? nativeEth?
|
|
4798
4820
|
canonicalEth: () => ({
|
|
4799
4821
|
provider,
|
|
4800
|
-
build: ({
|
|
4822
|
+
build: ({
|
|
4823
|
+
asset,
|
|
4824
|
+
destination,
|
|
4825
|
+
destinationAddress,
|
|
4826
|
+
bridgeChainFee
|
|
4827
|
+
}) => {
|
|
4801
4828
|
if (!EvmChain2.is(destination)) {
|
|
4802
4829
|
throw new Error(
|
|
4803
4830
|
"Destination must be an EVM chain for globalConsensus function"
|
|
4804
4831
|
);
|
|
4805
4832
|
}
|
|
4833
|
+
if (!bridgeChainFee) {
|
|
4834
|
+
throw new Error(
|
|
4835
|
+
"Bridge chain fee is required for the polkadotXcm.canonicalEth function"
|
|
4836
|
+
);
|
|
4837
|
+
}
|
|
4806
4838
|
return new ExtrinsicConfig({
|
|
4807
4839
|
module: pallet7,
|
|
4808
4840
|
func,
|
|
@@ -4821,8 +4853,7 @@ function polkadotXcm2() {
|
|
|
4821
4853
|
parents: 1,
|
|
4822
4854
|
interior: "Here"
|
|
4823
4855
|
},
|
|
4824
|
-
fun: { Fungible:
|
|
4825
|
-
// TODO mjm
|
|
4856
|
+
fun: { Fungible: bridgeChainFee.amount }
|
|
4826
4857
|
},
|
|
4827
4858
|
{
|
|
4828
4859
|
id: {
|