blockchain

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Keccak256

func Keccak256(data ...[]byte) []byte

func PersonalEcRecover

func PersonalEcRecover(data []byte, sig []byte) (string, error)

func SigToPub

func SigToPub(hash, sig []byte) (*ecdsa.PublicKey, error)

Types

type Block

type Block interface {
	Number() uint64
	Timestamp() uint64
	GetTransactions() []Transaction

	Hash() string
	ParentHash() string
}

type BlockChain

type BlockChain interface {
	GetTokenBalance(tokenAddress, address string) decimal.Decimal
	GetTokenAllowance(tokenAddress, proxyAddress, address string) decimal.Decimal

	GetBlockNumber() (uint64, error)
	GetBlockByNumber(blockNumber uint64) (Block, error)

	GetTransaction(ID string) (Transaction, error)
	GetTransactionReceipt(ID string) (TransactionReceipt, error)
	GetTransactionAndReceipt(ID string) (Transaction, TransactionReceipt, error)
}

type Ethereum

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

func (*Ethereum) EnableDebug

func (e *Ethereum) EnableDebug(b bool)

func (*Ethereum) GetBlockByNumber

func (e *Ethereum) GetBlockByNumber(number uint64) (Block, error)

func (*Ethereum) GetBlockNumber

func (e *Ethereum) GetBlockNumber() (uint64, error)

func (*Ethereum) GetTokenAllowance

func (e *Ethereum) GetTokenAllowance(tokenAddress, proxyAddress, address string) decimal.Decimal

func (*Ethereum) GetTokenBalance

func (e *Ethereum) GetTokenBalance(tokenAddress, address string) decimal.Decimal

func (*Ethereum) GetTransaction

func (e *Ethereum) GetTransaction(ID string) (Transaction, error)

func (*Ethereum) GetTransactionAndReceipt

func (e *Ethereum) GetTransactionAndReceipt(ID string) (Transaction, TransactionReceipt, error)

func (*Ethereum) GetTransactionCount

func (e *Ethereum) GetTransactionCount(address string) (int, error)

func (*Ethereum) GetTransactionReceipt

func (e *Ethereum) GetTransactionReceipt(ID string) (TransactionReceipt, error)

type EthereumBlock

type EthereumBlock struct {
	*ethrpc.Block
}

func (*EthereumBlock) GetTransactions

func (block *EthereumBlock) GetTransactions() []Transaction

func (*EthereumBlock) Hash

func (block *EthereumBlock) Hash() string

func (*EthereumBlock) Number

func (block *EthereumBlock) Number() uint64

func (*EthereumBlock) ParentHash

func (block *EthereumBlock) ParentHash() string

func (*EthereumBlock) Timestamp

func (block *EthereumBlock) Timestamp() uint64

type EthereumTransaction

type EthereumTransaction struct {
	*ethrpc.Transaction
}

func (*EthereumTransaction) GetBlockHash

func (t *EthereumTransaction) GetBlockHash() string

func (*EthereumTransaction) GetBlockNumber

func (t *EthereumTransaction) GetBlockNumber() uint64

func (*EthereumTransaction) GetFrom

func (t *EthereumTransaction) GetFrom() string

func (*EthereumTransaction) GetGas

func (t *EthereumTransaction) GetGas() int

func (*EthereumTransaction) GetGasPrice

func (t *EthereumTransaction) GetGasPrice() big.Int

func (*EthereumTransaction) GetHash

func (t *EthereumTransaction) GetHash() string

func (*EthereumTransaction) GetTo

func (t *EthereumTransaction) GetTo() string

func (*EthereumTransaction) GetValue

func (t *EthereumTransaction) GetValue() big.Int

type EthereumTransactionReceipt

type EthereumTransactionReceipt struct {
	*ethrpc.TransactionReceipt
}

func (*EthereumTransactionReceipt) GetBlockHash

func (r *EthereumTransactionReceipt) GetBlockHash() string

func (*EthereumTransactionReceipt) GetBlockNumber

func (r *EthereumTransactionReceipt) GetBlockNumber() uint64

func (*EthereumTransactionReceipt) GetLogs

func (r *EthereumTransactionReceipt) GetLogs() (rst []IReceiptLog)

func (*EthereumTransactionReceipt) GetResult

func (r *EthereumTransactionReceipt) GetResult() bool

func (*EthereumTransactionReceipt) GetTxHash

func (r *EthereumTransactionReceipt) GetTxHash() string

func (*EthereumTransactionReceipt) GetTxIndex

func (r *EthereumTransactionReceipt) GetTxIndex() int

type IReceiptLog

type IReceiptLog interface {
	GetRemoved() bool
	GetLogIndex() int
	GetTransactionIndex() int
	GetTransactionHash() string
	GetBlockNum() int
	GetBlockHash() string
	GetAddress() string
	GetData() string
	GetTopics() []string
}

type ReceiptLog

type ReceiptLog struct {
	*ethrpc.Log
}

func (ReceiptLog) GetAddress

func (log ReceiptLog) GetAddress() string

func (ReceiptLog) GetBlockHash

func (log ReceiptLog) GetBlockHash() string

func (ReceiptLog) GetBlockNum

func (log ReceiptLog) GetBlockNum() int

func (ReceiptLog) GetData

func (log ReceiptLog) GetData() string

func (ReceiptLog) GetLogIndex

func (log ReceiptLog) GetLogIndex() int

func (ReceiptLog) GetRemoved

func (log ReceiptLog) GetRemoved() bool

func (ReceiptLog) GetTopics

func (log ReceiptLog) GetTopics() []string

func (ReceiptLog) GetTransactionHash

func (log ReceiptLog) GetTransactionHash() string

func (ReceiptLog) GetTransactionIndex

func (log ReceiptLog) GetTransactionIndex() int

type Transaction

type Transaction interface {
	GetBlockHash() string
	GetBlockNumber() uint64
	GetFrom() string
	GetGas() int
	GetGasPrice() big.Int
	GetHash() string
	GetTo() string
	GetValue() big.Int
}

type TransactionReceipt

type TransactionReceipt interface {
	GetResult() bool
	GetBlockNumber() uint64

	GetBlockHash() string
	GetTxHash() string
	GetTxIndex() int

	GetLogs() []IReceiptLog
}

Jump to

Keyboard shortcuts

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