ethereum

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EthBlockByNumber

func EthBlockByNumber(clientId Client, size uint32, bufPtr *byte, blockIdPtr *uint64) (error errno.Error)

func EthBlockNumberFromId

func EthBlockNumberFromId(clientId Client, blockIdPtr *uint64, bufPtr *byte) (error errno.Error)

func EthBlockNumberFromIdSize

func EthBlockNumberFromIdSize(clientId Client, blockIdPtr *uint64, lenPtr *uint32) (error errno.Error)

func EthCallContract

func EthCallContract(clientId Client, contractId uint32, method string, outputPtr *byte) (error errno.Error)

func EthCallContractSize

func EthCallContractSize(clientId Client, contractId uint32, method string, inputsPtr *byte, inputsSize uint32, outputSizePtr *uint32) (error errno.Error)

func EthCurrentBlockNumber

func EthCurrentBlockNumber(clientId Client, blockNumberPtr *uint64) (error errno.Error)

func EthCurrentChainId

func EthCurrentChainId(clientId Client, bufPtr *byte) (error errno.Error)

func EthCurrentChainIdSize

func EthCurrentChainIdSize(clientId Client, sizePtr *uint32) (error errno.Error)

func EthGetContractMethod

func EthGetContractMethod(clientId Client, contractId uint32, method string, inputPtr *byte, outputPtr *byte) (error errno.Error)

func EthGetContractMethodSize

func EthGetContractMethodSize(clientId Client, contractId uint32, method string, inputSizePtr *uint32, outputSizePtr *uint32) (error errno.Error)

func EthGetTransactionFromBlockByHash

func EthGetTransactionFromBlockByHash(clientId Client, blockIdPtr *uint64, idPtr *uint32, hashPtr *byte) (error errno.Error)

func EthGetTransactionMethodBytes

func EthGetTransactionMethodBytes(clientId Client, blockIdPtr *uint64, contractId uint32, transactionId uint32, method string, bufPtr *byte) (error errno.Error)

func EthGetTransactionMethodSize

func EthGetTransactionMethodSize(clientId Client, blockIdPtr *uint64, contractId uint32, transactionId uint32, method string, sizePtr *uint32) (error errno.Error)

func EthGetTransactionMethodUint64

func EthGetTransactionMethodUint64(clientId Client, blockIdPtr *uint64, contractId uint32, transactionId uint32, method string, numPtr *uint64) (error errno.Error)

func EthGetTransactionsFromBlock

func EthGetTransactionsFromBlock(clientId Client, blockIdPtr *uint64, bufPtr *byte) (error errno.Error)

func EthGetTransactionsFromBlockSize

func EthGetTransactionsFromBlockSize(clientId Client, blockIdPtr *uint64, sizePtr *uint32) (error errno.Error)

func EthNew

func EthNew(clientIdPtr *Client, url string) (error errno.Error)

func EthNewContract

func EthNewContract(clientId Client, contractId uint32, methodsPtr *byte) (error errno.Error)

func EthNewContractSize

func EthNewContractSize(clientId Client, abiPtr *byte, abiSize uint32, address string, methodsSizePtr *uint32, contractPtr *uint32) (error errno.Error)

func EthNonceFromPrivateKey

func EthNonceFromPrivateKey(clientId Client, hexKey string, blockNumberLen uint32, blockNumberPtr *byte, noncePtr *uint64) (error errno.Error)

func EthSendTransaction

func EthSendTransaction(clientId Client, blockIdPtr *uint64, contractId uint32, transactionId uint32) (error errno.Error)

func EthTransactContract

func EthTransactContract(clientId Client, contractId uint32, chainIdPtr *byte, chainIdSize uint32, method string, privKey string, inputPtr *byte, inputSize uint32, transactionIdPtr *uint32) (error errno.Error)

func EthTransactionRawSignatures

func EthTransactionRawSignatures(clientId Client, blockIdPtr *uint64, contractId uint32, transactionId uint32, vSigBufPtr *byte, rSigBufPtr *byte, sSigBufPtr *byte) (error errno.Error)

func EthTransactionRawSignaturesSize

func EthTransactionRawSignaturesSize(clientId Client, blockIdPtr *uint64, contractId uint32, transactionId uint32, vSigSizePtr *uint32, rSigSizePtr *uint32, sSigSizePtr *uint32) (error errno.Error)

Types

type Block

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

Block defines wrappers for a block retrieved by the client.

