{"id":19162514,"url":"https://github.com/salmandabbakuti/web3-plugin-superfluid","last_synced_at":"2026-02-15T22:32:59.138Z","repository":{"id":209309343,"uuid":"699288303","full_name":"Salmandabbakuti/web3-plugin-superfluid","owner":"Salmandabbakuti","description":"Web3js plugin for Superfluid Protocol","archived":false,"fork":false,"pushed_at":"2025-02-01T07:14:43.000Z","size":55,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-10-02T16:37:37.872Z","etag":null,"topics":["defi","superfluid-finance","web3-plugin","web3js"],"latest_commit_sha":null,"homepage":"https://tsdocs.dev/docs/web3-plugin-superfluid/0.2.7/classes/SuperfluidPlugin.html#cfav1","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/Salmandabbakuti.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":"2023-10-02T10:34:34.000Z","updated_at":"2025-02-01T07:14:47.000Z","dependencies_parsed_at":"2023-11-26T16:23:53.295Z","dependency_job_id":"e60c56b2-95df-4714-9ed7-e8609300dfac","html_url":"https://github.com/Salmandabbakuti/web3-plugin-superfluid","commit_stats":null,"previous_names":["salmandabbakuti/web3-plugin-superfluid"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/Salmandabbakuti/web3-plugin-superfluid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Salmandabbakuti%2Fweb3-plugin-superfluid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Salmandabbakuti%2Fweb3-plugin-superfluid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Salmandabbakuti%2Fweb3-plugin-superfluid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Salmandabbakuti%2Fweb3-plugin-superfluid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Salmandabbakuti","download_url":"https://codeload.github.com/Salmandabbakuti/web3-plugin-superfluid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Salmandabbakuti%2Fweb3-plugin-superfluid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29490910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T19:29:10.908Z","status":"ssl_error","status_checked_at":"2026-02-15T19:29:10.419Z","response_time":118,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["defi","superfluid-finance","web3-plugin","web3js"],"created_at":"2024-11-09T09:11:37.344Z","updated_at":"2026-02-15T22:32:59.124Z","avatar_url":"https://github.com/Salmandabbakuti.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Superfluid Web3 Plugin\n\n[![npm version](https://img.shields.io/badge/npm-0.2.8-brightgreen)](https://www.npmjs.com/package/web3-plugin-superfluid)\n\nThe Superfluid Web3.js Plugin extends the capabilities of the Web3.js library to interact seamlessly with the [Superfluid Protocol](https://superfluid.finance). This plugin provides convenient methods for interacting with the Superfluid protocol contracts.\n\n#### Supported Features:\n\n- [Money Streaming(CFA)](https://docs.superfluid.finance/superfluid/developers/constant-flow-agreement-cfa)\n\n- [Superfluid Host](https://docs.superfluid.finance/superfluid/protocol-overview/in-depth-overview/superfluid-host)\n\n- [Distributions(IDA)](https://docs.superfluid.finance/superfluid/developers/instant-distribution-agreement-ida)\n\n## Installation\n\n\u003e Note: Make sure you are using `web3` version 4.0.3 or higher in your project.\n\n```bash\nnpm install web3-plugin-superfluid web3@latest --save\n```\n\n## Usage\n\n### Basic Usage\n\n```js\nimport { Web3 } from \"web3\";\nimport { SuperfluidPlugin } from \"web3-plugin-superfluid\";\n\nconst web3 = new Web3(\"https://rpc-mumbai.maticvigil.com\"); // Any RPC node you wanted to connect with\nweb3.registerPlugin(new SuperfluidPlugin());\n\n// Getting contract addresses of the network\nconst addresses = web3.superfluid.contractAddresses(80001); // chainId of the network\n\n// Contract Instances\nconst cfav1Forwarder = web3.superfluid.cfav1Forwarder(addresses.cfaV1Forwarder);\nconst cfav1 = web3.superfluid.cfav1(addresses.cfaV1);\nconst host = web3.superfluid.host(addresses.host);\nconst idav1 = web3.superfluid.idav1(addresses.idaV1);\n\nconst token = \"0x5d8b4c2554aeb7e86f387b4d6c00ac33499ed01f\"; //fDAIx on Mumbai\nconst sender = \"0xc7203561EF179333005a9b81215092413aB86aE9\";\nconst receiver = \"0x7348943C8d263ea253c0541656c36b88becD77B9\";\n\n// Getting FlowRate with cfav1Forwarder\nconst flowRate = await cfav1Forwarder.methods\n  .getFlowRate(token, sender, receiver)\n  .call();\n\nconsole.log(\"FlowRate: \", flowRate.toString());\n\n// Getting Flow Info with cfav1\nconst flow = await cfav1.methods.getFlow(token, sender, receiver).call();\n\nconsole.log(\"Flow Info: \", flow);\n```\n\n### Connecting Accounts to Web3\n\n```js\nimport { Web3 } from \"web3\";\nimport { SuperfluidPlugin } from \"web3-plugin-superfluid\";\n\n// With any RPC node and private key\nconst web3 = new Web3(\"https://rpc-mumbai.maticvigil.com/\");\nconst wallet = web3.eth.accounts.wallet.add(\"0x...\"); // Private Key\nconst { address: account } = wallet[0];\n\n// or with browser wallets\nconst web3 = new Web3(window.ethereum);\nconst [account] = await window.ethereum.request({\n  method: \"eth_requestAccounts\"\n});\n\nweb3.registerPlugin(new SuperfluidPlugin());\n\n// Getting contract addresses of the network\nconst addresses = web3.superfluid.contractAddresses(80001); // chainId of the network\n\n// Contract Instances\nconst cfav1Forwarder = web3.superfluid.cfav1Forwarder(addresses.cfaV1Forwarder);\nconst cfav1 = web3.superfluid.cfav1(addresses.cfaV1);\nconst host = web3.superfluid.host(addresses.host);\nconst idav1 = web3.superfluid.idav1(addresses.idaV1);\n```\n\n### Money Streaming(CFA):\n\n#### Creating flow:\n\n```js\n// using cfav1forwarder\nconst tx = await cfav1Forwarder.methods\n  .createFlow(token, sender, receiver, flowRate, \"0x\")\n  .send({ from: account });\n\n// using host\nconst callData = cfav1.methods\n  .createFlow(token, receiver, flowRate, \"0x\")\n  .encodeABI();\n\nconst tx = await host.methods\n  .callAgreement(cfav1Address, callData, \"0x\")\n  .send({ from: account });\n```\n\n#### Updating flow:\n\n```js\n// using cfav1forwarder\nconst tx = await cfav1Forwarder.methods\n  .updateFlow(token, sender, receiver, flowRate, \"0x\")\n  .send({ from: account });\n\n// using host\nconst callData = cfav1.methods\n  .updateFlow(token, receiver, flowRate, \"0x\")\n  .encodeABI();\n\nconst tx = await host.methods\n  .callAgreement(cfav1Address, callData, \"0x\")\n  .send({ from: account });\n```\n\n#### Deleting flow:\n\n```js\n// using cfav1forwarder\nconst tx = await cfav1Forwarder.methods\n  .deleteFlow(token, sender, receiver, \"0x\")\n  .send({ from: account });\n\n// using host\nconst callData = cfav1.methods\n  .deleteFlow(token, sender, receiver, \"0x\")\n  .encodeABI();\n\nconst tx = await host.methods\n  .callAgreement(cfav1Address, callData, \"0x\")\n  .send({ from: account });\n```\n\n#### Retrieving flow:\n\n```js\n// with cfav1forwarder\nconst flow = await cfav1Forwarder.methods\n  .getFlowInfo(token, sender, receiver)\n  .call();\n\n// with cfav1\nconst flow = await cfav1.methods.getFlow(token, sender, receiver).call();\n```\n\nRefer [Superfluid CFA docs](https://docs.superfluid.finance/superfluid/developers/constant-flow-agreement-cfa) for more on respective contract methods.\n\n### Distributions(IDA):\n\n#### Creating Index:\n\n```js\nconst callData = idav1.methods.createIndex(token, indexId, \"0x\").encodeABI();\n\nconst tx = await host.methods\n  .callAgreement(idav1Address, callData, \"0x\")\n  .send({ from: account });\n```\n\n#### Getting Subscription:\n\n```js\nconst { units, exist, approved } = await idav1.methods\n  .getSubscription(token, publisher, indexId, subscriber)\n  .call();\n```\n\n#### Getting Index:\n\n```js\nconst { exist, totalUnitsApproved, totalUnitsPending } = await idav1.methods\n  .getIndex(token, publisher, indexId)\n  .call();\n```\n\nRefer [Superfluid IDA docs](https://docs.superfluid.finance/superfluid/developers/instant-distribution-agreement-ida) for more on respective contract methods.\n\n### Publishing\n\nTo publish a new version of the package to npm, run the following command:\n\n```bash\nnpm run build\n\nnpm publish\n```\n\n## Change Log\n\n#### 0.2.8\n\n- Chore(deps): Dependencies update\n- Updated tests for sepolia testnet\n\n#### 0.2.7\n\n- Added example to show how to use the plugin in a react app\n- Few tsdoc improvements\n- Updated dependencies\n\n#### 0.2.6\n\n- Added handy `contractAddresses` method to get contract addresses of the network\n- Updated tests and README.md examples with `contractAddresses` method\n\n#### 0.2.5\n\n- Updated README.md examples and TSDoc\n\n#### 0.2.3\n\n- Using jest for tests instead of mocha\n- Added tests for invalid address to cfav1Forwarder, cfav1, idav1, host\n\n#### 0.2.1\n\n- Updated README.md examples and docs\n\n#### 0.2.0\n\n- Added support for IDAv1 contract\n- IDAv1 examples, tests, and docs\n\n#### 0.1.0\n\n- Added support for CFAv1 contract\n- Added examples on encoding calldata with cfav1 contract for creating, updating, deleting in host's callAgreement method\n\n#### 0.0.9\n\n- Added examples for creating, updating, deleting, and retrieving flows using CFAv1Forwarder and Host contracts\n- Added examples for connecting accounts to web3 using private key and metamask\n\n#### 0.0.8\n\n- cfav1Forwarder, host contract type exports, function natspec comments\n- Tests Cleanup and refactoring\n\n#### 0.0.7\n\n- Fixed Types not being interpreted correctly, Plugin named export\n\n#### 0.0.1\n\n- Added support for CFAv1Forwarder and Host contracts\n\n## Resources\n\n- [Superfluid Documentation](https://docs.superfluid.finance)\n- [Web3js Plugins Documentation](https://docs.web3js.org/guides/web3_plugin_guide/)\n\n## Safety\n\nThis is experimental software and subject to change over time.\n\nThis package is not audited and has not been tested for security. Use at your own risk.\nI do not give any warranties and will not be liable for any loss incurred through any use of this codebase.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalmandabbakuti%2Fweb3-plugin-superfluid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsalmandabbakuti%2Fweb3-plugin-superfluid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsalmandabbakuti%2Fweb3-plugin-superfluid/lists"}