From 81937ff61fcce63b3e2988a1ef77e1fadc1b3a83 Mon Sep 17 00:00:00 2001 From: Lautaro Dragan Date: Mon, 2 Dec 2019 18:31:47 -0300 Subject: [PATCH] feat(EthereumRegistryWriter): onCidAdded + transaction receipts (#953) --- package-lock.json | 480 ++++++++++-------- package.json | 5 +- src/Configuration.ts | 4 + src/EthereumRegistryWriter/Business.ts | 175 ++++++- .../EthereumRegistryWriter.ts | 12 + src/EthereumRegistryWriter/Router.ts | 40 ++ src/EthereumRegistryWriter/Scheduler.ts | 18 +- src/EthereumRegistryWriter/index.ts | 2 + src/Helpers/EthereumRegistryContract.ts | 58 ++- src/Helpers/EthereumRegistryContractAbi.ts | 17 + src/Helpers/asyncPipe.ts | 2 + 11 files changed, 557 insertions(+), 256 deletions(-) diff --git a/package-lock.json b/package-lock.json index ae729e0b..1014db62 100644 --- a/package-lock.json +++ b/package-lock.json @@ -921,6 +921,14 @@ "resolved": "http://registry.npmjs.org/@types/base-x/-/base-x-1.0.29.tgz", "integrity": "sha1-ii1z5KXDEhdXpfiHDPpFCWVRhrY=" }, + "@types/bignumber.js": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@types/bignumber.js/-/bignumber.js-5.0.0.tgz", + "integrity": "sha512-0DH7aPGCClywOFaxxjE6UwpN2kQYe9LwuDQMv+zYA97j5GkOMo8e66LYT+a8JYU7jfmUFRZLa9KycxHDsKXJCA==", + "requires": { + "bignumber.js": "*" + } + }, "@types/bluebird": { "version": "3.5.24", "resolved": "https://registry.npmjs.org/@types/bluebird/-/bluebird-3.5.24.tgz", @@ -1109,6 +1117,12 @@ "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.0.tgz", "integrity": "sha512-1w52Nyx4Gq47uuu0EVcsHBxZFJgurQ+rTKS3qMHxR1GY2T8c2AJYd6vZoZ9q1rupaDjU0yT+Jc2XTyXkjeMA+Q==" }, + "@types/luxon": { + "version": "1.21.0", + "resolved": "https://registry.npmjs.org/@types/luxon/-/luxon-1.21.0.tgz", + "integrity": "sha512-Zhrf65tpjOlVIYrUhX9eu1VzRo8iixQDLFPbfqFxPpG4pBTNNPZ2BFhYE0IAsDfW9GWg+RcrUqiLwrGJH4rq4w==", + "dev": true + }, "@types/mime": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.0.tgz", @@ -1184,6 +1198,41 @@ "uuid": "^3.0.1" } }, + "@web3-js/scrypt-shim": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@web3-js/scrypt-shim/-/scrypt-shim-0.1.0.tgz", + "integrity": "sha512-ZtZeWCc/s0nMcdx/+rZwY1EcuRdemOK9ag21ty9UsHkFxsNb/AaoucUz0iPuyGe0Ku+PFuRmWZG7Z7462p9xPw==", + "requires": { + "scryptsy": "^2.1.0", + "semver": "^6.3.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" + } + } + }, + "@web3-js/websocket": { + "version": "1.0.30", + "resolved": "https://registry.npmjs.org/@web3-js/websocket/-/websocket-1.0.30.tgz", + "integrity": "sha512-fDwrD47MiDrzcJdSeTLF75aCcxVVt8B1N74rA+vh2XCAvFy4tEWJjtnUtj2QG7/zlQ6g9cQ88bZFBxwd9/FmtA==", + "requires": { + "debug": "^2.2.0", + "es5-ext": "^0.10.50", + "nan": "^2.14.0", + "typedarray-to-buffer": "^3.1.5", + "yaeti": "^0.0.6" + }, + "dependencies": { + "nan": { + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" + } + } + }, "JSONStream": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", @@ -1923,16 +1972,16 @@ } }, "mime-db": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" + "version": "1.42.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.42.0.tgz", + "integrity": "sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ==" }, "mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "version": "2.1.25", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.25.tgz", + "integrity": "sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg==", "requires": { - "mime-db": "1.40.0" + "mime-db": "1.42.0" } }, "qs": { @@ -3094,6 +3143,7 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, "requires": { "object-keys": "^1.0.12" } @@ -3172,9 +3222,9 @@ "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" }, "des.js": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", - "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.1.tgz", + "integrity": "sha512-Q0I4pfFrv2VPd34/vfLrFOoRmlYj3OV50i7fskps1jZWK1kApMWWT9G6RRUeYedLcBDIhnSDaUvJMb3AhUlaEA==", "requires": { "inherits": "^2.0.1", "minimalistic-assert": "^1.0.0" @@ -3420,6 +3470,7 @@ "version": "1.12.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", + "dev": true, "requires": { "es-to-primitive": "^1.1.1", "function-bind": "^1.1.1", @@ -3432,6 +3483,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.0.tgz", "integrity": "sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg==", + "dev": true, "requires": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", @@ -3558,9 +3610,9 @@ } }, "ethereumjs-common": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/ethereumjs-common/-/ethereumjs-common-1.3.2.tgz", - "integrity": "sha512-GkltYRIqBLzaZLmF/K3E+g9lZ4O4FL+TtpisAlD3N+UVlR+mrtoG+TvxavqVa6PwOY4nKIEMe5pl6MrTio3Lww==" + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ethereumjs-common/-/ethereumjs-common-1.4.0.tgz", + "integrity": "sha512-ser2SAplX/YI5W2AnzU8wmSjKRy4KQd4uxInJ36BzjS3m18E/B9QedPUIresZN1CSEQb/RgNQ2gN7C/XbpTafA==" }, "ethereumjs-tx": { "version": "2.1.1", @@ -3572,16 +3624,16 @@ } }, "ethereumjs-util": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz", - "integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.0.tgz", + "integrity": "sha512-vb0XN9J2QGdZGIEKG2vXM+kUdEivUfU6Wmi5y0cg+LRhDYKnXIZ/Lz7XjFbHRR9VIKq2lVGLzGBkA++y2nOdOQ==", "requires": { + "@types/bn.js": "^4.11.3", "bn.js": "^4.11.0", "create-hash": "^1.1.2", "ethjs-util": "0.1.6", - "keccak": "^1.0.2", - "rlp": "^2.0.0", - "safe-buffer": "^5.1.1", + "keccak": "^2.0.0", + "rlp": "^2.2.3", "secp256k1": "^3.0.1" } }, @@ -3771,16 +3823,16 @@ } }, "mime-db": { - "version": "1.40.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.40.0.tgz", - "integrity": "sha512-jYdeOMPy9vnxEqFRRo6ZvTZ8d9oPb+k18PKoYNYUe2stVEBPPwsln/qWzdbmaIvnhZ9v2P+CuecK+fpUfsV2mA==" + "version": "1.42.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.42.0.tgz", + "integrity": "sha512-UbfJCR4UAVRNgMpfImz05smAXK7+c+ZntjaA26ANtkXLlOe947Aag5zdIcKQULAiF9Cq4WxBi9jUs5zkA84bYQ==" }, "mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", + "version": "2.1.25", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.25.tgz", + "integrity": "sha512-5KhStqB5xpTAeGqKBAMgwaYMnQik7teQN4IAzC7npDv6kzeU6prfkR67bc87J1kWMPGkoaZSq1npmexMgkmEVg==", "requires": { - "mime-db": "1.40.0" + "mime-db": "1.42.0" } }, "negotiator": { @@ -3820,9 +3872,9 @@ } }, "ext": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/ext/-/ext-1.1.2.tgz", - "integrity": "sha512-/KLjJdTNyDepCihrk4HQt57nAE1IRCEo5jUt+WgWGCr1oARhibDvmI2DMcSNWood1T9AUWwq+jaV1wvRqaXfnA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ext/-/ext-1.2.0.tgz", + "integrity": "sha512-0ccUQK/9e3NreLFg6K6np8aPyRgwycx+oFGtfx1dSp7Wj00Ozw9r05FgBRlzjf2XBM7LAzwgLyDscRrtSU91hA==", "requires": { "type": "^2.0.0" }, @@ -4309,6 +4361,7 @@ "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", + "dev": true, "requires": { "is-callable": "^1.1.3" } @@ -4374,6 +4427,11 @@ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" }, + "fp-ts": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/fp-ts/-/fp-ts-2.2.0.tgz", + "integrity": "sha512-muJL9NOYluuoRezrvOyQvLAHIXrYg7u/Tc6cu4PP/Ed4TJKrm6BVSX8H1goT/4nhgP/yQ+Z4Xjjt4ijeKFX4Ng==" + }, "fragment-cache": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", @@ -4919,7 +4977,8 @@ "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true }, "get-caller-file": { "version": "1.0.3", @@ -5111,6 +5170,7 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, "requires": { "function-bind": "^1.1.1" } @@ -5136,7 +5196,8 @@ "has-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", - "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=", + "dev": true }, "has-to-string-tag-x": { "version": "1.4.1", @@ -5746,7 +5807,8 @@ "is-callable": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", - "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==" + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "dev": true }, "is-circular": { "version": "1.0.2", @@ -5764,7 +5826,8 @@ "is-date-object": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true }, "is-descriptor": { "version": "0.1.6", @@ -5940,6 +6003,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "dev": true, "requires": { "has": "^1.0.1" } @@ -5964,6 +6028,7 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", "integrity": "sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw==", + "dev": true, "requires": { "has-symbols": "^1.0.0" } @@ -6296,9 +6361,9 @@ "dev": true }, "keccak": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", - "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-2.0.0.tgz", + "integrity": "sha512-rKe/lRr0KGhjoz97cwg+oeT1Rj/Y4cjae6glArioUC8JBF9ROGZctwIaaruM7d7naovME4Q8WcQSO908A8qcyQ==", "requires": { "bindings": "^1.2.1", "inherits": "^2.0.3", @@ -6731,6 +6796,11 @@ "yallist": "^2.1.2" } }, + "luxon": { + "version": "1.21.2", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-1.21.2.tgz", + "integrity": "sha512-yshwnlkA79WfC24/BC9Rd1n0mhorP22Sc7GYn0puRU6wD/douCgNJIzI9qQBuT9m2/bU+n9v1RflVNE4rMPPxQ==" + }, "macos-release": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/macos-release/-/macos-release-1.1.0.tgz", @@ -10432,7 +10502,8 @@ "object-keys": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", - "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==" + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", + "dev": true }, "object-visit": { "version": "1.0.1", @@ -10699,13 +10770,9 @@ } }, "parse-headers": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.2.tgz", - "integrity": "sha512-/LypJhzFmyBIDYP9aDVgeyEb5sQfbfY5mnDq4hVhlQ69js87wXfmEI5V3xI6vvXasqebp0oCytYFLxsBVfCzSg==", - "requires": { - "for-each": "^0.3.3", - "string.prototype.trim": "^1.1.2" - } + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.3.tgz", + "integrity": "sha512-QhhZ+DCCit2Coi2vmAKbq5RGTRcQUOE2+REgv8vdyu7MnYx2eZztegqtTx99TZ86GTIwqiy3+4nQTWZ2tgmdCA==" }, "parse-json": { "version": "4.0.0", @@ -12085,21 +12152,6 @@ "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz", "integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q=" }, - "scrypt-shim": { - "version": "github:web3-js/scrypt-shim#be5e616323a8b5e568788bf94d03c1b8410eac54", - "from": "github:web3-js/scrypt-shim", - "requires": { - "scryptsy": "^2.1.0", - "semver": "^6.3.0" - }, - "dependencies": { - "semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==" - } - } - }, "scryptsy": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-2.1.0.tgz", @@ -12936,6 +12988,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz", "integrity": "sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo=", + "dev": true, "requires": { "define-properties": "^1.1.2", "es-abstract": "^1.5.0", @@ -13807,31 +13860,31 @@ } }, "web3": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3/-/web3-1.2.2.tgz", - "integrity": "sha512-/ChbmB6qZpfGx6eNpczt5YSUBHEA5V2+iUCbn85EVb3Zv6FVxrOo5Tv7Lw0gE2tW7EEjASbCyp3mZeiZaCCngg==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3/-/web3-1.2.4.tgz", + "integrity": "sha512-xPXGe+w0x0t88Wj+s/dmAdASr3O9wmA9mpZRtixGZxmBexAF0MjfqYM+MS4tVl5s11hMTN3AZb8cDD4VLfC57A==", "requires": { "@types/node": "^12.6.1", - "web3-bzz": "1.2.2", - "web3-core": "1.2.2", - "web3-eth": "1.2.2", - "web3-eth-personal": "1.2.2", - "web3-net": "1.2.2", - "web3-shh": "1.2.2", - "web3-utils": "1.2.2" + "web3-bzz": "1.2.4", + "web3-core": "1.2.4", + "web3-eth": "1.2.4", + "web3-eth-personal": "1.2.4", + "web3-net": "1.2.4", + "web3-shh": "1.2.4", + "web3-utils": "1.2.4" }, "dependencies": { "@types/node": { - "version": "12.12.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.5.tgz", - "integrity": "sha512-KEjODidV4XYUlJBF3XdjSH5FWoMCtO0utnhtdLf1AgeuZLOrRbvmU/gaRCVg7ZaQDjVf3l84egiY0mRNe5xE4A==" + "version": "12.12.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.8.tgz", + "integrity": "sha512-XLla8N+iyfjvsa0KKV+BP/iGSoTmwxsu5Ci5sM33z9TjohF72DEz95iNvD6pPmemvbQgxAv/909G73gUn8QR7w==" } } }, "web3-bzz": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.2.2.tgz", - "integrity": "sha512-b1O2ObsqUN1lJxmFSjvnEC4TsaCbmh7Owj3IAIWTKqL9qhVgx7Qsu5O9cD13pBiSPNZJ68uJPaKq380QB4NWeA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.2.4.tgz", + "integrity": "sha512-MqhAo/+0iQSMBtt3/QI1rU83uvF08sYq8r25+OUZ+4VtihnYsmkkca+rdU0QbRyrXY2/yGIpI46PFdh0khD53A==", "requires": { "@types/node": "^10.12.18", "got": "9.6.0", @@ -13840,132 +13893,133 @@ }, "dependencies": { "@types/node": { - "version": "10.17.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.3.tgz", - "integrity": "sha512-QZ9CjUB3QoA3f2afw3utKlfRPhpmufB7jC2+oDhLWnXqoyx333fhKSQDLQu2EK7OE0a15X67eYiRAaJsHXrpMA==" + "version": "10.17.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.5.tgz", + "integrity": "sha512-RElZIr/7JreF1eY6oD5RF3kpmdcreuQPjg5ri4oQ5g9sq7YWU8HkfB3eH8GwAwxf5OaCh0VPi7r4N/yoTGelrA==" } } }, "web3-core": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.2.2.tgz", - "integrity": "sha512-miHAX3qUgxV+KYfaOY93Hlc3kLW2j5fH8FJy6kSxAv+d4d5aH0wwrU2IIoJylQdT+FeenQ38sgsCnFu9iZ1hCQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.2.4.tgz", + "integrity": "sha512-CHc27sMuET2cs1IKrkz7xzmTdMfZpYswe7f0HcuyneTwS1yTlTnHyqjAaTy0ZygAb/x4iaVox+Gvr4oSAqSI+A==", "requires": { + "@types/bignumber.js": "^5.0.0", "@types/bn.js": "^4.11.4", "@types/node": "^12.6.1", - "web3-core-helpers": "1.2.2", - "web3-core-method": "1.2.2", - "web3-core-requestmanager": "1.2.2", - "web3-utils": "1.2.2" + "web3-core-helpers": "1.2.4", + "web3-core-method": "1.2.4", + "web3-core-requestmanager": "1.2.4", + "web3-utils": "1.2.4" }, "dependencies": { "@types/node": { - "version": "12.12.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.5.tgz", - "integrity": "sha512-KEjODidV4XYUlJBF3XdjSH5FWoMCtO0utnhtdLf1AgeuZLOrRbvmU/gaRCVg7ZaQDjVf3l84egiY0mRNe5xE4A==" + "version": "12.12.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.8.tgz", + "integrity": "sha512-XLla8N+iyfjvsa0KKV+BP/iGSoTmwxsu5Ci5sM33z9TjohF72DEz95iNvD6pPmemvbQgxAv/909G73gUn8QR7w==" } } }, "web3-core-helpers": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.2.2.tgz", - "integrity": "sha512-HJrRsIGgZa1jGUIhvGz4S5Yh6wtOIo/TMIsSLe+Xay+KVnbseJpPprDI5W3s7H2ODhMQTbogmmUFquZweW2ImQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.2.4.tgz", + "integrity": "sha512-U7wbsK8IbZvF3B7S+QMSNP0tni/6VipnJkB0tZVEpHEIV2WWeBHYmZDnULWcsS/x/jn9yKhJlXIxWGsEAMkjiw==", "requires": { "underscore": "1.9.1", - "web3-eth-iban": "1.2.2", - "web3-utils": "1.2.2" + "web3-eth-iban": "1.2.4", + "web3-utils": "1.2.4" } }, "web3-core-method": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.2.2.tgz", - "integrity": "sha512-szR4fDSBxNHaF1DFqE+j6sFR/afv9Aa36OW93saHZnrh+iXSrYeUUDfugeNcRlugEKeUCkd4CZylfgbK2SKYJA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.2.4.tgz", + "integrity": "sha512-8p9kpL7di2qOVPWgcM08kb+yKom0rxRCMv6m/K+H+yLSxev9TgMbCgMSbPWAHlyiF3SJHw7APFKahK5Z+8XT5A==", "requires": { "underscore": "1.9.1", - "web3-core-helpers": "1.2.2", - "web3-core-promievent": "1.2.2", - "web3-core-subscriptions": "1.2.2", - "web3-utils": "1.2.2" + "web3-core-helpers": "1.2.4", + "web3-core-promievent": "1.2.4", + "web3-core-subscriptions": "1.2.4", + "web3-utils": "1.2.4" } }, "web3-core-promievent": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.2.2.tgz", - "integrity": "sha512-tKvYeT8bkUfKABcQswK6/X79blKTKYGk949urZKcLvLDEaWrM3uuzDwdQT3BNKzQ3vIvTggFPX9BwYh0F1WwqQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.2.4.tgz", + "integrity": "sha512-gEUlm27DewUsfUgC3T8AxkKi8Ecx+e+ZCaunB7X4Qk3i9F4C+5PSMGguolrShZ7Zb6717k79Y86f3A00O0VAZw==", "requires": { "any-promise": "1.3.0", "eventemitter3": "3.1.2" } }, "web3-core-requestmanager": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.2.2.tgz", - "integrity": "sha512-a+gSbiBRHtHvkp78U2bsntMGYGF2eCb6219aMufuZWeAZGXJ63Wc2321PCbA8hF9cQrZI4EoZ4kVLRI4OF15Hw==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.2.4.tgz", + "integrity": "sha512-eZJDjyNTDtmSmzd3S488nR/SMJtNnn/GuwxnMh3AzYCqG3ZMfOylqTad2eYJPvc2PM5/Gj1wAMQcRpwOjjLuPg==", "requires": { "underscore": "1.9.1", - "web3-core-helpers": "1.2.2", - "web3-providers-http": "1.2.2", - "web3-providers-ipc": "1.2.2", - "web3-providers-ws": "1.2.2" + "web3-core-helpers": "1.2.4", + "web3-providers-http": "1.2.4", + "web3-providers-ipc": "1.2.4", + "web3-providers-ws": "1.2.4" } }, "web3-core-subscriptions": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.2.2.tgz", - "integrity": "sha512-QbTgigNuT4eicAWWr7ahVpJyM8GbICsR1Ys9mJqzBEwpqS+RXTRVSkwZ2IsxO+iqv6liMNwGregbJLq4urMFcQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.2.4.tgz", + "integrity": "sha512-3D607J2M8ymY9V+/WZq4MLlBulwCkwEjjC2U+cXqgVO1rCyVqbxZNCmHyNYHjDDCxSEbks9Ju5xqJxDSxnyXEw==", "requires": { "eventemitter3": "3.1.2", "underscore": "1.9.1", - "web3-core-helpers": "1.2.2" + "web3-core-helpers": "1.2.4" } }, "web3-eth": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.2.2.tgz", - "integrity": "sha512-UXpC74mBQvZzd4b+baD4Ocp7g+BlwxhBHumy9seyE/LMIcMlePXwCKzxve9yReNpjaU16Mmyya6ZYlyiKKV8UA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.2.4.tgz", + "integrity": "sha512-+j+kbfmZsbc3+KJpvHM16j1xRFHe2jBAniMo1BHKc3lho6A8Sn9Buyut6odubguX2AxoRArCdIDCkT9hjUERpA==", "requires": { "underscore": "1.9.1", - "web3-core": "1.2.2", - "web3-core-helpers": "1.2.2", - "web3-core-method": "1.2.2", - "web3-core-subscriptions": "1.2.2", - "web3-eth-abi": "1.2.2", - "web3-eth-accounts": "1.2.2", - "web3-eth-contract": "1.2.2", - "web3-eth-ens": "1.2.2", - "web3-eth-iban": "1.2.2", - "web3-eth-personal": "1.2.2", - "web3-net": "1.2.2", - "web3-utils": "1.2.2" + "web3-core": "1.2.4", + "web3-core-helpers": "1.2.4", + "web3-core-method": "1.2.4", + "web3-core-subscriptions": "1.2.4", + "web3-eth-abi": "1.2.4", + "web3-eth-accounts": "1.2.4", + "web3-eth-contract": "1.2.4", + "web3-eth-ens": "1.2.4", + "web3-eth-iban": "1.2.4", + "web3-eth-personal": "1.2.4", + "web3-net": "1.2.4", + "web3-utils": "1.2.4" } }, "web3-eth-abi": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.2.2.tgz", - "integrity": "sha512-Yn/ZMgoOLxhTVxIYtPJ0eS6pnAnkTAaJgUJh1JhZS4ekzgswMfEYXOwpMaD5eiqPJLpuxmZFnXnBZlnQ1JMXsw==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.2.4.tgz", + "integrity": "sha512-8eLIY4xZKoU3DSVu1pORluAw9Ru0/v4CGdw5so31nn+7fR8zgHMgwbFe0aOqWQ5VU42PzMMXeIJwt4AEi2buFg==", "requires": { "ethers": "4.0.0-beta.3", "underscore": "1.9.1", - "web3-utils": "1.2.2" + "web3-utils": "1.2.4" } }, "web3-eth-accounts": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.2.2.tgz", - "integrity": "sha512-KzHOEyXOEZ13ZOkWN3skZKqSo5f4Z1ogPFNn9uZbKCz+kSp+gCAEKxyfbOsB/JMAp5h7o7pb6eYsPCUBJmFFiA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.2.4.tgz", + "integrity": "sha512-04LzT/UtWmRFmi4hHRewP5Zz43fWhuHiK5XimP86sUQodk/ByOkXQ3RoXyGXFMNoRxdcAeRNxSfA2DpIBc9xUw==", "requires": { + "@web3-js/scrypt-shim": "^0.1.0", "any-promise": "1.3.0", "crypto-browserify": "3.12.0", "eth-lib": "0.2.7", "ethereumjs-common": "^1.3.2", "ethereumjs-tx": "^2.1.1", - "scrypt-shim": "github:web3-js/scrypt-shim", "underscore": "1.9.1", "uuid": "3.3.2", - "web3-core": "1.2.2", - "web3-core-helpers": "1.2.2", - "web3-core-method": "1.2.2", - "web3-utils": "1.2.2" + "web3-core": "1.2.4", + "web3-core-helpers": "1.2.4", + "web3-core-method": "1.2.4", + "web3-utils": "1.2.4" }, "dependencies": { "eth-lib": { @@ -13981,119 +14035,119 @@ } }, "web3-eth-contract": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.2.2.tgz", - "integrity": "sha512-EKT2yVFws3FEdotDQoNsXTYL798+ogJqR2//CaGwx3p0/RvQIgfzEwp8nbgA6dMxCsn9KOQi7OtklzpnJMkjtA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.2.4.tgz", + "integrity": "sha512-b/9zC0qjVetEYnzRA1oZ8gF1OSSUkwSYi5LGr4GeckLkzXP7osEnp9lkO/AQcE4GpG+l+STnKPnASXJGZPgBRQ==", "requires": { "@types/bn.js": "^4.11.4", "underscore": "1.9.1", - "web3-core": "1.2.2", - "web3-core-helpers": "1.2.2", - "web3-core-method": "1.2.2", - "web3-core-promievent": "1.2.2", - "web3-core-subscriptions": "1.2.2", - "web3-eth-abi": "1.2.2", - "web3-utils": "1.2.2" + "web3-core": "1.2.4", + "web3-core-helpers": "1.2.4", + "web3-core-method": "1.2.4", + "web3-core-promievent": "1.2.4", + "web3-core-subscriptions": "1.2.4", + "web3-eth-abi": "1.2.4", + "web3-utils": "1.2.4" } }, "web3-eth-ens": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.2.2.tgz", - "integrity": "sha512-CFjkr2HnuyMoMFBoNUWojyguD4Ef+NkyovcnUc/iAb9GP4LHohKrODG4pl76R5u61TkJGobC2ij6TyibtsyVYg==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.2.4.tgz", + "integrity": "sha512-g8+JxnZlhdsCzCS38Zm6R/ngXhXzvc3h7bXlxgKU4coTzLLoMpgOAEz71GxyIJinWTFbLXk/WjNY0dazi9NwVw==", "requires": { "eth-ens-namehash": "2.0.8", "underscore": "1.9.1", - "web3-core": "1.2.2", - "web3-core-helpers": "1.2.2", - "web3-core-promievent": "1.2.2", - "web3-eth-abi": "1.2.2", - "web3-eth-contract": "1.2.2", - "web3-utils": "1.2.2" + "web3-core": "1.2.4", + "web3-core-helpers": "1.2.4", + "web3-core-promievent": "1.2.4", + "web3-eth-abi": "1.2.4", + "web3-eth-contract": "1.2.4", + "web3-utils": "1.2.4" } }, "web3-eth-iban": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.2.2.tgz", - "integrity": "sha512-gxKXBoUhaTFHr0vJB/5sd4i8ejF/7gIsbM/VvemHT3tF5smnmY6hcwSMmn7sl5Gs+83XVb/BngnnGkf+I/rsrQ==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.2.4.tgz", + "integrity": "sha512-D9HIyctru/FLRpXakRwmwdjb5bWU2O6UE/3AXvRm6DCOf2e+7Ve11qQrPtaubHfpdW3KWjDKvlxV9iaFv/oTMQ==", "requires": { "bn.js": "4.11.8", - "web3-utils": "1.2.2" + "web3-utils": "1.2.4" } }, "web3-eth-personal": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.2.2.tgz", - "integrity": "sha512-4w+GLvTlFqW3+q4xDUXvCEMU7kRZ+xm/iJC8gm1Li1nXxwwFbs+Y+KBK6ZYtoN1qqAnHR+plYpIoVo27ixI5Rg==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.2.4.tgz", + "integrity": "sha512-5Russ7ZECwHaZXcN3DLuLS7390Vzgrzepl4D87SD6Sn1DHsCZtvfdPIYwoTmKNp69LG3mORl7U23Ga5YxqkICw==", "requires": { "@types/node": "^12.6.1", - "web3-core": "1.2.2", - "web3-core-helpers": "1.2.2", - "web3-core-method": "1.2.2", - "web3-net": "1.2.2", - "web3-utils": "1.2.2" + "web3-core": "1.2.4", + "web3-core-helpers": "1.2.4", + "web3-core-method": "1.2.4", + "web3-net": "1.2.4", + "web3-utils": "1.2.4" }, "dependencies": { "@types/node": { - "version": "12.12.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.5.tgz", - "integrity": "sha512-KEjODidV4XYUlJBF3XdjSH5FWoMCtO0utnhtdLf1AgeuZLOrRbvmU/gaRCVg7ZaQDjVf3l84egiY0mRNe5xE4A==" + "version": "12.12.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.8.tgz", + "integrity": "sha512-XLla8N+iyfjvsa0KKV+BP/iGSoTmwxsu5Ci5sM33z9TjohF72DEz95iNvD6pPmemvbQgxAv/909G73gUn8QR7w==" } } }, "web3-net": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.2.2.tgz", - "integrity": "sha512-K07j2DXq0x4UOJgae65rWZKraOznhk8v5EGSTdFqASTx7vWE/m+NqBijBYGEsQY1lSMlVaAY9UEQlcXK5HzXTw==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.2.4.tgz", + "integrity": "sha512-wKOsqhyXWPSYTGbp7ofVvni17yfRptpqoUdp3SC8RAhDmGkX6irsiT9pON79m6b3HUHfLoBilFQyt/fTUZOf7A==", "requires": { - "web3-core": "1.2.2", - "web3-core-method": "1.2.2", - "web3-utils": "1.2.2" + "web3-core": "1.2.4", + "web3-core-method": "1.2.4", + "web3-utils": "1.2.4" } }, "web3-providers-http": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.2.2.tgz", - "integrity": "sha512-BNZ7Hguy3eBszsarH5gqr9SIZNvqk9eKwqwmGH1LQS1FL3NdoOn7tgPPdddrXec4fL94CwgNk4rCU+OjjZRNDg==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.2.4.tgz", + "integrity": "sha512-dzVCkRrR/cqlIrcrWNiPt9gyt0AZTE0J+MfAu9rR6CyIgtnm1wFUVVGaxYRxuTGQRO4Dlo49gtoGwaGcyxqiTw==", "requires": { - "web3-core-helpers": "1.2.2", + "web3-core-helpers": "1.2.4", "xhr2-cookies": "1.1.0" } }, "web3-providers-ipc": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.2.2.tgz", - "integrity": "sha512-t97w3zi5Kn/LEWGA6D9qxoO0LBOG+lK2FjlEdCwDQatffB/+vYrzZ/CLYVQSoyFZAlsDoBasVoYSWZK1n39aHA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.2.4.tgz", + "integrity": "sha512-8J3Dguffin51gckTaNrO3oMBo7g+j0UNk6hXmdmQMMNEtrYqw4ctT6t06YOf9GgtOMjSAc1YEh3LPrvgIsR7og==", "requires": { "oboe": "2.1.4", "underscore": "1.9.1", - "web3-core-helpers": "1.2.2" + "web3-core-helpers": "1.2.4" } }, "web3-providers-ws": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.2.2.tgz", - "integrity": "sha512-Wb1mrWTGMTXOpJkL0yGvL/WYLt8fUIXx8k/l52QB2IiKzvyd42dTWn4+j8IKXGSYYzOm7NMqv6nhA5VDk12VfA==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.2.4.tgz", + "integrity": "sha512-F/vQpDzeK+++oeeNROl1IVTufFCwCR2hpWe5yRXN0ApLwHqXrMI7UwQNdJ9iyibcWjJf/ECbauEEQ8CHgE+MYQ==", "requires": { + "@web3-js/websocket": "^1.0.29", "underscore": "1.9.1", - "web3-core-helpers": "1.2.2", - "websocket": "github:web3-js/WebSocket-Node#polyfill/globalThis" + "web3-core-helpers": "1.2.4" } }, "web3-shh": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.2.2.tgz", - "integrity": "sha512-og258NPhlBn8yYrDWjoWBBb6zo1OlBgoWGT+LL5/LPqRbjPe09hlOYHgscAAr9zZGtohTOty7RrxYw6Z6oDWCg==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.2.4.tgz", + "integrity": "sha512-z+9SCw0dE+69Z/Hv8809XDbLj7lTfEv9Sgu8eKEIdGntZf4v7ewj5rzN5bZZSz8aCvfK7Y6ovz1PBAu4QzS4IQ==", "requires": { - "web3-core": "1.2.2", - "web3-core-method": "1.2.2", - "web3-core-subscriptions": "1.2.2", - "web3-net": "1.2.2" + "web3-core": "1.2.4", + "web3-core-method": "1.2.4", + "web3-core-subscriptions": "1.2.4", + "web3-net": "1.2.4" } }, "web3-utils": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.2.tgz", - "integrity": "sha512-joF+s3243TY5cL7Z7y4h1JsJpUCf/kmFmj+eJar7Y2yNIGVcW961VyrAms75tjUysSuHaUQ3eQXjBEUJueT52A==", + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.4.tgz", + "integrity": "sha512-+S86Ip+jqfIPQWvw2N/xBQq5JNqCO0dyvukGdJm8fEWHZbckT4WxSpHbx+9KLEWY4H4x9pUwnoRkK87pYyHfgQ==", "requires": { "bn.js": "4.11.8", "eth-lib": "0.2.7", @@ -14117,24 +14171,6 @@ } } }, - "websocket": { - "version": "github:web3-js/WebSocket-Node#905deb4812572b344f5801f8c9ce8bb02799d82e", - "from": "github:web3-js/WebSocket-Node#polyfill/globalThis", - "requires": { - "debug": "^2.2.0", - "es5-ext": "^0.10.50", - "nan": "^2.14.0", - "typedarray-to-buffer": "^3.1.5", - "yaeti": "^0.0.6" - }, - "dependencies": { - "nan": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" - } - } - }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", diff --git a/package.json b/package.json index dc728b2a..c7c1e6d4 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,7 @@ "bitcoin-core": "2.2.0", "bs58": "4.0.1", "form-data": "2.3.3", + "fp-ts": "2.2.0", "ipfs-http-client": "28.1.0", "joi": "14.3.0", "koa": "2.6.2", @@ -67,13 +68,14 @@ "koa-cors": "0.0.16", "koa-helmet": "4.0.0", "koa-router": "7.4.0", + "luxon": "1.21.2", "mongodb": "3.1.10", "node-fetch": "1.7.3", "pino": "4.17.6", "protobufjs": "6.8.8", "ramda": "0.26.1", "string-to-stream": "1.1.1", - "web3": "1.2.2" + "web3": "1.2.4" }, "devDependencies": { "@po.et/tslint-rules": "2.2.0", @@ -84,6 +86,7 @@ "@types/koa": "2.0.47", "@types/koa-helmet": "3.1.2", "@types/koa-router": "7.0.35", + "@types/luxon": "1.21.0", "@types/mongodb": "3.3.8", "@types/node-fetch": "1.6.9", "@types/pino": "4.16.1", diff --git a/src/Configuration.ts b/src/Configuration.ts index 0989dc70..e7902702 100644 --- a/src/Configuration.ts +++ b/src/Configuration.ts @@ -50,6 +50,8 @@ export interface Configuration extends LoggingConfiguration, BitcoinRPCConfigura readonly ethereumRegistryPrivateKey: string readonly ethereumRegistryUploadAnchorReceiptIntervalInSeconds: number readonly ethereumRegistryRegisterNextDirectoryIntervalInSeconds: number + readonly ethereumGasPrice: number + readonly ethereumMaximumUnconfirmedTransactionAgeInSeconds: number } export interface LoggingConfiguration { @@ -141,6 +143,8 @@ export const DefaultConfiguration: Configuration = { ethereumRegistryPrivateKey: '', ethereumRegistryUploadAnchorReceiptIntervalInSeconds: 60, ethereumRegistryRegisterNextDirectoryIntervalInSeconds: 60, + ethereumGasPrice: 1e9, + ethereumMaximumUnconfirmedTransactionAgeInSeconds: 5 * 60 * 1000, exchangeAnchorNextHashRequest: 'ANCHOR_NEXT_HASH_REQUEST', exchangeBatchReaderReadNextDirectoryRequest: 'BATCH_READER::READ_NEXT_DIRECTORY_REQUEST', diff --git a/src/EthereumRegistryWriter/Business.ts b/src/EthereumRegistryWriter/Business.ts index 02844747..34a2975a 100644 --- a/src/EthereumRegistryWriter/Business.ts +++ b/src/EthereumRegistryWriter/Business.ts @@ -1,11 +1,14 @@ import { PoetBlockAnchor } from '@po.et/poet-js' +import { DateTime } from 'luxon' import { Collection, Db } from 'mongodb' import * as Pino from 'pino' -import { identity } from 'ramda' +import { identity, map, filter, tap, complement } from 'ramda' +import { TransactionReceipt } from 'web3-core' import { EthereumRegistryContract } from 'Helpers/EthereumRegistryContract' import { IPFS } from 'Helpers/IPFS' import { childWithFileName } from 'Helpers/Logging' +import { asyncPipe } from 'Helpers/asyncPipe' import { ClaimIPFSHashPair } from 'Interfaces' export interface Dependencies { @@ -15,8 +18,13 @@ export interface Dependencies { readonly ethereumRegistryContract: EthereumRegistryContract } +export interface Configuration { + readonly maximumUnconfirmedTransactionAgeInSeconds: number +} + export interface Arguments { readonly dependencies: Dependencies + readonly configuration: Configuration } export interface Business { @@ -28,7 +36,15 @@ export interface Business { readonly confirmClaimFiles: (claimIPFSHashPairs: ReadonlyArray) => Promise readonly uploadNextAnchorReceipt: () => Promise readonly uploadNextClaimFileAnchorReceiptPair: () => Promise - readonly registerNextDirectory: () => Promise + readonly writeNextDirectoryToEthereum: () => Promise + readonly setRegistryIndex: ( + confirmClaimAndAnchorReceiptDirectory: string, + registryIndex: number, + transactionHash: string, + blockHash: string, + blockNumber: number, + ) => Promise + readonly getEthereumTransactionReceipts: () => Promise } interface DbEntry { @@ -40,6 +56,17 @@ interface DbEntry { readonly batchDirectoryConfirmed?: boolean readonly claimAndAnchorReceiptDirectory?: string readonly registryIndex?: number + readonly registryAdditionTransactionReceipt?: { + readonly transactionHash?: string + readonly transactionCreationDate?: Date + readonly blockHash?: string + readonly blockNumber?: number, // comma due to some tslint randomness, will move to eslint in the future + } + readonly onCidAdded?: { + readonly transactionHash?: string + readonly blockHash?: string + readonly blockNumber?: number, // comma due to some tslint randomness, will move to eslint in the future + } } export const Business = ({ @@ -49,6 +76,9 @@ export const Business = ({ ipfs, ethereumRegistryContract, }, + configuration: { + maximumUnconfirmedTransactionAgeInSeconds, + }, }: Arguments): Business => { const businessLogger: Pino.Logger = childWithFileName(logger, __filename) const claimAnchorReceiptsCollection: Collection = db.collection('claimAnchorReceipts') @@ -187,26 +217,135 @@ export const Business = ({ await claimAnchorReceiptsCollection.updateOne({ claimId }, { $set: { claimAndAnchorReceiptDirectory } }) } - const registerNextDirectory = async () => { + const writeNextDirectoryToEthereum = async () => { const logger = businessLogger.child({ method: 'registerNextDirectory' }) - const entry = await claimAnchorReceiptsCollection.findOne({ - claimAndAnchorReceiptDirectory: { $ne: null }, - registryIndex: null, - }) - if (!entry) + + const entry = await claimAnchorReceiptsCollection.findOneAndUpdate( + { + claimAndAnchorReceiptDirectory: { $ne: null }, + $or: [ + { 'registryAdditionTransactionReceipt.transactionCreationDate': null }, + { $and: [ + { 'registryAdditionTransactionReceipt.transactionCreationDate': { + $lt: DateTime.utc().minus({ seconds: maximumUnconfirmedTransactionAgeInSeconds }).toJSDate(), + } }, + { 'registryAdditionTransactionReceipt.blockHash': null }, + ]}, + ], + }, + { + $set: { 'registryAdditionTransactionReceipt.transactionCreationDate': new Date() }, + }, + ) + if (!entry.value) return - const { claimId, claimAndAnchorReceiptDirectory } = entry - const cidCount = await ethereumRegistryContract.getCidCount() + const { claimId, claimAndAnchorReceiptDirectory } = entry.value logger.debug( - { claimId, claimAndAnchorReceiptDirectory, cidCount }, - 'Registering next (claim + anchor receipt) directory to Ethereum', + { claimId, claimAndAnchorReceiptDirectory }, + 'Adding (claim + anchor receipt) directory to Ethereum', ) - await ethereumRegistryContract.addCid(claimAndAnchorReceiptDirectory) + const transactionHash = await ethereumRegistryContract.addCid(claimAndAnchorReceiptDirectory) + logger.info( - { claimId, claimAndAnchorReceiptDirectory, cidCount }, - '(claim + anchor receipt) directory added to Ethereum', + { claimId, claimAndAnchorReceiptDirectory, transactionHash }, + '(claim + anchor receipt) transaction sent', ) - await claimAnchorReceiptsCollection.updateOne({ claimId }, { $set: { registryIndex: cidCount } }) + + await claimAnchorReceiptsCollection.updateOne( + { claimAndAnchorReceiptDirectory }, + { $set: { 'registryAdditionTransactionReceipt.transactionHash': transactionHash } }, + ) + + } + + const setRegistryIndex = async ( + claimAndAnchorReceiptDirectory: string, + registryIndex: number, + transactionHash: string, + blockHash: string, + blockNumber: number, + ) => { + const logger = businessLogger.child({ method: 'setRegistryIndex' }) + await claimAnchorReceiptsCollection.updateOne( + { claimAndAnchorReceiptDirectory }, + { $set: { registryIndex, onCidAdded: { transactionHash, blockHash, blockNumber } } }, + ) + logger.info( + { claimAndAnchorReceiptDirectory, registryIndex, blockNumber, transactionHash }, + 'Registry index for (claim + anchor receipt) directory set', + ) + } + + const getEthereumTransactionReceipts = async () => { + const logger = businessLogger.child({ method: 'getEthereumTransactionReceipts' }) + + logger.trace('Looking for transactions without confirmation') + + const entries = await claimAnchorReceiptsCollection.find( + { + 'registryAdditionTransactionReceipt.transactionHash': { $ne: null }, + 'registryAdditionTransactionReceipt.blockHash': null, + }, + { projection: { 'registryAdditionTransactionReceipt.transactionHash': 1 } }, + ).toArray() + + if (!entries.length) { + logger.trace('No transactions without confirmation found') + return + } + + const transactionHashes = entries.map(_ => _.registryAdditionTransactionReceipt.transactionHash) + + logger.debug({ transactionHashes }, 'These transactions have no known confirmations yet') + + const receiptToSimplified = ({ transactionHash, blockHash, blockNumber }: TransactionReceipt) => ({ + transactionHash, + blockHash, + blockNumber, + }) + + const logErrors = (transactionReceipt: TransactionReceipt) => { + logger.error({ transactionReceipt }, 'Error in transaction receipt') + } + + const transactionReceiptIsOk = (transactionReceipt: TransactionReceipt) => transactionReceipt.status + + const filterAndLogErrors = asyncPipe( + tap(asyncPipe( + filter(complement(transactionReceiptIsOk)), + map(logErrors), + )), + filter(transactionReceiptIsOk), + ) + + const getReceipts = asyncPipe( + map(ethereumRegistryContract.getTransactionReceipt), + Promise.all.bind(Promise), + filter(identity), + filterAndLogErrors, + map(receiptToSimplified), + ) as (transactionHashes: ReadonlyArray) => Promise>> + + const receipts = await getReceipts(transactionHashes) + + if (!receipts.length) { + logger.trace({ transactionHashes }, 'No transactions receipts available yet for these transactions') + return + } + + logger.debug({ receipts }, 'Got these transaction receipts') + + await Promise.all(receipts.map(({ transactionHash, blockHash, blockNumber }) => + claimAnchorReceiptsCollection.updateOne( + { 'registryAdditionTransactionReceipt.transactionHash': transactionHash }, + { $set: { + 'registryAdditionTransactionReceipt.blockHash': blockHash, + 'registryAdditionTransactionReceipt.blockNumber': blockNumber, + } }, + ), + )) + + logger.info({ receipts }, 'Transaction receipts set') } return { @@ -218,6 +357,8 @@ export const Business = ({ confirmClaimFiles, uploadNextAnchorReceipt, uploadNextClaimFileAnchorReceiptPair, - registerNextDirectory, + writeNextDirectoryToEthereum, + setRegistryIndex, + getEthereumTransactionReceipts, } } diff --git a/src/EthereumRegistryWriter/EthereumRegistryWriter.ts b/src/EthereumRegistryWriter/EthereumRegistryWriter.ts index cf0d6b24..17fc23e9 100644 --- a/src/EthereumRegistryWriter/EthereumRegistryWriter.ts +++ b/src/EthereumRegistryWriter/EthereumRegistryWriter.ts @@ -24,6 +24,8 @@ export interface EthereumRegistryWriterConfiguration extends LoggingConfiguratio readonly privateKey: string readonly uploadAnchorReceiptIntervalInSeconds: number readonly registerNextDirectoryIntervalInSeconds: number + readonly gasPrice?: number + readonly maximumUnconfirmedTransactionAgeInSeconds: number } type stop = () => Promise @@ -47,8 +49,11 @@ export const EthereumRegistryWriter = async (configuration: EthereumRegistryWrit chainId: configuration.chainId, contractAddress: configuration.contractAddress, privateKey: configuration.privateKey, + gasPrice: configuration.gasPrice, }) + logger.info({ ethereumAccountAddress: ethereumRegistryContract.accountAddress }) + const business = Business({ dependencies: { logger, @@ -56,6 +61,9 @@ export const EthereumRegistryWriter = async (configuration: EthereumRegistryWrit ipfs, ethereumRegistryContract, }, + configuration: { + maximumUnconfirmedTransactionAgeInSeconds: configuration.maximumUnconfirmedTransactionAgeInSeconds, + }, }) await business.createDbIndices() @@ -64,6 +72,7 @@ export const EthereumRegistryWriter = async (configuration: EthereumRegistryWrit logger, messaging, business, + ethereumRegistryContract, }, exchange: configuration.exchanges, }) @@ -92,6 +101,9 @@ export const EthereumRegistryWriter = async (configuration: EthereumRegistryWrit logger.debug('Closing database connection...') await mongoClient.close() logger.info('Database connection closed') + logger.debug('Closing WS connection to geth...') + ethereumRegistryContract.close() + logger.info('WS connection to geth closed') logger.info('Stopped EthereumRegistryWriter...') } diff --git a/src/EthereumRegistryWriter/Router.ts b/src/EthereumRegistryWriter/Router.ts index 1934be2c..5827e13d 100644 --- a/src/EthereumRegistryWriter/Router.ts +++ b/src/EthereumRegistryWriter/Router.ts @@ -1,5 +1,6 @@ import Pino from 'pino' +import { EthereumRegistryContract } from 'Helpers/EthereumRegistryContract' import { childWithFileName } from 'Helpers/Logging' import { ClaimIPFSHashPair } from 'Interfaces' import { BlockDownloaded } from 'Messaging/Messages' @@ -12,6 +13,7 @@ export interface Dependencies { readonly logger: Pino.Logger readonly messaging: Messaging readonly business: Business + readonly ethereumRegistryContract: EthereumRegistryContract } export interface Arguments { @@ -28,6 +30,7 @@ export const Router = ({ logger, messaging, business, + ethereumRegistryContract, }, exchange, }: Arguments): Router => { @@ -39,6 +42,25 @@ export const Router = ({ await messaging.consumeBlockDownloaded(onPoetBlockAnchorsDownloaded) await messaging.consumeClaimsDownloaded(onClaimsDownloaded) await messaging.consume(exchange.batchRead, onBatchRead) + + const handleEventError = (error: any, event: any) => { + if (error) + logger.error({ error, event }) + } + + const onCidAddedPromievent = await ethereumRegistryContract.onCidAdded({}, handleEventError) + + onCidAddedPromievent + .on('connected', (subscriptionId: string) => { + logger.info({ subscriptionId }, 'onCidAdded connected') + }) + .on('data', onCidAdded) + .on('changed', (event: any) => { + logger.warn({ event }, 'onCidAdded changed') + }) + .on('error', (error: any) => { + logger.error({ error }, 'onCidAdded error') + }) } const onClaimIPFSHash = async (message: any) => { @@ -112,6 +134,24 @@ export const Router = ({ } } + const onCidAdded = async (event: any) => { + const logger = routerLogger.child({ method: 'onCidAdded' }) + + logger.trace({ event }, 'onCidAdded') + + try { + await business.setRegistryIndex( + event.returnValues.cid, + event.returnValues.index, + event.transactionHash, + event.blockHash, + event.blockNumber, + ) + } catch (error) { + logger.error({ error, event }) + } + } + return { start, } diff --git a/src/EthereumRegistryWriter/Scheduler.ts b/src/EthereumRegistryWriter/Scheduler.ts index 36704115..68e24cd0 100644 --- a/src/EthereumRegistryWriter/Scheduler.ts +++ b/src/EthereumRegistryWriter/Scheduler.ts @@ -66,7 +66,7 @@ export const Scheduler = ({ const registerNextDirectory = async () => { const methodLogger = logger.child({ method: 'registerNextDirectory' }) try { - await business.registerNextDirectory() + await business.writeNextDirectoryToEthereum() } catch (error) { methodLogger.error({ error }, 'Uncaught exception') } @@ -77,11 +77,26 @@ export const Scheduler = ({ secondsToMiliseconds(configuration.registerNextDirectoryIntervalInSeconds), ) + const getEthereumTransactionReceipts = async () => { + const methodLogger = logger.child({ method: 'getNextEthereumTransactionReceipt' }) + try { + await business.getEthereumTransactionReceipts() + } catch (error) { + methodLogger.error({ error }, 'Uncaught exception') + } + } + + const getEthereumTransactionReceiptsInterval = new Interval( + getEthereumTransactionReceipts, + secondsToMiliseconds(10), + ) + const start = async () => { logger.debug({ configuration }, 'EthereumRegistryWriter Scheduler Starting') await uploadNextAnchorReceiptInterval.start() await uploadNextClaimFileAnchorReceiptPairInterval.start() await registerNextDirectoryInterval.start() + await getEthereumTransactionReceiptsInterval.start() logger.info({ configuration }, 'EthereumRegistryWriter Scheduler Started') } @@ -90,6 +105,7 @@ export const Scheduler = ({ await uploadNextAnchorReceiptInterval.stop() await uploadNextClaimFileAnchorReceiptPairInterval.stop() await registerNextDirectoryInterval.stop() + await getEthereumTransactionReceiptsInterval.stop() logger.info('EthereumRegistryWriter Scheduler Stopped') } diff --git a/src/EthereumRegistryWriter/index.ts b/src/EthereumRegistryWriter/index.ts index e7ccc1a1..75247a30 100644 --- a/src/EthereumRegistryWriter/index.ts +++ b/src/EthereumRegistryWriter/index.ts @@ -35,8 +35,10 @@ EthereumRegistryWriter({ chainId: configuration.ethereumChainId, contractAddress: configuration.ethereumRegistryContractAddress, privateKey: configuration.ethereumRegistryPrivateKey, + gasPrice: configuration.ethereumGasPrice, uploadAnchorReceiptIntervalInSeconds: configuration.ethereumRegistryUploadAnchorReceiptIntervalInSeconds, registerNextDirectoryIntervalInSeconds: configuration.ethereumRegistryRegisterNextDirectoryIntervalInSeconds, + maximumUnconfirmedTransactionAgeInSeconds: configuration.ethereumMaximumUnconfirmedTransactionAgeInSeconds, }) .then(stop => process.on('SIGINT', stop)) .catch(catchStartupError('EthereumRegistryWriter', logger)) diff --git a/src/Helpers/EthereumRegistryContract.ts b/src/Helpers/EthereumRegistryContract.ts index b147a956..b337f58e 100644 --- a/src/Helpers/EthereumRegistryContract.ts +++ b/src/Helpers/EthereumRegistryContract.ts @@ -1,6 +1,10 @@ +import { tap } from 'ramda' import Web3 from 'web3' +import { SignedTransaction, TransactionConfig, TransactionReceipt } from 'web3-core' +import { ContractSendMethod } from 'web3-eth-contract' import { EthereumRegistryContractAbi } from './EthereumRegistryContractAbi' +import { asyncPipe } from './asyncPipe' interface EthereumRegistryContractArguments { readonly rpcUrl?: string @@ -11,11 +15,18 @@ interface EthereumRegistryContractArguments { } export interface EthereumRegistryContract { + readonly accountAddress: string + readonly close: () => void readonly getCidCount: () => Promise readonly getCid: (index: number) => Promise - readonly addCid: (cid: string) => Promise + readonly addCid: (cid: string) => Promise + readonly onCidAdded: any + readonly getTransactionReceipt: (hash: string) => Promise } +const pickRawTransaction = (_: SignedTransaction) => _.rawTransaction +const pickTransactionHash = (_: SignedTransaction) => _.transactionHash + export const EthereumRegistryContract = ({ rpcUrl = 'http://localhost:8545', contractAddress, @@ -27,31 +38,48 @@ export const EthereumRegistryContract = ({ const account = web3.eth.accounts.privateKeyToAccount(privateKey) const contract = new web3.eth.Contract(EthereumRegistryContractAbi, contractAddress, { from: account.address }) + const close = () => { + if (web3.currentProvider instanceof Web3.providers.WebsocketProvider) + web3.currentProvider.disconnect(null, null) + } + const getCidCount = () => contract.methods.getCidCount().call().then(parseInt) const getCid = (index: number) => contract.methods.cids(index).call() - const addCid = async (cid: string) => { - const method = contract.methods.addCid(cid) + const createTransaction = async (method: ContractSendMethod): Promise => ({ + from: account.address, + to: contractAddress, + gas: await method.estimateGas(), + gasPrice, + data: method.encodeABI(), + chainId, + nonce: await web3.eth.getTransactionCount(account.address, 'pending'), + }) - const tx = { - from: account.address, - to: contractAddress, - gas: await method.estimateGas(), - gasPrice, - data: method.encodeABI(), - chainId, - nonce: await web3.eth.getTransactionCount(account.address, 'pending'), - } + const createSignAndSendTransaction = asyncPipe( + createTransaction, + account.signTransaction, + tap(asyncPipe( + pickRawTransaction, + web3.eth.sendSignedTransaction, + )), + pickTransactionHash, + ) - const { rawTransaction } = await account.signTransaction(tx) + const addCid = (cid: string) => createSignAndSendTransaction(contract.methods.addCid(cid)) - await web3.eth.sendSignedTransaction(rawTransaction) - } + const onCidAdded = contract.events.CidAdded + + const getTransactionReceipt = web3.eth.getTransactionReceipt return { + accountAddress: account.address, + close, getCidCount, getCid, addCid, + onCidAdded, + getTransactionReceipt, } } diff --git a/src/Helpers/EthereumRegistryContractAbi.ts b/src/Helpers/EthereumRegistryContractAbi.ts index 45ba1fc9..f3899ce3 100644 --- a/src/Helpers/EthereumRegistryContractAbi.ts +++ b/src/Helpers/EthereumRegistryContractAbi.ts @@ -7,6 +7,23 @@ export const EthereumRegistryContractAbi: AbiItem[] = [ stateMutability: 'nonpayable', type: 'constructor', }, + { + anonymous: false, + inputs: [ + { + indexed: false, + name: 'cid', + type: 'string', + }, + { + indexed: false, + name: 'index', + type: 'uint256', + }, + ], + name: 'CidAdded', + type: 'event', + }, { constant: true, inputs: [], diff --git a/src/Helpers/asyncPipe.ts b/src/Helpers/asyncPipe.ts index 7f81168a..920b05e8 100644 --- a/src/Helpers/asyncPipe.ts +++ b/src/Helpers/asyncPipe.ts @@ -1,3 +1,5 @@ +// Note: we should be able to replace our asyncPipe with fp-ts. See https://github.com/gcanti/fp-ts/issues/477. + export function asyncPipe(fn1: (x?: V0) => T1 | Promise): (x?: V0) => Promise export function asyncPipe(