import { foundry } from "./skills/foundry/index.js";
import * as Address from "@voltaire/primitives/Address";
import * as Transaction from "@voltaire/primitives/Transaction";
// Connect to local Anvil
const anvil = foundry.anvil({ port: 8545 });
// Load deployed contract from Foundry artifacts
const contract = await foundry.loadContract("out/MyContract.sol/MyContract.json");
// Build transaction using Voltaire
const tx = Transaction.from({
to: Address.from(contract.address),
data: contract.interface.encodeFunctionData("mint", [100n]),
});
// Execute and get traces
const result = await anvil.call(tx, { trace: true });