models

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type InvokeResult

type InvokeResult struct {
	Script           string                      `json:"script"`
	State            string                      `json:"state"`
	GasConsumed      string                      `json:"gasconsumed"`
	Exception        string                      `json:"exception"`
	Notifications    []RpcNotification           `json:"notifications"`
	Diagnostics      RpcDiagnostic               `json:"diagnostics,omitempty"`
	Stack            []InvokeStack               `json:"stack"` // "error: invalid operation" | InvokeStack[]
	Session          string                      `json:"session,omitempty"`
	Tx               string                      `json:"tx,omitempty"`
	PendingSignature RpcContractParameterContext `json:"pendingsignature,omitempty"`
}

type InvokeStack

type InvokeStack struct {
	Type      string      `json:"type"`
	Value     interface{} `json:"value"`
	Interface string      `json:"interface,omitempty"`
	Id        string      `json:"id,omitempty"`
}

func ConvertInvokeStackArray added in v1.2.1

func ConvertInvokeStackArray(s InvokeStack) []InvokeStack

ConvertInvokeStackArray converts an "Array" type InvokeStack to an InvokeStack array

type Peer

type Peer struct {
	Address string `json:"address"`
	Port    int    `json:"port"`
}

type RpcAddress

type RpcAddress struct {
	Address   string `json:"address"`
	HasKey    bool   `json:"haskey"`
	Label     string `json:"label"`
	WatchOnly bool   `json:"watchonly"`
}

type RpcApplicationLog

type RpcApplicationLog struct {
	TxId       string         `json:"txid"`
	Executions []RpcExecution `json:"executions"`
}

type RpcBlock

type RpcBlock struct {
	RpcBlockHeader
	Tx []RpcTransaction `json:"tx"`
}

type RpcBlockHeader

type RpcBlockHeader struct {
	Hash              string       `json:"hash"`
	Size              int          `json:"size"`
	Version           int          `json:"version"`
	PreviousBlockHash string       `json:"previousblockhash"`
	MerkleRoot        string       `json:"merkleroot"`
	Time              int          `json:"time"`
	Nonce             string       `json:"nonce"`
	Index             int          `json:"index"`
	PrimaryIndex      byte         `json:"primary"`
	NextConsensus     string       `json:"nextconsensus"` //address
	Witnesses         []RpcWitness `json:"witnesses"`
	Confirmations     int          `json:"confirmations"`
	NextBlockHash     string       `json:"nextblockhash"`
}

type RpcCandidates added in v1.2.0

type RpcCandidates struct {
	PublicKey string `json:"publickey"`
	Votes     string `json:"votes"`
	Active    bool   `json:"active"`
}

type RpcContextItem added in v1.2.0

type RpcContextItem struct {
	Script     string                 `json:"script"`
	Parameters []RpcContractParameter `json:"parameters"`
	Signatures map[string]string      `json:"signatures"`
}

type RpcContractAbi

type RpcContractAbi struct {
	Methods []RpcContractMethodDescriptor `json:"methods"`
	Events  []RpcContractEventDescriptor  `json:"events"`
}

type RpcContractEventDescriptor

type RpcContractEventDescriptor struct {
	Name       string                           `json:"name"`
	Parameters []RpcContractParameterDefinition `json:"parameters"`
}

type RpcContractGroup

type RpcContractGroup struct {
	PubKey    string `json:"pubkey"`
	Signature string `json:"signature"` // base64
}

type RpcContractManifest

type RpcContractManifest struct {
	Name               string                  `json:"name"`
	Groups             []RpcContractGroup      `json:"groups"`
	SupportedStandards []string                `json:"supportedstandards"`
	Abi                RpcContractAbi          `json:"abi"`
	Permissions        []RpcContractPermission `json:"permissions"`
	Trusts             []string                `json:"trusts"`
	Extra              interface{}             `json:"extra"`
}

type RpcContractMethodDescriptor

type RpcContractMethodDescriptor struct {
	Name       string                           `json:"name"`
	Parameters []RpcContractParameterDefinition `json:"parameters"`
	ReturnType string                           `json:"returntype"`
	Offset     int                              `json:"offset"`
	Safe       bool                             `json:"safe"`
}

type RpcContractParameter

type RpcContractParameter struct {
	Type  string      `json:"type"`
	Value interface{} `json:"value"`
}

func NewRpcContractParameter added in v0.3.1

func NewRpcContractParameter(t string, v interface{}) RpcContractParameter

type RpcContractParameterContext added in v1.2.0

type RpcContractParameterContext struct {
	Type    string                    `json:"type"`
	Hash    string                    `json:"hash"`
	Data    string                    `json:"data"`
	Items   map[string]RpcContextItem `json:"items"`
	Network uint32                    `json:"network"`
}

type RpcContractParameterDefinition

type RpcContractParameterDefinition struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

func (*RpcContractParameterDefinition) ToContractParameterType

func (mp *RpcContractParameterDefinition) ToContractParameterType() (sc.ContractParameterType, error)

type RpcContractPermission

