result

package
v0.106.3 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 27 Imported by: 45

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KnownNEP11Properties = map[string]bool{
	"description": true,
	"image":       true,
	"name":        true,
	"tokenURI":    true,
}

KnownNEP11Properties contains a list of well-known NEP-11 token property names.

Functions

This section is empty.

Types

type ApplicationLog

type ApplicationLog struct {
	Container     util.Uint256
	IsTransaction bool
	Executions    []state.Execution
}

ApplicationLog represent the results of the script executions for a block or a transaction.

func NewApplicationLog

func NewApplicationLog(hash util.Uint256, aers []state.AppExecResult, trig trigger.Type) ApplicationLog

NewApplicationLog creates an ApplicationLog from a set of several application execution results including only the results with the specified trigger.

func (ApplicationLog) MarshalJSON

func (l ApplicationLog) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*ApplicationLog) UnmarshalJSON

func (l *ApplicationLog) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Block

type Block struct {
	block.Block
	BlockMetadata
}

Block wrapper used for the representation of block.Block / block.Base on the RPC Server.

func (Block) MarshalJSON

func (b Block) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Block) UnmarshalJSON

func (b *Block) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type BlockMetadata

type BlockMetadata struct {
	Size          int           `json:"size"`
	NextBlockHash *util.Uint256 `json:"nextblockhash,omitempty"`
	Confirmations uint32        `json:"confirmations"`
}

BlockMetadata is an additional metadata added to the standard block.Block.

type Candidate

type Candidate struct {
	PublicKey keys.PublicKey `json:"publickey"`
	Votes     int64          `json:"votes,string"`
	Active    bool           `json:"active"`
}

Candidate represents a node participating in the governance elections, it's active when it's a validator (consensus node).

type FindStates

type FindStates struct {
	Results    []KeyValue    `json:"results"`
	FirstProof *ProofWithKey `json:"firstProof,omitempty"`
	LastProof  *ProofWithKey `json:"lastProof,omitempty"`
	Truncated  bool          `json:"truncated"`
}

type FindStorage added in v0.102.0

type FindStorage struct {
	Results []KeyValue `json:"results"`
	// Next contains the index of the next subsequent element of the contract storage
	// that can be retrieved during the next iteration.
	Next      int  `json:"next"`
	Truncated bool `json:"truncated"`
}

FindStorage represents the result of `findstorage` RPC handler.

type GetPeers

type GetPeers struct {
	Unconnected Peers `json:"unconnected"`
	Connected   Peers `json:"connected"`
	Bad         Peers `json:"bad"`
}

GetPeers payload for outputting peers in `getpeers` RPC call.

func NewGetPeers

func NewGetPeers() GetPeers

NewGetPeers creates a new GetPeers structure.

func (*GetPeers) AddBad

func (g *GetPeers) AddBad(addrs []string)

AddBad adds a set of peers to the bad peers slice.

func (*GetPeers) AddConnected

func (g *GetPeers) AddConnected(connectedPeers []network.PeerInfo)

AddConnected adds a set of connected peers to the connected peers slice.

func (*GetPeers) AddUnconnected

func (g *GetPeers) AddUnconnected(addrs []string)

AddUnconnected adds a set of peers to the unconnected peers slice.

type Header struct {
	block.Header
	BlockMetadata
}

Header wrapper used for a representation of the block header on the RPC Server.

func (Header) MarshalJSON

func (h Header) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*Header) UnmarshalJSON

func (h *Header) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type Invoke

type Invoke struct {
	State          string
	GasConsumed    int64
	Script         []byte
	Stack          []stackitem.Item
	FaultException string
	Notifications  []state.NotificationEvent
	Transaction    *transaction.Transaction
	Diagnostics    *InvokeDiag
	Session        uuid.UUID
}

Invoke represents a code invocation result and is used by several RPC calls that invoke functions, scripts and generic bytecode.

func AppExecToInvocation added in v0.99.5

func AppExecToInvocation(aer *state.AppExecResult, err error) (*Invoke, error)

