app

package
v0.0.0-...-21d70e9 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 63 Imported by: 4

Documentation

Index

Constants

View Source
const (
	AppVersion = "RC-0.11.1"
)
View Source
const (
	ReadInError = `An error occurred reading in the information: `
)

Variables

View Source
var (

	// the default fileseparator based on OS
	FS = string(fp.Separator)
	// app instance currently running
	PCA *PocketCoreApp
	// config
	GlobalConfig sdk.Config

	// global genesis type
	GlobalGenesisType GenesisType
	// current authToken for secured rpc calls
	AuthToken sdk.AuthToken
)
View Source
var (
	UninitializedKeybaseError = errors.New(`no Keys stored in keybase, create a key pair by using "./main accounts create"`)
	InvalidChainsError        = errors.New("the chains.json file input is invalid")
)

Functions

func BuildMultisig

func BuildMultisig(fromAddr, jsonMessage, passphrase, chainID string, pk crypto.PublicKeyMultiSig, fees int64, legacyCodec bool) ([]byte, error)

func Codec

func Codec() *codec.Codec

func Confirmation

func Confirmation(pwd string) bool

func Credentials

func Credentials(pwd string) string

func DeleteHostedChains

func DeleteHostedChains()

func GenerateAAT

func GenerateAAT(appPubKey, clientPubKey string, appPrivKey crypto.PrivateKey) (aatjson []byte, err error)

GenerateAAT generates an AAT to be used for relay request authentication. - appPubKey is the public key of the application that's staking for on-chain service. - clientPubKey is the public key of a client facilitating relays on behalf of the app. - appPubKey and clientPubKey may or may not be the same.

func GenerateHostedChains

func GenerateHostedChains() (chains []types.HostedBlockchain)

func GenerateToken

func GenerateToken()

func GenesisFileToGenDoc

func GenesisFileToGenDoc(genFile string) *tmtypes.GenesisDoc

func GenesisStateFromGenDoc

func GenesisStateFromGenDoc(cdc *codec.Codec, genDoc tmtypes.GenesisDoc) (genesisState map[string]json.RawMessage)

func GetAuthTokenFromFile

func GetAuthTokenFromFile() sdk.AuthToken

func GetDefaultConfig

func GetDefaultConfig(datadir string) string

func GetKeybase

func GetKeybase() (kb.Keybase, error)

get the global keybase

func GetPrivValFile

func GetPrivValFile() (file privval.FilePVKey)

func HotReloadChains

func HotReloadChains(chains *types.HostedBlockchains)

func InitApp

func InitApp(datadir, tmNode, persistentPeers, seeds, remoteCLIURL string, keybase bool, genesisType GenesisType, useCache bool, forceSetValidatorsLean bool) *node.Node

func InitAuthToken

func InitAuthToken(generateToken bool)

func InitConfig

func InitConfig(datadir, tmNode, persistentPeers, seeds, remoteCLIURL string)

func InitGenesis

func InitGenesis(genesisType GenesisType, logger log.Logger)

func InitKeyfiles

func InitKeyfiles(logger log.Logger)

func InitLogger

func InitLogger() (logger log.Logger)

func InitNodesLean

func InitNodesLean(logger log.Logger) error

func InitPocketCoreConfig

func InitPocketCoreConfig(chains *types.HostedBlockchains, logger log.Logger)

func InitTendermint

func InitTendermint(keybase bool, chains *types.HostedBlockchains, logger log.Logger) *node.Node

func LoadFilePVKeysFromFileLean

func LoadFilePVKeysFromFileLean(path string) ([]privval.FilePVKey, error)

func MakeCodec

func MakeCodec()

func MustGetKeybase

func MustGetKeybase() kb.Keybase

get the global keybase

func NewHostedChains

func NewHostedChains(generate bool) *types.HostedBlockchains

get the hosted chains variable

func NewInvalidChainsError

func NewInvalidChainsError(err error) error

func OpenApplicationDB

func OpenApplicationDB(config sdk.Config) (dbm.DB, error)

func OpenTxIndexerDB

func OpenTxIndexerDB(config sdk.Config) (dbm.DB, error)

func ReadValidatorPrivateKeyFileLean

func ReadValidatorPrivateKeyFileLean(filePath string) ([]crypto.PrivateKey, error)

