Documentation ¶
Index ¶
- Variables
- func GetDefaultHashMap(wrkchainType string, hashRef string) string
- func IsSupportedHash(wrkchainType string, hashType string) (bool, error)
- func IsSupportedWrkchainType(wrkchainType string) bool
- type Geth
- type Tendermint
- type WrkChain
- type WrkChainBlockHeader
- type WrkChainClient
- type WrkChainMeta
- type WrkChainMetaQueryResponse
Constants ¶
This section is empty.
Variables ¶
var ( // SupportedWrkchainTypes is an internal reference holding the currently supported WRKChain types SupportedWrkchainTypes = []string{ "geth", "cosmos", "tendermint", } )
Functions ¶
func GetDefaultHashMap ¶ added in v0.2.2
GetDefaultHashMap returns the default hash map given a WRKChain type and hash reference (i.e. hash1, hash2 and hash3) It is called during the workoracle init command
func IsSupportedHash ¶ added in v0.2.2
IsSupportedHash checks if the given hashType for the given chainType is currently supported by WRKOracle
func IsSupportedWrkchainType ¶ added in v0.2.2
IsSupportedWrkchainType checks if the given chainType is currently supported by WRKOracle
Types ¶
type Geth ¶ added in v0.2.1
type Geth struct {
// contains filtered or unexported fields
}
Geth is a structure for holding a Geth based WRKChain client
func NewGethClient ¶ added in v0.2.1
func NewGethClient() *Geth
NewGethClient returns a new Geth struct
func (Geth) GetBlockAtHeight ¶ added in v0.2.1
func (g Geth) GetBlockAtHeight(height uint64) (WrkChainBlockHeader, error)
GetBlockAtHeight is used to get the block headers for a given height from a geth based WRKChain
func (Geth) GetDefaultHashMap ¶ added in v0.2.2
GetDefaultHashMap returns the default has mapping for a given reference
func (Geth) IsSupportedHash ¶ added in v0.2.2
IsSupportedHash checks if the given hashType for the given chainType is currently supported by WRKOracle
type Tendermint ¶ added in v0.2.1
type Tendermint struct {
// contains filtered or unexported fields
}
Tendermint is a structure for holding a Tendermint based WRKChain client
func NewTendermintClient ¶ added in v0.2.1
func NewTendermintClient() *Tendermint
NewTendermintClient returns a new Tendermint struct
func (Tendermint) GetBlockAtHeight ¶ added in v0.2.1
func (t Tendermint) GetBlockAtHeight(height uint64) (WrkChainBlockHeader, error)
GetBlockAtHeight is used to get the block headers for a given height from a tendermint based WRKChain
func (Tendermint) GetDefaultHashMap ¶ added in v0.2.2
func (t Tendermint) GetDefaultHashMap(hashRef string) string
GetDefaultHashMap returns the default has mapping for a given reference
func (Tendermint) IsSupportedHash ¶ added in v0.2.2
func (t Tendermint) IsSupportedHash(hashType string) (bool, error)
IsSupportedHash checks if the given hashType for the given chainType is currently supported by WRKOracle
func (*Tendermint) SetLogger ¶ added in v0.2.2
func (t *Tendermint) SetLogger(log log.Logger)
SetLogger sets the logger
type WrkChain ¶ added in v0.2.1
type WrkChain struct {
// contains filtered or unexported fields
}
WrkChain is a top level struct to hold WRKChain data
func NewWrkChain ¶ added in v0.2.1
func NewWrkChain(wrkchainMeta WrkChainMeta, log log.Logger) (*WrkChain, error)
NewWrkChain returns a new initialised WrkChain
func (WrkChain) GetLatestBlock ¶ added in v0.2.1
func (w WrkChain) GetLatestBlock() (WrkChainBlockHeader, error)
GetLatestBlock is a top level function to query any WRKChain type for the latest block header
func (WrkChain) GetWrkChainBlock ¶ added in v0.2.1
func (w WrkChain) GetWrkChainBlock(height uint64) (WrkChainBlockHeader, error)
GetWrkChainBlock is a top level function to query any WRKChain type for the block header at a given height
type WrkChainBlockHeader ¶ added in v0.2.2
type WrkChainBlockHeader struct { Height uint64 `json:"height"` BlockHash string `json:"blockhash"` ParentHash string `json:"parenthash"` Hash1 string `json:"hash1"` Hash2 string `json:"hash2"` Hash3 string `json:"hash3"` }
WrkChainBlockHeader is the standard header object that should be returned by any WRKChain type client
func NewWrkChainBlockHeader ¶ added in v0.2.2
func NewWrkChainBlockHeader( height uint64, blockHash string, parentHash string, hash1 string, hash2 string, hash3 string, ) WrkChainBlockHeader
NewWrkChainBlockHeader returns a new initialised WrkChainBlockHeader
type WrkChainClient ¶ added in v0.2.1
type WrkChainClient interface { GetBlockAtHeight(height uint64) (WrkChainBlockHeader, error) IsSupportedHash(hashType string) (bool, error) GetDefaultHashMap(hashRef string) string SetLogger(log log.Logger) }
WrkChainClient is a generic interface for all WRKChain clients. New WRKChain client modules should implement this interface
func WrkChainClientFactory ¶ added in v0.2.2
func WrkChainClientFactory(wrkchainType string) (WrkChainClient, error)
WrkChainClientFactory returns a basic initialised WrkChainClient client based on the given WRKChain type
type WrkChainMeta ¶ added in v0.2.2
type WrkChainMeta struct { WRKChainId string `json:"wrkchain_id"` Moniker string `json:"moniker"` Name string `json:"name"` Type string `json:"type"` }
WrkChainMeta is an object to hold WRKChain metadata when queried from Mainchain
type WrkChainMetaQueryResponse ¶ added in v0.2.2
type WrkChainMetaQueryResponse struct { Height string `json:"height"` Result WrkChainMeta `json:"result"` }
WrkChainMetaQueryResponse is a structure which holds Mainchain query data specifically for WRKChain metadata