Skip to content
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

web3 external provider - Quicknode #7019

Merged
merged 26 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/web3-rpc-providers/.eslintignore
7 changes: 7 additions & 0 deletions packages/web3-rpc-providers/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: '../../.eslintrc.js',
parserOptions: {
project: './tsconfig.esm.json',
tsconfigRootDir: __dirname,
},
};
Empty file.
1 change: 1 addition & 0 deletions packages/web3-rpc-providers/.npmignore
1 change: 1 addition & 0 deletions packages/web3-rpc-providers/.npmrc
1 change: 1 addition & 0 deletions packages/web3-rpc-providers/.prettierignore
1 change: 1 addition & 0 deletions packages/web3-rpc-providers/.prettierrc.json
38 changes: 38 additions & 0 deletions packages/web3-rpc-providers/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

<!-- EXAMPLE

## [1.0.0]

### Added

- I've added feature XY (#1000)

### Changed

- I've cleaned up XY (#1000)

### Deprecated

- I've deprecated XY (#1000)

### Removed

- I've removed XY (#1000)

### Fixed

- I've fixed XY (#1000)

### Security

- I've improved the security in XY (#1000)

-->

## [Unreleased]
58 changes: 58 additions & 0 deletions packages/web3-rpc-providers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<p align="center">
<img src="assets/logo/web3js.jpg" width="500" alt="web3.js" />
</p>

# web3.js - Web3 Providers

![ES Version](https://img.shields.io/badge/ES-2020-yellow)
![Node Version](https://img.shields.io/badge/node-14.x-green)
[![NPM Package][npm-image]][npm-url]
[![Downloads][downloads-image]][npm-url]

This is a sub-package of [web3.js][repo].


## Installation

You can install the package either using [NPM](https://www.npmjs.com/package/web3-rpc-providers) or using [Yarn](https://yarnpkg.com/package/web3-rpc-providers)

### Using NPM

```bash
npm install web3-rpc-providers
```

### Using Yarn

```bash
yarn add web3-rpc-providers
```

## Getting Started

- :writing_hand: If you have questions [submit an issue](https://github.com/ChainSafe/web3.js/issues/new) or join us on [Discord](https://discord.gg/yjyvFRP)
![Discord](https://img.shields.io/discord/593655374469660673.svg?label=Discord&logo=discord)

## Prerequisites

- :gear: [NodeJS](https://nodejs.org/) (LTS/Fermium)
- :toolbox: [Yarn](https://yarnpkg.com/)/[Lerna](https://lerna.js.org/)

## Package.json Scripts

| Script | Description |
| ---------------- | -------------------------------------------------- |
| clean | Uses `rimraf` to remove `dist/` |
| build | Uses `tsc` to build package and dependent packages |
| lint | Uses `eslint` to lint package |
| lint:fix | Uses `eslint` to check and fix any warnings |
| format | Uses `prettier` to format the code |
| test | Uses `jest` to run unit tests |
| test:integration | Uses `jest` to run tests under `/test/integration` |
| test:unit | Uses `jest` to run tests under `/test/unit` |

[docs]: https://docs.web3js.org/
[repo]: https://github.com/web3/web3.js/tree/4.x/tools/web3-rpc-providers
[npm-image]: https://img.shields.io/github/package-json/v/web3/web3.js/4.x?filename=tools%2Fweb3-rpc-providers%2Fpackage.json
[npm-url]: https://npmjs.org/package/web3-rpc-providers
[downloads-image]: https://img.shields.io/npm/dm/web3-rpc-providers?label=npm%20downloads
1,516 changes: 1,516 additions & 0 deletions packages/web3-rpc-providers/assets/logo/web3js.ai

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions packages/web3-rpc-providers/assets/logo/web3js.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions packages/web3-rpc-providers/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"name": "web3-rpc-providers",
"version": "0.1.0",
"description": "Web3 Providers package",
"main": "./lib/commonjs/index.js",
"module": "./lib/esm/index.js",
"exports": {
".": {
"types": "./lib/types/index.d.ts",
"import": "./lib/esm/index.js",
"require": "./lib/commonjs/index.js"
}
},
"repository": "https://github.com/ChainSafe/web3.js",
"author": "ChainSafe Systems",
"license": "LGPL-3.0",
"engines": {
"node": ">=14",
"npm": ">=6.12.0"
},
"files": [
"lib/**/*",
"src/**/*",
"dist/**/*"
],
"scripts": {
"clean": "rimraf dist && rimraf lib",
"prebuild": "yarn clean",
"build": "concurrently --kill-others-on-fail \"yarn:build:*(!check)\"",
"build:cjs": "tsc --build tsconfig.cjs.json && echo '{\"type\": \"commonjs\"}' > ./lib/commonjs/package.json",
"build:esm": "tsc --build tsconfig.esm.json && echo '{\"type\": \"module\"}' > ./lib/esm/package.json",
"build:types": "tsc --build tsconfig.types.json",
"build:check": "node -e \"require('./lib')\"",
"lint": "eslint --cache --cache-strategy content --ext .ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
"test:unit": "jest --config=./test/unit/jest.config.js",
"test:integration": "jest --config=./test/integration/jest.config.js --passWithNoTests"
},
"devDependencies": {
"@types/jest": "^28.1.6",
"@typescript-eslint/eslint-plugin": "^5.30.7",
"@typescript-eslint/parser": "^5.30.7",
"eslint": "^8.20.0",
"eslint-config-base-web3": "0.1.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"jest": "^29.7.0",
"jest-extended": "^3.0.1",
"prettier": "^2.7.1",
"ts-jest": "^29.1.1",
"typescript": "^4.7.4"
},
"dependencies": {
"web3-providers-http": "^4.1.0",
"web3-providers-ws": "^4.0.7",
"web3-types": "^1.6.0",
"web3-utils": "^4.2.3"
}
}
25 changes: 25 additions & 0 deletions packages/web3-rpc-providers/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
This file is part of web3.js.

web3.js is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

web3.js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/

import { QuickNodeProvider } from './web3_provider_quicknode.js';

export * from './types.js';
export * from './web3_provider_quicknode.js';
export * from './web3_provider.js';

// default providers
export const mainnet = new QuickNodeProvider();
44 changes: 44 additions & 0 deletions packages/web3-rpc-providers/src/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
This file is part of web3.js.

web3.js is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

web3.js is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/

export enum Transport {
HTTPS = "https",
WebSocket = "wss"
};

export enum Network {
ETH_MAINNET = "eth_mainnet",
ETH_GOERLI = "eth_goerli",
ETH_SEPOLIA = "eth_sepolia",
ETH_HOLESKY = "eth_holesky",

POLYGON_MAINNET= "polygon_mainnet",
POLYGON_MUMBAI= "polygon_mumbai",
POLYGON_AMONY= "polygon_amony",

ARBITRUM_MAINNET = "arbitrum_mainnet",
ARBITRUM_SEPOLIA = "arbitrum_sepolia",

BASE_MAINNET = "base_mainnet",
BASE_SEPOLIA = "base_sepolia",

OPTIMISM_MAINNET = "optimism_mainnet",
OPTIMISM_SEPOLIA = "optimism_sepolia",

BNB_MAINNET = "bnb_mainnet",
BNB_TESTNET = "bnb_testnet"
};
Loading
Loading