Thanks to visit codestin.com
Credit goes to docs.base.org

Skip to main content

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.
1

Support the dataSuffix Capability

Your wallet should accept a dataSuffix object in the capabilities object of wallet_sendCalls.
type DataSuffixCapability = {
  value: `0x${string}`;  // hex-encoded bytes provided by the app
  optional?: boolean;    // whether the capability is optional
}
2

Append Suffix to Calldata

When constructing the transaction or User Operation, extract the dataSuffix and append it to the calldata.
Append to tx.data.
// 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)
  }
}
3

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:
finalSuffix = walletSuffix + appSuffix
This ensures both the app and the wallet receive onchain attribution.