{"_id":"@agilie/electrum-proxy-middleware","_rev":"9-43d2abf2bb2fd1744b9959ecb0aa3d23","name":"@agilie/electrum-proxy-middleware","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.1":{"name":"@agilie/electrum-proxy-middleware","version":"1.0.1","description":"# Electrum Proxy Middleware","main":"dist/src/index.js","scripts":{"test":"jest","docs":"swagger-jsdoc -d swaggerfile.js","tsc":"tsc","lint":"tslint"},"repository":{"type":"git","url":"git+https://github.com/agilie/electrum-proxy-middleware.git"},"keywords":["Electrum","ExpressJS","middleware","proxy"],"author":{"name":"Agilie"},"license":"MIT","bugs":{"url":"https://github.com/agilie/electrum-proxy-middleware/issues"},"homepage":"https://github.com/agilie/electrum-proxy-middleware#readme","dependencies":{"@dashevo/dashcore-lib":"^0.17.9","bitcore-lib":"^8.3.4","class-transformer":"^0.2.3","class-validator":"^0.10.0","execution-time":"^1.3.0","express-async-router":"^0.1.15","reflect-metadata":"^0.1.13","zcash-bitcore-lib":"^0.13.20-rc3"},"devDependencies":{"@types/express":"^4.17.1","@types/jest":"^24.0.18","@types/node":"^12.7.4","codelyzer":"^5.1.0","jest":"^24.9.0","js-sha256":"^0.9.0","rxjs":"^6.5.3","service":"^0.1.4","supertest":"^4.0.2","ts-jest":"^24.1.0","ts-node":"^8.4.1","tslint":"^5.19.0","typescript":"^3.6.2","@types/supertest":"^2.0.8"},"gitHead":"16539d1fd8195a330bff7d7cb2d6c0d41eeff144","_id":"@agilie/electrum-proxy-middleware@1.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.15.0","_npmUser":{"name":"agilie-admin","email":"web@agilie.com"},"dist":{"integrity":"sha512-s98+QxW9VlK7Dj9w1AWujJSgdcpEG1tQaWFQVhNJvIJPJEU5ephYcRS9+do45KYn8elQt5yeX3CNtWTIrHIRHw==","shasum":"3c436c1f542d850005b5bb311d1e0f6d4b455a8e","tarball":"https://registry.npmjs.org/@agilie/electrum-proxy-middleware/-/electrum-proxy-middleware-1.0.1.tgz","fileCount":105,"unpackedSize":321857,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd53+vCRA9TVsSAnZWagAAKZkQAJYKjidrROR+0CHcZuwl\nr64LbfjNVWe+AlK2xjvuL+LH2e/y91n7iamcF2NDlS+anRP2FF6DJzNsIjuK\nwFlbhdWEzijleC8TL/EzDbsI+k9C7ZL3qR0KB/+o7fLSyatBxM/vf0rQqu/z\nXgycQdzFDWgyWiR5DK7r4PjeQDiGqdSvq8nam9VXrVymCnzpJaB/RIeVEL9+\nYDOLwpmMGnCEer4Fbnlo06zmmsV+J4AYDGM4BLE760Jk8tDO+PsdwNLcDIXU\n5Vs5y9gCxY4bdjPxciOBUSx8ah8UDojXSMD6sV0JvBLg73gZIGzT283O+Bpe\nhXL/aDkoOee4WXztIuGAOLKR/9frUMtEJOdXV3y1e4WilzmQdLbSkO5wlfRp\nXeR1CQMPZRuwIu5imdqkf/+0doPWExUbmEvfjWJ1UEQRlThdLnqVeDlIW/H5\nCp/l0kyzHH9JfPI4DpdGSoQ3vOxFxaoSGm71qg+Qxh22niiyDWLDvFqDRS+L\nwJjQ9KaaJqxLSG3KFRbRDSTrA43igtiYsLqCCHthdQ6dNM9AEWR72A6RIFDn\noSuddtoGH5DTnzFOMEAwjCnzm640g27vlu7Pj8p1zJipzKSKS5W1WkVHP0g7\nIfyGATznIduQvTNEzKylVDu4XsE4NPyqXjx0mXDI+gwx9WGESCOqqg5BbPG4\nSKe7\r\n=Q4Jt\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEClcNwWcg6qEGSl04jfaa84j++echK08QOEuAV4y+FOAiAPVv39O01beeB1rAtFnSWQgYlaPhVW2XJRMiNRRka2ig=="}]},"maintainers":[{"name":"agilie-admin","email":"web@agilie.com"},{"name":"fargo23","email":"bohdan.zolotukhin@agilie.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electrum-proxy-middleware_1.0.1_1575452591208_0.08751020856098068"},"_hasShrinkwrap":false},"1.0.2":{"name":"@agilie/electrum-proxy-middleware","version":"1.0.2","description":"# Electrum Proxy Middleware","main":"dist/src/index.js","scripts":{"test":"jest","docs":"swagger-jsdoc -d swaggerfile.js","tsc":"tsc","lint":"tslint"},"repository":{"type":"git","url":"git+https://github.com/agilie/electrum-proxy-middleware.git"},"keywords":["Electrum","ExpressJS","middleware","proxy"],"author":{"name":"Agilie"},"license":"MIT","bugs":{"url":"https://github.com/agilie/electrum-proxy-middleware/issues"},"homepage":"https://github.com/agilie/electrum-proxy-middleware#readme","dependencies":{"@dashevo/dashcore-lib":"^0.17.9","bitcore-lib":"^8.3.4","class-transformer":"^0.2.3","class-validator":"^0.10.0","execution-time":"^1.3.0","express-async-router":"^0.1.15","reflect-metadata":"^0.1.13","zcash-bitcore-lib":"^0.13.20-rc3"},"devDependencies":{"@types/express":"^4.17.1","@types/jest":"^24.0.18","@types/node":"^12.7.4","codelyzer":"^5.1.0","jest":"^24.9.0","js-sha256":"^0.9.0","rxjs":"^6.5.3","service":"^0.1.4","supertest":"^4.0.2","ts-jest":"^24.1.0","ts-node":"^8.4.1","tslint":"^5.19.0","typescript":"^3.6.2","@types/supertest":"^2.0.8"},"gitHead":"e729d28ae789ed71f6da8442b92aa1817f8d4bb5","_id":"@agilie/electrum-proxy-middleware@1.0.2","_nodeVersion":"12.12.0","_npmVersion":"6.11.3","dist":{"integrity":"sha512-y5Om/FZeOLSuz59KRM3jG+EzZaCdIn1fq18/mqr5Kl6zjweM4OSR1NqeLDCUFzdsFUMvCUpo2xd5pEXR6YClsw==","shasum":"816c1e4ddf88875b3e402de49c10d104afe8b5dd","tarball":"https://registry.npmjs.org/@agilie/electrum-proxy-middleware/-/electrum-proxy-middleware-1.0.2.tgz","fileCount":109,"unpackedSize":334180,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd77QNCRA9TVsSAnZWagAArXUP/jRAJEYqAiwCxKvsQ+6M\nuvxHTw6aXV29NIEZvCEAOza/CAoUeHY6ieHWunezhx7hS18o1C0WacwGuoVk\n2xXYTv8DC5V6sS8LRveGJbEmoD+CTraKlydcO19tsp+RLWRJabAGHKrHc0PT\nDHDgH//hSnXTk5AR536hbklLfooLwGEVk5PQ0ULOTyo22ODZpYoJjLxs/nye\nAt9z+I3zwxFRmVxnUZpUQ97H36RGuUOxEornhi1gR358g3boWpglrQxRcurh\n5MUo5hk8wRjn7Et5EEPlQ2IhpTzI947I3fR4peDXzID6rq2OtCMyeujbRyXz\nu7cJPopKRgltOKbDKq7x8LA/LQOYpXBFo9B9Nh3IEGxvKnCtg6s8JTlYwTCR\n6EU2KYcvx8VW8eu336xlR/Kf/WEcQwviVoae8YqKfhmUdg8kNtP9TpDilWW5\nZSAfbwYMhxczm+yJAWJaEGWFkBXTkPLYtyqzpftOjahVxf/S1SPcFFITNEHF\nTEY7P0eYChDVlCA6ooZ2aqrDte2Hu7EtS/3y/GdCOT+da0eYoIfgD+jvErxz\nRTfCStqEnFvyA+Gtpf24W9nh7noYuZUminv1EX2scRKIQO++/yfp7av1PeUG\nHLFlSpD5NTHlREHLNT1tOE0D8lT6RIxZkYrwSaWDD2LQHrLseH32Gq4s3A+Z\nOF/y\r\n=5MEC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD1a92rTFIVs5XoXuvfcT2R8WLYJ2UHEoICxqLaikjXRwIgUYljYjuAQndATg3SJcUbmn+CKBSt2aYgB/Ex8zUwxfc="}]},"maintainers":[{"email":"web@agilie.com","name":"agilie-admin"},{"email":"viktor.pichkur@agilie.com","name":"victor_p"}],"_npmUser":{"name":"agilie-admin","email":"web@agilie.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/electrum-proxy-middleware_1.0.2_1575990285123_0.9306758187410809"},"_hasShrinkwrap":false}},"time":{"created":"2019-12-04T09:43:11.026Z","1.0.1":"2019-12-04T09:43:11.394Z","modified":"2022-04-04T11:59:34.506Z","1.0.2":"2019-12-10T15:04:45.296Z"},"maintainers":[{"email":"sergey.mell@agilie.com","name":"sergey.mell"},{"email":"web@agilie.com","name":"agilie-admin"}],"description":"# Electrum Proxy Middleware","homepage":"https://github.com/agilie/electrum-proxy-middleware#readme","keywords":["Electrum","ExpressJS","middleware","proxy"],"repository":{"type":"git","url":"git+https://github.com/agilie/electrum-proxy-middleware.git"},"author":{"name":"Agilie"},"bugs":{"url":"https://github.com/agilie/electrum-proxy-middleware/issues"},"license":"MIT","readme":"# README\n\n# Electrum Proxy Middleware\n\nExpressJS middleware to add functionality for proxying requests to Electrum servers\n\n## Agenda\nWeb applications can't communicate with electrum servers. This package provide ability to make requests to them.\n\n- [Requirements](#requirements)\n- [Getting started](#getting_started)\n- [Running the tests](#running_test)\n- [Supported calls](#supported_calls)\n    - [Server methods](#server_methods)\n    - [Getting history](https://github.com/agilie/electrum-proxy-middleware/blob/master/history.md)\n    - [Blockchain methods](#blockchain_methods)\n    - [Getting history](#getting_history)\n    - [Mempool methods](#mempool_methods)\n    - [Scripthash methods](#scripthash_methods)\n    - [Transaction methods](#transaction_methods)\n\n- [Examples](#examples)\n\n- [License](#license)\n\n<a name=\"requirements\"></a>\n## Requirements\n\nNode >= 7.x\n\n<a name=\"getting_started\"></a> \n## Getting started\n\n```\nnpm install @agilie/electrum-proxy-middleware\n```\n\n```\nconst electrum = require('@agilie/electrum-proxy-middleware');\n\napp.use(electrum.router);\n\napp.listen(3000)\n```\n\n```\ncurl -X GET http://localhost:3000/server/version?coinType=btc\n> {\"status\":\"success\",\"result\":[\"ElectrumX 1.13.0\",\"1.4\"]}\n\nor\n\ncurl -X GET 'http://localhost:3000/server/version?port=55002&host=tn.not.fyi&connectionType=ssl&version=1.4'\n> {\"status\":\"success\",\"result\":[\"ElectrumX 1.13.0\",\"1.4\"]}\n```\n\n<a name=\"running_test\"></a> \n## Running the tests\n\n```\nnpm test\n```\n\n<a name=\"supported_calls\"></a> \n## Supported calls\n\nAll calls are required to have a coinType param or at least host, port, connectionType and version params.\n\n\nParam | Value\n------------ | -------------\n**coinType** (required) | [supported coin types](https://github.com/agilie/electrum-proxy-middleware/blob/master/src/service/wallet/types/coin.type.ts)\n**netMode** | **mainnet**(by default) or **testnet**\n\nor\n\nParam | Value\n------------ | -------------\n**host** (required) | e.g. **tn.not.fyi**\n**port** (required)| e.g. **55002**\n**connectionType** (required) | **ssl** or **tcp**\n**version** (required) | e.g **1.4**\n**netMode** | **mainnet** (by default) or **testnet**\n\n<a name=\"server_methods\"></a> \n### Server methods\n#### [GET] /server/version eq. to server.version\n#### [GET] /server/features eq. to server.features\n#### [GET] /server/banner eq. to server.banner\n#### [GET] /server/donation-address eq. to server.donation_address\n#### [GET] /server/add_peer eq. to server.add_peer\n#### [GET] /server/get-peers eq. to server.peers.subscribe\n#### [GET] /server/ping eq. to server.ping\n**Example:** */server/version?coinType=btc*\n\n<a name=\"blockchain_methods\"></a> \n### Blockchain methods\n#### [GET] /block/header eq. to blockchain.block.header\nAdditional params:\n\nParam  | Type | Description\n------------ | ------------- | -------------\nversion | Float | server version\nheight | non-negative integer | the height of the block\n\n**Example:** */block/header?coinType=btc&height=5*\n#### [GET] /block/headers eq. to blockchain.block.headers\nAdditional params: start_height - the height of the first header requested, count - the number of headers requested.  \n**Example:** */block/headers?&coinType=btc&start_height=5&count=1*\n#### [GET] /blockchain/estimatefee eq. to blockchain.estimatefee\nAdditional params:\n\nParam | Description\n------------ | -------------\nblocks |  the number of blocks to target for confirmation\n\n**Example:** */blockchain/estimatefee?coinType=btc&blocks=1*\n#### [GET] /blockchain/relayfee eq. to blockchain.relayfee\nExample: */blockchain/relayfee?coinType=btc*\n\n<a name=\"mempool_methods\"></a>\n### Mempool methods\n#### [GET] /mempool/get_fee_histogram eq. to mempool.get_fee_histogram\n**Example:** */mempool/get_fee_histogram?coinType=btc*\n\n<a name=\"scripthash_methods\"></a>\n### Scripthash methods\n\nParam | Type | Description\n------------ | ------------- | -------------\nscripthash |hexadecimal string |  script hash \n\n#### [GET] /scripthash/balance eq. to blockchain.scripthash.get_balance\n#### [GET] /scripthash/listunspent eq. to blockchain.scripthash.listunspent\n#### [GET] /scripthash/get_history eq. to blockchain.scripthash.get_history\n#### [GET] /scripthash/get_mempool eq. to blockchain.scripthash.get_mempool\n**Example:** */scripthash/balance?scripthash=20b360e68b4fe6d1eb460e45434f756fa1582ed687167898f9a716435ecd737f&coinType=btc*\n\n<a name=\"transaction_methods\"></a>\n### Transaction methods\n#### [POST] /transaction/broadcast eq. to blockchain.transaction.broadcast\nAdditional params:\n\nParam | Type | Description\n------------ | ------------- | -------------\nraw_tx |  hexadecimal string | raw transaction\n\n#### [GET] /transaction/get eq. to blockchain.transaction.get\nAdditional params: \n\nParam | Type | Description\n------------ | ------------- | -------------\ntx_hash | hexadecimal string | transaction hash\n verbose | boolean | whether a verbose coin-specific response is required\n \n**Example:** */transaction/get?tx_hash=871af2528c83ba90bd7b3fbfeac703cbd20f204f1b800ba4ec748842fcac0c9b&coinType=btc*\n#### [GET] /transaction/get-merkle eq. to blockchain.transaction.get_merkle\nAdditional params:\n\nParam | Type | Description\n------------ | ------------- | -------------\ntx_hash | hexadecimal string | raw transaction\nheight | integer | the height at which it was confirmed\n\n#### [GET] /transaction/id-from-pos eq. to blockchain.transaction.id_from_pos\nAdditional params:\n\nParam | Type | Description\n------------ | ------------- | -------------\nheight |  non-negative integer | the main chain block height\ntx_pos | integer | a zero-based index of the transaction in the given block\nmerkle | boolean | whether a merkle proof should also be returned\n\n### Getting history\n [Getting history](https://github.com/agilie/electrum-proxy-middleware/blob/master/history.md) docs.\n\n<br/>\n\nFor more details, refer to the [ElectrumX Protocol Methods](https://electrumx.readthedocs.io/en/latest/protocol-methods.html) docs.\n\n<a name=\"examples\"></a>\n## Examples\n Here are some basic examples. \n\n#### Protocol version\n  \n* **URL**\n\n  <_/server/version?coinType=btc_>\n\n* **Method:**\n\n  `GET`\n  \n*  **URL Params**\n\n\n   **Required:**\n \n   `coinType=[CoinType]`\n\n   **Optional:**\n \n   `netMode=[Netmode]`\n\n* **Success Response:**\n  \n  * **Code:** 200 <br />\n  *  **Content:** \n    <pre>  {\n        \"status\":\"success\",\"result\":[\"ElectrumX 1.13.0\",\"1.4\"]\n    }</pre>\n \n* **Error Response:**\n\n  * **Code:** 409 <br />\n  *  **Content:** \n    <pre>{\n        \"error\": [{\n            \"target\": {\n                \"netMode\": \"mainnet\",\n                \"coinType\": \"etc\"\n            },\n            \"value\": \"etc\",\n            \"property\": \"coinType\",\n            \"children\": [],\n            \"constraints\": {\n                \"isEnum\": \"coinType must be a valid enum value\"\n            }\n        }]\n    }</pre>\n\n\nOr you can specify electrum server:\n\n  \n* **URL**\n\n  <_/server/version?port=55002&host=tn.not.fyi&connectionType=ssl&version=1.4_>\n\n* **Method:**\n\n  `GET`\n  \n*  **URL Params**\n\n\n   **Required:**\n \n   `port=[integer]`\n   \n   `host=[string]`\n   \n   `connectionType=[ssl | tcp]`\n   \n   `version=[server version]`\n\n   **Optional:**\n \n   `netMode=[testnet | mainnet]`\n\n\n#### Confirmed and unconfirmed history of a script hash.\n\n* **URL**\n\n  <_/history/get_history?address=1BWwXJH3q6PRsizBkSGm2Uw4Sz1urZ5sCj&coinType=btc&page=1&pageSize=2_>\n\n* **Method:**\n\n  `GET`\n  \n*  **URL Params**\n\n\n   **Required:**\n \n   `coinType=[CoinType]`\n   \n   `address=[string]`\n\n   **Optional:**\n \n   `netMode=[Netmode]`\n   \n   `page=[number]`\n   \n   `pageSize=[number]`\n\n* **Success Response:**\n  \n  * **Code:** 200 <br />\n  *  **Content:** \n    <pre>\n    {\n      \"status\": \"success\",\n      \"result\": [{\n          \"value\": \"0.0002\",\n          \"timestamp\": 1399325126000,\n          \"fee\": \"0.0001\",\n          \"status\": \"completed\"\n      }, {\n          \"value\": \"0.00011\",\n          \"timestamp\": 1399325126000,\n          \"fee\": \"0.0001\",\n          \"status\": \"completed\"\n      }],\n       \"time\": 336.57917699999996\n    }</pre>\n \n* **Error Response:**\n\n  * **Code:** 409 <br />\n  *  **Content:** \n    <pre>{\n        \"error\": [{\n            \"target\": {\n                \"netMode\": \"test\",\n                \"address\": \"8b01df4e368ea28f8dc0423bcf77a4923e3a12d307c875e47a0cfbf90b5c39161\",\n                \"coinType\": \"btc\",\n                \"page\": \"1\",\n                \"pageSize\": \"2\"\n            },\n            \"value\": \"test\",\n            \"property\": \"netMode\",\n            \"children\": [],\n            \"constraints\": {\n                \"isEnum\": \"netMode must be a valid enum value\"\n            }\n        }]\n    }</pre>\n\n<a name=\"license\"></a>\n## License\nThe MIT License (MIT). Full license text is available in [LICENSE](https://github.com/agilie/electrum-proxy-middleware/blob/master/LICENSE.md).\n","readmeFilename":"README.md"}