src

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var StateKey = []byte("State")

Functions

func Handle

func Handle(deps *std.Deps, env std.Env, info std.MessageInfo, data []byte) (*std.HandleResultOk, error)

func Init

func Init(deps *std.Deps, env std.Env, info std.MessageInfo, msg []byte) (*std.InitResultOk, error)

func Query

func Query(deps *std.Deps, env std.Env, data []byte) (*std.QueryResponseOk, error)

func SaveState

func SaveState(storage std.Storage, state *State) error

Types

type CountResponse

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

type HandleMsg

type HandleMsg struct {
	Increment ezjson.EmptyStruct `json:"increment,opt_seen"`
	Reset     Reset              `json:"reset"`
}

type Increment

type Increment struct {
	Delta uint64 `json:"delta"`
}

type InitMsg

type InitMsg struct {
	Count uint64 `json:"count"`
}

all message type define here

type QueryMsg

type QueryMsg struct {
	Count ezjson.EmptyStruct `json:"get_count,opt_seen"`
}

type Reset

type Reset struct {
	Value uint64 `json:"value"`
}

type State

type State struct {
	// having issues unmarshalling []byte (maybe human addr is better anyway?)
	Owner string `json:"owner"`
	Count uint64 `json:"count"`
}

this is what we store

func LoadState

func LoadState(storage std.Storage) (*State, error)

Jump to

Keyboard shortcuts

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