{"id":19083961,"url":"https://github.com/floating/eth-provider","last_synced_at":"2025-04-13T04:59:00.048Z","repository":{"id":32842631,"uuid":"141797661","full_name":"floating/eth-provider","owner":"floating","description":"A Universal Ethereum Provider Client","archived":false,"fork":false,"pushed_at":"2024-08-15T21:25:59.000Z","size":1163,"stargazers_count":193,"open_issues_count":9,"forks_count":34,"subscribers_count":11,"default_branch":"master","last_synced_at":"2024-12-18T06:19:13.385Z","etag":null,"topics":["browser","ethereum","http","ipc","nodejs","provider","web3","websocket"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/floating.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}},"created_at":"2018-07-21T09:10:58.000Z","updated_at":"2024-12-14T22:27:17.000Z","dependencies_parsed_at":"2024-12-28T04:01:36.280Z","dependency_job_id":null,"html_url":"https://github.com/floating/eth-provider","commit_stats":{"total_commits":75,"total_committers":7,"mean_commits":"10.714285714285714","dds":0.6,"last_synced_commit":"99c3c98c6556d436d664acd2e20313c9b0dfd99f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floating%2Feth-provider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floating%2Feth-provider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floating%2Feth-provider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/floating%2Feth-provider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/floating","download_url":"https://codeload.github.com/floating/eth-provider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244295840,"owners_count":20430214,"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","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":["browser","ethereum","http","ipc","nodejs","provider","web3","websocket"],"created_at":"2024-11-09T02:49:35.913Z","updated_at":"2025-03-28T03:08:13.551Z","avatar_url":"https://github.com/floating.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cbr\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"/asset/header.png?raw=true\" alt=\"eth-provider\" height=\"400\"/\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\u003ch3 align=\"center\"\u003eA Universal Ethereum Provider Client\u003c/h3\u003e\n\u003cp align=\"center\"\u003eSeamlessly connect to  \u003cb\u003eHTTP\u003c/b\u003e, \u003cb\u003eWebSocket\u003c/b\u003e, \u003cb\u003eIPC\u003c/b\u003e and \u003cb\u003eInjected\u003c/b\u003e RPC transports in \u003cb\u003eNode\u003c/b\u003e and the \u003cb\u003eBrowser\u003c/b\u003e!\u003c/p\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n### Goals\n* Follows [EIP 1193](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md) Spec\n* Support all transport types (websocket, http, ipc \u0026 injected)\n* Attempt connection to an array of RPC endpoints until successful connection\n* Reconnect when connection is lost\n* Emit helpful status updates so apps can handle changes gracefully\n\n### Install\n```\nnpm install eth-provider --save\n```\n\n### Use\n\n```js\nconst provider = require('eth-provider')\nconst web3 = new Web3(provider())\n```\n* By default, eth-provider will first try to discover providers injected by the environment, usually by a browser or extension\n* If eth-provider fails to find an injected provider it will attempt to connect to local providers running on the user's device like [Frame](https://github.com/floating/frame), Geth or Parity\n* You can override these defaults by passing in your own RPC targets\n```js\nconst provider = require('eth-provider')\nconst web3 = new Web3(provider('wss://sepolia.infura.io/ws/v3/${INFURA_ID}))\n```\n* When passing in multiple RPC targets order them by priority\n* When eth-provider fails to connect to a target it will automatically attempt to connect to the next priority target\n* For example `['injected', 'wss://sepolia.infura.io/ws/v3/${INFURA_ID}']` will first try to discover injected providers and if unsuccessful connect to the Infura endpoint\n```js\nconst provider = require('eth-provider')\nconst web3 = new Web3(provider(['injected', 'wss://sepolia.infura.io/ws/v3/${INFURA_ID}']))\n```\n* In Node and Electron you'll have access to IPC endpoints created by Geth or Parity that cannot be accessed by the Browser. You can connect to these by using the `'direct'` preset, or by passing custom IPC paths\n```js\nconst provider = require('eth-provider')\nconst web3 = new Web3(provider('direct'))\n```\n\n### Presets\n* **`injected`** - Discover providers injected by environment, usually by the browser or a browser extension\n  * Browser\n    * `['injected']`\n* **`frame`** - Connect to [Frame](https://github.com/floating/frame) running on the user's device\n  * Browser/Node/Electron\n    * `['ws://127.0.0.1:1248', 'http://127.0.0.1:1248']`\n* **`direct`** - Connect to local Ethereum nodes running on the user's device\n  * Browser\n    * `['ws://127.0.0.1:8546', 'http://127.0.0.1:8545']`\n  * Node/Electron\n    * `[/* Default IPC paths for platform */, 'ws://127.0.0.1:8546', 'http://127.0.0.1:8545']`\n* **`infura`** - Connect to Mainnet Infura\n  * Browser/Node/Electron\n    * `['wss://mainnet.infura.io/ws/v3/${infuraId}', 'https://mainnet.infura.io/v3/${infuraId}']`\n* **`alchemy`** - Connect to Mainnet Alchemy\n  * Browser/Node/Electron\n    * `['wss://eth-mainnet.ws.alchemyapi.io/v2/${alchemyId}', 'https://eth-mainnet.alchemyapi.io/v2/${alchemyId}']`\n\nView all possible presets [here](https://github.com/floating/eth-provider/blob/master/presets/index.js)\n\nIf you do not pass any targets, eth-provider will use default targets `['injected', 'frame']` in the Browser and `['frame', 'direct']` in Node and Electron.\n\n### Options\n\nWhen creating the provider you can also pass an options object\n\n* `infuraId` - Your projects Infura ID\n* `alchemyId` - Your projects Alchemy ID\n* `origin` - Used when connecting from outside of a browser env to declare the identity of your connection to interfaces like Frame (this currently doesn't work with HTTP connections)\n\n`provider('infura', { infuraId: '123abc' })` or `provider({ origin: 'DappName', infuraId: '123abc' })`\n\nThe origin setting will only be applied when a dapp is connecting to from outside of a browser env. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloating%2Feth-provider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffloating%2Feth-provider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffloating%2Feth-provider/lists"}