{"modulePath":"github.com/Evolution404/simcore","version":"v1.0.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package ethereum\n\nPackage ethereum defines interfaces for interacting with Ethereum.\n\n## Variables\n\n```go\nvar NotFound = errors.New(\"not found\")\n```\nNotFound is returned by API methods if the requested item does not exist.\n\n## Types\n\n```go\ntype CallMsg struct {\n\tFrom      common.Address  // the sender of the 'transaction'\n\tTo        *common.Address // the destination contract (nil for contract creation)\n\tGas       uint64          // if 0, the call executes with near-infinite gas\n\tGasPrice  *big.Int        // wei \u003c-\u003e gas exchange ratio\n\tGasFeeCap *big.Int        // EIP-1559 fee cap per gas.\n\tGasTipCap *big.Int        // EIP-1559 tip per gas.\n\tValue     *big.Int        // amount of wei sent along with the call\n\tData      []byte          // input data, usually an ABI-encoded contract method invocation\n\n\tAccessList types.AccessList // EIP-2930 access list.\n}\n```\nCallMsg contains parameters for contract calls.\n\n```go\ntype ChainReader interface {\n\tBlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)\n\tBlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)\n\tHeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)\n\tHeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)\n\tTransactionCount(ctx context.Context, blockHash common.Hash) (uint, error)\n\tTransactionInBlock(ctx context.Context, blockHash common.Hash, index uint) (*types.Transaction, error)\n\n\t// This method subscribes to notifications about changes of the head block of\n\t// the canonical chain.\n\tSubscribeNewHead(ctx context.Context, ch chan\u003c- *types.Header) (Subscription, error)\n}\n```\nChainReader provides access to the blockchain. The methods in this interface access raw data from either the canonical chain (when requesting by block number) or any blockchain fork that was previously downloaded and processed by the node. The block number argument can be nil to select the latest canonical block. Reading block headers should be preferred over full blocks whenever possible.\n\nThe returned error is NotFound if the requested item does not exist.\n\n```go\ntype ChainStateReader interface {\n\tBalanceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (*big.Int, error)\n\tStorageAt(ctx context.Context, account common.Address, key common.Hash, blockNumber *big.Int) ([]byte, error)\n\tCodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)\n\tNonceAt(ctx context.Context, account common.Address, blockNumber *big.Int) (uint64, error)\n}\n```\nChainStateReader wraps access to the state trie of the canonical blockchain. Note that implementations of the interface may be unable to return state values for old blocks. In many cases, using CallContract can be preferable to reading raw contract storage.\n\n```go\ntype ChainSyncReader interface {\n\tSyncProgress(ctx context.Context) (*SyncProgress, error)\n}\n```\nChainSyncReader wraps access to the node's current sync status. If there's no sync currently running, it returns nil.\n\n```go\ntype ContractCaller interface {\n\tCallContract(ctx context.Context, call CallMsg, blockNumber *big.Int) ([]byte, error)\n}\n```\nA ContractCaller provides contract calls, essentially transactions that are executed by the EVM but not mined into the blockchain. ContractCall is a low-level method to execute such calls. For applications which are structured around specific contracts, the abigen tool provides a nicer, properly typed way to perform calls.\n\n```go\ntype FilterQuery struct {\n\tBlockHash *common.Hash     // used by eth_getLogs, return logs only from block with this hash\n\tFromBlock *big.Int         // beginning of the queried range, nil means genesis block\n\tToBlock   *big.Int         // end of the range, nil means latest block\n\tAddresses []common.Address // restricts matches to events created by specific contracts\n\n\t// The Topic list restricts matches to particular event topics. Each event has a list\n\t// of topics. Topics matches a prefix of that list. An empty element slice matches any\n\t// topic. Non-empty elements represent an alternative that matches any of the\n\t// contained topics.\n\t//\n\t// Examples:\n\t// {} or nil          matches any topic list\n\t// {{A}}              matches topic A in first position\n\t// {{}, {B}}          matches any topic in first position AND B in second position\n\t// {{A}, {B}}         matches topic A in first position AND B in second position\n\t// {{A, B}, {C, D}}   matches topic (A OR B) in first position AND (C OR D) in second position\n\tTopics [][]common.Hash\n}\n```\nFilterQuery contains options for contract log filtering.\n\n```go\ntype GasEstimator interface {\n\tEstimateGas(ctx context.Context, call CallMsg) (uint64, error)\n}\n```\nGasEstimator wraps EstimateGas, which tries to estimate the gas needed to execute a specific transaction based on the pending state. There is no guarantee that this is the true gas limit requirement as other transactions may be added or removed by miners, but it should provide a basis for setting a reasonable default.\n\n```go\ntype GasPricer interface {\n\tSuggestGasPrice(ctx context.Context) (*big.Int, error)\n}\n```\nGasPricer wraps the gas price oracle, which monitors the blockchain to determine the optimal gas price given current fee market conditions.\n\n```go\ntype LogFilterer interface {\n\tFilterLogs(ctx context.Context, q FilterQuery) ([]types.Log, error)\n\tSubscribeFilterLogs(ctx context.Context, q FilterQuery, ch chan\u003c- types.Log) (Subscription, error)\n}\n```\nLogFilterer provides access to contract log events using a one-off query or continuous event subscription.\n\nLogs received through a streaming query subscription may have Removed set to true, indicating that the log was reverted due to a chain reorganisation.\n\n```go\ntype PendingContractCaller interface {\n\tPendingCallContract(ctx context.Context, call CallMsg) ([]byte, error)\n}\n```\nPendingContractCaller can be used to perform calls against the pending state.\n\n```go\ntype PendingStateEventer interface {\n\tSubscribePendingTransactions(ctx context.Context, ch chan\u003c- *types.Transaction) (Subscription, error)\n}\n```\nA PendingStateEventer provides access to real time notifications about changes to the pending state.\n\n```go\ntype PendingStateReader interface {\n\tPendingBalanceAt(ctx context.Context, account common.Address) (*big.Int, error)\n\tPendingStorageAt(ctx context.Context, account common.Address, key common.Hash) ([]byte, error)\n\tPendingCodeAt(ctx context.Context, account common.Address) ([]byte, error)\n\tPendingNonceAt(ctx context.Context, account common.Address) (uint64, error)\n\tPendingTransactionCount(ctx context.Context) (uint, error)\n}\n```\nA PendingStateReader provides access to the pending state, which is the result of all known executable transactions which have not yet been included in the blockchain. It is commonly used to display the result of ’unconfirmed’ actions (e.g. wallet value transfers) initiated by the user. The PendingNonceAt operation is a good way to retrieve the next available transaction nonce for a specific account.\n\n```go\ntype Subscription interface {\n\t// Unsubscribe cancels the sending of events to the data channel\n\t// and closes the error channel.\n\tUnsubscribe()\n\t// Err returns the subscription error channel. The error channel receives\n\t// a value if there is an issue with the subscription (e.g. the network connection\n\t// delivering the events has been closed). Only one value will ever be sent.\n\t// The error channel is closed by Unsubscribe.\n\tErr() \u003c-chan error\n}\n```\nSubscription represents an event subscription where events are delivered on a data channel.\n\n```go\ntype SyncProgress struct {\n\tStartingBlock uint64 // Block number where sync began\n\tCurrentBlock  uint64 // Current block number where sync is at\n\tHighestBlock  uint64 // Highest alleged block number in the chain\n\n\t// Fields belonging to snap sync\n\tSyncedAccounts      uint64 // Number of accounts downloaded\n\tSyncedAccountBytes  uint64 // Number of account trie bytes persisted to disk\n\tSyncedBytecodes     uint64 // Number of bytecodes downloaded\n\tSyncedBytecodeBytes uint64 // Number of bytecode bytes downloaded\n\tSyncedStorage       uint64 // Number of storage slots downloaded\n\tSyncedStorageBytes  uint64 // Number of storage trie bytes persisted to disk\n\n\tHealedTrienodes     uint64 // Number of state trie nodes downloaded\n\tHealedTrienodeBytes uint64 // Number of state trie bytes persisted to disk\n\tHealedBytecodes     uint64 // Number of bytecodes downloaded\n\tHealedBytecodeBytes uint64 // Number of bytecodes persisted to disk\n\n\tHealingTrienodes uint64 // Number of state trie nodes pending\n\tHealingBytecode  uint64 // Number of bytecodes pending\n}\n```\nSyncProgress gives progress indications when the node is synchronising with the Ethereum network.\n\n```go\ntype TransactionReader interface {\n\t// TransactionByHash checks the pool of pending transactions in addition to the\n\t// blockchain. The isPending return value indicates whether the transaction has been\n\t// mined yet. Note that the transaction may not be part of the canonical chain even if\n\t// it's not pending.\n\tTransactionByHash(ctx context.Context, txHash common.Hash) (tx *types.Transaction, isPending bool, err error)\n\t// TransactionReceipt returns the receipt of a mined transaction. Note that the\n\t// transaction may not be included in the current canonical chain even if a receipt\n\t// exists.\n\tTransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)\n}\n```\nTransactionReader provides access to past transactions and their receipts. Implementations may impose arbitrary restrictions on the transactions and receipts that can be retrieved. Historic transactions may not be available.\n\nAvoid relying on this interface if possible. Contract logs (through the LogFilterer interface) are more reliable and usually safer in the presence of chain reorganisations.\n\nThe returned error is NotFound if the requested item does not exist.\n\n```go\ntype TransactionSender interface {\n\tSendTransaction(ctx context.Context, tx *types.Transaction) error\n}\n```\nTransactionSender wraps transaction sending. The SendTransaction method injects a signed transaction into the pending transaction pool for execution. If the transaction was a contract creation, the TransactionReceipt method can be used to retrieve the contract address after the transaction has been mined.\n\nThe transaction must be signed and have a valid nonce to be included. Consumers of the API can use package accounts to maintain local private keys and need can retrieve the next available nonce using PendingNonceAt.\n\n","path":"github.com/Evolution404/simcore","name":"ethereum","synopsis":"Package ethereum defines interfaces for interacting with Ethereum.","isRedistributable":true}
