src

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const FirstKey byte = 0

FirstKey defines the value of the default key, when no key is set in the contract so far. NOTE: keys are [1]byte length but in KV they're [n]bytes.

Variables

This section is empty.

Functions

func Execute

func Execute(deps *std.Deps, env types.Env, info types.MessageInfo, data []byte) (*types.Response, error)

Execute runs state modifying handlers of the contract given msg data.

func Instantiate

func Instantiate(_ *std.Deps, _ types.Env, _ types.MessageInfo, _ []byte) (*types.Response, error)

Instantiate does nothing.

func Migrate

func Migrate(deps *std.Deps, _ types.Env, _ []byte) (*types.Response, error)

Migrate executes queue contract's migration which consists in clearing the state and writing three new values in the queue

func Query

func Query(deps *std.Deps, _ types.Env, msg []byte) ([]byte, error)

Query handles given message bytes what query handler must be executed.

Types

type CountResponse

type CountResponse struct {
	Count uint32 `json:"count"`
}

CountResponse is the total number of Item in the queue

func (CountResponse) MarshalJSON

func (v CountResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (CountResponse) MarshalTinyJSON

func (v CountResponse) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*CountResponse) UnmarshalJSON

func (v *CountResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*CountResponse) UnmarshalTinyJSON

func (v *CountResponse) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type Dequeue

type Dequeue struct{}

Dequeue is the message used to remove an Item from the queue.

func (Dequeue) MarshalJSON

func (v Dequeue) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (Dequeue) MarshalTinyJSON

func (v Dequeue) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*Dequeue) UnmarshalJSON

func (v *Dequeue) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Dequeue) UnmarshalTinyJSON

func (v *Dequeue) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type Enqueue

type Enqueue struct {
	Value int32 `json:"value"`
}

Enqueue is the message used to add an Item to the queue.

func (Enqueue) MarshalJSON

func (v Enqueue) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (Enqueue) MarshalTinyJSON

func (v Enqueue) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*Enqueue) UnmarshalJSON

func (v *Enqueue) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Enqueue) UnmarshalTinyJSON

func (v *Enqueue) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type ExecuteMsg

type ExecuteMsg struct {
	// Enqueue adds a value in the queue
	Enqueue *Enqueue `json:"enqueue"`
	// Dequeue removes a value from the queue
	Dequeue *Dequeue `json:"dequeue"`
}

ExecuteMsg defines all the messages that modify state that can be sent to the contract.

func (ExecuteMsg) MarshalJSON

func (v ExecuteMsg) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (ExecuteMsg) MarshalTinyJSON

func (v ExecuteMsg) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*ExecuteMsg) UnmarshalJSON

func (v *ExecuteMsg) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*ExecuteMsg) UnmarshalTinyJSON

func (v *ExecuteMsg) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type InstantiateMsg

type InstantiateMsg struct{}

InstantiateMsg is the instantiation messages.

func (InstantiateMsg) MarshalJSON

func (v InstantiateMsg) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (InstantiateMsg) MarshalTinyJSON

func (v InstantiateMsg) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*InstantiateMsg) UnmarshalJSON

func (v *InstantiateMsg) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*InstantiateMsg) UnmarshalTinyJSON

func (v *InstantiateMsg) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type Item

type Item struct {
	Value int32 `json:"value"`
}

Item defines the state object of the queue values.

func (Item) MarshalJSON

func (v Item) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (Item) MarshalTinyJSON

func (v Item) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*Item) UnmarshalJSON

func (v *Item) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*Item) UnmarshalTinyJSON

func (v *Item) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type ListResponse

type ListResponse struct {
	Empty []uint32 `json:"empty"`
	Early []uint32 `json:"early"`
	Late  []uint32 `json:"late"`
}

ListResponse is the response returned by the List query

func (ListResponse) MarshalJSON

func (v ListResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (ListResponse) MarshalTinyJSON

func (v ListResponse) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*ListResponse) UnmarshalJSON

func (v *ListResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*ListResponse) UnmarshalTinyJSON

func (v *ListResponse) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type QueryMsg

type QueryMsg struct {
	// Count counts how many items in the queue; returns CountResponse
	Count *struct{} `json:"count"`
	// Sum the number of values in the queue; returns SumResponse
	Sum *struct{} `json:"sum"`
	// Reducer keeps open two iters at once; returns ReducerResponse
	Reducer *struct{} `json:"reducer"`
	// List does multiple list operations; returns ListResponse
	List *struct{} `json:"list"`
}

QueryMsg defines all the set of the possible queries that can be sent to the contract.

func (QueryMsg) MarshalJSON

func (v QueryMsg) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (QueryMsg) MarshalTinyJSON

func (v QueryMsg) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*QueryMsg) UnmarshalJSON

func (v *QueryMsg) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*QueryMsg) UnmarshalTinyJSON

func (v *QueryMsg) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type ReducerResponse

type ReducerResponse struct {
	Counters [][2]int32 `json:"counters"`
}

func (ReducerResponse) MarshalJSON

func (v ReducerResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (ReducerResponse) MarshalTinyJSON

func (v ReducerResponse) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*ReducerResponse) UnmarshalJSON

func (v *ReducerResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*ReducerResponse) UnmarshalTinyJSON

func (v *ReducerResponse) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

type SumResponse

type SumResponse struct {
	Sum int32 `json:"sum"`
}

SumResponse is the total sum of Item in the queue values

func (SumResponse) MarshalJSON

func (v SumResponse) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (SumResponse) MarshalTinyJSON

func (v SumResponse) MarshalTinyJSON(w *jwriter.Writer)

MarshalTinyJSON supports tinyjson.Marshaler interface

func (*SumResponse) UnmarshalJSON

func (v *SumResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (*SumResponse) UnmarshalTinyJSON

func (v *SumResponse) UnmarshalTinyJSON(l *jlexer.Lexer)

UnmarshalTinyJSON supports tinyjson.Unmarshaler interface

Jump to

Keyboard shortcuts

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