{"id":21280832,"url":"https://github.com/consensysmesh/reflux-tx","last_synced_at":"2025-07-11T10:32:56.805Z","repository":{"id":35931321,"uuid":"40219467","full_name":"ConsenSysMesh/reflux-tx","owner":"ConsenSysMesh","description":"Reflux store and a component wrapper to connect React components with Ethereum transaction states","archived":false,"fork":false,"pushed_at":"2016-05-14T22:23:08.000Z","size":1590,"stargazers_count":30,"open_issues_count":0,"forks_count":11,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-11-11T19:41:42.962Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ConsenSysMesh.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}},"created_at":"2015-08-05T02:12:13.000Z","updated_at":"2024-03-06T02:05:57.000Z","dependencies_parsed_at":"2022-09-19T01:32:01.871Z","dependency_job_id":null,"html_url":"https://github.com/ConsenSysMesh/reflux-tx","commit_stats":null,"previous_names":["consensys/reflux-tx"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsenSysMesh%2Freflux-tx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsenSysMesh%2Freflux-tx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsenSysMesh%2Freflux-tx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsenSysMesh%2Freflux-tx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ConsenSysMesh","download_url":"https://codeload.github.com/ConsenSysMesh/reflux-tx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225715945,"owners_count":17512908,"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":[],"created_at":"2024-11-21T10:41:19.434Z","updated_at":"2024-11-21T10:41:20.134Z","avatar_url":"https://github.com/ConsenSysMesh.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"reflux-tx\n============\n\nReflux store \u0026 higher order component for monitoring Ethereum transactions in real-time.\n\n#### Features\n\n* Serverless (excluding eth client)\n* Persistent - uses localstorage, retains state over page refreshes\n* Associate arbitrary data with any transaction\n* Detect chain reorgs and failed transactions\n* States filterable by extra properties you can associate w txs\n* Multiple chain support\n\n\n### TX States\n\n\n  ![states](https://raw.githubusercontent.com/ConsenSys/reflux-tx/enhance/docs/tx_states.png)\n\n\u003cdl\u003e\n  \u003cdt\u003e\u003ch4\u003epending\u003c/h4\u003e\u003c/dt\u003e\n  \u003cdd\u003eTX has been accepted as valid, is waiting for receipt into a valid block\u003c/dd\u003e\n  \u003cdt\u003e\u003ch4\u003ereceived\u003c/h4\u003e\u003c/dt\u003e\n  \u003cdd\u003eTX has been received into a block, is waiting for sufficient confirmation\u003c/dd\u003e\n  \u003cdt\u003e\u003ch4\u003edropped\u003c/h4\u003e\u003c/dt\u003e\n  \u003cdd\u003eTX is dropped when a tx with equal or higher nonce has been received\u003c/dd\u003e\n  \u003cdt\u003e\u003ch4\u003econfirmed\u003c/h4\u003e\u003c/dt\u003e\n  \u003cdd\u003eEnough blocks have passed since receipt to consider the TX confirmed \u0026 a reversion is sufficiently unlikely \u003c/dd\u003e\n  \u003cdt\u003e\u003ch4\u003efailed\u003c/h4\u003e\u003c/dt\u003e\n  \u003cdd\u003eTX is failed when a tx with equal or higher nonce is confirmed\u003c/dd\u003e\n\u003c/dl\u003e\n\n\n## Installation\n\n`npm install reflux-tx`\n\nor for the browserified version which exposes global `refluxTX`:\n\n`\u003cscript type='text/javascript' src='./dist/refluxTX.min.js'\u003e\u003c/script\u003e`\n\n\nIf using with webpack, you'll need these config additions to support localforage:\n\n```\n\tmodule: {\n\t\tnoParse: [ /localforage\\/dist\\/localforage.js/ ],\n\t\tloaders: [ {test: /localforage\\/dist\\/localforage.js/, loader: 'exports?localforage'} ]\n\t},\n\tresolve: {\n\t\talias: { 'localforage': 'localforage/dist/localforage.js' }\n\t}\n\t\n```\n\nUsage\n--------------\n\n#### initialization\nBefore connecting to the store, you must first initialize it in a toplevel component with `TXActions.connect()`. This loads the genesis identifier required for storing any transaction data.\n\nAvailable options\n\n\n\u003cb\u003e versions \u003e= 0.2.0 \u003c/b\u003e\n\nNote: for version 0.2.0 and above, web3 is a required parameter for `TXStore.connect` so the provider option is removed\n\nField Name  | Description | Default\n------------- | ------------- | ------------\nconfirmCount  | Number of blocks before a tx is sufficiently confirmed | 12\nbufferSize  | Max number of resolved transactions (failed + confirmed) to keep in localstorage per-account | 100\n\nExample:\n\n`TXActions.connect(web3, {confirmCount: 10, bufferSize: 5})`\n\n\u003cb\u003e versions \u003c 0.2.0 \u003c/b\u003e\n\nField Name  | Description | Default\n------------- | ------------- | ------------\nprovider  | web3 http provider | assumes already set\nconfirmCount  | Number of blocks before a tx is sufficiently confirmed | 12\nbufferSize  | Max number of resolved transactions (failed + confirmed) to keep in localstorage per-account | 100\n\nExample:\n\n`TXActions.connect({provider: 'http://localhost:8545', confirmCount: 10, bufferSize: 5})`\n\n#### create a transaction\nAdd transaction to TXStore with `TXActions.add(txInfo)` where `txInfo` is an object or array of objects containing at least a `{hash: '0x..'}` property referencing a transaction hash. Any additional properties will be saved and can be used to filter out transactions by arbitrary data.\n\nExample:\n\n```\nTXActions.add({\n\thash: '0x30f42ba1f7d816d850fd172e128ffbacee7564e0cb41cc27c1e9af743aace6bc',\n\ttxType: 'deposit',\n\tparentAddress: '0x26ac60acb581516b175010730a2bcee041bb0099'\n});\n```\n\n#### view transactions\nReact components can use the TXComponent wrapper to inherit the latest `blockNumber`, `timestamp` (block.timesamp), and `blockHash` along with array representations of each transaction state as its properties.\n\nTransaction state objects have 3 possible fields\n\nField Name  | Value | In tx states\n------------- | ------------- | ------------\ninfo  | txInfo added via TXActions.add() | *\ndata  | object returned from `web3.eth.getTransaction` | *\nreceipt | object returned from `web3.eth.getTransactionReceipt` | pending, received, confirmed\n\n\n\nExample:\n\n```\n\trender() {\n\t\t\u003cTXComponent filter={{txType: 'deposit'}} \u003e\n\t\t\t\u003cMyComponent /\u003e\n\t\t\u003c/TXComponent\u003e\n\t}\n```\nWould be represented in MyComponent as \n\n```\nconsole.log(this.props.received)\n[{info: {...}, receipt: {...}, data: {...}}, ...]\n\nconsole.log(this.props.confirmed)\n[{info: {...}, receipt: {...}, data: {...}}, ...]\n\nconsole.log(this.props.pending)\n[{info: {...}, data: {...}}, ...]\n\nconsole.log(this.props.dropped)\n[{info: {...}, data: {...}}, ...]\n\nconsole.log(this.props.failed)\n[{info: {...}, data: {...}}, ...]\n\nconsole.log(this.props.blockNumber)\n30000\n```\n\n### Example\nFor another example check out [reflux-tx-example](https://github.com/ckeenan/reflux-tx-example)\n\n### Notes\n\nreflux-tx will only subscribe to new block info when it's needed for tx confirmations. For that reason, a component's block properties (blockNumber, timestamp, blockHash) will update only while you have pending or received transactions matching the wrapping TXComponent's `filter` and `keys`.\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsensysmesh%2Freflux-tx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconsensysmesh%2Freflux-tx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsensysmesh%2Freflux-tx/lists"}