Skip to content

Signature.from

Instantiates a typed Signature.Signature object from a Signature.Signature, Signature.Legacy, Bytes.Bytes, or Hex.Hex.

Imports

Named
import { Signature } from 'ox'

Examples

import { Signature } from 'ox'
 
Signature.from({
  r: 49782753348462494199823712700004552394425719014458918871452329774910450607807n,
  s: 33726695977844476214676913201140481102225469284307016937915595756355928419768n,
  yParity: 1,
})
{
r: 49782753348462494199823712700004552394425719014458918871452329774910450607807n,
s: 33726695977844476214676913201140481102225469284307016937915595756355928419768n,
yParity: 1
}

From Serialized

import { Signature } from 'ox'
 
Signature.from('0x6e100a352ec6ad1b70802290e18aeed190704973570f3b8ed42cb9808e2ea6bf4a90a229a244495b41890987806fcbd2d5d23fc0dbe5f5256c2613c039d76db801')
{
r: 49782753348462494199823712700004552394425719014458918871452329774910450607807n,
s: 33726695977844476214676913201140481102225469284307016937915595756355928419768n,
yParity: 1,
}

From Legacy

import { Signature } from 'ox'
 
Signature.from({
  r: 47323457007453657207889730243826965761922296599680473886588287015755652701072n,
  s: 57228803202727131502949358313456071280488184270258293674242124340113824882788n,
  v: 27,
})
{
r: 47323457007453657207889730243826965761922296599680473886588287015755652701072n,
s: 57228803202727131502949358313456071280488184270258293674242124340113824882788n,
yParity: 0
}

Definition

function from<signature>(
  signature: signature | OneOf<Signature<boolean> | Rpc<boolean> | Legacy | LegacyRpc> | Hex.Hex | Bytes.Bytes,
): from.ReturnType<signature>

Source: src/Signature.ts

Parameters

signature

  • Type: signature | OneOf<Signature<boolean> | Rpc<boolean> | Legacy | LegacyRpc> | Hex.Hex | Bytes.Bytes

The signature value to instantiate.

Return Type

The instantiated Signature.Signature.

from.ReturnType<signature>

Error Type

Signature.from.ErrorType