Releases: DePayFi/web3-mock
Releases · DePayFi/web3-mock
v2.0.0
Use api
to describe interface (set of methods) a contract at a certain address is implementing.
v1.1.0
Bump ethers.js dependency
v1.0.1
fix: move address
and abi
into call
namespace
v1.0.0
- refactors interface to be more blockchain agnostic and more intuitive
- introduces returning spies when
mock
is called in order to supporttoHaveBeenCalled
on mocks - introduces explicit helpers to
confirm
a mocked transaction and toincreaseBlock
in order to execute code that requires a certain amount of confirmations
v0.11.4
fix: throw correct error if transaction has not been mocked at all
v0.11.3
fix: stop shadowing configuration
variable.
v0.11.2
consider global
before window
in jest context
v0.11.1
Takes global
instead of window
automatically in jest environments.
v.0.11.0
Mock for specific providers
If you want to mock Web3 calls and transactions for other providers but the usual, implicit ones (like window.ethereum),
you can pass them explicitly to Web3Mock
:
let provider = new ethers.providers.JsonRpcProvider('https://example.com');
Web3Mock({
provider,
mocks: {
ethereum: {
calls: {
[contractAddress]: {
abi: abi,
getAmountsIn: {
[
["1000000000000000000", ["0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2","0xa0bed124a09ac2bd941b10349d8d224fe3c955eb"]]
]: ["773002376389189", "1000000000000000000"]
}
}
}
}
},
})
v0.10.1
Prevents shadowing of an internal variable called configuration
.