@ethereum-waffle/provider
Version:
A mock provider for your blockchain testing needs.
23 lines • 1.29 kB
TypeScript
import { providers } from 'ethers';
import { Provider } from 'ganache';
/**
* Decodes a revert string from a failed call/query that reverts on chain.
* @param callRevertError The error catched from performing a reverting call (query)
*/
export declare const decodeRevertString: (callRevertError: any) => string;
export declare const appendRevertString: (etherProvider: providers.Web3Provider, receipt: any) => Promise<void>;
/**
* Ethers executes a gas estimation before sending the transaction to the blockchain.
* This poses a problem for Waffle - we cannot track sent transactions which eventually revert.
* This is a common use case for testing, but such transaction never gets sent.
* A failed gas estimation prevents it from being sent.
*
* In test environment, we replace the gas estimation with an always-succeeding method.
* If a transaction is meant to be reverted, it will do so after it is actually send and mined.
*
* Additionally, we patch the method for getting transaction receipt.
* Ethers does not provide the error code in the receipt that we can use to
* read a revert string, so we patch it and include it using a query to the blockchain.
*/
export declare const injectRevertString: (provider: Provider) => Provider;
//# sourceMappingURL=revertString.d.ts.map