AppExecToInvocation converts state.AppExecResult to result.Invoke and can be used as a wrapper for actor.Wait. The result of AppExecToInvocation doesn't have all fields properly filled, it's limited by State, GasConsumed, Stack, FaultException and Notifications. The result of AppExecToInvocation can be passed to unwrap package helpers.

func (Invoke) MarshalJSON

func (r Invoke) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler.

func (*Invoke) UnmarshalJSON

func (r *Invoke) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler.

type InvokeDiag

type InvokeDiag struct {
	Changes     []dboper.Operation  `json:"storagechanges"`
	Invocations []*invocations.Tree `json:"invokedcontracts"`
}

InvokeDiag is an additional diagnostic data for invocation.

type Iterator

type Iterator struct {
	// ID represents iterator ID. It is non-nil iff JSON-RPC server support session mechanism.
	ID *uuid.UUID

	// Values contains deserialized VM iterator values with a truncated flag. It is non-nil
	// iff JSON-RPC server does not support sessions mechanism and able to traverse iterator.
	Values    []stackitem.Item
	Truncated bool
}

Iterator represents VM iterator identifier. It either has ID set (for those JSON-RPC servers that support sessions) or non-nil Values and Truncated set (for those JSON-RPC servers that doesn't support sessions but perform in-place iterator traversing) or doesn't have ID, Values and Truncated set at all (for those JSON-RPC servers that doesn't support iterator sessions and doesn't perform in-place iterator traversing).

func (Iterator) MarshalJSON

func (r Iterator) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler.

func (*Iterator) UnmarshalJSON

func (r *Iterator) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler.

type KeyValue

type KeyValue struct {
	Key   []byte `json:"key"`
	Value []byte `json:"value"`
}

type NEP11AssetBalance

type NEP11AssetBalance struct {
	Asset    util.Uint160        `json:"assethash"`
	Decimals int                 `json:"decimals,string"`
	Name     string              `json:"name"`
	Symbol   string              `json:"symbol"`
	Tokens   []NEP11TokenBalance `json:"tokens"`
}

NEP11Balance is a structure holding balance of a NEP-11 asset.

type NEP11Balances

type NEP11Balances struct {
	Balances []NEP11AssetBalance `json:"balance"`
	Address  string              `json:"address"`
}

NEP11Balances is a result for the getnep11balances RPC call.

type NEP11TokenBalance

type NEP11TokenBalance struct {
	ID          string `json:"tokenid"`
	Amount      string `json:"amount"`
	LastUpdated uint32 `json:"lastupdatedblock"`
}

NEP11TokenBalance represents balance of a single NFT.

type NEP11Transfer

type NEP11Transfer struct {
	Timestamp   uint64       `json:"timestamp"`
	Asset       util.Uint160 `json:"assethash"`
	Address     string       `json:"transferaddress,omitempty"`
	ID          string       `json:"tokenid"`
	Amount      string       `json:"amount"`
	Index       uint32       `json:"blockindex"`
	NotifyIndex uint32       `json:"transfernotifyindex"`
	TxHash      util.Uint256 `json:"txhash"`
}

NEP11Transfer represents single NEP-11 transfer event.

type NEP11Transfers

type NEP11Transfers struct {
	Sent     []NEP11Transfer `json:"sent"`
	Received []NEP11Transfer `json:"received"`
	Address  string          `json:"address"`
}

NEP11Transfers is a result for the getnep11transfers RPC.

type NEP17Balance

type NEP17Balance struct {
	Asset       util.Uint160 `json:"assethash"`
	Amount      string       `json:"amount"`
	Decimals    int          `json:"decimals,string"`
	LastUpdated uint32       `json:"lastupdatedblock"`
	Name        string       `json:"name"`
	Symbol      string       `json:"symbol"`
}

NEP17Balance represents balance for the single token contract.

type NEP17Balances

type NEP17Balances struct {
	Balances []NEP17Balance `json:"balance"`
	Address  string         `json:"address"`
}

NEP17Balances is a result for the getnep17balances RPC call.

type NEP17Transfer

type NEP17Transfer struct {
	Timestamp   uint64       `json:"timestamp"`
	Asset       util.Uint160 `json:"assethash"`
	Address     string       `json:"transferaddress,omitempty"`
	Amount      string       `json:"amount"`
	Index       uint32       `json:"blockindex"`
	NotifyIndex uint32       `json:"transfernotifyindex"`
	TxHash      util.Uint256 `json:"txhash"`
}

NEP17Transfer represents single NEP17 transfer event.

type NEP17Transfers

type NEP17Transfers struct {
	Sent     []NEP17Transfer `json:"sent"`
	Received []NEP17Transfer `json:"received"`
	Address  string          `json:"address"`
}

NEP17Transfers is a result for the getnep17transfers RPC.

type NetworkFee

type NetworkFee struct {
	Value int64 `json:"networkfee,string"`
}

NetworkFee represents a result of calculatenetworkfee RPC call.

type NotaryRequestEvent

type NotaryRequestEvent struct {
	Type          mempoolevent.Type         `json:"type"`
	NotaryRequest *payload.P2PNotaryRequest `json:"notaryrequest"`
}

NotaryRequestEvent represents a P2PNotaryRequest event either added or removed from the notary payload pool.

type Peer

type Peer struct {
	Address         string `json:"address"`
	Port            uint16 `json:"port"`
	UserAgent       string `json:"useragent,omitempty"`
	LastKnownHeight uint32 `json:"lastknownheight,omitempty"`
}

Peer represents a peer.

func (*Peer) UnmarshalJSON added in v0.102.0

func (p *Peer) UnmarshalJSON(data []byte) error

type Peers

type Peers []Peer

Peers represents a slice of peers.

type ProofWithKey

type ProofWithKey struct {
	Key   []byte
	Proof [][]byte
}

ProofWithKey represens a key-proof pair.

func (*ProofWithKey) DecodeBinary

func (p *ProofWithKey) DecodeBinary(r *io.BinReader)

DecodeBinary implements io.Serializable.

func (*ProofWithKey) EncodeBinary

func (p *ProofWithKey) EncodeBinary(w *io.BinWriter)

EncodeBinary implements io.Serializable.

func (*ProofWithKey) FromString

func (p *ProofWithKey) FromString(s string) error

FromString decodes p from hex-encoded string.

func (*ProofWithKey) MarshalJSON

func (p *ProofWithKey) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler.

func (*ProofWithKey) String

func (p *ProofWithKey) String() string

String implements fmt.Stringer.

func (*ProofWithKey) UnmarshalJSON

func (p *ProofWithKey) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler.

type Protocol

type Protocol struct {
	AddressVersion              byte
	Network                     netmode.Magic
	MillisecondsPerBlock        int
	MaxTraceableBlocks          uint32
	MaxValidUntilBlockIncrement uint32
	MaxTransactionsPerBlock     uint16
	MemoryPoolMaxTransactions   int
	ValidatorsCount             byte
	InitialGasDistribution      fixedn.Fixed8
	// Hardforks is the map of network hardforks with the enabling height.
	Hardforks map[config.Hardfork]uint32

	// CommitteeHistory stores height:size map of the committee size.
	CommitteeHistory map[uint32]uint32
	// P2PSigExtensions is true when Notary subsystem is enabled on the network.
	P2PSigExtensions bool
	// StateRootInHeader is true if state root is contained in block header.
	StateRootInHeader bool
	// ValidatorsHistory stores height:size map of the validators count.
	ValidatorsHistory map[uint32]uint32
}

Protocol represents network-dependent parameters.

func (Protocol) MarshalJSON added in v0.100.0

func (p Protocol) MarshalJSON() ([]byte, error)

MarshalJSON implements the JSON marshaler interface.

func (*Protocol) UnmarshalJSON added in v0.100.0

func (p *Protocol) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the JSON unmarshaler interface.

type RPC added in v0.106.0

type RPC struct {
	MaxIteratorResultItems int  `json:"maxiteratorresultitems"`
	SessionEnabled         bool `json:"sessionenabled"`
}

RPC represents the RPC server configuration.

type RawMempool

type RawMempool struct {
	Height     uint32         `json:"height"`
	Verified   []util.Uint256 `json:"verified"`
	Unverified []util.Uint256 `json:"unverified"`
}

RawMempool represents a result of getrawmempool RPC call.

type RawNotaryPool added in v0.102.0

type RawNotaryPool struct {
	Hashes map[util.Uint256][]util.Uint256
}

RawNotaryPool represents a result of `getrawnotarypool` RPC call. The structure consist of `Hashes`. `Hashes` field is a map, where key is the hash of the main transaction and value is a slice of related fallback transaction hashes.

func (RawNotaryPool) MarshalJSON added in v0.102.0

func (p RawNotaryPool) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*RawNotaryPool) UnmarshalJSON added in v0.102.0

