sdk

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VERSION of ethereum
	VERSION = "v1.8.23"
	// CLIENT identifier
	CLIENT = "geth"
)

Variables

This section is empty.

Functions

func Close

func Close()

Close client's connection

func EthBlockNumber

func EthBlockNumber() (height string, err error)

EthBlockNumber return block number in hex string

func EthBlockNumberInt64

func EthBlockNumberInt64() (height int64, err error)

EthBlockNumberInt64 return block number in int64

func EthBlockNumberResponse

func EthBlockNumberResponse() (response string, err error)

EthBlockNumberResponse json-rpc response string for eth_blockNumber

func EthGetBalance

func EthGetBalance(address string, blockParameter string) (response string, err error)

EthGetBalance returns the balance of the account of given address.

func EthGetBlockByNumberResponse

func EthGetBlockByNumberResponse(height int64) (response string, err error)

EthGetBlockByNumberResponse json-rpc for eth_getBlockByNumber

func EthGetTransactionByHashResponse

func EthGetTransactionByHashResponse(hash string) (response string, err error)

EthGetTransactionByHashResponse returns the information about a transaction requested by transaction hash.

func EthGetTransactionReceiptResponse

func EthGetTransactionReceiptResponse(hash string) (response string, err error)

EthGetTransactionReceiptResponse returns the receipt of a transaction by transaction hash

func EthProtocolVersionResponse

func EthProtocolVersionResponse() (response string, err error)

EthProtocolVersionResponse json-rpc for eth_protocolVersion

Types

type Account

type Account struct {
	WalletAddress string
	EncryptedKey  string
}

Account escrow account on hyperledger fabric

func NewAccount

func NewAccount(accountID, pass string) (*Account, error)

NewAccount create a new account on ethereum

type Block

type Block struct {
	Number       string         `json:"number,omitempty"`
	Difficulty   string         `json:"difficulty,omitempty"`
	Transactions []*Transaction `json:"transactions,omitempty"`
}

Block returns from ethereum

func EthGetBlockByNumber

func EthGetBlockByNumber(height int64) (*Block, error)

EthGetBlockByNumber json-rpc for eth_getBlockByNumber

type EthClient

type EthClient struct {
	// contains filtered or unexported fields
}

EthClient ethereum json-rpc client

type GethConfig

type GethConfig struct {
	Eth  eth.Config
	Shh  whisper.Config
	Node node.Config
	// Ethstats  ethstatsConfig
	Dashboard dashboard.Config
}

GethConfig wrapped ethereum config

func Config

func Config() GethConfig

Config returns ethereum config

type JSONRPC

type JSONRPC struct {
	JSONRPC string        `json:"jsonrpc,omitempty"`
	Method  string        `json:"method,omitempty"`
	Params  []interface{} `json:"params,omitempty"`
	ID      uint8         `json:"id,omitempty"`
}

JSONRPC rpc request

type RPCResponse

type RPCResponse struct {
	JSONRPCVersion string       `json:"jsonrpc"`
	ID             uint8        `json:"id"`
	Result         interface{}  `json:"result"`
	Error          *ResultError `json:"error"`
}

RPCResponse returns block from ethereum

type ResultError

type ResultError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ResultError error message

type Token

type Token struct {
	Name     string `json:"name,omitempty"`
	Symbol   string `json:"symbol,omitempty"`
	Decimals uint8  `json:"decimals,omitempty"`
}

Token info on chain

func QueryTokenInfo

func QueryTokenInfo(chain, tokenAddress string) (*Token, error)

QueryTokenInfo query token info on ethereum

type Transaction

type Transaction struct {
	BlockHash        string `json:"blockHash,omitempty"`
	TransactionIndex string `json:"transactionIndex,omitempty"`
	From             string `json:"from,omitempty"`
	To               string `json:"to,omitempty"`
	Value            string `json:"value,omitempty"`

	BlockNumber string `json:"blockNumber,omitempty"`
	ChainID     string `json:"chainId,omitempty"`
	//     Condition
	//     Creates
	Gas       string `json:"gas,omitempty"`
	GasPrice  string `json:"gasPrice,omitempty"`
	Hash      string `json:"hash,omitempty"`
	Input     string `json:"input,omitempty"`
	Nonce     string `json:"nonce,omitempty"`
	PublicKey string `json:"publicKey,omitempty"`
	R         string `json:"r,omitempty"`
	Raw       string `json:"raw,omitempty"`
	S         string `json:"s,omitempty"`
	StandardV string `standardV:"value,omitempty"`
	V         string `json:"v,omitempty"`
}

Transaction block tx

func EthGetTransactionByHash

func EthGetTransactionByHash(hash string) (*Transaction, error)

EthGetTransactionByHash returns the information about a transaction requested by transaction hash.

type TransactionReceipt

type TransactionReceipt struct {
	Height          string `json:"blockNumber,omitempty"`
	Hash            string `json:"transactionHash,omitempty"`
	Status          string `json:"status,omitempty"`
	GasUsed         string `json:"gasUsed,omitempty"`
	ContractAddress string `json:"contractAddress,omitempty"`
}

TransactionReceipt receipt of transaction

func EthGetTransactionReceipt

func EthGetTransactionReceipt(hash string) (*TransactionReceipt, error)

EthGetTransactionReceipt returns the receipt of a transaction by transaction hash

func (*TransactionReceipt) Success

func (r *TransactionReceipt) Success() bool

Success or not

Jump to

Keyboard shortcuts

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