cosmos

package
v0.26.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// CosmosBech32MainPrefix defines the main Bech32 prefix.
	CosmosBech32MainPrefix = "mesg"

	// CosmosCoinType is the mesg registered coin type from https://github.com/satoshilabs/slips/blob/master/slip-0044.md.
	CosmosCoinType = uint32(470)

	// FullFundraiserPath is the parts of the BIP44 HD path that are fixed by what we used during the fundraiser.
	FullFundraiserPath = "44'/470'/0'/0/0"

	// GasAdjustment is a multiplier to make sure transactions have enough gas when gas are estimated.
	GasAdjustment = 1.5

	// DefaultAlgo for create account.
	DefaultAlgo = keys.Secp256k1
)

Variables

This section is empty.

Functions

func InitConfig added in v0.21.0

func InitConfig()

InitConfig sets the bech32 prefix and HDPath to cosmos config.

func RegisterSimulateRoute added in v0.23.0

func RegisterSimulateRoute(cliCtx context.CLIContext, r *mux.Router)

RegisterSimulateRoute registers the route on the router.

func SimulateRequestHandlerFn added in v0.23.0

func SimulateRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc

SimulateRequestHandlerFn - http request handler to simulate msgs.

Types

type Keybase

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

Keybase is a standard cosmos keybase.

func NewInMemoryKeybase added in v0.24.0

func NewInMemoryKeybase() *Keybase

NewInMemoryKeybase initializes a in memory keybase.

func NewKeybase

func NewKeybase(dir string) (*Keybase, error)

NewKeybase initializes a filesystem keybase at a particular dir.

func (*Keybase) CloseDB added in v0.18.0

func (kb *Keybase) CloseDB()

CloseDB is a lock protected version of keys.CloseDB

func (*Keybase) CreateAccount added in v0.18.0

func (kb *Keybase) CreateAccount(name, mnemonic, bip39Passwd, encryptPasswd, hdPath string, algo keys.SigningAlgo) (keys.Info, error)

CreateAccount is a lock protected version of keys.CreateAccount

func (*Keybase) CreateLedger added in v0.18.0

func (kb *Keybase) CreateLedger(name string, algo keys.SigningAlgo, hrp string, account, index uint32) (keys.Info, error)

CreateLedger is a lock protected version of keys.CreateLedger

func (*Keybase) CreateMnemonic added in v0.18.0

func (kb *Keybase) CreateMnemonic(name string, language keys.Language, passwd string, algo keys.SigningAlgo) (keys.Info, string, error)

CreateMnemonic is a lock protected version of keys.CreateMnemonic

func (*Keybase) CreateMulti added in v0.18.0

func (kb *Keybase) CreateMulti(name string, pubkey crypto.PubKey) (keys.Info, error)

CreateMulti is a lock protected version of keys.CreateMulti

func (*Keybase) CreateOffline added in v0.18.0

func (kb *Keybase) CreateOffline(name string, pubkey crypto.PubKey, algo keys.SigningAlgo) (keys.Info, error)

CreateOffline is a lock protected version of keys.CreateOffline

func (*Keybase) Delete added in v0.18.0

func (kb *Keybase) Delete(name, passphrase string, skipPass bool) error

Delete is a lock protected version of keys.Delete

func (*Keybase) Exist added in v0.17.0

func (kb *Keybase) Exist(name string) (bool, error)

Exist checks if the account exists.

func (*Keybase) Export added in v0.18.0

func (kb *Keybase) Export(name string) (armor string, err error)

Export is a lock protected version of keys.Export

func (*Keybase) ExportPrivKey added in v0.18.0

func (kb *Keybase) ExportPrivKey(name, decryptPassphrase, encryptPassphrase string) (armor string, err error)

ExportPrivKey is a lock protected version of keys.ExportPrivKey

func (*Keybase) ExportPrivateKeyObject added in v0.18.0

func (kb *Keybase) ExportPrivateKeyObject(name string, passphrase string) (crypto.PrivKey, error)

ExportPrivateKeyObject is a lock protected version of keys.ExportPrivateKeyObject

func (*Keybase) ExportPubKey added in v0.18.0

func (kb *Keybase) ExportPubKey(name string) (armor string, err error)

ExportPubKey is a lock protected version of keys.ExportPubKey

func (*Keybase) Get added in v0.18.0

func (kb *Keybase) Get(name string) (keys.Info, error)

Get is a lock protected version of keys.Get

func (*Keybase) GetByAddress added in v0.18.0

func (kb *Keybase) GetByAddress(address types.AccAddress) (keys.Info, error)

GetByAddress is a lock protected version of keys.GetByAddress

func (*Keybase) Import added in v0.18.0

func (kb *Keybase) Import(name, armor string) error

Import is a lock protected version of keys.Import

