import {
Transaction, Abi, Address, TokenBalance,
Nonce, GasLimit, Wei, Gwei, ChainId
} from '@tevm/voltaire';
const abi = Abi([{
name: "transfer",
type: "function",
inputs: [
{ name: "to", type: "address" },
{ name: "amount", type: "uint256" }
]
}]);
// Encode function call
const calldata = abi.transfer.encode(
Address("0x70997970C51812dc3A010C7d01b50e0d17dc79C8"),
TokenBalance.fromUnits("1", 18)
);
// Create transaction
const tx = Transaction({
type: Transaction.Type.EIP1559,
to: Address("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"), // USDC
data: calldata,
value: Wei(0),
chainId: ChainId(1),
nonce: Nonce(0),
maxFeePerGas: Gwei(30),
maxPriorityFeePerGas: Gwei(2),
gasLimit: GasLimit(100000),
});