client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2023 License: Apache-2.0 Imports: 37 Imported by: 5

Documentation

Overview

Package modules is to warpped the API provided by each module of IRITA

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromTmPubKey

func FromTmPubKey(Algo string, pubKey tmcrypto.PubKey) commoncryptotypes.PubKey

func NewBaseClient

func NewBaseClient(cfg sdktypes.ClientConfig, encodingConfig sdktypes.EncodingConfig, logger log.Logger) sdktypes.BaseClient

NewBaseClient return the baseClient for every sub modules

func NewGRPCClient

func NewGRPCClient(url string, options ...grpc.DialOption) types.GRPCClient

func NewLocker

func NewLocker(size int) *locker

NewLocker implement the function of lock, can lock resources according to conditions

func NewRPCClient

func NewRPCClient(cfg sdktypes.ClientConfig,
	cdc *commoncodec.LegacyAmino,
	txDecoder sdk.TxDecoder,
	logger log.Logger,
) sdk.TmClient

Types

type AccountQuery

type AccountQuery struct {
	sdk.Queries
	sdk.GRPCClient
	log.Logger
	cache.Cache

	Km sdk.KeyManager
	// contains filtered or unexported fields
}

Must be used with locker, otherwise there are thread safety issues

func (AccountQuery) QueryAccount

func (a AccountQuery) QueryAccount(address string) (sdk.BaseAccount, sdk.Error)

func (AccountQuery) QueryAddress

func (a AccountQuery) QueryAddress(name, password string) (sdk.AccAddress, sdk.Error)

func (AccountQuery) QueryAndRefreshAccount

func (a AccountQuery) QueryAndRefreshAccount(address string) (sdk.BaseAccount, sdk.Error)

type Client

type Client interface {
	Add(name, password string) (address string, mnemonic string, err types.Error)
	Recover(name, password, mnemonic string) (address string, err types.Error)
	RecoverWithHDPath(name, password, mnemonic, hdPath string) (address string, err types.Error)
	Import(name, password, privKeyArmor string) (address string, err types.Error)
	Export(name, password string) (privKeyArmor string, err types.Error)
	Delete(name, password string) types.Error
	Show(name, password string) (string, types.Error)
}

func NewKeysClient

func NewKeysClient(cfg types.ClientConfig, keyManager types.KeyManager) Client

type KeyManager

type KeyManager struct {
	KeyDAO store.KeyDAO
	Algo   string
}

func (KeyManager) Add

func (k KeyManager) Add(name, password string) (string, string, types.Error)

func (KeyManager) Delete

func (k KeyManager) Delete(name, password string) error

func (KeyManager) Export

func (k KeyManager) Export(name, password string) (armor string, err error)

func (KeyManager) Find

func (k KeyManager) Find(name, password string) (tmcrypto.PubKey, types.AccAddress, error)

func (KeyManager) Import

func (k KeyManager) Import(name, password, armor string) (string, error)

func (KeyManager) Insert

func (k KeyManager) Insert(name, password string) (string, string, error)

func (KeyManager) Recover

func (k KeyManager) Recover(name, password, mnemonic, hdPath string) (string, error)

func (KeyManager) Sign

func (k KeyManager) Sign(name, password string, data []byte) ([]byte, tmcrypto.PubKey, error)

Jump to

Keyboard shortcuts

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