eth

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2018 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Overview

Package eth is a generated protocol buffer package.

It is generated from these files:

tx.proto

It has these top-level messages:

ProtoTransaction

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewEthereumRPC

func NewEthereumRPC(config json.RawMessage, pushHandler func(bchain.NotificationType)) (bchain.BlockChain, error)

NewEthereumRPC returns new EthRPC instance.

Types

type Configuration

type Configuration struct {
	CoinName     string `json:"coin_name"`
	CoinShortcut string `json:"coin_shortcut"`
	RPCURL       string `json:"rpc_url"`
	RPCTimeout   int    `json:"rpc_timeout"`
}

type EthereumNet

type EthereumNet uint32

EthereumNet type specifies the type of ethereum network

const (
	// MainNet is production network
	MainNet EthereumNet = 1
	// TestNet is Ropsten test network
	TestNet EthereumNet = 3
)

type EthereumParser

type EthereumParser struct {
	*bchain.BaseParser
}

EthereumParser handle

func NewEthereumParser

func NewEthereumParser() *EthereumParser

NewEthereumParser returns new EthereumParser instance

func (*EthereumParser) GetAddrDescFromAddress added in v0.1.0

func (p *EthereumParser) GetAddrDescFromAddress(address string) (bchain.AddressDescriptor, error)

GetAddrDescFromAddress returns internal address representation of given address

func (*EthereumParser) GetAddrDescFromVout added in v0.1.0

func (p *EthereumParser) GetAddrDescFromVout(output *bchain.Vout) (bchain.AddressDescriptor, error)

GetAddrDescFromVout returns internal address representation of given transaction output

func (*EthereumParser) GetAddressesFromAddrDesc added in v0.1.0

func (p *EthereumParser) GetAddressesFromAddrDesc(addrDesc bchain.AddressDescriptor) ([]string, bool, error)

GetAddressesFromAddrDesc returns addresses for given address descriptor with flag if the addresses are searchable

func (*EthereumParser) GetScriptFromAddrDesc added in v0.1.0

func (p *EthereumParser) GetScriptFromAddrDesc(addrDesc bchain.AddressDescriptor) ([]byte, error)

GetScriptFromAddrDesc returns output script for given address descriptor

func (*EthereumParser) IsUTXOChain

func (p *EthereumParser) IsUTXOChain() bool

IsUTXOChain returns true if the block chain is UTXO type, otherwise false

func (*EthereumParser) PackBlockHash

func (p *EthereumParser) PackBlockHash(hash string) ([]byte, error)

PackBlockHash packs block hash to byte array

func (*EthereumParser) PackTx

func (p *EthereumParser) PackTx(tx *bchain.Tx, height uint32, blockTime int64) ([]byte, error)

PackTx packs transaction to byte array

func (*EthereumParser) PackTxid

func (p *EthereumParser) PackTxid(txid string) ([]byte, error)

PackTxid packs txid to byte array

func (*EthereumParser) PackedTxidLen

func (p *EthereumParser) PackedTxidLen() int

PackedTxidLen returns length in bytes of packed txid

func (*EthereumParser) UnpackBlockHash

func (p *EthereumParser) UnpackBlockHash(buf []byte) (string, error)

UnpackBlockHash unpacks byte array to block hash

func (*EthereumParser) UnpackTx

func (p *EthereumParser) UnpackTx(buf []byte) (*bchain.Tx, uint32, error)

UnpackTx unpacks transaction from byte array

func (*EthereumParser) UnpackTxid

func (p *EthereumParser) UnpackTxid(buf []byte) (string, error)

UnpackTxid unpacks byte array to txid

type EthereumRPC

type EthereumRPC struct {
	Parser  *EthereumParser
	Testnet bool
	Network string
	Mempool *bchain.NonUTXOMempool

	ChainConfig *Configuration
	// contains filtered or unexported fields
}

EthereumRPC is an interface to JSON-RPC eth service.

