import { Mock3 } from 'mock3';
// You can use if branch for when you want to use Mock3
// In this example, it consider using Mock3 in NODE_ENV === 'test'
let web3;
if (NODE_ENV === 'test') {
// Set JSON RPC using Infura, Ganache, Local, or your own
// If you do not set, the default is Rinkeby
web3 = new Mock3('YOUR.RPC.URL');
// Set signers with private key array or single
web3.setSigner(['0x3afe...', '0xf2f1...']);
// You can also set a specific account like real behavior of selecting from MetaMask or just retrieve all accounts.
web3.setAccountIndex(2);
} else {
web3 = window.web3;
}
const accounts = await web3.listAccounts();