mysql

package
v0.0.0-...-8e9f79f Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TableNameBlock              = "block"
	TableNameTransaction        = "transaction"
	TableNameTransactionReceipt = "transaction_receipt"
	TableNameContract           = "erc20_contract"
	TableNameUserTokens         = "user_tokens"
)

Functions

func SanitizeUint32

func SanitizeUint32(hex string) uint32

************

  • helpers ***********

Types

type Block

type Block struct {
	Number           string
	Hash             string
	Size             string
	Timestamp        string
	GasLimit         string
	GasUsed          string
	Difficulty       string
	TotalDifficulty  string
	Miner            string
	ParentHash       string
	MixHash          string
	ReceiptsRoot     string
	Sha3Uncles       string
	StateRoot        string
	TransactionsRoot string
	Nonce            string
	ExtraData        string
	LogsBloom        string
	Transactions     []*Transaction
	Uncles           interface{}
}

type Connection

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

func NewConnection

func NewConnection(dsn string) *Connection

func (*Connection) Close

func (conn *Connection) Close()

func (*Connection) Error

func (conn *Connection) Error() error

func (*Connection) GetReceipt

func (conn *Connection) GetReceipt(txhash string) (*TransactionReceipt, error)

func (*Connection) GetTransactionErc20History

func (conn *Connection) GetTransactionErc20History(address string, contractAddress string, pageFrom, pageTo int) ([]*Transaction, error)

仅ERC20交易历史

func (*Connection) GetTransactionEthHistory

func (conn *Connection) GetTransactionEthHistory(address string, pageFrom, pageTo int) ([]*Transaction, error)

仅EOA交易历史

func (*Connection) GetTransactionHistory

func (conn *Connection) GetTransactionHistory(address string, pageFrom, pageTo int) ([]*Transaction, error)

所有交易历史

func (*Connection) GetUserTokens

func (conn *Connection) GetUserTokens(address string) ([]*Contract, error)

func (*Connection) MaxBlockNumber

func (conn *Connection) MaxBlockNumber() (uint64, error)

type Contract

type Contract struct {
	Bytecode    string `json:"bytecode,omitempty"`
	Address     string `json:"address"`
	Name        string `json:"name"`
	Symbol      string `json:"symbol"`
	Decimals    int    `json:"decimals"`
	TotalSupply string `json:"total_supply,omitempty"`
}

type Transaction

type Transaction struct {
	Id               uint32 `json:"id"`
	Hash             string `json:"hash"`
	BlockNumber      string `json:"blockNumber"`
	BlockHash        string `json:"blockHash"`
	From             string `json:"from"`
	To               string `json:"to"`
	Receipt          string `json:"receipt"`
	Gas              string `json:"gas"`
	GasPrice         string `json:"gasPrice"`
	Nonce            string `json:"nonce"`
	TransactionIndex string `json:"transactionIndex"`
	Value            string `json:"value"`
	V                string `json:"v"`
	R                string `json:"r"`
	S                string `json:"s"`
	Input            string `json:"input"`
	IsContract       int    `json:"is_contract_tx"`
	TimeStamp        string `json:"time_stamp"`
}

type TransactionReceipt

type TransactionReceipt struct {
	Id                uint32      `json:"id"`
	BlockHash         string      `json:"block_hash"`
	BlockNumber       string      `json:"block_number"`
	ContractAddress   string      `json:"contract_address"`
	CumulativeGasUsed string      `json:"-"`
	From              string      `json:"from"`
	To                string      `json:"to"`
	GasUsed           string      `json:"gas_used"`
	TransactionHash   string      `json:"transaction_hash"`
	TransactionIndex  string      `json:"transaction_index"`
	Status            string      `json:"status"`
	LogsBloom         string      `json:"-"`
	Logs              interface{} `json:"-"`
}

logs https://codeburst.io/deep-dive-into-ethereum-logs-a8d2047c7371

func (*TransactionReceipt) String

func (receipt *TransactionReceipt) String() []byte

Jump to

Keyboard shortcuts

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