From ffb0235dcf10203d7261612212ddf9a028588375 Mon Sep 17 00:00:00 2001 From: imsk17 Date: Thu, 29 Feb 2024 15:12:07 +0530 Subject: [PATCH] Chains: Fix Transaction Fee on Claim --- src/handlers/evm/index.ts | 16 ++++++++++++---- src/handlers/multiversx/index.ts | 2 +- src/test.ts | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 src/test.ts diff --git a/src/handlers/evm/index.ts b/src/handlers/evm/index.ts index 94033e0d..085c525f 100644 --- a/src/handlers/evm/index.ts +++ b/src/handlers/evm/index.ts @@ -14,10 +14,13 @@ export function evmHandler({ return { claimNft(wallet, claimData, extraArgs, sigs) { const contract = Bridge__factory.connect(bridge, wallet); - return contract.claimNFT1155( + return contract.claimNFT721( claimData, sigs.map((e) => e.signature), - extraArgs, + { + ...extraArgs, + value: claimData.fee, + }, ); }, async deployCollection(signer, da, ga) { @@ -34,13 +37,15 @@ export function evmHandler({ }, async mintNft(signer, ma) { const minter = ERC721Royalty__factory.connect(ma.contract, signer); - return minter.mint( + const response = await minter.mint( await signer.getAddress(), ma.tokenId, ma.royalty, ma.royaltyReceiver, ma.uri, ); + await response.wait(); + return response; }, getProvider() { return provider; @@ -155,7 +160,10 @@ export function evmHandler({ return contract.claimNFT1155( claimData, sigs.map((e) => e.signature), - extraArgs, + { + ...extraArgs, + value: claimData.fee, + }, ); }, async lockNft( diff --git a/src/handlers/multiversx/index.ts b/src/handlers/multiversx/index.ts index afc6916e..f10a895e 100644 --- a/src/handlers/multiversx/index.ts +++ b/src/handlers/multiversx/index.ts @@ -431,7 +431,7 @@ export function multiversxHandler({ .withSender(signer.getAddress()) .withChainID("D") .withGasLimit(6_000_000_00) - .withValue(new BigUIntValue("50000000000000000")) + .withValue(new BigUIntValue(claimData.fee)) .buildTransaction(); transaction.setNonce(userAccount.getNonceThenIncrement()); transaction.applySignature( diff --git a/src/test.ts b/src/test.ts new file mode 100644 index 00000000..1298c0dd --- /dev/null +++ b/src/test.ts @@ -0,0 +1,16 @@ +import { Wallet } from "ethers"; +import { Chain, ChainFactory, ChainFactoryConfigs } from "./factory"; + +(async () => { + const cf = ChainFactory(ChainFactoryConfigs.TestNet()); + const eth = await cf.inner(Chain.ETH); + const wallet = new Wallet( + "0x0e979ae1299df55645e68808754c93c067e35834195c420945d062858bea2965", + eth.getProvider(), + ); + + const response = await eth.getClaimData( + "0x210b4850cae9ab90802ac624cb7af46646ffc01167bfc079aab40345630361cf", + ); + console.log(mint); +})();