func ReloadValidatorKeys

func ReloadValidatorKeys(c config, tmNode *node.Node) error

func ResetAll

func ResetAll(dbDir, addrBookFile, privValKeyFile, privValStateFile string, logger log.Logger)

ResetAll removes address book files plus all data, and resets the privValidator data. Exported so other CLI tools can use it.

func ResetWorldState

func ResetWorldState(cmd *cobra.Command, args []string)

XXX: this is totally unsafe. it's only suitable for testnets.

func SetValidator

func SetValidator(address sdk.Address, passphrase string)

func SetValidatorsFilesLean

func SetValidatorsFilesLean(keys []crypto.PrivateKey) error

func SetValidatorsFilesWithPeerLean

func SetValidatorsFilesWithPeerLean(keys []crypto.PrivateKey, address string) error

func ShutdownPocketCore

func ShutdownPocketCore()

func SignMultisigNext

func SignMultisigNext(fromAddr, txHex, passphrase, chainID string, legacyCodec bool) ([]byte, error)

func SignMultisigOutOfOrder

func SignMultisigOutOfOrder(fromAddr, txHex, passphrase, chainID string, keys []crypto.PublicKey, legacyCodec bool) ([]byte, error)

func SortJSON

func SortJSON(toSortJSON []byte) string

func UnmarshalTx

func UnmarshalTx(txBytes []byte, height int64) (types.StdTx, error)

func UnmarshalTxStr

func UnmarshalTxStr(txStr string, height int64) (types.StdTx, error)

func UpdateConfig

func UpdateConfig(datadir string)

Types

type AllParamsReturn

type AllParamsReturn struct {
	AppParams    []SingleParamReturn `json:"app_params"`
	NodeParams   []SingleParamReturn `json:"node_params"`
	PocketParams []SingleParamReturn `json:"pocket_params"`
	GovParams    []SingleParamReturn `json:"gov_params"`
	AuthParams   []SingleParamReturn `json:"auth_params"`
}

type AppCreator

type AppCreator func(log.Logger, dbm.DB, io.Writer) *PocketCoreApp

type Config

type Config struct {
	TmConfig    *config2.Config
	Logger      log.Logger
	TraceWriter string
}

type GenesisState

type GenesisState map[string]json.RawMessage
var GenState GenesisState

func GenesisStateFromFile

func GenesisStateFromFile(cdc *codec.Codec, genFile string) GenesisState

func GenesisStateFromJson

func GenesisStateFromJson(json string) GenesisState

type GenesisType

type GenesisType int
const (
	MainnetGenesisType GenesisType = iota + 1
	TestnetGenesisType
	DefaultGenesisType
)

type Page

type Page struct {
	Result interface{} `json:"result"`
	Total  int         `json:"total_pages"`
	Page   int         `json:"page"`
}

func (Page) JSON

func (p Page) JSON() (out []byte, err error)

Marshals struct into JSON

func (Page) String

func (p Page) String() string

String returns a human readable string representation of a validator page

type PocketCoreApp

type PocketCoreApp struct {
	// extends baseapp
	*bam.BaseApp

	// Keys to access the substores
	Keys  map[string]*sdk.KVStoreKey
	Tkeys map[string]*sdk.TransientStoreKey
	// contains filtered or unexported fields
}

pocket core is an extension of baseapp

func NewClient

func NewClient(c config, creator AppCreator) (*node.Node, *PocketCoreApp, error)

func NewPocketBaseApp

func NewPocketBaseApp(logger log.Logger, db db.DB, cache bool, iavlCacheSize int64, options ...func(*bam.BaseApp)) *PocketCoreApp

new pocket core base

func NewPocketCoreApp

func NewPocketCoreApp(genState GenesisState, keybase keys.Keybase, tmClient client.Client, hostedChains *pocketTypes.HostedBlockchains, logger log.Logger, db dbm.DB, cache bool, iavlCacheSize int64, baseAppOptions ...func(*bam.BaseApp)) *PocketCoreApp

NewPocketCoreApp is a constructor function for PocketCoreApp

func (*PocketCoreApp) BeginBlocker

func (app *PocketCoreApp) BeginBlocker(ctx sdk.Ctx, req abci.RequestBeginBlock) abci.ResponseBeginBlock

