Signature
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:32
A Signature
@_docloc: api/crypto:Signing
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get _s(): string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:55
Return the s value, unchecked for EIP-2 compliance.
This should generally not be used and is for situations where a non-canonical S value might be relevant, such as Frontier blocks that were mined prior to EIP-2 or invalid Authorization List signatures.
Returns
Section titled “Returns”string
compactSerialized
Section titled “compactSerialized”Get Signature
Section titled “Get Signature”get compactSerialized(): string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:96
The [[link-eip-2098]] compact representation.
Returns
Section titled “Returns”string
legacyChainId
Section titled “legacyChainId”Get Signature
Section titled “Get Signature”get legacyChainId(): null | bigint;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:81
The chain ID for EIP-155 legacy transactions. For non-legacy
transactions, this value is null
.
Returns
Section titled “Returns”null
| bigint
networkV
Section titled “networkV”Get Signature
Section titled “Get Signature”get networkV(): null | bigint;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:76
The EIP-155 v
for legacy transactions. For non-legacy
transactions, this value is null
.
Returns
Section titled “Returns”null
| bigint
Get Signature
Section titled “Get Signature”get r(): string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:40
The r
value for a signature.
This represents the x
coordinate of a “reference” or
challenge point, from which the y
can be computed.
Returns
Section titled “Returns”string
Set Signature
Section titled “Set Signature”set r(value): void;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:41
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
value | BytesLike |
Returns
Section titled “Returns”void
Get Signature
Section titled “Get Signature”get s(): string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:45
The s
value for a signature.
Returns
Section titled “Returns”string
Set Signature
Section titled “Set Signature”set s(_value): void;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:46
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
_value | BytesLike |
Returns
Section titled “Returns”void
serialized
Section titled “serialized”Get Signature
Section titled “Get Signature”get serialized(): string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:100
The serialized representation.
Returns
Section titled “Returns”string
Get Signature
Section titled “Get Signature”get v(): 27 | 28;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:70
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
Section titled “Returns”27
| 28
Set Signature
Section titled “Set Signature”set v(value): void;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:71
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
value | BigNumberish |
Returns
Section titled “Returns”void
yParity
Section titled “yParity”Get Signature
Section titled “Get Signature”get yParity(): 0 | 1;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:87
The yParity
for the signature.
See v
for more details on how this value is used.
Returns
Section titled “Returns”0
| 1
yParityAndS
Section titled “yParityAndS”Get Signature
Section titled “Get Signature”get yParityAndS(): string;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:92
The [[link-eip-2098]] compact representation of the yParity
and s
compacted into a single bytes32
.
Returns
Section titled “Returns”string
Methods
Section titled “Methods”clone()
Section titled “clone()”clone(): Signature;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:108
Returns a new identical [[Signature]].
Returns
Section titled “Returns”Signature
isValid()
Section titled “isValid()”isValid(): boolean;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:59
Returns true if the Signature is valid for [[link-eip-2]] signatures.
Returns
Section titled “Returns”boolean
toJSON()
Section titled “toJSON()”toJSON(): any;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:112
Returns a representation that is compatible with JSON.stringify
.
Returns
Section titled “Returns”any
from()
Section titled “from()”static from(sig?): Signature;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:169
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
Section titled “Parameters”Parameter | Type |
---|---|
sig? | SignatureLike |
Returns
Section titled “Returns”Signature
getChainId()
Section titled “getChainId()”static getChainId(v): bigint;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:123
Compute the chain ID from the v
in a legacy EIP-155 transactions.
@example: Signature.getChainId(45) //_result:
Signature.getChainId(46) //_result:
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
v | BigNumberish |
Returns
Section titled “Returns”bigint
getChainIdV()
Section titled “getChainIdV()”static getChainIdV(chainId, v): bigint;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:138
Compute the v
for a chain ID for a legacy EIP-155 transactions.
Legacy transactions which use [[link-eip-155]] hijack the v
property to include the chain ID.
@example: Signature.getChainIdV(5, 27) //_result:
Signature.getChainIdV(5, 28) //_result:
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
chainId | BigNumberish |
v | 27 | 28 |
Returns
Section titled “Returns”bigint
getNormalizedV()
Section titled “getNormalizedV()”static getNormalizedV(v): 27 | 28;
Defined in: node_modules/.pnpm/ethers@6.15.0/node_modules/ethers/lib.esm/crypto/signature.d.ts:160
Compute the normalized legacy transaction v
from a yParirty
,
a legacy transaction v
or a legacy [[link-eip-155]] transaction.
@example: // The values 0 and 1 imply v is actually yParity Signature.getNormalizedV(0) //_result:
// Legacy non-EIP-1559 transaction (i.e. 27 or 28) Signature.getNormalizedV(27) //_result:
// Legacy EIP-155 transaction (i.e. >= 35) Signature.getNormalizedV(46) //_result:
// Invalid values throw Signature.getNormalizedV(5) //_error:
Parameters
Section titled “Parameters”Parameter | Type |
---|---|
v | BigNumberish |
Returns
Section titled “Returns”27
| 28