rpc

package
v0.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 17 Imported by: 12

Documentation

Index

Constants

View Source
const TxVersionInfo = "84"

Variables

View Source
var (
	InvalidMetadataErr      = errors.New("invalid Metadata")
	InvalidCallErr          = errors.New("invalid call name or module name")
	InvalidCallArgsErr      = errors.New("invalid call args length")
	NotSetKeyRingErr        = errors.New("not set keyring")
	NetworkErr              = errors.New("network error")
	SubscribeTransactionErr = errors.New("subscribe transaction failed")
)

Functions

func AccountNonce

func AccountNonce(id int, address string) []byte

func AuthorSubmitAndWatchExtrinsic added in v0.5.0

func AuthorSubmitAndWatchExtrinsic(id int, signedExtrinsic string) []byte

AuthorSubmitAndWatchExtrinsic submits an extrinsic and watches it until block finalized

func AuthorSubmitExtrinsic added in v0.5.0

func AuthorSubmitExtrinsic(id int, signedExtrinsic string) []byte

AuthorSubmitExtrinsic submits an extrinsic and returns the hash

func ChainGetBlock

func ChainGetBlock(id int, hash string) []byte

func ChainGetBlockHash

func ChainGetBlockHash(id int, blockNum int) []byte

func ChainGetRuntimeVersion

func ChainGetRuntimeVersion(id int, hash ...string) []byte

func ChainSubscribeFinalizedHeads

func ChainSubscribeFinalizedHeads(id int) []byte

func ChainSubscribeNewHead

func ChainSubscribeNewHead(id int) []byte

func GetChainGetBlockHash added in v0.5.0

func GetChainGetBlockHash(p websocket.WsConn, blockNum int) (string, error)

func GetMetadataByHash

func GetMetadataByHash(p websocket.WsConn, hash ...string) (string, error)

func GetPaymentQueryInfo

func GetPaymentQueryInfo(p websocket.WsConn, encodedExtrinsic string) (paymentInfo *model.PaymentQueryInfo, err error)

func GetStateGetRuntimeVersion added in v0.5.0

func GetStateGetRuntimeVersion(p websocket.WsConn, hash string) *model.RuntimeVersion

func GetSystemAccountNextIndex added in v0.5.0

func GetSystemAccountNextIndex(p websocket.WsConn, accountId string) uint64

func GetSystemProperties

func GetSystemProperties(p websocket.WsConn) (*model.Properties, error)

func ReadKeysPaged

func ReadKeysPaged(p websocket.WsConn, module, prefix string) (r []string, scale string, err error)

func ReadStorage

func ReadStorage(p websocket.WsConn, module, prefix string, hash string, arg ...string) (r storage.StateStorage, err error)

ReadStorage Read substrate storage

func ReadStorageByKey

func ReadStorageByKey(p websocket.WsConn, key storageKey.StorageKey, hash string) (r storage.StateStorage, err error)

func StateGetKeysPaged

func StateGetKeysPaged(id int, storageKey string) []byte

func StateGetMetadata

func StateGetMetadata(id int, hash ...string) []byte

func StateGetRuntimeVersion added in v0.5.0

func StateGetRuntimeVersion(id int, hash string) []byte

StateGetRuntimeVersion Query the runtime version

func StateGetStorage

func StateGetStorage(id int, storageKey string, hash string) []byte

func StateQueryStorage added in v0.5.0

func StateQueryStorage(id int, key, start, end string) []byte

StateQueryStorage Query historical storage entries (by key) starting from a start block key Vec<StorageKey>

func StateQueryStorageAt

func StateQueryStorageAt(id int, key, start string) []byte

StateQueryStorageAt Query storage entries (by key) starting at block hash given as the second parameter key Vec<StorageKey>

func StateSubscribeStorage

func StateSubscribeStorage(id int, storageKey []string) []byte

func SystemAccountNextIndex added in v0.5.0

func SystemAccountNextIndex(id int, hash string) []byte

SystemAccountNextIndex Query the next account index of an account

func SystemChain

func SystemChain(id int) []byte

func SystemHealth

func SystemHealth(id int) []byte

func SystemName

func SystemName(id int) []byte

func SystemPaymentQueryInfo

func SystemPaymentQueryInfo(id int, encodedExtrinsic string) []byte

func SystemProperties

func SystemProperties(id int) []byte

func SystemVersion

func SystemVersion(id int) []byte

Types

type Client added in v0.5.0

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

func (*Client) SendAuthorSubmitAndWatchExtrinsic added in v0.5.0

func (cl *Client) SendAuthorSubmitAndWatchExtrinsic(signedExtrinsic string) (string, error)

SendAuthorSubmitAndWatchExtrinsic send extrinsic and watch will call rpc author_submitAndWatchExtrinsic

func (*Client) SendAuthorSubmitExtrinsic added in v0.5.0

func (cl *Client) SendAuthorSubmitExtrinsic(signedExtrinsic string) (string, error)

SendAuthorSubmitExtrinsic send extrinsic will call rpc author_submitExtrinsic

func (*Client) SetKeyRing added in v0.5.0

func (cl *Client) SetKeyRing(keyRing keyring.IKeyRing)

func (*Client) SetMetadata added in v0.5.0

func (cl *Client) SetMetadata(metadata *metadata.Instant)

func (*Client) SignTransaction added in v0.5.0

func (cl *Client) SignTransaction(moduleName, callName string, args ...interface{}) (string, error)

SignTransaction sign transaction p: websocket connection keyRing: keyring moduleName: module name callName: call name args: call args return: transaction hex

type Param

type Param struct {
	Id      int         `json:"id"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params"`
	JsonRpc string      `json:"jsonrpc"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL