types

package
v0.0.0-...-dcea795 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2026 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentSchemaFormatVersion = "contract-schema-format-v1"

CurrentSchemaFormatVersion identifies the on-state metadata wrapper shape. It is separate from the typed schema ruleset version and from any runtime snapshot codec version.

Variables

View Source
var DesignHint = hint.MustNewHint("mitum-contract-design-v0.0.1")

Functions

func ContractSourceHash

func ContractSourceHash(source string) string

Types

type ContractSchema

type ContractSchema struct {
	PackageName       string                    `json:"package_name" bson:"package_name"`
	Mode              string                    `json:"mode" bson:"mode"`
	Types             TypeRegistry              `json:"types" bson:"types"`
	PersistentGlobals []PersistentBindingSchema `json:"persistent_globals" bson:"persistent_globals"`
	Functions         []FunctionSchema          `json:"functions" bson:"functions"`
}

func (ContractSchema) Bytes

func (s ContractSchema) Bytes() []byte

func (ContractSchema) IsValid

func (s ContractSchema) IsValid([]byte) error

type Design

type Design struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewDesign

func NewDesign(contractCode string) Design

func (Design) Bytes

func (de Design) Bytes() []byte

func (Design) ContractCode

func (de Design) ContractCode() string

func (*Design) DecodeBSON

func (de *Design) DecodeBSON(b []byte, enc *bsonenc.Encoder) error

func (*Design) DecodeJSON

func (de *Design) DecodeJSON(b []byte, enc encoder.Encoder) error

func (Design) GenerateHash

func (de Design) GenerateHash() util.Hash

func (Design) Hash

func (de Design) Hash() util.Hash

func (Design) IsValid

func (de Design) IsValid([]byte) error

func (Design) MarshalBSON

func (de Design) MarshalBSON() ([]byte, error)

func (Design) MarshalJSON

func (de Design) MarshalJSON() ([]byte, error)

type DesignBSONUnmarshaler

type DesignBSONUnmarshaler struct {
	Hint         string `bson:"_hint"`
	ContractCode string `bson:"contract_code"`
}

type DesignJSONMarshaler

type DesignJSONMarshaler struct {
	hint.BaseHinter
	ContractCode string `json:"contract_code"`
}

type DesignJSONUnmarshaler

type DesignJSONUnmarshaler struct {
	Hint         hint.Hint `json:"_hint"`
	ContractCode string    `json:"contract_code"`
}

type FunctionSchema

type FunctionSchema struct {
	Name     string         `json:"name" bson:"name"`
	Exported bool           `json:"exported" bson:"exported"`
	Params   []ParamSchema  `json:"params" bson:"params"`
	Results  []ResultSchema `json:"results" bson:"results"`
}

type ParamSchema

type ParamSchema struct {
	Name string  `json:"name" bson:"name"`
	Type TypeRef `json:"type" bson:"type"`
}

type PersistedContractSchema

type PersistedContractSchema struct {
	SchemaFormatVersion  string         `json:"schema_format_version" bson:"schema_format_version"`
	SchemaRulesetVersion string         `json:"schema_ruleset_version" bson:"schema_ruleset_version"`
	SourceHash           string         `json:"source_hash" bson:"source_hash"`
	Schema               ContractSchema `json:"schema" bson:"schema"`
}

func (PersistedContractSchema) Bytes

func (s PersistedContractSchema) Bytes() []byte

func (PersistedContractSchema) IsValid

func (s PersistedContractSchema) IsValid([]byte) error

type PersistentBindingSchema

type PersistentBindingSchema struct {
	Name            string  `json:"name" bson:"name"`
	Type            TypeRef `json:"type" bson:"type"`
	HasExplicitType bool    `json:"has_explicit_type" bson:"has_explicit_type"`
}

type ResultSchema

type ResultSchema struct {
	Type TypeRef `json:"type" bson:"type"`
}

type StructField

type StructField struct {
	Name string  `json:"name" bson:"name"`
	Type TypeRef `json:"type" bson:"type"`
}

type TypeRef

type TypeRef struct {
	Kind   string        `json:"kind" bson:"kind"`
	Raw    string        `json:"raw,omitempty" bson:"raw,omitempty"`
	Scalar string        `json:"scalar,omitempty" bson:"scalar,omitempty"`
	Name   string        `json:"name,omitempty" bson:"name,omitempty"`
	Key    *TypeRef      `json:"key,omitempty" bson:"key,omitempty"`
	Elem   *TypeRef      `json:"elem,omitempty" bson:"elem,omitempty"`
	Fields []StructField `json:"fields,omitempty" bson:"fields,omitempty"`
}

func (TypeRef) Bytes

func (t TypeRef) Bytes() []byte

type TypeRegistry

type TypeRegistry struct {
	Structs map[string]TypeRef `json:"structs" bson:"structs"`
}

func (TypeRegistry) Bytes

func (r TypeRegistry) Bytes() []byte

Jump to

Keyboard shortcuts

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