Choose your attribution integration
Keep a Builder Code with the client, wallet, or transaction path you already use.
viem
Add a dataSuffix when constructing a transaction. The adapter prepares the request; your app controls signing and submission. Replace the illustrative code with your own registered Builder Code.
import { builderCodeDataSuffix } from "@base-attribution-os/viem";
const dataSuffix = builderCodeDataSuffix("bc_abc123");
await walletClient.sendTransaction({ account, to, value, data: "0x", dataSuffix });wagmi
Use the attribution hook and pass its suffix to your transaction or contract call.
import { useAttributionSuffix } from "@base-attribution-os/wagmi";
const dataSuffix = useAttributionSuffix({ codes: ["bc_abc123"] });
writeContract({ address, abi, functionName: "mint", args: [], dataSuffix });ethers
Wrap the transaction request before sending it through your signer.
import { withEthersAttribution } from "@base-attribution-os/ethers";
await signer.sendTransaction(
withEthersAttribution({ to, value, data: "0x" }, { codes: ["bc_abc123"] }),
);Smart wallets and UserOperations
EIP-5792 batches need capability negotiation before wallet_sendCalls. ERC-4337 middleware appends one suffix to the final userOp.callData. The Smart Wallet Attribution Kit fails closed by default and defines explicit fallback behavior.
import { sendAttributedCalls } from "@base-attribution-os/wallet";
await sendAttributedCalls(provider, request, { codes: ["bc_abc123"] });Privy, RPC, x402, and agents
Doctor recognizes supported attribution patterns around Privy transactions, raw eth_sendTransaction calls, x402 Builder Code extensions, and agent transaction tools. Use the pattern that matches the actual send path. A helper elsewhere in the file does not establish coverage for every call.