Documentation ¶
Index ¶
- Variables
- func ConvertAPIs(in []runtime.APIItem) []interface{}
- func IsUnsafe(name string) bool
- type AuthorModule
- func (am *AuthorModule) HasKey(r *http.Request, req *[]string, res *bool) error
- func (am *AuthorModule) HasSessionKeys(r *http.Request, req *HasSessionKeyRequest, res *HasSessionKeyResponse) error
- func (am *AuthorModule) InsertKey(r *http.Request, req *KeyInsertRequest, _ *KeyInsertResponse) error
- func (am *AuthorModule) PendingExtrinsics(r *http.Request, req *EmptyRequest, res *PendingExtrinsicsResponse) error
- func (am *AuthorModule) RemoveExtrinsic(r *http.Request, _ *ExtrinsicOrHashRequest, _ *RemoveExtrinsicsResponse) error
- func (am *AuthorModule) RotateKeys(r *http.Request, req *EmptyRequest, res *KeyRotateResponse) error
- func (am *AuthorModule) SubmitAndWatchExtrinsic(r *http.Request, req *Extrinsic, res *ExtrinsicStatus) error
- func (am *AuthorModule) SubmitExtrinsic(r *http.Request, req *Extrinsic, res *ExtrinsicHashResponse) error
- type BlockAPI
- type BlockFinalityAPI
- type BlockProducerAPI
- type ChainBlock
- type ChainBlockHeaderDigest
- type ChainBlockHeaderResponse
- type ChainBlockNumberRequest
- type ChainBlockResponse
- type ChainFinalizedHeadRequest
- type ChainHashRequest
- type ChainHashResponse
- type ChainModule
- func (cm *ChainModule) GetBlock(r *http.Request, req *ChainHashRequest, res *ChainBlockResponse) error
- func (cm *ChainModule) GetBlockHash(r *http.Request, req *ChainBlockNumberRequest, res *ChainHashResponse) error
- func (cm *ChainModule) GetFinalizedHead(r *http.Request, req *EmptyRequest, res *ChainHashResponse) error
- func (cm *ChainModule) GetFinalizedHeadByRound(r *http.Request, req *ChainFinalizedHeadRequest, res *ChainHashResponse) error
- func (cm *ChainModule) GetHeader(r *http.Request, req *ChainHashRequest, res *ChainBlockHeaderResponse) error
- func (cm *ChainModule) SubscribeFinalizedHeads(_ *http.Request, _ *EmptyRequest, _ *ChainBlockHeaderResponse) error
- func (cm *ChainModule) SubscribeNewHead(r *http.Request, req *EmptyRequest, res *ChainBlockHeaderResponse) error
- func (cm *ChainModule) SubscribeNewHeads(r *http.Request, req *EmptyRequest, res *ChainBlockHeaderResponse) error
- type ChildStateModule
- func (cs *ChildStateModule) GetKeys(_ *http.Request, req *GetKeysRequest, res *[]string) error
- func (cs *ChildStateModule) GetStorage(_ *http.Request, req *ChildStateStorageRequest, res *StateStorageResponse) error
- func (cs *ChildStateModule) GetStorageHash(_ *http.Request, req *GetStorageHash, res *string) error
- func (cs *ChildStateModule) GetStorageSize(_ *http.Request, req *GetChildStorageRequest, res *uint64) error
- type ChildStateStorageRequest
- type CoreAPI
- type DevModule
- type EmptyRequest
- type Extrinsic
- type ExtrinsicHashResponse
- type ExtrinsicOrHash
- type ExtrinsicOrHashRequest
- type ExtrinsicStatus
- type GenSyncSpecRequest
- type GetChildStorageRequest
- type GetKeysRequest
- type GetStorageHash
- type GrandpaModule
- type HasSessionKeyRequest
- type HasSessionKeyResponse
- type KeyInsertRequest
- type KeyInsertResponse
- type KeyRotateResponse
- type KeyValueOption
- type MethodsResponse
- type NetworkAPI
- type NetworkStateString
- type OffchainLocalStorageGet
- type OffchainLocalStorageSet
- type OffchainModule
- type PaymentModule
- type PaymentQueryInfoRequest
- type PaymentQueryInfoResponse
- type PendingExtrinsicsResponse
- type ProveFinalityRequest
- type ProveFinalityResponse
- type RPCAPI
- type RPCModule
- type RemoveExtrinsicsResponse
- type RoundState
- type RoundStateResponse
- type RuntimeStorageAPI
- type StateCallRequest
- type StateCallResponse
- type StateChildStorageResponse
- type StateChildStorageSizeResponse
- type StateGetReadProofRequest
- type StateGetReadProofResponse
- type StateKeysResponse
- type StateMetadataResponse
- type StateModule
- func (sm *StateModule) Call(_ *http.Request, _ *StateCallRequest, _ *StateCallResponse) error
- func (sm *StateModule) GetKeysPaged(_ *http.Request, req *StateStorageKeyRequest, res *StateStorageKeysResponse) error
- func (sm *StateModule) GetMetadata(_ *http.Request, req *StateRuntimeMetadataQuery, res *StateMetadataResponse) error
- func (sm *StateModule) GetPairs(_ *http.Request, req *StatePairRequest, res *StatePairResponse) error
- func (sm *StateModule) GetReadProof(_ *http.Request, req *StateGetReadProofRequest, res *StateGetReadProofResponse) error
- func (sm *StateModule) GetRuntimeVersion(_ *http.Request, req *StateRuntimeVersionRequest, ...) error
- func (sm *StateModule) GetStorage(_ *http.Request, req *StateStorageRequest, res *StateStorageResponse) error
- func (sm *StateModule) GetStorageHash(_ *http.Request, req *StateStorageHashRequest, res *StateStorageHashResponse) error
- func (sm *StateModule) GetStorageSize(_ *http.Request, req *StateStorageSizeRequest, res *StateStorageSizeResponse) error
- func (sm *StateModule) QueryStorage(_ *http.Request, req *StateStorageQueryRangeRequest, ...) error
- func (sm *StateModule) SubscribeRuntimeVersion(r *http.Request, _ *StateStorageQueryRangeRequest, ...) error
- func (*StateModule) SubscribeStorage(_ *http.Request, _ *StateStorageQueryRangeRequest, _ *StorageChangeSetResponse) error
- type StatePairRequest
- type StatePairResponse
- type StateRuntimeMetadataQuery
- type StateRuntimeVersionRequest
- type StateRuntimeVersionResponse
- type StateStorageDataResponse
- type StateStorageHashRequest
- type StateStorageHashResponse
- type StateStorageKeyRequest
- type StateStorageKeysQuery
- type StateStorageKeysResponse
- type StateStorageQueryRangeRequest
- type StateStorageRequest
- type StateStorageResponse
- type StateStorageSizeRequest
- type StateStorageSizeResponse
- type StorageAPI
- type StorageChangeSetResponse
- type StorageKey
- type StringRequest
- type StringResponse
- type SyncAPI
- type SyncStateAPI
- type SyncStateModule
- type SyncStateResponse
- type SystemAPI
- type SystemHealthResponse
- type SystemModule
- func (sm *SystemModule) AccountNextIndex(r *http.Request, req *StringRequest, res *U64Response) error
- func (sm *SystemModule) AddReservedPeer(r *http.Request, req *StringRequest, res *[]byte) error
- func (sm *SystemModule) Chain(r *http.Request, req *EmptyRequest, res *string) error
- func (sm *SystemModule) ChainType(r *http.Request, req *EmptyRequest, res *string) error
- func (sm *SystemModule) Health(r *http.Request, req *EmptyRequest, res *SystemHealthResponse) error
- func (sm *SystemModule) LocalListenAddresses(r *http.Request, req *EmptyRequest, res *[]string) error
- func (sm *SystemModule) LocalPeerId(r *http.Request, req *EmptyRequest, res *string) error
- func (sm *SystemModule) Name(r *http.Request, req *EmptyRequest, res *string) error
- func (sm *SystemModule) NetworkState(r *http.Request, req *EmptyRequest, res *SystemNetworkStateResponse) error
- func (sm *SystemModule) NodeRoles(r *http.Request, req *EmptyRequest, res *[]interface{}) error
- func (sm *SystemModule) Peers(r *http.Request, req *EmptyRequest, res *SystemPeersResponse) error
- func (sm *SystemModule) Properties(r *http.Request, req *EmptyRequest, res *interface{}) error
- func (sm *SystemModule) RemoveReservedPeer(r *http.Request, req *StringRequest, res *[]byte) error
- func (sm *SystemModule) SyncState(r *http.Request, req *EmptyRequest, res *SyncStateResponse) error
- func (sm *SystemModule) Version(r *http.Request, req *EmptyRequest, res *string) error
- type SystemNetworkStateResponse
- type SystemPeersResponse
- type TransactionStateAPI
- type U64Response
- type Votes
Constants ¶
This section is empty.
Variables ¶
var ( // UnsafeMethods is a list of all unsafe rpc methods of https://github.com/w3f/PSPs/blob/master/PSPs/drafts/psp-6.md UnsafeMethods = []string{ "system_addReservedPeer", "system_removeReservedPeer", "author_submitExtrinsic", "author_removeExtrinsic", "author_insertKey", "author_rotateKeys", "state_getPairs", "state_getKeysPaged", "state_queryStorage", } // AliasesMethods is a map that links the original methods to their aliases AliasesMethods = map[string]string{ "chain_getHead": "chain_getBlockHash", "account_nextIndex": "system_accountNextIndex", "chain_getFinalisedHead": "chain_getFinalizedHead", } )
var ErrProvidedKeyDoesNotMatch = errors.New("generated public key does not equal provide public key")
var ErrSubscriptionTransport = errors.New("subscriptions are not available on this transport")
ErrSubscriptionTransport error sent when trying to access websocket subscriptions via http
Functions ¶
func ConvertAPIs ¶
ConvertAPIs runtime.APIItems to []interface
Types ¶
type AuthorModule ¶
type AuthorModule struct {
// contains filtered or unexported fields
}
AuthorModule holds a pointer to the API
func NewAuthorModule ¶
func NewAuthorModule(logger *log.Logger, coreAPI CoreAPI, txStateAPI TransactionStateAPI) *AuthorModule
NewAuthorModule creates a new Author module.
func (*AuthorModule) HasKey ¶
HasKey Checks if the keystore has private keys for the given public key and key type.
func (*AuthorModule) HasSessionKeys ¶
func (am *AuthorModule) HasSessionKeys(r *http.Request, req *HasSessionKeyRequest, res *HasSessionKeyResponse) error
HasSessionKeys checks if the keystore has private keys for the given session public keys.
func (*AuthorModule) InsertKey ¶
func (am *AuthorModule) InsertKey(r *http.Request, req *KeyInsertRequest, _ *KeyInsertResponse) error
InsertKey inserts a key into the keystore
func (*AuthorModule) PendingExtrinsics ¶
func (am *AuthorModule) PendingExtrinsics(r *http.Request, req *EmptyRequest, res *PendingExtrinsicsResponse) error
PendingExtrinsics Returns all pending extrinsics
func (*AuthorModule) RemoveExtrinsic ¶
func (am *AuthorModule) RemoveExtrinsic(r *http.Request, _ *ExtrinsicOrHashRequest, _ *RemoveExtrinsicsResponse) error
RemoveExtrinsic Remove given extrinsic from the pool and temporarily ban it to prevent reimporting
func (*AuthorModule) RotateKeys ¶
func (am *AuthorModule) RotateKeys(r *http.Request, req *EmptyRequest, res *KeyRotateResponse) error
RotateKeys Generate new session keys and returns the corresponding public keys
func (*AuthorModule) SubmitAndWatchExtrinsic ¶
func (am *AuthorModule) SubmitAndWatchExtrinsic(r *http.Request, req *Extrinsic, res *ExtrinsicStatus) error
SubmitAndWatchExtrinsic Submit and subscribe to watch an extrinsic until unsubscribed
func (*AuthorModule) SubmitExtrinsic ¶
func (am *AuthorModule) SubmitExtrinsic(r *http.Request, req *Extrinsic, res *ExtrinsicHashResponse) error
SubmitExtrinsic Submit a fully formatted extrinsic for block inclusion
type BlockAPI ¶
type BlockAPI interface { GetHeader(hash common.Hash) (*types.Header, error) BestBlockHash() common.Hash GetBlockByHash(hash common.Hash) (*types.Block, error) GetHashByNumber(blockNumber uint) (common.Hash, error) GetFinalisedHash(uint64, uint64) (common.Hash, error) GetHighestFinalisedHash() (common.Hash, error) HasJustification(hash common.Hash) (bool, error) GetJustification(hash common.Hash) ([]byte, error) GetImportedBlockNotifierChannel() chan *types.Block FreeImportedBlockNotifierChannel(ch chan *types.Block) GetFinalisedNotifierChannel() chan *types.FinalisationInfo FreeFinalisedNotifierChannel(ch chan *types.FinalisationInfo) SubChain(start, end common.Hash) ([]common.Hash, error) RegisterRuntimeUpdatedChannel(ch chan<- runtime.Version) (uint32, error) UnregisterRuntimeUpdatedChannel(id uint32) bool GetRuntime(hash *common.Hash) (runtime.Instance, error) }
BlockAPI is the interface for the block state
type BlockFinalityAPI ¶
type BlockFinalityAPI interface { GetSetID() uint64 GetRound() uint64 GetVoters() grandpa.Voters PreVotes() []ed25519.PublicKeyBytes PreCommits() []ed25519.PublicKeyBytes }
BlockFinalityAPI is the interface for handling block finalisation methods
type BlockProducerAPI ¶
type BlockProducerAPI interface { Pause() error Resume() error EpochLength() uint64 SlotDuration() uint64 }
BlockProducerAPI is the interface for BlockProducer methods
type ChainBlock ¶
type ChainBlock struct { Header ChainBlockHeaderResponse `json:"header"` Body []string `json:"extrinsics"` }
ChainBlock struct to hold json instance of a block
type ChainBlockHeaderDigest ¶
type ChainBlockHeaderDigest struct {
Logs []string `json:"logs"`
}
ChainBlockHeaderDigest struct to hold digest logs
type ChainBlockHeaderResponse ¶
type ChainBlockHeaderResponse struct { ParentHash string `json:"parentHash"` Number string `json:"number"` StateRoot string `json:"stateRoot"` ExtrinsicsRoot string `json:"extrinsicsRoot"` Digest ChainBlockHeaderDigest `json:"digest"` }
ChainBlockHeaderResponse struct
func HeaderToJSON ¶
func HeaderToJSON(header types.Header) (ChainBlockHeaderResponse, error)
HeaderToJSON converts types.Header to ChainBlockHeaderResponse
type ChainBlockNumberRequest ¶
type ChainBlockNumberRequest struct {
Block interface{}
}
ChainBlockNumberRequest interface can accept string, float64 or []
type ChainBlockResponse ¶
type ChainBlockResponse struct {
Block ChainBlock `json:"block"`
}
ChainBlockResponse struct
type ChainFinalizedHeadRequest ¶
ChainFinalizedHeadRequest ...
type ChainHashRequest ¶
ChainHashRequest Hash as a string
type ChainHashResponse ¶
type ChainHashResponse interface{}
ChainHashResponse interface to handle response
type ChainModule ¶
type ChainModule struct {
// contains filtered or unexported fields
}
ChainModule is an RPC module providing access to storage API points.
func NewChainModule ¶
func NewChainModule(api BlockAPI) *ChainModule
NewChainModule creates a new State module.
func (*ChainModule) GetBlock ¶
func (cm *ChainModule) GetBlock(r *http.Request, req *ChainHashRequest, res *ChainBlockResponse) error
GetBlock Get header and body of a relay chain block. If no block hash is provided,
the latest block body will be returned.
func (*ChainModule) GetBlockHash ¶
func (cm *ChainModule) GetBlockHash(r *http.Request, req *ChainBlockNumberRequest, res *ChainHashResponse) error
GetBlockHash Get hash of the 'n-th' block in the canon chain. If no parameters are provided,
the latest block hash gets returned.
func (*ChainModule) GetFinalizedHead ¶
func (cm *ChainModule) GetFinalizedHead(r *http.Request, req *EmptyRequest, res *ChainHashResponse) error
GetFinalizedHead returns the most recently finalised block hash
func (*ChainModule) GetFinalizedHeadByRound ¶
func (cm *ChainModule) GetFinalizedHeadByRound( r *http.Request, req *ChainFinalizedHeadRequest, res *ChainHashResponse) error
GetFinalizedHeadByRound returns the hash of the block finalised at the given round and setID
func (*ChainModule) GetHeader ¶
func (cm *ChainModule) GetHeader(r *http.Request, req *ChainHashRequest, res *ChainBlockHeaderResponse) error
GetHeader Get header of a relay chain block. If no block hash is provided, the latest block header will be returned.
func (*ChainModule) SubscribeFinalizedHeads ¶
func (cm *ChainModule) SubscribeFinalizedHeads(_ *http.Request, _ *EmptyRequest, _ *ChainBlockHeaderResponse) error
SubscribeFinalizedHeads handled by websocket handler, but this func should remain
here so it's added to rpc_methods list
func (*ChainModule) SubscribeNewHead ¶
func (cm *ChainModule) SubscribeNewHead(r *http.Request, req *EmptyRequest, res *ChainBlockHeaderResponse) error
SubscribeNewHead handled by websocket handler, but this func should remain
here so it's added to rpc_methods list
func (*ChainModule) SubscribeNewHeads ¶
func (cm *ChainModule) SubscribeNewHeads(r *http.Request, req *EmptyRequest, res *ChainBlockHeaderResponse) error
SubscribeNewHeads handled by websocket handler, but this func should remain
here so it's added to rpc_methods list
type ChildStateModule ¶
type ChildStateModule struct {
// contains filtered or unexported fields
}
ChildStateModule is the module responsible to implement all the childstate RPC calls
func NewChildStateModule ¶
func NewChildStateModule(s StorageAPI, b BlockAPI) *ChildStateModule
NewChildStateModule returns a new ChildStateModule
func (*ChildStateModule) GetKeys ¶
func (cs *ChildStateModule) GetKeys(_ *http.Request, req *GetKeysRequest, res *[]string) error
GetKeys returns the keys from the specified child storage. The keys can also be filtered based on a prefix.
func (*ChildStateModule) GetStorage ¶
func (cs *ChildStateModule) GetStorage( _ *http.Request, req *ChildStateStorageRequest, res *StateStorageResponse) error
GetStorage returns a child storage entry.
func (*ChildStateModule) GetStorageHash ¶
func (cs *ChildStateModule) GetStorageHash(_ *http.Request, req *GetStorageHash, res *string) error
GetStorageHash returns the hash of a child storage entry
func (*ChildStateModule) GetStorageSize ¶
func (cs *ChildStateModule) GetStorageSize(_ *http.Request, req *GetChildStorageRequest, res *uint64) error
GetStorageSize returns the size of a child storage entry.
type ChildStateStorageRequest ¶
type ChildStateStorageRequest struct { ChildStorageKey []byte `json:"childStorageKey"` Key []byte `json:"key"` Hash *common.Hash `json:"block"` }
ChildStateStorageRequest holds json fields
type CoreAPI ¶
type CoreAPI interface { InsertKey(kp crypto.Keypair, keystoreType string) error HasKey(pubKeyStr string, keyType string) (bool, error) GetRuntimeVersion(bhash *common.Hash) (runtime.Version, error) HandleSubmittedExtrinsic(types.Extrinsic) error GetMetadata(bhash *common.Hash) ([]byte, error) QueryStorage(from, to common.Hash, keys ...string) (map[common.Hash]core.QueryKeyValueChanges, error) DecodeSessionKeys(enc []byte) ([]byte, error) GetReadProofAt(block common.Hash, keys [][]byte) (common.Hash, [][]byte, error) }
CoreAPI is the interface for the core methods
type DevModule ¶
type DevModule struct {
// contains filtered or unexported fields
}
DevModule is an RPC module that provides developer endpoints
func NewDevModule ¶
func NewDevModule(bp BlockProducerAPI, net NetworkAPI) *DevModule
NewDevModule creates a new Dev module.
func (*DevModule) EpochLength ¶
EpochLength Dev RPC to return epoch length
func (*DevModule) SlotDuration ¶
SlotDuration Dev RPC to return slot duration
type EmptyRequest ¶
type EmptyRequest struct{}
EmptyRequest represents an RPC request with no fields
type ExtrinsicHashResponse ¶
type ExtrinsicHashResponse string
ExtrinsicHashResponse is used as Extrinsic hash response
type ExtrinsicOrHash ¶
ExtrinsicOrHash is a type for Hash and Extrinsic array of bytes
type ExtrinsicOrHashRequest ¶
type ExtrinsicOrHashRequest []ExtrinsicOrHash
ExtrinsicOrHashRequest is a array of ExtrinsicOrHash
type ExtrinsicStatus ¶
type ExtrinsicStatus struct { IsFuture bool IsReady bool IsFinalized bool AsFinalized common.Hash IsUsurped bool AsUsurped common.Hash IsBroadcast bool AsBroadcast []string IsDropped bool IsInvalid bool }
ExtrinsicStatus holds the actual valid statuses
type GenSyncSpecRequest ¶
type GenSyncSpecRequest struct {
Raw bool
}
GenSyncSpecRequest represents request to get chain specification.
type GetChildStorageRequest ¶
GetChildStorageRequest the request to get the entry child storage hash
type GetKeysRequest ¶
GetKeysRequest represents the request to retrieve the keys of a child storage
type GetStorageHash ¶
GetStorageHash the request to get the entry child storage hash
type GrandpaModule ¶
type GrandpaModule struct {
// contains filtered or unexported fields
}
GrandpaModule init parameters
func NewGrandpaModule ¶
func NewGrandpaModule(api BlockAPI, finalityAPI BlockFinalityAPI) *GrandpaModule
NewGrandpaModule creates a new Grandpa rpc module.
func (*GrandpaModule) ProveFinality ¶
func (gm *GrandpaModule) ProveFinality(r *http.Request, req *ProveFinalityRequest, res *ProveFinalityResponse) error
ProveFinality for the provided block range. Returns NULL if there are no known finalised blocks in the range. If no authorities set is provided, the current one will be attempted.
func (*GrandpaModule) RoundState ¶
func (gm *GrandpaModule) RoundState(r *http.Request, req *EmptyRequest, res *RoundStateResponse) error
RoundState returns the state of the current best round state as well as the ongoing background rounds.
type HasSessionKeyRequest ¶
type HasSessionKeyRequest struct {
PublicKeys string
}
HasSessionKeyRequest is used to receive the rpc data
type HasSessionKeyResponse ¶
type HasSessionKeyResponse bool
HasSessionKeyResponse is the response to the RPC call author_hasSessionKeys
type KeyInsertRequest ¶
KeyInsertRequest is used as model for the JSON
type KeyRotateResponse ¶
type KeyRotateResponse []byte
KeyRotateResponse is a byte array used to rotate
type MethodsResponse ¶
type MethodsResponse struct {
Methods []string `json:"methods"`
}
MethodsResponse struct representing methods
type NetworkAPI ¶
type NetworkAPI interface { Health() common.Health NetworkState() common.NetworkState Peers() []common.PeerInfo NodeRoles() byte Stop() error Start() error IsStopped() bool StartingBlock() int64 AddReservedPeers(addrs ...string) error RemoveReservedPeers(addrs ...string) error }
NetworkAPI interface for network state methods
type NetworkStateString ¶
NetworkStateString Network State represented as string so JSON encode/decoding works
type OffchainLocalStorageGet ¶
OffchainLocalStorageGet represents the request format to retrieve data from offchain storage
type OffchainLocalStorageSet ¶
OffchainLocalStorageSet represents the request format to store data into offchain storage
type OffchainModule ¶
type OffchainModule struct {
// contains filtered or unexported fields
}
OffchainModule defines the RPC module to Offchain methods
func NewOffchainModule ¶
func NewOffchainModule(ns RuntimeStorageAPI) *OffchainModule
NewOffchainModule creates a RPC module to Offchain methods
func (*OffchainModule) LocalStorageGet ¶
func (s *OffchainModule) LocalStorageGet(_ *http.Request, req *OffchainLocalStorageGet, res *StringResponse) error
LocalStorageGet get offchain local storage under given key and prefix
func (*OffchainModule) LocalStorageSet ¶
func (s *OffchainModule) LocalStorageSet(_ *http.Request, req *OffchainLocalStorageSet, _ *StringResponse) error
LocalStorageSet set offchain local storage under given key and prefix
type PaymentModule ¶
type PaymentModule struct {
// contains filtered or unexported fields
}
PaymentModule holds all the RPC implementation of polkadot payment rpc api
func NewPaymentModule ¶
func NewPaymentModule(blockAPI BlockAPI) *PaymentModule
NewPaymentModule returns a pointer to PaymentModule
func (*PaymentModule) QueryInfo ¶
func (p *PaymentModule) QueryInfo(_ *http.Request, req *PaymentQueryInfoRequest, res *PaymentQueryInfoResponse) error
QueryInfo query the known data about the fee of an extrinsic at the given block
type PaymentQueryInfoRequest ¶
type PaymentQueryInfoRequest struct { // hex SCALE encoded extrinsic Ext string // hex optional block hash indicating the state Hash *common.Hash }
PaymentQueryInfoRequest represents the request to get the fee of an extrinsic in a given block
type PaymentQueryInfoResponse ¶
type PaymentQueryInfoResponse struct { Weight uint64 `json:"weight"` Class int `json:"class"` PartialFee string `json:"partialFee"` }
PaymentQueryInfoResponse holds the response fields to the query info RPC method
type PendingExtrinsicsResponse ¶
type PendingExtrinsicsResponse []string
PendingExtrinsicsResponse is a bi-dimensional array of bytes for allocating the pending extrinsics
type ProveFinalityRequest ¶
type ProveFinalityRequest struct {
// contains filtered or unexported fields
}
ProveFinalityRequest request struct
type ProveFinalityResponse ¶
type ProveFinalityResponse [][]byte
ProveFinalityResponse is an optional SCALE encoded proof array
type RPCModule ¶
type RPCModule struct {
// contains filtered or unexported fields
}
RPCModule is a RPC module providing access to RPC methods
func NewRPCModule ¶
NewRPCModule creates a new RPC api module
func (*RPCModule) Methods ¶
func (rm *RPCModule) Methods(r *http.Request, req *EmptyRequest, res *MethodsResponse) error
Methods responds with list of methods available via RPC call
type RemoveExtrinsicsResponse ¶
RemoveExtrinsicsResponse is a array of hash used to Remove extrinsics
type RoundState ¶
type RoundState struct { Round uint32 `json:"round"` TotalWeight uint32 `json:"totalWeight"` ThresholdWeight uint32 `json:"thresholdWeight"` Prevotes Votes `json:"prevotes"` Precommits Votes `json:"precommits"` }
RoundState json format for roundState RPC call
type RoundStateResponse ¶
type RoundStateResponse struct { SetID uint32 `json:"setId"` Best RoundState `json:"best"` Background []RoundState `json:"background"` }
RoundStateResponse response to roundState RPC call
type RuntimeStorageAPI ¶
type RuntimeStorageAPI interface { SetLocal(k, v []byte) error SetPersistent(k, v []byte) error GetLocal(k []byte) ([]byte, error) GetPersistent(k []byte) ([]byte, error) }
RuntimeStorageAPI is the interface to interacts with the node storage
type StateCallRequest ¶
type StateCallRequest struct { Method string `json:"method"` Data []byte `json:"data"` Block *common.Hash `json:"block"` }
StateCallRequest holds json fields
type StateChildStorageResponse ¶
type StateChildStorageResponse string
StateChildStorageResponse is a hash value
type StateChildStorageSizeResponse ¶
type StateChildStorageSizeResponse uint64
StateChildStorageSizeResponse is a unint value
type StateGetReadProofRequest ¶
StateGetReadProofRequest json fields
type StateGetReadProofResponse ¶
StateGetReadProofResponse holds the response format
type StateKeysResponse ¶
type StateKeysResponse [][]byte
StateKeysResponse field to store the state keys
type StateMetadataResponse ¶
type StateMetadataResponse string
StateMetadataResponse holds the metadata
type StateModule ¶
type StateModule struct {
// contains filtered or unexported fields
}
StateModule is an RPC module providing access to storage API points.
func NewStateModule ¶
func NewStateModule(net NetworkAPI, storage StorageAPI, core CoreAPI) *StateModule
NewStateModule creates a new State module.
func (*StateModule) Call ¶
func (sm *StateModule) Call(_ *http.Request, _ *StateCallRequest, _ *StateCallResponse) error
Call isn't implemented properly yet.
func (*StateModule) GetKeysPaged ¶
func (sm *StateModule) GetKeysPaged(_ *http.Request, req *StateStorageKeyRequest, res *StateStorageKeysResponse) error
GetKeysPaged Returns the keys with prefix with pagination support.
func (*StateModule) GetMetadata ¶
func (sm *StateModule) GetMetadata(_ *http.Request, req *StateRuntimeMetadataQuery, res *StateMetadataResponse) error
GetMetadata calls runtime Metadata_metadata function
func (*StateModule) GetPairs ¶
func (sm *StateModule) GetPairs(_ *http.Request, req *StatePairRequest, res *StatePairResponse) error
GetPairs returns the keys with prefix, leave empty to get all the keys.
func (*StateModule) GetReadProof ¶
func (sm *StateModule) GetReadProof( _ *http.Request, req *StateGetReadProofRequest, res *StateGetReadProofResponse) error
GetReadProof returns the proof to the received storage keys
func (*StateModule) GetRuntimeVersion ¶
func (sm *StateModule) GetRuntimeVersion( _ *http.Request, req *StateRuntimeVersionRequest, res *StateRuntimeVersionResponse) error
GetRuntimeVersion Get the runtime version at a given block.
If no block hash is provided, the latest version gets returned.
func (*StateModule) GetStorage ¶
func (sm *StateModule) GetStorage( _ *http.Request, req *StateStorageRequest, res *StateStorageResponse) error
GetStorage Returns a storage entry at a specific block's state. If not block hash is provided, the latest value is returned.
func (*StateModule) GetStorageHash ¶
func (sm *StateModule) GetStorageHash( _ *http.Request, req *StateStorageHashRequest, res *StateStorageHashResponse) error
GetStorageHash returns the blake2b hash of a storage entry at a block's state.
If no block hash is provided, the latest value is returned.
func (*StateModule) GetStorageSize ¶
func (sm *StateModule) GetStorageSize( _ *http.Request, req *StateStorageSizeRequest, res *StateStorageSizeResponse) error
GetStorageSize returns the size of a storage entry at a block's state.
If no block hash is provided, the latest value is used.
func (*StateModule) QueryStorage ¶
func (sm *StateModule) QueryStorage( _ *http.Request, req *StateStorageQueryRangeRequest, res *[]StorageChangeSetResponse) error
QueryStorage isn't implemented properly yet.
func (*StateModule) SubscribeRuntimeVersion ¶
func (sm *StateModule) SubscribeRuntimeVersion( r *http.Request, _ *StateStorageQueryRangeRequest, res *StateRuntimeVersionResponse) error
SubscribeRuntimeVersion initialised a runtime version subscription and returns the current version See dot/rpc/subscription
func (*StateModule) SubscribeStorage ¶
func (*StateModule) SubscribeStorage( _ *http.Request, _ *StateStorageQueryRangeRequest, _ *StorageChangeSetResponse) error
SubscribeStorage Storage subscription. If storage keys are specified, it creates a message for each block which
changes the specified storage keys. If none are specified, then it creates a message for every block. This endpoint communicates over the Websocket protocol, but this func should remain here so it's added to rpc_methods list
type StatePairRequest ¶
StatePairRequest holds json field
type StateRuntimeMetadataQuery ¶
StateRuntimeMetadataQuery is a hash value
type StateRuntimeVersionRequest ¶
StateRuntimeVersionRequest is hash value
type StateRuntimeVersionResponse ¶
type StateRuntimeVersionResponse struct { SpecName string `json:"specName"` ImplName string `json:"implName"` AuthoringVersion uint32 `json:"authoringVersion"` SpecVersion uint32 `json:"specVersion"` ImplVersion uint32 `json:"implVersion"` TransactionVersion uint32 `json:"transactionVersion"` Apis []interface{} `json:"apis"` }
StateRuntimeVersionResponse is the runtime version response
type StateStorageDataResponse ¶
type StateStorageDataResponse string
StateStorageDataResponse field to store data response
type StateStorageHashRequest ¶
StateStorageHashRequest holds json field
type StateStorageHashResponse ¶
type StateStorageHashResponse string
StateStorageHashResponse is a hash value
type StateStorageKeyRequest ¶
type StateStorageKeyRequest struct { Prefix string `json:"prefix"` Qty uint32 `json:"qty"` AfterKey string `json:"afterKey"` Block *common.Hash `json:"block"` }
StateStorageKeyRequest holds json fields
type StateStorageKeysQuery ¶
type StateStorageKeysQuery [][]byte
StateStorageKeysQuery field to store storage keys
type StateStorageKeysResponse ¶
type StateStorageKeysResponse []string
StateStorageKeysResponse field for storage keys
type StateStorageQueryRangeRequest ¶
type StateStorageQueryRangeRequest struct { Keys []string `json:"keys" validate:"required"` StartBlock common.Hash `json:"startBlock" validate:"required"` EndBlock common.Hash `json:"block"` }
StateStorageQueryRangeRequest holds json fields
type StateStorageRequest ¶
StateStorageRequest holds json field
type StateStorageResponse ¶
type StateStorageResponse string
StateStorageResponse storage hash value
type StateStorageSizeRequest ¶
StateStorageSizeRequest holds json field
type StateStorageSizeResponse ¶
type StateStorageSizeResponse uint64
StateStorageSizeResponse the default size for response
type StorageAPI ¶
type StorageAPI interface { GetStorage(root *common.Hash, key []byte) ([]byte, error) GetStorageChild(root *common.Hash, keyToChild []byte) (*trie.Trie, error) GetStorageFromChild(root *common.Hash, keyToChild, key []byte) ([]byte, error) GetStorageByBlockHash(bhash *common.Hash, key []byte) ([]byte, error) Entries(root *common.Hash) (map[string][]byte, error) GetStateRootFromBlock(bhash *common.Hash) (*common.Hash, error) GetKeysWithPrefix(root *common.Hash, prefix []byte) ([][]byte, error) RegisterStorageObserver(observer state.Observer) UnregisterStorageObserver(observer state.Observer) }
StorageAPI is the interface for the storage state
type StorageChangeSetResponse ¶
type StorageChangeSetResponse struct { Block *common.Hash `json:"block"` Changes [][]string `json:"changes"` }
StorageChangeSetResponse is the struct that holds the block and changes
type SyncAPI ¶
type SyncAPI interface {
HighestBlock() uint
}
SyncAPI is the interface to interact with the sync service
type SyncStateAPI ¶
SyncStateAPI is the interface to interact with sync state.
func NewStateSync ¶
func NewStateSync(gData *genesis.Data, storageAPI StorageAPI) (SyncStateAPI, error)
NewStateSync creates an instance of SyncStateAPI given a chain specification.
type SyncStateModule ¶
type SyncStateModule struct {
// contains filtered or unexported fields
}
SyncStateModule is an RPC module to interact with sync state methods.
func NewSyncStateModule ¶
func NewSyncStateModule(syncStateAPI SyncStateAPI) *SyncStateModule
NewSyncStateModule creates an instance of SyncStateModule given SyncStateAPI.
func (*SyncStateModule) GenSyncSpec ¶
func (ss *SyncStateModule) GenSyncSpec(_ *http.Request, req *GenSyncSpecRequest, res *genesis.Genesis) error
GenSyncSpec returns the JSON serialised chain specification running the node (i.e. the current state state), with a sync state.
type SyncStateResponse ¶
type SyncStateResponse struct { CurrentBlock uint32 `json:"currentBlock"` HighestBlock uint32 `json:"highestBlock"` StartingBlock uint32 `json:"startingBlock"` }
SyncStateResponse is the struct to return on the system_syncState rpc call
type SystemAPI ¶
type SystemAPI interface { SystemName() string SystemVersion() string Properties() map[string]interface{} ChainType() string ChainName() string }
SystemAPI is the interface for handling system methods
type SystemHealthResponse ¶
SystemHealthResponse struct to marshal json
type SystemModule ¶
type SystemModule struct {
// contains filtered or unexported fields
}
SystemModule is an RPC module providing access to core API points
func NewSystemModule ¶
func NewSystemModule(net NetworkAPI, sys SystemAPI, core CoreAPI, storage StorageAPI, txAPI TransactionStateAPI, blockAPI BlockAPI, syncAPI SyncAPI) *SystemModule
NewSystemModule creates a new API instance
func (*SystemModule) AccountNextIndex ¶
func (sm *SystemModule) AccountNextIndex(r *http.Request, req *StringRequest, res *U64Response) error
AccountNextIndex Returns the next valid index (aka. nonce) for given account.
func (*SystemModule) AddReservedPeer ¶
func (sm *SystemModule) AddReservedPeer(r *http.Request, req *StringRequest, res *[]byte) error
AddReservedPeer adds a reserved peer. The string parameter should encode a p2p multiaddr.
func (*SystemModule) Chain ¶
func (sm *SystemModule) Chain(r *http.Request, req *EmptyRequest, res *string) error
Chain returns the runtime chain
func (*SystemModule) ChainType ¶
func (sm *SystemModule) ChainType(r *http.Request, req *EmptyRequest, res *string) error
ChainType returns the chain type
func (*SystemModule) Health ¶
func (sm *SystemModule) Health(r *http.Request, req *EmptyRequest, res *SystemHealthResponse) error
Health returns the information about the health of the network
func (*SystemModule) LocalListenAddresses ¶
func (sm *SystemModule) LocalListenAddresses(r *http.Request, req *EmptyRequest, res *[]string) error
LocalListenAddresses Returns the libp2p multiaddresses that the local node is listening on
func (*SystemModule) LocalPeerId ¶
func (sm *SystemModule) LocalPeerId(r *http.Request, req *EmptyRequest, res *string) error
LocalPeerId Returns the base58-encoded PeerId fo the node. nolint
func (*SystemModule) Name ¶
func (sm *SystemModule) Name(r *http.Request, req *EmptyRequest, res *string) error
Name returns the runtime name
func (*SystemModule) NetworkState ¶
func (sm *SystemModule) NetworkState(r *http.Request, req *EmptyRequest, res *SystemNetworkStateResponse) error
NetworkState returns the network state (basic information about the host)
func (*SystemModule) NodeRoles ¶
func (sm *SystemModule) NodeRoles(r *http.Request, req *EmptyRequest, res *[]interface{}) error
NodeRoles Returns the roles the node is running as.
func (*SystemModule) Peers ¶
func (sm *SystemModule) Peers(r *http.Request, req *EmptyRequest, res *SystemPeersResponse) error
Peers returns peer information for each connected and confirmed peer
func (*SystemModule) Properties ¶
func (sm *SystemModule) Properties(r *http.Request, req *EmptyRequest, res *interface{}) error
Properties returns the runtime properties
func (*SystemModule) RemoveReservedPeer ¶
func (sm *SystemModule) RemoveReservedPeer(r *http.Request, req *StringRequest, res *[]byte) error
RemoveReservedPeer remove a reserved peer. The string should encode only the PeerId
func (*SystemModule) SyncState ¶
func (sm *SystemModule) SyncState(r *http.Request, req *EmptyRequest, res *SyncStateResponse) error
SyncState Returns the state of the syncing of the node.
func (*SystemModule) Version ¶
func (sm *SystemModule) Version(r *http.Request, req *EmptyRequest, res *string) error
Version returns the runtime version
type SystemNetworkStateResponse ¶
type SystemNetworkStateResponse struct {
NetworkState NetworkStateString `json:"networkState"`
}
SystemNetworkStateResponse struct to marshal json
type SystemPeersResponse ¶
SystemPeersResponse struct to marshal json
type TransactionStateAPI ¶
type TransactionStateAPI interface { AddToPool(*transaction.ValidTransaction) common.Hash Pop() *transaction.ValidTransaction Peek() *transaction.ValidTransaction Pending() []*transaction.ValidTransaction GetStatusNotifierChannel(ext types.Extrinsic) chan transaction.Status FreeStatusNotifierChannel(ch chan transaction.Status) }
TransactionStateAPI ...