> ## Documentation Index
> Fetch the complete documentation index at: https://docs.base.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Builder Codes for Wallet Developers

> Implement the dataSuffix capability in your wallet to enable Builder Code attribution.

## Overview

Wallet providers need to support the `dataSuffix` capability to enable attribution. This involves accepting the capability and appending the suffix to the calldata before signing.

<Steps>
  <Step title="Support the dataSuffix Capability">
    Your wallet should accept a `dataSuffix` object in the `capabilities` object of `wallet_sendCalls`.

    ```typescript theme={null}
    type DataSuffixCapability = {
      value: `0x${string}`;  // hex-encoded bytes provided by the app
      optional?: boolean;    // whether the capability is optional
    }
    ```
  </Step>

  <Step title="Append Suffix to Calldata">
    When constructing the transaction or User Operation, extract the `dataSuffix` and append it to the calldata.

    <Tabs>
      <Tab title="EOA Transactions">
        Append to `tx.data`.

        ```typescript theme={null}
        // Minimal example for EOA
        function applySuffixToEOA(tx, capabilities) {
          const suffix = capabilities.dataSuffix?.value
          if (!suffix) return tx

          return {
            ...tx,
            // Append suffix bytes (remove 0x prefix from suffix if tx.data has it)
            data: tx.data + suffix.slice(2)
          }
        }
        ```
      </Tab>

      <Tab title="ERC-4337 User Operations">
        Append to `userOp.callData` (not the transaction-level calldata).

        ```typescript theme={null}
        // Minimal example for ERC-4337
        function applySuffixToUserOp(userOp, capabilities) {
          const suffix = capabilities.dataSuffix?.value
          if (!suffix) return userOp

          return {
            ...userOp,
            // Append suffix bytes to the UserOp callData
            callData: userOp.callData + suffix.slice(2)
          }
        }
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Add Wallet Attribution (Optional)">
    Wallets may also include their own attribution code (their own ERC-8021 suffix) by prepending the wallet's suffix before the app's.

    * **No interaction required with apps:** The wallet handles this independently.
    * **Multi-code support:** ERC-8021 natively supports multiple attribution codes.

    **Example:**

    ```typescript theme={null}
    finalSuffix = walletSuffix + appSuffix
    ```

    This ensures both the app and the wallet receive onchain attribution.
  </Step>
</Steps>
