rpc

package
v0.0.0-...-bfbcaa6 Latest Latest
Warning

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

Go to latest
Published: May 2, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountSate

type AccountSate struct {
	Version    int         `json:"version"`
	ScriptHash string      `json:"script_hash"`
	Frozen     bool        `json:"frozen"`
	Votes      interface{} `json:"votes"`
	Balances   []Asset     `json:"balances"`
}

AccountSate neo account state

type ApplicationLog

type ApplicationLog struct {
	ID            string          `json:"txid"`
	State         string          `json:"vmstate"`
	GasConsumed   string          `json:"gas_consumed"`
	Notifications []*Notification `json:"notifications"`
}

ApplicationLog .

type Asset

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

Asset .

type AssetState

type AssetState struct {
	Version    int          `json:"version"`
	ID         string       `json:"id"`
	Type       string       `json:"type"`
	Name       []L10NString `json:"name"`
	Amount     string       `json:"amount"`
	Available  string       `json:"available"`
	Precision  float64      `json:"precision"`
	Owner      string       `json:"owner"`
	Admin      string       `json:"admin"`
	Issuer     string       `json:"issuer"`
	Expiration float64      `json:"expiration"`
	Frozen     bool         `json:"frozen"`
}

AssetState neo asset state

type Balance

type Balance struct {
	Balance   string `json:"balance"`
	Confirmed string `json:"confirmed"`
}

Balance .

type Block

type Block struct {
	Confirmations     int64         `json:"Confirmations"`
	Hash              string        `json:"Hash"`
	Index             int64         `json:"Index"`
	Merkleroot        string        `json:"Merkleroot"`
	NextBlockHash     string        `json:"Nextblockhash"`
	NextConsensus     string        `json:"Nextconsensus"`
	Nonce             string        `json:"Nonce"`
	PreviousBlockHash string        `json:"Previousblockhash"`
	Size              int64         `json:"Size"`
	Time              int64         `json:"Time"`
	Version           int64         `json:"Version"`
	Script            Script        `json:"Script"`
	Transactions      []Transaction `json:"Tx"`
}

Block .

type BlockFee

type BlockFee struct {
	ID         int64
	SysFee     float64
	NetFee     float64
	CreateTime string
}

BlockFee block

type Claim

type Claim struct {
	TransactionID string `json:"txid"`
	Vout          int    `json:"vout"`
}

Claim .

type Client

type Client struct {
	slf4go.Logger
	// contains filtered or unexported fields
}

Client neo jsonrpc 2.0 client

func NewClient

func NewClient(url string) *Client

NewClient create new neo client

func (*Client) ApplicationLog

func (client *Client) ApplicationLog(txid string) (*ApplicationLog, error)

ApplicationLog get application log

func (*Client) GetAccountState

func (client *Client) GetAccountState(account string) (state *AccountSate, err error)

GetAccountState get account state using jsonrpc :http://docs.neo.org/zh-cn/node/api/getaccountstate.html

func (*Client) GetAssetState

func (client *Client) GetAssetState(asset string) (state *AssetState, err error)

GetAssetState get asset state using jsonrpc :http://docs.neo.org/zh-cn/node/api/getassetstate.html

func (*Client) GetBalance

func (client *Client) GetBalance(address string, asset string) (utxos []*UTXO, err error)

GetBalance extend rpc method get address's utxos

func (*Client) GetBestBlockHash

func (client *Client) GetBestBlockHash() (hash string, err error)

GetBestBlockHash get neo last block hash http://docs.neo.org/zh-cn/node/api/getbestblockhash.html

func (*Client) GetBlock

func (client *Client) GetBlock(hash string) (block *Block, err error)

GetBlock get neo block info http://docs.neo.org/zh-cn/node/api/getblock.html

func (*Client) GetBlockByIndex

func (client *Client) GetBlockByIndex(index int64) (block *Block, err error)

GetBlockByIndex get neo block info http://docs.neo.org/zh-cn/node/api/getblock2.html

func (*Client) GetBlockCount

func (client *Client) GetBlockCount() (count int64, err error)

GetBlockCount get neo count info http://docs.neo.org/zh-cn/node/api/getblockcount.html

func (*Client) GetClaim

func (client *Client) GetClaim(address string) (unclaimed *Unclaimed, err error)

GetClaim get unclaimed utxos

func (*Client) GetConnectionCount

func (client *Client) GetConnectionCount() (count int, err error)