func (*EthereumRPC) EstimateFee

func (b *EthereumRPC) EstimateFee(blocks int) (big.Int, error)

EstimateFee returns fee estimation

func (*EthereumRPC) EstimateSmartFee

func (b *EthereumRPC) EstimateSmartFee(blocks int, conservative bool) (big.Int, error)

EstimateSmartFee returns fee estimation

func (*EthereumRPC) GetBestBlockHash

func (b *EthereumRPC) GetBestBlockHash() (string, error)

func (*EthereumRPC) GetBestBlockHeight

func (b *EthereumRPC) GetBestBlockHeight() (uint32, error)

func (*EthereumRPC) GetBlock

func (b *EthereumRPC) GetBlock(hash string, height uint32) (*bchain.Block, error)

GetBlock returns block with given hash or height, hash has precedence if both passed

func (*EthereumRPC) GetBlockHash

func (b *EthereumRPC) GetBlockHash(height uint32) (string, error)

func (*EthereumRPC) GetBlockHeader

func (b *EthereumRPC) GetBlockHeader(hash string) (*bchain.BlockHeader, error)

func (*EthereumRPC) GetBlockInfo added in v0.1.0

func (b *EthereumRPC) GetBlockInfo(hash string) (*bchain.BlockInfo, error)

GetBlockInfo returns extended header (more info than in bchain.BlockHeader) with a list of txids

func (*EthereumRPC) GetChainInfo added in v0.1.0

func (b *EthereumRPC) GetChainInfo() (*bchain.ChainInfo, error)

GetChainInfo returns information about the connected backend

func (*EthereumRPC) GetChainParser

func (b *EthereumRPC) GetChainParser() bchain.BlockChainParser

func (*EthereumRPC) GetCoinName

func (b *EthereumRPC) GetCoinName() string

func (*EthereumRPC) GetMempool

func (b *EthereumRPC) GetMempool() ([]string, error)

func (*EthereumRPC) GetMempoolEntry

func (b *EthereumRPC) GetMempoolEntry(txid string) (*bchain.MempoolEntry, error)

func (*EthereumRPC) GetMempoolTransactions

func (b *EthereumRPC) GetMempoolTransactions(address string) ([]string, error)

GetMempoolTransactions returns slice of mempool transactions for given address

func (*EthereumRPC) GetMempoolTransactionsForAddrDesc added in v0.1.0

func (b *EthereumRPC) GetMempoolTransactionsForAddrDesc(addrDesc bchain.AddressDescriptor) ([]string, error)

GetMempoolTransactionsForAddrDesc returns slice of mempool transactions for given address descriptor

func (*EthereumRPC) GetNetworkName

func (b *EthereumRPC) GetNetworkName() string

func (*EthereumRPC) GetSubversion

func (b *EthereumRPC) GetSubversion() string

func (*EthereumRPC) GetTransaction

func (b *EthereumRPC) GetTransaction(txid string) (*bchain.Tx, error)

GetTransaction returns a transaction by the transaction ID.

func (*EthereumRPC) GetTransactionForMempool

func (b *EthereumRPC) GetTransactionForMempool(txid string) (*bchain.Tx, error)

GetTransactionForMempool returns a transaction by the transaction ID. It could be optimized for mempool, i.e. without block time and confirmations

func (*EthereumRPC) GetTransactionSpecific added in v0.1.1

func (b *EthereumRPC) GetTransactionSpecific(txid string) (json.RawMessage, error)

GetTransactionSpecific returns json as returned by backend, with all coin specific data

func (*EthereumRPC) Initialize

func (b *EthereumRPC) Initialize() error

Initialize initializes ethereum rpc interface

func (*EthereumRPC) IsTestnet

func (b *EthereumRPC) IsTestnet() bool

func (*EthereumRPC) ResyncMempool

func (b *EthereumRPC) ResyncMempool(onNewTxAddr bchain.OnNewTxAddrFunc) (int, error)

func (*EthereumRPC) SendRawTransaction

func (b *EthereumRPC) SendRawTransaction(hex string) (string, error)

SendRawTransaction sends raw transaction.

func (*EthereumRPC) Shutdown

func (b *EthereumRPC) Shutdown(ctx context.Context) error

Shutdown cleans up rpc interface to ethereum

type ProtoTransaction

type ProtoTransaction struct {
	AccountNonce     uint64 `protobuf:"varint,1,opt,name=AccountNonce" json:"AccountNonce,omitempty"`
	Price            []byte `protobuf:"bytes,2,opt,name=Price,proto3" json:"Price,omitempty"`
	GasLimit         uint64 `protobuf:"varint,3,opt,name=GasLimit" json:"GasLimit,omitempty"`
	Value            []byte `protobuf:"bytes,4,opt,name=Value,proto3" json:"Value,omitempty"`
	Payload          []byte `protobuf:"bytes,5,opt,name=Payload,proto3" json:"Payload,omitempty"`
	Hash             []byte `protobuf:"bytes,6,opt,name=Hash,proto3" json:"Hash,omitempty"`
	BlockNumber      uint32 `protobuf:"varint,7,opt,name=BlockNumber" json:"BlockNumber,omitempty"`
	BlockTime        uint64 `protobuf:"varint,8,opt,name=BlockTime" json:"BlockTime,omitempty"`
	To               []byte `protobuf:"bytes,9,opt,name=To,proto3" json:"To,omitempty"`
	From             []byte `protobuf:"bytes,10,opt,name=From,proto3" json:"From,omitempty"`
	TransactionIndex uint32 `protobuf:"varint,11,opt,name=TransactionIndex" json:"TransactionIndex,omitempty"`
	V                []byte `protobuf:"bytes,12,opt,name=V,proto3" json:"V,omitempty"`
	R                []byte `protobuf:"bytes,13,opt,name=R,proto3" json:"R,omitempty"`
	S                []byte `protobuf:"bytes,14,opt,name=S,proto3" json:"S,omitempty"`
}

func (*ProtoTransaction) Descriptor

func (*ProtoTransaction) Descriptor() ([]byte, []int)

func (*ProtoTransaction) GetAccountNonce

func (m *ProtoTransaction) GetAccountNonce() uint64

func (*ProtoTransaction) GetBlockNumber

func (m *ProtoTransaction) GetBlockNumber() uint32

func (*ProtoTransaction) GetBlockTime

func (m *ProtoTransaction) GetBlockTime() uint64

func (*ProtoTransaction) GetFrom

func (m *ProtoTransaction) GetFrom() []byte

func (*ProtoTransaction) GetGasLimit

func (m *ProtoTransaction) GetGasLimit() uint64

func (*ProtoTransaction) GetHash

func (m *ProtoTransaction) GetHash() []byte

func (*ProtoTransaction) GetPayload

func (m *ProtoTransaction) GetPayload() []byte

func (*ProtoTransaction) GetPrice

func (m *ProtoTransaction) GetPrice() []byte

func (*ProtoTransaction) GetR

func (m *ProtoTransaction) GetR() []byte

func (*ProtoTransaction) GetS

func (m *ProtoTransaction) GetS() []byte

func (*ProtoTransaction) GetTo

func (m *ProtoTransaction) GetTo() []byte

func (*ProtoTransaction) GetTransactionIndex

func (m *ProtoTransaction) GetTransactionIndex() uint32

func (*ProtoTransaction) GetV

func (m *ProtoTransaction) GetV() []byte

func (*ProtoTransaction) GetValue

func (m *ProtoTransaction) GetValue() []byte

func (*ProtoTransaction) ProtoMessage

func (*ProtoTransaction) ProtoMessage()

func (*ProtoTransaction) Reset

func (m *ProtoTransaction) Reset()

func (*ProtoTransaction) String

func (m *ProtoTransaction) String() string

Jump to

Keyboard shortcuts

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