rpc

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

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

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

AuthorSubmitAndWatchExtrinsic submits an extrinsic and watches it until block finalized

func AuthorSubmitExtrinsic

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

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

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

func GetSystemAccountNextIndex

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

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

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

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

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

func (*Client) SendAuthorSubmitAndWatchExtrinsic

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

SendAuthorSubmitAndWatchExtrinsic send extrinsic and watch will call rpc author_submitAndWatchExtrinsic

func (*Client) SendAuthorSubmitExtrinsic

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

SendAuthorSubmitExtrinsic send extrinsic will call rpc author_submitExtrinsic

func (*Client) SetKeyRing

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

func (*Client) SetMetadata

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

func (*Client) SignTransaction

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 CustomTransaction

type CustomTransaction struct {
	CallIndex,
	GenesisHash,
	Era string
	Nonce            int
	RuntimeVersion   *model.RuntimeVersion
	Meta             *types.MetadataStruct
	Keyring          keyring.IKeyRing
	ScaleDecoderOpts *types.ScaleDecoderOption
	Params           []scalecodec.ExtrinsicParam
}

func (*CustomTransaction) GetEncodedCall

func (customTx *CustomTransaction) GetEncodedCall() string

func (*CustomTransaction) SignTransactionCustom

func (customTx *CustomTransaction) SignTransactionCustom() (string, error)

type ICustomTranscation

type ICustomTranscation interface {
	SignTransactionCustom() (string, error)
}

func NewCustomTransaction

func NewCustomTransaction(
	callIndex, genesisHash, era string,
	nonce int,
	version *model.RuntimeVersion,
	meta *types.MetadataStruct,
	kr keyring.IKeyRing,
	scaleDecOpts *types.ScaleDecoderOption,
	params []scalecodec.ExtrinsicParam) ICustomTranscation

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