neorpc

package
v0.0.0-...-cbe201a Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	Error struct {
		Code    int    `json:"code"`
		Message string `json:"message"`
	} `json:"error"`
}

type GetAccountStateBalance

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

type GetAccountStateResponse

type GetAccountStateResponse struct {
	JSONRPCResponse
	*ErrorResponse                       //optional
	Result         GetAccountStateResult `json:"result"`
}

type GetAccountStateResult

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

type GetBlockCountResponse

type GetBlockCountResponse struct {
	JSONRPCResponse
	*ErrorResponse     //optional
	Result         int `json:"result"`
}

type GetBlockResponse

type GetBlockResponse struct {
	JSONRPCResponse
	*ErrorResponse                //optional
	Result         GetBlockResult `json:"result"`
}

type GetBlockResult

type GetBlockResult 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"`
	Index             int    `json:"index"`
	Nonce             string `json:"nonce"`
	Nextconsensus     string `json:"nextconsensus"`
	Script            struct {
		Invocation   string `json:"invocation"`
		Verification string `json:"verification"`
	} `json:"script"`
	Tx []struct {
		Txid       string        `json:"txid"`
		Size       int           `json:"size"`
		Type       string        `json:"type"`
		Version    int           `json:"version"`
		Attributes []interface{} `json:"attributes"`
		Vin        []interface{} `json:"vin"`
		Vout       []interface{} `json:"vout"`
		Claims     []interface{} `json:"claims"`
		SysFee     string        `json:"sys_fee"`
		NetFee     string        `json:"net_fee"`
		Scripts    []interface{} `json:"scripts"`
		Nonce      int64         `json:"nonce,omitempty"`
		Script     string        `json:"script,omitempty"`
		Gas        string        `json:"gas,omitempty"`
	} `json:"tx"`
	Confirmations int    `json:"confirmations"`
	Nextblockhash string `json:"nextblockhash"`
}

type GetContractStateResponse

type GetContractStateResponse struct {
	JSONRPCResponse
	*ErrorResponse                        //optional
	Result         GetContractStateResult `json:"result"`
}

type GetContractStateResult

type GetContractStateResult struct {
	Version     int      `json:"version"`
	Hash        string   `json:"hash"`
	Script      string   `json:"script"`
	Parameters  []string `json:"parameters"`
	Returntype  string   `json:"returntype"`
	Name        string   `json:"name"`
	CodeVersion string   `json:"code_version"`
	Author      string   `json:"author"`
	Email       string   `json:"email"`
	Description string   `json:"description"`
	Properties  struct {
		Storage       bool `json:"storage"`
		DynamicInvoke bool `json:"dynamic_invoke"`
	} `json:"properties"`
}

type GetRawTransactionResponse

type GetRawTransactionResponse struct {
	JSONRPCResponse
	*ErrorResponse                         //optional
	Result         GetRawTransactionResult `json:"result"`
}

type GetRawTransactionResult

type GetRawTransactionResult struct {
	Txid       string `json:"txid"`
	Size       int    `json:"size"`
	Type       string `json:"type"`
	Version    int    `json:"version"`
	Attributes []struct {
		Usage string `json:"usage"`
		Data  string `json:"data"`
	} `json:"attributes"`
	Vin []struct {
		Txid string `json:"txid"`
		Vout int    `json:"vout"`
	} `json:"vin"`
	Vout []struct {
		N       int    `json:"n"`
		Asset   string `json:"asset"`
		Value   string `json:"value"`
		Address string `json:"address"`
	} `json:"vout"`
	Claims []struct {
		Txid string `json:"txid"`
		Vout int    `json:"vout"`
	} `json:"claims"`
	SysFee  string `json:"sys_fee"`
	NetFee  string `json:"net_fee"`
	Scripts []struct {
		Invocation   string `json:"invocation"`
		Verification string `json:"verification"`
	} `json:"scripts"`
	Script        string `json:"script"`
	Gas           string `json:"gas"`
	Blockhash     string `json:"blockhash"`
	Confirmations int    `json:"confirmations"`
	Blocktime     int    `json:"blocktime"`
}

type GetUnspentsResponse

