mirror of
https://github.com/oceanprotocol-archive/squid-js.git
synced 2024-02-02 15:31:51 +01:00
replaced eslint with tslint
This commit is contained in:
parent
20c10a8ef5
commit
72c9bebc2e
13
.babelrc
13
.babelrc
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"presets": [
|
|
||||||
["@babel/preset-env", { "useBuiltIns": "entry" }]
|
|
||||||
],
|
|
||||||
"plugins": [
|
|
||||||
["@babel/plugin-transform-runtime",
|
|
||||||
{
|
|
||||||
"regenerator": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
["@babel/plugin-proposal-object-rest-spread", { "useBuiltIns": true }]
|
|
||||||
]
|
|
||||||
}
|
|
210
package-lock.json
generated
210
package-lock.json
generated
@ -5,9 +5,9 @@
|
|||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oceanprotocol/keeper-contracts": {
|
"@oceanprotocol/keeper-contracts": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.2.1.tgz",
|
||||||
"integrity": "sha512-9qEun7a9fcQ3Z4a5O3sLyXIm4SPQpLFeIbQRg/BY29aNOXEoD/wUG4mNStM6ogdMDckLgR4KyOR2mPOQs7Yh3A==",
|
"integrity": "sha512-mmgLhW0wpa42Ziaq/DRyNVnFtxfPAWQ03WeFRpwxi1h+ctyClr8ry1GGtzb7JTZkaefUlyNe71n88RBJcAe+ww==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"bignumber": "^1.1.0",
|
"bignumber": "^1.1.0",
|
||||||
"bignumber.js": "^7.2.1",
|
"bignumber.js": "^7.2.1",
|
||||||
@ -121,6 +121,15 @@
|
|||||||
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz",
|
||||||
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
|
"integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4="
|
||||||
},
|
},
|
||||||
|
"argparse": {
|
||||||
|
"version": "1.0.10",
|
||||||
|
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
|
||||||
|
"integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"sprintf-js": "~1.0.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
"array-flatten": {
|
"array-flatten": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||||
@ -759,7 +768,7 @@
|
|||||||
},
|
},
|
||||||
"babelify": {
|
"babelify": {
|
||||||
"version": "7.3.0",
|
"version": "7.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/babelify/-/babelify-7.3.0.tgz",
|
"resolved": "http://registry.npmjs.org/babelify/-/babelify-7.3.0.tgz",
|
||||||
"integrity": "sha1-qlau3nBn/XvVSWZu4W3ChQh+iOU=",
|
"integrity": "sha1-qlau3nBn/XvVSWZu4W3ChQh+iOU=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"babel-core": "^6.0.14",
|
"babel-core": "^6.0.14",
|
||||||
@ -894,7 +903,7 @@
|
|||||||
},
|
},
|
||||||
"browserify-aes": {
|
"browserify-aes": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
|
"resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz",
|
||||||
"integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==",
|
"integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"buffer-xor": "^1.0.3",
|
"buffer-xor": "^1.0.3",
|
||||||
@ -1056,6 +1065,21 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"color-convert": {
|
||||||
|
"version": "1.9.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
|
||||||
|
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"color-name": "1.1.3"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"color-name": {
|
||||||
|
"version": "1.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
|
||||||
|
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"combined-stream": {
|
"combined-stream": {
|
||||||
"version": "1.0.7",
|
"version": "1.0.7",
|
||||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz",
|
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.7.tgz",
|
||||||
@ -1096,9 +1120,12 @@
|
|||||||
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
|
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
|
||||||
},
|
},
|
||||||
"convert-source-map": {
|
"convert-source-map": {
|
||||||
"version": "1.5.1",
|
"version": "1.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz",
|
"resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.6.0.tgz",
|
||||||
"integrity": "sha1-uCeAl7m8IpNl3lxiz1/K7YtVmeU="
|
"integrity": "sha512-eFu7XigvxdZ1ETfbgPBohgyQ/Z++C0eEhTor0qRwBw9unw+L0/6V8wkSuGgzdThkiS5lSpdptOQPD8Ak40a+7A==",
|
||||||
|
"requires": {
|
||||||
|
"safe-buffer": "~5.1.1"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"cookie": {
|
"cookie": {
|
||||||
"version": "0.3.1",
|
"version": "0.3.1",
|
||||||
@ -1136,7 +1163,7 @@
|
|||||||
},
|
},
|
||||||
"create-hash": {
|
"create-hash": {
|
||||||
"version": "1.2.0",
|
"version": "1.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
|
"resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
|
||||||
"integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
|
"integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"cipher-base": "^1.0.1",
|
"cipher-base": "^1.0.1",
|
||||||
@ -1148,7 +1175,7 @@
|
|||||||
},
|
},
|
||||||
"create-hmac": {
|
"create-hmac": {
|
||||||
"version": "1.1.7",
|
"version": "1.1.7",
|
||||||
"resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
|
"resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
|
||||||
"integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
|
"integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"cipher-base": "^1.0.3",
|
"cipher-base": "^1.0.3",
|
||||||
@ -1166,13 +1193,6 @@
|
|||||||
"requires": {
|
"requires": {
|
||||||
"node-fetch": "2.1.2",
|
"node-fetch": "2.1.2",
|
||||||
"whatwg-fetch": "2.0.4"
|
"whatwg-fetch": "2.0.4"
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"whatwg-fetch": {
|
|
||||||
"version": "2.0.4",
|
|
||||||
"resolved": "http://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz",
|
|
||||||
"integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng=="
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"crypto-js": {
|
"crypto-js": {
|
||||||
@ -1299,9 +1319,9 @@
|
|||||||
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
|
||||||
},
|
},
|
||||||
"electron-to-chromium": {
|
"electron-to-chromium": {
|
||||||
"version": "1.3.62",
|
"version": "1.3.70",
|
||||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.62.tgz",
|
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.70.tgz",
|
||||||
"integrity": "sha512-x09ndL/Gjnuk3unlAyoGyUg3wbs4w/bXurgL7wL913vXHAOWmMhrLf1VNGRaMLngmadd5Q8gsV9BFuIr6rP+Xg=="
|
"integrity": "sha512-WYMjqCnPVS5JA+XvwEnpwucJpVi2+q9cdCFpbhxgWGsCtforFBEkuP9+nCyy/wnU/0SyLcLRIeZct9ayMGcXoQ=="
|
||||||
},
|
},
|
||||||
"elliptic": {
|
"elliptic": {
|
||||||
"version": "6.4.1",
|
"version": "6.4.1",
|
||||||
@ -1386,6 +1406,12 @@
|
|||||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
|
||||||
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
|
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
|
||||||
},
|
},
|
||||||
|
"esprima": {
|
||||||
|
"version": "4.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz",
|
||||||
|
"integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"esutils": {
|
"esutils": {
|
||||||
"version": "2.0.2",
|
"version": "2.0.2",
|
||||||
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
|
||||||
@ -2044,7 +2070,7 @@
|
|||||||
},
|
},
|
||||||
"express": {
|
"express": {
|
||||||
"version": "4.16.3",
|
"version": "4.16.3",
|
||||||
"resolved": "https://registry.npmjs.org/express/-/express-4.16.3.tgz",
|
"resolved": "http://registry.npmjs.org/express/-/express-4.16.3.tgz",
|
||||||
"integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=",
|
"integrity": "sha1-avilAjUNsyRuzEvs9rWjTSL37VM=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"accepts": "~1.3.5",
|
"accepts": "~1.3.5",
|
||||||
@ -2270,7 +2296,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"combined-stream": {
|
"combined-stream": {
|
||||||
"version": "1.0.6",
|
"version": "1.0.6",
|
||||||
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
|
"resolved": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
|
||||||
"integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",
|
"integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"delayed-stream": "~1.0.0"
|
"delayed-stream": "~1.0.0"
|
||||||
@ -2463,7 +2489,7 @@
|
|||||||
},
|
},
|
||||||
"http-errors": {
|
"http-errors": {
|
||||||
"version": "1.6.3",
|
"version": "1.6.3",
|
||||||
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
|
"resolved": "http://registry.npmjs.org/http-errors/-/http-errors-1.6.3.tgz",
|
||||||
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
|
"integrity": "sha1-i1VoC7S+KDoLW/TqLjhYC+HZMg0=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"depd": "~1.1.2",
|
"depd": "~1.1.2",
|
||||||
@ -2534,7 +2560,7 @@
|
|||||||
},
|
},
|
||||||
"is-builtin-module": {
|
"is-builtin-module": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
|
"resolved": "http://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz",
|
||||||
"integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",
|
"integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"builtin-modules": "^1.0.0"
|
"builtin-modules": "^1.0.0"
|
||||||
@ -2632,6 +2658,16 @@
|
|||||||
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
|
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
|
||||||
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls="
|
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls="
|
||||||
},
|
},
|
||||||
|
"js-yaml": {
|
||||||
|
"version": "3.12.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz",
|
||||||
|
"integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"argparse": "^1.0.7",
|
||||||
|
"esprima": "^4.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"jsbn": {
|
"jsbn": {
|
||||||
"version": "0.1.1",
|
"version": "0.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||||
@ -2699,7 +2735,7 @@
|
|||||||
},
|
},
|
||||||
"jsonfile": {
|
"jsonfile": {
|
||||||
"version": "2.4.0",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
|
"resolved": "http://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz",
|
||||||
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
|
"integrity": "sha1-NzaitCi4e72gzIO1P6PWM6NcKug=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"graceful-fs": "^4.1.6"
|
"graceful-fs": "^4.1.6"
|
||||||
@ -2788,7 +2824,7 @@
|
|||||||
},
|
},
|
||||||
"readable-stream": {
|
"readable-stream": {
|
||||||
"version": "1.1.14",
|
"version": "1.1.14",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
|
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz",
|
||||||
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
|
"integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"core-util-is": "~1.0.0",
|
"core-util-is": "~1.0.0",
|
||||||
@ -2825,7 +2861,7 @@
|
|||||||
},
|
},
|
||||||
"readable-stream": {
|
"readable-stream": {
|
||||||
"version": "1.0.34",
|
"version": "1.0.34",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz",
|
||||||
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
"integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"core-util-is": "~1.0.0",
|
"core-util-is": "~1.0.0",
|
||||||
@ -2872,7 +2908,7 @@
|
|||||||
},
|
},
|
||||||
"load-json-file": {
|
"load-json-file": {
|
||||||
"version": "1.1.0",
|
"version": "1.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
|
"resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
|
||||||
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
|
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"graceful-fs": "^4.1.2",
|
"graceful-fs": "^4.1.2",
|
||||||
@ -3198,7 +3234,7 @@
|
|||||||
},
|
},
|
||||||
"os-locale": {
|
"os-locale": {
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
|
"resolved": "http://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz",
|
||||||
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
|
"integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"lcid": "^1.0.0"
|
"lcid": "^1.0.0"
|
||||||
@ -3448,7 +3484,7 @@
|
|||||||
},
|
},
|
||||||
"readable-stream": {
|
"readable-stream": {
|
||||||
"version": "2.3.6",
|
"version": "2.3.6",
|
||||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
"resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz",
|
||||||
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"core-util-is": "~1.0.0",
|
"core-util-is": "~1.0.0",
|
||||||
@ -3751,7 +3787,7 @@
|
|||||||
},
|
},
|
||||||
"sha.js": {
|
"sha.js": {
|
||||||
"version": "2.4.11",
|
"version": "2.4.11",
|
||||||
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
|
"resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
|
||||||
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
|
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"inherits": "^2.0.1",
|
"inherits": "^2.0.1",
|
||||||
@ -3835,9 +3871,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"spdx-license-ids": {
|
"spdx-license-ids": {
|
||||||
"version": "3.0.0",
|
"version": "3.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.1.tgz",
|
||||||
"integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA=="
|
"integrity": "sha512-TfOfPcYGBB5sDuPn3deByxPhmfegAhpDYKSOXZQN81Oyrrif8ZCodOLzK3AesELnCx03kikhyDwh0pfvvQvF8w=="
|
||||||
|
},
|
||||||
|
"sprintf-js": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
|
||||||
|
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"sshpk": {
|
"sshpk": {
|
||||||
"version": "1.14.2",
|
"version": "1.14.2",
|
||||||
@ -3954,7 +3996,7 @@
|
|||||||
},
|
},
|
||||||
"through": {
|
"through": {
|
||||||
"version": "2.3.8",
|
"version": "2.3.8",
|
||||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
"resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz",
|
||||||
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
"integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
|
||||||
},
|
},
|
||||||
"through2": {
|
"through2": {
|
||||||
@ -4136,6 +4178,84 @@
|
|||||||
"web3": "0.20.6"
|
"web3": "0.20.6"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"tslib": {
|
||||||
|
"version": "1.9.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz",
|
||||||
|
"integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"tslint": {
|
||||||
|
"version": "5.11.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tslint/-/tslint-5.11.0.tgz",
|
||||||
|
"integrity": "sha1-mPMMAurjzecAYgHkwzywi0hYHu0=",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"babel-code-frame": "^6.22.0",
|
||||||
|
"builtin-modules": "^1.1.1",
|
||||||
|
"chalk": "^2.3.0",
|
||||||
|
"commander": "^2.12.1",
|
||||||
|
"diff": "^3.2.0",
|
||||||
|
"glob": "^7.1.1",
|
||||||
|
"js-yaml": "^3.7.0",
|
||||||
|
"minimatch": "^3.0.4",
|
||||||
|
"resolve": "^1.3.2",
|
||||||
|
"semver": "^5.3.0",
|
||||||
|
"tslib": "^1.8.0",
|
||||||
|
"tsutils": "^2.27.2"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": {
|
||||||
|
"version": "3.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
|
||||||
|
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"color-convert": "^1.9.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"chalk": {
|
||||||
|
"version": "2.4.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz",
|
||||||
|
"integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"ansi-styles": "^3.2.1",
|
||||||
|
"escape-string-regexp": "^1.0.5",
|
||||||
|
"supports-color": "^5.3.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"commander": {
|
||||||
|
"version": "2.18.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/commander/-/commander-2.18.0.tgz",
|
||||||
|
"integrity": "sha512-6CYPa+JP2ftfRU2qkDK+UTVeQYosOg/2GbcjIcKPHfinyOLPVGXu/ovN86RP49Re5ndJK1N0kuiidFFuepc4ZQ==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"has-flag": {
|
||||||
|
"version": "3.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
|
||||||
|
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
|
"supports-color": {
|
||||||
|
"version": "5.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
|
||||||
|
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"has-flag": "^3.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tsutils": {
|
||||||
|
"version": "2.29.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz",
|
||||||
|
"integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"tslib": "^1.8.1"
|
||||||
|
}
|
||||||
|
},
|
||||||
"tunnel-agent": {
|
"tunnel-agent": {
|
||||||
"version": "0.6.0",
|
"version": "0.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||||
@ -4164,6 +4284,12 @@
|
|||||||
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
|
||||||
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
|
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
|
||||||
},
|
},
|
||||||
|
"typescript": {
|
||||||
|
"version": "3.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz",
|
||||||
|
"integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"ultron": {
|
"ultron": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz",
|
||||||
@ -4244,7 +4370,7 @@
|
|||||||
},
|
},
|
||||||
"web3": {
|
"web3": {
|
||||||
"version": "0.20.6",
|
"version": "0.20.6",
|
||||||
"resolved": "https://registry.npmjs.org/web3/-/web3-0.20.6.tgz",
|
"resolved": "http://registry.npmjs.org/web3/-/web3-0.20.6.tgz",
|
||||||
"integrity": "sha1-PpcwauAk+yThCj11yIQwJWIhUSA=",
|
"integrity": "sha1-PpcwauAk+yThCj11yIQwJWIhUSA=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934",
|
"bignumber.js": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934",
|
||||||
@ -4256,7 +4382,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bignumber.js": {
|
"bignumber.js": {
|
||||||
"version": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934",
|
"version": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934",
|
||||||
"from": "git+https://github.com/frozeman/bignumber.js-nolookahead.git#57692b3ecfc98bbdd6b3a516cb2353652ea49934"
|
"from": "git+https://github.com/frozeman/bignumber.js-nolookahead.git"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -4331,9 +4457,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"whatwg-fetch": {
|
"whatwg-fetch": {
|
||||||
"version": "3.0.0",
|
"version": "2.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz",
|
"resolved": "http://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz",
|
||||||
"integrity": "sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q=="
|
"integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng=="
|
||||||
},
|
},
|
||||||
"which-module": {
|
"which-module": {
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
@ -4347,7 +4473,7 @@
|
|||||||
},
|
},
|
||||||
"wrap-ansi": {
|
"wrap-ansi": {
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
"resolved": "http://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz",
|
||||||
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
|
"integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"string-width": "^1.0.1",
|
"string-width": "^1.0.1",
|
||||||
@ -4430,7 +4556,7 @@
|
|||||||
},
|
},
|
||||||
"yargs": {
|
"yargs": {
|
||||||
"version": "4.8.1",
|
"version": "4.8.1",
|
||||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz",
|
"resolved": "http://registry.npmjs.org/yargs/-/yargs-4.8.1.tgz",
|
||||||
"integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=",
|
"integrity": "sha1-wMQpJMpKqmsObaFznfshZDn53cA=",
|
||||||
"requires": {
|
"requires": {
|
||||||
"cliui": "^3.2.0",
|
"cliui": "^3.2.0",
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"description": "JavaScript client library for Ocean Protocol",
|
"description": "JavaScript client library for Ocean Protocol",
|
||||||
"main": "dist/squid.js",
|
"main": "dist/squid.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "eslint ./src",
|
"test": "tslint -c tslint.json 'src/**/*.ts'",
|
||||||
"start": "tsc -w",
|
"start": "tsc -w",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"release": "./node_modules/release-it/bin/release-it.js --src.tagName='v%s' --github.release --npm.publish --non-interactive",
|
"release": "./node_modules/release-it/bin/release-it.js --src.tagName='v%s' --github.release --npm.publish --non-interactive",
|
||||||
@ -27,13 +27,14 @@
|
|||||||
"@oceanprotocol/keeper-contracts": "^0.2.0",
|
"@oceanprotocol/keeper-contracts": "^0.2.0",
|
||||||
"bn.js": "^4.11.8",
|
"bn.js": "^4.11.8",
|
||||||
"truffle-contract": "^3.0.6",
|
"truffle-contract": "^3.0.6",
|
||||||
"web3": "0.20.6",
|
"web3": "0.20.6"
|
||||||
"whatwg-fetch": "^3.0.0"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=8 <10"
|
"node": ">=8 <10"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/web3": "^1.0.6"
|
"@types/web3": "^1.0.6",
|
||||||
|
"tslint": "^5.11.0",
|
||||||
|
"typescript": "^3.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
import ContractLoader from './contractLoader'
|
|
||||||
import KeeperBase from './keeper-base'
|
|
||||||
import Web3Helper from "../utils/Web3Helper";
|
|
||||||
import Config from "../utils/config";
|
import Config from "../utils/config";
|
||||||
|
import Web3Helper from "../utils/Web3Helper";
|
||||||
|
import ContractLoader from "./contractLoader";
|
||||||
|
import KeeperBase from "./keeper-base";
|
||||||
|
|
||||||
export default class OceanAuth extends KeeperBase {
|
export default class OceanAuth extends KeeperBase {
|
||||||
|
|
||||||
private constructor(config: Config, web3Helper: Web3Helper) {
|
|
||||||
super(config, web3Helper)
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async getInstance(config: Config, web3Helper) {
|
public static async getInstance(config: Config, web3Helper) {
|
||||||
const auth = new OceanAuth(config, web3Helper);
|
const auth = new OceanAuth(config, web3Helper);
|
||||||
|
|
||||||
auth.contract = await ContractLoader.load('OceanAuth', auth._web3Helper)
|
auth.contract = await ContractLoader.load("OceanAuth", auth.web3Helper);
|
||||||
return auth;
|
return auth;
|
||||||
}
|
}
|
||||||
|
|
||||||
cancelAccessRequest(orderId: string, senderAddress: string) {
|
private constructor(config: Config, web3Helper: Web3Helper) {
|
||||||
return this.contract.cancelAccessRequest(orderId, {from: senderAddress})
|
super(config, web3Helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
getOrderStatus(orderId: string) {
|
public cancelAccessRequest(orderId: string, senderAddress: string) {
|
||||||
return this.contract.statusOfAccessRequest(orderId)
|
return this.contract.cancelAccessRequest(orderId, {from: senderAddress});
|
||||||
}
|
}
|
||||||
|
|
||||||
getEncryptedAccessToken(orderId: string, senderAddress: string) {
|
public getOrderStatus(orderId: string) {
|
||||||
return this.contract.getEncryptedAccessToken(orderId, {from: senderAddress})
|
return this.contract.statusOfAccessRequest(orderId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getEncryptedAccessToken(orderId: string, senderAddress: string) {
|
||||||
|
return this.contract.getEncryptedAccessToken(orderId, {from: senderAddress});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
import * as TruffleContract from 'truffle-contract'
|
import * as TruffleContract from "truffle-contract";
|
||||||
import Logger from '../utils/logger'
|
import Logger from "../utils/logger";
|
||||||
import Web3Helper from '../utils/Web3Helper'
|
import Web3Helper from "../utils/Web3Helper";
|
||||||
|
|
||||||
const contracts: Map<string, object> = new Map<string, object>()
|
const contracts: Map<string, object> = new Map<string, object>();
|
||||||
|
|
||||||
export default class ContractLoader {
|
export default class ContractLoader {
|
||||||
static async _doLoad(what: string, web3Helper: Web3Helper): Promise<object> {
|
public static async load(what: string, web3Helper: Web3Helper) {
|
||||||
const where = (await web3Helper.getNetworkName()).toLowerCase()
|
return contracts.get(what) || await ContractLoader._doLoad(what, web3Helper);
|
||||||
Logger.log('Loading', what, 'from', where)
|
}
|
||||||
|
|
||||||
|
private static async _doLoad(what: string, web3Helper: Web3Helper): Promise<object> {
|
||||||
|
const where = (await web3Helper.getNetworkName()).toLowerCase();
|
||||||
|
Logger.log("Loading", what, "from", where);
|
||||||
try {
|
try {
|
||||||
/* eslint-disable-next-line security/detect-non-literal-require */
|
/* eslint-disable-next-line security/detect-non-literal-require */
|
||||||
const artifact = require(`@oceanprotocol/keeper-contracts/artifacts/${what}.${where}`)
|
const artifact = require(`@oceanprotocol/keeper-contracts/artifacts/${what}.${where}`);
|
||||||
// Logger.log('Loaded artifact', artifact)
|
// Logger.log('Loaded artifact', artifact)
|
||||||
|
|
||||||
const contract = TruffleContract(artifact)
|
const contract = TruffleContract(artifact);
|
||||||
Logger.log('Getting instance of', what, 'from', where, 'at', artifact.address)
|
Logger.log("Getting instance of", what, "from", where, "at", artifact.address);
|
||||||
contract.setProvider(web3Helper.web3.currentProvider)
|
contract.setProvider(web3Helper.web3.currentProvider);
|
||||||
contracts.set(what, await contract.at(artifact.address))
|
contracts.set(what, await contract.at(artifact.address));
|
||||||
return contracts.get(what)
|
return contracts.get(what);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Logger.error('Failed to load', what, 'from', where)
|
Logger.error("Failed to load", what, "from", where);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static async load(what: string, web3Helper: Web3Helper) {
|
|
||||||
return contracts.get(what) || await ContractLoader._doLoad(what, web3Helper)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
import Web3Helper from '../utils/Web3Helper'
|
|
||||||
import Config from "../utils/config";
|
import Config from "../utils/config";
|
||||||
|
import Web3Helper from "../utils/Web3Helper";
|
||||||
|
|
||||||
export default class KeeperBase {
|
export default class KeeperBase {
|
||||||
|
|
||||||
protected _config: Config
|
|
||||||
protected _web3Helper: Web3Helper;
|
|
||||||
public contract: any = null;
|
public contract: any = null;
|
||||||
|
|
||||||
|
protected config: Config;
|
||||||
|
protected web3Helper: Web3Helper;
|
||||||
|
|
||||||
constructor(config: Config, web3Helper: Web3Helper) {
|
constructor(config: Config, web3Helper: Web3Helper) {
|
||||||
this._config = config;
|
this.config = config;
|
||||||
this._web3Helper = web3Helper
|
this.web3Helper = web3Helper;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,61 +1,61 @@
|
|||||||
import ContractLoader from './contractLoader'
|
|
||||||
import KeeperBase from './keeper-base'
|
|
||||||
import Logger from '../utils/logger'
|
|
||||||
import Web3Helper from "../utils/Web3Helper";
|
|
||||||
import BigNumber from "bignumber.js";
|
import BigNumber from "bignumber.js";
|
||||||
import Config from "../utils/config";
|
import Config from "../utils/config";
|
||||||
|
import Logger from "../utils/logger";
|
||||||
|
import Web3Helper from "../utils/Web3Helper";
|
||||||
|
import ContractLoader from "./contractLoader";
|
||||||
|
import KeeperBase from "./keeper-base";
|
||||||
|
|
||||||
export default class OceanMarket extends KeeperBase {
|
export default class OceanMarket extends KeeperBase {
|
||||||
|
|
||||||
private constructor(config: Config, web3Helper: Web3Helper) {
|
|
||||||
super(config, web3Helper)
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async getInstance(config: Config, web3Helper: Web3Helper) {
|
public static async getInstance(config: Config, web3Helper: Web3Helper) {
|
||||||
|
|
||||||
const market = new OceanMarket(config, web3Helper);
|
const market = new OceanMarket(config, web3Helper);
|
||||||
market.contract = await ContractLoader.load('OceanMarket', market._web3Helper)
|
market.contract = await ContractLoader.load("OceanMarket", market.web3Helper);
|
||||||
return market;
|
return market;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private constructor(config: Config, web3Helper: Web3Helper) {
|
||||||
|
super(config, web3Helper);
|
||||||
|
}
|
||||||
|
|
||||||
// call functions (costs no gas)
|
// call functions (costs no gas)
|
||||||
checkAsset(assetId: string) {
|
public checkAsset(assetId: string) {
|
||||||
return this.contract.checkAsset(assetId)
|
return this.contract.checkAsset(assetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyOrderPayment(orderId: string): boolean {
|
public verifyOrderPayment(orderId: string): boolean {
|
||||||
return this.contract.verifyPaymentReceived(orderId)
|
return this.contract.verifyPaymentReceived(orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAssetPrice(assetId: string) {
|
public getAssetPrice(assetId: string) {
|
||||||
return this.contract.getAssetPrice(assetId)
|
return this.contract.getAssetPrice(assetId)
|
||||||
.then((price: BigNumber) => price.toNumber())
|
.then((price: BigNumber) => price.toNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transactions with gas cost
|
// Transactions with gas cost
|
||||||
requestTokens(amount: number, address: string) {
|
public requestTokens(amount: number, address: string) {
|
||||||
return this.contract.requestTokens(amount, {from: address})
|
return this.contract.requestTokens(amount, {from: address});
|
||||||
}
|
}
|
||||||
|
|
||||||
async registerAsset(name: string, description: string, price: number, publisherAddress: string) {
|
public async registerAsset(name: string, description: string, price: number, publisherAddress: string) {
|
||||||
const assetId = await this.contract.generateId(name + description)
|
const assetId = await this.contract.generateId(name + description);
|
||||||
const result = await this.contract.register(
|
const result = await this.contract.register(
|
||||||
assetId,
|
assetId,
|
||||||
price, {
|
price, {
|
||||||
from: publisherAddress, gas:
|
from: publisherAddress,
|
||||||
this._config.defaultGas
|
gas: this.config.defaultGas,
|
||||||
}
|
},
|
||||||
)
|
);
|
||||||
Logger.log('registered: ', result)
|
Logger.log("registered: ", result);
|
||||||
return assetId
|
return assetId;
|
||||||
}
|
}
|
||||||
|
|
||||||
async payAsset(assetId: string, order: any, publisherAddress: string, senderAddress: string) {
|
public async payAsset(assetId: string, order: any, publisherAddress: string, senderAddress: string) {
|
||||||
let assetPrice = await this.contract.getAssetPrice(assetId)
|
const assetPrice = await this.contract.getAssetPrice(assetId)
|
||||||
.then((price: BigNumber) => price.toNumber())
|
.then((price: BigNumber) => price.toNumber());
|
||||||
this.contract.sendPayment(order.id, publisherAddress, assetPrice, order.timeout, {
|
this.contract.sendPayment(order.id, publisherAddress, assetPrice, order.timeout, {
|
||||||
from: senderAddress,
|
from: senderAddress,
|
||||||
gas: 2000000
|
gas: 2000000,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,36 @@
|
|||||||
import ContractLoader from './contractLoader'
|
|
||||||
import KeeperBase from './keeper-base'
|
|
||||||
import Logger from '../utils/logger'
|
|
||||||
import Web3Helper from "../utils/Web3Helper"
|
|
||||||
import Config from "../utils/config";
|
import Config from "../utils/config";
|
||||||
|
import Logger from "../utils/logger";
|
||||||
|
import Web3Helper from "../utils/Web3Helper";
|
||||||
|
import ContractLoader from "./contractLoader";
|
||||||
|
import KeeperBase from "./keeper-base";
|
||||||
|
|
||||||
export default class OceanToken extends KeeperBase {
|
export default class OceanToken extends KeeperBase {
|
||||||
|
|
||||||
private constructor(config: Config, web3Helper: Web3Helper) {
|
|
||||||
super(config, web3Helper)
|
|
||||||
}
|
|
||||||
|
|
||||||
public static async getInstance(config: Config, web3Helper: Web3Helper) {
|
public static async getInstance(config: Config, web3Helper: Web3Helper) {
|
||||||
const token = new OceanToken(config, web3Helper)
|
const token = new OceanToken(config, web3Helper);
|
||||||
token.contract = await ContractLoader.load('OceanToken', token._web3Helper)
|
token.contract = await ContractLoader.load("OceanToken", token.web3Helper);
|
||||||
|
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
getTokenBalance(accountAddress: string) {
|
private constructor(config: Config, web3Helper: Web3Helper) {
|
||||||
return this.contract.balanceOf.call(accountAddress)
|
super(config, web3Helper);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getEthBalance(account: string): Promise<number> {
|
public getTokenBalance(accountAddress: string) {
|
||||||
|
return this.contract.balanceOf.call(accountAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getEthBalance(account: string): Promise<number> {
|
||||||
return new Promise<number>((resolve, reject) => {
|
return new Promise<number>((resolve, reject) => {
|
||||||
Logger.log('getting balance for', account)
|
Logger.log("getting balance for", account);
|
||||||
this._web3Helper.web3.eth.getBalance(account, 'latest', (err: any, balance: number) => {
|
this.web3Helper.web3.eth.getBalance(account, "latest", (err: any, balance: number) => {
|
||||||
if (err) return reject(err)
|
if (err) {
|
||||||
Logger.log('balance', balance)
|
return reject(err);
|
||||||
resolve(balance)
|
}
|
||||||
})
|
Logger.log("balance", balance);
|
||||||
})
|
resolve(balance);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,44 +1,45 @@
|
|||||||
import Logger from './utils/logger'
|
|
||||||
import Config from "./utils/config";
|
import Config from "./utils/config";
|
||||||
|
import Logger from "./utils/logger";
|
||||||
|
|
||||||
declare var fetch
|
declare var fetch;
|
||||||
|
|
||||||
export default class MetaData {
|
export default class MetaData {
|
||||||
|
|
||||||
private assetsUrl: string;
|
private assetsUrl: string;
|
||||||
|
|
||||||
constructor(config: Config) {
|
constructor(config: Config) {
|
||||||
const providerUri = config.providerUri || null
|
const providerUri = config.providerUri || null;
|
||||||
|
|
||||||
this.assetsUrl = providerUri + '/assets'
|
this.assetsUrl = providerUri + "/assets";
|
||||||
}
|
}
|
||||||
|
|
||||||
getAssetsMetadata() {
|
public getAssetsMetadata() {
|
||||||
return fetch(this.assetsUrl + '/metadata', { method: 'GET' })
|
return fetch(this.assetsUrl + "/metadata", {method: "GET"})
|
||||||
.then(res => res.json())
|
.then((res) => res.json())
|
||||||
.then(data => JSON.parse(data))
|
.then((data) => JSON.parse(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
publishDataAsset(asset: object) {
|
public publishDataAsset(asset: object) {
|
||||||
return fetch(this.assetsUrl + '/metadata',
|
return fetch(this.assetsUrl + "/metadata",
|
||||||
{
|
{
|
||||||
method: 'POST',
|
method: "POST",
|
||||||
body: JSON.stringify(asset),
|
body: JSON.stringify(asset),
|
||||||
headers: { 'Content-type': 'application/json' }
|
headers: {"Content-type": "application/json"},
|
||||||
})
|
})
|
||||||
.then((response: any) => {
|
.then((response: any) => {
|
||||||
Logger.log('Success:', response)
|
Logger.log("Success:", response);
|
||||||
if (response.ok) {
|
if (response.ok) {
|
||||||
Logger.log('Success:', response)
|
Logger.log("Success:", response);
|
||||||
return true
|
return true;
|
||||||
}
|
}
|
||||||
Logger.log('Failed: ', response.status, response.statusText)
|
Logger.log("Failed: ", response.status, response.statusText);
|
||||||
return false
|
return false;
|
||||||
// throw new Error(response.statusText ? response.statusText : `publish asset failed with status ${response.status}`)
|
// throw new Error(response.statusText ? response.statusText :
|
||||||
|
// `publish asset failed with status ${response.status}`)
|
||||||
})
|
})
|
||||||
.catch((error: Error) => {
|
.catch((error: Error) => {
|
||||||
Logger.log(`Publish asset to ocean database could not be completed: ${error.message}`)
|
Logger.log(`Publish asset to ocean database could not be completed: ${error.message}`);
|
||||||
return false
|
return false;
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
171
src/ocean.ts
171
src/ocean.ts
@ -1,15 +1,24 @@
|
|||||||
import OceanMarket from './keeper/market'
|
import BigNumber = require("bn.js");
|
||||||
import OceanAuth from './keeper/auth'
|
import OceanAuth from "./keeper/auth";
|
||||||
import OceanToken from './keeper/token'
|
import OceanMarket from "./keeper/market";
|
||||||
import Logger from './utils/logger'
|
import OceanToken from "./keeper/token";
|
||||||
import Web3Helper from './utils/Web3Helper'
|
import MetaData from "./metadata";
|
||||||
import MetaData from './metadata'
|
|
||||||
import BigNumber = require("bn.js")
|
|
||||||
import Config from "./utils/config";
|
import Config from "./utils/config";
|
||||||
|
import Logger from "./utils/logger";
|
||||||
|
import Web3Helper from "./utils/Web3Helper";
|
||||||
|
|
||||||
export default class Ocean {
|
export default class Ocean {
|
||||||
|
|
||||||
private _config: Config;
|
public static async getInstance(config) {
|
||||||
|
|
||||||
|
const ocean = new Ocean(config);
|
||||||
|
|
||||||
|
ocean.market = await OceanMarket.getInstance(config, ocean.helper);
|
||||||
|
ocean.auth = await OceanAuth.getInstance(config, ocean.helper);
|
||||||
|
ocean.token = await OceanToken.getInstance(config, ocean.helper);
|
||||||
|
|
||||||
|
return ocean;
|
||||||
|
}
|
||||||
|
|
||||||
public token: OceanToken;
|
public token: OceanToken;
|
||||||
public market: OceanMarket;
|
public market: OceanMarket;
|
||||||
@ -17,66 +26,58 @@ export default class Ocean {
|
|||||||
public helper: Web3Helper;
|
public helper: Web3Helper;
|
||||||
public metadata: MetaData;
|
public metadata: MetaData;
|
||||||
|
|
||||||
|
private config: Config;
|
||||||
|
|
||||||
private constructor(config: Config) {
|
private constructor(config: Config) {
|
||||||
|
|
||||||
this._config = config;
|
this.config = config;
|
||||||
|
|
||||||
this.helper = new Web3Helper(config)
|
this.helper = new Web3Helper(config);
|
||||||
this.metadata = new MetaData(config)
|
this.metadata = new MetaData(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async getInstance(config) {
|
public async getAccounts() {
|
||||||
|
|
||||||
const ocean = new Ocean(config);
|
|
||||||
|
|
||||||
ocean.market = await OceanMarket.getInstance(config, ocean.helper)
|
|
||||||
ocean.auth = await OceanAuth.getInstance(config, ocean.helper)
|
|
||||||
ocean.token = await OceanToken.getInstance(config, ocean.helper)
|
|
||||||
|
|
||||||
return ocean;
|
|
||||||
}
|
|
||||||
|
|
||||||
async getAccounts() {
|
|
||||||
return Promise.all((await this.helper.getAccounts()).map(async (account: string) => {
|
return Promise.all((await this.helper.getAccounts()).map(async (account: string) => {
|
||||||
// await ocean.market.requestTokens(account, 1000)
|
// await ocean.market.requestTokens(account, 1000)
|
||||||
|
const {token} = this;
|
||||||
return {
|
return {
|
||||||
name: account,
|
name: account,
|
||||||
balance: {
|
balance: {
|
||||||
ocn: await this.token.getTokenBalance(account),
|
eth: await token.getEthBalance(account),
|
||||||
eth: await this.token.getEthBalance(account)
|
ocn: await token.getTokenBalance(account),
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
}))
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
async getOrdersByConsumer(consumerAddress: string) {
|
public async getOrdersByConsumer(consumerAddress: string) {
|
||||||
let accessConsentEvent = this.auth.contract.AccessConsentRequested({_consumer: consumerAddress}, {
|
const {auth} = this;
|
||||||
|
const accessConsentEvent = auth.contract.AccessConsentRequested({_consumer: consumerAddress}, {
|
||||||
fromBlock: 0,
|
fromBlock: 0,
|
||||||
toBlock: 'latest'
|
toBlock: "latest",
|
||||||
})
|
});
|
||||||
|
|
||||||
let _resolve: Function = null
|
let outerResolve = null;
|
||||||
let _reject: Function = null
|
let outerReject = null;
|
||||||
const promise = new Promise<any[]>((resolve, reject) => {
|
const promise = new Promise<any[]>((resolve, reject) => {
|
||||||
_resolve = resolve
|
outerResolve = resolve;
|
||||||
_reject = reject
|
outerReject = reject;
|
||||||
})
|
});
|
||||||
|
|
||||||
const getEvents = (): Promise<any[]> => {
|
const getEvents = (): Promise<any[]> => {
|
||||||
accessConsentEvent.get((error: any, logs: any[]) => {
|
accessConsentEvent.get((error: any, logs: any[]) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
_reject(error)
|
outerReject(error);
|
||||||
throw new Error(error)
|
throw new Error(error);
|
||||||
} else {
|
} else {
|
||||||
_resolve(logs)
|
outerResolve(logs);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
return promise
|
return promise;
|
||||||
}
|
};
|
||||||
const events = await getEvents().then((events) => events)
|
const events = await getEvents().then((result) => result);
|
||||||
// let orders = await this.buildOrdersFromEvents(events, consumerAddress).then((result) => result)
|
// let orders = await this.buildOrdersFromEvents(events, consumerAddress).then((result) => result)
|
||||||
let orders = events
|
const orders = events
|
||||||
.filter((obj: any) => (obj.args._consumer === consumerAddress))
|
.filter((obj: any) => (obj.args._consumer === consumerAddress))
|
||||||
.map(async (event: any) => ({
|
.map(async (event: any) => ({
|
||||||
...event.args,
|
...event.args,
|
||||||
@ -84,69 +85,69 @@ export default class Ocean {
|
|||||||
status: await this.auth.getOrderStatus(event.args._id)
|
status: await this.auth.getOrderStatus(event.args._id)
|
||||||
.then((status: BigNumber) => status.toNumber()),
|
.then((status: BigNumber) => status.toNumber()),
|
||||||
paid: this.market.verifyOrderPayment(event.args._id),
|
paid: this.market.verifyOrderPayment(event.args._id),
|
||||||
key: null
|
key: null,
|
||||||
}))
|
}));
|
||||||
Logger.debug('got orders: ', orders)
|
Logger.debug("got orders: ", orders);
|
||||||
return orders
|
return orders;
|
||||||
}
|
}
|
||||||
|
|
||||||
async purchaseAsset(
|
public async purchaseAsset(
|
||||||
assetId: string, publisherId: string, price: number, privateKey: string, publicKey: string, timeout: number, senderAddress: string,
|
assetId: string, publisherId: string, price: number, privateKey: string, publicKey: string, timeout: number,
|
||||||
initialRequestEventHandler: Function, accessCommittedEventHandler: Function, tokenPublishedEventHandler: Function) {
|
senderAddress: string, initialRequestEventHandler, accessCommittedEventHandler, tokenPublishedEventHandler) {
|
||||||
const {token: OceanToken, market: OceanMarket, auth} = this
|
const {token, market, auth, config} = this;
|
||||||
try {
|
try {
|
||||||
// Allow market contract to transfer funds on the consumer's behalf
|
// Allow market contract to transfer funds on the consumer"s behalf
|
||||||
await this.token.contract.approve(this.market.contract.address, price, {from: senderAddress, gas: 2000000})
|
await token.contract.approve(market.contract.address, price, {from: senderAddress, gas: config.defaultGas});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Logger.log('token approve', err)
|
Logger.log("token approve", err);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// Submit the access request
|
// Submit the access request
|
||||||
await auth.contract.initiateAccessRequest(
|
await auth.contract.initiateAccessRequest(
|
||||||
assetId, publisherId, publicKey,
|
assetId, publisherId, publicKey,
|
||||||
timeout, {from: senderAddress, gas: 1000000}
|
timeout, {from: senderAddress, gas: 1000000},
|
||||||
)
|
);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Logger.log('initiateAccessRequest', err)
|
Logger.log("initiateAccessRequest", err);
|
||||||
}
|
}
|
||||||
const resourceFilter = {_resourceId: assetId, _consumer: senderAddress}
|
const resourceFilter = {_resourceId: assetId, _consumer: senderAddress};
|
||||||
const initRequestEvent = auth.contract.AccessConsentRequested(resourceFilter)
|
const initRequestEvent = auth.contract.AccessConsentRequested(resourceFilter);
|
||||||
let order: any = {}
|
let order: any = {};
|
||||||
this._listenOnce(
|
this._listenOnce(
|
||||||
initRequestEvent,
|
initRequestEvent,
|
||||||
'AccessConsentRequested',
|
"AccessConsentRequested",
|
||||||
(result: any, error: any) => {
|
(result: any, error: any) => {
|
||||||
order = initialRequestEventHandler(result, error)
|
order = initialRequestEventHandler(result, error);
|
||||||
const requestIdFilter = {_id: order.id}
|
const requestIdFilter = {_id: order.id};
|
||||||
const accessCommittedEvent = auth.contract.AccessRequestCommitted(requestIdFilter)
|
const accessCommittedEvent = auth.contract.AccessRequestCommitted(requestIdFilter);
|
||||||
const tokenPublishedEvent = auth.contract.EncryptedTokenPublished(requestIdFilter)
|
const tokenPublishedEvent = auth.contract.EncryptedTokenPublished(requestIdFilter);
|
||||||
this._listenOnce(
|
this._listenOnce(
|
||||||
accessCommittedEvent,
|
accessCommittedEvent,
|
||||||
'AccessRequestCommitted',
|
"AccessRequestCommitted",
|
||||||
(result: any, error: any) => {
|
(accessRequestCommittedResult: any, accessRequestCommittedError: any) => {
|
||||||
accessCommittedEventHandler(result, order, error)
|
accessCommittedEventHandler(accessRequestCommittedResult, order, accessRequestCommittedError);
|
||||||
}
|
},
|
||||||
)
|
);
|
||||||
this._listenOnce(
|
this._listenOnce(
|
||||||
tokenPublishedEvent,
|
tokenPublishedEvent,
|
||||||
'EncryptedTokenPublished',
|
"EncryptedTokenPublished",
|
||||||
(result: any, error: any) => {
|
(encryptedTokenPublishedResult: any, encryptedTokenPublishedError: any) => {
|
||||||
tokenPublishedEventHandler(result, order, error)
|
tokenPublishedEventHandler(encryptedTokenPublishedResult, order, encryptedTokenPublishedError);
|
||||||
}
|
},
|
||||||
)
|
);
|
||||||
})
|
});
|
||||||
return order
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper functions (private)
|
// Helper functions (private)
|
||||||
_listenOnce(event: any, eventName: string, callback: Function) {
|
public _listenOnce(event: any, eventName: string, callback) {
|
||||||
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
||||||
event.watch((error: any, result: any) => {
|
event.watch((error: any, result: any) => {
|
||||||
event.stopWatching()
|
event.stopWatching();
|
||||||
if (error) {
|
if (error) {
|
||||||
Logger.log(`Error in keeper ${eventName} event: `, error)
|
Logger.log(`Error in keeper ${eventName} event: `, error);
|
||||||
}
|
}
|
||||||
callback(result, error)
|
callback(result, error);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import Ocean from './ocean'
|
import Ocean from "./ocean";
|
||||||
import Logger from './utils/logger'
|
import Logger from "./utils/logger";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Ocean,
|
Ocean,
|
||||||
Logger
|
Logger,
|
||||||
}
|
};
|
||||||
|
@ -1,58 +1,59 @@
|
|||||||
import Web3 = require("web3");
|
import Web3 = require("web3");
|
||||||
|
import Config from "./config";
|
||||||
|
|
||||||
export default class Web3Helper {
|
export default class Web3Helper {
|
||||||
public web3: Web3;
|
public web3: Web3;
|
||||||
|
|
||||||
constructor(config: any) {
|
public constructor(config: Config) {
|
||||||
const web3Provider = config.web3Provider || new Web3.providers.HttpProvider(config.nodeUri)
|
const web3Provider = config.web3Provider || new Web3.providers.HttpProvider(config.nodeUri);
|
||||||
this.web3 = new Web3(web3Provider)
|
this.web3 = new Web3(web3Provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
async getAccounts(): Promise<any[]> {
|
public async getAccounts(): Promise<any[]> {
|
||||||
return new Promise<any[]>((resolve: Function, reject: Function) => {
|
return new Promise<any[]>((resolve, reject) => {
|
||||||
this.web3.eth.getAccounts((err: any, accounts: string[]) => {
|
this.web3.eth.getAccounts((err: any, accounts: string[]) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err
|
throw err;
|
||||||
}
|
}
|
||||||
resolve(accounts)
|
resolve(accounts);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async getNetworkName(): Promise<string> {
|
public async getNetworkName(): Promise<string> {
|
||||||
return new Promise<string>((resolve: Function, reject: Function) => {
|
return new Promise<string>((resolve, reject) => {
|
||||||
let network: string = 'unknown'
|
let network: string = "unknown";
|
||||||
// @ts-ignore old version of web3, lets get to 1.0
|
// @ts-ignore old version of web3, lets get to 1.0
|
||||||
this.web3.version.getNetwork((err, networkId) => {
|
this.web3.version.getNetwork((err, networkId) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
throw err
|
throw err;
|
||||||
}
|
}
|
||||||
switch (networkId) {
|
switch (networkId) {
|
||||||
case '1':
|
case "1":
|
||||||
network = 'Main'
|
network = "Main";
|
||||||
break
|
break;
|
||||||
case '2':
|
case "2":
|
||||||
network = 'Morden'
|
network = "Morden";
|
||||||
break
|
break;
|
||||||
case '3':
|
case "3":
|
||||||
network = 'Ropsten'
|
network = "Ropsten";
|
||||||
break
|
break;
|
||||||
case '4':
|
case "4":
|
||||||
network = 'Rinkeby'
|
network = "Rinkeby";
|
||||||
break
|
break;
|
||||||
case '42':
|
case "42":
|
||||||
network = 'Kovan'
|
network = "Kovan";
|
||||||
break
|
break;
|
||||||
default:
|
default:
|
||||||
network = 'development'
|
network = "development";
|
||||||
}
|
}
|
||||||
resolve(network)
|
resolve(network);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// web3 wrappers
|
// web3 wrappers
|
||||||
sign(accountAddress: string, message: string) {
|
public sign(accountAddress: string, message: string) {
|
||||||
return this.web3.eth.sign(accountAddress, message)
|
return this.web3.eth.sign(accountAddress, message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,4 +2,6 @@ export default class Config {
|
|||||||
|
|
||||||
public defaultGas: number = 300000;
|
public defaultGas: number = 300000;
|
||||||
public providerUri: string;
|
public providerUri: string;
|
||||||
|
public nodeUri: string;
|
||||||
|
public web3Provider: any;
|
||||||
}
|
}
|
||||||
|
@ -1,23 +1,22 @@
|
|||||||
export default class Logger {
|
export default class Logger {
|
||||||
static dispatch(verb: string, ...args: any[]) {
|
public static log(...args: any[]) {
|
||||||
|
Logger.dispatch("log", ...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static debug(...args: any[]) {
|
||||||
|
Logger.dispatch("debug", ...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static warn(...args: any[]) {
|
||||||
|
Logger.dispatch("warn", ...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static error(...args: any[]) {
|
||||||
|
Logger.dispatch("error", ...args);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static dispatch(verb: string, ...args: any[]) {
|
||||||
/* eslint-disable-next-line no-console */
|
/* eslint-disable-next-line no-console */
|
||||||
// @ts-ignore
|
console[verb](...args);
|
||||||
console[verb](...args)
|
|
||||||
}
|
|
||||||
|
|
||||||
static log(...args: any[]) {
|
|
||||||
Logger.dispatch('log', ...args)
|
|
||||||
}
|
|
||||||
|
|
||||||
static debug(...args: any[]) {
|
|
||||||
Logger.dispatch('debug', ...args)
|
|
||||||
}
|
|
||||||
|
|
||||||
static warn(...args: any[]) {
|
|
||||||
Logger.dispatch('warn', ...args)
|
|
||||||
}
|
|
||||||
|
|
||||||
static error(...args: any[]) {
|
|
||||||
Logger.dispatch('error', ...args)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user