parser

package
v1.22.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ABI

type ABI struct {
	Namespace        string             `json:"namespace"`
	ContractName     string             `json:"contractName"`
	InheritsContract string             `json:"inheritsContract,omitempty"`
	Author           string             `json:"author,omitempty"`
	Version          string             `json:"version,omitempty"`
	Description      string             `json:"description,omitempty"`
	Declarations     []Declaration      `json:"declarations"`
	IncomingMessages []IncomingMessage  `json:"incomingMessages"`
	IncomingExternal []IncomingExternal `json:"incomingExternal"`
	OutgoingMessages []OutgoingMessage  `json:"outgoingMessages"`
	EmittedMessages  []OutgoingMessage  `json:"emittedEvents"`
	GetMethods       []GetMethod        `json:"getMethods"`
	ThrownErrors     []ThrownError      `json:"thrownErrors"`
	Storage          Storage            `json:"storage,omitempty"`
	CompilerName     string             `json:"compilerName"`
	CompilerVersion  string             `json:"compilerVersion"`
	CodeBoc64        string             `json:"codeBoc64"`
	CodeHashes       []string           `json:"codeHashes,omitempty"`
}

func MustParseABI

func MustParseABI(data []byte) ABI

func (*ABI) GetGolangContractName

func (a *ABI) GetGolangContractName() string

func (*ABI) GetGolangNamespace

func (a *ABI) GetGolangNamespace() string

type ABICustomSerializers added in v1.22.0

type ABICustomSerializers struct {
	PackToBuilder   bool `json:"packToBuilder"`
	UnpackFromSlice bool `json:"unpackFromSlice"`
}

type AliasDeclaration

type AliasDeclaration struct {
	Name             string               `json:"name"`
	TargetTy         Ty                   `json:"targetTy"`
	TypeParams       []string             `json:"typeParams,omitempty"`
	CustomPackUnpack ABICustomSerializers `json:"customPackUnpack"`
}

type AliasRef

type AliasRef struct {
	AliasName string `json:"aliasName"`
	TypeArgs  []Ty   `json:"typeArgs,omitempty"`
}

type ArrayOf added in v1.22.0

type ArrayOf struct {
	Inner Ty `json:"inner"`
}

type BitsN

type BitsN struct {
	N int `json:"n"`
}

type CellOf

type CellOf struct {
	Inner Ty `json:"inner"`
}

type Declaration

type Declaration struct {
	SumType           DeclarationKind `json:"kind"`
	PayloadType       *string         `json:"payloadType,omitempty"` // todo: think abt naming
	StructDeclaration StructDeclaration
	AliasDeclaration  AliasDeclaration
	EnumDeclaration   EnumDeclaration
}

func (Declaration) MarshalJSON

func (d Declaration) MarshalJSON() ([]byte, error)

func (*Declaration) UnmarshalJSON

func (d *Declaration) UnmarshalJSON(b []byte) error

type DeclarationKind added in v1.22.0

type DeclarationKind string
const (
	DeclarationKindStruct DeclarationKind = "Struct"
	DeclarationKindAlias  DeclarationKind = "Alias"
	DeclarationKindEnum   DeclarationKind = "Enum"
)

type DefaultValue

type DefaultValue struct {
	SumType         string `json:"kind"`
	IntDefaultValue struct {
		V string `json:"v"`
	}
	BoolDefaultValue struct {
		V bool `json:"v"`
	}
	SliceDefaultValue struct {
		Hex string `json:"hex"`
	}
	AddressDefaultValue struct {
		Address string `json:"addr"`
	}
	TensorDefaultValue struct {
		Items []DefaultValue `json:"items"`
	}
	NullDefaultValue struct{}
}

func (*DefaultValue) MarshalJSON

func (d *DefaultValue) MarshalJSON() ([]byte, error)

func (*DefaultValue) UnmarshalJSON

func (d *DefaultValue) UnmarshalJSON(b []byte) error

type EnumDeclaration

type EnumDeclaration struct {
	Name             string               `json:"name"`
	EncodedAs        Ty                   `json:"encodedAs"`
	Members          []EnumMember         `json:"members"`
	CustomPackUnpack ABICustomSerializers `json:"customPackUnpack"`
}

type EnumMember

type EnumMember struct {
	Name string `json:"name"`
	// Value is a number string
	Value string `json:"value"`
}

type EnumRef

type EnumRef struct {
	EnumName string `json:"enumName"`
}

type Field

type Field struct {
	Name string `json:"name"`
	//IsPayload    *bool         `json:"isPayload,omitempty"` not in
	Ty Ty `json:"ty"`
	//DefaultValue *DefaultValue `json:"defaultValue,omitempty"`
	Description string `json:"description,omitempty"`
}

