# Attribution.toDataSuffix

Converts an [`Attribution.Attribution`](/ercs/erc8021/Attribution/types#attribution) to a data suffix that can be appended to transaction calldata.

## Imports

:::code-group
```ts [Named]
import { Attribution } from 'ox/erc8021'
```

```ts [Entrypoint]
import * as Attribution from 'ox/erc8021/Attribution'
```
:::

## Examples

### Schema 0 (Canonical Registry)

```ts twoslash
import { Attribution } from 'ox/erc8021'

const suffix = Attribution.toDataSuffix({
  codes: ['baseapp', 'morpho']
})
// @log: '0x626173656170702c6d6f7270686f0e0080218021802180218021802180218021'
```

### Schema 1 (Custom Registry)

```ts twoslash
import { Attribution } from 'ox/erc8021'

const suffix = Attribution.toDataSuffix({
  codes: ['baseapp'],
  codeRegistry: {
    address: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
    chainId: 8453
  }
})
```

### Schema 2 (CBOR-Encoded)

```ts twoslash
import { Attribution } from 'ox/erc8021'

const suffix = Attribution.toDataSuffix({
  appCode: 'baseapp',
  walletCode: 'privy',
  metadata: { source: 'webapp' }
})
```

## Definition

```ts
function toDataSuffix(
  attribution: Attribution.Attribution,
): Hex.Hex
```

**Source:** [src/erc8021/Attribution.ts](https://github.com/wevm/ox/blob/main/src/erc8021/Attribution.ts#L517)

## Parameters

### attribution

* **Type:** [`Attribution.Attribution`](/ercs/erc8021/Attribution/types#attributionattribution)

The attribution to convert.

#### attribution.appCode

* **Type:** `string`
* **Optional**

Application attribution code.

#### attribution.codeRegistry

* **Type:** `AttributionSchemaId1Registry`

#### attribution.codes

* **Type:** `readonly string[]`

Attribution codes identifying entities involved in the transaction.

#### attribution.id

* **Type:** `2`
* **Optional**

Schema identifier (2 for CBOR-encoded).

#### attribution.metadata

* **Type:** `Record`
* **Optional**

Arbitrary metadata key-value pairs.

#### attribution.registries

* **Type:** `AttributionSchemaId2Registries`
* **Optional**

Custom code registries keyed by entity type.

#### attribution.serviceCodes

* **Type:** `readonly string[]`
* **Optional**

Service codes identifying additional service providers (e.g., block builders, relayers, solvers).

#### attribution.walletCode

* **Type:** `string`
* **Optional**

Wallet attribution code.

## Return Type

The data suffix as a [`Hex.Hex`](/api/Hex/types#hex) value.

`Hex.Hex`
