Documentation ¶
Index ¶
- func BalanceAt(ctx context.Context, client *ethclient.Client, account common.Address, ...) (*big.Int, error)
- func BlockNumber(ctx context.Context, client *ethclient.Client) (string, error)
- func CodeAt(ctx context.Context, client *ethclient.Client, account common.Address, ...) ([]byte, error)
- func CreateRawTransaction(nonce uint64, toAddress common.Address, amount *big.Int, gasLimit uint64, ...) *types.Transaction
- func GetBalance(ctx context.Context, client *ethclient.Client, addr string) (*big.Int, error)
- func GetBlockByHash(ctx context.Context, client *ethclient.Client, hash common.Hash) (*types.Block, error)
- func GetBlockByNumber(ctx context.Context, client *ethclient.Client, blockNumber *big.Int) (*types.Block, error)
- func GetBlockTransactionCountByHash(ctx context.Context, client *ethclient.Client, blockHash common.Hash) (uint, error)
- func GetBlockTransactionCountByNumber(ctx context.Context, client *ethclient.Client) (uint, error)
- func GetBlocks(ctx context.Context, client *ethclient.Client, startBlockNumber *big.Int, ...) ([]*types.Block, error)
- func GetBlocksByMiner(ctx context.Context, client *ethclient.Client, miner string, ...) ([]*types.Block, error)
- func GetClient(addr string) (*ethclient.Client, error)
- func GetEthblocksClient2Details() (string, string, string)
- func GetEthblocksClientAddr() string
- func GetGethClient(addr string) (*gethclient.Client, error)
- func GetLogs(receipt *types.Receipt) []*types.Log
- func GetPendingBalanceAt(ctx context.Context, client *ethclient.Client, addr string) (*big.Int, error)
- func GetProof(ctx context.Context, gclient *gethclient.Client, account common.Address, ...) (*gethclient.AccountResult, error)
- func GetTopics(lg *types.Log) []common.Hash
- func GetTransactionByBlockHashAndIndex(ctx context.Context, client *ethclient.Client, hash common.Hash, index uint) (*types.Transaction, error)
- func GetTransactionByHash(ctx context.Context, client *ethclient.Client, hash common.Hash) (*types.Transaction, bool, error)
- func GetTransactionReceipt(ctx context.Context, client *ethclient.Client, txHash common.Hash) (*types.Receipt, error)
- func GetTransactions(block *types.Block) []*types.Transaction
- func GetTransactionsByAddress(ctx context.Context, client *ethclient.Client, frmaddr string, ...) ([]*types.Transaction, error)
- func GetUncleCountByBlockHash(ctx context.Context, client *ethclient.Client, hash common.Hash) (int, error)
- func GetUncleCountByBlockNumber(ctx context.Context, client *ethclient.Client, blockNumber *big.Int) (int, error)
- func GetUncles(block *types.Block) []*types.Header
- func NonceAt(ctx context.Context, client *ethclient.Client, account common.Address, ...) (uint64, error)
- func PrintBlock(block *types.Block)
- func PrintBlockHeader(header *types.Header)
- func PrintBlockTransactions(blocktransactions []*types.Transaction)
- func PrintBlockUncle(uncle *types.Header)
- func PrintBlockUncles(uncles []*types.Header)
- func PrintReceipt(receipt *types.Receipt)
- func PrintReceiptLog(lg *types.Log)
- func PrintTopic(s common.Hash)
- func PrintTransaction(tx *types.Transaction)
- func SendRawTransaction(ctx context.Context, client *ethclient.Client, tx *types.Transaction, ...) error
- func SendTransaction1(client *ethclient.Client, fromAddr common.Address, toAddress *common.Address, ...) error
- func SendTransaction2(client *ethclient.Client, nonce uint64, toAddress *common.Address, ...) error
- func StorageAt(ctx context.Context, client *ethclient.Client, account common.Address, ...) ([]byte, error)
- func SubscribeFullPendingTransactions(ctx context.Context, client *ethclient.Client, gclient *gethclient.Client, ...) error
- func SubscribePendingTransactions(ctx context.Context, client *ethclient.Client, gclient *gethclient.Client, ...) error
- func TransactionInBlock(ctx context.Context, client *ethclient.Client, blockHash common.Hash, ...) (*types.Transaction, error)
- type Block
- type BlockService
- func (b *BlockService) AddBlock(ctx context.Context, client *ethclient.Client, block *types.Block) (*Block, error)
- func (b *BlockService) CreateBlockTransaction(ctx context.Context, client *ethclient.Client, tx *sql.Tx, blk *Block, ...) error
- func (b *BlockService) GetBlock(ctx context.Context, id uint) (*Block, error)
- type BlockServiceIntf
- type BlockUncle
- type BlockUncleIntf
- type BlockUncleService
- type Transaction
- type TransactionIntf
- type TransactionLog
- type TransactionLogIntf
- type TransactionLogService
- type TransactionLogTopic
- type TransactionLogTopicIntf
- type TransactionLogTopicService
- type TransactionReceipt
- type TransactionReceiptIntf
- type TransactionReceiptService
- type TransactionService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BalanceAt ¶
func BalanceAt(ctx context.Context, client *ethclient.Client, account common.Address, blockNumber *big.Int) (*big.Int, error)
BalanceAt - returns the wei balance of the given account.
func BlockNumber ¶
BlockNumber - returns the number of most recent block https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_blocknumber
func CodeAt ¶
func CodeAt(ctx context.Context, client *ethclient.Client, account common.Address, blockNumber *big.Int) ([]byte, error)
CodeAt - returns the contract code of the given account.
func CreateRawTransaction ¶
func CreateRawTransaction(nonce uint64, toAddress common.Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte) *types.Transaction
CreateRawTransaction - Create Raw Transaction
func GetBalance ¶
GetBalance - returns the wei balance of the given account.
func GetBlockByHash ¶
func GetBlockByHash(ctx context.Context, client *ethclient.Client, hash common.Hash) (*types.Block, error)
GetBlockByHash - Returns information about a block by hash https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblockbyhash
func GetBlockByNumber ¶
func GetBlockByNumber(ctx context.Context, client *ethclient.Client, blockNumber *big.Int) (*types.Block, error)
GetBlockByNumber - Get block by block number https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber
func GetBlockTransactionCountByHash ¶
func GetBlockTransactionCountByHash(ctx context.Context, client *ethclient.Client, blockHash common.Hash) (uint, error)
GetBlockTransactionCountByHash - Returns the number of transactions in a block from a block matching the given block hash. https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblocktransactioncountbyhash
func GetBlockTransactionCountByNumber ¶
GetBlockTransactionCountByNumber - returns the total number of transactions in the pending state. https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getblocktransactioncountbynumber
func GetBlocks ¶
func GetBlocks(ctx context.Context, client *ethclient.Client, startBlockNumber *big.Int, endBlockNumber *big.Int) ([]*types.Block, error)
GetBlocks - return blocks between start and end
func GetBlocksByMiner ¶
func GetBlocksByMiner(ctx context.Context, client *ethclient.Client, miner string, startBlockNumber *big.Int, endBlockNumber *big.Int) ([]*types.Block, error)
GetBlocksByMiner - Get blocks by miner
func GetEthblocksClient2Details ¶
GetEthblocksClient2Details - used to get address from sepolia.infura
func GetEthblocksClientAddr ¶
func GetEthblocksClientAddr() string
GetEthblocksClientAddr - used to get address from infura
func GetGethClient ¶
func GetGethClient(addr string) (*gethclient.Client, error)
GetGethClient - Get gethclient
func GetPendingBalanceAt ¶
func GetPendingBalanceAt(ctx context.Context, client *ethclient.Client, addr string) (*big.Int, error)
GetPendingBalanceAt - returns the wei balance of the given account in the pending state
func GetProof ¶
func GetProof(ctx context.Context, gclient *gethclient.Client, account common.Address, keys []string, blockNumber *big.Int) (*gethclient.AccountResult, error)
GetProof - returns the account and storage values of the specified account including the Merkle-proof
func GetTransactionByBlockHashAndIndex ¶
func GetTransactionByBlockHashAndIndex(ctx context.Context, client *ethclient.Client, hash common.Hash, index uint) (*types.Transaction, error)
GetTransactionByBlockHashAndIndex - Returns information about a transaction by block hash and transaction index position. https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionbyblockhashandindex
func GetTransactionByHash ¶
func GetTransactionByHash(ctx context.Context, client *ethclient.Client, hash common.Hash) (*types.Transaction, bool, error)
GetTransactionByHash - Returns the information about a transaction requested by transaction hash. https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionbyhash
func GetTransactionReceipt ¶
func GetTransactionReceipt(ctx context.Context, client *ethclient.Client, txHash common.Hash) (*types.Receipt, error)
GetTransactionReceipt - Returns the receipt of a transaction by transaction hash https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_gettransactionreceiptt
func GetTransactions ¶
func GetTransactions(block *types.Block) []*types.Transaction
GetTransactions - return the Transactions in this block
func GetTransactionsByAddress ¶
func GetTransactionsByAddress(ctx context.Context, client *ethclient.Client, frmaddr string, startBlockNumber *big.Int, endBlockNumber *big.Int) ([]*types.Transaction, error)
GetTransactionsByAddress - returns the transactions in a range of blocks
func GetUncleCountByBlockHash ¶
func GetUncleCountByBlockHash(ctx context.Context, client *ethclient.Client, hash common.Hash) (int, error)
GetUncleCountByBlockHash - Returns the number of uncles in a block from a block matching the given block number. https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getunclecountbyblocknumber
func GetUncleCountByBlockNumber ¶
func GetUncleCountByBlockNumber(ctx context.Context, client *ethclient.Client, blockNumber *big.Int) (int, error)
GetUncleCountByBlockNumber - Returns the number of uncles in a block from a block matching the given block number. https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getunclecountbyblocknumber
func NonceAt ¶
func NonceAt(ctx context.Context, client *ethclient.Client, account common.Address, blockNumber *big.Int) (uint64, error)
NonceAt - returns the account nonce of the given account
func PrintBlockHeader ¶
PrintBlockHeader - Print a single block Header
func PrintBlockTransactions ¶
func PrintBlockTransactions(blocktransactions []*types.Transaction)
PrintBlockTransactions Loop over the transactions and print each one
func PrintBlockUncle ¶
PrintBlockUncle - Print a single block Uncle
func PrintBlockUncles ¶
PrintBlockUncles - Loop over the uncles and print each one
func PrintTransaction ¶
func PrintTransaction(tx *types.Transaction)
PrintTransaction - Print Transaction
func SendRawTransaction ¶
func SendRawTransaction(ctx context.Context, client *ethclient.Client, tx *types.Transaction, prv *ecdsa.PrivateKey) error
SendRawTransaction - Send a signed Transaction https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_sendrawtransaction
func SendTransaction1 ¶
func SendTransaction1(client *ethclient.Client, fromAddr common.Address, toAddress *common.Address, privateKey *ecdsa.PrivateKey, value *big.Int, gas uint64, gasPrice *big.Int) error
SendTransaction1 -- create and send a transaction
func SendTransaction2 ¶
func SendTransaction2(client *ethclient.Client, nonce uint64, toAddress *common.Address, privateKey *ecdsa.PrivateKey, value *big.Int, gas uint64, gasPrice *big.Int) error
SendTransaction2 -- create and send a transaction
func StorageAt ¶
func StorageAt(ctx context.Context, client *ethclient.Client, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)
StorageAt - returns the value of key in the contract storage of the given account.
func SubscribeFullPendingTransactions ¶
func SubscribeFullPendingTransactions(ctx context.Context, client *ethclient.Client, gclient *gethclient.Client, nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, testKey *ecdsa.PrivateKey) error
SubscribeFullPendingTransactions - subscribe full pending transactions
func SubscribePendingTransactions ¶
func SubscribePendingTransactions(ctx context.Context, client *ethclient.Client, gclient *gethclient.Client, nonce uint64, to *common.Address, amount *big.Int, gasLimit uint64, gasPrice *big.Int, data []byte, testKey *ecdsa.PrivateKey) error
SubscribePendingTransactions - Subscribe to Transactions
Types ¶
type Block ¶
type Block struct { Id uint ParentHash string UncleHash string Coinbase string BlockRoot string TxHash string ReceiptHash string Bloom []byte Difficulty uint64 BlockNumber uint64 GasLimit uint64 GasUsed uint64 BlockTime uint64 Extra []byte MixDigest string BlockNonce uint64 BaseFee uint64 WithdrawalsHash string BlobGasUsed *uint64 ExcessBlobGas *uint64 ParentBeaconRoot string BlockHash string BlockSize uint64 ReceivedAt time.Time BlockUncles []*BlockUncle Transactions []*Transaction }
Block - Used for
type BlockService ¶
BlockService - For accessing block services
func NewBlockService ¶
func NewBlockService(db *sql.DB) *BlockService
NewBlockService - Create block service
func (*BlockService) AddBlock ¶
func (b *BlockService) AddBlock(ctx context.Context, client *ethclient.Client, block *types.Block) (*Block, error)
AddBlock - add a block to the db
type BlockServiceIntf ¶
type BlockServiceIntf interface { AddBlock(ctx context.Context, client *ethclient.Client, block *types.Block) (*Block, error) CreateBlockTransaction(ctx context.Context, client *ethclient.Client, tx *sql.Tx, blk *Block, block *types.Block) error GetBlock(ctx context.Context, id uint) (*Block, error) }
BlockServiceIntf - BlockIntf interface for BlockService
type BlockUncle ¶
type BlockUncle struct { Id uint ParentHash string UncleHash string Coinbase string BlockRoot string TxHash string ReceiptHash string Bloom []byte Difficulty uint64 BlockNumber uint64 GasLimit uint64 GasUsed uint64 BlockTime uint64 Extra []byte MixDigest string BlockNonce uint64 BaseFee uint64 WithdrawalsHash string BlobGasUsed *uint64 ExcessBlobGas *uint64 ParentBeaconRoot string BlockId uint }
BlockUncle - Used for
type BlockUncleIntf ¶
type BlockUncleIntf interface { AddBlockUncle(ctx context.Context, tx *sql.Tx, blkUncle *types.Header, blockId uint) (*BlockUncle, error) GetBlockUncles(ctx context.Context, blockId uint) ([]*BlockUncle, error) }
BlockUncleIntf - interface
type BlockUncleService ¶
BlockUncleService - For accessing Block Uncle services
func NewBlockUncleService ¶
func NewBlockUncleService(db *sql.DB) *BlockUncleService
NewBlockUncleService - Create Block Uncle service
func (*BlockUncleService) AddBlockUncle ¶
func (bu *BlockUncleService) AddBlockUncle(ctx context.Context, tx *sql.Tx, blkUncle *types.Header, blockId uint) (*BlockUncle, error)
AddBlockUncle - add a block uncle to the db
func (*BlockUncleService) GetBlockUncles ¶
func (bu *BlockUncleService) GetBlockUncles(ctx context.Context, blockId uint) ([]*BlockUncle, error)
GetBlockUncles - used for
type Transaction ¶
type Transaction struct { Id uint TxType uint8 ChainId uint64 TxData []byte Gas uint64 GasPrice uint64 GasTipCap uint64 GasFeeCap uint64 TxValue uint64 AccountNonce uint64 TxTo string TxV uint64 TxR uint64 TxS uint64 BlockNumber uint64 BlockHash string BlockId uint TransactionReceipts []*TransactionReceipt }
Transaction - Used for
type TransactionIntf ¶
type TransactionIntf interface { AddTransaction(ctx context.Context, tx *sql.Tx, ethTrans *types.Transaction, blockId uint, blockNumber uint64) (*Transaction, error) GetBlockTransactions(ctx context.Context, blockId uint) ([]*Transaction, error) }
TransactionIntf - interface
type TransactionLog ¶
type TransactionLog struct { Id uint Address string LogData []byte BlockNumber uint64 TxHash string TxIndex uint BlockHash string LogIndex uint Removed bool BlockId uint TransactionId uint TransactionReceiptId uint Topics []*TransactionLogTopic }
TransactionLog - Used for
type TransactionLogIntf ¶
type TransactionLogIntf interface { AddTransactionLog(ctx context.Context, tx *sql.Tx, ethLog *types.Log, blockId uint, transactionId uint, transactionReceiptId uint) (*TransactionLog, error) GetTransactionLogs(ctx context.Context, transactionReceiptId uint) ([]*TransactionLog, error) }
TransactionLogIntf - interface
type TransactionLogService ¶
TransactionLogService - For accessing Transaction Log services
func NewTransactionLogService ¶
func NewTransactionLogService(db *sql.DB) *TransactionLogService
NewTransactionLogService - Create Transaction Log service
func (*TransactionLogService) AddTransactionLog ¶
func (tl *TransactionLogService) AddTransactionLog(ctx context.Context, tx *sql.Tx, ethLog *types.Log, blockId uint, transactionId uint, transactionReceiptId uint) (*TransactionLog, error)
AddTransactionLog - add a transaction log to the db
func (*TransactionLogService) GetTransactionLogs ¶
func (tl *TransactionLogService) GetTransactionLogs(ctx context.Context, transactionReceiptId uint) ([]*TransactionLog, error)
GetTransactionLogs - used for getting logs by TransactionReceiptId
type TransactionLogTopic ¶
type TransactionLogTopic struct { Id uint Topic string BlockId uint TransactionId uint TransactionReceiptId uint TransactionLogId uint }
TransactionLogTopic - Used for
type TransactionLogTopicIntf ¶
type TransactionLogTopicIntf interface { AddTransactionLogTopic(ctx context.Context, tx *sql.Tx, s common.Hash, blockId uint, transactionId uint, transactionReceiptId uint, TransactionLogId uint) (*TransactionLogTopic, error) GetTransactionLogTopics(ctx context.Context, transactionLogId uint) ([]*TransactionLogTopic, error) }
TransactionLogTopicIntf interface
type TransactionLogTopicService ¶
TransactionLogTopicService - For accessing Transaction Log Topic services
func NewTransactionLogTopicService ¶
func NewTransactionLogTopicService(db *sql.DB) *TransactionLogTopicService
NewTransactionLogTopicService - Create Transaction Log Topic service
func (*TransactionLogTopicService) AddTransactionLogTopic ¶
func (t *TransactionLogTopicService) AddTransactionLogTopic(ctx context.Context, tx *sql.Tx, s common.Hash, blockId uint, transactionId uint, transactionReceiptId uint, transactionLogId uint) (*TransactionLogTopic, error)
AddTransactionLogTopic - add a transaction Topic to the db
func (*TransactionLogTopicService) GetTransactionLogTopics ¶
func (t *TransactionLogTopicService) GetTransactionLogTopics(ctx context.Context, transactionLogId uint) ([]*TransactionLogTopic, error)
GetTransactionLogTopics - used for getting topics by TransactionLogId
type TransactionReceipt ¶
type TransactionReceipt struct { Id uint ReceiptType uint8 PostState []byte TxStatus uint64 CumulativeGasUsed uint64 Bloom []byte TxHash string ContractAddress string GasUsed uint64 EffectiveGasPrice uint64 BlobGasUsed uint64 BlobGasPrice uint64 BlockHash string BlockNumber uint64 TransactionIndex uint BlockId uint TransactionId uint Logs []*TransactionLog }
TransactionReceipt - Used for
type TransactionReceiptIntf ¶
type TransactionReceiptIntf interface { AddTransactionReceipt(ctx context.Context, tx *sql.Tx, ethReceipt *types.Receipt, BlockId uint, BlockNumber uint64, BlockHash string, TransactionId uint) (*TransactionReceipt, error) GetTransactionReceipts(ctx context.Context, transactionId uint) ([]*TransactionReceipt, error) }
TransactionReceiptIntf interface
type TransactionReceiptService ¶
TransactionReceiptService - For accessing Transaction Receipt services
func NewTransactionReceiptService ¶
func NewTransactionReceiptService(db *sql.DB) *TransactionReceiptService
NewTransactionReceiptService - Create Transaction Receipt service
func (*TransactionReceiptService) AddTransactionReceipt ¶
func (t *TransactionReceiptService) AddTransactionReceipt(ctx context.Context, tx *sql.Tx, ethReceipt *types.Receipt, blockId uint, blockNumber uint64, blockHash string, transactionId uint) (*TransactionReceipt, error)
AddTransactionReceipt - add a transaction to the db
func (*TransactionReceiptService) GetTransactionReceipts ¶
func (t *TransactionReceiptService) GetTransactionReceipts(ctx context.Context, transactionId uint) ([]*TransactionReceipt, error)
GetTransactionReceipts - used for getting receipts by TransactionId
type TransactionService ¶
TransactionService - For accessing Transaction services
func NewTransactionService ¶
func NewTransactionService(db *sql.DB) *TransactionService
NewTransactionService - Create Transaction service
func (*TransactionService) AddTransaction ¶
func (t *TransactionService) AddTransaction(ctx context.Context, tx *sql.Tx, ethTransaction *types.Transaction, blockId uint, blockNumber uint64) (*Transaction, error)
AddTransaction - add a transaction to the db
func (*TransactionService) GetBlockTransactions ¶
func (t *TransactionService) GetBlockTransactions(ctx context.Context, blockId uint) ([]*Transaction, error)
GetBlockTransactions - used for