Documentation
¶
Index ¶
- func AsUnsigned(v *big.Int, sz uint) *big.Int
- func LoadFromCell(v any, loader *cell.Slice, skipMagic ...bool) error
- func ToCell(v any) (*cell.Cell, error)
- type BigUint
- type Cell
- type Dict
- func (d Dict[K, V]) AsDictionary() (*cell.Dictionary, error)
- func (d *Dict[K, V]) AsMap() map[K]V
- func (d *Dict[K, V]) Delete(key K)
- func (d *Dict[K, V]) Get(key K) (V, bool)
- func (d Dict[K, V]) Len() int
- func (d *Dict[K, V]) LoadFromCell(slice *cell.Slice) error
- func (d *Dict[K, V]) LoadFromDictionary(dict *cell.Dictionary) error
- func (d Dict[K, V]) MarshalJSON() ([]byte, error)
- func (d *Dict[K, V]) Set(key K, value V)
- func (d Dict[K, V]) ToCell() (*cell.Cell, error)
- func (d *Dict[K, V]) UnmarshalJSON(data []byte) error
- type DictKey
- type InternalMessageHeader
- type Uint160
- type Uint256
- func (*Uint256) BitsLen() uint
- func (x *Uint256) Cmp(y *Uint256) (r int)
- func (x *Uint256) LoadFromCell(loader *cell.Slice) error
- func (x *Uint256) MarshalJSON() ([]byte, error)
- func (x Uint256) String() string
- func (x Uint256) ToCell() (*cell.Cell, error)
- func (x *Uint256) UnmarshalJSON(data []byte) error
- func (x Uint256) Value() *big.Int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsUnsigned ¶
AsUnsigned interprets the given big.Int as an unsigned integer of size sz bits.
This is useful for masking sign bits when dealing with fixed-width unsigned integers. For example, a 160-bit unsigned integer with the high bit set would be interpreted as a negative number in big.Int, so we mask it to get the correct unsigned value.
func LoadFromCell ¶
LoadFromCell is a helper that decodes basic types directly, and falls back to tlb.LoadFromCell for others.
Types ¶
type Cell ¶
Cell is a generic wrapper around cell.Cell, adds underlying type information T.
func ManyCellsFrom ¶
ManyCellsFrom creates multiple Cell[T] from a slice of values of type T.
func NewCellFrom ¶
NewCellFrom creates a new Cell[T] from a value of type T.
The type parameter T must be a value type, not a pointer type. For example, use Cell[tlb.InternalMessage], not Cell[tlb.InternalMessage].
func (*Cell[T]) LoadFromCell ¶
LoadFromCell implements the tlb.Unmarshaller interface
func (*Cell[T]) MarshalJSON ¶
func (*Cell[T]) MustToCell ¶
func (*Cell[T]) ToValue ¶
ToValue converts the cell back to its original value type T.
If T is a pointer type, this will fail because tlb.LoadFromCell requires a pointer to a value type, not a pointer to a pointer.
func (*Cell[T]) UnmarshalJSON ¶
type Dict ¶
type Dict[K comparable, V any] struct { // contains filtered or unexported fields }
func NewDict ¶
func NewDict[K comparable, V any](entries map[K]V) *Dict[K, V]
func NewDictFromDictionary ¶
func NewDictFromDictionary[K comparable, V any](dict *cell.Dictionary) (*Dict[K, V], error)
func NewDictFromSlice ¶
func NewEmptyDict ¶
func NewEmptyDict[K comparable, V any]() *Dict[K, V]
func (Dict[K, V]) AsDictionary ¶
func (d Dict[K, V]) AsDictionary() (*cell.Dictionary, error)
func (*Dict[K, V]) LoadFromDictionary ¶
func (d *Dict[K, V]) LoadFromDictionary(dict *cell.Dictionary) error
func (Dict[K, V]) MarshalJSON ¶
MarshalJSON implements the encoding/json.Marshaler interface, serializing the dictionary as an array of key-value pairs.
func (*Dict[K, V]) UnmarshalJSON ¶
UnmarshalJSON implements the encoding/json.Unmarshaler interface, deserializing the dictionary from an array of key-value pairs.
type InternalMessageHeader ¶
type InternalMessageHeader struct {
IHRDisabled bool `tlb:"bool"`
Bounce bool `tlb:"bool"`
Bounced bool `tlb:"bool"`
SrcAddr *address.Address `tlb:"addr"`
DstAddr *address.Address `tlb:"addr"`
Amount tlb.Coins `tlb:"."`
// contains filtered or unexported fields
}
InternalMessageHeader is a helper struct to read internal message header (subset of fields).
type Uint160 ¶
Uint160 is a 160-bit unsigned integer wrapper.
func NewUint160 ¶
func (*Uint160) LoadFromCell ¶
LoadFromCell implements tlb.Unmarshaler.
func (*Uint160) MarshalJSON ¶
func (*Uint160) UnmarshalJSON ¶
UnmarshalJSON implements the encoding/json.Unmarshaler interface.
type Uint256 ¶
Uint256 is a 256-bit unsigned integer wrapper.
func NewUint256 ¶
func (*Uint256) LoadFromCell ¶
LoadFromCell implements tlb.Unmarshaler.
func (*Uint256) MarshalJSON ¶
func (*Uint256) UnmarshalJSON ¶
UnmarshalJSON implements the encoding/json.Unmarshaler interface.