encodeBigInt function
Implementation
Uint8List encodeBigInt(BigInt number) {
if (number == BigInt.zero) {
return Uint8List.fromList([0]);
}
// Convert to bytes removing leading zeros
var result = number.toUint8List();
// Ensure the size is 32 bytes for EIP-712
if (result.length < 32) {
var padded = Uint8List(32);
padded.setAll(32 - result.length, result);
result = padded;
}
return result;
}