cosmos

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2020 License: Apache-2.0 Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AttributeKeyHash = "hash"
)

common attribute keys.

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

Variables

EventHashType is a message with resource hash

Functions

func CustomizeConfig added in v0.18.1

func CustomizeConfig(engineCfg *config.Config)

CustomizeConfig customizes the cosmos application like addresses prefixes and coin type

func EventActionQuery added in v0.17.0

func EventActionQuery(msgType string) string

EventActionQuery returns tendermint query which matches given message type.

func EventModuleQuery added in v0.17.0

func EventModuleQuery(module string) string

EventModuleQuery returns tendermint query which matches given module.

func GenGenesis added in v0.16.0

func GenGenesis(cdc *codec.Codec, kb *Keybase, defaultGenesisŚtate map[string]json.RawMessage, chainID, initialBalances, validatorDelegationCoin, 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 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 Client

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

Client is a tendermint client with helper functions.

func NewClient

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

NewClient returns a rpc tendermint client.

func (*Client) BuildAndBroadcastMsg

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

BuildAndBroadcastMsg builds and signs message and broadcast it to node.

func (*Client) CreateAndSignTx added in v0.20.0

func (c *Client) CreateAndSignTx(msgs []sdktypes.Msg) (tenderminttypes.Tx, error)

CreateAndSignTx build and sign a msg with client account.

func (*Client) GetAccount added in v0.18.0

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

GetAccount returns the local account.

func (*Client) QueryJSON added in v0.19.0

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

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

func (*Client) QueryWithData

func (c *Client) 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.

func (*Client) Stream added in v0.17.0

func (c *Client) Stream(ctx context.Context, query string) (chan hash.Hash, chan error, error)

Stream subscribes to the provided query and returns the hash of the matching ressources.

type FilterRunner added in v0.19.0

type FilterRunner struct {
	Owner        string
	InstanceHash hash.Hash
}

FilterRunner to apply while listing runners.

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 ModuleClient added in v0.19.0

type ModuleClient struct {
	*Client
}

ModuleClient handles all communication with every module.

func NewModuleClient added in v0.19.0

func NewModuleClient(c *Client) *ModuleClient

NewModuleClient creates new module client.

func (*ModuleClient) CreateExecution added in v0.19.0

func (mc *ModuleClient) CreateExecution(req *api.CreateExecutionRequest) (*executionpb.Execution, error)

CreateExecution creates a new execution.

func (*ModuleClient) CreateProcess added in v0.19.0

func (mc *ModuleClient) CreateProcess(req *api.CreateProcessRequest) (*processpb.Process, error)

CreateProcess creates a new process.

func (*ModuleClient) CreateRunner added in v0.19.0

func (mc *ModuleClient) CreateRunner(req *api.CreateRunnerRequest) (*runnerpb.Runner, error)

CreateRunner creates a new runner.

func (*ModuleClient) CreateService added in v0.19.0

func (mc *ModuleClient) CreateService(req *api.CreateServiceRequest) (*servicepb.Service, error)

CreateService creates a new service from definition.

func (*ModuleClient) DeleteProcess added in v0.19.0

func (mc *ModuleClient) DeleteProcess(req *api.DeleteProcessRequest) error

DeleteProcess deletes the process by hash.

func (*ModuleClient) DeleteRunner added in v0.19.0

func (mc *ModuleClient) DeleteRunner(req *api.DeleteRunnerRequest) error

DeleteRunner deletes an existing runner.

func (*ModuleClient) ExistService added in v0.19.0

func (mc *ModuleClient) ExistService(hash hash.Hash) (bool, error)

ExistService returns if a service already exists.

func (*ModuleClient) GetExecution added in v0.19.0

func (mc *ModuleClient) GetExecution(hash hash.Hash) (*executionpb.Execution, error)

GetExecution returns the execution that matches given hash.

func (*ModuleClient) GetInstance added in v0.19.0

func (mc *ModuleClient) GetInstance(hash hash.Hash) (*instancepb.Instance, error)

GetInstance returns the instance that matches given hash.

func (*ModuleClient) GetProcess added in v0.19.0

func (mc *ModuleClient) GetProcess(hash hash.Hash) (*processpb.Process, error)

GetProcess returns the process that matches given hash.

func (*ModuleClient) GetRunner added in v0.19.0

func (mc *ModuleClient) GetRunner(hash hash.Hash) (*runnerpb.Runner, error)

GetRunner returns the runner that matches given hash.

func (*ModuleClient) GetService added in v0.19.0

func (mc *ModuleClient) GetService(hash hash.Hash) (*servicepb.Service, error)

GetService returns the service that matches given hash.

func (*ModuleClient) HashService added in v0.19.0

func (mc *ModuleClient) HashService(req *api.CreateServiceRequest) (hash.Hash, error)

HashService returns the calculate hash of a service.

func (*ModuleClient) ListExecution added in v0.19.0

func (mc *ModuleClient) ListExecution() ([]*executionpb.Execution, error)

ListExecution returns all executions.

func (*ModuleClient) ListInstance added in v0.19.0

func (mc *ModuleClient) ListInstance(req *api.ListInstanceRequest) ([]*instancepb.Instance, error)

ListInstance returns all instances.

func (*ModuleClient) ListOwnership added in v0.19.0

func (mc *ModuleClient) ListOwnership() ([]*ownershippb.Ownership, error)

ListOwnership returns all ownerships.

func (*ModuleClient) ListProcess added in v0.19.0

func (mc *ModuleClient) ListProcess() ([]*processpb.Process, error)

ListProcess returns all processes.

func (*ModuleClient) ListRunner added in v0.19.0

func (mc *ModuleClient) ListRunner(f *FilterRunner) ([]*runnerpb.Runner, error)

ListRunner returns all runners.

func (*ModuleClient) ListService added in v0.19.0

func (mc *ModuleClient) ListService() ([]*servicepb.Service, error)

ListService returns all services.

func (*ModuleClient) StreamExecution added in v0.19.0

func (mc *ModuleClient) StreamExecution(ctx context.Context, req *api.StreamExecutionRequest) (chan *executionpb.Execution, chan error, error)

StreamExecution returns execution that matches given hash.

func (*ModuleClient) UpdateExecution added in v0.19.0

func (mc *ModuleClient) UpdateExecution(req *api.UpdateExecutionRequest) (*executionpb.Execution, error)

UpdateExecution updates a execution.

Jump to

Keyboard shortcuts

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