wrappers

package
v0.73.0 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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 AssetState

type AssetState struct {
	ID         util.Uint256          `json:"assetID"`
	AssetType  transaction.AssetType `json:"assetType"`
	Name       string                `json:"name"`
	Amount     util.Fixed8           `json:"amount"`
	Available  util.Fixed8           `json:"available"`
	Precision  uint8                 `json:"precision"`
	FeeMode    uint8                 `json:"fee"`
	FeeAddress util.Uint160          `json:"address"`
	Owner      string                `json:"owner"`
	Admin      string                `json:"admin"`
	Issuer     string                `json:"issuer"`
	Expiration uint32                `json:"expiration"`
	IsFrozen   bool                  `json:"is_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 Balance

type Balance struct {
	Asset util.Uint256 `json:"asset"`
	Value util.Fixed8  `json:"value"`
}

Balance response wrapper.

type Balances

type Balances []Balance

Balances type for sorting balances in rpc response.

func (Balances) Len

func (b Balances) Len() int

func (Balances) Less

func (b Balances) Less(i, j int) bool

func (Balances) Swap

func (b Balances) Swap(i, j int)

type Block

type Block struct {
	Hash              util.Uint256  `json:"hash"`
	Size              int           `json:"size"`
	Version           uint32        `json:"version"`
	NextBlockHash     *util.Uint256 `json:"nextblockhash,omitempty"`
	PreviousBlockHash util.Uint256  `json:"previousblockhash"`
	MerkleRoot        util.Uint256  `json:"merkleroot"`
	Time              uint32        `json:"time"`
	Index             uint32        `json:"index"`
	Nonce             string        `json:"nonce"`
	NextConsensus     util.Uint160  `json:"nextconsensus"`

	Confirmations uint32 `json:"confirmations"`

	Script transaction.Witness `json:"script"`

	Tx []Tx `json:"tx"`
}

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.

type ContractState added in v0.73.0

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 added in v0.73.0

func NewContractState(c *state.Contract) ContractState

NewContractState creates a new Contract wrapper.

type InvokeResult added in v0.61.0

type InvokeResult struct {
	State       string `json:"state"`
	GasConsumed string `json:"gas_consumed"`
	Script      string `json:"script"`
	Stack       *vm.Stack
}

InvokeResult is used as a wrapper to represent an invokation result.

type Properties added in v0.73.0

type Properties struct {
	HasStorage       bool `json:"storage"`
	HasDynamicInvoke bool `json:"dynamic_invoke"`
	IsPayable        bool `json:"is_payable"`
}

Properties response wrapper.

type TransactionOutput added in v0.73.0

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 added in v0.73.0

func NewTxOutput(out *transaction.Output) *TransactionOutput

NewTxOutput converts out to a TransactionOutput.

type TransactionOutputRaw

type TransactionOutputRaw struct {
	*transaction.Transaction
	TxHash        util.Uint256 `json:"txid"`
	Size          int          `json:"size"`
	SysFee        util.Fixed8  `json:"sys_fee"`
	NetFee        util.Fixed8  `json:"net_fee"`
	Blockhash     util.Uint256 `json:"blockhash"`
	Confirmations int          `json:"confirmations"`
	Timestamp     uint32       `json:"blocktime"`
}

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.

type Tx added in v0.73.0

type Tx struct {
	TxID       util.Uint256            `json:"txid"`
	Size       int                     `json:"size"`
	Type       transaction.TXType      `json:"type"`
	Version    uint8                   `json:"version"`
	Attributes []transaction.Attribute `json:"attributes"`
	VIn        []transaction.Input     `json:"vin"`
	VOut       []transaction.Output    `json:"vout"`
	Scripts    []transaction.Witness   `json:"scripts"`

	SysFee util.Fixed8 `json:"sys_fee"`
	NetFee util.Fixed8 `json:"net_fee"`

	Nonce uint32 `json:"nonce,omitempty"`
}

Tx wrapper used for the representation of transaction on the RPC Server.

type UnspentBalanceInfo added in v0.70.0

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 added in v0.70.0

type Unspents struct {
	Balance []UnspentBalanceInfo `json:"balance"`
	Address string               `json:"address"`
}

Unspents wrapper is used to represent getunspents return result.

func NewUnspents added in v0.70.0

func NewUnspents(a *state.Account, chain core.Blockchainer, addr string) Unspents

NewUnspents creates a new Account wrapper using given Blockchainer.

type ValidateAddressResponse

type ValidateAddressResponse struct {
	Address interface{} `json:"address"`
	IsValid bool        `json:"isvalid"`
}

ValidateAddressResponse represents response to validate address call.

func ValidateAddress

func ValidateAddress(addr interface{}) ValidateAddressResponse

ValidateAddress verifies that the address is a correct NEO address see https://docs.neo.org/en-us/node/cli/2.9.4/api/validateaddress.html

Jump to

Keyboard shortcuts

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