type RpcContractPermission struct {
	Contract string   `json:"contract"`
	Methods  []string `json:"methods"`
}

type RpcContractState

type RpcContractState struct {
	Id            int                 `json:"id"`
	UpdateCounter uint16              `json:"updatecounter"`
	Hash          string              `json:"hash"`
	Nef           RpcNefFile          `json:"nef"`
	Manifest      RpcContractManifest `json:"manifest"`
}

func (*RpcContractState) ToContract

func (cs *RpcContractState) ToContract() (*sc.Contract, error)

type RpcDiagnostic added in v1.2.0

type RpcDiagnostic struct {
	InvokedContracts []RpcInvocationTreeNode `json:"invokedcontracts"`
}

type RpcExecution

type RpcExecution struct {
	Trigger       string            `json:"trigger"`
	VMState       string            `json:"vmstate"`
	Exception     string            `json:"exception"`
	GasConsumed   string            `json:"gasconsumed"`
	Stack         []InvokeStack     `json:"stack"`
	Notifications []RpcNotification `json:"notifications"`
}

type RpcInvocationTreeNode added in v1.2.0

type RpcInvocationTreeNode struct {
	Hash string                  `json:"hash"`
	Call []RpcInvocationTreeNode `json:"call,omitempty"`
}

type RpcListAddress

type RpcListAddress struct {
	AddressList []RpcAddress
}

type RpcListPlugin

type RpcListPlugin struct {
	Name       string   `json:"name"`
	Version    string   `json:"version"`
	Interfaces []string `json:"interfaces"`
}

type RpcMethodToken

type RpcMethodToken struct {
	Hash            string `json:"hash"`
	Method          string `json:"method"`
	ParametersCount uint16 `json:"paramcount"`
	HasReturnValue  bool   `json:"hasreturnvalue"`
	CallFlags       string `json:"callflags"`
}

type RpcNativeContract added in v0.3.8

type RpcNativeContract struct {
	Id            int                 `json:"id"`
	Hash          string              `json:"hash"`
	Nef           RpcNefFile          `json:"nef"`
	Manifest      RpcContractManifest `json:"manifest"`
	UpdateHistory []uint              `json:"updatehistory"`
}

type RpcNefFile

type RpcNefFile struct {
	Magic    uint             `json:"magic"`
	Compiler string           `json:"compiler"`
	Tokens   []RpcMethodToken `json:"tokens"`
	Script   string           `json:"script"` // base64
	CheckSum uint             `json:"checksum"`
}

type RpcNep11Balance added in v1.2.0

type RpcNep11Balance struct {
	AssetHash string          `json:"assethash"`
	Name      string          `json:"name"`
	Symbol    string          `json:"symbol"`
	Decimals  string          `json:"decimals"`
	Tokens    []RpcNep11Token `json:"tokens"`
}

type RpcNep11Balances added in v1.2.0

type RpcNep11Balances struct {
	Address  string            `json:"address"`
	Balances []RpcNep11Balance `json:"balance"`
}

type RpcNep11Token added in v1.2.0

type RpcNep11Token struct {
	TokenId          string `json:"tokenid"`
	Amount           string `json:"amount"`
	LastUpdatedBlock uint32 `json:"lastupdatedblock"`
}

type RpcNep11Transfer added in v1.2.0

type RpcNep11Transfer struct {
	Timestamp           uint64 `json:"timestamp"`
	AssetHash           string `json:"assethash"`
	TransferAddress     string `json:"transferaddress"`
	Amount              string `json:"amount"`
	BlockIndex          uint32 `json:"blockindex"`
	TransferNotifyIndex uint32 `json:"transfernotifyindex"`
	TxHash              string `json:"txhash"`
	TokenId             string `json:"tokenid"`
}

type RpcNep11Transfers added in v1.2.0

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

type RpcNep17Balance

type RpcNep17Balance struct {
	AssetHash        string `json:"assethash"`
	Name             string `json:"name"`
	Symbol           string `json:"symbol"`
	Decimals         string `json:"decimals"`
	Amount           string `json:"amount"`
	LastUpdatedBlock uint32 `json:"lastupdatedblock"`
}

type RpcNep17Balances

type RpcNep17Balances struct {
	Address  string            `json:"address"`
	Balances []RpcNep17Balance `json:"balance"`
}

type RpcNep17Transfer

type RpcNep17Transfer struct {
	Timestamp           uint64 `json:"timestamp"`
	AssetHash           string `json:"assethash"`
	TransferAddress     string `json:"transferaddress"`
	Amount              string `json:"amount"`
	BlockIndex          uint32 `json:"blockindex"`
	TransferNotifyIndex uint32 `json:"transfernotifyindex"`
	TxHash              string `json:"txhash"`
}

type RpcNep17Transfers

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

type RpcNetworkFee

type RpcNetworkFee struct {
	NetworkFee string `json:"networkfee"`
}

type RpcNotification

type RpcNotification struct {
	Contract  string      `json:"contract"`
	EventName string      `json:"eventname"`
	State     InvokeStack `json:"state"`
}

type RpcPeers

