Advanced use cases
We strongly recommend following this tutorial if you plan to support an Edition product with any of the following configurations:
Price set using an ERC-20 token
As discussed in Transaction Steps, purchasing a product might require more than one on-chain transaction. We recommend executing each transaction explicitly (e.g., via button clicks).
This tutorial demonstrates how to handle the above using the SDK.
The repo ships with a full example at examples/step-by-step-mint, showing how to implement minting with a Blind Mint product.
Install dependencies
cd examples/step-by-step-mint
npm installConfigure environment – Copy .env.example to .env and set the following:
NEXT_PUBLIC_INSTANCE_ID= # You blind mint instance ID from Manifold Studio
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID= # Get one at https://dashboard.reown.com/sign-inRun locally
npm run devKey implementation steps
Make sure you render ConnectButton on the page. This handles the user’s wallet connection, which is required to create an Account that the SDK uses to perform checks and execute transactions later.
'use client';
import { ConnectButton } from '@rainbow-me/rainbowkit';
export default function Home() {
return (
<main>
<div>
<ConnectButton />
</div>
</main>
);
}Implement the MintButton.tsx
On button click, initialize the client, fetch the product, and call preparePurchase to get the steps.
This is handled within handlePreparePurchase.
a. Create a Manifold Client
b. Fetch the product and validate the type
c. Check the product status to ensure it’s still active
e. Prepare the purchase by specifying the purchase amount and capture the returned PreparedPurchase
Implement a function responsible for executing an individual step. This is handled in handleExecuteStep
a. Create an Account representing the connected user.
b. Execute the step by calling the execute function on each step
c. Render the StepModal
Putting it all together
Best practices:
Validate the product type using isBlindMintProduct or isEditionProduct to ensure proper TypeScript typings.
Run getStatus before attempting a purchase to verify the product is available.
Handle ClientSDKError codes for scenarios like ineligibility, sold-out items, or insufficient funds.
See each method’s documentation for detailed error descriptions.
Last updated