setups all of the begin blockers for each module

func (*PocketCoreApp) EndBlocker

func (app *PocketCoreApp) EndBlocker(ctx sdk.Ctx, req abci.RequestEndBlock) abci.ResponseEndBlock

setups all of the end blockers for each module

func (*PocketCoreApp) ExportAppState

func (app *PocketCoreApp) ExportAppState(height int64, forZeroHeight bool, jailWhiteList []string) (appState json.RawMessage, err error)

exports the app state to json

func (*PocketCoreApp) ExportState

func (app *PocketCoreApp) ExportState(height int64, chainID string) (string, error)

func (*PocketCoreApp) GetClient

func (app *PocketCoreApp) GetClient() client.Client

func (PocketCoreApp) HandleChallenge

func (PocketCoreApp) HandleDispatch

func (app PocketCoreApp) HandleDispatch(header pocketTypes.SessionHeader) (res *pocketTypes.DispatchResponse, err error)

func (PocketCoreApp) HandleRelay

func (app PocketCoreApp) HandleRelay(r pocketTypes.Relay) (res *pocketTypes.RelayResponse, dispatch *pocketTypes.DispatchResponse, err error)

func (*PocketCoreApp) InitChainer

func (app *PocketCoreApp) InitChainer(ctx sdk.Ctx, req abci.RequestInitChain) abci.ResponseInitChain

inits from genesis

func (*PocketCoreApp) InitChainerWithGenesis

func (app *PocketCoreApp) InitChainerWithGenesis(ctx sdk.Ctx, req abci.RequestInitChain) abci.ResponseInitChain

inits from genesis

func (*PocketCoreApp) ModuleAccountAddrs

func (app *PocketCoreApp) ModuleAccountAddrs() map[string]bool

ModuleAccountAddrs returns all the pcInstance's module account addresses.

func (*PocketCoreApp) NewContext

func (app *PocketCoreApp) NewContext(height int64) (sdk.Ctx, error)

func (PocketCoreApp) QueryACL

func (app PocketCoreApp) QueryACL(height int64) (res types.ACL, err error)

func (PocketCoreApp) QueryAccount

func (app PocketCoreApp) QueryAccount(addr string, height int64) (res *exported.Account, err error)

func (PocketCoreApp) QueryAccountTxs

func (app PocketCoreApp) QueryAccountTxs(addr string, page, perPage int, prove bool, sort string, height int64) (res *core_types.ResultTxSearch, err error)

func (PocketCoreApp) QueryAccounts

func (app PocketCoreApp) QueryAccounts(height int64, page, perPage int) (res Page, err error)

func (PocketCoreApp) QueryAllBlockTxs

func (app PocketCoreApp) QueryAllBlockTxs(height int64, page, perPage int) (res *core_types.ResultTxSearch, err error)

func (PocketCoreApp) QueryAllParams

func (app PocketCoreApp) QueryAllParams(height int64) (r AllParamsReturn, err error)

func (PocketCoreApp) QueryApp

func (app PocketCoreApp) QueryApp(addr string, height int64) (res appsTypes.Application, err error)

func (PocketCoreApp) QueryAppParams

func (app PocketCoreApp) QueryAppParams(height int64) (res appsTypes.Params, err error)

func (PocketCoreApp) QueryApps

func (app PocketCoreApp) QueryApps(height int64, opts appsTypes.QueryApplicationsWithOpts) (res Page, err error)

func (PocketCoreApp) QueryBalance

func (app PocketCoreApp) QueryBalance(addr string, height int64) (res sdk.BigInt, err error)

func (PocketCoreApp) QueryBlock

func (app PocketCoreApp) QueryBlock(height *int64) (blockJSON []byte, err error)

zero for height = latest

func (PocketCoreApp) QueryBlockTxs

func (app PocketCoreApp) QueryBlockTxs(height int64, page, perPage int, prove bool, sort string) (res *core_types.ResultTxSearch, err error)

func (PocketCoreApp) QueryClaim

func (app PocketCoreApp) QueryClaim(address, appPubkey, chain, evidenceType string, sessionBlockHeight int64, height int64) (res *pocketTypes.MsgClaim, err error)

func (PocketCoreApp) QueryClaims

