Write Contract
Send transactions from the connected wallet using type-safe functions and hooks for contract calls or raw transactions
Code
Preview
Send transactions from the connected wallet using type-safe functions and hooks for contract calls or raw transactions
import { getContract, prepareContractCall, toUnits } from "thirdweb";
import { sepolia } from "thirdweb/chains";
const tw_coin = getContract({
address: "0xACf072b740a23D48ECd302C9052fbeb3813b60a6",
chain: sepolia,
client: THIRDWEB_CLIENT,
});
function App() {
return (
<TransactionButton
transaction={() =>
prepareContractCall({
contract: tw_coin,
method: "function transfer(address to, uint256 value) returns (bool)",
params: ["0x...", toUnits("5", 18)],
})
}
>
Send
</TransactionButton>
);
}