utils

package
v0.11.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAccount

func CreateAccount(name, passWd string) (info keys.Info, mnemo string, err error)

CreateAccount creates a random key info with the given name and password

func CreateAccountWithMnemo

func CreateAccountWithMnemo(mnemonic, name, passWd string) (info keys.Info, mnemo string, err error)

CreateAccountWithMnemo creates the key info with the given mnemonic, name and password

func CreateAccountWithPrivateKey

func CreateAccountWithPrivateKey(privateKey, name, passWd string) (info keys.Info, err error)

CreateAccountWithPrivateKey creates the key info with the given privateKey string, name and password

func ErrClientQuery

func ErrClientQuery(errMsg string) error

ErrClientQuery returns an error when client failed in query

func ErrFilterDataFromBaseResponse

func ErrFilterDataFromBaseResponse(kind, errMsg string) error

ErrFilterDataFromBaseResponse returns an error when it failed to filter data from backend base response

func ErrFilterDataFromListResponse

func ErrFilterDataFromListResponse(kind, errMsg string) error

ErrFilterDataFromListResponse returns an error when it failed to filter data from backend list response

func ErrMarshalJSON

func ErrMarshalJSON(errMsg string) error

ErrMarshalJSON returns an error when it failed in marshaling JSON

func ErrUnmarshalJSON

func ErrUnmarshalJSON(errMsg string) error

ErrUnmarshalJSON returns an error when it failed in unmarshaling JSON

func GenerateMnemonic

func GenerateMnemonic() (mnemo string, err error)

GenerateMnemonic creates a random mnemonic

func GeneratePrivateKeyFromMnemo

func GeneratePrivateKeyFromMnemo(mnemo string) (privKey string, err error)

GeneratePrivateKeyFromMnemo converts mnemonic to private key

func GetDataFromBaseResponse

func GetDataFromBaseResponse(bytes []byte, ptr interface{}) error

GetDataFromBaseResponse gets the detail data from the base response bytes

func GetOrderIDsFromResponse

func GetOrderIDsFromResponse(txResp *sdk.TxResponse) (orderIDs []string)

GetOrderIDsFromResponse filters the orderID from the tx response a useful tool

func GetStdTxFromFile

func GetStdTxFromFile(codec sdk.SDKCodec, filePath string) (stdTx sdk.StdTx, err error)

GetStdTxFromFile gets the instance of stdTx from a json file

func ParseBlock

func ParseBlock(cdc sdk.SDKCodec, pTmBlock *tmtypes.Block) (block types.Block, err error)

ParseBlock converts raw tendermint block type to the one gosdk requires

func ParseBlockResults

func ParseBlockResults(pTmBlockResults *ctypes.ResultBlockResults) types.BlockResults

ParseBlockResults converts raw tendermint block result type to the one gosdk requires

func ParseCommitResult

func ParseCommitResult(pTmCommitResult *ctypes.ResultCommit) types.ResultCommit

ParseCommitResult converts raw tendermint commit result type to the one gosdk requires

func ParseTransfersStr

func ParseTransfersStr(str string) ([]types.TransferUnit, error)

ParseTransfersStr parses the whole multi-send info string into TransferUnit Example: `addr1 1okt

addr2 2okt`

func ParseTxResult

func ParseTxResult(pTmTxResult *ctypes.ResultTx) types.ResultTx

ParseTxResult converts raw tendermint tx result type to the one gosdk requires

func ParseTxsResult

func ParseTxsResult(pTmTxsResult *ctypes.ResultTxSearch) types.ResultTxs

ParseTxsResult converts raw tendermint txs result type to the one gosdk requires

func ParseValAddresses

func ParseValAddresses(valAddrsStr []string) ([]sdk.ValAddress, error)

ParseValAddresses parses validator address string to types.ValAddress

func ParseValidatorsResult

func ParseValidatorsResult(pTmValsResult *ctypes.ResultValidators) types.ResultValidators

ParseValidatorsResult converts raw tendermint validators result type to the one gosdk requires

func UnmarshalListResponse

func UnmarshalListResponse(bz []byte, ptr interface{}) error

UnmarshalListResponse unmarshals the list response from data bytes

Types

This section is empty.

Jump to

Keyboard shortcuts

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