func (app PocketCoreApp) QueryClaims(address string, height int64, page, perPage int) (res Page, err error)

func (PocketCoreApp) QueryDaoBalance

func (app PocketCoreApp) QueryDaoBalance(height int64) (res sdk.BigInt, err error)

func (PocketCoreApp) QueryDaoOwner

func (app PocketCoreApp) QueryDaoOwner(height int64) (res sdk.Address, err error)

func (PocketCoreApp) QueryHeight

func (app PocketCoreApp) QueryHeight() (res int64, err error)

func (PocketCoreApp) QueryHostedChains

func (app PocketCoreApp) QueryHostedChains() (res map[string]pocketTypes.HostedBlockchain, err error)

func (PocketCoreApp) QueryNode

func (app PocketCoreApp) QueryNode(addr string, height int64) (res nodesTypes.Validator, err error)

func (PocketCoreApp) QueryNodeParams

func (app PocketCoreApp) QueryNodeParams(height int64) (res nodesTypes.Params, err error)

func (PocketCoreApp) QueryNodeStatus

func (app PocketCoreApp) QueryNodeStatus() (res *core_types.ResultStatus, err error)

func (PocketCoreApp) QueryNodes

func (app PocketCoreApp) QueryNodes(height int64, opts nodesTypes.QueryValidatorsParams) (res Page, err error)

func (PocketCoreApp) QueryParam

func (app PocketCoreApp) QueryParam(height int64, paramkey string) (r SingleParamReturn, err error)

func (PocketCoreApp) QueryPocketParams

func (app PocketCoreApp) QueryPocketParams(height int64) (res pocketTypes.Params, err error)

func (PocketCoreApp) QueryPocketSupportedBlockchains

func (app PocketCoreApp) QueryPocketSupportedBlockchains(height int64) (res []string, err error)

func (PocketCoreApp) QueryRecipientTxs

func (app PocketCoreApp) QueryRecipientTxs(addr string, page, perPage int, prove bool, sort string, height int64) (res *core_types.ResultTxSearch, err error)

func (PocketCoreApp) QuerySigningInfo

func (app PocketCoreApp) QuerySigningInfo(height int64, addr string) (res nodesTypes.ValidatorSigningInfo, err error)

func (PocketCoreApp) QuerySigningInfos

func (app PocketCoreApp) QuerySigningInfos(address string, height int64, page, perPage int) (res Page, err error)

func (PocketCoreApp) QueryTotalAppCoins

func (app PocketCoreApp) QueryTotalAppCoins(height int64) (staked sdk.BigInt, err error)

func (PocketCoreApp) QueryTotalNodeCoins

func (app PocketCoreApp) QueryTotalNodeCoins(height int64) (stakedTokens sdk.BigInt, totalTokens sdk.BigInt, err error)

func (PocketCoreApp) QueryTx

func (app PocketCoreApp) QueryTx(hash string, prove bool) (res *core_types.ResultTx, err error)

func (PocketCoreApp) QueryUnconfirmedTx

func (app PocketCoreApp) QueryUnconfirmedTx(hash string) (res tmtypes.Tx, err error)

func (PocketCoreApp) QueryUnconfirmedTxs

func (app PocketCoreApp) QueryUnconfirmedTxs(page, perPage int) (res *core_types.ResultUnconfirmedTxs, err error)

func (PocketCoreApp) QueryUpgrade

func (app PocketCoreApp) QueryUpgrade(height int64) (res types.Upgrade, err error)

func (PocketCoreApp) QueryValidatorByChain

func (app PocketCoreApp) QueryValidatorByChain(height int64, chain string) (amount int64, err error)

func (PocketCoreApp) SendRawTx

func (app PocketCoreApp) SendRawTx(fromAddr string, txBytes []byte) (sdk.TxResponse, error)

SendRawTx - Deliver tx bytes to node

func (PocketCoreApp) SetHostedChains

func (app PocketCoreApp) SetHostedChains(req map[string]pocketTypes.HostedBlockchain) (res map[string]pocketTypes.HostedBlockchain, err error)

type SingleParamReturn

type SingleParamReturn struct {
	Key   string `json:"param_key"`
	Value string `json:"param_value"`
}

Directories

Path Synopsis
cmd
cli
rpc

Jump to

Keyboard shortcuts

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