Skip to content

feat: Add ERC-8021 schema 2 support#191

Open
dgca wants to merge 2 commits intowevm:mainfrom
dgca:danc/erc-8021-schema-2-support
Open

feat: Add ERC-8021 schema 2 support#191
dgca wants to merge 2 commits intowevm:mainfrom
dgca:danc/erc-8021-schema-2-support

Conversation

@dgca
Copy link

@dgca dgca commented Mar 12, 2026

Adds ERC-8021 Schema 2 (CBOR-encoded) attribution support to the Attribution module. This enables extensible transaction annotation with optional fields for app codes, wallet codes, custom registries, and arbitrary metadata.

Design choices that could use a second look:

  • The public API uses descriptive field names (appCode, walletCode, registries, metadata) rather than the single-letter CBOR keys (a, w, r, m) from the spec. I decided to use "registries" instead of "codeRegistries" (which would align with schema 1's codeRegistry field) so the field names match the single-letter CBOR fields.
  • I created a new AttributionSchemaId2Registry type even though it's the same as AttributionSchemaId1Registry to avoid confusion (e.g. SchemaId2 field using SchemaId1 type).

Example usage:

const schema2Suffix = Attribution.toDataSuffix({
  appCode: 'baseapp',
  walletCode: 'privy',
});

console.log(schema2Suffix); // 0xa261616762617365617070617765707269767900130280218021802180218021802180218021

const schema2Parsed = Attribution.fromData(schema2Suffix);

console.log(schema2Parsed); // { appCode: 'baseapp', walletCode: 'privy' }

@vercel
Copy link

vercel bot commented Mar 12, 2026

@dgca is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@dgca dgca marked this pull request as ready for review March 12, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant