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
| Name | Description |
|---|---|
Attribution.fromData | Extracts an Attribution.Attribution from transaction calldata. |
Attribution.getSchemaId | Determines the schema ID for an Attribution.Attribution. |
Attribution.toDataSuffix | Converts an Attribution.Attribution to a data suffix that can be appended to transaction calldata. |
Types
| Name | Description |
|---|---|
Attribution.Attribution | ERC-8021 Transaction Attribution. |
Attribution.AttributionSchemaId0 | Schema 0: Canonical Registry Attribution. |
Attribution.AttributionSchemaId1 | Schema 1: Custom Registry Attribution. |
Attribution.SchemaId | Attribution schema identifier. |

