Loading...
Loading...
Integrate Base Builder Codes (ERC-8021) into web3 applications for onchain transaction attribution and referral fee earning. Use when a project needs to append a builder code or dataSuffix to transactions on Base L2, whether using Wagmi, Viem, Privy, ethers.js, or raw window.ethereum. Covers phrases like "add builder codes", "integrate builder codes", "earn referral fees on Base transactions", "append a builder code to my transactions", "transaction attribution", "Builder Code integration", or "attribute transactions to my app". Handles project analysis to detect frameworks, locating transaction call sites, and replacing them with attributed versions.
npx skill4agent add base/skills adding-builder-codesoxnpm install oxBuilder Codes Integration:
- [ ] Step 1: Detect framework (Required First Step)
- [ ] Step 2: Install dependencies
- [ ] Step 3: Generate the dataSuffix constant
- [ ] Step 4: Apply attribution (framework-specific)
- [ ] Step 5: Verify attribution is working# Check for framework dependencies
grep -E "wagmi|@privy-io/react-auth|viem|ethers" package.json
# Check for smart wallet / account abstraction usage
grep -rn "useSendCalls\|sendCalls\|ERC-4337\|useSmartWallets" src/
# Check for EOA transaction patterns
grep -rn "useSendTransaction\|sendTransaction\|writeContract\|useWriteContract" src/
# Check Privy version if present
grep "@privy-io/react-auth" package.json| Framework | Detection Signal |
|---|---|
| |
| |
| |
| |
"I detected you are using [Framework]. I'll implement builder codes using the [Framework] approach — does that sound right?"
@privy-io/react-authwindow.ethereumnpm install oxviem >= 2.45.0@privy-io/react-auth >= 3.13.0src/lib/attribution.tssrc/constants/builderCode.tsimport { Attribution } from "ox/erc8021";
export const DATA_SUFFIX = Attribution.toDataSuffix({
codes: ["YOUR-BUILDER-CODE"], // Replace with your code from base.dev
});dataSuffixdataSuffixDATA_SUFFIXwindow.ethereumsendCallscapabilities8021dataSuffixdataSuffix@privy-io/wagmi# React hooks (Wagmi)
grep -rn "useSendTransaction\|useSendCalls\|useWriteContract\|useContractWrite" src/
# Viem client calls
grep -rn "sendTransaction\|writeContract\|sendRawTransaction" src/
# Privy embedded wallet calls
grep -rn "sendTransaction\|signTransaction" src/
# ethers.js
grep -rn "signer\.sendTransaction\|contract\.connect" src/
# Raw window.ethereum
grep -rn "window\.ethereum\|eth_sendTransaction" src/