-
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 private policy #5
Conversation
b6d136a
to
d922b2b
Compare
src/paymasterclient.ts
Outdated
|
||
constructor( | ||
userUrl: string | FetchRequest, | ||
sponsorUrl: string | FetchRequest, |
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.
what if a user:
- just want to use the user api?
- just want to use the sponsor api and private policy?
- will use both of them.
But now, I have to input two URL. I think we can improve so that user just need input necessary 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.
Make the sponsorUrl optional, so that private policy UUID can only be sent if the user provides this URL. Add a comment explaining the purpose of sponsorUrl and Options.
2d0da9b
to
a1f71d3
Compare
1150f05
to
2f69254
Compare
2f69254
to
ca4c90e
Compare
src/paymasterclient.ts
Outdated
if (policyUUID) { | ||
const newConnection = this._getConnection() | ||
newConnection.setHeader("X-MegaFuel-Policy-Uuid", policyUUID) | ||
const sponsorProviderWithHeader = new ethers.JsonRpcProvider( |
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.
sponsorProviderWithHeader
the name sponsor
is not proper here.
if no new header to set here, can we not do new ethers.JsonRpcProvider
, but reuse the current 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.
sponsorProviderWithHeader the name sponsor is not proper here. ------> rename to provider
if no new header to set here, can we not do new ethers.JsonRpcProvider, but reuse the current one.
------------>
if (policyUUID)
if policyUUID
is undefined, null, or an empty string. In any of these cases, the program will skip the if block and directly execute: return await this.send('pm_isSponsorable', [tx])
This way, we didn't create a new ethers.JsonRpcProvider
in cases where we don't need to set a header.
1a2c754
to
54a7267
Compare
support private policy for IsSponsorable & SendRawTransaction