func (p *RawNotaryPool) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type RelayResult

type RelayResult struct {
	Hash util.Uint256 `json:"hash"`
}

RelayResult ia a result of `sendrawtransaction` or `submitblock` RPC calls.

type StateHeight

type StateHeight struct {
	Local     uint32 `json:"localrootindex"`
	Validated uint32 `json:"validatedrootindex"`
}

StateHeight is a result of getstateheight RPC.

type TransactionMetadata

type TransactionMetadata struct {
	Blockhash     util.Uint256 `json:"blockhash,omitempty"`
	Confirmations int          `json:"confirmations,omitempty"`
	Timestamp     uint64       `json:"blocktime,omitempty"`
	VMState       string       `json:"vmstate,omitempty"`
}

TransactionMetadata is an auxiliary struct for proper TransactionOutputRaw marshaling.

type TransactionOutputRaw

type TransactionOutputRaw struct {
	transaction.Transaction
	TransactionMetadata
}

TransactionOutputRaw is used as a wrapper to represents a Transaction.

func (TransactionOutputRaw) MarshalJSON

func (t TransactionOutputRaw) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*TransactionOutputRaw) UnmarshalJSON

func (t *TransactionOutputRaw) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Marshaler interface.

type UnclaimedGas

type UnclaimedGas struct {
	Address   util.Uint160
	Unclaimed big.Int
}

