# Minting Tokens (/docs/rise-wallet/minting)

import { MintWidget } from "@/components/rise-wallet/MintWidget";
import { ComponentPreviewTabs } from "@/components/rise-wallet/ComponentPreviewTabs";
import { CODE_EXAMPLES } from "@/components/rise-wallet/code-examples";

# Minting Tokens

This example demonstrates how to interact with a smart contract on RISE. Because RISE Wallet users often start without gas, transactions are sponsored by the relay infrastructure.

<ComponentPreviewTabs code={CODE_EXAMPLES.mint}>
  <MintWidget />
</ComponentPreviewTabs>

## How it Works

1. **Contract Interaction**: We use `wagmi`'s `useSendCalls` (or a wrapper hook) to send transactions.
2. **Gas Sponsorship**: The RISE Paymaster automatically sponsors eligible transactions.
3. **User Experience**: The user signs the request with their Passkey (or Session Key if active), and the transaction is submitted instantly.

### Sending a Transaction

To write to a contract, encode the function data using `viem` and send it using `sendCallsAsync`.

```tsx
import { useSendCalls } from "wagmi";
import { encodeFunctionData } from "viem";
import { MintableERC20ABI } from "@/abi/erc20";

// ... inside your component
const { sendCallsAsync } = useSendCalls();

const handleMint = async () => {
  const data = encodeFunctionData({
    abi: MintableERC20ABI,
    functionName: "mintOnce",
    args: [],
  });

  await sendCallsAsync({
    calls: [
      {
        to: "0x...", // Token Contract Address
        data,
      },
    ],
  });
};
```
