-
I'm developing a snap to interact with a local testnet (modified version of ethereum with new precompiles). For development, I've added a metamask network for my local anvil instance (running at localhost:7545). I've imported one of the test accounts that has a whole lot of ether: And yet when I try to call one of my contract methods, the confirmation is grayed out: Clearly the account has the funds. Is there some other explanation for this behavior? Here's a sample of the code: // Get current flask account
let acct = ethereum.selectedAddress;
if (acct == null) {
const accts : string[] = await ethereum.request({method: 'eth_requestAccounts'});
if (accts.length === 0) {
throw new Error('No account selected');
}
acct = accts[0];
}
// Create contract instance
const SPETHER_ADDR = '0xb70a3b53d02b7882bee532e5387343aa3263f0e8';
const SPETHER_API = [
"function register(bytes memory y, bytes memory proof)"
];
const provider = new ethers.providers.Web3Provider(ethereum);
await provider.send('eth_requestAccounts', []); // <- this promps user to connect metamask
const signer = provider.getSigner()
const contract = new ethers.Contract(SPETHER_ADDR, SPETHER_API, provider).connect(signer);
// Register pub k with Spether contract
let public_key: Uint8Array = 'some other stuff';
let tx = await contract.register(public_key, []);
tx.await; Note that because of this issue I am using ethers version 5.7.2 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
I will ask a DevRel for the dapp API to get back to you, since this issue is not really a Snaps issue |
Beta Was this translation helpful? Give feedback.
-
I figured out the issue. See explanation here but the tl;dr is that my local testnet nodes have gas measuring disabled, and it appears metamask freaks out if gas estimates are zero? In any case, re-enabling gas measuring resolved the issue. |
Beta Was this translation helpful? Give feedback.
I figured out the issue. See explanation here but the tl;dr is that my local testnet nodes have gas measuring disabled, and it appears metamask freaks out if gas estimates are zero? In any case, re-enabling gas measuring resolved the issue.