type Generic

type Generic struct {
	NameT string `json:"nameT"`
}

type GetMethod

type GetMethod struct {
	TvmMethodID int         `json:"tvmMethodId"`
	Name        string      `json:"name"`
	Parameters  []Parameter `json:"parameters"`
	ReturnTy    Ty          `json:"returnTy"`
	Description string      `json:"description,omitempty"`
}

func (GetMethod) FullResultName

func (g GetMethod) FullResultName(contractName string) string

func (GetMethod) GolangFunctionName

func (g GetMethod) GolangFunctionName() string

func (GetMethod) UsedByIntrospection

func (g GetMethod) UsedByIntrospection() bool

type IncomingExternal

type IncomingExternal struct {
	BodyTy      Ty     `json:"bodyTy"`
	Description string `json:"description,omitempty"`
}

func (*IncomingExternal) GetMsgName

func (m *IncomingExternal) GetMsgName() (string, error)

type IncomingMessage

type IncomingMessage struct {
	BodyTy            Ty       `json:"bodyTy"`
	MinimalMsgValue   *big.Int `json:"minimalMsgValue,omitempty"`
	Description       string   `json:"description,omitempty"`
	PreferredSendMode int16    `json:"preferredSendMode,omitempty"`
}

func (*IncomingMessage) GetMsgName

func (m *IncomingMessage) GetMsgName() (string, error)

type IntN

type IntN struct {
	N int `json:"n"`
}

type Kind

type Kind struct {
	Kind string `json:"kind"`
}

type LispListOf added in v1.22.0

type LispListOf struct {
	Inner Ty `json:"inner"`
}

type MapKV added in v1.22.0

type MapKV struct {
	K Ty `json:"k"`
	V Ty `json:"v"`
}

type Nullable

type Nullable struct {
	Inner       Ty  `json:"inner"`
	StackTypeId int `json:"stackTypeId,omitempty"`
	StackWidth  int `json:"stackWidth,omitempty"`
}

type OutgoingMessage

type OutgoingMessage struct {
	BodyTy      Ty     `json:"bodyTy"`
	Description string `json:"description,omitempty"`
}

func (*OutgoingMessage) GetMsgName

func (m *OutgoingMessage) GetMsgName() (string, error)

type Parameter

type Parameter struct {
	Name string `json:"name"`
	Ty   Ty     `json:"ty"`
}

type Prefix

type Prefix struct {
	PrefixStr string `json:"prefixStr"`
	PrefixLen int    `json:"prefixLen"`
}

type ShapedTuple added in v1.22.0

type ShapedTuple struct {
	Items []Ty `json:"items"`
}

type Storage added in v1.22.0

type Storage struct {
	StorageTy *Ty `json:"storageTy,omitempty"`
}

Storage describes the on-chain persistent storage layout of a contract.

type String added in v1.22.0

type String struct{}

type StructDeclaration

type StructDeclaration struct {
	Name             string               `json:"name"`
	TypeParams       []string             `json:"typeParams,omitempty"`
	Prefix           *Prefix              `json:"prefix,omitempty"`
	Fields           []Field              `json:"fields"`
	CustomPackUnpack ABICustomSerializers `json:"customPackUnpack"`
}

type StructRef

type StructRef struct {
	StructName string `json:"structName"`
	TypeArgs   []Ty   `json:"typeArgs,omitempty"`
}

type Tensor

type Tensor struct {
	Items []Ty `json:"items"`
}

type ThrownError

type ThrownError struct {
	Name    string `json:"constName"`
	ErrCode int    `json:"errCode"`
}

type Ty

type Ty struct {
	SumType     string `json:"kind"`
	IntN        *IntN
	UintN       *UintN
	VarIntN     *VarIntN
	BitsN       *BitsN
	Nullable    *Nullable
	CellOf      *CellOf
	ArrayOf     *ArrayOf
	LispListOf  *LispListOf
	Tensor      *Tensor
	ShapedTuple *ShapedTuple
	MapKV       *MapKV
	EnumRef     *EnumRef
	StructRef   *StructRef
	AliasRef    *AliasRef
	Generic     *Generic
	Union       *Union
	VarUintN    *VarUintN
}

func NewAddressAnyType

func NewAddressAnyType() Ty

func NewAddressExtType

func NewAddressExtType() Ty

func NewAddressOptType

func NewAddressOptType() Ty

func NewAddressType

func NewAddressType() Ty

func NewAliasType

func NewAliasType(name string, typeArgs ...Ty) Ty

func NewBitsNType

func NewBitsNType(n int) Ty

func NewBoolType

func NewBoolType() Ty

func NewCellOfType

func NewCellOfType(of Ty) Ty

