Viem

createAccountViem(params)Account

Create an account representation from Viem Wallet Client

Parameters

Parameter
Type
Required
Description

walletClient

Instance of Viem Wallet client

Returns: Account

Example

import { createClient, BlindMintProduct, createAccountViem, createPublicProviderViem } from '@manifoldxyz/client-sdk';
import { walletClient, publicClient } from './client.ts';

// Create public provider for blockchain interactions
const publicProvider = createPublicProviderViem({
  1: publicClient // mainnet
});

// Initialize client with public provider
const client = createClient({ publicProvider });

// Grab product
const product = await client.getProduct('4150231280') as BlindMintProduct;

const prepared = await product.preparePurchase({
  address: '0xBuyer',
  payload: { quantity: 1 },
});

const account = createAccountViem({
  walletClient
})
const order = await product.purchase({
  account,
  preparedPurchase: prepared,
});
const txHash = order.receipts[0]?.txHash;
console.log(`Transaction submitted ${txHash}`)

ClientSDKError

Code
Message

INVALID_INPUT

Account not found. Please provide an Account explicitly when creating the Viem client.

Last updated