type GetUnspentsResponse struct {
	Jsonrpc string `json:"jsonrpc"`
	ID      int    `json:"id"`
	Result  struct {
		Balance []struct {
			Unspent []struct {
				Txid  string `json:"txid"`
				N     int    `json:"n"`
				Value int    `json:"value"`
			} `json:"unspent"`
			AssetHash   string `json:"asset_hash"`
			Asset       string `json:"asset"`
			AssetSymbol string `json:"asset_symbol"`
			Amount      int    `json:"amount"`
		} `json:"balance"`
		Address string `json:"address"`
	} `json:"result"`
}

type InvokeFunctionStackArg

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

func NewInvokeFunctionStackByteArray

func NewInvokeFunctionStackByteArray(value string) InvokeFunctionStackArg

type InvokeFunctionStackResult

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

type InvokeScriptResponse

type InvokeScriptResponse struct {
	JSONRPCResponse
	*ErrorResponse
	Result struct {
		Script      string `json:"script"`
		State       string `json:"state"`
		GasConsumed string `json:"gas_consumed"`
		Stack       []struct {
			Type  string `json:"type"`
			Value string `json:"value"`
		} `json:"stack"`
	} `json:"result"`
}

type JSONRPCRequest

type JSONRPCRequest struct {
	Jsonrpc string        `json:"jsonrpc"`
	Method  string        `json:"method"`
	Params  []interface{} `json:"params"`
	ID      int           `json:"id"`
}

func NewRequest

func NewRequest(method string, params []interface{}) JSONRPCRequest

type JSONRPCResponse

type JSONRPCResponse struct {
	Jsonrpc string `json:"jsonrpc"`
	ID      int    `json:"id"`
}

type NEORPCClient

type NEORPCClient struct {
	Endpoint url.URL
	// contains filtered or unexported fields
}

func NewClient

func NewClient(endpoint string) *NEORPCClient

func (*NEORPCClient) GetAccountState

func (n *NEORPCClient) GetAccountState(address string) GetAccountStateResponse

func (*NEORPCClient) GetBlock

func (n *NEORPCClient) GetBlock(blockHash string) GetBlockResponse

func (*NEORPCClient) GetBlockByIndex

func (n *NEORPCClient) GetBlockByIndex(index int) GetBlockResponse

func (*NEORPCClient) GetBlockCount

func (n *NEORPCClient) GetBlockCount() GetBlockCountResponse

func (*NEORPCClient) GetContractState

func (n *NEORPCClient) GetContractState(scripthash string) GetContractStateResponse

func (*NEORPCClient) GetRawTransaction

func (n *NEORPCClient) GetRawTransaction(txID string) GetRawTransactionResponse

func (*NEORPCClient) GetTokenBalance

func (n *NEORPCClient) GetTokenBalance(tokenHash string, neoAddress string) TokenBalanceResponse

func (*NEORPCClient) GetUnspents

func (n *NEORPCClient) GetUnspents(adddress string) GetUnspentsResponse

func (*NEORPCClient) InvokeScript

func (n *NEORPCClient) InvokeScript(scriptInHex string) InvokeScriptResponse

func (*NEORPCClient) SendRawTransaction

func (n *NEORPCClient) SendRawTransaction(rawTransactionInHex string) SendRawTransactionResponse

type NEORPCInterface

type NEORPCInterface interface {
	GetContractState(scripthash string) GetContractStateResponse
	SendRawTransaction(rawTransactionInHex string) SendRawTransactionResponse
	GetRawTransaction(txID string) GetRawTransactionResponse

	GetBlockCount() GetBlockCountResponse
	GetBlock(blockHash string) GetBlockResponse
	GetBlockByIndex(index int) GetBlockResponse
	GetAccountState(address string) GetAccountStateResponse
	InvokeScript(scriptInHex string) InvokeScriptResponse
	GetTokenBalance(tokenHash string, adddress string) TokenBalanceResponse
	GetUnspents(adddress string) GetUnspentsResponse
	// contains filtered or unexported methods
}

type SendRawTransactionResponse

type SendRawTransactionResponse struct {
	JSONRPCResponse
	*ErrorResponse //optional
	Result         bool
}

type TokenBalanceResponse

type TokenBalanceResponse struct {
	JSONRPCResponse
	*ErrorResponse                    //optional
	Result         TokenBalanceResult `json:"result"`
}

type TokenBalanceResult

type TokenBalanceResult struct {
	Script      string                      `json:"script"`
	State       string                      `json:"state"`
	GasConsumed string                      `json:"gas_consumed"`
	Stack       []InvokeFunctionStackResult `json:"stack"`
	Tx          string                      `json:"tx"`
}

Jump to

Keyboard shortcuts

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