Helios API/ API Reference/ Classes/

UplcInt

Primitive equivalent of IntData.

Implements

Hierarchy

Implements

Index

Constructors

constructor

new UplcInt(site, value, signed?)

Parameters

NameTypeDescription
siteSite
valuebigintsupposed to be arbitrary precision
signed?booleanunsigned is only for internal use

Overrides

UplcValueImpl.constructor

Properties

signed

Readonly signed: boolean

value

Readonly value: bigint

Accessors

bool

get bool(): boolean

Returns

boolean

Implementation of

UplcValue.bool

Inherited from

UplcValueImpl.bool

bytes

get bytes(): number[]

Returns

number[]

Implementation of

UplcValue.bytes

Inherited from

UplcValueImpl.bytes

data

get data(): UplcData

Returns

UplcData

Implementation of

UplcValue.data

Inherited from

UplcValueImpl.data

first

get first(): UplcValue

Returns

UplcValue

Implementation of

UplcValue.first

Inherited from

UplcValueImpl.first

flatSize

get flatSize(): number

4 for type, 7 for simple int, (7 + 1)*ceil(n/7) for large int

Returns

number

Implementation of

UplcValue.flatSize

int

get int(): bigint

Returns

bigint

Implementation of

UplcValue.int

Inherited from

UplcValueImpl.int

itemType

get itemType(): UplcType

Returns

UplcType

Implementation of

UplcValue.itemType

Inherited from

UplcValueImpl.itemType

length

get length(): number

Returns

number

Implementation of

UplcValue.length

Inherited from

UplcValueImpl.length

list

get list(): UplcValue[]

Returns

UplcValue[]

Implementation of

UplcValue.list

Inherited from

UplcValueImpl.list

memSize

get memSize(): number

Returns

number

Implementation of

UplcValue.memSize

second

get second(): UplcValue

Returns

UplcValue

Implementation of

UplcValue.second

Inherited from

UplcValueImpl.second

site

get site(): Site

Returns

Site

Implementation of

UplcValue.site

Inherited from

UplcValueImpl.site

string

get string(): string

Returns

string

Implementation of

UplcValue.string

Inherited from

UplcValueImpl.string

Methods

assertUnit

assertUnit(): UplcUnit

Returns

UplcUnit

Implementation of

UplcValue.assertUnit

Inherited from

UplcValueImpl.assertUnit

copy

copy(newSite): UplcInt

Parameters

NameType
newSiteSite

Returns

UplcInt

Implementation of

UplcValue.copy

isAny

isAny(): boolean

Returns

boolean

Implementation of

UplcValue.isAny

Inherited from

UplcValueImpl.isAny

isData

isData(): boolean

Returns

boolean

Implementation of

UplcValue.isData

Inherited from

UplcValueImpl.isData

isList

isList(): boolean

Distinguishes a list from a map

Returns

boolean

Implementation of

UplcValue.isList

Inherited from

UplcValueImpl.isList

isPair

isPair(): boolean

Distinguishes a pair from a mapItem

Returns

boolean

Implementation of

UplcValue.isPair

Inherited from

UplcValueImpl.isPair

toFlatValue

toFlatValue(bitWriter): void

Encodes value with plutus flat encoding. Member function not named 'toFlat' as not to confuse with 'toFlat' member of terms.

Parameters

NameType
bitWriterBitWriter

Returns

void

Implementation of

UplcValue.toFlatValue

Inherited from

UplcValueImpl.toFlatValue

toFlatValueInternal

toFlatValueInternal(bitWriter): void

Encodes value without type header

Parameters

NameType
bitWriterBitWriter

Returns

void

Implementation of

UplcValue.toFlatValueInternal

Inherited from

UplcValueImpl.toFlatValueInternal

toSigned

toSigned(): UplcInt

Unapplies zigzag encoding

Returns

UplcInt

Example

(new UplcInt(Site.dummy(), 1n, false)).toSigned().int == -1n

toUnsigned

toUnsigned(): UplcInt

Applies zigzag encoding

Returns

UplcInt

Example

(new UplcInt(Site.dummy(), -1n, true)).toUnsigned().int == 1n

Example

(new UplcInt(Site.dummy(), -1n, true)).toUnsigned().toSigned().int == -1n

Example

(new UplcInt(Site.dummy(), -2n, true)).toUnsigned().toSigned().int == -2n

Example

(new UplcInt(Site.dummy(), -3n, true)).toUnsigned().toSigned().int == -3n

Example

(new UplcInt(Site.dummy(), -4n, true)).toUnsigned().toSigned().int == -4n

transfer

transfer(other): any

Parameters

NameType
otherTransferUplcAst

Returns

any

Implementation of

UplcValue.transfer

typeBits

typeBits(): string

Returns

string

Implementation of

UplcValue.typeBits

Inherited from

UplcValueImpl.typeBits

bytesToBigInt

Static bytesToBigInt(bytes): bigint

Combines a list of Plutus-core bytes into a bigint (leading bit of each byte is ignored). Differs from bytesToBigInt in utils.js because only 7 bits are used from each byte.

Parameters

NameType
bytesnumber[]

Returns

bigint

new

Static new(value): UplcInt

Constructs a UplcInt without requiring a Site

Parameters

NameType
valuenumber | bigint

Returns

UplcInt

newSignedTerm

Static newSignedTerm(site, value): UplcConst

Creates a UplcInt wrapped in a UplcConst, so it can be used a term

Parameters

NameType
siteSite
valuebigint

Returns

UplcConst

parseRawByte

Static parseRawByte(b): number

Parses a single byte in the Plutus-core byte-list representation of an int

Parameters

NameType
bnumber

Returns

number

rawByteIsLast

Static rawByteIsLast(b): boolean

Returns true if 'b' is the last byte in the Plutus-core byte-list representation of an int.

Parameters

NameType
bnumber

Returns

boolean