core

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 6

Documentation

Index

Constants

View Source
const (
	MethodHandlerKindCall          methodHandlerKind = "call"
	MethodHandlerKindQuery         methodHandlerKind = "query"
	MethodHandlerKindMessageResult methodHandlerKind = "message_result"
)

These constants represent the kinds of methods that handlers handle.

View Source
const (
	// GasUsedEventCode is the event code for the gas used event.
	GasUsedEventCode = 1
)
View Source
const ModuleName = "core"

ModuleName is the core module name.

Variables

This section is empty.

Functions

func DecodeEvent added in v0.2.0

func DecodeEvent(event *types.Event) ([]client.DecodedEvent, error)

DecodeEvent decodes a core event.

Types

type CallDataPublicKeyResponse added in v0.3.0

type CallDataPublicKeyResponse struct {
	// PublicKey is the signed runtime call data public key.
	PublicKey types.SignedPublicKey `json:"public_key"`
	// Epoch is the epoch of the ephemeral runtime key.
	Epoch uint64 `json:"epoch,omitempty"`
}

CallDataPublicKeyResponse is the response of the core.CallDataPublicKey query.

type EstimateGasQuery added in v0.2.0

type EstimateGasQuery struct {
	// Caller is the address of the caller for which to do estimation. If not specified the
	// authentication information from the passed transaction is used.
	Caller *types.CallerAddress `json:"caller,omitempty"`
	// Tx is the unsigned transaction to estimate.
	Tx *types.Transaction `json:"tx"`
	// PropagateFailures indicates if the estimate gas query should propagate transaction failures.
	PropagateFailures bool `json:"propagate_failures,omitempty"`
}

EstimateGasQuery is the body of the core.EstimateGas query.

type Event added in v0.2.0

type Event struct {
	GasUsed *GasUsedEvent
}

Event is a core module event.

type ExecuteReadOnlyTxQuery added in v0.3.0

type ExecuteReadOnlyTxQuery struct {
	Tx []byte `json:"tx"`
}

ExecuteReadOnlyTxQuery is the body of the core.ExecuteReadOnlyTx query.

type ExecuteReadOnlyTxResponse added in v0.3.0

type ExecuteReadOnlyTxResponse struct {
	Result types.CallResult `json:"result"`
}

ExecuteReadOnlyTxResponse is the response of the core.ExecuteReadOnlyTx query.

type GasCosts added in v0.2.0

type GasCosts struct {
	TxByte                   uint64 `json:"tx_byte"`
	AuthSignature            uint64 `json:"auth_signature"`
	AuthMultisigSigner       uint64 `json:"auth_multisig_signer"`
	CallformatX25519Deoxysii uint64 `json:"callformat_x25519_deoxysii"`
}

GasCosts are the consensus accounts module gas costs.

type GasUsedEvent added in v0.2.0

type GasUsedEvent struct {
	Amount uint64 `json:"amount"`
}

GasUsedEvent is a gas used event.

type MethodHandlerInfo added in v0.3.0

type MethodHandlerInfo struct {
	// Name is the name of the RPC.
	Name string `json:"name"`
	// Kind is the kind of the RPC.
	Kind methodHandlerKind `json:"kind"`
}

MethodHandlerInfo describes a single RPC.

type ModuleInfo added in v0.3.0

type ModuleInfo struct {
	// Version is the version of the module.
	Version uint32 `json:"version"`
	// Params are the initial parameters of the module.
	Params cbor.RawMessage `json:"params"`
	// Methods are the RPC methods exposed by the module.
	Methods []MethodHandlerInfo `json:"methods"`
}

ModuleInfo is the information about a single module within the runtime.

type Parameters added in v0.2.0

type Parameters struct {
	MaxBatchGas        uint64                                   `json:"max_batch_gas"`
	MaxTxSigners       uint32                                   `json:"max_tx_signers"`
	MaxMultisigSigners uint32                                   `json:"max_multisig_signers"`
	GasCosts           GasCosts                                 `json:"gas_costs"`
	MinGasPrice        map[types.Denomination]quantity.Quantity `json:"min_gas_price"`

	MaxTxSize uint32 `json:"max_tx_size,omitempty"`
}

Parameters are the parameters for the consensus accounts module.

type RuntimeInfoResponse added in v0.3.0

type RuntimeInfoResponse struct {
	RuntimeVersion *version.Version `json:"runtime_version"`
	// StateVersion is the version of the schema used by the runtime for keeping its state.
	StateVersion uint32 `json:"state_version"`
	// Modules are the SDK modules that comprise this runtime.
	Modules map[string]ModuleInfo `json:"modules"`
}

RuntimeInfoResponse is the response of the core.RuntimeInfo query and provides basic introspection information about the runtime.

type V1

type V1 interface {
	// Parameters queries the core module parameters.
	Parameters(ctx context.Context, round uint64) (*Parameters, error)

	// EstimateGas performs gas estimation for executing the given transaction.
	EstimateGas(ctx context.Context, round uint64, tx *types.Transaction, propagateFailures bool) (uint64, error)

	// EstimateGasForCaller performs gas estimation for executing the given transaction as if the
	// caller specified by address had executed it.
	EstimateGasForCaller(ctx context.Context, round uint64, caller types.CallerAddress, tx *types.Transaction, propagateFailures bool) (uint64, error)

	// MinGasPrice returns the minimum gas price.
	MinGasPrice(ctx context.Context) (map[types.Denomination]types.Quantity, error)

	// GetEvents returns all core events emitted in a given block.
	GetEvents(ctx context.Context, round uint64) ([]*Event, error)

	// RuntimeInfo returns basic info about the module and the containing runtime.
	RuntimeInfo(ctx context.Context) (*RuntimeInfoResponse, error)

	// CallDataPublicKey returns the runtime's call data public key.
	CallDataPublicKey(ctx context.Context) (*CallDataPublicKeyResponse, error)

	// ExecuteReadOnlyTx executes a read only transaction.
	ExecuteReadOnlyTx(ctx context.Context, round uint64, tx *types.UnverifiedTransaction) (*ExecuteReadOnlyTxResponse, error)
}

V1 is the v1 core module interface.

func NewV1

func NewV1(rc client.RuntimeClient) V1

NewV1 generates a V1 client helper for the core module.

Jump to

Keyboard shortcuts

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