Skip to content

Attribution

Utility functions for working with ERC-8021 Transaction Attribution.

Examples

Below are some examples demonstrating common usages of the Attribution module:

Converting an Attribution to Data Suffix

import { Attribution } from 'ox/erc8021'
 
const dataSuffix1 = Attribution.toDataSuffix({
  codes: ['baseapp']
})
 
const dataSuffix2 = Attribution.toDataSuffix({
  codes: ['baseapp', 'morpho'],
  codeRegistryAddress: '0x...'
})

Extracting an Attribution from Calldata

import { Attribution } from 'ox/erc8021'
 
const attribution = Attribution.fromData('0x...')
 
console.log(attribution)
{ codes: ['baseapp', 'morpho'], codeRegistryAddress: '0x...' }

Functions

NameDescription
Attribution.fromDataExtracts an Attribution.Attribution from transaction calldata.
Attribution.getSchemaIdDetermines the schema ID for an Attribution.Attribution.
Attribution.toDataSuffixConverts an Attribution.Attribution to a data suffix that can be appended to transaction calldata.

Types

NameDescription
Attribution.AttributionERC-8021 Transaction Attribution.
Attribution.AttributionSchemaId0Schema 0: Canonical Registry Attribution.
Attribution.AttributionSchemaId1Schema 1: Custom Registry Attribution.
Attribution.SchemaIdAttribution schema identifier.