Documentation
¶
Overview ¶
Package blockchain provides functionality to interact with different blockchain interfaces.
Index ¶
- Constants
- Variables
- func Cfx2EthResponse(cfx cfxLogResponse) (models.Log, error)
- func CreateClientManager(sub store.Subscription) (subscriber.ISubscriber, error)
- func CreateJsonManager(t subscriber.Type, sub store.Subscription) (subscriber.JsonManager, error)
- func CreateSubscription(sub *store.Subscription, params Params)
- func GetBlockNumberPayload() ([]byte, error)
- func GetConnectionType(endpoint store.Endpoint) (subscriber.Type, error)
- func GetValidations(t string, params Params) []int
- func ParseBlocknumberFromNewHeads(msg JsonrpcMessage) (*big.Int, error)
- func ParseNEAROracleRequestsMap(msg JsonrpcMessage) (map[string][]NEAROracleRequest, error)
- func StringToBytes32(str string) common.Hash
- func ValidBlockchain(name string) bool
- type BIritaServiceRequest
- type EventChainlinkKillRequest
- type EventChainlinkOperatorRegistered
- type EventChainlinkOperatorUnregistered
- type EventChainlinkOracleAnswer
- type EventChainlinkOracleRequest
- type EventRecords
- type JsonrpcMessage
- type NEAROracleFnGetAllRequestsArgs
- type NEAROracleNonces
- type NEAROracleRequest
- type NEAROracleRequestArgs
- type NEAROracleRequestFulfillmentArgs
- type NEARQueryCallFunction
- type NEARQueryResult
- type NEARStatus
- type NEARSyncInfo
- type NEARValidator
- type NEARVersion
- type Params
- type SubstrateRequestParams
Constants ¶
const ( BIRITA = "bsn-irita" DefaultScannerInterval = 5 ClientTimeout = 10 ServiceRequestEventType = "new_batch_request_provider" )
const Agoric = "agoric"
Agoric is the identifier of this blockchain integration.
const BSC = "binance-smart-chain"
const CFX = "conflux"
const ETH = "ethereum"
const HMY = "harmony"
const (
IOTX = "iotex"
)
const (
Keeper = "keeper"
)
const Klaytn = "klaytn"
const (
// NEAR platform name
NEAR = "near"
)
const (
ONT = "ontology"
)
const Substrate = "substrate"
Substrate is the identifier of this blockchain integration.
const UpkeepRegistryInterface = `` /* 1025-byte string literal not displayed */
const (
XTZ = "tezos"
)
Variables ¶
var ( ErrConnectionType = errors.New("unknown connection type") ErrSubscriberType = errors.New("unknown subscriber type") )
var ExpectsMock = false
ExpectsMock variable is set when we run in a mock context
Functions ¶
func Cfx2EthResponse ¶
convert cfxLogResponse type to eth.Log type
func CreateClientManager ¶
func CreateClientManager(sub store.Subscription) (subscriber.ISubscriber, error)
CreateClientManager creates a new instance of a subscriber.ISubscriber with the provided connection type and store.Subscription config.
func CreateJsonManager ¶
func CreateJsonManager(t subscriber.Type, sub store.Subscription) (subscriber.JsonManager, error)
CreateJsonManager creates a new instance of a JSON blockchain manager with the provided connection type and store.Subscription config.
func CreateSubscription ¶
func CreateSubscription(sub *store.Subscription, params Params)
func GetBlockNumberPayload ¶
func GetConnectionType ¶
func GetConnectionType(endpoint store.Endpoint) (subscriber.Type, error)
func GetValidations ¶
func ParseBlocknumberFromNewHeads ¶
func ParseBlocknumberFromNewHeads(msg JsonrpcMessage) (*big.Int, error)
func ParseNEAROracleRequestsMap ¶
func ParseNEAROracleRequestsMap(msg JsonrpcMessage) (map[string][]NEAROracleRequest, error)
ParseNEAROracleRequestsMap will unmarshal JsonrpcMessage result.result as map[string][]NEAROracleRequest
func StringToBytes32 ¶
func ValidBlockchain ¶
Types ¶
type BIritaServiceRequest ¶
type EventChainlinkOracleRequest ¶
type EventChainlinkOracleRequest struct { Phase types.Phase OracleAccountID types.AccountID SpecIndex types.Text RequestIdentifier types.U64 RequesterAccountID types.AccountID DataVersion types.U64 Bytes SubstrateRequestParams Callback types.Text Payment types.U32 Topics []types.Hash }
EventChainlinkOracleRequest is the event structure we expect to be emitted from the Chainlink pallet
type EventRecords ¶
type EventRecords struct { types.EventRecords Chainlink_OracleRequest []EventChainlinkOracleRequest //nolint:stylecheck,golint Chainlink_OracleAnswer []EventChainlinkOracleAnswer //nolint:stylecheck,golint Chainlink_OperatorRegistered []EventChainlinkOperatorRegistered //nolint:stylecheck,golint Chainlink_OperatorUnregistered []EventChainlinkOperatorUnregistered //nolint:stylecheck,golint Chainlink_KillRequest []EventChainlinkKillRequest //nolint:stylecheck,golint }
type JsonrpcMessage ¶
type JsonrpcMessage struct { Version string `json:"jsonrpc"` ID json.RawMessage `json:"id,omitempty"` Method string `json:"method,omitempty"` Params json.RawMessage `json:"params,omitempty"` Error *interface{} `json:"error,omitempty"` Result json.RawMessage `json:"result,omitempty"` }
JsonrpcMessage declares JSON-RPC message type
type NEAROracleFnGetAllRequestsArgs ¶
type NEAROracleFnGetAllRequestsArgs struct { MaxNumAccounts string `json:"max_num_accounts"` // uint64 string MaxRequests string `json:"max_requests"` // uint64 string }
NEAROracleFnGetAllRequestsArgs represents function arguments for NEAR oracle 'get_all_requests' function
type NEAROracleNonces ¶
NEAROracleNonces maps accounts to its latest nonce TODO: user *big.Int for nonces (u128)
func ParseNEARNEAROracleNonces ¶
func ParseNEARNEAROracleNonces(msg JsonrpcMessage) (NEAROracleNonces, error)
ParseNEARNEAROracleNonces will unmarshal JsonrpcMessage result.result as NEAROracleNonces map
type NEAROracleRequest ¶
type NEAROracleRequest struct { Nonce string `json:"nonce"` Request NEAROracleRequestArgs `json:"request"` }
NEAROracleRequest is the request returned by the oracle 'get_requests' or 'get_all_requests' function
type NEAROracleRequestArgs ¶
type NEAROracleRequestArgs struct { CallerAccount string `json:"caller_account"` RequestSpec string `json:"request_spec"` // base64-encoded CallbackAddress string `json:"callback_address"` CallbackMethod string `json:"callback_method"` Data string `json:"data"` // base64-encoded Payment uint64 `json:"payment"` // in LINK tokens Expiration uint64 `json:"expiration"` // in nanoseconds }
NEAROracleRequestArgs contains the oracle request arguments
type NEAROracleRequestFulfillmentArgs ¶
type NEAROracleRequestFulfillmentArgs struct { Account string `json:"account"` Nonce string `json:"nonce"` }
NEAROracleRequestFulfillmentArgs contains the arguments for oracle 'fulfill_request' function
type NEARQueryCallFunction ¶
type NEARQueryCallFunction struct { RequestType string `json:"request_type"` Finality string `json:"finality"` AccountID string `json:"account_id"` MethodName string `json:"method_name"` ArgsBase64 string `json:"args_base64"` // base64-encoded }
NEARQueryCallFunction is a JSON-RPC Params struct for NEAR JSON-RPC query Method where "request_type": "call_function".
NEAR "call_function" request type, calls method_name in contract account_id as view function with data as parameters.
type NEARQueryResult ¶
type NEARQueryResult struct { Result []byte `json:"result"` Logs []byte `json:"logs"` BlockHeight uint64 `json:"block_height"` BlockHash string `json:"block_hash"` }
NEARQueryResult is a result struct for NEAR JSON-RPC NEARQueryCallFunction response
func ParseNEARQueryResult ¶
func ParseNEARQueryResult(msg JsonrpcMessage) (*NEARQueryResult, error)
ParseNEARQueryResult will unmarshal JsonrpcMessage as a NEAR standard NEARQueryResult
type NEARStatus ¶
type NEARStatus struct { ChainID string `json:"chain_id"` LatestProtocolVersion uint16 `json:"latest_protocol_version"` ProtocolVersion uint16 `json:"protocol_version"` RPCAddr string `json:"rpc_addr"` SyncInfo NEARSyncInfo `json:"sync_info"` Validators []NEARValidator `json:"validators"` }
NEARStatus is a result type for NEAR JSON-RPC status response, contains NEAR network status info
type NEARSyncInfo ¶
type NEARSyncInfo struct { LatestBlockHash string `json:"latest_block_hash"` LatestBlockHeight uint64 `json:"latest_block_height"` LatestBlockTime string `json:"latest_block_time"` LatestStateRoot string `json:"latest_state_root"` Syncing bool `json:"syncing"` }
NEARSyncInfo type contains NEAR sync info
type NEARValidator ¶
type NEARValidator struct { AccountID string `json:"account_id"` IsSlashed bool `json:"is_slashed"` }
NEARValidator type contains NEAR validator info
type NEARVersion ¶
NEARVersion type contains NEAR build & version info
type SubstrateRequestParams ¶
type SubstrateRequestParams []string
SubstrateRequestParams allows for decoding a scale hex string into a byte array, which is then encoded back to a scale encoded byte array, to be decoded into a string array. This solves issues where decoding directly into a string array would read past the end of the array.