ton3-core / Builder
Cell Builder
- storeSlice
- storeRef
- storeMaybeRef
- storeRefs
- storeBit
- storeBits
- storeInt
- storeUint
- storeVarInt
- storeVarUint
- storeBytes
- storeString
- storeAddress
- storeCoins
- storeDict
- clone
- cell
• new Builder(size?
)
Name | Type | Default value |
---|---|---|
size |
number |
1023 |
• get
size(): number
Returns instance maximum allowed size in bits.
readonly
number
• get
bits(): Bit
[]
Returns instance stored bits Bit.
readonly
Bit
[]
• get
bytes(): Uint8Array
Returns instance stored bits in bytes.
readonly
Uint8Array
• get
refs(): Cell
[]
Returns instance stored refs Cell.
readonly
Cell
[]
• get
remainder(): number
Returns instance unused space in bits.
readonly
number
▸ storeSlice(slice
): Builder
Merge Slice into instance.
Name | Type | Description |
---|---|---|
slice |
Slice |
An instance of a Slice. |
▸ storeRef(ref
): Builder
Add cell to instance refs.
Name | Type | Description |
---|---|---|
ref |
Cell |
Cell to reference. |
▸ storeMaybeRef(ref
): Builder
Add unary one bit and cell to instance refs or unary zero bit.
Name | Type | Description |
---|---|---|
ref |
Cell |
Cell or null to reference. |
▸ storeRefs(refs
): Builder
Add multiple cells to instance refs.
Name | Type | Description |
---|---|---|
refs |
Cell [] |
Array of Cell to reference. |
▸ storeBit(bit
): Builder
Store one bit in instance.
Name | Type | Description |
---|---|---|
bit |
BitLike |
1 or 0. |
▸ storeBits(bits
): Builder
Store multiple bits as array in instance.
Name | Type | Description |
---|---|---|
bits |
BitLike [] |
Array of 1 and/or 0. |
▸ storeInt(value
, size
): Builder
Store an integer in instance.
Name | Type | Description |
---|---|---|
value |
number | bigint |
Int. |
size |
number |
Size in bits of allocated space for value. |
▸ storeUint(value
, size
): Builder
Store an unsigned integer in instance.
Name | Type | Description |
---|---|---|
value |
number | bigint |
UInt. |
size |
number |
Size in bits of allocated space for value. |
▸ storeVarInt(value
, length
): Builder
Name | Type |
---|---|
value |
number | bigint |
length |
number |
▸ storeVarUint(value
, length
): Builder
Name | Type |
---|---|
value |
number | bigint |
length |
number |
▸ storeBytes(value
): Builder
Store a bytes array in instance.
Name | Type | Description |
---|---|---|
value |
Uint8Array | number [] |
Array of bytes. |
▸ storeString(value
): Builder
Store a string in instance.
Name | Type | Description |
---|---|---|
value |
string |
Any string, Unicode is suppported. |
▸ storeAddress(address
): Builder
Store an Address in instance.
Name | Type | Description |
---|---|---|
address |
Address |
Smart contract address as Address or as null. |
▸ storeCoins(coins
): Builder
Store a Coins in instance.
Name | Type | Description |
---|---|---|
coins |
Coins |
Toncoin as Coins. |
▸ storeDict(hashmap
): Builder
Store a HashmapE in instance.
Name | Type | Description |
---|---|---|
hashmap |
HashmapE <any , any > |
HashmapE. |
▸ clone(): Builder
Returns this instance copy as a new instance.
▸ cell(type?
): Cell
Returns builded Cell.
example
import { Builder } from 'ton3-core'
const bits = [ 1, 0, 0, 1 ]
const cell = new Builder(bits.length)
.storeBits(bits)
.cell()
Name | Type | Default value |
---|---|---|
type |
CellType |
CellType.Ordinary |