Skip to content

Authorization.fromTuple

Converts an Authorization.Tuple to an Authorization.Authorization.

Imports

Named
import { Authorization } from 'ox'

Examples

import { Authorization } from 'ox'
 
const authorization = Authorization.fromTuple([
  '0x1',
  '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
  '0x3'
])
{
address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
chainId: 1,
nonce: 3n
}

It is also possible to append a Signature tuple to the end of an Authorization tuple.

import { Authorization } from 'ox'
 
const authorization = Authorization.fromTuple([
  '0x1',
  '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
  '0x3',
  '0x1',
  '0x68a020a209d3d56c46f38cc50a33f704f4a9a10a59377f8dd762ac66910e9b90',
  '0x7e865ad05c4035ab5792787d4a0297a43617ae897930a6fe4d822b8faea52064',
])
{
address: '0xbe95c3f554e9fc85ec51be69a3d807a0d55bcf2c',
chainId: 1,
nonce: 3n
r: BigInt('0x68a020a209d3d56c46f38cc50a33f704f4a9a10a59377f8dd762ac66910e9b90'),
s: BigInt('0x7e865ad05c4035ab5792787d4a0297a43617ae897930a6fe4d822b8faea52064'),
yParity: 0,
}

Definition

function fromTuple<tuple>(
  tuple: tuple,
): fromTuple.ReturnType<tuple>

Source: src/Authorization.ts

Parameters

tuple

  • Type: tuple

The EIP-7702 Authorization tuple.

Return Type

The Authorization.Authorization.

fromTuple.ReturnType<tuple>