npm-package-near-react-gas-display-sdk
v1.0.449
Published
npm Package - @near-react/gas-display
Readme
near-react-gas-display
A React component for displaying real-time NEAR Protocol gas prices.
Installation
npm install near-react-gas-display
Usage
import { NearReactGasDisplay } from 'near-react-gas-display'
function App() { return }
Props
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| className | string | — | CSS class name |
| style | React.CSSProperties | — | Inline styles |
| refreshInterval | number | 10000 | Poll interval in ms |
| showGwei | boolean | true | Show price in Gwei |
| label | string | 'NEAR Gas Price' | Display label |
| onGasFetched | (gasPrice: string) => void | — | Callback when gas price is fetched |
Examples
Basic usage:
Custom label and refresh interval:
Hide Gwei and use callback:
<NearReactGasDisplay showGwei={false} onGasFetched={(gasPrice) => console.log('Gas price:', gasPrice)} />
With custom styles:
<NearReactGasDisplay className="my-gas-widget" style={{ color: 'green', fontWeight: 'bold' }} refreshInterval={15000} showGwei={true} label="NEAR Fee" onGasFetched={(gasPrice) => console.log(gasPrice)} />
License
MIT
