ThorSignature.fromBytes constructor

ThorSignature.fromBytes(
  1. Uint8List sigBytes
)

Initiate a signature from 65 bytes.

Implementation

ThorSignature.fromBytes(
  Uint8List sigBytes,
) {
  if (sigBytes.length != 65) {
    throw Exception("signature bytes shall be 65 length.");
  }

  BigInt r = bytesToInt(sigBytes.sublist(0, 32));
  BigInt s = bytesToInt(sigBytes.sublist(32, 64));

  //FIXME: add 27 or not? Have to look into this
  var v = sigBytes[64] + 27;
  signature = w3d.MsgSignature(r, s, v);
}