Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@web3-onboard/gas
Advanced tools
Estimate the gas prices needed to get a transaction in to the next block for Ethereum Mainnet and Polygon Matic Mainnet.
NPM
npm i @web3-onboard/gas
Yarn
yarn add @web3-onboard/gas
import gas from '@web3-onboard/gas'
// subscribe to a single chain for estimates using the default poll rate of 5 secs
// API key is optional and if provided allows for faster poll rates
const ethMainnetGasBlockPrices = gas.stream({
chains: ['0x1'],
apiKey: '<OPTIONAL_API_KEY>',
endpoint: 'blockPrices'
})
const { unsubscribe: ethGasUnsub } = ethMainnetGasBlockPrices.subscribe(
estimates => console.log(estimates)
)
// .... sometime later, unsubscribe to stop polling
setTimeout(ethGasUnsub, 10000)
// OR you can subscribe to multiple chains at once:
const gasBlockPrices = gas.stream({
chains: ['0x1', '0x89'],
apiKey: '<OPTIONAL_API_KEY>',
endpoint: 'blockPrices',
// can override default poll rate as well
poll: 1000
})
const { unsubscribe } = gasBlockPrices.subscribe(estimates =>
console.log(estimates)
)
// .... sometime later, unsubscribe to stop polling
setTimeout(unsubscribe, 10000)
// Can also just do a one time get rather than a stream
const gasBlockPrices = await gas.get({
chains: ['0x1', '0x89'],
apiKey: '<OPTIONAL_API_KEY>',
endpoint: 'blockPrices'
})
FAQs
Estimate the gas prices needed to get a transaction in to the next block for Ethereum Mainnet and Polygon Matic Mainnet.
The npm package @web3-onboard/gas receives a total of 144 weekly downloads. As such, @web3-onboard/gas popularity was classified as not popular.
We found that @web3-onboard/gas demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.