estimateGas()

SDKestimateGas()

Description

Estimate the gas consumption for the transaction

Nature

Method of Class

Parameters

NameTypeRequiredDescription

from

string

YES

The EVM-compatible wallet address of the user

to

string

YES

The contract address of Tako Open Curation (Use takoHubInfo() to retrieve the contract address)

data

string

YES

The calldata for calling the Tako Open Curation Contract

value

bigint

YES

Token amount

Example Code

import { ethers } from 'ethers'
import { CONSTANT, TakoOpenCuration } from 'tako-open-curation'

const tako = new TakoOpenCuration(CONSTANT.Network.TESTNET)
const lensOpenCuration = tako.lensOpenCuration
const apikey = "Your Alchemy API Key"
const web3Provider = new ethers.providers.AlchemyProvider(80001, apikey)
lensOpenCuration.provider = web3Provider

const takoHubInfo = await lensOpenCuration.takoHubInfo();
const amount = BigInt(325); // 325 GWEI
const abiData = await lensOpenCuration.generateBidAbiData("0x47-0x01-DA-fece722d", "0x0000000000000000000000000000000000000000", amount);
const estimatedGas = await lensOpenCuration.estimateGas("0xaddress", takoHubInfo.contract, abiData, amount);

Example Returns

// bigint
144171n

Last updated