Made Signatures more flexible for input.
This commit is contained in:
parent
a67e3d1d65
commit
a062f75d38
@ -248,6 +248,9 @@ export function splitSignature(signature: Arrayish | Signature): Signature {
|
||||
let r = '0x', s = '0x';
|
||||
|
||||
if (isSignature(signature)) {
|
||||
if (signature.v == null && signature.recoveryParam == null) {
|
||||
errors.throwError('at least on of recoveryParam or v must be specified', errors.INVALID_ARGUMENT, { argument: 'signature', value: signature });
|
||||
}
|
||||
r = hexZeroPad(signature.r, 32);
|
||||
s = hexZeroPad(signature.s, 32);
|
||||
|
||||
|
@ -65,7 +65,9 @@ export type SupportedAlgorithms = 'sha256' | 'sha512';
|
||||
export interface Signature {
|
||||
r: string;
|
||||
s: string;
|
||||
recoveryParam: number;
|
||||
|
||||
/* At least one of the following MUST be specified; the other will be derived */
|
||||
recoveryParam?: number;
|
||||
v?: number;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user