approve

Prepares a transaction to call the "approve" function on the contract.

Example

import { sendTransaction } from "thirdweb";
import { approve } from "thirdweb/extensions/erc721";
const transaction = approve({
contract,
to: ...,
tokenId: ...,
overrides: {
...
}
});
// Send the transaction
await sendTransaction({ transaction, account });
function approve(
ApproveParams | { asyncParams: () => Promise<ApproveParams> }
>,

Parameters

The options for the "approve" function.

Type

ApproveParams | { asyncParams: () => Promise<ApproveParams> }
>;

Returns

let returnType: PreparedTransaction<
any,
AbiFunction,
>;

A prepared transaction object.