Documentation
¶
Index ¶
- Constants
- Variables
- func BeaconEqual(wcA types.Beacon, wcB types.Beacon) bool
- func BeaconTimestampEqual(lA, lB types.BeaconTimestamp) bool
- 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
- type Keeper
- func (k Keeper) Cdc() *codec.Codec
- func (k Keeper) GetAllBeaconTimestamps(ctx sdk.Context, beaconID uint64) (timestamps types.BeaconTimestamps)
- func (k Keeper) GetAllBeacons(ctx sdk.Context) (beacons types.Beacons)
- func (k Keeper) GetBeacon(ctx sdk.Context, beaconID uint64) types.Beacon
- func (k Keeper) GetBeaconOwner(ctx sdk.Context, beaconID uint64) sdk.AccAddress
- func (k Keeper) GetBeaconTimestampByID(ctx sdk.Context, beaconID uint64, timestampID uint64) types.BeaconTimestamp
- func (k Keeper) GetBeaconTimestampsFiltered(ctx sdk.Context, params types.QueryBeaconTimestampParams) []types.BeaconTimestamp
- func (k Keeper) GetBeaconsFiltered(ctx sdk.Context, params types.QueryBeaconParams) []types.Beacon
- func (k Keeper) GetBeaconsIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) GetHighestBeaconID(ctx sdk.Context) (beaconID 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) GetZeroFeeAsCoin(ctx sdk.Context) sdk.Coin
- func (k Keeper) GetZeroFeeAsCoins(ctx sdk.Context) sdk.Coins
- func (k Keeper) IsAuthorisedToRecord(ctx sdk.Context, beaconID uint64, recorder sdk.AccAddress) bool
- func (k Keeper) IsBeaconRegistered(ctx sdk.Context, beaconID uint64) bool
- func (k Keeper) IsBeaconTimestampRecordedByHashTime(ctx sdk.Context, beaconID uint64, hash string, subTime uint64) bool
- func (k Keeper) IsBeaconTimestampRecordedByID(ctx sdk.Context, beaconID uint64, timestampID uint64) bool
- func (k Keeper) IterateBeaconTimestamps(ctx sdk.Context, beaconID uint64, ...)
- func (k Keeper) IterateBeacons(ctx sdk.Context, cb func(beacon types.Beacon) (stop bool))
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) RecordBeaconTimestamp(ctx sdk.Context, beaconID uint64, hash string, submitTime uint64, ...) (uint64, error)
- func (k Keeper) RegisterBeacon(ctx sdk.Context, moniker string, beaconName string, owner sdk.AccAddress) (uint64, error)
- func (k Keeper) SetBeacon(ctx sdk.Context, beacon types.Beacon) error
- func (k Keeper) SetBeaconTimestamp(ctx sdk.Context, beaconTimestamp types.BeaconTimestamp) error
- func (k Keeper) SetHighestBeaconID(ctx sdk.Context, beaconID uint64)
- func (k Keeper) SetLastTimestampID(ctx sdk.Context, beaconID uint64, timestampID uint64) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- type NodeQuerier
- type ParamsRetriever
Constants ¶
const ( QueryParameters = "params" QueryBeacon = "beacon" QueryBeacons = "beacons" QueryBeaconTimestamp = "timestamp" )
query endpoints supported by the beacon Querier
const (
TestDenomination = "testc"
)
Variables ¶
var (
TestAddrs = []sdk.AccAddress{
bAddr1, bAddr2, bAddr3, bAddr4, bAddr5,
}
)
dummy addresses used for testing
Functions ¶
func BeaconEqual ¶
BeaconEqual checks if two Beacons are equal
func BeaconTimestampEqual ¶
func BeaconTimestampEqual(lA, lB types.BeaconTimestamp) bool
BeaconTimestampEqual checks if two BeaconTimestamps are equal
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
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) GetAllBeaconTimestamps ¶
func (k Keeper) GetAllBeaconTimestamps(ctx sdk.Context, beaconID uint64) (timestamps types.BeaconTimestamps)
GetAllBeaconTimestamps Get an iterator over all a Beacon's timestamps in which the keys are the beaconID and the values are the BeaconTimestamps
func (Keeper) GetAllBeacons ¶
GetAllBeacons returns all the registered BEACON metadata from store
func (Keeper) GetBeaconOwner ¶
GetBeaconOwner - get the current owner of a BEACON
func (Keeper) GetBeaconTimestampByID ¶
func (k Keeper) GetBeaconTimestampByID(ctx sdk.Context, beaconID uint64, timestampID uint64) types.BeaconTimestamp
GetBeaconTimestampByID Gets the beacon timestamp data for a beaconID and timestampID
func (Keeper) GetBeaconTimestampsFiltered ¶
func (k Keeper) GetBeaconTimestampsFiltered(ctx sdk.Context, params types.QueryBeaconTimestampParams) []types.BeaconTimestamp
GetBeaconTimestampsFiltered retrieves a BEACON's timestamps filtered by submit time, or the hash itself
func (Keeper) GetBeaconsFiltered ¶
GetBeaconsFiltered retrieves BEACONs 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) GetBeaconsIterator ¶
GetBeaconsIterator Get an iterator over all BEACONs in which the keys are the BEACON Ids and the values are the BEACONs
func (Keeper) GetHighestBeaconID ¶
GetHighestBeaconID gets the highest BEACON ID
func (Keeper) GetParamRegistrationFee ¶
func (Keeper) GetRegistrationFeeAsCoin ¶
func (Keeper) GetRegistrationFeeAsCoins ¶
func (Keeper) IsAuthorisedToRecord ¶
func (k Keeper) IsAuthorisedToRecord(ctx sdk.Context, beaconID uint64, recorder sdk.AccAddress) bool
IsAuthorisedToRecord ensures only the BEACON owner is recording hashes
func (Keeper) IsBeaconRegistered ¶
IsBeaconRegistered Checks if the BEACON is present in the store or not
func (Keeper) IsBeaconTimestampRecordedByHashTime ¶
func (Keeper) IsBeaconTimestampRecordedByID ¶
func (k Keeper) IsBeaconTimestampRecordedByID(ctx sdk.Context, beaconID uint64, timestampID uint64) bool
IsBeaconTimestampRecordedByID Check if the BEACON timestamp is present in the store or not, given the beaconID and timestampID
func (Keeper) IterateBeaconTimestamps ¶
func (k Keeper) IterateBeaconTimestamps(ctx sdk.Context, beaconID uint64, cb func(beaconTimestamp types.BeaconTimestamp) (stop bool))
IterateBeacons iterates over the all the BEACON's timestamps and performs a callback function
func (Keeper) IterateBeacons ¶
IterateBeacons iterates over the all the BEACON metadata and performs a callback function
func (Keeper) RecordBeaconTimestamp ¶
func (k Keeper) RecordBeaconTimestamp( ctx sdk.Context, beaconID uint64, hash string, submitTime uint64, owner sdk.AccAddress) (uint64, error)
RecordBeaconTimestamp records a BEACON timestamp hash for a registered BEACON
func (Keeper) RegisterBeacon ¶
func (k Keeper) RegisterBeacon(ctx sdk.Context, moniker string, beaconName string, owner sdk.AccAddress) (uint64, error)
RegisterBeacon registers a BEACON in the store
func (Keeper) SetBeaconTimestamp ¶
SetBeaconTimestamp Sets the Beacon timestamp struct for a beaconID + timestampID
func (Keeper) SetHighestBeaconID ¶
SetHighestBeaconID sets the new highest BEACON ID to the store
func (Keeper) SetLastTimestampID ¶
SetLastTimestampID - sets the last timestamp ID submitted
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 subTime 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 subTime of the query with the params. An error is returned if the query or decoding fails.