Helios API/ API Reference/ Classes/
UplcInt
Primitive equivalent of IntData
.
Implements
Hierarchy
-
↳
UplcInt
Implements
Index
Constructors
constructor
• new UplcInt(site
, value
, signed?
)
Parameters
Name | Type | Description |
---|---|---|
site | Site | |
value | bigint | supposed to be arbitrary precision |
signed? | boolean | unsigned is only for internal use |
Overrides
Properties
signed
• Readonly
signed: boolean
value
• Readonly
value: bigint
Accessors
bool
• get
bool(): boolean
Returns
boolean
Implementation of
Inherited from
UplcValueImpl.bool
bytes
• get
bytes(): number
[]
Returns
number
[]
Implementation of
Inherited from
UplcValueImpl.bytes
data
• get
data(): UplcData
Returns
Implementation of
Inherited from
UplcValueImpl.data
first
• get
first(): UplcValue
Returns
Implementation of
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
int
• get
int(): bigint
Returns
bigint
Implementation of
Inherited from
UplcValueImpl.int
itemType
• get
itemType(): UplcType
Returns
Implementation of
Inherited from
UplcValueImpl.itemType
length
• get
length(): number
Returns
number
Implementation of
Inherited from
UplcValueImpl.length
list
• get
list(): UplcValue
[]
Returns
Implementation of
Inherited from
UplcValueImpl.list
memSize
• get
memSize(): number
Returns
number
Implementation of
second
• get
second(): UplcValue
Returns
Implementation of
Inherited from
UplcValueImpl.second
site
• get
site(): Site
Returns
Implementation of
Inherited from
UplcValueImpl.site
string
• get
string(): string
Returns
string
Implementation of
Inherited from
UplcValueImpl.string
Methods
assertUnit
▸ assertUnit(): UplcUnit
Returns
Implementation of
Inherited from
copy
▸ copy(newSite
): UplcInt
Parameters
Name | Type |
---|---|
newSite | Site |
Returns
Implementation of
isAny
▸ isAny(): boolean
Returns
boolean
Implementation of
Inherited from
isData
▸ isData(): boolean
Returns
boolean
Implementation of
Inherited from
isList
▸ isList(): boolean
Distinguishes a list from a map
Returns
boolean
Implementation of
Inherited from
isPair
▸ isPair(): boolean
Distinguishes a pair from a mapItem
Returns
boolean
Implementation of
Inherited from
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
Name | Type |
---|---|
bitWriter | BitWriter |
Returns
void
Implementation of
Inherited from
toFlatValueInternal
▸ toFlatValueInternal(bitWriter
): void
Encodes value without type header
Parameters
Name | Type |
---|---|
bitWriter | BitWriter |
Returns
void
Implementation of
Inherited from
UplcValueImpl.toFlatValueInternal
toSigned
▸ toSigned(): UplcInt
Unapplies zigzag encoding
Returns
Example
(new UplcInt(Site.dummy(), 1n, false)).toSigned().int == -1n
toUnsigned
▸ toUnsigned(): UplcInt
Applies zigzag encoding
Returns
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
Name | Type |
---|---|
other | TransferUplcAst |
Returns
any
Implementation of
typeBits
▸ typeBits(): string
Returns
string
Implementation of
Inherited from
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
Name | Type |
---|---|
bytes | number [] |
Returns
bigint
new
▸ Static
new(value
): UplcInt
Constructs a UplcInt without requiring a Site
Parameters
Name | Type |
---|---|
value | number | bigint |
Returns
newSignedTerm
▸ Static
newSignedTerm(site
, value
): UplcConst
Creates a UplcInt wrapped in a UplcConst, so it can be used a term
Parameters
Name | Type |
---|---|
site | Site |
value | bigint |
Returns
parseRawByte
▸ Static
parseRawByte(b
): number
Parses a single byte in the Plutus-core byte-list representation of an int
Parameters
Name | Type |
---|---|
b | number |
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
Name | Type |
---|---|
b | number |
Returns
boolean