RISE Logo-Light

Minting Tokens

Interact with smart contracts using RISE Wallet

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.

Mint Tokens

Mock USD
0x044b...7f50
18 decimals
Mock Token
0x6166...6ceD
18 decimals

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.

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,
      },
    ],
  });
};