GetConnectionCount get node's connection count http://docs.neo.org/zh-cn/node/api/getconnectioncount.html

func (*Client) GetPeers

func (client *Client) GetPeers() (data interface{}, err error)

GetPeers .

func (*Client) GetRawTransaction

func (client *Client) GetRawTransaction(txid string) (trans *Transaction, err error)

GetRawTransaction get transaction with txid http://docs.neo.org/zh-cn/node/api/getrawtransaction.html

func (*Client) GetTxOut

func (client *Client) GetTxOut(txid string, n uint) (vout *Vout, err error)

GetTxOut get tx vout http://docs.neo.org/zh-cn/node/api/gettxout.html

func (*Client) Nep5BalanceOf

func (client *Client) Nep5BalanceOf(scriptHash string, address string) (uint64, error)

Nep5BalanceOf get nep5 balance of special address

func (*Client) Nep5Decimals

func (client *Client) Nep5Decimals(scriptHash string) (uint64, error)

Nep5Decimals get nep5 deciamls

func (*Client) Nep5Symbol

func (client *Client) Nep5Symbol(scriptHash string) (string, error)

Nep5Symbol .

func (*Client) Nep5Transfer

func (client *Client) Nep5Transfer(scriptHash string, from, to string, amount uint64) (*Nep5Result, error)

Nep5Transfer .

func (*Client) SendRawTransaction

func (client *Client) SendRawTransaction(data []byte) (status bool, err error)

SendRawTransaction send raw transaction with jsonrpc api:http://docs.neo.org/zh-cn/node/api/sendrawtransaction.html

type L10NString

type L10NString struct {
	Lang string `json:"lang"`
	Name string `json:"name"`
}

L10NString localization string

type Nep5Result

type Nep5Result struct {
	State       string   `json:"state"`
	GasConsumed string   `json:"gas_consumed"`
	Script      string   `json:"script"`
	Stack       []*Value `json:"stack"`
}

Nep5Result .

type Notification

type Notification struct {
	Contract string `json:"contract"`
	State    State  `json:"state"`
}

Notification .

type Script

type Script struct {
	Invocation   string `json:"Invocation"`
	Verification string `json:"Verification"`
}

Script .

type State

type State struct {
	Type  string      `json:"type"`
	Value interface{} `json:"value,omitempty"`
}

State .

type Transaction

type Transaction struct {
	ID         string        `json:"Txid"`
	Size       int64         `json:"Size"`
	Type       string        `json:"Type"`
	Version    int64         `json:"Version"`
	Attributes []interface{} `json:"Attributes"` //
	Script     interface{}   `json:"Script"`
	Gas        string        `json:"Gas"`
	Claims     []Claim       `json:"Claims"`
	Vin        []Vin         `json:"Vin"`
	Vout       []Vout        `json:"Vout"`
	SysFee     string        `json:"Sys_fee"`
	NetFee     string        `json:"Net_fee"`
	Scripts    []Script      `json:"Scripts"`
	Nonce      int64         `json:"Nonce"`
}

Transaction .

type TxAttr

type TxAttr struct {
	Usage byte
	Data  []byte
}

TxAttr .

func (*TxAttr) Bytes

func (attr *TxAttr) Bytes() []byte

Bytes get attr bytes

type UTXO

type UTXO struct {
	TransactionID string `json:"txid"`
	Vout          Vout   `json:"vout"`
	CreateTime    string `json:"createTime"`
	SpentTime     string `json:"spentTime"`
	Block         int64  `json:"block"`
	SpentBlock    int64  `json:"spentBlock"`

	Gas string `json:"gas"`
	// contains filtered or unexported fields
}

UTXO .

func (*UTXO) TxHex

func (utxo *UTXO) TxHex() ([]byte, error)

TxHex get utxo txid hex value

func (*UTXO) Value

func (utxo *UTXO) Value() (float64, error)

Value get utxo value

type Unclaimed

type Unclaimed struct {
	Unavailable string
	Available   string
	Claims      []*UTXO
}

Unclaimed .

type Value

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

Value .

type ValueN

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

ValueN .

type Vin

type Vin struct {
	TransactionID string `json:"Txid"`
	Vout          int    `json:"Vout"`
}

Vin .

type Vout

type Vout struct {
	Address string `json:"Address"`
	Asset   string `json:"Asset"`
	N       int    `json:"N"`
	Value   string `json:"Value"`
}

Vout .

Jump to

Keyboard shortcuts

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