Evolution SDK

BigInt.ts

BigInt overview


Table of contents


constructors

bigNInt

Creates a big negative integer from bytes

Signature

export declare const bigNInt: (bytes: Uint8Array) => BigInt

Added in v2.0.0

bigUInt

Creates a big unsigned integer from bytes

Signature

export declare const bigUInt: (bytes: Uint8Array) => BigInt

Added in v2.0.0

int

Creates an integer value

Signature

export declare const int: (value: number) => BigInt

Added in v2.0.0

model

BigInt (type alias)

Type alias for BigInt.

Signature

export type BigInt = typeof BigIntSchema.Type

Added in v2.0.0

BigNInt (type alias)

Type alias for BigNInt.

Signature

export type BigNInt = typeof BigNIntSchema.Type

Added in v2.0.0

BigUInt (type alias)

Type alias for BigUInt.

Signature

export type BigUInt = typeof BigUIntSchema.Type

Added in v2.0.0

schemas

BigIntSchema

BigInt schema based on Conway CDDL specification

CDDL: big_int = int/ big_uint/ big_nint

Signature

export declare const BigIntSchema: Schema.Union<
  [
    Schema.TaggedStruct<"Int", { value: typeof Schema.Number }>,
    Schema.TaggedStruct<"BigUInt", { bytes: typeof Schema.Uint8ArrayFromSelf }>,
    Schema.TaggedStruct<"BigNInt", { bytes: typeof Schema.Uint8ArrayFromSelf }>
  ]
>

Added in v2.0.0

BigNIntSchema

BigNInt schema based on Conway CDDL specification

CDDL: big_nint = #6.3(bounded_bytes)

Signature

export declare const BigNIntSchema: Schema.TaggedStruct<"BigNInt", { bytes: typeof Schema.Uint8ArrayFromSelf }>

Added in v2.0.0

BigUIntSchema

BigUInt schema based on Conway CDDL specification

CDDL: big_uint = #6.2(bounded_bytes)

Signature

export declare const BigUIntSchema: Schema.TaggedStruct<"BigUInt", { bytes: typeof Schema.Uint8ArrayFromSelf }>

Added in v2.0.0

utilities

match

Pattern matching helper for BigInt types

Signature

export declare const match: <T>(
  bigInt: BigInt,
  cases: { Int: (value: number) => T; BigUInt: (bytes: Uint8Array) => T; BigNInt: (bytes: Uint8Array) => T }
) => T

Added in v2.0.0