EVM Interactions
Mint an NFT on EVM with Wagmi
The Basics
- Add Login / Signup
- Chains / Networks
- Wallets
- Set Up Embedded Wallets
- Set Up Branded Wallets
- Smart Wallets
- Using Wallets
- Accessing Wallets
- Interacting with wallets
- General Interactions
- EVM Interactions
- Bitcoin Interactions
- Solana Interactions
- Multi Wallet
- Multi Asset UI
- Send Assets
- Users / VC's
- Design
- Onramps
Beyond The Basics
- Headless
- Cross-ecosystem Connectivity
- Bridge Widget
- Rate Limits
Developer Dashboard
- SDK and API Keys
- Sandbox vs Live
- Analytics
- User Management
- Test Accounts
- Settings
- Admin
- Webhooks
- Configuring Social Providers
Tutorials
- Farcaster
- Telegram
- Features
- Frameworks
- Integrations
- Webhooks
Migrating to Dynamic
- Migrating to Dynamic
- Migration Tutorials
For Wallets & Chains
Hackathons
EVM Interactions
Mint an NFT on EVM with Wagmi
import { FC } from 'react';
import {
useContractWrite,
usePrepareContractWrite,
useWaitForTransaction,
} from 'wagmi';
export const ContractWriteSection: FC = () => {
const { config } = usePrepareContractWrite({
abi: [
{
inputs: [],
name: 'mint',
outputs: [],
stateMutability: 'nonpayable',
type: 'function',
},
] as const,
address: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
functionName: 'mint',
});
const { data, write } = useContractWrite(config);
const { isLoading, isSuccess } = useWaitForTransaction({
hash: data?.hash,
});
return (
<div>
<p>Mint NFT</p>
<button disabled={!write || isLoading} onClick={() => write?.()}>
{isLoading ? 'Minting...' : 'Mint'}
</button>
{isSuccess && (
<div>
Successfully minted your NFT!
<div>
<a href={`https://etherscan.io/tx/${data?.hash}`}>Etherscan</a>
</div>
</div>
)}
</div>
);
};
Was this page helpful?