How to estimate transaction cost using Hedera SDK

64 views Asked by At

Is it possible to estimate transaction cost on Hedera SDK for operations like create token, wallet, mint nft etc?

As an example I'm posting minting function:

async mintToken(): Promise<TransactionResponse> {
    const tx = new TokenMintTransaction()
      .setTokenId(tokenId)
      .addMetadata(Buffer.from(ipfs))
      .setMaxTransactionFee(fee)
      .freezeWith(client);

    const signTx = await tx.sign(pkey);

    return signTx.execute(client);
  }

Node version 18,

"@hashgraph/sdk": "2.29.0",

0

There are 0 answers