cosmos

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2020 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultAlgo for create account.
	DefaultAlgo = keys.Secp256k1
)

Variables

This section is empty.

Functions

func GenGenesis added in v0.16.0

func GenGenesis(cdc *codec.Codec, kb *Keybase, defaultGenesisŚtate map[string]json.RawMessage, chainID, initialBalances, genesisFile string, validators []GenesisValidator) (*tmtypes.GenesisDoc, error)

GenGenesis generates a new genesis and save it.

func GenesisExist added in v0.16.0

func GenesisExist(genesisFile string) bool

GenesisExist returns true if the genesis file already exists.

func InitConfig added in v0.21.0

func InitConfig()

InitConfig sets the bech32 prefix and HDPath to cosmos config.

func LoadGenesis added in v0.16.0

func LoadGenesis(genesisFile string) (*tmtypes.GenesisDoc, error)

LoadGenesis loads a genesis from a file.

func NewNode

func NewNode(app *bam.BaseApp, cfg *tmconfig.Config, genesis *types.GenesisDoc) (*node.Node, error)

NewNode creates a new Tendermint node from an App.

Types

type GenesisValidator added in v0.16.0

type GenesisValidator struct {
	Name      string
	Password  string
	ValPubKey crypto.PubKey
	NodeID    p2p.ID
}

GenesisValidator holds the info of a specific validator to use to generate a genesis.

func NewGenesisValidator added in v0.16.0

func NewGenesisValidator(kb *Keybase, name, password, privValidatorKeyFile, privValidatorStateFile, nodeKeyFile string) (GenesisValidator, error)

NewGenesisValidator creates a new validator with an cosmos account, validator and node identity.

type Keybase

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

Keybase is a standard cosmos 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, minGasPrices string, gasLimit uint64) (*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, minGasPrices 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.

Jump to

Keyboard shortcuts

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