Transaction

Overview

The transaction object is used throughout the SDK to make transactions. It follows the format of ethers transactions.

Parameters

.to
string
Required

The address the transaction is being sent to.

.data
string
Required

Data of the transaction to be executed.

Usage

,
getTransaction.js
const { Token } = require("fun-wallet/data")
const { Contract } = require("ethers")
const abi = require("fun-wallet/abis/ERC20.json").abi
const TO_ADDR = "0x07Ac5A221e5b3263ad0E04aBa6076B795A91aef9"
const getTx = async () => {
const tokenAddress = await Token.getAddress("usdc")
const provider = await global.chain.getProvider()
const contract = new Contract(tokenAddress, abi, provider)
// Get raw transaction object.
const tx = await contract.populateTransaction.approve(TO_ADDR, 1e6)
}
getTx()

See full transaction reference.

On this page