Skip to content

set gasLimit in useWeb3Contract hook Nextjs #5078

Closed Answered by Belingheri
Belingheri asked this question in Q&A
Discussion options

You must be logged in to vote

thanks to @alymurtazamemon

@Belingheri You can also use the thirdweb for interacting with smart contracts.

I switch to thirdweb, this lib have the gasLimit option:

import { useContractWrite, useContract, Web3Button } from "@thirdweb-dev/react";
import { ethers } from "ethers";

// Your smart contract address
const contractAddress = "{{contract_address}}";

function App() {
  const { contract } = useContract(contractAddress);
  const { mutateAsync, isLoading, error } = useContractWrite(
    contract,
    "setName",
  );

  return (
    <Web3Button
      contractAddress={contractAddress}
      action={() =>
        mutateAsync([
          "My Name",
          {
            gasLimit: 1000000,

Replies: 3 comments 7 replies

Comment options

You must be logged in to vote
4 replies
@paulcoffee85
Comment options

@Belingheri
Comment options

@alymurtazamemon
Comment options

@Belingheri
Comment options

Comment options

You must be logged in to vote
3 replies
@Belingheri
Comment options

@alymurtazamemon
Comment options

@Belingheri
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by Belingheri
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants