-
Notifications
You must be signed in to change notification settings - Fork 375
Use cached wallet_getCapabilities #542
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
Conversation
Removed hardcoded userOperation hash value in wallet_getCallsStatus to the value returned from last successful call to wallet_sendCalls
Action wallet_getCapabilities will return cached data from session.sessioProperties if present else it will send a call to wallet to get the capabilities. Added RequestLoaderModal.tsx for waiting for request to get fulfil from the wallet, this modal have different message, RequestModal can be refactored to support both, but for simplicity created a separate modal to handle request which don't need a user action
The latest updates on your projects. Learn more about Vercel for Git ↗︎
9 Ignored Deployments
|
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.
The wallet_getCapabilities
"caching" should ultimately move into the provider. No concern with this PR but @KannuSingh can you leave a comment in the code reminding us to clean up after it's done.
@ganchoradkov the ERC is in review
now. When do you think is the right time to move this logic into the provider?
@@ -0,0 +1,52 @@ | |||
import * as React from "react"; |
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.
looks very similar to the old one - why a new one?
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.
its just some text changes on the modal, it don't need any approval or reject action on wallet side.
I can refactor the old one to take these messages as props.
@@ -518,15 +518,21 @@ export function JsonRpcContextProvider({ | |||
} | |||
|
|||
const params = [address] | |||
// check the session.sessioProperties first for capabilities |
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.
// check the session.sessioProperties first for capabilities | |
// check the session.sessionProperties first for capabilities |
@@ -548,8 +554,9 @@ export function JsonRpcContextProvider({ | |||
`Missing rpcProvider definition for chainId: ${chainId}` | |||
); | |||
} | |||
if(lastTxId == undefined) throw new Error(`Last transaction id ${lastTxId}, make sure call to sendCalls returns successfully. `); | |||
//hardcoded valid userOpHash |
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.
No longer hardcoded based on the change (I presume)
//hardcoded valid userOpHash |
@@ -548,8 +554,9 @@ export function JsonRpcContextProvider({ | |||
`Missing rpcProvider definition for chainId: ${chainId}` | |||
); | |||
} | |||
if(lastTxId == undefined) throw new Error(`Last transaction id ${lastTxId}, make sure call to sendCalls returns successfully. `); |
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.
Better to use ===
strict comparison here if the possible values are string | undefined
if(lastTxId == undefined) throw new Error(`Last transaction id ${lastTxId}, make sure call to sendCalls returns successfully. `); | |
if (lastTxId === undefined) throw new Error(`Last transaction ID is undefined, make sure previous call to sendCalls returns successfully. `); |
Action wallet_getCapabilities will return cached data from session.sessioProperties if present else it will send a call to wallet to get the capabilities.
Added RequestLoaderModal.tsx for waiting for request to get fulfil from the wallet, this modal have different display message, RequestModal can be refactored to support both, but for simplicity created a separate modal to handle request which don't need a user action