Create a wallet-backed client
Call this from a connect action using your injected EIP-1193 provider:Read without a wallet
balanceOf(owner) for another public address.Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Use the core SDK with an injected wallet or a caller-owned wallet client.
import { createPublicClient, createWalletClient, custom, http } from "viem";
import { baseSepolia } from "viem/chains";
import { CTokenClient } from "@inco/ctoken";
// readRpcUrl is your application's configured read endpoint (or HTTP proxy).
const publicClient = createPublicClient({
chain: baseSepolia,
transport: http(readRpcUrl),
});
// ethereum is your injected EIP-1193 provider.
const connection = createWalletClient({
chain: baseSepolia,
transport: custom(ethereum),
});
const [account] = await connection.requestAddresses();
if (!account) throw new Error("Connect a wallet first.");
const walletClient = createWalletClient({
account,
chain: baseSepolia,
transport: custom(ethereum),
});
const ctoken = new CTokenClient({
network: "baseSepolia",
publicClient,
walletClient,
});
const ctoken = new CTokenClient({ network: "baseSepolia", publicClient, indexer: true });
const token = "0x036CbD53842c5426634e7929541eC2318f3dCF7e";
const owner = "0x0000000000000000000000000000000000000001";
const wrapper = await ctoken.wrapperOf({ token });
const prices = await ctoken.prices([token]);
const assets = await ctoken.assets({ address: owner });
const history = await ctoken.history({ address: owner, page: 1, limit: 10 });
balanceOf(owner) for another public address.Was this page helpful?