-
Notifications
You must be signed in to change notification settings - Fork 702
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: add getGasPrice rpc provider method #1056
Conversation
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.
Just few improvements and variables naming.
src/provider/rpc.ts
Outdated
@@ -100,6 +100,12 @@ export class RpcProvider implements ProviderInterface { | |||
return this.channel.getBlockWithTxs(blockIdentifier); | |||
} | |||
|
|||
public async getGasPrice(blockIdentifier?: BlockIdentifier) { | |||
return this.channel | |||
.getBlockWithTxs(blockIdentifier) |
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.
getBlockWithTxHashes
should generate less amount of data to receive, and will nevertheless return the L1 gas price
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.
On my side, with
const bl=await provider.getBlockWithTxHashes();
https://starknet-sepolia.public.blastapi.io/rpc/v0_7
{
l1_da_mode: 'BLOB',
l1_data_gas_price: { price_in_fri: '0x91acb74c302d3', price_in_wei: '0x14f44f92900' },
l1_gas_price: { price_in_fri: '0x2d7f150f9892', price_in_wei: '0x68b5b1857' },
parent_hash: '0x16cc570bf6841d72a650ac06eefe965f8325c01d80df0ed5de2d3b03d62c6ec',
sequencer_address: '0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8',
starknet_version: '0.13.1',
status: 'PENDING',
timestamp: 1712319031,
transactions: [
https://starknet-sepolia.public.blastapi.io/rpc/v0_6
{
l1_gas_price: { price_in_fri: '0x2782d833b2c3', price_in_wei: '0x5b07580b4' },
parent_hash: '0x2ef3f69a56a90ca2864d4679aa64e857b72b7c9702fb3e3caaf07d863da79d1',
sequencer_address: '0x1176a1bd84444c89232ec27754698e5d2e7e1a7f1539f12027f28b23ec9f3d8',
starknet_version: '0.13.1',
status: 'PENDING',
timestamp: 1712319274,
transactions: [
Same with mainnet, same with Nethermind.
So, it should work.
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.
Your problem is probably related to a connection to rpc v0.4 or v0.5 (as it's not described in your url)
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.
Fixed ✅. What caused the problem earlier was because I was using older RPC version. @PhilippeR26
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.
LGTM
let's see about @PhilippeR26 comment still
- change the helper method of `getL1GasPrice()` from `getBlockWithTxs()` to `getBlockWithTxHashes()`
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.
lgtm
# [6.8.0](v6.7.0...v6.8.0) (2024-04-23) ### Bug Fixes * starkne types 0.7 ([#1087](#1087)) ([b038c76](b038c76)) * tslib ([#1068](#1068)) ([dd7dc10](dd7dc10)) * **utils:** fix block identifier ([#1076](#1076)) ([0a3499d](0a3499d)) ### Features * add getGasPrice rpc provider method ([#1056](#1056)) ([d396275](d396275)) * Export function parseCalldataField() ([4d59658](4d59658)) * rpc 0.7.1 ([#1071](#1071)) ([11dc600](11dc600))
🎉 This PR is included in version 6.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
* chore(release): 6.8.0 [skip ci] # [6.8.0](v6.7.0...v6.8.0) (2024-04-23) ### Bug Fixes * starkne types 0.7 ([#1087](#1087)) ([b038c76](b038c76)) * tslib ([#1068](#1068)) ([dd7dc10](dd7dc10)) * **utils:** fix block identifier ([#1076](#1076)) ([0a3499d](0a3499d)) ### Features * add getGasPrice rpc provider method ([#1056](#1056)) ([d396275](d396275)) * Export function parseCalldataField() ([4d59658](4d59658)) * rpc 0.7.1 ([#1071](#1071)) ([11dc600](11dc600)) * docs: add paragrapher for encode decode tool * Update CHANGELOG.md --------- Co-authored-by: Toni Tabak <tabaktoni@gmail.com> Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net> Co-authored-by: Ivan Pavičić <ivan.pavicic@live.com>
* chore(release): 6.8.0 [skip ci] # [6.8.0](v6.7.0...v6.8.0) (2024-04-23) ### Bug Fixes * starkne types 0.7 ([#1087](#1087)) ([b038c76](b038c76)) * tslib ([#1068](#1068)) ([dd7dc10](dd7dc10)) * **utils:** fix block identifier ([#1076](#1076)) ([0a3499d](0a3499d)) ### Features * add getGasPrice rpc provider method ([#1056](#1056)) ([d396275](d396275)) * Export function parseCalldataField() ([4d59658](4d59658)) * rpc 0.7.1 ([#1071](#1071)) ([11dc600](11dc600)) * chore/add JsDoc for address.ts file * update/ change address jsDoc - Add quotes to address string - Change address to get more zeros * feat/ Add JSDoc for encode.ts * update/ fix comments of encode.ts * update/ Fix last comment --------- Co-authored-by: Toni Tabak <tabaktoni@gmail.com> Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
Motivation and Resolution
Closes #761
RPC version (if applicable)
...
Usage related changes
...
Development related changes
...
Checklist: