fromRpcSig static method
Implementation
static ECDSASignature fromRpcSig(String sig) {
Uint8List buf = toBuffer(sig);
// 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 ECDSASignature(
decodeBigInt(Uint8List.view(buf.buffer, 0, 32)),
decodeBigInt(Uint8List.view(buf.buffer, 32, 32)),
v,
);
}