diff --git a/docs/base-chain/quickstart/builder-codes.mdx b/docs/base-chain/quickstart/builder-codes.mdx index 8454326e..277cff0c 100644 --- a/docs/base-chain/quickstart/builder-codes.mdx +++ b/docs/base-chain/quickstart/builder-codes.mdx @@ -17,127 +17,13 @@ Once your app is registered on [Base.dev](http://base.dev/), the Base App will a **Builder Code analytics currently only support Smart Account (AA) transactions.** EOA support is coming soon. Your attribution data is preserved and will appear once EOA support is activated. - - ## For App Developers - -Mini Apps in the Base app will have their builder codes auto-appended to their transactions. -Be sure to [register for Base.dev](https://base.dev/) - - -Integrating Builder Codes requires appending a suffix—provided by Base—to your transaction data. - - - - When you register on [base.dev](https://base.dev/), you will receive a **Builder Code**—a random string (e.g., `k3p9da`) that you'll use to generate your attribution suffix. You can find your code anytime under **Settings** → **Builder Code**. - - - - - The recommended way to attach your suffix is using `wallet_sendCalls` (ERC-5792). This passes the suffix through a capability, allowing the wallet to handle the attachment automatically for both EOA and Smart Account (ERC-4337) users. - - - - Use the `useSendCalls` hook from Wagmi's features to pass the `dataSuffix` capability. - - ```typescript lines highlight={14-16} - import { useSendCalls } from 'wagmi' - import { Attribution } from 'ox/erc8021' - - // Your builder code provided by base.dev - const builderCode = "abcd1234" - const dataSuffix = Attribution.toDataSuffix({ - codes: [builderCode] - }) - - function SendTx() { - const { sendCalls } = useSendCalls() - - async function submit() { - await sendCalls({ - calls: [ - { - to: "0xYourContract", - data: "0xYourCalldata" - } - ], - capabilities: { - dataSuffix: dataSuffix - } - }) - } - return - } - ``` - - - If you are using Viem directly, pass the `dataSuffix` in the `capabilities` object. - - ```typescript lines highlight={11-13} - import { walletClient } from './client' - import { Attribution } from 'ox/erc8021' - - // Your builder code provided by base.dev - const builderCode = "abcd1234" - const dataSuffix = Attribution.toDataSuffix({ - codes: [builderCode] - }) - - await walletClient.sendCalls({ - calls: [ - { - to: "0xYourContract", - data: "0xYourCalldata" - } - ], - capabilities: { - dataSuffix: dataSuffix - } - }) - ``` - - - If you are restricted to `writeContract` (EOA only), you must manually append the suffix to the calldata. This is **not recommended** as it does not support Smart Accounts automatically. - - ```typescript lines highlight={15} - import { encodeFunctionData } from 'viem' - import { Attribution } from 'ox/erc8021' - - // Your builder code provided by base.dev - const builderCode = "abcd1234" - const dataSuffix = Attribution.toDataSuffix({ - codes: [builderCode] - }) - - // 1. Encode your function call - const encoded = encodeFunctionData({ - abi, - functionName: "yourFn", - args: [a, b, c], - }) - - // 2. Manually append the suffix (stripping the '0x' prefix from the suffix) - const dataWithSuffix = encoded + dataSuffix.slice(2) - - // 3. Send the transaction - await sendTransaction({ - to: "0xYourContract", - data: dataWithSuffix, - }) - ``` - - - - - -Once you have added the suffix, your app is fully ERC-8021 compliant. - ---- +Manual appending outside of the Base app is coming soon. ## For Wallet Developers