-
-
Notifications
You must be signed in to change notification settings - Fork 775
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
GITC-616: fetch gas price from polygon gas tracker #9733
Conversation
@@ -381,6 +382,14 @@ Vue.component('grantsCartEthereumPolygon', { | |||
|
|||
let gasLimit = 0; | |||
|
|||
// fetch gas prices from polygon gas tracker | |||
if (!this.polygon.gasPrices) { | |||
const priceUrl = 'https://api.polygonscan.com/api?module=gastracker&action=gasoracle&apikey=I28K1DVQAWAISBSI146I71YQDBK6N1C9GJ'; |
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.
We might want to switch this out for a paid account or move this to the backend and set up a cron to store and update the safeGasPrice
periodically.
This is going to get hammered if we call it every time a user hits the checkout.
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.
I'd say set a high default price and wrap this in a try catch for now
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.
Shouldn't we load the api key from the settings?
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.
Oh that is a nice catch ! @chibie i agree with nutrina here
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.
Yeah we should really be protecting that key - I would recommend moving this to the backend and returning the safeGasPrice
as part of the context.
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.
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 great @chibie, nicely done 🙌
Description
This pr fetches the gas price from polygon gas tracker as opposed to hardcoding it.
Refers/Fixes
Testing
tested locally