Skip to content

Releases: DePayFi/web3-mock

v2.0.0

29 Jun 06:10
8f94307
Compare
Choose a tag to compare

Use api to describe interface (set of methods) a contract at a certain address is implementing.

v1.1.0

28 Jun 13:28
588669e
Compare
Choose a tag to compare

Bump ethers.js dependency

v1.0.1

25 Jun 14:56
12765a3
Compare
Choose a tag to compare

fix: move address and abi into call namespace

v1.0.0

25 Jun 09:11
75103fe
Compare
Choose a tag to compare
  • refactors interface to be more blockchain agnostic and more intuitive
  • introduces returning spies when mock is called in order to support toHaveBeenCalled on mocks
  • introduces explicit helpers to confirm a mocked transaction and to increaseBlock in order to execute code that requires a certain amount of confirmations

v0.11.4

23 Jun 09:08
1d25471
Compare
Choose a tag to compare

fix: throw correct error if transaction has not been mocked at all

v0.11.3

23 Jun 08:22
2f58340
Compare
Choose a tag to compare

fix: stop shadowing configuration variable.

v0.11.2

17 Jun 10:57
b9bcf0f
Compare
Choose a tag to compare

consider global before window in jest context

v0.11.1

17 Jun 10:52
be3e446
Compare
Choose a tag to compare

Takes global instead of window automatically in jest environments.

v.0.11.0

17 Jun 09:45
958e1e7
Compare
Choose a tag to compare

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

17 Jun 07:38
d7f069e
Compare
Choose a tag to compare

Prevents shadowing of an internal variable called configuration.