To assert the balance of an account, try this:
let expectedBalance = web3.toBigNumber(web3.toWei(3, 'ether'));
let actualBalance = await web3.eth.getBalance(accounts[1]);
assert.deepEqual(actualBalance, expectedBalance, "Balance incorrect!");
To use accounts other than the first one you have to indicate so to HDWalletProvider
. Third parameter is account index, default is 0. For example to use the fifth one:
provider: () => {
return new HDWalletProvider(mnemonic, URL, 4);
}
If required you can indicate to load more than one account. To load the the first 5 accounts
provider: () => {
return new HDWalletProvider(mnemonic, URL, 0, 5);
}
Truffle will use the first account returned from provider but you can change default account using from
in truffle-config.js
networks:
develop: {
provider: () => {...},
from: "0x01230123...0123",
gas: "4500000",
gasPrice: "10000000000",
}
}
You can also override default configuration passing new parameters when deploying
module.exports = function(deployer) {
deployer.deploy(Migrations, {
from: "0x444433332222....0000",
gas: "1000000",
gasPrice: "9000000000",
});
};
Best Answer
After much exploration of various links, I finally stumbled upon the Google Cloud Web3 Portal today. You'll receive 0.05 faucets. Additionally, Alchemy mentioned that you should have 0.001 ETH in mainnet funds to access Sepolia. However, other links mention the requirement of points, mining, or undergoing maintenance.