Home > eth-connect > RequestManager
It's responsible for passing messages to providers It's also responsible for polling the ethereum node for incoming messages Default poll timeout is 1 second
Signature:
export declare class RequestManager
Constructor | Modifiers | Description |
---|---|---|
(constructor)(provider) | Constructs a new instance of the RequestManager class |
Property | Modifiers | Type | Description |
---|---|---|---|
eth_accounts | () => Promise<Address[]> | Returns a list of addresses owned by client. | |
eth_blockNumber | () => Promise<Quantity> | Returns the number of most recent block. | |
eth_call | (options: TransactionCallOptions, block: BlockIdentifier) => Promise<Data> | Executes a new message call immediately without creating a transaction on the block chain. | |
eth_coinbase | () => Promise<Address> | Returns the client coinbase address. | |
eth_estimateGas | (data: Partial<TransactionCallOptions> & Partial<TransactionOptions>) => Promise<Quantity> | Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance. | |
eth_gasPrice | () => Promise<BigNumber> | Returns the current price per gas in wei. | |
eth_getBalance | (address: Address, block: BlockIdentifier) => Promise<BigNumber> | Returns the balance of the account of given address. | |
eth_getBlockByHash | (blockHash: TxHash, fullTransactionObjects: boolean) => Promise<BlockObject> | Returns information about a block by hash. | |
eth_getBlockByNumber | (block: BlockIdentifier, fullTransactionObjects: boolean) => Promise<BlockObject> | Returns information about a block by block number. | |
eth_getBlockTransactionCountByHash | (blockHash: TxHash) => Promise<number> | Returns the number of transactions in a block from a block matching the given block hash. | |
eth_getBlockTransactionCountByNumber | (block: BlockIdentifier) => Promise<number> | Returns the number of transactions in a block matching the given block number. | |
eth_getCode | (address: Address, block: BlockIdentifier) => Promise<Data> | Returns code at a given address. | |
eth_getFilterChanges | (filterId: Data) => Promise<Array<TxHash> | Array<LogObject>> | Polling method for a filter, which returns an array of logs which occurred since last poll. | |
eth_getFilterLogs | (filterId: Data) => Promise<Array<TxHash> | Array<LogObject>> | Returns an array of all logs matching filter with given id. | |
eth_getLogs | (options: FilterOptions) => Promise<Array<TxHash> | Array<LogObject>> | Returns an array of all logs matching a given filter object. | |
eth_getStorageAt | (address: Address, position: Quantity, block: BlockIdentifier) => Promise<Data> | Returns the value from a storage position at a given address. | |
eth_getTransactionByBlockHashAndIndex | (blockHash: TxHash, txIndex: Quantity) => Promise<TransactionObject> | Returns information about a transaction by block hash and transaction index position. | |
eth_getTransactionByBlockNumberAndIndex | (block: BlockIdentifier, txIndex: Quantity) => Promise<TransactionObject> | Returns information about a transaction by block number and transaction index position. | |
eth_getTransactionByHash | (hash: TxHash) => Promise<TransactionObject> | Returns the information about a transaction requested by transaction hash. | |
eth_getTransactionCount | (address: Address, block: BlockIdentifier) => Promise<number> | Returns the number of transactions sent from an address. | |
eth_getTransactionReceipt | (hash: TxHash) => Promise<TransactionReceipt> | Returns the receipt of a transaction by transaction hash. Note That the receipt is not available for pending transactions. | |
eth_getUncleByBlockHashAndIndex | (blockHash: TxHash, index: Quantity) => Promise<BlockObject> | Returns information about a uncle of a block by hash and uncle index position. | |
eth_getUncleByBlockNumberAndIndex | (block: BlockIdentifier, index: Quantity) => Promise<BlockObject> | Returns information about a uncle of a block by number and uncle index position. | |
eth_getUncleCountByBlockHash | (blockHash: TxHash) => Promise<number> | Returns the number of uncles in a block from a block matching the given block hash. | |
eth_getUncleCountByBlockNumber | (block: BlockIdentifier) => Promise<number> | Returns the number of uncles in a block from a block matching the given block number. | |
eth_hashrate | () => Promise<Quantity> | Returns the number of hashes per second that the node is mining with. | |
eth_mining | () => Promise<boolean> | Returns true if client is actively mining new blocks. | |
eth_newBlockFilter | () => Promise<Data> | Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges. | |
eth_newFilter | (options: FilterOptions) => Promise<Data> | Creates a filter object, based on filter options, to notify when the state changes (logs). To check if the state has changed, call eth_getFilterChanges. A note on specifying topic filters: Topics are order-dependent. A transaction with a log with topics [A, B] will be matched by the following topic filters: [] "anything" [A] "A in first position (and anything after)" [null, B] "anything in first position AND B in second position (and anything after)" [A, B] "A in first position AND B in second position (and anything after)" [[A, B], [A, B]] "(A OR B) in first position AND (A OR B) in second position (and anything after)" |
|
eth_newPendingTransactionFilter | () => Promise<Data> | Creates a filter in the node, to notify when new pending transactions arrive. To check if the state has changed, call eth_getFilterChanges. | |
eth_protocolVersion | () => Promise<number> | Returns the current ethereum protocol version. | |
eth_sendRawTransaction | (rawTransaction: Data) => Promise<TxHash> | Creates new message call transaction or a contract creation for signed transactions. | |
eth_sendTransaction | (options: TransactionOptions) => Promise<TxHash> | Creates new message call transaction or a contract creation, if the data field contains code. | |
eth_sign | (address: Address, message: Data) => Promise<Data> | The sign method calculates an Ethereum specific signature with: sign(keccak256("Ethereum Signed Message:" + len(message) + message))). By adding a prefix to the message makes the calculated signature recognisable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim. Note the address to sign with must be unlocked. |
|
eth_submitHashrate | (hashRate: Data, id: Data) => Promise<boolean> | Used for submitting mining hashrate. | |
eth_submitWork | (data: Data, powHash: TxHash, digest: TxHash) => Promise<boolean> | Used for submitting a proof-of-work solution. | |
eth_syncing | () => Promise<false | Syncing> | Returns an object with data about the sync status or false. | |
eth_uninstallFilter | (filterId: Data) => Promise<boolean> | Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additonally Filters timeout when they aren't requested with eth_getFilterChanges for a period of time. | |
net_listening | () => Promise<boolean> | Returns true if client is actively listening for network connections. | |
net_peerCount | () => Promise<Quantity> | Returns number of peers currently connected to the client. | |
net_version | () => Promise<string> | Returns the current network id. | |
personal_ecRecover | (message: Data, signature: Data) => Promise<Address> | ecRecover returns the address associated with the private key that was used to calculate the signature in personal_sign. | |
personal_importRawKey | (keydata: Data, passPhrase: Data) => Promise<Address> | Imports the given unencrypted private key (hex string) into the key store, encrypting it with the passphrase. Returns the address of the new account. | |
personal_listAccounts | () => Promise<Array<Address>> | Returns all the Ethereum account addresses of all keys in the key store. | |
personal_lockAccount | (address: Address) => Promise<boolean> | Removes the private key with given address from memory. The account can no longer be used to send transactions. | |
personal_newAccount | (passPhrase: Data) => Promise<Address> | Generates a new private key and stores it in the key store directory. The key file is encrypted with the given passphrase. Returns the address of the new account. At the geth console, newAccount will prompt for a passphrase when it is not supplied as the argument. |
|
personal_sendTransaction | (txObject: TransactionOptions, passPhrase: Data) => Promise<TxHash> | Imports the given unencrypted private key (hex string) into the key store, encrypting it with the passphrase. Returns the address of the new account. | |
personal_sign | (data: Data, signerAddress: Address, passPhrase: Data) => Promise<Data> | The sign method calculates an Ethereum specific signature with: sign(keccack256("Ethereum Signed Message:" + len(message) + message))). By adding a prefix to the message makes the calculated signature recognisable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim. See ecRecover to verify the signature. |
|
personal_unlockAccount | (account: Address, passPhrase?: Data, seconds?: Quantity) => Promise<boolean> | Decrypts the key with the given address from the key store. Both passphrase and unlock duration are optional when using the JavaScript console. If the passphrase is not supplied as an argument, the console will prompt for the passphrase interactively. The unencrypted key will be held in memory until the unlock duration expires. If the unlock duration defaults to 300 seconds. An explicit duration of zero seconds unlocks the key until geth exits. The account can be used with eth_sign and eth_sendTransaction while it is unlocked. |
|
provider | any | ||
shh_addToGroup | (group: Data) => Promise<boolean> | ||
shh_getFilterChanges | (filterId: Data) => Promise<Array<SHHFilterMessage>> | Polling method for whisper filters. Returns new messages since the last call of this method. Note calling the shh_getMessages method, will reset the buffer for this method, so that you won't receive duplicate messages. |
|
shh_getMessages | (filterId: Data) => Promise<Array<SHHFilterMessage>> | Get all messages matching a filter. Unlike shh_getFilterChanges this returns all messages. | |
shh_hasIdentity | (identity: Data) => Promise<boolean> | Checks if the client hold the private keys for a given identity. | |
shh_newFilter | (options: SHHFilterOptions) => Promise<Data> | Creates filter to notify, when client receives whisper message matching the filter options. | |
shh_newGroup | () => Promise<Data> | ||
shh_newIdentity | () => Promise<Data> | Creates new whisper identity in the client. | |
shh_post | (data: SHHPost) => Promise<boolean> | Sends a whisper message. | |
shh_uninstallFilter | (filterId: Data) => Promise<boolean> | Uninstalls a filter with given id. Should always be called when watch is no longer needed. Additonally Filters timeout when they aren't requested with shh_getFilterChanges for a period of time. | |
shh_version | () => Promise<string> | Returns the current whisper protocol version. | |
web3_clientVersion | () => Promise<string> | Returns the current client version. | |
web3_sha3 | (data: Data) => Promise<Data> | Returns Keccak-256 (not the standardized SHA3-256) of the given data. |
Method | Modifiers | Description |
---|---|---|
getConfirmedTransaction(txId) | Waits until the transaction finishes. Returns if it was successfull. Throws if the transaction fails or if it lacks any of the supplied events | |
getTransaction(txId) | Returns a transaction in any of the possible states. | |
getTransactionAndReceipt(txId) | Get the transaction status and receipt | |
isFailure(tx) | Expects the result of getTransactionRecepeit's geth command and returns true if the transaction failed. It'll also check for a failed status prop against TRANSACTION_STATUS | |
isPending(tx) | Expects the result of getTransaction's geth command and returns true if the transaction is still pending. It'll also check for a pending status prop against TRANSACTION_STATUS | |
isTxDropped(txId, _retryAttemps) | Wait retryAttemps * TRANSACTION_FETCH_DELAY for a transaction status to be in the mempool | |
sendAsync(data) | Should be used to asynchronously send request | |
setProvider(p) | Should be used to set provider of request manager | |
waitForCompletion(txId, retriesOnEmpty) | Wait until a transaction finishes by either being mined or failing |