func (*Keybase) ImportPrivKey added in v0.18.0

func (kb *Keybase) ImportPrivKey(name, armor, passphrase string) error

ImportPrivKey is a lock protected version of keys.ImportPrivKey

func (*Keybase) ImportPubKey added in v0.18.0

func (kb *Keybase) ImportPubKey(name, armor string) (err error)

ImportPubKey is a lock protected version of keys.ImportPubKey

func (*Keybase) List added in v0.18.0

func (kb *Keybase) List() ([]keys.Info, error)

List is a lock protected version of keys.List

func (*Keybase) NewMnemonic added in v0.15.0

func (kb *Keybase) NewMnemonic() (string, error)

NewMnemonic returns a new mnemonic phrase.

func (*Keybase) Sign added in v0.18.0

func (kb *Keybase) Sign(name, passphrase string, msg []byte) ([]byte, crypto.PubKey, error)

Sign is a lock protected version of keys.Sign it also keeps the last private key used in memory for the time set in `keepPrivTime` for performance improvement.

func (*Keybase) SupportedAlgos added in v0.19.0

func (kb *Keybase) SupportedAlgos() []keys.SigningAlgo

SupportedAlgos returns a list of signing algorithms supported by the keybase

func (*Keybase) SupportedAlgosLedger added in v0.19.0

func (kb *Keybase) SupportedAlgosLedger() []keys.SigningAlgo

SupportedAlgosLedger returns a list of signing algorithms supported by the keybase's ledger integration

func (*Keybase) Update added in v0.18.0

func (kb *Keybase) Update(name, oldpass string, getNewpass func() (string, error)) error

Update is a lock protected version of keys.Update

type LCD added in v0.21.0

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

LCD is a simple cosmos LCD client.

func NewLCD added in v0.21.0

func NewLCD(endpoint string, cdc *codec.Codec, kb keys.Keybase, chainID, accName, accPassword, gasPrices string) (*LCD, error)

NewLCD initializes a cosmos LCD client.

func (*LCD) BroadcastMsg added in v0.21.0

func (lcd *LCD) BroadcastMsg(msg sdk.Msg) ([]byte, error)

BroadcastMsg sign and broadcast a transaction from a message.

func (*LCD) BroadcastMsgs added in v0.21.0

func (lcd *LCD) BroadcastMsgs(msgs []sdk.Msg) ([]byte, error)

BroadcastMsgs sign and broadcast a transaction from multiple messages.

func (*LCD) Get added in v0.21.0

func (lcd *LCD) Get(path string, ptr interface{}) error

Get executes a get request on the LCD.

func (*LCD) Post added in v0.21.0

func (lcd *LCD) Post(path string, req interface{}, ptr interface{}) error

Post executes a post request on the LCD. The response is expected to be a ResponseWithHeight that contains the expected result.

func (*LCD) PostBare added in v0.21.0

func (lcd *LCD) PostBare(path string, req interface{}, ptr interface{}) error

PostBare executes a post request on the LCD. There is no expectation on the type of response.

type RPC added in v0.21.0

type RPC struct {
	rpcclient.Client
	// contains filtered or unexported fields
}

RPC is a tendermint rpc client with helper functions.

func NewRPC added in v0.21.0

func NewRPC(client rpcclient.Client, cdc *codec.Codec, kb keys.Keybase, chainID, accName, accPassword, gasPrices string) (*RPC, error)

NewRPC returns a rpc tendermint client.

func (*RPC) BuildAndBroadcastMsg added in v0.21.0

func (c *RPC) BuildAndBroadcastMsg(msg sdktypes.Msg) (*abci.ResponseDeliverTx, error)

BuildAndBroadcastMsg builds and signs message and broadcast it to node.

func (*RPC) Codec added in v0.21.0

func (c *RPC) Codec() *codec.Codec

Codec returns the codec used by RPC.

func (*RPC) GetAccount added in v0.21.0

func (c *RPC) GetAccount() (authExported.Account, error)

GetAccount returns the local account.

func (*RPC) QueryJSON added in v0.21.0

func (c *RPC) QueryJSON(path string, qdata, ptr interface{}) error

QueryJSON is abci.query wrapper with errors check and decode data.

func (*RPC) QueryWithData added in v0.21.0

func (c *RPC) QueryWithData(path string, data []byte) ([]byte, int64, error)

QueryWithData performs a query to a Tendermint node with the provided path and a data payload. It returns the result and height of the query upon success or an error if the query fails.

type SimulateReq added in v0.23.0

type SimulateReq struct {
	BaseReq rest.BaseReq `json:"base_req" yaml:"base_req"`
	Msgs    []sdk.Msg    `json:"msgs" yaml:"msgs"`
}

SimulateReq defines the properties of a send request's body.

Jump to

Keyboard shortcuts

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