type RpcPeers struct {
	Unconnected []Peer `json:"unconnected"`
	Bad         []Peer `json:"bad"`
	Connected   []Peer `json:"connected"`
}

type RpcProtocol added in v1.2.0

type RpcProtocol struct {
	AddressVersion              byte   `json:"addressversion"`
	Network                     uint32 `json:"network"`
	ValidatorsCount             int32  `json:"validatorscount"`
	MillisecondsPerBlock        uint32 `json:"msperblock"`
	MaxTraceableBlocks          uint32 `json:"maxtraceableblocks"`
	MaxValidUntilBlockIncrement uint32 `json:"maxvaliduntilblockincrement"`
	MaxTransactionsPerBlock     uint32 `json:"maxtransactionsperblock"`
	MemoryPoolMaxTransactions   int32  `json:"memorypoolmaxtransactions"`
	InitialGasDistribution      uint64 `json:"initialgasdistribution"`
}

type RpcSigner

type RpcSigner struct {
	Account          string           `json:"account"` // script hash
	Scopes           string           `json:"scopes"`
	AllowedContracts []string         `json:"allowedcontracts,omitempty"`
	AllowedGroups    []string         `json:"allowedgroups,omitempty"`
	Rules            []RpcWitnessRule `json:"rules,omitempty"`
}

func CreateRpcSigner

func CreateRpcSigner(signer *tx.Signer) RpcSigner

func CreateRpcSigners

func CreateRpcSigners(signers []*tx.Signer) []RpcSigner

type RpcStateHeight

type RpcStateHeight struct {
	LocalRootIndex    uint32 `json:"localrootindex"`
	ValidateRootIndex uint32 `json:"validatedrootindex"`
}

type RpcStorageChange added in v1.2.0

type RpcStorageChange struct {
	State string `json:"state"`
	Key   string `json:"key"`
	Value string `json:"value"`
}

type RpcTransaction

type RpcTransaction struct {
	Hash            string                    `json:"hash"`
	Size            int                       `json:"size"`
	Version         int                       `json:"version"`
	Nonce           int                       `json:"nonce"`
	Sender          string                    `json:"sender"`
	SysFee          string                    `json:"sysfee"`
	NetFee          string                    `json:"netfee"`
	ValidUntilBlock int                       `json:"validuntilblock"`
	Signers         []RpcSigner               `json:"signers"`
	Attributes      []RpcTransactionAttribute `json:"attributes"`
	Script          string                    `json:"script"`
	Witnesses       []RpcWitness              `json:"witnesses"`
	BlockHash       string                    `json:"blockhash"`
	Confirmations   int                       `json:"confirmations"`
	Blocktime       int                       `json:"blocktime"`
}

type RpcTransactionAttribute

type RpcTransactionAttribute struct {
	Usage string `json:"usage"`
	Data  string `json:"data"`
}

type RpcTransferOut

type RpcTransferOut struct {
	Asset   string `json:"asset"`
	Value   string `json:"value"`
	Address string `json:"address"`
}

type RpcValidator

type RpcValidator struct {
	PublicKey string `json:"publickey"`
	Votes     string `json:"votes"`
}

type RpcVersion

type RpcVersion struct {
	TcpPort   int         `json:"tcpPort"`
	WsPort    int         `json:"wsPort"`
	Nonce     string      `json:"nonce"`
	UserAgent string      `json:"useragent"`
	Protocol  RpcProtocol `json:"protocol"`
}

type RpcWalletBalance

type RpcWalletBalance struct {
	Balance string `json:"balance"`
}

type RpcWitness

type RpcWitness struct {
	Invocation   string `json:"invocation"`
	Verification string `json:"verification"`
}

type RpcWitnessCondition added in v1.2.0

type RpcWitnessCondition struct {
	Type        string                `json:"type"`                  // type of this condition
	Expression  interface{}           `json:"expression,omitempty"`  // BooleanCondition: "true" || "false" | NotCondition: !RpcWitnessCondition
	Expressions []RpcWitnessCondition `json:"expressions,omitempty"` // AndCondition: RpcWitnessCondition && RpcWitnessCondition | OrCondition: RpcWitnessCondition || RpcWitnessCondition
	Hash        string                `json:"hash,omitempty"`        // ScriptHashCondition | CalledByContractCondition: UInt160.ToString()
	Group       string                `json:"group,omitempty"`       // GroupCondition | CalledByGroupCondition: ECPoint.ToString()
}

RpcWitnessCondition combines all types of conditions into one struct

func CreateRpcWitnessCondition added in v1.2.0

func CreateRpcWitnessCondition(c *conditions.WitnessCondition) RpcWitnessCondition

type RpcWitnessRule added in v1.2.0

type RpcWitnessRule struct {
	Action    string              `json:"action"`
	Condition RpcWitnessCondition `json:"condition"`
}

type UnclaimedGas

type UnclaimedGas struct {
	Unclaimed string `json:"unclaimed"`
	Address   string `json:"address"`
}

type ValidateAddress

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

Jump to

Keyboard shortcuts

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