https://github.com/zeriontech/simple-web3-provider
A web3 provider with retries under the hood
https://github.com/zeriontech/simple-web3-provider
Last synced: 13 days ago
JSON representation
A web3 provider with retries under the hood
- Host: GitHub
- URL: https://github.com/zeriontech/simple-web3-provider
- Owner: zeriontech
- License: mit
- Created: 2021-04-21T13:19:49.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-07-14T12:04:04.000Z (almost 5 years ago)
- Last Synced: 2025-02-22T20:32:27.709Z (over 1 year ago)
- Language: TypeScript
- Size: 1.23 MB
- Stars: 2
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple-web3-provider
This library creates a web3 provider that delegates sending all signing methods to the given provider (if it is available) and all other methods to the provided endpoint
## Installation
```shell
npm install ky # a peer dependency
npm install simple-web3-provider
```
## Getting Started
```javascript
import Web3 from 'web3';
import { Provider } from 'simple-web3-provider';
const web3 = new Web3(new Provider(url, options));
```
## API
#### Provider Constructor
```typescript
new Provider(url: string, options?: Options)
```
- `url`: An RPC Endpoint to send requests to
- `options`: An [Options](#Options) object
#### Options
```typescript
interface Options {
maxRetries?: number;
timeout?: number;
}
```
- `maxRetries`: Number of retries for failed requests, defaults to `10`
- `timeout`: Timeout in milliseconds for getting a response, defaults to `30000`
## License
MIT License, see the included [LICENSE](LICENSE) file.