-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support sepolia testnet #61
Conversation
✅ Deploy Preview for new-admin-opencerts ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
This reverts commit aa3bccc.
src/app.tsx
Outdated
if (e instanceof EthereumProviderError) { | ||
e.code === 4001 ? setMetamaskConnected(true) : console.debug(e); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we also put an else
to handle when e
is not an instance of EthereumProviderError?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! Ill update it!
Actually, Ill also change the other error handling to log ? log(e.message) : console.error(e.message)
instead of
admin-website-v2/src/components/util/issue.tsx
Lines 22 to 24 in a9146e7
log ? log(e.message) : null; | |
} else { | |
log ? log("Unable to issue certificate") : null; |
log
object is undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that would be good as well to default to console.error(e.message)
When e
is not an instance of Error
, maybe we can do this:
log ? log("Unable to issue certificate", e) : console.error("Unable to issue certificate", e);
// or
log ? log("Unable to issue certificate", JSON.stringify(e)) : console.error("Unable to issue certificate", JSON.stringify(e));
integration/metamask-init.mjs
Outdated
const addNetworkPromise = dappPage.evaluate(addNetwork); | ||
try { | ||
setTimeout(async () => { | ||
await metamask.acceptAddNetwork(true); | ||
}, 2000); | ||
} catch (e) { | ||
// ignore error | ||
} | ||
|
||
await addNetworkPromise; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not too sure about this section. Should we be using await sleep(2000)
instead of setTimeout()
?
Furthermore, the last line can be:
await dappPage.evaluate(addNetwork);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow, if I add the await
, it won't work... 🤔
Ill either have to separate the code (like the Dappeteer testcase) or just call dappPage.evaluate(addNetwork)
before await metamask.acceptAddNetwork(true);
Anyway I removed the setTimeout
from the code await metamask.acceptAddNetwork(true);
as its no longer needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI about what the 2 code does,
dappPage.evaluate(addNetwork)
opens a page to add the new network as per our configuration
metamask.acceptAddNetwork(true)
will supposedly click on the button "Approve" to add the new network, and then do a switch of network to the new network (reference)
Context
unknown
network when metamask wallet is set toSepolia
because it is not supported (Add Sepolia to InfuraProvider ethers-io/ethers.js#3325)What this PR does
Sepolia
testnet can be supportedintegration:wait
eth-rpc-errors
as recommended by metamaskEthereumProviderError
instead ofEthereumRpcError
because we are previously checking for code 4001 which is inEIP-1193
(for context of code 4001 returned by metamask, visit https://eips.ethereum.org/EIPS/eip-1193#provider-errors)page.waitFor
changed to use custom timeoutsleep
(can't use waitForTimeout because its obsolete)Localhost 8545
testnetnpm run dev