package state

import "github.com/centrifuge/go-substrate-rpc-client/v4/rpc/state"

Index

Types

type RuntimeVersionSubscription

type RuntimeVersionSubscription struct {
	// contains filtered or unexported fields
}

RuntimeVersionSubscription is a subscription established through one of the Client's subscribe methods.

func (*RuntimeVersionSubscription) Chan

Chan returns the subscription channel.

The channel is closed when Unsubscribe is called on the subscription.

func (*RuntimeVersionSubscription) Err

func (s *RuntimeVersionSubscription) Err() <-chan error

Err returns the subscription error channel. The intended use of Err is to schedule resubscription when the client connection is closed unexpectedly.

The error channel receives a value when the subscription has ended due to an error. The received error is nil if Close has been called on the underlying client and no other error has occurred.

The error channel is closed when Unsubscribe is called on the subscription.

func (*RuntimeVersionSubscription) Unsubscribe

func (s *RuntimeVersionSubscription) Unsubscribe()

Unsubscribe unsubscribes the notification and closes the error channel. It can safely be called more than once.

type State

type State interface {
	GetStorage(key types.StorageKey, target interface{}, blockHash types.Hash) (ok bool, err error)
	GetStorageLatest(key types.StorageKey, target interface{}) (ok bool, err error)
	GetStorageRaw(key types.StorageKey, blockHash types.Hash) (*types.StorageDataRaw, error)
	GetStorageRawLatest(key types.StorageKey) (*types.StorageDataRaw, error)

	GetChildStorageSize(childStorageKey, key types.StorageKey, blockHash types.Hash) (types.U64, error)
	GetChildStorageSizeLatest(childStorageKey, key types.StorageKey) (types.U64, error)
	GetChildStorage(childStorageKey, key types.StorageKey, target interface{}, blockHash types.Hash) (ok bool, err error)
	GetChildStorageLatest(childStorageKey, key types.StorageKey, target interface{}) (ok bool, err error)
	GetChildStorageRaw(childStorageKey, key types.StorageKey, blockHash types.Hash) (*types.StorageDataRaw, error)
	GetChildStorageRawLatest(childStorageKey, key types.StorageKey) (*types.StorageDataRaw, error)

	GetMetadata(blockHash types.Hash) (*types.Metadata, error)
	GetMetadataLatest() (*types.Metadata, error)

	GetStorageHash(key types.StorageKey, blockHash types.Hash) (types.Hash, error)
	GetStorageHashLatest(key types.StorageKey) (types.Hash, error)

	SubscribeStorageRaw(keys []types.StorageKey) (*StorageSubscription, error)

	GetRuntimeVersion(blockHash types.Hash) (*types.RuntimeVersion, error)
	GetRuntimeVersionLatest() (*types.RuntimeVersion, error)

	GetChildKeys(childStorageKey, prefix types.StorageKey, blockHash types.Hash) ([]types.StorageKey, error)
	GetChildKeysLatest(childStorageKey, prefix types.StorageKey) ([]types.StorageKey, error)

	SubscribeRuntimeVersion() (*RuntimeVersionSubscription, error)

	QueryStorage(keys []types.StorageKey, startBlock types.Hash, block types.Hash) ([]types.StorageChangeSet, error)
	QueryStorageLatest(keys []types.StorageKey, startBlock types.Hash) ([]types.StorageChangeSet, error)

	QueryStorageAt(keys []types.StorageKey, block types.Hash) ([]types.StorageChangeSet, error)
	QueryStorageAtLatest(keys []types.StorageKey) ([]types.StorageChangeSet, error)

	GetKeys(prefix types.StorageKey, blockHash types.Hash) ([]types.StorageKey, error)
	GetKeysLatest(prefix types.StorageKey) ([]types.StorageKey, error)

	GetStorageSize(key types.StorageKey, blockHash types.Hash) (types.U64, error)
	GetStorageSizeLatest(key types.StorageKey) (types.U64, error)

	GetChildStorageHash(childStorageKey, key types.StorageKey, blockHash types.Hash) (types.Hash, error)
	GetChildStorageHashLatest(childStorageKey, key types.StorageKey) (types.Hash, error)
}

func NewState

func NewState(c client.Client) State

NewState creates a new state struct

type StorageSubscription

type StorageSubscription struct {
	// contains filtered or unexported fields
}

StorageSubscription is a subscription established through one of the Client's subscribe methods.

func (*StorageSubscription) Chan

func (s *StorageSubscription) Chan() <-chan types.StorageChangeSet

Chan returns the subscription channel.

The channel is closed when Unsubscribe is called on the subscription.

func (*StorageSubscription) Err

func (s *StorageSubscription) Err() <-chan error

Err returns the subscription error channel. The intended use of Err is to schedule resubscription when the client connection is closed unexpectedly.

The error channel receives a value when the subscription has ended due to an error. The received error is nil if Close has been called on the underlying client and no other error has occurred.

The error channel is closed when Unsubscribe is called on the subscription.

func (*StorageSubscription) Unsubscribe

func (s *StorageSubscription) Unsubscribe()

Unsubscribe unsubscribes the notification and closes the error channel. It can safely be called more than once.

Source Files

get_child_keys.go get_child_storage.go get_child_storage_hash.go get_child_storage_size.go get_keys.go get_metadata.go get_runtime_version.go get_storage.go get_storage_hash.go get_storage_size.go query_storage.go query_storage_at.go state.go subscribe_runtime_version.go subscribe_storage.go

Directories

PathSynopsis
rpc/state/mocks
Version
v4.2.1 (latest)
Published
Dec 5, 2023
Platform
linux/amd64
Imports
7 packages
Last checked
1 week ago

Tools for package owners.