Skip to main content

Integers

o1js exports a few different integer types:

  • Unsigned integers: UInt8, UInt32, UInt64
  • Signed integers: Int64

These types have range checks built in so that they will throw on overflow or underflow.

const uint8 = new UInt8(1n);
const uint32 = new UInt32(2 ** 32 - 1);
const uint64 = new UInt64("10");
const int64 = Int64.create(uint64, Sign.minusOne);
const alternative_int64 = Int64.from(20);

Read more at the language reference: UInt8, UInt32, UInt64, Int64 (TODO: Broken).