sdkutil

package
v0.7.9-rc9 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// EventTypeMessage defines the Akash message string
	EventTypeMessage = akashEventMessageV1
)

Variables

View Source
var (
	// ErrNotFound is the error with message "Not found"
	ErrNotFound = errors.New("Not found")
	// ErrUnknownType is the error with message "Unknown type"
	ErrUnknownType = errors.New("Unknown type")
	// ErrUnknownModule is the error with message "Unknown module"
	ErrUnknownModule = errors.New("Unknown module")
	// ErrUnknownAction is the error with message "Unknown action"
	ErrUnknownAction = errors.New("Unknown action")
	// ErrParsingBlockID indicates one of the uint parsers failed to convert a value.
	ErrParsingBlockID = errors.New("error parsing block id values")
	// ErrInvalidParseBlockIDInput indicates the splitting of block path failed.
	ErrInvalidParseBlockIDInput = errors.New("error parsing block id input string")
)
View Source
var (
	// ErrCouldNotRenderObject indicates response rendering error.
	ErrCouldNotRenderObject = sdkerrors.New("sdkutil", 1, "could not render object")
)

Functions

func FmtBlockID added in v0.7.8

func FmtBlockID(owner *sdk.AccAddress, dseq *uint64, gseq *uint32, oseq *uint32, provider *sdk.AccAddress) string

FmtBlockID provides a human readable representation of the block chain ID fields.

func GetAccAddress

func GetAccAddress(attrs []sdk.Attribute, key string) (sdk.AccAddress, error)

GetAccAddress take sdk attributes, key and returns account address. Returns error incase of failure.

func GetString

func GetString(attrs []sdk.Attribute, key string) (string, error)

GetString take sdk attributes, key and returns key value. Returns error incase of failure.

func GetUint64

func GetUint64(attrs []sdk.Attribute, key string) (uint64, error)

GetUint64 take sdk attributes, key and returns uint64 value. Returns error incase of failure.

func RenderQueryResponse

func RenderQueryResponse(cdc *codec.Codec, obj interface{}) ([]byte, error)

RenderQueryResponse uses codec to render query response. Returns error incase of failure.

Types

type BaseModuleEvent added in v0.7.5

type BaseModuleEvent struct {
	Module string `json:"module"`
	Action string `json:"action"`
}

type BlockID added in v0.7.8

type BlockID struct {
	Owner    *sdk.AccAddress
	DSeq     *uint64
	GSeq     *uint32
	OSeq     *uint32
	Provider *sdk.AccAddress
}

BlockID provides type to properly format print blockchain ID types.

func NewBlockID added in v0.7.8

func NewBlockID(owner *sdk.AccAddress, dseq *uint64, gseq *uint32, oseq *uint32, provider *sdk.AccAddress) BlockID

NewBlockID initializes the BlockID struct, passing nil values is acceptable for fields which are not used.

func ParseBlockID added in v0.7.8

func ParseBlockID(id string) (*BlockID, error)

ParseBlockID returns the values from a human readable ID string.

func ReflectBlockID added in v0.7.8

func ReflectBlockID(id interface{}) BlockID

ReflectBlockID accepts an ID struct and unpacks the block identifying fields. Useful for passing *ID types and getting consistent output based on the consistent field names.

func (BlockID) String added in v0.7.8

func (b BlockID) String() string

String method provides the full formating of all the BlockID fields which are not nil. Format: [Owner AccAddress]/[DSeq]/[GSeq]/[OSeq]/[Provider AccAddress] eg: akash1vgv30hr8lel8r7270wywmak5c82es3njws3u4z/795423625/1/1/akash1pxqksfr60zc6uadht6300uavwl3s58ct0apt9w

type Event

type Event struct {
	Type       string
	Module     string
	Action     string
	Attributes []sdk.Attribute
}

Event stores type, module, action and attributes list of sdk

func ParseEvent

func ParseEvent(sev sdk.StringEvent) (Event, error)

ParseEvent parses string to event

type ModuleEvent added in v0.7.3

type ModuleEvent interface {
	ToSDKEvent() sdk.Event
}

Jump to

Keyboard shortcuts

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