func (*Block) NonceFromPrivateKey

func (b *Block) NonceFromPrivateKey(hexKey string) (uint64, error)

NonceFromPrivateKey returns the account nonce of the account given from the secp256k1 hexkey. The block number can be nil, in which case the nonce is taken from the latest known block.

func (*Block) Number

func (b *Block) Number() (*big.Int, error)

Number returns the uint64 value of the block number

func (*Block) Transaction

func (b *Block) Transaction(hash []byte) (*Transaction, error)

Transaction returns transaction from block with the given transaction hash.

Transaction hash is 32 bytes, if inputted hash is longer than 32 bytes hash will be trimmed.

func (*Block) Transactions

func (b *Block) Transactions() ([]*Transaction, error)

Transactions returns all transactions from the given block.

type Client

type Client uint32

Client defines typed wrappers for the Ethereum RPC API.

func New

func New(url string) (Client, error)

New connects a client to the given rpc URL.

func (Client) BlockByNumber

func (c Client) BlockByNumber(blockNumber *big.Int) (*Block, error)

BlockByNumber returns a block from the current canonical chain. If number is nil, the latest known block is returned.

func (Client) CurrentBlockNumber

func (c Client) CurrentBlockNumber() (number uint64, err error)

CurrentBlockNumber returns the most recent block number.

func (Client) CurrentChainId

func (c Client) CurrentChainId() (*big.Int, error)

CurrentChainID retrieves the current chain ID for transaction replay protection.

func (Client) NewBoundContract

func (c Client) NewBoundContract(abi io.Reader, address string) (*Contract, error)

NewBoundContract creates a low level contract interface through which calls and transactions may be made through.

type Contract

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

Contract defines typed wrappers for a contract with given abi.

func (*Contract) Method

func (c *Contract) Method(name string) (*ContractMethod, error)

Method returns the contract method with the corresponding inputted name.

func (*Contract) Methods

func (c *Contract) Methods() []*ContractMethod

Methods lists the available methods for within the given contract

type ContractMethod

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

func (*ContractMethod) Call

func (c *ContractMethod) Call(inputParameters ...interface{}) ([]interface{}, error)

Call invokes the (constant) contract method with params as input values

func (*ContractMethod) Name

func (c *ContractMethod) Name() string

func (*ContractMethod) Transact

func (c *ContractMethod) Transact(chainId *big.Int, privateKey string, inputParameters ...interface{}) (*Transaction, error)

Transact invokes the (paid) contract method with params as input values.

type Transaction

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

Transaction defines wrappers for a transaction retrieved by the client.

func (*Transaction) Chain

func (t *Transaction) Chain() (*big.Int, error)

Chain returns the EIP155 chain ID of the transaction. The return value will always be non-nil. For legacy transactions which are not replay-protected, the return value is zero.

func (*Transaction) Data

func (t *Transaction) Data() ([]byte, error)

Data returns the input data of the transaction.

func (*Transaction) Gas

func (t *Transaction) Gas() (uint64, error)

Gas returns the gas limit of the transaction.

func (*Transaction) GasFeeCap

func (t *Transaction) GasFeeCap() (*big.Int, error)

GasFeeCap returns the fee cap per gas of the transaction.

func (*Transaction) GasPrice

func (t *Transaction) GasPrice() (*big.Int, error)

GasPrice returns the gas price of the transaction

func (*Transaction) GasTipCap

func (t *Transaction) GasTipCap() (*big.Int, error)

GasTipCap returns the gasTipCap per gas of the transaction.

func (*Transaction) Hash

func (t *Transaction) Hash() ([]byte, error)

Hash returns the transaction hash.

func (*Transaction) Nonce

func (t *Transaction) Nonce() (uint64, error)

Nonce returns the sender account nonce of the transaction.

func (*Transaction) RawSignatures

func (t *Transaction) RawSignatures() (rawSignatures, error)

RawSignatureValues returns the V, R, S signature values of the transaction. The return values should not be modified by the caller.

func (*Transaction) Send

func (t *Transaction) Send() (err error)

SendTransaction injects a signed transaction into the pending pool for execution.

func (*Transaction) ToAddress

func (t *Transaction) ToAddress() ([]byte, error)

ToAddress returns the recipient address of the transaction.

func (*Transaction) Value

func (t *Transaction) Value() (*big.Int, error)

Value returns the ether amount of the transaction.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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