func NewCellType

func NewCellType() Ty

func NewCoinsType

func NewCoinsType() Ty

func NewEnumType

func NewEnumType(name string) Ty

func NewGenericType

func NewGenericType(nameT string) Ty

func NewIntNType

func NewIntNType(n int) Ty

func NewMapType

func NewMapType(key, value Ty) Ty

func NewNullableType

func NewNullableType(of Ty) Ty

func NewRemainingType

func NewRemainingType() Ty

func NewStructType

func NewStructType(name string, typeArgs ...Ty) Ty

func NewTensorType

func NewTensorType(of ...Ty) Ty

func NewTupleWithType

func NewTupleWithType(of ...Ty) Ty

func NewUIntNType

func NewUIntNType(n int) Ty

func NewUnionType

func NewUnionType(prefixLen int, prefixEatIntPlace bool, variants ...UnionVariant) Ty

func NewVarInt16Type

func NewVarInt16Type() Ty

func NewVarInt32Type

func NewVarInt32Type() Ty

func NewVarIntType

func NewVarIntType(n int) Ty

func NewVarUInt16Type

func NewVarUInt16Type() Ty

func NewVarUInt32Type

func NewVarUInt32Type() Ty

func NewVarUIntType

func NewVarUIntType(n int) Ty

func (*Ty) GetFixedSize

func (t *Ty) GetFixedSize() (int, bool)

func (Ty) InstantiateGenerics added in v1.22.0

func (ty Ty) InstantiateGenerics(typeParams []string, typeArgs []Ty) Ty

InstantiateGenerics replaces all generic Ts (typeParams) with instantiation (typeArgs) recursively. Example: `(int, T, Wrapper<T?>)` and T=coins => `(int, coins, Wrapper<coins?>)` A new struct is returned

func (*Ty) MarshalJSON

func (t *Ty) MarshalJSON() ([]byte, error)

func (Ty) String added in v1.22.0

func (ty Ty) String() string

func (*Ty) UnmarshalJSON

func (t *Ty) UnmarshalJSON(b []byte) error

type TyKind added in v1.22.0

type TyKind = string
const (
	TyKindInt         TyKind = "int"
	TyKindIntN        TyKind = "intN"
	TyKindUintN       TyKind = "uintN"
	TyKindVarIntN     TyKind = "varintN"
	TyKindVarUintN    TyKind = "varuintN"
	TyKindCoins       TyKind = "coins"
	TyKindBool        TyKind = "bool"
	TyKindCell        TyKind = "cell"
	TyKindBuilder     TyKind = "builder"
	TyKindSlice       TyKind = "slice"
	TyKindString      TyKind = "string"
	TyKindRemaining   TyKind = "remaining"
	TyKindAddress     TyKind = "address"
	TyKindAddressOpt  TyKind = "addressOpt"
	TyKindAddressExt  TyKind = "addressExt"
	TyKindAddressAny  TyKind = "addressAny"
	TyKindBitsN       TyKind = "bitsN"
	TyKindNullLiteral TyKind = "nullLiteral"
	TyKindCallable    TyKind = "callable"
	TyKindVoid        TyKind = "void"
	TyKindUnknown     TyKind = "unknown"
	TyKindNullable    TyKind = "nullable"
	TyKindCellOf      TyKind = "cellOf"
	TyKindArrayOf     TyKind = "arrayOf"
	TyKindLispListOf  TyKind = "lispListOf"
	TyKindTensor      TyKind = "tensor"
	TyKindShapedTuple TyKind = "shapedTuple"
	TyKindMapKV       TyKind = "mapKV"
	TyKindEnumRef     TyKind = "EnumRef"
	TyKindStructRef   TyKind = "StructRef"
	TyKindAliasRef    TyKind = "AliasRef"
	TyKindGenericT    TyKind = "genericT"
	TyKindUnion       TyKind = "union"
)

type UintN

type UintN struct {
	N int `json:"n"`
}

type Union

type Union struct {
	Variants   []UnionVariant `json:"variants"`
	StackWidth int            `json:"stackWidth"`
}

type UnionVariant

type UnionVariant struct {
	PrefixStr        string `json:"prefixStr"`
	PrefixLen        int    `json:"prefixLen"`
	PrefixEatInPlace bool   `json:"prefixEatInPlace,omitempty"`
	VariantTy        Ty     `json:"variantTy"`
}

func NewUnionVariant

func NewUnionVariant(variant Ty, prefixValue string) UnionVariant

type Unknown added in v1.22.0

type Unknown struct{}

type VarIntN

type VarIntN struct {
	N int `json:"n"`
}

type VarUintN

type VarUintN struct {
	N int `json:"n"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL