stateapi

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: Apache-2.0, BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Overview

access to the solid state of the smart contract

Index

Constants

View Source
const (
	ValueTypeScalar        = ValueType("scalar")
	ValueTypeArray         = ValueType("array")
	ValueTypeDict          = ValueType("dict")
	ValueTypeDictElement   = ValueType("dict-elem")
	ValueTypeTLogSlice     = ValueType("tlog_slice")
	ValueTypeTLogSliceData = ValueType("tlog_slice_data")
)

Variables

This section is empty.

Functions

func HandlerQueryRequestState

func HandlerQueryRequestState(c echo.Context) error

func HandlerQueryState

func HandlerQueryState(c echo.Context) error

Types

type ArrayQueryParams

type ArrayQueryParams struct {
	From uint16
	To   uint16
}

type ArrayResult

type ArrayResult struct {
	Len    uint16
	Values [][]byte
}

type DictElementQueryParams

type DictElementQueryParams struct {
	Key []byte
}

type DictElementResult

type DictElementResult struct {
	Value []byte
}

type DictQueryParams

type DictQueryParams struct {
	Limit uint32
}

type DictResult

type DictResult struct {
	Len     uint32
	Entries []KeyValuePair
}

type KeyQuery

type KeyQuery struct {
	Key    []byte
	Type   ValueType
	Params json.RawMessage // one of DictQueryParams, ArrayQueryParams, ...
}

type KeyValuePair

type KeyValuePair struct {
	Key   []byte
	Value []byte
}

type QueryRequest

type QueryRequest struct {
	Address          string
	QueryGeneralData bool
	Query            []*KeyQuery
}

func NewQueryRequest

func NewQueryRequest(address *address.Address) *QueryRequest

func (*QueryRequest) AddArray

func (q *QueryRequest) AddArray(key kv.Key, from uint16, to uint16)

func (*QueryRequest) AddDictionary

func (q *QueryRequest) AddDictionary(key kv.Key, limit uint32)

func (*QueryRequest) AddDictionaryElement

func (q *QueryRequest) AddDictionaryElement(dictKey kv.Key, elemKey []byte)

func (*QueryRequest) AddGeneralData

func (q *QueryRequest) AddGeneralData()

func (*QueryRequest) AddScalar

func (q *QueryRequest) AddScalar(key kv.Key)

func (*QueryRequest) AddTLogSlice

func (q *QueryRequest) AddTLogSlice(key kv.Key, fromTs, toTs int64)

func (*QueryRequest) AddTLogSliceData

func (q *QueryRequest) AddTLogSliceData(key kv.Key, fromIndex, toIndex uint32, descending bool)

type QueryResponse

type QueryResponse struct {
	// general info
	StateIndex uint32
	Timestamp  int64
	StateHash  string
	StateTxId  string
	Requests   []string
	// queried variables
	Results []*QueryResult
	Error   string
}

type QueryResult

type QueryResult struct {
	Key   []byte
	Type  ValueType
	Value json.RawMessage // one of []byte, DictResult, ArrayResult, ...
}

func (*QueryResult) MustAddress

func (r *QueryResult) MustAddress() *address.Address

func (*QueryResult) MustArrayResult

func (r *QueryResult) MustArrayResult() *ArrayResult

func (*QueryResult) MustBytes

func (r *QueryResult) MustBytes() []byte

func (*QueryResult) MustDictionaryElementResult

func (r *QueryResult) MustDictionaryElementResult() []byte

func (*QueryResult) MustDictionaryResult

func (r *QueryResult) MustDictionaryResult() *DictResult

func (*QueryResult) MustHashValue

func (r *QueryResult) MustHashValue() *hashing.HashValue

func (*QueryResult) MustInt64

func (r *QueryResult) MustInt64() (int64, bool)

func (*QueryResult) MustString

func (r *QueryResult) MustString() (string, bool)

func (*QueryResult) MustTLogSliceDataResult

func (r *QueryResult) MustTLogSliceDataResult() *TLogSliceDataResult

func (*QueryResult) MustTLogSliceResult

func (r *QueryResult) MustTLogSliceResult() *TLogSliceResult

type ReqStateRequest

type ReqStateRequest struct {
	Address    string   `json:"address"`
	RequestIds []string `json:"requests"`
}

type ReqStateResponse

type ReqStateResponse struct {
	Address  string          `json:"address"`
	Requests map[string]bool `json:"processed"` // false - backlog, true - processed, not present in the map - unknown
	Error    string          `json:"error"`
}

type TLogSliceDataQueryParams

type TLogSliceDataQueryParams struct {
	FromIndex  uint32
	ToIndex    uint32
	Descending bool
}

TLogSliceDataQueryParams request data for the slice

type TLogSliceDataResult

type TLogSliceDataResult struct {
	Values [][]byte
}

type TLogSliceQueryParams

type TLogSliceQueryParams struct {
	FromTs int64
	ToTs   int64
}

TLogSliceQueryParams request slice of timestamped log. If FromTs or ToTs is 0, it is considered 'earliest' and 'latest' respectively. For 0,0 slice corresponds to the whole log

type TLogSliceResult

type TLogSliceResult struct {
	IsNotEmpty bool
	FirstIndex uint32
	LastIndex  uint32
	Earliest   int64
	Latest     int64
}

type ValueType

type ValueType string

Jump to

Keyboard shortcuts

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