{"id":28264465,"url":"https://github.com/morpho-org/ethers-fallback-provider","last_synced_at":"2025-08-30T07:15:40.839Z","repository":{"id":162906021,"uuid":"631887804","full_name":"morpho-org/ethers-fallback-provider","owner":"morpho-org","description":"Package providing a fallback provider based on `ethers` package, adding more resilience.","archived":false,"fork":false,"pushed_at":"2024-05-27T00:50:31.000Z","size":241,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-06T18:58:03.850Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/morpho-org.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-04-24T09:16:11.000Z","updated_at":"2025-05-22T17:48:51.000Z","dependencies_parsed_at":"2025-06-18T08:48:55.177Z","dependency_job_id":"ac7cbbe0-d873-4264-9813-126e8b2ecac3","html_url":"https://github.com/morpho-org/ethers-fallback-provider","commit_stats":null,"previous_names":["morpho-org/ethers-fallback-provider","morpho-labs/ethers-fallback-provider"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/morpho-org/ethers-fallback-provider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fethers-fallback-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fethers-fallback-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fethers-fallback-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fethers-fallback-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/morpho-org","download_url":"https://codeload.github.com/morpho-org/ethers-fallback-provider/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/morpho-org%2Fethers-fallback-provider/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272817705,"owners_count":24998038,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-05-20T09:10:41.782Z","updated_at":"2025-08-30T07:15:40.827Z","avatar_url":"https://github.com/morpho-org.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ethers-fallback-provider\n[![npm package][npm-img]][npm-url]\n[![Build Status][build-img]][build-url]\n[![Downloads][downloads-img]][downloads-url]\n[![Issues][issues-img]][issues-url]\n[![Commitizen Friendly][commitizen-img]][commitizen-url]\n[![Semantic Release][semantic-release-img]][semantic-release-url]\n\n\u003e Package providing a fallback provider based on `ethers` package, adding more resilience.\n\nThe provider fallbacks on multiple providers in case of failure, and returns the first successful result.\n\nIt throws an error if all providers failed.\n\nThe providers are called in the order they are passed to the constructor.\n\nContrary to the `FallbackProvider` provided by `ethers`, this one does not use all providers at the same time, but only one at a time.\nThe purpose is more to have resilience if one provider fails, rather than having a resilience on the result.\n\n## Installation\n```bash\nnpm install @morpho-labs/ethers-fallback-provider\n```\nor\n```bash\nyarn add @morpho-labs/ethers-fallback-provider\n```\n\n## Usage\n\n```typescript\nimport FallbackProvider from '@morpho-labs/ethers-fallback-provider';\n\nimport { \n    InfuraProvider, \n    AlchemyProvider, \n    getDefaultProvider \n} from \"@ethersproject/providers\";\n\n\nconst timeout = 1000; // 1 second, optionnal, default is 3000ms\n\nconst provider = new FallbackProvider([\n    {\n        provider: new InfuraProvider('mainnet', 'your-api-key'),\n        retries: 3, // retry after a timeout or an error 3 times, default is 0.\n        timeout,\n        retryDelay: 1000 // wait a random time less than 1 second before retrying. Default is 0.\n    },\n    new AlchemyProvider('mainnet', 'your-api-key'),\n    getDefaultProvider('mainnet')\n]);\n\n// You can now use the fallback provider as a classic provider\nconst blockNumber = await provider.getBlockNumber();\n\n```\n\n\n[build-img]: https://github.com/morpho-labs/ethers-fallback-provider/actions/workflows/ci.yaml/badge.svg?branch=main\n[build-url]: https://github.com/morpho-labs/ethers-fallback-provider/actions/workflows/ci.yaml\n[downloads-img]: https://img.shields.io/npm/dt/ethers-multicall-provider\n[downloads-url]: https://www.npmtrends.com/ethers-multicall-provider\n[npm-img]: https://img.shields.io/npm/v/ethers-multicall-provider\n[npm-url]: https://www.npmjs.com/package/ethers-multicall-provider\n[issues-img]: https://img.shields.io/github/issues/morpho-labs/ethers-fallback-provider\n[issues-url]: https://github.com/morpho-labs/ethers-fallback-provider/issues\n[codecov-img]: https://codecov.io/gh/morpho-labs/ethers-fallback-provider/branch/main/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/morpho-labs/ethers-fallback-provider\n[semantic-release-img]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-release-url]: https://github.com/semantic-release/semantic-release\n[commitizen-img]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg\n[commitizen-url]: http://commitizen.github.io/cz-cli/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorpho-org%2Fethers-fallback-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmorpho-org%2Fethers-fallback-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmorpho-org%2Fethers-fallback-provider/lists"}