Documentation ¶
Index ¶
- Constants
- Variables
- func CustomizeConfig()
- func EventActionQuery(msgType string) string
- func EventModuleQuery(module string) string
- func GenGenesis(kb *Keybase, defaultGenesisŚtate map[string]json.RawMessage, ...) (*tmtypes.GenesisDoc, error)
- func GenesisExist(genesisFile string) bool
- func LoadGenesis(genesisFile string) (*tmtypes.GenesisDoc, error)
- func NewMesgErrorf(ct types.CodeType, format string, a ...interface{}) types.Error
- func NewMesgWrapError(ct types.CodeType, err error) types.Error
- func NewNode(app *App, cfg *tmconfig.Config, genesis *types.GenesisDoc) (*node.Node, error)
- type App
- type AppFactory
- func (a *AppFactory) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx
- func (a *AppFactory) RegisterModule(module module.AppModule)
- func (a *AppFactory) RegisterOrderBeginBlocks(beginBlockers ...string)
- func (a *AppFactory) RegisterOrderEndBlocks(endBlockers ...string)
- func (a *AppFactory) RegisterOrderInitGenesis(moduleNames ...string)
- func (a *AppFactory) RegisterStoreKey(storeKey *sdk.KVStoreKey)
- func (a *AppFactory) RegisterTransientStoreKey(transientStoreKey *sdk.TransientStoreKey)
- func (a *AppFactory) SetAnteHandler(anteHandler sdk.AnteHandler)
- type AppModule
- func (m AppModule) BeginBlock(_ cosmostypes.Request, _ abci.RequestBeginBlock)
- func (m AppModule) EndBlock(cosmostypes.Request, abci.RequestEndBlock) []abci.ValidatorUpdate
- func (m AppModule) ExportGenesis(request cosmostypes.Request) json.RawMessage
- func (m AppModule) InitGenesis(request cosmostypes.Request, data json.RawMessage) []abci.ValidatorUpdate
- func (m AppModule) NewHandler() cosmostypes.Handler
- func (m AppModule) NewQuerierHandler() cosmostypes.Querier
- func (m AppModule) QuerierRoute() string
- func (m AppModule) RegisterInvariants(ir cosmostypes.InvariantRegistry)
- func (m AppModule) Route() string
- type AppModuleBasic
- func (AppModuleBasic) DefaultGenesis() json.RawMessage
- func (AppModuleBasic) GetQueryCmd(cdc *cosmoscodec.Codec) *cobra.Command
- func (AppModuleBasic) GetTxCmd(cdc *cosmoscodec.Codec) *cobra.Command
- func (m AppModuleBasic) Name() string
- func (AppModuleBasic) RegisterCodec(cdc *cosmoscodec.Codec)
- func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
- func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
- type Client
- func (c *Client) BuildAndBroadcastMsg(msg sdktypes.Msg) (*abci.ResponseDeliverTx, error)
- func (c *Client) GetAccount() (auth.Account, error)
- func (c *Client) Query(path string, qdata, ptr interface{}) error
- func (c *Client) QueryWithData(path string, data []byte) ([]byte, int64, error)
- func (c *Client) Stream(ctx context.Context, query string) (chan hash.Hash, chan error, error)
- type GenesisValidator
- type Handler
- type Keybase
- func (kb *Keybase) CloseDB()
- func (kb *Keybase) CreateAccount(name, mnemonic, bip39Passwd, encryptPasswd string, account, index uint32) (keys.Info, error)
- func (kb *Keybase) CreateLedger(name string, algo keys.SigningAlgo, hrp string, account, index uint32) (keys.Info, error)
- func (kb *Keybase) CreateMnemonic(name string, language keys.Language, passwd string, algo keys.SigningAlgo) (keys.Info, string, error)
- func (kb *Keybase) CreateMulti(name string, pubkey crypto.PubKey) (keys.Info, error)
- func (kb *Keybase) CreateOffline(name string, pubkey crypto.PubKey) (keys.Info, error)
- func (kb *Keybase) Delete(name, passphrase string, skipPass bool) error
- func (kb *Keybase) Derive(name, mnemonic, bip39Passwd, encryptPasswd string, params hd.BIP44Params) (keys.Info, error)
- func (kb *Keybase) Exist(name string) (bool, error)
- func (kb *Keybase) Export(name string) (armor string, err error)
- func (kb *Keybase) ExportPrivKey(name, decryptPassphrase, encryptPassphrase string) (armor string, err error)
- func (kb *Keybase) ExportPrivateKeyObject(name string, passphrase string) (crypto.PrivKey, error)
- func (kb *Keybase) ExportPubKey(name string) (armor string, err error)
- func (kb *Keybase) Get(name string) (keys.Info, error)
- func (kb *Keybase) GetByAddress(address types.AccAddress) (keys.Info, error)
- func (kb *Keybase) Import(name, armor string) error
- func (kb *Keybase) ImportPrivKey(name, armor, passphrase string) error
- func (kb *Keybase) ImportPubKey(name, armor string) (err error)
- func (kb *Keybase) List() ([]keys.Info, error)
- func (kb *Keybase) NewMnemonic() (string, error)
- func (kb *Keybase) Sign(name, passphrase string, msg []byte) ([]byte, crypto.PubKey, error)
- func (kb *Keybase) Update(name, oldpass string, getNewpass func() (string, error)) error
- type Querier
- type TxBuilder
Constants ¶
const ( // Bech32MainPrefix defines the main Bech32 prefix Bech32MainPrefix = "mesgtest" // CoinType is the mesg registered coin type from https://github.com/satoshilabs/slips/blob/master/slip-0044.md. CoinType = 470 // BIP44Prefix is the parts of the BIP44 HD path that are fixed by // what we used during the fundraiser. FullFundraiserPath = "44'/470'/0'/0/0" // Bech32PrefixAccAddr defines the Bech32 prefix of an account's address Bech32PrefixAccAddr = Bech32MainPrefix // Bech32PrefixAccPub defines the Bech32 prefix of an account's public key Bech32PrefixAccPub = Bech32MainPrefix + sdktypes.PrefixPublic // Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address Bech32PrefixValAddr = Bech32MainPrefix + sdktypes.PrefixValidator + sdktypes.PrefixOperator // Bech32PrefixValPub defines the Bech32 prefix of a validator's operator public key Bech32PrefixValPub = Bech32MainPrefix + sdktypes.PrefixValidator + sdktypes.PrefixOperator + sdktypes.PrefixPublic // Bech32PrefixConsAddr defines the Bech32 prefix of a consensus node address Bech32PrefixConsAddr = Bech32MainPrefix + sdktypes.PrefixValidator + sdktypes.PrefixConsensus // Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key Bech32PrefixConsPub = Bech32MainPrefix + sdktypes.PrefixValidator + sdktypes.PrefixConsensus + sdktypes.PrefixPublic )
See github.com/cosmos/cosmos-sdk/types/address.go
const ( CodeInternal types.CodeType = 1000 CodeValidation types.CodeType = 2000 )
Base mesg codes.
const (
AttributeKeyHash = "hash"
)
common attribute keys.
const ( // CodespaceMesg is a cosmos codespace for all mesg errors. CodespaceMesg types.CodespaceType = "mesg" )
Variables ¶
var EventHashType = sdktypes.EventTypeMessage + "." + AttributeKeyHash
EventHashType is a message with resource hash
Functions ¶
func CustomizeConfig ¶ added in v0.18.1
func CustomizeConfig()
CustomizeConfig customizes the cosmos application like addresses prefixes and coin type
func EventActionQuery ¶ added in v0.17.0
EventActionQuery returns tendermint query which matches given message type.
func EventModuleQuery ¶ added in v0.17.0
EventModuleQuery returns tendermint query which matches given module.
func GenGenesis ¶ added in v0.16.0
func GenGenesis(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
GenesisExist returns true if the genesis file already exists.
func LoadGenesis ¶ added in v0.16.0
func LoadGenesis(genesisFile string) (*tmtypes.GenesisDoc, error)
LoadGenesis loads a genesis from a file.
func NewMesgErrorf ¶ added in v0.18.0
NewMesgErrorf creates error with given code type and mesg codespace.
func NewMesgWrapError ¶ added in v0.18.0
NewMesgWrapError creates error with given code type and mesg codespace.
Types ¶
type App ¶
App is a loaded Cosmos application that inherit from BaseApp.
func (*App) BasicManager ¶ added in v0.18.1
func (a *App) BasicManager() module.BasicManager
BasicManager returns app basic manager.
func (*App) DefaultGenesis ¶
func (a *App) DefaultGenesis() map[string]json.RawMessage
DefaultGenesis returns the default genesis from the basic manager.
type AppFactory ¶
type AppFactory struct {
// contains filtered or unexported fields
}
AppFactory is a Cosmos application factory.
func NewAppFactory ¶
NewAppFactory returns a new AppFactory.
func (*AppFactory) DeliverTx ¶
func (a *AppFactory) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx
DeliverTx implement baseApp.DeliverTx
func (*AppFactory) RegisterModule ¶
func (a *AppFactory) RegisterModule(module module.AppModule)
RegisterModule registers a module to the app.
func (*AppFactory) RegisterOrderBeginBlocks ¶
func (a *AppFactory) RegisterOrderBeginBlocks(beginBlockers ...string)
RegisterOrderBeginBlocks sets the order of the modules when they are called on the begin block event.
func (*AppFactory) RegisterOrderEndBlocks ¶
func (a *AppFactory) RegisterOrderEndBlocks(endBlockers ...string)
RegisterOrderEndBlocks sets the order of the modules when they are called on the end block event.
func (*AppFactory) RegisterOrderInitGenesis ¶
func (a *AppFactory) RegisterOrderInitGenesis(moduleNames ...string)
RegisterOrderInitGenesis sets the order of the modules when they are called to initialize the genesis.
func (*AppFactory) RegisterStoreKey ¶
func (a *AppFactory) RegisterStoreKey(storeKey *sdk.KVStoreKey)
RegisterStoreKey registers a store key to the app.
func (*AppFactory) RegisterTransientStoreKey ¶
func (a *AppFactory) RegisterTransientStoreKey(transientStoreKey *sdk.TransientStoreKey)
RegisterTransientStoreKey registers a transient store key to the app.
func (*AppFactory) SetAnteHandler ¶
func (a *AppFactory) SetAnteHandler(anteHandler sdk.AnteHandler)
SetAnteHandler registers the authentication handler to the app.
type AppModule ¶
type AppModule struct { AppModuleBasic // contains filtered or unexported fields }
AppModule is a main element of an cosmos app.
func NewAppModule ¶
func NewAppModule(moduleBasic AppModuleBasic, handler Handler, querier Querier) AppModule
NewAppModule inits an AppModule using an AppModuleBasic, Handler and Querier.
func (AppModule) BeginBlock ¶
func (m AppModule) BeginBlock(_ cosmostypes.Request, _ abci.RequestBeginBlock)
BeginBlock is called at the beginning of the process of a new block.
func (AppModule) EndBlock ¶
func (m AppModule) EndBlock(cosmostypes.Request, abci.RequestEndBlock) []abci.ValidatorUpdate
EndBlock is called at the end of the process of a new block.
func (AppModule) ExportGenesis ¶
func (m AppModule) ExportGenesis(request cosmostypes.Request) json.RawMessage
ExportGenesis exports the current state of the app.
func (AppModule) InitGenesis ¶
func (m AppModule) InitGenesis(request cosmostypes.Request, data json.RawMessage) []abci.ValidatorUpdate
InitGenesis initializes the genesis from a request and data.
func (AppModule) NewHandler ¶
func (m AppModule) NewHandler() cosmostypes.Handler
NewHandler returns the handler used to apply transactions.
func (AppModule) NewQuerierHandler ¶
func (m AppModule) NewQuerierHandler() cosmostypes.Querier
NewQuerierHandler returns the handler used to reply ABCI query.
func (AppModule) QuerierRoute ¶
QuerierRoute the route prefix for query of the module.
func (AppModule) RegisterInvariants ¶
func (m AppModule) RegisterInvariants(ir cosmostypes.InvariantRegistry)
RegisterInvariants registers invariants to the registry.
type AppModuleBasic ¶
type AppModuleBasic struct {
// contains filtered or unexported fields
}
AppModuleBasic is a basic element of an cosmos app.
func NewAppModuleBasic ¶
func NewAppModuleBasic(name string) AppModuleBasic
NewAppModuleBasic inits an AppModuleBasic using a name.
func (AppModuleBasic) DefaultGenesis ¶
func (AppModuleBasic) DefaultGenesis() json.RawMessage
DefaultGenesis returns the default genesis of the module.
func (AppModuleBasic) GetQueryCmd ¶
func (AppModuleBasic) GetQueryCmd(cdc *cosmoscodec.Codec) *cobra.Command
GetQueryCmd returns the root query command of this module
func (AppModuleBasic) GetTxCmd ¶
func (AppModuleBasic) GetTxCmd(cdc *cosmoscodec.Codec) *cobra.Command
GetTxCmd returns the root tx command of this module
func (AppModuleBasic) Name ¶
func (m AppModuleBasic) Name() string
Name returns the name of the module.
func (AppModuleBasic) RegisterCodec ¶
func (AppModuleBasic) RegisterCodec(cdc *cosmoscodec.Codec)
RegisterCodec registers the module's structs in the codec.
func (AppModuleBasic) RegisterRESTRoutes ¶
func (AppModuleBasic) RegisterRESTRoutes(ctx context.CLIContext, rtr *mux.Router)
RegisterRESTRoutes registers rest routes
func (AppModuleBasic) ValidateGenesis ¶
func (AppModuleBasic) ValidateGenesis(bz json.RawMessage) error
ValidateGenesis checks a Genesis.
type Client ¶
Client is a tendermint client with helper functions.
func NewClient ¶
func NewClient(node *node.Node, kb keys.Keybase, chainID, accName, accPassword, minGasPrices string) *Client
NewClient returns a rpc tendermint client.
func (*Client) BuildAndBroadcastMsg ¶
BuildAndBroadcastMsg builds and signs message and broadcast it to node.
func (*Client) GetAccount ¶ added in v0.18.0
GetAccount returns the local account.
func (*Client) Query ¶ added in v0.15.0
Query is abci.query wrapper with errors check and decode data.
func (*Client) QueryWithData ¶
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 GenesisValidator ¶ added in v0.16.0
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 Handler ¶ added in v0.17.0
type Handler func(request cosmostypes.Request, msg cosmostypes.Msg) (hash.Hash, error)
Handler defines the core of the state transition function of an application.
type Keybase ¶
type Keybase struct {
// contains filtered or unexported fields
}
Keybase is a standard cosmos keybase.
func NewKeybase ¶
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 string, account, index uint32) (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
CreateMulti is a lock protected version of keys.CreateMulti
func (*Keybase) CreateOffline ¶ added in v0.18.0
CreateOffline is a lock protected version of keys.CreateOffline
func (*Keybase) Derive ¶ added in v0.18.0
func (kb *Keybase) Derive(name, mnemonic, bip39Passwd, encryptPasswd string, params hd.BIP44Params) (keys.Info, error)
Derive is a lock protected version of keys.Derive
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
ExportPrivateKeyObject is a lock protected version of keys.ExportPrivateKeyObject
func (*Keybase) ExportPubKey ¶ added in v0.18.0
ExportPubKey is a lock protected version of keys.ExportPubKey
func (*Keybase) GetByAddress ¶ added in v0.18.0
GetByAddress is a lock protected version of keys.GetByAddress
func (*Keybase) ImportPrivKey ¶ added in v0.18.0
ImportPrivKey is a lock protected version of keys.ImportPrivKey
func (*Keybase) ImportPubKey ¶ added in v0.18.0
ImportPubKey is a lock protected version of keys.ImportPubKey
func (*Keybase) NewMnemonic ¶ added in v0.15.0
NewMnemonic returns a new mnemonic phrase.
type Querier ¶
type Querier func(request cosmostypes.Request, path []string, req abci.RequestQuery) (res interface{}, err error)
Querier is responsible to answer to ABCI queries.
type TxBuilder ¶
TxBuilder implements a transaction context created in SDK modules.
func NewTxBuilder ¶
func NewTxBuilder(accNumber, accSeq uint64, kb keys.Keybase, chainID string, minGasPrices sdktypes.DecCoins) TxBuilder
NewTxBuilder returns a new initialized TxBuilder.
func (TxBuilder) BuildAndSignStdTx ¶
func (b TxBuilder) BuildAndSignStdTx(msg sdktypes.Msg, accountName, accountPassword string) (authtypes.StdTx, error)
BuildAndSignStdTx a signed transaction from a message.