Signature
A Signature
TODO
Accessors
compactSerialized
The EIP-2098 compact representation.
Returns
string
Source
legacyChainId
The chain ID for EIP-155 legacy transactions. For non-legacy transactions, this value is null
.
Returns
null
| bigint
Source
networkV
The EIP-155 v
for legacy transactions. For non-legacy transactions, this value is null
.
Returns
null
| bigint
Source
r
The r
value for a signautre.
This represents the x
coordinate of a “reference” or challenge point, from which the y
can be computed.
Returns
string
Source
s
The s
value for a signature.
Returns
string
Source
serialized
The serialized representation.
Returns
string
Source
v
The v
value for a signature.
Since a given x
value for r
has two possible values for its correspondin y
, the v
indicates which of the
two y
values to use.
It is normalized to the values 27
or 28
for legacy purposes.
Returns
27
| 28
Source
yParity
The yParity
for the signature.
See v
for more details on how this value is used.
Returns
0
| 1
Source
yParityAndS
The EIP-2098 compact representation of the yParity
and s
compacted
into a single bytes32
.
Returns
string
Source
Methods
clone()
Returns a new identical Signature.
Returns
Source
toJSON()
Returns a representation that is compatible with JSON.stringify
.
Returns
any
Source
from()
Creates a new Signature.
If no sig
is provided, a new Signature is created with default values.
If sig
is a string, it is parsed.
Parameters
Parameter | Type | Description |
---|---|---|
sig ? | SignatureLike | The signature to create. |
Returns
The new signature.
Source
getChainId()
Compute the chain ID from the v
in a legacy EIP-155 transactions.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The v value from the signature. |
Returns
bigint
The chain ID.
Example
Source
getChainIdV()
Compute the v
for a chain ID for a legacy EIP-155 transactions.
Legacy transactions which use EIP-155 hijack the v
property to
include the chain ID.
Parameters
Parameter | Type | Description |
---|---|---|
chainId | BigNumberish | The chain ID. |
v | 27 | 28 | The v value. |
Returns
bigint
The v
value.
Example
Source
getNormalizedV()
Compute the normalized legacy transaction v
from a yParirty
, a legacy transaction v
or a legacy
EIP-155 transaction.
Parameters
Parameter | Type | Description |
---|---|---|
v | BigNumberish | The v value. |
Returns
27
| 28
The normalized v
value.
Example
Throws
Thrown if the v
is invalid.
Source
Was this page helpful?