Skip to content

KeyAuthorization.hash

Computes the hash for an KeyAuthorization.KeyAuthorization.

Imports

Named
import { KeyAuthorization } from 'ox/tempo'

Examples

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

Definition

function hash(
  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
  • Optional

Chain ID for replay protection (0 = valid on any chain).

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 hash.

Hex.Hex