UnclaimedGas response wrapper.

func (UnclaimedGas) MarshalJSON

func (g UnclaimedGas) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (*UnclaimedGas) UnmarshalJSON

func (g *UnclaimedGas) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type ValidateAddress

type ValidateAddress struct {
	Address any  `json:"address"`
	IsValid bool `json:"isvalid"`
}

ValidateAddress represents a result of the `validateaddress` call. Notice that Address is an interface{} here because the server echoes back whatever address value a user has sent to it, even if it's not a string.

type Validator

type Validator struct {
	PublicKey keys.PublicKey `json:"publickey"`
	Votes     int64          `json:"votes"`
}

Validator is used for the representation of consensus node data in the JSON-RPC protocol.

func (*Validator) UnmarshalJSON

func (v *Validator) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

type VerifyProof

type VerifyProof struct {
	Value []byte
}

VerifyProof is a result of verifyproof RPC. nil Value is considered invalid.

func (*VerifyProof) MarshalJSON

func (p *VerifyProof) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler.

func (*VerifyProof) UnmarshalJSON

func (p *VerifyProof) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler.

type Version

type Version struct {
	TCPPort   uint16   `json:"tcpport"`
	WSPort    uint16   `json:"wsport,omitempty"`
	Nonce     uint32   `json:"nonce"`
	UserAgent string   `json:"useragent"`
	Protocol  Protocol `json:"protocol"`
	RPC       RPC      `json:"rpc"`
}

Version model used for reporting server version info.

Jump to

Keyboard shortcuts

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