sdkutil

package
v0.22.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Bech32PrefixAccAddr = "akash"
	Bech32PrefixAccPub  = "akashpub"

	Bech32PrefixValAddr = "akashvaloper"
	Bech32PrefixValPub  = "akashvaloperpub"

	Bech32PrefixConsAddr = "akashvalcons"
	Bech32PrefixConsPub  = "akashvalconspub"
)
View Source
const (
	BroadcastBlockRetryTimeout = 300 * time.Second
)
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 AdjustGas

func AdjustGas(ctx client.Context, txf tx.Factory, msgs ...sdk.Msg) (tx.Factory, error)

func BroadcastTX

func BroadcastTX(ctx context.Context, cctx client.Context, flags *pflag.FlagSet, msgs ...sdk.Msg) error

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 InitSDKConfig

func InitSDKConfig()

InitSDKConfig configures address prefixes for validator, accounts and consensus nodes

func MustAccAddressFromBech32

func MustAccAddressFromBech32(address string) sdk.AccAddress

MustAccAddressFromBech32 creates an AccAddress from a Bech32 string. It panics if there is an error.

func PrepareFactory

func PrepareFactory(clientCtx client.Context, txf tx.Factory) (tx.Factory, error)

PrepareFactory has been copied from cosmos-sdk to make it public. Source: https://github.com/cosmos/cosmos-sdk/blob/v0.43.0-rc2/client/tx/tx.go#L311

func RenderQueryResponse

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

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

Types

type BaseModuleEvent

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

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

type ModuleEvent interface {
	ToSDKEvent() sdk.Event
}

Jump to

Keyboard shortcuts

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