types

package
v0.0.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ModuleName is the name of the module
	ModuleName = "contract"

	// StoreKey to be used when creating the KVStore
	StoreKey = ModuleName

	// RouterKey is the msg router key for the IBC module
	RouterKey string = ModuleName
)
View Source
const (
	ObjectTypeHTTP cross.ObjectType = 10
)
View Source
const (
	QuerySimulation = "simulation"
)

Variables

View Source
var (
	ErrFailedContractHandle = sdkerrors.Register(ModuleName, 2, "failed to execute contract handler")
	ErrFailedCommitStore    = sdkerrors.Register(ModuleName, 3, "failed to commit updates")
)
View Source
var ModuleCdc = codec.New()

ModuleCdc is the codec for the module

Functions

func EncodeContractCallInfo added in v0.0.5

func EncodeContractCallInfo(c ContractCallInfo) ([]byte, error)

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers concrete types on the Amino codec

Types

type ContractCallInfo

type ContractCallInfo struct {
	ID     string   `json:"id"`
	Method string   `json:"method"`
	Args   [][]byte `json:"args"`
}

func DecodeContractCallInfo added in v0.0.5

func DecodeContractCallInfo(bz []byte) (*ContractCallInfo, error)

func NewContractCallInfo

func NewContractCallInfo(id, method string, args [][]byte) ContractCallInfo

func (ContractCallInfo) Bytes

func (ci ContractCallInfo) Bytes() []byte

type ContractCallResponse

type ContractCallResponse struct {
	ReturnValue []byte    `json:"return_value"`
	OPs         cross.OPs `json:"ops"`
}

type ContractHandlerResult

type ContractHandlerResult struct {
	Data   []byte
	Events sdk.Events
}

func NewContractHandlerResult

func NewContractHandlerResult(data []byte, events sdk.Events) ContractHandlerResult

func (ContractHandlerResult) GetData

func (r ContractHandlerResult) GetData() []byte

func (ContractHandlerResult) GetEvents

func (r ContractHandlerResult) GetEvents() sdk.Events

type HTTPObject added in v0.0.5

type HTTPObject struct {
	K          []byte
	ServerInfo HTTPServerInfo
}

HTTPObject is an Object that wraps HTTPServerInfo

func (HTTPObject) ChainID added in v0.0.6

func (o HTTPObject) ChainID() types.ChainID

ChainID implements Object.ChainID

func (HTTPObject) Evaluate added in v0.0.5

func (o HTTPObject) Evaluate(_ []byte) ([]byte, error)

Evaluate implements Object.Evaluate

func (HTTPObject) Key added in v0.0.5

func (o HTTPObject) Key() []byte

Key implements Object.Key

func (HTTPObject) Type added in v0.0.5

func (HTTPObject) Type() cross.ObjectType

Type implements Object.Type

type HTTPObjectResolver added in v0.0.6

type HTTPObjectResolver struct {
	Router ServerRouter
}

HTTPObjectResolver resolves a given ChainID and call info to HTTPObject

func NewHTTPObjectResolver added in v0.0.6

func NewHTTPObjectResolver(router ServerRouter) HTTPObjectResolver

NewHTTPObjectResolver returns a new HTTPObjectResolver

func (HTTPObjectResolver) Resolve added in v0.0.6

func (rs HTTPObjectResolver) Resolve(id types.ChainID, bz []byte) (cross.Object, error)

Resolve implements Resolver.Resolve

type HTTPServerInfo added in v0.0.5

type HTTPServerInfo struct {
	ChainID types.ChainID
	Address string
}

HTTPServerInfo is an info of http server

type HTTPServerRouter added in v0.0.5

type HTTPServerRouter struct {
	// contains filtered or unexported fields
}

HTTPServerRouter manages the routes to each http servers that have contract functions

func NewHTTPServerRouter added in v0.0.5

func NewHTTPServerRouter() *HTTPServerRouter

NewHTTPServerRouter returns a new HTTPServerRouter

func (*HTTPServerRouter) AddRoute added in v0.0.5

func (r *HTTPServerRouter) AddRoute(chainID types.ChainID, id string, info HTTPServerInfo)

AddRoute adds a new route to the http server

func (HTTPServerRouter) Route added in v0.0.5

func (r HTTPServerRouter) Route(chainID types.ChainID, bz []byte) (cross.Object, error)

Route returns HTTPObject that indicates the object on matched http server

type MsgContractCall

type MsgContractCall struct {
	Sender              sdk.AccAddress            `json:"sender" yaml:"sender"`
	Signers             []sdk.AccAddress          `json:"signers" yaml:"signers"`
	CallInfo            cross.ContractCallInfo    `json:"call_info" yaml:"call_info"`
	StateConstraintType cross.StateConstraintType `json:"state_constraint_type" yaml:"state_constraint_type"`
}

func NewMsgContractCall

func NewMsgContractCall(sender sdk.AccAddress, signers []sdk.AccAddress, callInfo cross.ContractCallInfo, scType cross.StateConstraintType) MsgContractCall

func (MsgContractCall) GetSignBytes

func (msg MsgContractCall) GetSignBytes() []byte

func (MsgContractCall) GetSigners

func (msg MsgContractCall) GetSigners() []sdk.AccAddress

GetSigners implements sdk.Msg GetSigners returns the addresses that must sign the transaction. Addresses are returned in a deterministic order. Duplicate addresses will be omitted.

func (MsgContractCall) Route

func (MsgContractCall) Route() string

func (MsgContractCall) Type

func (MsgContractCall) Type() string

func (MsgContractCall) ValidateBasic

func (msg MsgContractCall) ValidateBasic() error

type QuerySimulationResponse

type QuerySimulationResponse = sdk.Result

type ServerRouter added in v0.0.5

type ServerRouter interface {
	Route(id types.ChainID, bz []byte) (cross.Object, error)
}

ServerRouter manages routes to contract functions on http server

Jump to

Keyboard shortcuts

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