You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a new `evm+free` type of upstream (alongside the `buildFreeUpstreams(...)` helper) to generate placeholder upstreams that will be filled with the 15 best free rpcs
Copy file name to clipboardExpand all lines: README.md
+36Lines changed: 36 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ This project is currently under active development. Features and API may change.
12
12
-[x] Write YAML config file for eRPC config
13
13
-[x] Helpers for networks, upstream, and auth configurations
14
14
-[x] Support for various blockchain networks and RPC providers
15
+
-[x] Automatic generation of free RPC upstreams using `evm+free` type
16
+
-[x] Command to fetch best free RPC URLs for a given chain
15
17
-[ ] More stuff within the CLI (config validity check, docker file generation, version specification etc)
16
18
-[ ] Cleaner rate limit configuration and auto completion
17
19
-[ ] Builder pattern with chaining (like `createProject(...).addRateLimits(...)/* a few more steps */.write(...)`)
@@ -78,6 +80,7 @@ bun erpc-config --config ./configs/my-erpc-config.ts --out ./configs/my-erpc-con
78
80
# Explicitly use the generate command
79
81
bun erpc-config generate --config ./custom-config.ts
80
82
```
83
+
Note: When using `evm+free` upstream type, the generator will automatically fetch and include the 15 best free RPC URLs for the specified chain in the output YAML.
81
84
82
85
### Validate Command
83
86
@@ -100,6 +103,24 @@ bun erpc-config validate
100
103
bun erpc-config validate --config ./configs/my-erpc-config.ts
101
104
```
102
105
106
+
### Free RPC Command
107
+
108
+
Fetch the 15 best free RPC URLs for a given chain:
109
+
110
+
```
111
+
erpc-config free-rpc --chain-id <chainId>
112
+
```
113
+
114
+
Options:
115
+
--chain-id The chain ID to fetch free RPC URLs for (required)
116
+
117
+
Example:
118
+
119
+
```bash
120
+
# Fetch free RPC URLs for Ethereum mainnet (chain ID 1)
121
+
bun erpc-config free-rpc --chain-id 1
122
+
```
123
+
103
124
### General CLI Options
104
125
105
126
-`--help`, `-h`: Show help information
@@ -127,6 +148,7 @@ You can run these commands using `bun`, `npm`, or any other package runner of yo
127
148
-`buildAlchemyUpstream({ apiKey, ...options })`: Configure Alchemy as an upstream provider.
128
149
-`buildPimlicoUpstream({ apiKey, ...options })`: Configure Pimlico as an upstream provider.
129
150
-`buildEvmUpstream<TRpc extends RpcSchema>({ id, endpoint, ...options })`: Configure a generic EVM upstream provider with customizable RPC schema.
151
+
-`buildFreeUpstreams({ chains, ...options})`: Configure placeholder upstreams that will be filled with the 15 best free RPCs for the specified chain.
130
152
131
153
### Projects
132
154
@@ -150,6 +172,20 @@ All other exported types (such as `Config`, `ServerConfig`, `DatabaseConfig`, et
150
172
151
173
For a complete list of available types, refer to the type definitions in the library.
152
174
175
+
## Dependencies
176
+
177
+
This package relies on the following main dependencies:
178
+
179
+
-[viem](https://viem.sh/): (Peer Dependency) A TypeScript interface for Ethereum, providing lightweight and type-safe modules for interacting with the blockchain.
180
+
181
+
-[@ubiquity-dao/rpc-handler](https://github.com/ubiquity/rpc-handler): (Optional Peer Dependency) Used for fetching and comparing free RPC URLs from chainlist. Only required if you intend to use the free RPC features.
182
+
183
+
-[erpc](https://www.erpc.cloud/): The core RPC load balancer that this config generator is designed for. It offers fault-tolerant EVM RPC load balancing with reorg-aware permanent caching and auto-discovery of node providers.
184
+
185
+
-[gluegun](https://github.com/infinitered/gluegun): A toolkit used for building the command-line interface of this config generator, offering a robust set of utilities for creating TypeScript-powered CLI apps.
186
+
187
+
Please ensure you have the required peer dependencies installed in your project when using this package. The `@ubiquity-dao/rpc-handler` is only necessary if you plan to utilize the free RPC functionality.
188
+
153
189
## Usage examples
154
190
155
191
For a simple setup, please refer to the [simple example](example/simple.ts) in the repository.
0 commit comments