Documentation
¶
Index ¶
- Variables
- type AccountState
- type ApplicationLog
- type AssetState
- type AssetUTXO
- type Balance
- type Balances
- type Block
- type BlockMetadataAndTx
- type Claimable
- type ClaimableInfo
- type ContractState
- type Execution
- type Fees
- type GetPeers
- type GetProof
- type GetUTXO
- type Header
- type Invoke
- type NEP5Balance
- type NEP5Balances
- type NEP5Transfer
- type NEP5Transfers
- type NotificationEvent
- type Peer
- type Peers
- type ProofWithKey
- func (p *ProofWithKey) DecodeBinary(r *io.BinReader)
- func (p *ProofWithKey) EncodeBinary(w *io.BinWriter)
- func (p *ProofWithKey) FromString(s string) error
- func (p *ProofWithKey) MarshalJSON() ([]byte, error)
- func (p *ProofWithKey) String() string
- func (p *ProofWithKey) UnmarshalJSON(data []byte) error
- type Properties
- type StateHeight
- type TransactionMetadata
- type TransactionOutput
- type TransactionOutputRaw
- type TransferTx
- type TransferTxEvent
- type Tx
- type UTXO
- type Unclaimed
- type UnspentBalanceInfo
- type Unspents
- type ValidateAddress
- type Validator
- type VerifyProof
- type Version
Constants ¶
This section is empty.
Variables ¶
var GlobalAssets = map[string]string{
"c56f33fc6ecfcd0c225c4ab356fee59390af8560be0e930faebe74a6daff7c9b": "NEO",
"602c79718b16e442de58778e148d0b1084e3b2dffd5de6b7b16cee7969282de7": "GAS",
}
GlobalAssets stores a map of asset IDs to user-friendly strings ("NEO"/"GAS").
Functions ¶
This section is empty.
Types ¶
type AccountState ¶
type AccountState struct {
Version uint8 `json:"version"`
ScriptHash util.Uint160 `json:"script_hash"`
IsFrozen bool `json:"frozen"`
Votes []*keys.PublicKey `json:"votes"`
Balances []Balance `json:"balances"`
}
AccountState wrapper used for the representation of state.Account on the RPC Server.
func NewAccountState ¶
func NewAccountState(a *state.Account) AccountState
NewAccountState creates a new Account wrapper.
type ApplicationLog ¶
type ApplicationLog struct {
TxHash util.Uint256 `json:"txid"`
Executions []Execution `json:"executions"`
}
ApplicationLog wrapper used for the representation of the state.AppExecResult based on the specific tx on the RPC Server.
func NewApplicationLog ¶
func NewApplicationLog(appExecRes *state.AppExecResult, scriptHash util.Uint160) ApplicationLog
NewApplicationLog creates a new ApplicationLog wrapper.
type AssetState ¶
type AssetState struct {
ID util.Uint256 `json:"id"`
AssetType transaction.AssetType `json:"type"`
Name string `json:"name"`
Amount util.Fixed8 `json:"amount"`
Available util.Fixed8 `json:"available"`
Precision uint8 `json:"precision"`
Owner string `json:"owner"`
Admin string `json:"admin"`
Issuer string `json:"issuer"`
Expiration uint32 `json:"expiration"`
IsFrozen bool `json:"frozen"`
}
AssetState wrapper used for the representation of state.Asset on the RPC Server.
func NewAssetState ¶
func NewAssetState(a *state.Asset) AssetState
NewAssetState creates a new Asset wrapper.
type AssetUTXO ¶ added in v0.77.0
type AssetUTXO struct {
AssetHash util.Uint256 `json:"asset_hash"`
AssetName string `json:"asset"`
TotalAmount int64 `json:"total_amount,string"`
Transactions []UTXO `json:"transactions"`
}
AssetUTXO represents UTXO for a specific asset.
type Block ¶
type Block struct {
*block.Base
BlockMetadataAndTx
}
Block wrapper used for the representation of block.Block / block.Base on the RPC Server.
func NewBlock ¶
func NewBlock(b *block.Block, chain core.Blockchainer) Block
NewBlock creates a new Block wrapper.
func (Block) MarshalJSON ¶ added in v0.75.0
MarshalJSON implements json.Marshaler interface.
func (*Block) UnmarshalJSON ¶ added in v0.75.0
UnmarshalJSON implements json.Unmarshaler interface.
type BlockMetadataAndTx ¶ added in v0.75.0
type BlockMetadataAndTx struct {
Size int `json:"size"`
NextBlockHash *util.Uint256 `json:"nextblockhash,omitempty"`
Confirmations uint32 `json:"confirmations"`
Tx []Tx `json:"tx"`
}
BlockMetadataAndTx is an additional metadata added to standard block.Base plus specially encoded transactions.
type Claimable ¶
type Claimable struct {
Tx util.Uint256 `json:"txid"`
N int `json:"n"`
Value util.Fixed8 `json:"value"`
StartHeight uint32 `json:"start_height"`
EndHeight uint32 `json:"end_height"`
Generated util.Fixed8 `json:"generated"`
SysFee util.Fixed8 `json:"sys_fee"`
Unclaimed util.Fixed8 `json:"unclaimed"`
}
Claimable represents spent outputs which can be claimed.
type ClaimableInfo ¶
type ClaimableInfo struct {
Spents []Claimable `json:"claimable"`
Address string `json:"address"`
Unclaimed util.Fixed8 `json:"unclaimed"`
}
ClaimableInfo is a result of a getclaimable RPC call.
type ContractState ¶
type ContractState struct {
Version byte `json:"version"`
ScriptHash util.Uint160 `json:"hash"`
Script []byte `json:"script"`
ParamList []smartcontract.ParamType `json:"parameters"`
ReturnType smartcontract.ParamType `json:"returntype"`
Name string `json:"name"`
CodeVersion string `json:"code_version"`
Author string `json:"author"`
Email string `json:"email"`
Description string `json:"description"`
Properties Properties `json:"properties"`
}
ContractState wrapper used for the representation of state.Contract on the RPC Server.
func NewContractState ¶
func NewContractState(c *state.Contract) ContractState
NewContractState creates a new Contract wrapper.
func (ContractState) MarshalJSON ¶ added in v0.75.0
func (c ContractState) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface.
func (*ContractState) UnmarshalJSON ¶ added in v0.75.0
func (c *ContractState) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler interface.
type Execution ¶
type Execution struct {
Trigger string `json:"trigger"`
ScriptHash util.Uint160 `json:"contract"`
VMState string `json:"vmstate"`
GasConsumed util.Fixed8 `json:"gas_consumed"`
Stack []smartcontract.Parameter `json:"stack"`
Events []NotificationEvent `json:"notifications"`
}
Execution response wrapper
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 (*GetPeers) AddConnected ¶
AddConnected adds a set of peers to the connected peers slice.
func (*GetPeers) AddUnconnected ¶
AddUnconnected adds a set of peers to the unconnected peers slice.
type GetProof ¶ added in v0.76.0
type GetProof struct {
Result ProofWithKey `json:"proof"`
Success bool `json:"success"`
}
GetProof is a result of getproof RPC.
type GetUTXO ¶ added in v0.77.0
type GetUTXO struct {
Address string `json:"address"`
Sent []AssetUTXO `json:"sent"`
Received []AssetUTXO `json:"received"`
}
GetUTXO is a result of the `getutxotransfers` RPC.
type Header ¶
type Header struct {
Hash util.Uint256 `json:"hash"`
Size int `json:"size"`
Version uint32 `json:"version"`
PrevBlockHash util.Uint256 `json:"previousblockhash"`
MerkleRoot util.Uint256 `json:"merkleroot"`
Timestamp uint32 `json:"time"`
Index uint32 `json:"index"`
Nonce string `json:"nonce"`
NextConsensus string `json:"nextconsensus"`
Script transaction.Witness `json:"script"`
Confirmations uint32 `json:"confirmations"`
NextBlockHash *util.Uint256 `json:"nextblockhash,omitempty"`
}
Header wrapper used for the representation of block header on the RPC Server.
type Invoke ¶
type Invoke struct {
State string `json:"state"`
GasConsumed string `json:"gas_consumed"`
Script string `json:"script"`
Stack []smartcontract.Parameter `json:"stack"`
}
Invoke represents code invocation result and is used by several RPC calls that invoke functions, scripts and generic bytecode.
type NEP5Balance ¶
type NEP5Balance struct {
Asset util.Uint160 `json:"asset_hash"`
Amount string `json:"amount"`
LastUpdated uint32 `json:"last_updated_block"`
}
NEP5Balance represents balance for the single token contract.
func (*NEP5Balance) MarshalJSON ¶
func (b *NEP5Balance) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface.
func (*NEP5Balance) UnmarshalJSON ¶
func (b *NEP5Balance) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler interface.
type NEP5Balances ¶
type NEP5Balances struct {
Balances []NEP5Balance `json:"balance"`
Address string `json:"address"`
}
NEP5Balances is a result for the getnep5balances RPC call.
type NEP5Transfer ¶
type NEP5Transfer struct {
Timestamp uint32 `json:"timestamp"`
Asset util.Uint160 `json:"asset_hash"`
Address string `json:"transfer_address,omitempty"`
Amount string `json:"amount"`
Index uint32 `json:"block_index"`
NotifyIndex uint32 `json:"transfer_notify_index"`
TxHash util.Uint256 `json:"tx_hash"`
}
NEP5Transfer represents single NEP5 transfer event.
type NEP5Transfers ¶
type NEP5Transfers struct {
Sent []NEP5Transfer `json:"sent"`
Received []NEP5Transfer `json:"received"`
Address string `json:"address"`
}
NEP5Transfers is a result for the getnep5transfers RPC.
type NotificationEvent ¶
type NotificationEvent struct {
Contract util.Uint160 `json:"contract"`
Item smartcontract.Parameter `json:"state"`
}
NotificationEvent response wrapper
func StateEventToResultNotification ¶ added in v0.75.0
func StateEventToResultNotification(event state.NotificationEvent) NotificationEvent
StateEventToResultNotification converts state.NotificationEvent to result.NotificationEvent.
type ProofWithKey ¶ added in v0.76.0
ProofWithKey represens key-proof pair.
func (*ProofWithKey) DecodeBinary ¶ added in v0.76.0
func (p *ProofWithKey) DecodeBinary(r *io.BinReader)
DecodeBinary implements io.Serializable.
func (*ProofWithKey) EncodeBinary ¶ added in v0.76.0
func (p *ProofWithKey) EncodeBinary(w *io.BinWriter)
EncodeBinary implements io.Serializable.
func (*ProofWithKey) FromString ¶ added in v0.76.0
func (p *ProofWithKey) FromString(s string) error
FromString decodes p from hex-encoded string.
func (*ProofWithKey) MarshalJSON ¶ added in v0.76.0
func (p *ProofWithKey) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*ProofWithKey) String ¶ added in v0.76.0
func (p *ProofWithKey) String() string
String implements fmt.Stringer.
func (*ProofWithKey) UnmarshalJSON ¶ added in v0.76.0
func (p *ProofWithKey) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.
type Properties ¶
type Properties struct {
HasStorage bool `json:"storage"`
HasDynamicInvoke bool `json:"dynamic_invoke"`
IsPayable bool `json:"is_payable"`
}
Properties response wrapper.
type StateHeight ¶ added in v0.76.0
type StateHeight struct {
BlockHeight uint32 `json:"blockheight"`
StateHeight uint32 `json:"stateheight"`
}
StateHeight is a result of getstateheight RPC.
type TransactionMetadata ¶ added in v0.75.0
type TransactionMetadata struct {
SysFee util.Fixed8 `json:"sys_fee"`
NetFee util.Fixed8 `json:"net_fee"`
Blockhash util.Uint256 `json:"blockhash,omitempty"`
Confirmations int `json:"confirmations,omitempty"`
Timestamp uint32 `json:"blocktime,omitempty"`
}
TransactionMetadata is an auxilliary struct for proper TransactionOutputRaw marshaling.
type TransactionOutput ¶
type TransactionOutput struct {
N int `json:"n"`
Asset string `json:"asset"`
Value util.Fixed8 `json:"value"`
Address string `json:"address"`
}
TransactionOutput is a wrapper to represent transaction's output.
func NewTxOutput ¶
func NewTxOutput(out *transaction.Output) *TransactionOutput
NewTxOutput converts out to a TransactionOutput.
type TransactionOutputRaw ¶
type TransactionOutputRaw struct {
*transaction.Transaction
TransactionMetadata
}
TransactionOutputRaw is used as a wrapper to represents a Transaction.
func NewTransactionOutputRaw ¶
func NewTransactionOutputRaw(tx *transaction.Transaction, header *block.Header, chain core.Blockchainer) TransactionOutputRaw
NewTransactionOutputRaw returns a new ransactionOutputRaw object.
func (TransactionOutputRaw) MarshalJSON ¶ added in v0.75.0
func (t TransactionOutputRaw) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler interface.
func (*TransactionOutputRaw) UnmarshalJSON ¶ added in v0.75.0
func (t *TransactionOutputRaw) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Marshaler interface.
type TransferTx ¶ added in v0.78.0
type TransferTx struct {
TxID util.Uint256 `json:"txid"`
Timestamp uint32 `json:"timestamp"`
Index uint32 `json:"block_index"`
SystemFee string `json:"sys_fee"`
NetworkFee string `json:"net_fee"`
Elements []TransferTxEvent `json:"elements,omitempty"`
Events []TransferTxEvent `json:"events,omitempty"`
}
TransferTx is a type used to represent and element of `getalltransfertx` result. It combines transaction's inputs/outputs with NEP5 events.
type TransferTxEvent ¶ added in v0.78.0
type TransferTxEvent struct {
Address string `json:"address,omitempty"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Type string `json:"type,omitempty"`
Value string `json:"value"`
Asset string `json:"asset"`
}
TransferTxEvent is an event used for elements or events of TransferTx, it's either a single input/output, or a nep5 transfer. The former always has Address and Type fields set with no From/To, the latter can either have From and To or Address and Type depending on particular RPC API function.
type Tx ¶
type Tx struct {
*transaction.Transaction
Fees
}
Tx wrapper used for the representation of transaction on the RPC Server.
func (Tx) MarshalJSON ¶ added in v0.75.0
MarshalJSON implements json.Marshaler interface.
func (*Tx) UnmarshalJSON ¶ added in v0.75.0
UnmarshalJSON implements json.Marshaler interface.
type UTXO ¶ added in v0.77.0
type UTXO struct {
Index uint32 `json:"block_index"`
Timestamp uint32 `json:"timestamp"`
TxHash util.Uint256 `json:"txid"`
Amount int64 `json:"amount,string"`
}
UTXO represents single output for a single asset.
type Unclaimed ¶
type Unclaimed struct {
Available util.Fixed8 `json:"available"`
Unclaimed util.Fixed8 `json:"unclaimed"`
}
Unclaimed wrapper is used to represent getunclaimed return result.
func NewUnclaimed ¶
NewUnclaimed creates a new Unclaimed wrapper using given Blockchainer.
type UnspentBalanceInfo ¶
type UnspentBalanceInfo struct {
Unspents []state.UnspentBalance `json:"unspent"`
AssetHash util.Uint256 `json:"asset_hash"`
Asset string `json:"asset"`
AssetSymbol string `json:"asset_symbol"`
Amount util.Fixed8 `json:"amount"`
}
UnspentBalanceInfo wrapper is used to represent single unspent asset entry in `getunspents` output.
type Unspents ¶
type Unspents struct {
Balance []UnspentBalanceInfo `json:"balance"`
Address string `json:"address"`
}
Unspents wrapper is used to represent getunspents return result.
func NewUnspents ¶
NewUnspents creates a new Account wrapper using given Blockchainer.
type ValidateAddress ¶
type ValidateAddress struct {
Address interface{} `json:"address"`
IsValid bool `json:"isvalid"`
}
ValidateAddress represents result of the `validateaddress` call. Notice that Address is an interface{} here because server echoes back whatever address value user has sent to it, even if it's not a string.
type Validator ¶
type Validator struct {
PublicKey keys.PublicKey `json:"publickey"`
Votes util.Fixed8 `json:"votes"`
Active bool `json:"active"`
}
Validator used for the representation of state.Validator on the RPC Server.
type VerifyProof ¶ added in v0.76.0
type VerifyProof struct {
Value []byte
}
VerifyProof is a result of verifyproof RPC. nil Value is considered invalid.
func (*VerifyProof) MarshalJSON ¶ added in v0.76.0
func (p *VerifyProof) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.
func (*VerifyProof) UnmarshalJSON ¶ added in v0.76.0
func (p *VerifyProof) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.