api

package
v0.0.0-...-85922c0 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const ETHKTODIC = 10000000

Variables

View Source
var (
	ETH_CHAINID               string = "eth_chainId"
	NET_VERSION               string = "net_version"
	NET_LISTENING             string = "net_listening"
	ETH_SENDTRANSACTION       string = "eth_sendTransaction"
	ETH_CALL                  string = "eth_call"
	ETH_BLOCKNUMBER           string = "eth_blockNumber"
	ETH_GETBALANCE            string = "eth_getBalance"
	ETH_GETBLOCKBYHASH        string = "eth_getBlockByHash"
	ETH_GETBLOCKBYNUMBER      string = "eth_getBlockByNumber"
	ETH_GETTRANSACTIONBYHASH  string = "eth_getTransactionByHash"
	ETH_GASPRICE              string = "eth_gasPrice"
	EHT_GETCODE               string = "eth_getCode"
	ETH_GETTRANSACTIONCOUNT   string = "eth_getTransactionCount"
	ETH_ESTIMATEGAS           string = "eth_estimateGas"
	ETH_SENDRAWTRANSACTION    string = "eth_sendRawTransaction"
	ETH_GETTRANSACTIONRECEIPT string = "eth_getTransactionReceipt"
	ETH_GETLOGS               string = "eth_getLogs"
	ETH_GETSTORAGEAT          string = "eth_getStorageAt"
	ETH_SIGNTRANSACTION       string = "eth_signTransaction"
	ETH_ACCOUNTS              string = "eth_accounts"
	PERSONAL_UNLOCKACCOUNT    string = "personal_unlockAccount"

	WEB3_CLIENTVERSION string = "web3_clientVersion"
)
View Source
var (
	JsonMarshalErr   int = -5001
	JsonUnmarshalErr int = -5002
	ParameterErr     int = -5003
	IoutilErr        int = -5004
	UnkonwnErr       int = -5005
)
View Source
var (
	SUCCESS = "0x1"
	FAILED  = "0x0"
)

Functions

This section is empty.

Types

type Block

type Block struct {
	Difficulty   string         `json:"difficulty"`
	ExtraData    string         `json:"extraData"`
	GasLimit     string         `json:"gasLimit"`
	GasUsed      string         `json:"gasUsed"`
	Hash         common.Hash    `json:"hash"`
	LogsBloom    string         `json:"logsBloom"`
	Miner        common.Address `json:"miner"`
	MixHash      string         `json:"mixHash"`
	Nonce        string         `json:"nonce"`
	Number       string         `json:"number"`
	ParentHash   common.Hash    `json:"parentHash"`
	TimeStamp    string         `json:"timestamp"`
	Transactions interface{}    `json:"transactions"`
}

type ErrorBody

type ErrorBody struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    string `json:"data"`
}

type Server

type Server struct {
	Bc blockchain.Blockchains
	Tp *txpool.Pool

	Cfg *config.CfgInfo
	// contains filtered or unexported fields
}

Server struct

func NewMetamaskServer

func NewMetamaskServer(bc blockchain.Blockchains, tp *txpool.Pool, cfg *config.CfgInfo) *Server

New Server

func (*Server) HandRequest

func (s *Server) HandRequest(w http.ResponseWriter, req *http.Request)

Handle Request

type Transaction

type Transaction struct {
	BlockHash        common.Hash    `json:"blockHash"`
	BlockNumber      string         `json:"blockNumber"`
	From             common.Address `json:"from"`
	Gas              string         `json:"gas"`
	GasPrice         string         `json:"gasPrice"`
	Hash             common.Hash    `json:"hash"`
	Input            string         `json:"input"`
	Nonce            string         `json:"nonce"`
	To               common.Address `json:"to"`
	TransactionIndex string         `json:"transactionIndex"`
	Value            string         `json:"value"`
	V                string         `json:"v"`
	R                common.Hash    `json:"r"`
	S                common.Hash    `json:"S"`
}

type TransactionReceipt

type TransactionReceipt struct {
	BlockHash         common.Hash    `json:"blockHash"`
	BlockNumber       string         `json:"blockNumber"`
	ContractAddress   common.Address `json:"contractAddress"`
	CumulativeGasUsed string         `json:"cumulativeGasUsed"`
	From              common.Address `json:"from"`
	GasUsed           string         `json:"gasUsed"`
	Logs              []*types.Log   `json:"logs"`
	LogsBloom         types.Bloom    `json:"logsBloom"`
	Status            string         `json:"status"`
	To                common.Address `json:"to"`

	TransactionHash  common.Hash `json:"transactionHash"`
	TransactionIndex string      `json:"transactionIndex"`

	Root common.Hash `json:"root"`
}

Jump to

Keyboard shortcuts

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