Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateRandomAddresses(num int) []sdk.AccAddress
- func GenerateRandomString(length int) string
- func GenerateRandomStringWithCharset(length int, charset string) string
- func NewQuerier(keeper Keeper) sdk.Querier
- func ParamsEqual(paramsA, paramsB types.Params) bool
- func RandInBetween(min, max int) int
- func WRKChainBlockEqual(lA, lB types.WrkChainBlock) bool
- func WRKChainEqual(wcA types.WrkChain, wcB types.WrkChain) bool
- type Keeper
- func (k Keeper) Cdc() *codec.Codec
- func (k Keeper) GetAllWrkChainBlockHashes(ctx sdk.Context, wrkchainID uint64) (wrkChainBlocks types.WrkChainBlocks)
- func (k Keeper) GetAllWrkChains(ctx sdk.Context) (wrkChains types.WrkChains)
- func (k Keeper) GetHighestWrkChainID(ctx sdk.Context) (wrkChainID uint64, err error)
- func (k Keeper) GetParamDenom(ctx sdk.Context) string
- func (k Keeper) GetParamRecordFee(ctx sdk.Context) uint64
- func (k Keeper) GetParamRegistrationFee(ctx sdk.Context) uint64
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetRecordFeeAsCoin(ctx sdk.Context) sdk.Coin
- func (k Keeper) GetRecordFeeAsCoins(ctx sdk.Context) sdk.Coins
- func (k Keeper) GetRegistrationFeeAsCoin(ctx sdk.Context) sdk.Coin
- func (k Keeper) GetRegistrationFeeAsCoins(ctx sdk.Context) sdk.Coins
- func (k Keeper) GetWrkChain(ctx sdk.Context, wrkchainId uint64) types.WrkChain
- func (k Keeper) GetWrkChainBlock(ctx sdk.Context, wrkchainId uint64, height uint64) types.WrkChainBlock
- func (k Keeper) GetWrkChainBlockHashesFiltered(ctx sdk.Context, wrkchainID uint64, params types.QueryWrkChainBlockParams) []types.WrkChainBlock
- func (k Keeper) GetWrkChainBlockHashesIterator(ctx sdk.Context, wrkchainID uint64) sdk.Iterator
- func (k Keeper) GetWrkChainOwner(ctx sdk.Context, wrkchainId uint64) sdk.AccAddress
- func (k Keeper) GetWrkChainsFiltered(ctx sdk.Context, params types.QueryWrkChainParams) []types.WrkChain
- func (k Keeper) GetWrkChainsIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetZeroFeeAsCoin(ctx sdk.Context) sdk.Coin
- func (k Keeper) GetZeroFeeAsCoins(ctx sdk.Context) sdk.Coins
- func (k Keeper) IsAuthorisedToRecord(ctx sdk.Context, wrkchainId uint64, recorder sdk.AccAddress) bool
- func (k Keeper) IsWrkChainBlockRecorded(ctx sdk.Context, wrkchainId uint64, height uint64) bool
- func (k Keeper) IsWrkChainRegistered(ctx sdk.Context, wrkchainId uint64) bool
- func (k Keeper) IterateWrkChainBlockHashes(ctx sdk.Context, wrkchainID uint64, ...)
- func (k Keeper) IterateWrkChains(ctx sdk.Context, cb func(wrkChain types.WrkChain) (stop bool))
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) RecordWrkchainHashes(ctx sdk.Context, wrkchainId uint64, height uint64, blockHash string, ...) error
- func (k Keeper) RegisterWrkChain(ctx sdk.Context, moniker string, wrkchainName string, genesisHash string, ...) (uint64, error)
- func (k Keeper) SetHighestWrkChainID(ctx sdk.Context, wrkChainID uint64)
- func (k Keeper) SetLastBlock(ctx sdk.Context, wrkchainId uint64, blockNum uint64) error
- func (k Keeper) SetNumBlocks(ctx sdk.Context, wrkchainId uint64) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetWrkChain(ctx sdk.Context, wrkchain types.WrkChain) error
- func (k Keeper) SetWrkChainBlock(ctx sdk.Context, wrkchainBlock types.WrkChainBlock) error
- type NodeQuerier
- type ParamsRetriever
Constants ¶
const ( QueryParameters = "params" QueryWrkChain = "wrkchain" QueryWrkChainsFiltered = "wrkchains-filtered" QueryWrkChainBlock = "block" )
query endpoints supported by the wrkchain Querier
const (
TestDenomination = "testc"
)
Variables ¶
var (
TestAddrs = []sdk.AccAddress{
wcAddr1, wcAddr2, wcAddr3, wcAddr4, wcAddr5,
}
)
dummy addresses used for testing
Functions ¶
func GenerateRandomAddresses ¶
func GenerateRandomAddresses(num int) []sdk.AccAddress
func GenerateRandomString ¶
GenerateRandomString generates a random string given a length, based on a set character set
func GenerateRandomStringWithCharset ¶
GenerateRandomStringWithCharset generates a random string given a length and character set
func NewQuerier ¶
NewQuerier is the module level router for state queries
func ParamsEqual ¶
ParamsEqual checks params are equal
func RandInBetween ¶
RandInBetween generates a random number between two given values
func WRKChainBlockEqual ¶
func WRKChainBlockEqual(lA, lB types.WrkChainBlock) bool
WRKChainBlockEqual checks if two WRKChainBlocks are equal
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine
func (Keeper) GetAllWrkChainBlockHashes ¶
func (k Keeper) GetAllWrkChainBlockHashes(ctx sdk.Context, wrkchainID uint64) (wrkChainBlocks types.WrkChainBlocks)
GetAllWrkChainBlockHashes returns all the wrkchain's hashes from store
func (Keeper) GetAllWrkChains ¶
GetAllWrkChains returns all the registered wrkchain metadata from store
func (Keeper) GetHighestWrkChainID ¶
GetHighestWrkChainID gets the highest WRKChain ID
func (Keeper) GetParamRegistrationFee ¶
func (Keeper) GetRegistrationFeeAsCoin ¶
func (Keeper) GetRegistrationFeeAsCoins ¶
func (Keeper) GetWrkChain ¶
GetWrkChain Gets the entire WRKChain metadata struct for a wrkchainId
func (Keeper) GetWrkChainBlock ¶
func (k Keeper) GetWrkChainBlock(ctx sdk.Context, wrkchainId uint64, height uint64) types.WrkChainBlock
GetWrkChainBlock Gets the entire WRKChain metadata struct for a wrkchainId
func (Keeper) GetWrkChainBlockHashesFiltered ¶
func (k Keeper) GetWrkChainBlockHashesFiltered(ctx sdk.Context, wrkchainID uint64, params types.QueryWrkChainBlockParams) []types.WrkChainBlock
GetWrkChainsFiltered retrieves wrkchains filtered by a given set of params which include pagination parameters along a moniker and owner address.
NOTE: If no filters are provided, all proposals will be returned in paginated form.
func (Keeper) GetWrkChainBlockHashesIterator ¶
GetWrkChainBlockHashesIterator Gets an iterator over all WrkChain hashess in which the keys are the WrkChain Ids and the values are the WrkChainBlocks
func (Keeper) GetWrkChainOwner ¶
GetWrkChainOwner - get the current owner of a WRKChain
func (Keeper) GetWrkChainsFiltered ¶
func (k Keeper) GetWrkChainsFiltered(ctx sdk.Context, params types.QueryWrkChainParams) []types.WrkChain
GetWrkChainsFiltered retrieves wrkchains filtered by a given set of params which include pagination parameters along a moniker and owner address.
NOTE: If no filters are provided, all proposals will be returned in paginated form.
func (Keeper) GetWrkChainsIterator ¶
GetWrkChainsIterator Get an iterator over all WrkChains in which the keys are the WrkChain Ids and the values are the WrkChains
func (Keeper) IsAuthorisedToRecord ¶
func (k Keeper) IsAuthorisedToRecord(ctx sdk.Context, wrkchainId uint64, recorder sdk.AccAddress) bool
IsAuthorisedToRecord ensures only the WRKChain owner is recording hashes
func (Keeper) IsWrkChainBlockRecorded ¶
IsWrkChainBlockRecorded Check if the WrkChainBlock is present in the store or not
func (Keeper) IsWrkChainRegistered ¶
IsWrkChainRegistered Checks if the WrkChain is present in the store or not
func (Keeper) IterateWrkChainBlockHashes ¶
func (k Keeper) IterateWrkChainBlockHashes(ctx sdk.Context, wrkchainID uint64, cb func(wrkChain types.WrkChainBlock) (stop bool))
IterateWrkChainBlockHashes iterates over the all the hashes for a wrkchain and performs a callback function
func (Keeper) IterateWrkChains ¶
IterateWrkChains iterates over the all the wrkchain metadata and performs a callback function
func (Keeper) RecordWrkchainHashes ¶
func (k Keeper) RecordWrkchainHashes( ctx sdk.Context, wrkchainId uint64, height uint64, blockHash string, parentHash string, hash1 string, hash2 string, hash3 string, owner sdk.AccAddress) error
RecordWrkchainHashes records a WRKChain block has for a registered WRKChain
func (Keeper) RegisterWrkChain ¶
func (k Keeper) RegisterWrkChain(ctx sdk.Context, moniker string, wrkchainName string, genesisHash string, baseType string, owner sdk.AccAddress) (uint64, error)
RegisterWrkChain registers a WRKChain in the store
func (Keeper) SetHighestWrkChainID ¶
SetHighestWrkChainID sets the new highest WRKChain ID to the store
func (Keeper) SetLastBlock ¶
SetLastBlock - sets the last block number submitted
func (Keeper) SetWrkChain ¶
SetWrkChain Sets the WrkChain metadata struct for a wrkchainId
func (Keeper) SetWrkChainBlock ¶
SetWrkChainBlock Sets the WrkChain Block struct for a wrkchainId & height
type NodeQuerier ¶
type NodeQuerier interface { // 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. QueryWithData(path string, data []byte) ([]byte, int64, error) }
NodeQuerier is an interface that is satisfied by types that provide the QueryWithData method
type ParamsRetriever ¶
type ParamsRetriever struct {
// contains filtered or unexported fields
}
ParamsRetriever defines the properties of a type that can be used to retrieve enterprise params.
func NewParamsRetriever ¶
func NewParamsRetriever(querier NodeQuerier) ParamsRetriever
NewParamsRetriever initialises a new ParamsRetriever instance.
func (ParamsRetriever) GetParams ¶
func (ar ParamsRetriever) GetParams() (types.Params, error)
GetParams queries for parameters. An error is returned if the query or decoding fails.
func (ParamsRetriever) GetParamsHeight ¶
func (ar ParamsRetriever) GetParamsHeight() (types.Params, int64, error)
GetParamsHeight queries for parameters. Returns the height of the query with the params. An error is returned if the query or decoding fails.