archive-monorepo/@tornado/web3-providers-http
T-Hax 96b941a315
gitea: save migration for community repo
Signed-off-by: T-Hax <>
2023-05-19 20:21:50 +00:00
..
lib Set up monorepo 2023-05-03 20:35:27 +00:00
src Set up monorepo 2023-05-03 20:35:27 +00:00
types Set up monorepo 2023-05-03 20:35:27 +00:00
.gitignore Set up monorepo 2023-05-03 20:35:27 +00:00
config Set up monorepo 2023-05-03 20:35:27 +00:00
package-lock.json Set up monorepo 2023-05-03 20:35:27 +00:00
package.json gitea: save migration for community repo 2023-05-19 20:21:50 +00:00
README.md Set up monorepo 2023-05-03 20:35:27 +00:00
tsconfig.json Set up monorepo 2023-05-03 20:35:27 +00:00

web3-providers-http

NPM Package Dependency Status Dev Dependency Status

Package forked from https://github.com/ChainSafe/web3.js/tree/v1.6.1/packages/web3-providers-http to change http headers

This is a HTTP provider sub-package for web3.js.

Please read the documentation for more.

Installation

Node.js

npm install web3-providers-http

Usage

const http = require('http');
const Web3HttpProvider = require('web3-providers-http');

const options = {
    keepAlive: true,
    timeout: 20000, // milliseconds,
    headers: [{name: 'Access-Control-Allow-Origin', value: '*'},{...}],
    withCredentials: false,
    agent: {http: http.Agent(...), baseUrl: ''}
};

const provider = new Web3HttpProvider('http://localhost:8545', options);

Types

All the TypeScript typings are placed in the types folder.