Skip to content

KeyAuthorization.serialize

Serializes a KeyAuthorization.KeyAuthorization to RLP-encoded hex.

Imports

Named
import { KeyAuthorization } from 'ox/tempo'

Examples

import { KeyAuthorization } from 'ox/tempo'
import { Value } from 'ox'
 
const authorization = KeyAuthorization.from({
  address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
  chainId: 4217n,
  expiry: 1234567890,
  type: 'secp256k1',
  limits: [{
    token: '0x20c0000000000000000000000000000000000001',
    limit: Value.from('10', 6)
  }],
})
 
const serialized = KeyAuthorization.serialize(authorization)

Definition

function serialize(
  authorization: KeyAuthorization.KeyAuthorization,
): Hex.Hex

Source: src/tempo/KeyAuthorization.ts

Parameters

authorization

  • Type: KeyAuthorization.KeyAuthorization

The KeyAuthorization.KeyAuthorization.

authorization.address

  • Type: abitype_Address

Address derived from the public key of the key type.

authorization.chainId

  • Type: bigintType

Chain ID for replay protection.

authorization.expiry

  • Type: numberType
  • Optional

Unix timestamp when key expires (0 = never expires).

authorization.limits

  • Type: readonly TokenLimit[]
  • Optional

TIP20 spending limits for this key.

authorization.signature

  • Type: SignatureEnvelope
  • Optional

authorization.type

  • Type: "secp256k1" | "p256" | "webAuthn"

Key type. (secp256k1, P256, WebAuthn).

Return Type

The RLP-encoded Key Authorization.

Hex.Hex