Skip to content

Commit

Permalink
Chains: Fix Transaction Fee on Claim
Browse files Browse the repository at this point in the history
  • Loading branch information
imsk17 committed Feb 29, 2024
1 parent 42e47a2 commit ffb0235
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
16 changes: 12 additions & 4 deletions src/handlers/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down Expand Up @@ -155,7 +160,10 @@ export function evmHandler({
return contract.claimNFT1155(
claimData,
sigs.map((e) => e.signature),
extraArgs,
{
...extraArgs,
value: claimData.fee,
},
);
},
async lockNft(
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/multiversx/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
16 changes: 16 additions & 0 deletions src/test.ts
Original file line number Diff line number Diff line change
@@ -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);
})();

0 comments on commit ffb0235

Please sign in to comment.