EcdaSignature.fromRpcSig constructor
EcdaSignature.fromRpcSig(
- String sig
Implementation
factory EcdaSignature.fromRpcSig(String sig) {
Uint8List buf = sig.toUint8List();
// NOTE: with potential introduction of chainId this might need to be updated
if (buf.length != 65) {
throw ArgumentError('Invalid signature length');
}
var v = buf[64];
// support both versions of `eth_sign` responses
if (v < 27) {
v += 27;
}
return EcdaSignature(
buf.sublist(0, 32),
buf.sublist(32, 64),
v,
);
}