{"_id":"@drm3labs-oss/rpc-pool","_rev":"5-a402d4b9b09d12a743686536d167fa0c","name":"@drm3labs-oss/rpc-pool","dist-tags":{"latest":"0.2.8"},"versions":{"0.2.4":{"name":"@drm3labs-oss/rpc-pool","version":"0.2.4","keywords":["evm","rpc","ethereum","failover","wasm","browser","drm3"],"license":"MIT","_id":"@drm3labs-oss/rpc-pool@0.2.4","maintainers":[{"name":"drm3","email":"rob@drm3.io"}],"homepage":"https://github.com/DRM3Labs-OSS/drm3-rpc-pool#readme","bugs":{"url":"https://github.com/DRM3Labs-OSS/drm3-rpc-pool/issues"},"dist":{"shasum":"54a5635d5731e72ae17f5701101eafcd3893e192","tarball":"https://registry.npmjs.org/@drm3labs-oss/rpc-pool/-/rpc-pool-0.2.4.tgz","fileCount":6,"integrity":"sha512-iFxjcL2kGZAkdGscVwPz4M0tyTeCddPOHybIYau9JkA9lUB+NWMChTe1ZluqTb3GHoPG0MlwYFxMIxqyCluDSw==","signatures":[{"sig":"MEQCIFUcTscljpB7NiwDslIrITp7evSkDu9Ys5FjtYyGTN1zAiBy5wXaX4M4htIZdgCP+waPkD/9XTPDJ5QeV5K4PH1rbA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":287686},"main":"drm3_rpc_pool_wasm.js","type":"module","types":"drm3_rpc_pool_wasm.d.ts","gitHead":"7f6fb8ee69a8f19c7344a3ae1dcb2c6de6dc9dee","_npmUser":{"name":"drm3","email":"rob@drm3.io"},"repository":{"url":"git+https://github.com/DRM3Labs-OSS/drm3-rpc-pool.git","type":"git"},"_npmVersion":"10.8.2","description":"Browser + Node WASM binding for drm3-rpc-pool: a resilient JSON-RPC failover pool driven by the platform `fetch`.","directories":{},"sideEffects":["./snippets/*"],"_nodeVersion":"20.20.2","collaborators":["DRM3 Labs Corp. <support@drm3.io>"],"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/rpc-pool_0.2.4_1782266721043_0.03827279966548369","host":"s3://npm-registry-packages-npm-production"}},"0.2.5":{"name":"@drm3labs-oss/rpc-pool","version":"0.2.5","keywords":["evm","rpc","ethereum","failover","wasm","browser","drm3"],"license":"MIT","_id":"@drm3labs-oss/rpc-pool@0.2.5","maintainers":[{"name":"drm3","email":"rob@drm3.io"}],"homepage":"https://github.com/DRM3Labs-OSS/drm3-rpc-pool#readme","bugs":{"url":"https://github.com/DRM3Labs-OSS/drm3-rpc-pool/issues"},"dist":{"shasum":"1b9edb32c0691777d7892785cb7179e1e8bfabe2","tarball":"https://registry.npmjs.org/@drm3labs-oss/rpc-pool/-/rpc-pool-0.2.5.tgz","fileCount":6,"integrity":"sha512-AupEUQVT2ROXLEZktNHap5oCS5EkNmjycSGMIf0mwrMiivrDla1f7N0LsCXsZ3ll3qJTNavLCIEqIcSzh74lsQ==","signatures":[{"sig":"MEUCIHrUiVWMi2PG6o2OtTjZpyDYTooIOxTrhRYPQmNg/2SQAiEA1ncb81hhogTtYVGFYY92F/pqHaXtWwAeDmxmGcCHKpw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":288945},"main":"drm3_rpc_pool_wasm.js","type":"module","types":"drm3_rpc_pool_wasm.d.ts","gitHead":"9d1ed6f0f397d51e02b8e7ffb4abd2395c11de07","_npmUser":{"name":"drm3","email":"rob@drm3.io"},"repository":{"url":"git+https://github.com/DRM3Labs-OSS/drm3-rpc-pool.git","type":"git"},"_npmVersion":"10.8.2","description":"Browser + Node WASM binding for drm3-rpc-pool: a resilient JSON-RPC failover pool driven by the platform `fetch`.","directories":{},"sideEffects":["./snippets/*"],"_nodeVersion":"20.20.2","collaborators":["DRM3 Labs Corp. <support@drm3.io>"],"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/rpc-pool_0.2.5_1782270631795_0.9597982733046848","host":"s3://npm-registry-packages-npm-production"}},"0.2.6":{"name":"@drm3labs-oss/rpc-pool","version":"0.2.6","keywords":["evm","rpc","ethereum","failover","wasm","browser","drm3"],"license":"MIT","_id":"@drm3labs-oss/rpc-pool@0.2.6","maintainers":[{"name":"drm3","email":"rob@drm3.io"}],"homepage":"https://github.com/DRM3Labs-OSS/drm3-rpc-pool#readme","bugs":{"url":"https://github.com/DRM3Labs-OSS/drm3-rpc-pool/issues"},"dist":{"shasum":"8bc9fea7781c487fbf190ef6e3112e23f36e915d","tarball":"https://registry.npmjs.org/@drm3labs-oss/rpc-pool/-/rpc-pool-0.2.6.tgz","fileCount":6,"integrity":"sha512-0YZdWnXVDbPl/l957Ql/ZYknMBSIXBBqDw75nr1CbiN+35Asct0TRnR3J2qRDgtQEVuCMnwhw8fH+CyozQSAww==","signatures":[{"sig":"MEUCIAg6R6FVY3LhfhT34xPZ35wdiV8HHfU4IW+zfuhh4leHAiEAl8r+GcUsg75cQbZiAN9ZjD7Jtw8s3JqZu09EoE5hMq0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":289180},"main":"drm3_rpc_pool_wasm.js","type":"module","types":"drm3_rpc_pool_wasm.d.ts","gitHead":"f75e666e45c8f0548075da185915c2ec5ba806b2","_npmUser":{"name":"drm3","email":"rob@drm3.io"},"repository":{"url":"git+https://github.com/DRM3Labs-OSS/drm3-rpc-pool.git","type":"git"},"_npmVersion":"10.8.2","description":"Browser + Node WASM binding for drm3-rpc-pool: a resilient JSON-RPC failover pool driven by the platform `fetch`.","directories":{},"sideEffects":["./snippets/*"],"_nodeVersion":"20.20.2","collaborators":["DRM3 Labs Corp. <support@drm3.io>"],"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/rpc-pool_0.2.6_1782281338547_0.2884442944688781","host":"s3://npm-registry-packages-npm-production"}},"0.2.7":{"name":"@drm3labs-oss/rpc-pool","version":"0.2.7","keywords":["evm","rpc","ethereum","failover","wasm","browser","drm3"],"license":"MIT","_id":"@drm3labs-oss/rpc-pool@0.2.7","maintainers":[{"name":"drm3","email":"rob@drm3.io"}],"homepage":"https://github.com/DRM3Labs-OSS/drm3-rpc-pool#readme","bugs":{"url":"https://github.com/DRM3Labs-OSS/drm3-rpc-pool/issues"},"dist":{"shasum":"1cd50555e56a0b69ff53c7719fde59ec6b6213d8","tarball":"https://registry.npmjs.org/@drm3labs-oss/rpc-pool/-/rpc-pool-0.2.7.tgz","fileCount":6,"integrity":"sha512-khfJPUgfb4kYdTCKUhleSKh1wUtUKJX2BYMMO3UwgMjTR6ap09EiX51BKO8xwDj7KOQ3ldcpEqlAkKX+eYCIJg==","signatures":[{"sig":"MEUCIFQ2/ZzUX2jtMtIbrLALXKTPeag8G/+plX4SqoFPGt6AAiEAgyJVHngFlN2g/DrXY3/XY94NtNvN+yvmhEhKLvJBBLs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":289191},"main":"drm3_rpc_pool_wasm.js","type":"module","types":"drm3_rpc_pool_wasm.d.ts","gitHead":"c12669c5356a9b66b800a7b0df693d993e97573f","_npmUser":{"name":"drm3","email":"rob@drm3.io"},"repository":{"url":"git+https://github.com/DRM3Labs-OSS/drm3-rpc-pool.git","type":"git"},"_npmVersion":"10.8.2","description":"Browser + Node WASM binding for drm3-rpc-pool: a resilient JSON-RPC failover pool driven by the platform `fetch`.","directories":{},"sideEffects":["./snippets/*"],"_nodeVersion":"20.20.2","collaborators":["DRM3 Labs Corp. <support@drm3.io>"],"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/rpc-pool_0.2.7_1783135449125_0.956582695786697","host":"s3://npm-registry-packages-npm-production"}},"0.2.8":{"name":"@drm3labs-oss/rpc-pool","type":"module","collaborators":["DRM3 Labs Corp. <support@drm3.io>"],"description":"Browser + Node WASM binding for drm3-rpc-pool: a resilient JSON-RPC failover pool driven by the platform `fetch`.","version":"0.2.8","license":"MIT","repository":{"type":"git","url":"git+https://github.com/DRM3Labs-OSS/drm3-rpc-pool.git"},"main":"drm3_rpc_pool_wasm.js","types":"drm3_rpc_pool_wasm.d.ts","sideEffects":["./snippets/*"],"keywords":["evm","rpc","ethereum","failover","wasm","browser","drm3"],"_id":"@drm3labs-oss/rpc-pool@0.2.8","gitHead":"b9d15278bce59d1419ffe906cf95e0a2446f0521","bugs":{"url":"https://github.com/DRM3Labs-OSS/drm3-rpc-pool/issues"},"homepage":"https://github.com/DRM3Labs-OSS/drm3-rpc-pool#readme","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-flgSbx+VKNw3XvYUG33PRjXAy+TtFsAYbB+NrqCkREQHn/Sd/GaMKYOfidNF1/R48LoMKutgLwvi+W+KB9zXxQ==","shasum":"8f3fada9fa9ecd14cc89ebf8e5db23a3d7a7335b","tarball":"https://registry.npmjs.org/@drm3labs-oss/rpc-pool/-/rpc-pool-0.2.8.tgz","fileCount":6,"unpackedSize":296314,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQD+HcF/VVZRkRy6Rk+qgy9cszDHD7nO166idv7BVSs78gIgR1VQITsvJMFuVOcZawI+QBB6AkJh5IYhAULnB2dfaOU="}]},"_npmUser":{"name":"drm3","email":"rob@drm3.io"},"directories":{},"maintainers":[{"name":"drm3","email":"rob@drm3.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rpc-pool_0.2.8_1783135620496_0.23456089762613996"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-24T02:05:20.942Z","modified":"2026-07-04T03:27:00.742Z","0.2.4":"2026-06-24T02:05:21.206Z","0.2.5":"2026-06-24T03:10:31.931Z","0.2.6":"2026-06-24T06:08:58.692Z","0.2.7":"2026-07-04T03:24:09.270Z","0.2.8":"2026-07-04T03:27:00.622Z"},"bugs":{"url":"https://github.com/DRM3Labs-OSS/drm3-rpc-pool/issues"},"license":"MIT","homepage":"https://github.com/DRM3Labs-OSS/drm3-rpc-pool#readme","keywords":["evm","rpc","ethereum","failover","wasm","browser","drm3"],"repository":{"type":"git","url":"git+https://github.com/DRM3Labs-OSS/drm3-rpc-pool.git"},"description":"Browser + Node WASM binding for drm3-rpc-pool: a resilient JSON-RPC failover pool driven by the platform `fetch`.","maintainers":[{"name":"drm3","email":"rob@drm3.io"}],"readme":"# @drm3labs-oss/rpc-pool\n\nResilient JSON-RPC failover pool for any EVM chain, compiled to WebAssembly.\n\nThe pool's failover, per-endpoint health tracking, exponential backoff,\ncapability routing, and client-side rate limiting all run in WASM. The actual\nnetwork call is done by the platform `fetch`, so the same package works in the\n**browser**, in **Web Workers**, and in **Node 18+**.\n\nIt is a WASM binding over the Rust crate\n[`drm3-rpc-pool`](https://github.com/DRM3Labs-OSS/drm3-rpc-pool). No `reqwest`, no\n`tokio` - just `fetch`.\n\n## Install\n\n```sh\nnpm install @drm3labs-oss/rpc-pool\n```\n\n## Browser (ES modules / Vite / bundler)\n\nWith the `--target web` build you must call the default `init()` once to load\nthe `.wasm`, then use the `RpcPool` class.\n\n```ts\nimport init, { RpcPool } from \"@drm3labs-oss/rpc-pool\";\n\nawait init(); // loads the .wasm\n\nconst pool = new RpcPool({\n  max_retries: 0, // 0 = try every healthy, capable endpoint\n  endpoints: [\n    { url: \"https://eth.llamarpc.com\", priority: 0 },\n    { url: \"https://rpc.ankr.com/eth\", priority: 1 },\n    {\n      url: \"https://eth-mainnet.example/v2/KEY\",\n      priority: 2,\n      auth: { type: \"bearer\", token: \"...\" },\n    },\n  ],\n});\n\n// Resolves the JSON-RPC `result`; fails over on 429 / transport errors.\nconst blockHex: string = await pool.call(\"eth_blockNumber\", []);\nconsole.log(parseInt(blockHex, 16));\n\n// Live per-endpoint health snapshot.\nconsole.log(pool.status());\n```\n\n## Node 18+\n\nNode ships a global `fetch`, so the same API works. Use the `web` build with a\nmanual wasm read, or build a `--target nodejs` package (`npm run build:node`)\nwhich needs no `init()`:\n\n```ts\n// nodejs target (no init needed):\nimport { RpcPool } from \"@drm3labs-oss/rpc-pool\";\n\nconst pool = new RpcPool({\n  endpoints: [{ url: \"https://eth.llamarpc.com\" }],\n});\nconst chainId = await pool.call(\"eth_chainId\", []);\nconsole.log(chainId);\n```\n\n## Config shape (TypeScript)\n\nTypes are generated by `wasm-bindgen` into `drm3_rpc_pool_wasm.d.ts`.\n\n```ts\nnew RpcPool({\n  request_timeout_ms?: number;\n  max_retries?: number;            // 0 = try every healthy candidate\n  endpoints: Array<{\n    url: string;\n    label?: string;\n    priority?: number;             // lower priority is tried first\n    capabilities?: string[];       // e.g. [\"eth_call\"]; empty/omitted = supports all\n    max_rps?: number;              // client-side throttle; throttled endpoint is skipped, not awaited\n    auth?:\n      | { type: \"none\" }\n      | { type: \"url_key\" }\n      | { type: \"header\"; name: string; value: string }\n      | { type: \"bearer\"; token: string };\n  }>;\n});\n\npool.call(method: string, params: any): Promise<any>;\npool.status(): any;\npool.length: number;\n```\n\n## Failover behavior\n\n- Endpoints are tried in `priority` order (ties broken by config order).\n- An endpoint that lacks the method's capability is skipped.\n- On a 429, non-2xx, transport error, or unparseable body, the call fails over\n  to the next endpoint. A well-formed JSON-RPC error result is returned as-is\n  (it is a valid answer, not a transport failure).\n- Repeated failures demote an endpoint into an exponentially-growing cooldown;\n  it is skipped while cooling down and reinstated automatically.\n- `call(...)` rejects only when every candidate has failed.\n\n## Notes / limitations\n\n- **Backoff is time-gated, not sleep-based.** The pool never blocks on a wasm\n  timer: it records failure timestamps and skips an endpoint while it is within\n  its cooldown window, comparing against `web-time`'s wasm clock. This is the\n  same logic as the native build; nothing about failover is \"simplified\" in\n  wasm. (`gloo-timers` is available as the documented wasm timer should a future\n  sleep-based path be added.)\n- **`request_timeout_ms` is advisory in this build.** The native crate enforces\n  it via the reqwest client timeout; the wasm `FetchTransport` does not yet wire\n  an `AbortController` deadline onto `fetch`. Per-request timeouts therefore rely\n  on the platform's default `fetch` timeout. (Adding an abort-based deadline is a\n  small follow-up.)\n- The pool runs single-threaded in wasm (the `Transport`/`Metrics` traits drop\n  their `Send + Sync` bounds on `wasm32`); this matches the JS event loop.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}