You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
Sending a transaction in secure mode (when all accounts are locked) generates multiple error events.
Expected Behavior
Expecting a single error noting that the account is locked.
Current Behavior
Currently seeing two very different error objects reporting the account is locked.
Possible Solution
Use try/catch and async/await with sendTransaction in secure mode.
Steps to Reproduce (for bugs)
Execute the following code and monitor err in the callback.
var web3 = new Web3();
web3.setProvider(
Ganache.provider({
mnemonic: mnemonic,
secure: true
})
);
web3.eth.sendTransaction(
{
from: expectedAddress,
to: "0x1234567890123456789012345678901234567890", // doesn't need to exist
value: web3.utils.toWei(1, "ether"),
gasLimit: 90000
},
function(**err**, tx) {
if (!**err**) {
return done(
new Error("We expected the account to be locked, which should throw an error when sending a transaction")
);
}
/* checking for "**signer account is locked**" but have to resort to this. */
assert(
err.message.toLowerCase().indexOf("could not unlock signer account") >= 0,
"Expected error message containing \"could not unlock signer account\" " +
"(case insensitive check). Received the following error message, instead. " +
`"${err.message}"`
);
}
Context
Ensuring that I can not send a transaction from a locked account.
The text was updated successfully, but these errors were encountered:
Sending a transaction in secure mode (when all accounts are locked) generates multiple error events.
Expected Behavior
Expecting a single error noting that the account is locked.
Current Behavior
Currently seeing two very different error objects reporting the account is locked.
Possible Solution
Use
try/catch
andasync/await
withsendTransaction
in secure mode.Steps to Reproduce (for bugs)
Execute the following code and monitor
err
in the callback.Context
Ensuring that I can not send a transaction from a locked account.
The text was updated successfully, but these errors were encountered: