cosmos

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2019 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNode

func NewNode(app *App, kb *Keybase, cfg *tmconfig.Config, ccfg *config.CosmosConfig) (*node.Node, error)

NewNode creates a new Tendermint node from an App.

Types

type App

type App struct {
	*baseapp.BaseApp
	// contains filtered or unexported fields
}

App is a loaded Cosmos application that inherit from BaseApp.

func NewApp

func NewApp(factory *AppFactory) (*App, error)

NewApp initializes a new App.

func (*App) Cdc

func (a *App) Cdc() *codec.Codec

Cdc returns the codec of the app.

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

func NewAppFactory(logger log.Logger, db dbm.DB) *AppFactory

NewAppFactory returns a new AppFactory.

func (*AppFactory) Cdc

func (a *AppFactory) Cdc() *codec.Codec

Cdc returns the codec of the app.

func (*AppFactory) DeliverTx

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, cdc *codec.Codec, handler sdk.Handler, querier Querier) AppModule

NewAppModule inits an AppModule using an AppModuleBasic, Codec, Handler and Querier.

func (AppModule) BeginBlock

func (m AppModule) BeginBlock(_ sdk.Request, _ abci.RequestBeginBlock)

BeginBlock is called at the beginning of the process of a new block.

func (AppModule) EndBlock

EndBlock is called at the end of the process of a new block.

func (AppModule) ExportGenesis

func (m AppModule) ExportGenesis(request sdk.Request) json.RawMessage

ExportGenesis exports the current state of the app.

func (AppModule) InitGenesis

func (m AppModule) InitGenesis(request sdk.Request, data json.RawMessage) []abci.ValidatorUpdate

InitGenesis initializes the genesis from a request and data.

func (AppModule) NewHandler

func (m AppModule) NewHandler() sdk.Handler

NewHandler returns the handler used to apply transactions.

func (AppModule) NewQuerierHandler

func (m AppModule) NewQuerierHandler() sdk.Querier

NewQuerierHandler returns the handler used to reply ABCI query.

func (AppModule) QuerierRoute

func (m AppModule) QuerierRoute() string

QuerierRoute the route prefix for query of the module.

func (AppModule) RegisterInvariants

func (m AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

RegisterInvariants registers invariants to the registry.

func (AppModule) Route

func (m AppModule) Route() string

Route returns the route prefix for transaction of the module.

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 *codec.Codec) *cobra.Command

GetQueryCmd returns the root query command of this module

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd(cdc *codec.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 *codec.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

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

Client is a tendermint client with helper functions.

func NewClient

func NewClient(node *node.Node, cdc *codec.Codec, kb keys.Keybase, chainID string) *Client

New returns a rpc tendermint client.

func (*Client) BuildAndBroadcastMsg

func (c *Client) BuildAndBroadcastMsg(msg sdktypes.Msg, accName, accPassword string, accNumber, accSeq uint64) (*tenderminttypes.TxResult, error)

BuildAndBroadcastMsg builds and signs message and broadcast it to node.

func (*Client) QueryWithData

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

QueryWithData is abci.query wraper with errors check. It retruns slice of bytes, height and an error.

type Keybase

type Keybase struct {
	keys.Keybase
}

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) GenerateAccount

func (kb *Keybase) GenerateAccount(name, mnemonic, password string) (keys.Info, error)

GenerateAccount creates an account.

type Querier

type Querier func(request sdk.Request, path []string, req abci.RequestQuery) (res interface{}, err error)

Querier is responsible to answer to ABCI queries.

type TxBuilder

type TxBuilder struct {
	authtypes.TxBuilder
}

TxBuilder implements a transaction context created in SDK modules.

func NewTxBuilder

func NewTxBuilder(cdc *codec.Codec, accNumber, accSeq uint64, kb keys.Keybase, chainID string) 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.

func (TxBuilder) Encode

func (b TxBuilder) Encode(tx sdktypes.Tx) (types.Tx, error)

Encode a transaction.

Jump to

Keyboard shortcuts

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