Get the URL for this Mockthereum node. You can pass this directly to libraries like Web3 as your Ethereum RPC endpoint to intercept all Web3 Ethereum interactions.
Mock all wallet balance queries, either for all addresses (by default) or for one specific wallet address, if specified.
This returns a rule builder that you can use to configure the rule. Call a
thenX()
method and wait for the returned promise to complete the rule and
activate it.
Optional
address: `0x${string}`Mock all block number queries.
This returns a rule builder that you can use to configure the rule. Call a
thenX()
method and wait for the returned promise to complete the rule and
activate it.
Mock all contract calls, either for all contracts (by default) or for one specific contract address, if specified.
This returns a rule builder that you can use to configure the rule. Call a
thenX()
method and wait for the returned promise to complete the rule and
activate it.
Optional
address: `0x${string}`Mock all gas price queries.
This returns a rule builder that you can use to configure the rule. Call a
thenX()
method and wait for the returned promise to complete the rule and
activate it.
Mock all sent transactions.
This returns a rule builder that you can use to configure the rule. Call a
thenX()
method and wait for the returned promise to complete the rule and
activate it.
Mock all transactions sent to a specific address.
This returns a rule builder that you can use to configure the rule. Call a
thenX()
method and wait for the returned promise to complete the rule and
activate it.
Query the list of requests seen by this node for a specific method.
This returns a promise, resolving to an array of objects containing method
(the Ethereum
method called), parameters
(the method parameters) and rawRequest
(the full raw HTTP
request data).
Query the list of requests seen by this node. This returns a promise, resolving
to an array of objects containing method
(the Ethereum method called),
parameters
(the method parameters) and rawRequest
(the full raw HTTP request data).
The node must be started before use. Starting the node resets it, removing any rules that may have been added previously and configuring default behaviours for unmatched requests.
This method returns a promise, which you should wait for to ensure the node is fully started before using it.
Generated using TypeDoc
A Mockthereum node provides default behaviours and allows defining custom behaviour rules to simulate interactions with the Ethereum network without requiring a full node, access to the real Ethereum network, or real transactions with the delays and costs that might involve.
This should not be created directly: instead, call then
getLocal()
orgetRemote()
methods exported from this module.Once you have a Mockthereum node, you can start defining rules using any of the
forX()
methods. Each method returns a rule builder, allowing you to add extra matching constraints, followed by athenX()
final method which enables the rule, returning a promise that resolves once the rule is constructed and active.