Attribution.fromData
Extracts an Attribution.Attribution
from transaction calldata.
Imports
Named
import { Attribution } from 'ox/erc8021'
Examples
Schema 0 (Canonical Registry)
import { Attribution } from 'ox/erc8021'
const attribution = Attribution.fromData(
'0xdddddddd62617365617070070080218021802180218021802180218021'
)
{ codes: ['baseapp'], id: 0 }
Schema 1 (Custom Registry)
import { Attribution } from 'ox/erc8021'
const attribution = Attribution.fromData(
'0xddddddddcccccccccccccccccccccccccccccccccccccccc626173656170702c6d6f7270686f0e0180218021802180218021802180218021'
)
{ codes: ['baseapp', 'morpho'], codeRegistryAddress: '0xcccccccccccccccccccccccccccccccccccccccc', id: 1 }
Definition
function fromData(
data: Hex.Hex,
): Attribution | undefined
Source: src/erc8021/Attribution.ts
Parameters
data
- Type:
Hex.Hex
The transaction calldata containing the attribution suffix.
Return Type
The extracted attribution, or undefined if no valid attribution is found.