diff --git a/.gitignore b/.gitignore index 76add87..78f2710 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -node_modules -dist \ No newline at end of file +node_modules/ +.idea/ diff --git a/dist/gochain-ng-web3/README.md b/dist/gochain-ng-web3/README.md new file mode 100644 index 0000000..2c35086 --- /dev/null +++ b/dist/gochain-ng-web3/README.md @@ -0,0 +1,24 @@ +# GochainNgWeb3 + +This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 8.2.0. + +## Code scaffolding + +Run `ng generate component component-name --project gochain-ng-web3` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project gochain-ng-web3`. +> Note: Don't forget to add `--project gochain-ng-web3` or else it will be added to the default project in your `angular.json` file. + +## Build + +Run `ng build gochain-ng-web3` to build the project. The build artifacts will be stored in the `dist/` directory. + +## Publishing + +After building your library with `ng build gochain-ng-web3`, go to the dist folder `cd dist/gochain-ng-web3` and run `npm publish`. + +## Running unit tests + +Run `ng test gochain-ng-web3` to execute the unit tests via [Karma](https://karma-runner.github.io). + +## Further help + +To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). diff --git a/dist/gochain-ng-web3/bundles/gochain-ng-web3.umd.js b/dist/gochain-ng-web3/bundles/gochain-ng-web3.umd.js new file mode 100644 index 0000000..65b90ef --- /dev/null +++ b/dist/gochain-ng-web3/bundles/gochain-ng-web3.umd.js @@ -0,0 +1,386 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('rxjs'), require('rxjs/internal-compatibility'), require('rxjs/operators'), require('web3')) : + typeof define === 'function' && define.amd ? define('gochain-ng-web3', ['exports', '@angular/core', 'rxjs', 'rxjs/internal-compatibility', 'rxjs/operators', 'web3'], factory) : + (global = global || self, factory(global['gochain-ng-web3'] = {}, global.ng.core, global.rxjs, global.rxjs['internal-compatibility'], global.rxjs.operators, global.Web3)); +}(this, function (exports, core, rxjs, internalCompatibility, operators, Web3) { 'use strict'; + + Web3 = Web3 && Web3.hasOwnProperty('default') ? Web3['default'] : Web3; + + /** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ + var InitConfig = /** @class */ (function () { + function InitConfig() { + } + return InitConfig; + }()); + if (false) { + /** @type {?} */ + InitConfig.prototype.rpcUrl; + } + /** + * @record + */ + function IGochainWeb3Service() { } + if (false) { + /** + * @param {?} config + * @return {?} + */ + IGochainWeb3Service.prototype.initialize = function (config) { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.initializePlugin = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.activatePlugin = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.getPluginAccountAddress = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.createAccount = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.closeAccount = function () { }; + } + var GochainNgWeb3Service = /** @class */ (function () { + function GochainNgWeb3Service() { + this.metamaskInstalled$ = new rxjs.BehaviorSubject(null); + this.metamaskConfigured$ = new rxjs.BehaviorSubject(null); + this.metamaskActivated$ = new rxjs.BehaviorSubject(null); + this.ready$ = new rxjs.BehaviorSubject(null); + } + Object.defineProperty(GochainNgWeb3Service.prototype, "metamaskInstalled", { + set: /** + * @param {?} value + * @return {?} + */ + function (value) { + this._metamaskInstalled = value; + this.metamaskInstalled$.next(value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GochainNgWeb3Service.prototype, "metamaskConfigured", { + set: /** + * @param {?} value + * @return {?} + */ + function (value) { + this._metamaskConfigured = value; + this.metamaskConfigured$.next(value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GochainNgWeb3Service.prototype, "metamaskActivated", { + set: /** + * @param {?} value + * @return {?} + */ + function (value) { + this._metamaskActivated = value; + this.metamaskActivated$.next(value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GochainNgWeb3Service.prototype, "web3", { + get: /** + * @return {?} + */ + function () { + if (this._metamaskConfigured && this._metamaskInstalled) { + return this.pluginWeb3; + } + return this.gochainWeb3; + }, + enumerable: true, + configurable: true + }); + /** + * @param {?} config + * @return {?} + */ + GochainNgWeb3Service.prototype.initialize = /** + * @param {?} config + * @return {?} + */ + function (config) { + this._config = config; + if (!config.rpcUrl) { + return rxjs.throwError('rpc url hasn\'t been provided'); + } + this.gochainWeb3 = new Web3(new Web3.providers.HttpProvider(config.rpcUrl), null, { transactionConfirmationBlocks: 1 }); + return internalCompatibility.fromPromise(this.gochainWeb3.eth.net.getId()).pipe(operators.catchError((/** + * @param {?} e + * @return {?} + */ + function (e) { + return rxjs.throwError('Can\'t get GoChain network id'); + })), operators.map((/** + * @param {?} v + * @return {?} + */ + function (v) { return !!v; }))); + }; + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.initializePlugin = /** + * @return {?} + */ + function () { + var _this = this; + if (!this.gochainWeb3) { + return rxjs.throwError('initialize first'); + } + if (!this._gochainNetId) { + return rxjs.throwError('gochain network id is not provided'); + } + this.pluginWeb3 = new Web3(Web3.givenProvider, null, { transactionConfirmationBlocks: 1 }); + if (!this.pluginWeb3.currentProvider) { + this.metamaskInstalled = false; + this.metamaskConfigured = false; + return rxjs.throwError('metamask is not installed'); + } + return internalCompatibility.fromPromise(this.pluginWeb3.eth.net.getId()).pipe(operators.catchError((/** + * @param {?} e + * @return {?} + */ + function (e) { + _this.metamaskInstalled = true; + _this.metamaskConfigured = false; + return rxjs.throwError('Metamask installed but not configured properly - can\'t get network id from Metamask'); + })), operators.map((/** + * @param {?} metamaskNetID + * @return {?} + */ + function (metamaskNetID) { + if (_this._gochainNetId !== metamaskNetID) { + _this.metamaskInstalled = true; + _this.metamaskConfigured = false; + return rxjs.throwError("Metamask installed but misconfigured - network ID mismatch (must use GoChain " + _this._gochainNetId + " - e.g. by pointing to " + _this._config.rpcUrl + ")"); + } + _this.metamaskInstalled = true; + _this.metamaskConfigured = true; + _this.getPluginAccountAddress(); + return true; + }))); + }; + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.activatePlugin = /** + * @return {?} + */ + function () { + var _this = this; + return internalCompatibility.fromPromise(((/** @type {?} */ (window))).ethereum.enable()).pipe(operators.catchError((/** + * @param {?} e + * @return {?} + */ + function (e) { + _this.metamaskActivated = false; + return rxjs.throwError('Access haven\'t been granted'); + })), operators.tap((/** + * @return {?} + */ + function () { + _this.metamaskActivated = true; + }))); + }; + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.getPluginAccountAddress = /** + * @return {?} + */ + function () { + var _this = this; + internalCompatibility.fromPromise(this.pluginWeb3.eth.getAccounts()).subscribe((/** + * @param {?} accounts + * @return {?} + */ + function (accounts) { + _this.accountAddress = accounts[0]; + })); + }; + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.createAccount = /** + * @return {?} + */ + function () { + return !!this.web3 ? this.web3.eth.accounts.create() : null; + }; + /*protected _openAccount(privateKey: string) { + if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) { + privateKey = '0x' + privateKey; + } + if (privateKey.length !== 66) { + throw Error('Given private key is not valid'); + } + try { + this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey); + } catch (e) { + throw e; + } + return this.account; + }*/ + /*protected _openAccount(privateKey: string) { + if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) { + privateKey = '0x' + privateKey; + } + if (privateKey.length !== 66) { + throw Error('Given private key is not valid'); + } + try { + this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey); + } catch (e) { + throw e; + } + return this.account; + }*/ + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.closeAccount = /*protected _openAccount(privateKey: string) { + if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) { + privateKey = '0x' + privateKey; + } + if (privateKey.length !== 66) { + throw Error('Given private key is not valid'); + } + try { + this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey); + } catch (e) { + throw e; + } + return this.account; + }*/ + /** + * @return {?} + */ + function () { + this.account = null; + this.accountAddress = null; + this.accountBalance = null; + }; + /*getBalance() { + return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe( + map((balance: string) => { + this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString(); + return this.accountBalance; + }), + ); + }*/ + /*getBalance() { + return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe( + map((balance: string) => { + this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString(); + return this.accountBalance; + }), + ); + }*/ + /** + * @param {?} signed + * @return {?} + */ + GochainNgWeb3Service.prototype.sendSignedTx = /*getBalance() { + return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe( + map((balance: string) => { + this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString(); + return this.accountBalance; + }), + ); + }*/ + /** + * @param {?} signed + * @return {?} + */ + function (signed) { + return internalCompatibility.fromPromise(this.gochainWeb3.eth.sendSignedTransaction(signed.rawTransaction)); + }; + /** + * @param {?} address + * @return {?} + */ + GochainNgWeb3Service.prototype.isAddress = /** + * @param {?} address + * @return {?} + */ + function (address) { + return this.gochainWeb3.utils.isAddress(address); + }; + GochainNgWeb3Service.decorators = [ + { type: core.Injectable, args: [{ + providedIn: 'root' + },] } + ]; + /** @nocollapse */ + GochainNgWeb3Service.ctorParameters = function () { return []; }; + /** @nocollapse */ GochainNgWeb3Service.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function GochainNgWeb3Service_Factory() { return new GochainNgWeb3Service(); }, token: GochainNgWeb3Service, providedIn: "root" }); + return GochainNgWeb3Service; + }()); + if (false) { + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskInstalled; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskConfigured; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskActivated; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._config; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._gochainNetId; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskInstalled$; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskConfigured$; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskActivated$; + /** @type {?} */ + GochainNgWeb3Service.prototype.ready$; + /** @type {?} */ + GochainNgWeb3Service.prototype.accountBalance; + /** @type {?} */ + GochainNgWeb3Service.prototype.gochainWeb3; + /** @type {?} */ + GochainNgWeb3Service.prototype.pluginWeb3; + /** @type {?} */ + GochainNgWeb3Service.prototype.accountAddress; + /** @type {?} */ + GochainNgWeb3Service.prototype.account; + } + + exports.GochainNgWeb3Service = GochainNgWeb3Service; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +//# sourceMappingURL=gochain-ng-web3.umd.js.map diff --git a/dist/gochain-ng-web3/bundles/gochain-ng-web3.umd.js.map b/dist/gochain-ng-web3/bundles/gochain-ng-web3.umd.js.map new file mode 100644 index 0000000..b965b16 --- /dev/null +++ b/dist/gochain-ng-web3/bundles/gochain-ng-web3.umd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gochain-ng-web3.umd.js","sources":["ng://gochain-ng-web3/lib/gochain-ng-web3.service.ts"],"sourcesContent":["/*CORE*/\nimport {Injectable} from '@angular/core';\nimport {BehaviorSubject, Observable, throwError} from 'rxjs';\nimport {fromPromise} from 'rxjs/internal-compatibility';\nimport {catchError, map, tap} from 'rxjs/operators';\n/*WEB3*/\nimport Web3 from 'web3';\nimport {Account} from 'web3-eth-accounts';\nimport {SignedTransaction, TransactionReceipt} from 'web3-core';\n\nclass InitConfig {\n rpcUrl: string;\n}\n\ninterface IGochainWeb3Service {\n initialize(config: InitConfig);\n\n initializePlugin();\n\n activatePlugin();\n\n getPluginAccountAddress();\n\n createAccount();\n\n /*openAccount(privateKey: string);*/\n\n closeAccount();\n\n /*getBalance();*/\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class GochainNgWeb3Service implements IGochainWeb3Service {\n private _metamaskInstalled: boolean;\n private _metamaskConfigured: boolean;\n private _metamaskActivated: boolean;\n private _config: InitConfig;\n private _gochainNetId: number;\n\n set metamaskInstalled(value: boolean) {\n this._metamaskInstalled = value;\n this.metamaskInstalled$.next(value);\n }\n\n set metamaskConfigured(value: boolean) {\n this._metamaskConfigured = value;\n this.metamaskConfigured$.next(value);\n }\n\n set metamaskActivated(value: boolean) {\n this._metamaskActivated = value;\n this.metamaskActivated$.next(value);\n }\n\n metamaskInstalled$: BehaviorSubject = new BehaviorSubject(null);\n metamaskConfigured$: BehaviorSubject = new BehaviorSubject(null);\n metamaskActivated$: BehaviorSubject = new BehaviorSubject(null);\n ready$: BehaviorSubject = new BehaviorSubject(null);\n accountBalance: string;\n gochainWeb3: Web3;\n pluginWeb3: Web3;\n accountAddress: string;\n account: Account;\n\n get web3(): Web3 {\n if (this._metamaskConfigured && this._metamaskInstalled) {\n return this.pluginWeb3;\n }\n return this.gochainWeb3;\n }\n\n constructor() {\n }\n\n initialize(config: InitConfig): Observable {\n this._config = config;\n if (!config.rpcUrl) {\n return throwError('rpc url hasn\\'t been provided');\n }\n this.gochainWeb3 = new Web3(new Web3.providers.HttpProvider(config.rpcUrl), null, {transactionConfirmationBlocks: 1});\n\n return fromPromise(this.gochainWeb3.eth.net.getId()).pipe(\n catchError((e: Error) => {\n return throwError('Can\\'t get GoChain network id');\n }),\n map(v => !!v),\n );\n }\n\n initializePlugin(): Observable {\n if (!this.gochainWeb3) {\n return throwError('initialize first');\n }\n if (!this._gochainNetId) {\n return throwError('gochain network id is not provided');\n }\n\n this.pluginWeb3 = new Web3(Web3.givenProvider, null, {transactionConfirmationBlocks: 1});\n\n if (!this.pluginWeb3.currentProvider) {\n this.metamaskInstalled = false;\n this.metamaskConfigured = false;\n return throwError('metamask is not installed');\n }\n\n return fromPromise(this.pluginWeb3.eth.net.getId()).pipe(\n catchError((e: Error) => {\n this.metamaskInstalled = true;\n this.metamaskConfigured = false;\n return throwError('Metamask installed but not configured properly - can\\'t get network id from Metamask');\n }),\n map((metamaskNetID: number) => {\n if (this._gochainNetId !== metamaskNetID) {\n this.metamaskInstalled = true;\n this.metamaskConfigured = false;\n return throwError(`Metamask installed but misconfigured - network ID mismatch (must use GoChain ${this._gochainNetId} - e.g. by pointing to ${this._config.rpcUrl})`);\n }\n this.metamaskInstalled = true;\n this.metamaskConfigured = true;\n this.getPluginAccountAddress();\n return true;\n }),\n );\n }\n\n activatePlugin(): Observable {\n return fromPromise((window as any).ethereum.enable()).pipe(\n catchError((e) => {\n this.metamaskActivated = false;\n return throwError('Access haven\\'t been granted');\n }),\n tap(() => {\n this.metamaskActivated = true;\n }),\n );\n }\n\n getPluginAccountAddress(): void {\n fromPromise(this.pluginWeb3.eth.getAccounts()).subscribe((accounts: string[]) => {\n this.accountAddress = accounts[0];\n });\n }\n\n createAccount() {\n return !!this.web3 ? this.web3.eth.accounts.create() : null;\n }\n\n /*protected _openAccount(privateKey: string) {\n if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) {\n privateKey = '0x' + privateKey;\n }\n if (privateKey.length !== 66) {\n throw Error('Given private key is not valid');\n }\n try {\n this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey);\n } catch (e) {\n throw e;\n }\n return this.account;\n }*/\n\n closeAccount() {\n this.account = null;\n this.accountAddress = null;\n this.accountBalance = null;\n }\n\n /*getBalance() {\n return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe(\n map((balance: string) => {\n this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString();\n return this.accountBalance;\n }),\n );\n }*/\n\n sendSignedTx(signed: SignedTransaction): Observable {\n return fromPromise(this.gochainWeb3.eth.sendSignedTransaction(signed.rawTransaction));\n }\n\n isAddress(address: string) {\n return this.gochainWeb3.utils.isAddress(address);\n }\n}\n"],"names":["BehaviorSubject","throwError","fromPromise","catchError","map","tap","Injectable"],"mappings":";;;;;;;;;;;;IAUA;QAAA;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ACnC,EAAC,CAAC;SACJ;;;;QAED,4CAAa;;;QAAb;YACE,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;SAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAiBD,2CAAY;;;;;;;;;;;;;;;;;QAAZ;YACE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;YACpB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAC3B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;SAC5B;;;;;;;;;;;;;;;;;;;;;QAWD,2CAAY;;;;;;;;;;;;QAAZ,UAAa,MAAyB;YACpC,OAAOA,iCAAW,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,qBAAqB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;SACvF;;;;;QAED,wCAAS;;;;QAAT,UAAU,OAAe;YACvB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;SAClD;;oBA1JFI,eAAU,SAAC;wBACV,UAAU,EAAE,MAAM;qBACnB;;;;;mCAlCD;KAgCA,IA2JC;;;;;;QAvJC,kDAAoC;;;;;QACpC,mDAAqC;;;;;QACrC,kDAAoC;;;;;QACpC,uCAA4B;;;;;QAC5B,6CAA8B;;QAiB9B,kDAAkF;;QAClF,mDAAmF;;QACnF,kDAAkF;;QAClF,sCAAsE;;QACtE,8CAAuB;;QACvB,2CAAkB;;QAClB,0CAAiB;;QACjB,8CAAuB;;QACvB,uCAAiB;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/gochain-ng-web3/bundles/gochain-ng-web3.umd.min.js b/dist/gochain-ng-web3/bundles/gochain-ng-web3.umd.min.js new file mode 100644 index 0000000..a699f45 --- /dev/null +++ b/dist/gochain-ng-web3/bundles/gochain-ng-web3.umd.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("rxjs"),require("rxjs/internal-compatibility"),require("rxjs/operators"),require("web3")):"function"==typeof define&&define.amd?define("gochain-ng-web3",["exports","@angular/core","rxjs","rxjs/internal-compatibility","rxjs/operators","web3"],t):t((e=e||self)["gochain-ng-web3"]={},e.ng.core,e.rxjs,e.rxjs["internal-compatibility"],e.rxjs.operators,e.Web3)}(this,(function(e,t,r,n,i,o){"use strict";o=o&&o.hasOwnProperty("default")?o.default:o;var a=function(){function e(){this.metamaskInstalled$=new r.BehaviorSubject(null),this.metamaskConfigured$=new r.BehaviorSubject(null),this.metamaskActivated$=new r.BehaviorSubject(null),this.ready$=new r.BehaviorSubject(null)}return Object.defineProperty(e.prototype,"metamaskInstalled",{set:function(e){this._metamaskInstalled=e,this.metamaskInstalled$.next(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"metamaskConfigured",{set:function(e){this._metamaskConfigured=e,this.metamaskConfigured$.next(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"metamaskActivated",{set:function(e){this._metamaskActivated=e,this.metamaskActivated$.next(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"web3",{get:function(){return this._metamaskConfigured&&this._metamaskInstalled?this.pluginWeb3:this.gochainWeb3},enumerable:!0,configurable:!0}),e.prototype.initialize=function(e){return this._config=e,e.rpcUrl?(this.gochainWeb3=new o(new o.providers.HttpProvider(e.rpcUrl),null,{transactionConfirmationBlocks:1}),n.fromPromise(this.gochainWeb3.eth.net.getId()).pipe(i.catchError((function(e){return r.throwError("Can't get GoChain network id")})),i.map((function(e){return!!e})))):r.throwError("rpc url hasn't been provided")},e.prototype.initializePlugin=function(){var e=this;return this.gochainWeb3?this._gochainNetId?(this.pluginWeb3=new o(o.givenProvider,null,{transactionConfirmationBlocks:1}),this.pluginWeb3.currentProvider?n.fromPromise(this.pluginWeb3.eth.net.getId()).pipe(i.catchError((function(t){return e.metamaskInstalled=!0,e.metamaskConfigured=!1,r.throwError("Metamask installed but not configured properly - can't get network id from Metamask")})),i.map((function(t){return e._gochainNetId!==t?(e.metamaskInstalled=!0,e.metamaskConfigured=!1,r.throwError("Metamask installed but misconfigured - network ID mismatch (must use GoChain "+e._gochainNetId+" - e.g. by pointing to "+e._config.rpcUrl+")")):(e.metamaskInstalled=!0,e.metamaskConfigured=!0,e.getPluginAccountAddress(),!0)}))):(this.metamaskInstalled=!1,this.metamaskConfigured=!1,r.throwError("metamask is not installed"))):r.throwError("gochain network id is not provided"):r.throwError("initialize first")},e.prototype.activatePlugin=function(){var e=this;return n.fromPromise(window.ethereum.enable()).pipe(i.catchError((function(t){return e.metamaskActivated=!1,r.throwError("Access haven't been granted")})),i.tap((function(){e.metamaskActivated=!0})))},e.prototype.getPluginAccountAddress=function(){var e=this;n.fromPromise(this.pluginWeb3.eth.getAccounts()).subscribe((function(t){e.accountAddress=t[0]}))},e.prototype.createAccount=function(){return this.web3?this.web3.eth.accounts.create():null},e.prototype.closeAccount=function(){this.account=null,this.accountAddress=null,this.accountBalance=null},e.prototype.sendSignedTx=function(e){return n.fromPromise(this.gochainWeb3.eth.sendSignedTransaction(e.rawTransaction))},e.prototype.isAddress=function(e){return this.gochainWeb3.utils.isAddress(e)},e.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[]},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e}();e.GochainNgWeb3Service=a,Object.defineProperty(e,"__esModule",{value:!0})})); +//# sourceMappingURL=gochain-ng-web3.umd.min.js.map \ No newline at end of file diff --git a/dist/gochain-ng-web3/bundles/gochain-ng-web3.umd.min.js.map b/dist/gochain-ng-web3/bundles/gochain-ng-web3.umd.min.js.map new file mode 100644 index 0000000..81ed279 --- /dev/null +++ b/dist/gochain-ng-web3/bundles/gochain-ng-web3.umd.min.js.map @@ -0,0 +1 @@ +{"version":3,"sources":["ng://gochain-ng-web3/lib/gochain-ng-web3.service.ts"],"names":["GochainNgWeb3Service","this","metamaskInstalled$","BehaviorSubject","metamaskConfigured$","metamaskActivated$","ready$","Object","defineProperty","prototype","value","_metamaskInstalled","next","_metamaskConfigured","_metamaskActivated","pluginWeb3","gochainWeb3","initialize","config","_config","rpcUrl","Web3","providers","HttpProvider","transactionConfirmationBlocks","fromPromise","eth","net","getId","pipe","catchError","e","throwError","map","v","initializePlugin","_this","_gochainNetId","givenProvider","currentProvider","metamaskInstalled","metamaskConfigured","metamaskNetID","getPluginAccountAddress","activatePlugin","ethereum","enable","metamaskActivated","tap","getAccounts","subscribe","accounts","accountAddress","createAccount","web3","create","closeAccount","account","accountBalance","sendSignedTx","signed","sendSignedTransaction","rawTransaction","isAddress","address","utils","Injectable","args","providedIn"],"mappings":"0iBAgCA,IAAAA,EAAA,WA0CE,SAAAA,IAjBAC,KAAAC,mBAA+C,IAAIC,EAAAA,gBAAyB,MAC5EF,KAAAG,oBAAgD,IAAID,EAAAA,gBAAyB,MAC7EF,KAAAI,mBAA+C,IAAIF,EAAAA,gBAAyB,MAC5EF,KAAAK,OAAmC,IAAIH,EAAAA,gBAAyB,aAlBhEI,OAAAC,eAAIR,EAAAS,UAAA,oBAAiB,KAArB,SAAsBC,GACpBT,KAAKU,mBAAqBD,EAC1BT,KAAKC,mBAAmBU,KAAKF,oCAG/BH,OAAAC,eAAIR,EAAAS,UAAA,qBAAkB,KAAtB,SAAuBC,GACrBT,KAAKY,oBAAsBH,EAC3BT,KAAKG,oBAAoBQ,KAAKF,oCAGhCH,OAAAC,eAAIR,EAAAS,UAAA,oBAAiB,KAArB,SAAsBC,GACpBT,KAAKa,mBAAqBJ,EAC1BT,KAAKI,mBAAmBO,KAAKF,oCAa/BH,OAAAC,eAAIR,EAAAS,UAAA,OAAI,KAAR,WACE,OAAIR,KAAKY,qBAAuBZ,KAAKU,mBAC5BV,KAAKc,WAEPd,KAAKe,6CAMdhB,EAAAS,UAAAQ,WAAA,SAA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ACDZ,EAAKW,mBAAoB,OAK/B/C,EAAAS,UAAAkC,wBAAA,WAAA,IAAAP,EAAAnC,KACEwB,EAAAA,YAAYxB,KAAKc,WAAWW,IAAIuB,eAAeC,WAAS,SAAEC,GACxDf,EAAKgB,eAAiBD,EAAS,OAInCnD,EAAAS,UAAA4C,cAAA,WACE,OAASpD,KAAKqD,KAAOrD,KAAKqD,KAAK5B,IAAIyB,SAASI,SAAW,MAkBzDvD,EAAAS,UAAA+C,aAAA,WACEvD,KAAKwD,QAAU,KACfxD,KAAKmD,eAAiB,KACtBnD,KAAKyD,eAAiB,MAYxB1D,EAAAS,UAAAkD,aAAA,SAAaC,GACX,OAAOnC,EAAAA,YAAYxB,KAAKe,YAAYU,IAAImC,sBAAsBD,EAAOE,kBAGvE9D,EAAAS,UAAAsD,UAAA,SAAUC,GACR,OAAO/D,KAAKe,YAAYiD,MAAMF,UAAUC,wBAzJ3CE,EAAAA,WAAUC,KAAA,CAAC,CACVC,WAAY,wJADd","sourcesContent":["/*CORE*/\nimport {Injectable} from '@angular/core';\nimport {BehaviorSubject, Observable, throwError} from 'rxjs';\nimport {fromPromise} from 'rxjs/internal-compatibility';\nimport {catchError, map, tap} from 'rxjs/operators';\n/*WEB3*/\nimport Web3 from 'web3';\nimport {Account} from 'web3-eth-accounts';\nimport {SignedTransaction, TransactionReceipt} from 'web3-core';\n\nclass InitConfig {\n rpcUrl: string;\n}\n\ninterface IGochainWeb3Service {\n initialize(config: InitConfig);\n\n initializePlugin();\n\n activatePlugin();\n\n getPluginAccountAddress();\n\n createAccount();\n\n /*openAccount(privateKey: string);*/\n\n closeAccount();\n\n /*getBalance();*/\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class GochainNgWeb3Service implements IGochainWeb3Service {\n private _metamaskInstalled: boolean;\n private _metamaskConfigured: boolean;\n private _metamaskActivated: boolean;\n private _config: InitConfig;\n private _gochainNetId: number;\n\n set metamaskInstalled(value: boolean) {\n this._metamaskInstalled = value;\n this.metamaskInstalled$.next(value);\n }\n\n set metamaskConfigured(value: boolean) {\n this._metamaskConfigured = value;\n this.metamaskConfigured$.next(value);\n }\n\n set metamaskActivated(value: boolean) {\n this._metamaskActivated = value;\n this.metamaskActivated$.next(value);\n }\n\n metamaskInstalled$: BehaviorSubject = new BehaviorSubject(null);\n metamaskConfigured$: BehaviorSubject = new BehaviorSubject(null);\n metamaskActivated$: BehaviorSubject = new BehaviorSubject(null);\n ready$: BehaviorSubject = new BehaviorSubject(null);\n accountBalance: string;\n gochainWeb3: Web3;\n pluginWeb3: Web3;\n accountAddress: string;\n account: Account;\n\n get web3(): Web3 {\n if (this._metamaskConfigured && this._metamaskInstalled) {\n return this.pluginWeb3;\n }\n return this.gochainWeb3;\n }\n\n constructor() {\n }\n\n initialize(config: InitConfig): Observable {\n this._config = config;\n if (!config.rpcUrl) {\n return throwError('rpc url hasn\\'t been provided');\n }\n this.gochainWeb3 = new Web3(new Web3.providers.HttpProvider(config.rpcUrl), null, {transactionConfirmationBlocks: 1});\n\n return fromPromise(this.gochainWeb3.eth.net.getId()).pipe(\n catchError((e: Error) => {\n return throwError('Can\\'t get GoChain network id');\n }),\n map(v => !!v),\n );\n }\n\n initializePlugin(): Observable {\n if (!this.gochainWeb3) {\n return throwError('initialize first');\n }\n if (!this._gochainNetId) {\n return throwError('gochain network id is not provided');\n }\n\n this.pluginWeb3 = new Web3(Web3.givenProvider, null, {transactionConfirmationBlocks: 1});\n\n if (!this.pluginWeb3.currentProvider) {\n this.metamaskInstalled = false;\n this.metamaskConfigured = false;\n return throwError('metamask is not installed');\n }\n\n return fromPromise(this.pluginWeb3.eth.net.getId()).pipe(\n catchError((e: Error) => {\n this.metamaskInstalled = true;\n this.metamaskConfigured = false;\n return throwError('Metamask installed but not configured properly - can\\'t get network id from Metamask');\n }),\n map((metamaskNetID: number) => {\n if (this._gochainNetId !== metamaskNetID) {\n this.metamaskInstalled = true;\n this.metamaskConfigured = false;\n return throwError(`Metamask installed but misconfigured - network ID mismatch (must use GoChain ${this._gochainNetId} - e.g. by pointing to ${this._config.rpcUrl})`);\n }\n this.metamaskInstalled = true;\n this.metamaskConfigured = true;\n this.getPluginAccountAddress();\n return true;\n }),\n );\n }\n\n activatePlugin(): Observable {\n return fromPromise((window as any).ethereum.enable()).pipe(\n catchError((e) => {\n this.metamaskActivated = false;\n return throwError('Access haven\\'t been granted');\n }),\n tap(() => {\n this.metamaskActivated = true;\n }),\n );\n }\n\n getPluginAccountAddress(): void {\n fromPromise(this.pluginWeb3.eth.getAccounts()).subscribe((accounts: string[]) => {\n this.accountAddress = accounts[0];\n });\n }\n\n createAccount() {\n return !!this.web3 ? this.web3.eth.accounts.create() : null;\n }\n\n /*protected _openAccount(privateKey: string) {\n if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) {\n privateKey = '0x' + privateKey;\n }\n if (privateKey.length !== 66) {\n throw Error('Given private key is not valid');\n }\n try {\n this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey);\n } catch (e) {\n throw e;\n }\n return this.account;\n }*/\n\n closeAccount() {\n this.account = null;\n this.accountAddress = null;\n this.accountBalance = null;\n }\n\n /*getBalance() {\n return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe(\n map((balance: string) => {\n this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString();\n return this.accountBalance;\n }),\n );\n }*/\n\n sendSignedTx(signed: SignedTransaction): Observable {\n return fromPromise(this.gochainWeb3.eth.sendSignedTransaction(signed.rawTransaction));\n }\n\n isAddress(address: string) {\n return this.gochainWeb3.utils.isAddress(address);\n }\n}\n"]} \ No newline at end of file diff --git a/dist/gochain-ng-web3/esm2015/gochain-ng-web3.js b/dist/gochain-ng-web3/esm2015/gochain-ng-web3.js new file mode 100644 index 0000000..012ff88 --- /dev/null +++ b/dist/gochain-ng-web3/esm2015/gochain-ng-web3.js @@ -0,0 +1,9 @@ +/** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ +/** + * Generated bundle index. Do not edit. + */ +export { GochainNgWeb3Service } from './public-api'; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ29jaGFpbi1uZy13ZWIzLmpzIiwic291cmNlUm9vdCI6Im5nOi8vZ29jaGFpbi1uZy13ZWIzLyIsInNvdXJjZXMiOlsiZ29jaGFpbi1uZy13ZWIzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFJQSxxQ0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0= \ No newline at end of file diff --git a/dist/gochain-ng-web3/esm2015/lib/gochain-ng-web3.service.js b/dist/gochain-ng-web3/esm2015/lib/gochain-ng-web3.service.js new file mode 100644 index 0000000..d0f5557 --- /dev/null +++ b/dist/gochain-ng-web3/esm2015/lib/gochain-ng-web3.service.js @@ -0,0 +1,286 @@ +/** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ +/*CORE*/ +import { Injectable } from '@angular/core'; +import { BehaviorSubject, throwError } from 'rxjs'; +import { fromPromise } from 'rxjs/internal-compatibility'; +import { catchError, map, tap } from 'rxjs/operators'; +/*WEB3*/ +import Web3 from 'web3'; +import * as i0 from "@angular/core"; +class InitConfig { +} +if (false) { + /** @type {?} */ + InitConfig.prototype.rpcUrl; +} +/** + * @record + */ +function IGochainWeb3Service() { } +if (false) { + /** + * @param {?} config + * @return {?} + */ + IGochainWeb3Service.prototype.initialize = function (config) { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.initializePlugin = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.activatePlugin = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.getPluginAccountAddress = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.createAccount = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.closeAccount = function () { }; +} +export class GochainNgWeb3Service { + constructor() { + this.metamaskInstalled$ = new BehaviorSubject(null); + this.metamaskConfigured$ = new BehaviorSubject(null); + this.metamaskActivated$ = new BehaviorSubject(null); + this.ready$ = new BehaviorSubject(null); + } + /** + * @param {?} value + * @return {?} + */ + set metamaskInstalled(value) { + this._metamaskInstalled = value; + this.metamaskInstalled$.next(value); + } + /** + * @param {?} value + * @return {?} + */ + set metamaskConfigured(value) { + this._metamaskConfigured = value; + this.metamaskConfigured$.next(value); + } + /** + * @param {?} value + * @return {?} + */ + set metamaskActivated(value) { + this._metamaskActivated = value; + this.metamaskActivated$.next(value); + } + /** + * @return {?} + */ + get web3() { + if (this._metamaskConfigured && this._metamaskInstalled) { + return this.pluginWeb3; + } + return this.gochainWeb3; + } + /** + * @param {?} config + * @return {?} + */ + initialize(config) { + this._config = config; + if (!config.rpcUrl) { + return throwError('rpc url hasn\'t been provided'); + } + this.gochainWeb3 = new Web3(new Web3.providers.HttpProvider(config.rpcUrl), null, { transactionConfirmationBlocks: 1 }); + return fromPromise(this.gochainWeb3.eth.net.getId()).pipe(catchError((/** + * @param {?} e + * @return {?} + */ + (e) => { + return throwError('Can\'t get GoChain network id'); + })), map((/** + * @param {?} v + * @return {?} + */ + v => !!v))); + } + /** + * @return {?} + */ + initializePlugin() { + if (!this.gochainWeb3) { + return throwError('initialize first'); + } + if (!this._gochainNetId) { + return throwError('gochain network id is not provided'); + } + this.pluginWeb3 = new Web3(Web3.givenProvider, null, { transactionConfirmationBlocks: 1 }); + if (!this.pluginWeb3.currentProvider) { + this.metamaskInstalled = false; + this.metamaskConfigured = false; + return throwError('metamask is not installed'); + } + return fromPromise(this.pluginWeb3.eth.net.getId()).pipe(catchError((/** + * @param {?} e + * @return {?} + */ + (e) => { + this.metamaskInstalled = true; + this.metamaskConfigured = false; + return throwError('Metamask installed but not configured properly - can\'t get network id from Metamask'); + })), map((/** + * @param {?} metamaskNetID + * @return {?} + */ + (metamaskNetID) => { + if (this._gochainNetId !== metamaskNetID) { + this.metamaskInstalled = true; + this.metamaskConfigured = false; + return throwError(`Metamask installed but misconfigured - network ID mismatch (must use GoChain ${this._gochainNetId} - e.g. by pointing to ${this._config.rpcUrl})`); + } + this.metamaskInstalled = true; + this.metamaskConfigured = true; + this.getPluginAccountAddress(); + return true; + }))); + } + /** + * @return {?} + */ + activatePlugin() { + return fromPromise(((/** @type {?} */ (window))).ethereum.enable()).pipe(catchError((/** + * @param {?} e + * @return {?} + */ + (e) => { + this.metamaskActivated = false; + return throwError('Access haven\'t been granted'); + })), tap((/** + * @return {?} + */ + () => { + this.metamaskActivated = true; + }))); + } + /** + * @return {?} + */ + getPluginAccountAddress() { + fromPromise(this.pluginWeb3.eth.getAccounts()).subscribe((/** + * @param {?} accounts + * @return {?} + */ + (accounts) => { + this.accountAddress = accounts[0]; + })); + } + /** + * @return {?} + */ + createAccount() { + return !!this.web3 ? this.web3.eth.accounts.create() : null; + } + /*protected _openAccount(privateKey: string) { + if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) { + privateKey = '0x' + privateKey; + } + if (privateKey.length !== 66) { + throw Error('Given private key is not valid'); + } + try { + this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey); + } catch (e) { + throw e; + } + return this.account; + }*/ + /** + * @return {?} + */ + closeAccount() { + this.account = null; + this.accountAddress = null; + this.accountBalance = null; + } + /*getBalance() { + return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe( + map((balance: string) => { + this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString(); + return this.accountBalance; + }), + ); + }*/ + /** + * @param {?} signed + * @return {?} + */ + sendSignedTx(signed) { + return fromPromise(this.gochainWeb3.eth.sendSignedTransaction(signed.rawTransaction)); + } + /** + * @param {?} address + * @return {?} + */ + isAddress(address) { + return this.gochainWeb3.utils.isAddress(address); + } +} +GochainNgWeb3Service.decorators = [ + { type: Injectable, args: [{ + providedIn: 'root' + },] } +]; +/** @nocollapse */ +GochainNgWeb3Service.ctorParameters = () => []; +/** @nocollapse */ GochainNgWeb3Service.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: function GochainNgWeb3Service_Factory() { return new GochainNgWeb3Service(); }, token: GochainNgWeb3Service, providedIn: "root" }); +if (false) { + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskInstalled; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskConfigured; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskActivated; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._config; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._gochainNetId; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskInstalled$; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskConfigured$; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskActivated$; + /** @type {?} */ + GochainNgWeb3Service.prototype.ready$; + /** @type {?} */ + GochainNgWeb3Service.prototype.accountBalance; + /** @type {?} */ + GochainNgWeb3Service.prototype.gochainWeb3; + /** @type {?} */ + GochainNgWeb3Service.prototype.pluginWeb3; + /** @type {?} */ + GochainNgWeb3Service.prototype.accountAddress; + /** @type {?} */ + GochainNgWeb3Service.prototype.account; +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ29jaGFpbi1uZy13ZWIzLnNlcnZpY2UuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9nb2NoYWluLW5nLXdlYjMvIiwic291cmNlcyI6WyJsaWIvZ29jaGFpbi1uZy13ZWIzLnNlcnZpY2UudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFDQSxPQUFPLEVBQUMs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mFuc2FjdGlvbihzaWduZWQucmF3VHJhbnNhY3Rpb24pKTtcbiAgfVxuXG4gIGlzQWRkcmVzcyhhZGRyZXNzOiBzdHJpbmcpIHtcbiAgICByZXR1cm4gdGhpcy5nb2NoYWluV2ViMy51dGlscy5pc0FkZHJlc3MoYWRkcmVzcyk7XG4gIH1cbn1cbiJdfQ== \ No newline at end of file diff --git a/dist/gochain-ng-web3/esm2015/public-api.js b/dist/gochain-ng-web3/esm2015/public-api.js new file mode 100644 index 0000000..b2114e3 --- /dev/null +++ b/dist/gochain-ng-web3/esm2015/public-api.js @@ -0,0 +1,9 @@ +/** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ +/* + * Public API Surface of gochain-ng-web3 + */ +export { GochainNgWeb3Service } from './lib/gochain-ng-web3.service'; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL2dvY2hhaW4tbmctd2ViMy8iLCJzb3VyY2VzIjpbInB1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUlBLHFDQUFjLCtCQUErQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBnb2NoYWluLW5nLXdlYjNcbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2xpYi9nb2NoYWluLW5nLXdlYjMuc2VydmljZSc7XG4iXX0= \ No newline at end of file diff --git a/dist/gochain-ng-web3/esm5/gochain-ng-web3.js b/dist/gochain-ng-web3/esm5/gochain-ng-web3.js new file mode 100644 index 0000000..012ff88 --- /dev/null +++ b/dist/gochain-ng-web3/esm5/gochain-ng-web3.js @@ -0,0 +1,9 @@ +/** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ +/** + * Generated bundle index. Do not edit. + */ +export { GochainNgWeb3Service } from './public-api'; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ29jaGFpbi1uZy13ZWIzLmpzIiwic291cmNlUm9vdCI6Im5nOi8vZ29jaGFpbi1uZy13ZWIzLyIsInNvdXJjZXMiOlsiZ29jaGFpbi1uZy13ZWIzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7QUFJQSxxQ0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0= \ No newline at end of file diff --git a/dist/gochain-ng-web3/esm5/lib/gochain-ng-web3.service.js b/dist/gochain-ng-web3/esm5/lib/gochain-ng-web3.service.js new file mode 100644 index 0000000..094f9ff --- /dev/null +++ b/dist/gochain-ng-web3/esm5/lib/gochain-ng-web3.service.js @@ -0,0 +1,381 @@ +/** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ +/*CORE*/ +import { Injectable } from '@angular/core'; +import { BehaviorSubject, throwError } from 'rxjs'; +import { fromPromise } from 'rxjs/internal-compatibility'; +import { catchError, map, tap } from 'rxjs/operators'; +/*WEB3*/ +import Web3 from 'web3'; +import * as i0 from "@angular/core"; +var InitConfig = /** @class */ (function () { + function InitConfig() { + } + return InitConfig; +}()); +if (false) { + /** @type {?} */ + InitConfig.prototype.rpcUrl; +} +/** + * @record + */ +function IGochainWeb3Service() { } +if (false) { + /** + * @param {?} config + * @return {?} + */ + IGochainWeb3Service.prototype.initialize = function (config) { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.initializePlugin = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.activatePlugin = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.getPluginAccountAddress = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.createAccount = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.closeAccount = function () { }; +} +var GochainNgWeb3Service = /** @class */ (function () { + function GochainNgWeb3Service() { + this.metamaskInstalled$ = new BehaviorSubject(null); + this.metamaskConfigured$ = new BehaviorSubject(null); + this.metamaskActivated$ = new BehaviorSubject(null); + this.ready$ = new BehaviorSubject(null); + } + Object.defineProperty(GochainNgWeb3Service.prototype, "metamaskInstalled", { + set: /** + * @param {?} value + * @return {?} + */ + function (value) { + this._metamaskInstalled = value; + this.metamaskInstalled$.next(value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GochainNgWeb3Service.prototype, "metamaskConfigured", { + set: /** + * @param {?} value + * @return {?} + */ + function (value) { + this._metamaskConfigured = value; + this.metamaskConfigured$.next(value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GochainNgWeb3Service.prototype, "metamaskActivated", { + set: /** + * @param {?} value + * @return {?} + */ + function (value) { + this._metamaskActivated = value; + this.metamaskActivated$.next(value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GochainNgWeb3Service.prototype, "web3", { + get: /** + * @return {?} + */ + function () { + if (this._metamaskConfigured && this._metamaskInstalled) { + return this.pluginWeb3; + } + return this.gochainWeb3; + }, + enumerable: true, + configurable: true + }); + /** + * @param {?} config + * @return {?} + */ + GochainNgWeb3Service.prototype.initialize = /** + * @param {?} config + * @return {?} + */ + function (config) { + this._config = config; + if (!config.rpcUrl) { + return throwError('rpc url hasn\'t been provided'); + } + this.gochainWeb3 = new Web3(new Web3.providers.HttpProvider(config.rpcUrl), null, { transactionConfirmationBlocks: 1 }); + return fromPromise(this.gochainWeb3.eth.net.getId()).pipe(catchError((/** + * @param {?} e + * @return {?} + */ + function (e) { + return throwError('Can\'t get GoChain network id'); + })), map((/** + * @param {?} v + * @return {?} + */ + function (v) { return !!v; }))); + }; + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.initializePlugin = /** + * @return {?} + */ + function () { + var _this = this; + if (!this.gochainWeb3) { + return throwError('initialize first'); + } + if (!this._gochainNetId) { + return throwError('gochain network id is not provided'); + } + this.pluginWeb3 = new Web3(Web3.givenProvider, null, { transactionConfirmationBlocks: 1 }); + if (!this.pluginWeb3.currentProvider) { + this.metamaskInstalled = false; + this.metamaskConfigured = false; + return throwError('metamask is not installed'); + } + return fromPromise(this.pluginWeb3.eth.net.getId()).pipe(catchError((/** + * @param {?} e + * @return {?} + */ + function (e) { + _this.metamaskInstalled = true; + _this.metamaskConfigured = false; + return throwError('Metamask installed but not configured properly - can\'t get network id from Metamask'); + })), map((/** + * @param {?} metamaskNetID + * @return {?} + */ + function (metamaskNetID) { + if (_this._gochainNetId !== metamaskNetID) { + _this.metamaskInstalled = true; + _this.metamaskConfigured = false; + return throwError("Metamask installed but misconfigured - network ID mismatch (must use GoChain " + _this._gochainNetId + " - e.g. by pointing to " + _this._config.rpcUrl + ")"); + } + _this.metamaskInstalled = true; + _this.metamaskConfigured = true; + _this.getPluginAccountAddress(); + return true; + }))); + }; + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.activatePlugin = /** + * @return {?} + */ + function () { + var _this = this; + return fromPromise(((/** @type {?} */ (window))).ethereum.enable()).pipe(catchError((/** + * @param {?} e + * @return {?} + */ + function (e) { + _this.metamaskActivated = false; + return throwError('Access haven\'t been granted'); + })), tap((/** + * @return {?} + */ + function () { + _this.metamaskActivated = true; + }))); + }; + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.getPluginAccountAddress = /** + * @return {?} + */ + function () { + var _this = this; + fromPromise(this.pluginWeb3.eth.getAccounts()).subscribe((/** + * @param {?} accounts + * @return {?} + */ + function (accounts) { + _this.accountAddress = accounts[0]; + })); + }; + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.createAccount = /** + * @return {?} + */ + function () { + return !!this.web3 ? this.web3.eth.accounts.create() : null; + }; + /*protected _openAccount(privateKey: string) { + if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) { + privateKey = '0x' + privateKey; + } + if (privateKey.length !== 66) { + throw Error('Given private key is not valid'); + } + try { + this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey); + } catch (e) { + throw e; + } + return this.account; + }*/ + /*protected _openAccount(privateKey: string) { + if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) { + privateKey = '0x' + privateKey; + } + if (privateKey.length !== 66) { + throw Error('Given private key is not valid'); + } + try { + this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey); + } catch (e) { + throw e; + } + return this.account; + }*/ + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.closeAccount = /*protected _openAccount(privateKey: string) { + if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) { + privateKey = '0x' + privateKey; + } + if (privateKey.length !== 66) { + throw Error('Given private key is not valid'); + } + try { + this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey); + } catch (e) { + throw e; + } + return this.account; + }*/ + /** + * @return {?} + */ + function () { + this.account = null; + this.accountAddress = null; + this.accountBalance = null; + }; + /*getBalance() { + return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe( + map((balance: string) => { + this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString(); + return this.accountBalance; + }), + ); + }*/ + /*getBalance() { + return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe( + map((balance: string) => { + this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString(); + return this.accountBalance; + }), + ); + }*/ + /** + * @param {?} signed + * @return {?} + */ + GochainNgWeb3Service.prototype.sendSignedTx = /*getBalance() { + return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe( + map((balance: string) => { + this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString(); + return this.accountBalance; + }), + ); + }*/ + /** + * @param {?} signed + * @return {?} + */ + function (signed) { + return fromPromise(this.gochainWeb3.eth.sendSignedTransaction(signed.rawTransaction)); + }; + /** + * @param {?} address + * @return {?} + */ + GochainNgWeb3Service.prototype.isAddress = /** + * @param {?} address + * @return {?} + */ + function (address) { + return this.gochainWeb3.utils.isAddress(address); + }; + GochainNgWeb3Service.decorators = [ + { type: Injectable, args: [{ + providedIn: 'root' + },] } + ]; + /** @nocollapse */ + GochainNgWeb3Service.ctorParameters = function () { return []; }; + /** @nocollapse */ GochainNgWeb3Service.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: function GochainNgWeb3Service_Factory() { return new GochainNgWeb3Service(); }, token: GochainNgWeb3Service, providedIn: "root" }); + return GochainNgWeb3Service; +}()); +export { GochainNgWeb3Service }; +if (false) { + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskInstalled; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskConfigured; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskActivated; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._config; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._gochainNetId; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskInstalled$; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskConfigured$; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskActivated$; + /** @type {?} */ + GochainNgWeb3Service.prototype.ready$; + /** @type {?} */ + GochainNgWeb3Service.prototype.accountBalance; + /** @type {?} */ + GochainNgWeb3Service.prototype.gochainWeb3; + /** @type {?} */ + GochainNgWeb3Service.prototype.pluginWeb3; + /** @type {?} */ + GochainNgWeb3Service.prototype.accountAddress; + /** @type {?} */ + GochainNgWeb3Service.prototype.account; +} +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ29jaGFpbi1uZy13ZWIzLnNlcnZpY2UuanMiLCJzb3VyY2VS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Z2V0QmFsYW5jZSh0aGlzLmFjY291bnQuYWRkcmVzcykpLnBpcGUoXG4gICAgICBtYXAoKGJhbGFuY2U6IHN0cmluZykgPT4ge1xuICAgICAgICB0aGlzLmFjY291bnRCYWxhbmNlID0gdGhpcy5nb2NoYWluV2ViMy51dGlscy5mcm9tV2VpKGJhbGFuY2UsICdldGhlcicpLnRvU3RyaW5nKCk7XG4gICAgICAgIHJldHVybiB0aGlzLmFjY291bnRCYWxhbmNlO1xuICAgICAgfSksXG4gICAgKTtcbiAgfSovXG5cbiAgc2VuZFNpZ25lZFR4KHNpZ25lZDogU2lnbmVkVHJhbnNhY3Rpb24pOiBPYnNlcnZhYmxlPFRyYW5zYWN0aW9uUmVjZWlwdD4ge1xuICAgIHJldHVybiBmcm9tUHJvbWlzZSh0aGlzLmdvY2hhaW5XZWIzLmV0aC5zZW5kU2lnbmVkVHJhbnNhY3Rpb24oc2lnbmVkLnJhd1RyYW5zYWN0aW9uKSk7XG4gIH1cblxuICBpc0FkZHJlc3MoYWRkcmVzczogc3RyaW5nKSB7XG4gICAgcmV0dXJuIHRoaXMuZ29jaGFpbldlYjMudXRpbHMuaXNBZGRyZXNzKGFkZHJlc3MpO1xuICB9XG59XG4iXX0= \ No newline at end of file diff --git a/dist/gochain-ng-web3/esm5/public-api.js b/dist/gochain-ng-web3/esm5/public-api.js new file mode 100644 index 0000000..b2114e3 --- /dev/null +++ b/dist/gochain-ng-web3/esm5/public-api.js @@ -0,0 +1,9 @@ +/** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ +/* + * Public API Surface of gochain-ng-web3 + */ +export { GochainNgWeb3Service } from './lib/gochain-ng-web3.service'; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL2dvY2hhaW4tbmctd2ViMy8iLCJzb3VyY2VzIjpbInB1YmxpYy1hcGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7OztBQUlBLHFDQUFjLCtCQUErQixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLypcbiAqIFB1YmxpYyBBUEkgU3VyZmFjZSBvZiBnb2NoYWluLW5nLXdlYjNcbiAqL1xuXG5leHBvcnQgKiBmcm9tICcuL2xpYi9nb2NoYWluLW5nLXdlYjMuc2VydmljZSc7XG4iXX0= \ No newline at end of file diff --git a/dist/gochain-ng-web3/fesm2015/gochain-ng-web3.js b/dist/gochain-ng-web3/fesm2015/gochain-ng-web3.js new file mode 100644 index 0000000..06286db --- /dev/null +++ b/dist/gochain-ng-web3/fesm2015/gochain-ng-web3.js @@ -0,0 +1,296 @@ +import { Injectable, ɵɵdefineInjectable } from '@angular/core'; +import { BehaviorSubject, throwError } from 'rxjs'; +import { fromPromise } from 'rxjs/internal-compatibility'; +import { catchError, map, tap } from 'rxjs/operators'; +import Web3 from 'web3'; + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ +class InitConfig { +} +if (false) { + /** @type {?} */ + InitConfig.prototype.rpcUrl; +} +/** + * @record + */ +function IGochainWeb3Service() { } +if (false) { + /** + * @param {?} config + * @return {?} + */ + IGochainWeb3Service.prototype.initialize = function (config) { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.initializePlugin = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.activatePlugin = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.getPluginAccountAddress = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.createAccount = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.closeAccount = function () { }; +} +class GochainNgWeb3Service { + constructor() { + this.metamaskInstalled$ = new BehaviorSubject(null); + this.metamaskConfigured$ = new BehaviorSubject(null); + this.metamaskActivated$ = new BehaviorSubject(null); + this.ready$ = new BehaviorSubject(null); + } + /** + * @param {?} value + * @return {?} + */ + set metamaskInstalled(value) { + this._metamaskInstalled = value; + this.metamaskInstalled$.next(value); + } + /** + * @param {?} value + * @return {?} + */ + set metamaskConfigured(value) { + this._metamaskConfigured = value; + this.metamaskConfigured$.next(value); + } + /** + * @param {?} value + * @return {?} + */ + set metamaskActivated(value) { + this._metamaskActivated = value; + this.metamaskActivated$.next(value); + } + /** + * @return {?} + */ + get web3() { + if (this._metamaskConfigured && this._metamaskInstalled) { + return this.pluginWeb3; + } + return this.gochainWeb3; + } + /** + * @param {?} config + * @return {?} + */ + initialize(config) { + this._config = config; + if (!config.rpcUrl) { + return throwError('rpc url hasn\'t been provided'); + } + this.gochainWeb3 = new Web3(new Web3.providers.HttpProvider(config.rpcUrl), null, { transactionConfirmationBlocks: 1 }); + return fromPromise(this.gochainWeb3.eth.net.getId()).pipe(catchError((/** + * @param {?} e + * @return {?} + */ + (e) => { + return throwError('Can\'t get GoChain network id'); + })), map((/** + * @param {?} v + * @return {?} + */ + v => !!v))); + } + /** + * @return {?} + */ + initializePlugin() { + if (!this.gochainWeb3) { + return throwError('initialize first'); + } + if (!this._gochainNetId) { + return throwError('gochain network id is not provided'); + } + this.pluginWeb3 = new Web3(Web3.givenProvider, null, { transactionConfirmationBlocks: 1 }); + if (!this.pluginWeb3.currentProvider) { + this.metamaskInstalled = false; + this.metamaskConfigured = false; + return throwError('metamask is not installed'); + } + return fromPromise(this.pluginWeb3.eth.net.getId()).pipe(catchError((/** + * @param {?} e + * @return {?} + */ + (e) => { + this.metamaskInstalled = true; + this.metamaskConfigured = false; + return throwError('Metamask installed but not configured properly - can\'t get network id from Metamask'); + })), map((/** + * @param {?} metamaskNetID + * @return {?} + */ + (metamaskNetID) => { + if (this._gochainNetId !== metamaskNetID) { + this.metamaskInstalled = true; + this.metamaskConfigured = false; + return throwError(`Metamask installed but misconfigured - network ID mismatch (must use GoChain ${this._gochainNetId} - e.g. by pointing to ${this._config.rpcUrl})`); + } + this.metamaskInstalled = true; + this.metamaskConfigured = true; + this.getPluginAccountAddress(); + return true; + }))); + } + /** + * @return {?} + */ + activatePlugin() { + return fromPromise(((/** @type {?} */ (window))).ethereum.enable()).pipe(catchError((/** + * @param {?} e + * @return {?} + */ + (e) => { + this.metamaskActivated = false; + return throwError('Access haven\'t been granted'); + })), tap((/** + * @return {?} + */ + () => { + this.metamaskActivated = true; + }))); + } + /** + * @return {?} + */ + getPluginAccountAddress() { + fromPromise(this.pluginWeb3.eth.getAccounts()).subscribe((/** + * @param {?} accounts + * @return {?} + */ + (accounts) => { + this.accountAddress = accounts[0]; + })); + } + /** + * @return {?} + */ + createAccount() { + return !!this.web3 ? this.web3.eth.accounts.create() : null; + } + /*protected _openAccount(privateKey: string) { + if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) { + privateKey = '0x' + privateKey; + } + if (privateKey.length !== 66) { + throw Error('Given private key is not valid'); + } + try { + this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey); + } catch (e) { + throw e; + } + return this.account; + }*/ + /** + * @return {?} + */ + closeAccount() { + this.account = null; + this.accountAddress = null; + this.accountBalance = null; + } + /*getBalance() { + return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe( + map((balance: string) => { + this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString(); + return this.accountBalance; + }), + ); + }*/ + /** + * @param {?} signed + * @return {?} + */ + sendSignedTx(signed) { + return fromPromise(this.gochainWeb3.eth.sendSignedTransaction(signed.rawTransaction)); + } + /** + * @param {?} address + * @return {?} + */ + isAddress(address) { + return this.gochainWeb3.utils.isAddress(address); + } +} +GochainNgWeb3Service.decorators = [ + { type: Injectable, args: [{ + providedIn: 'root' + },] } +]; +/** @nocollapse */ +GochainNgWeb3Service.ctorParameters = () => []; +/** @nocollapse */ GochainNgWeb3Service.ngInjectableDef = ɵɵdefineInjectable({ factory: function GochainNgWeb3Service_Factory() { return new GochainNgWeb3Service(); }, token: GochainNgWeb3Service, providedIn: "root" }); +if (false) { + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskInstalled; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskConfigured; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskActivated; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._config; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._gochainNetId; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskInstalled$; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskConfigured$; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskActivated$; + /** @type {?} */ + GochainNgWeb3Service.prototype.ready$; + /** @type {?} */ + GochainNgWeb3Service.prototype.accountBalance; + /** @type {?} */ + GochainNgWeb3Service.prototype.gochainWeb3; + /** @type {?} */ + GochainNgWeb3Service.prototype.pluginWeb3; + /** @type {?} */ + GochainNgWeb3Service.prototype.accountAddress; + /** @type {?} */ + GochainNgWeb3Service.prototype.account; +} + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ + +export { GochainNgWeb3Service }; +//# sourceMappingURL=gochain-ng-web3.js.map diff --git a/dist/gochain-ng-web3/fesm2015/gochain-ng-web3.js.map b/dist/gochain-ng-web3/fesm2015/gochain-ng-web3.js.map new file mode 100644 index 0000000..4e1fdbe --- /dev/null +++ b/dist/gochain-ng-web3/fesm2015/gochain-ng-web3.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gochain-ng-web3.js","sources":["ng://gochain-ng-web3/lib/gochain-ng-web3.service.ts"],"sourcesContent":["/*CORE*/\nimport {Injectable} from '@angular/core';\nimport {BehaviorSubject, Observable, throwError} from 'rxjs';\nimport {fromPromise} from 'rxjs/internal-compatibility';\nimport {catchError, map, tap} from 'rxjs/operators';\n/*WEB3*/\nimport Web3 from 'web3';\nimport {Account} from 'web3-eth-accounts';\nimport {SignedTransaction, TransactionReceipt} from 'web3-core';\n\nclass InitConfig {\n rpcUrl: string;\n}\n\ninterface IGochainWeb3Service {\n initialize(config: InitConfig);\n\n initializePlugin();\n\n activatePlugin();\n\n getPluginAccountAddress();\n\n createAccount();\n\n /*openAccount(privateKey: string);*/\n\n closeAccount();\n\n /*getBalance();*/\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class GochainNgWeb3Service implements IGochainWeb3Service {\n private _metamaskInstalled: boolean;\n private _metamaskConfigured: boolean;\n private _metamaskActivated: boolean;\n private _config: InitConfig;\n private _gochainNetId: number;\n\n set metamaskInstalled(value: boolean) {\n this._metamaskInstalled = value;\n this.metamaskInstalled$.next(value);\n }\n\n set metamaskConfigured(value: boolean) {\n this._metamaskConfigured = value;\n this.metamaskConfigured$.next(value);\n }\n\n set metamaskActivated(value: boolean) {\n this._metamaskActivated = value;\n this.metamaskActivated$.next(value);\n }\n\n metamaskInstalled$: BehaviorSubject = new BehaviorSubject(null);\n metamaskConfigured$: BehaviorSubject = new BehaviorSubject(null);\n metamaskActivated$: BehaviorSubject = new BehaviorSubject(null);\n ready$: BehaviorSubject = new BehaviorSubject(null);\n accountBalance: string;\n gochainWeb3: Web3;\n pluginWeb3: Web3;\n accountAddress: string;\n account: Account;\n\n get web3(): Web3 {\n if (this._metamaskConfigured && this._metamaskInstalled) {\n return this.pluginWeb3;\n }\n return this.gochainWeb3;\n }\n\n constructor() {\n }\n\n initialize(config: InitConfig): Observable {\n this._config = config;\n if (!config.rpcUrl) {\n return throwError('rpc url hasn\\'t been provided');\n }\n this.gochainWeb3 = new Web3(new Web3.providers.HttpProvider(config.rpcUrl), null, {transactionConfirmationBlocks: 1});\n\n return fromPromise(this.gochainWeb3.eth.net.getId()).pipe(\n catchError((e: Error) => {\n return throwError('Can\\'t get GoChain network id');\n }),\n map(v => !!v),\n );\n }\n\n initializePlugin(): Observable {\n if (!this.gochainWeb3) {\n return throwError('initialize first');\n }\n if (!this._gochainNetId) {\n return throwError('gochain network id is not provided');\n }\n\n this.pluginWeb3 = new Web3(Web3.givenProvider, null, {transactionConfirmationBlocks: 1});\n\n if (!this.pluginWeb3.currentProvider) {\n this.metamaskInstalled = false;\n this.metamaskConfigured = false;\n return throwError('metamask is not installed');\n }\n\n return fromPromise(this.pluginWeb3.eth.net.getId()).pipe(\n catchError((e: Error) => {\n this.metamaskInstalled = true;\n this.metamaskConfigured = false;\n return throwError('Metamask installed but not configured properly - can\\'t get network id from Metamask');\n }),\n map((metamaskNetID: number) => {\n if (this._gochainNetId !== metamaskNetID) {\n this.metamaskInstalled = true;\n this.metamaskConfigured = false;\n return throwError(`Metamask installed but misconfigured - network ID mismatch (must use GoChain ${this._gochainNetId} - e.g. by pointing to ${this._config.rpcUrl})`);\n }\n this.metamaskInstalled = true;\n this.metamaskConfigured = true;\n this.getPluginAccountAddress();\n return true;\n }),\n );\n }\n\n activatePlugin(): Observable {\n return fromPromise((window as any).ethereum.enable()).pipe(\n catchError((e) => {\n this.metamaskActivated = false;\n return throwError('Access haven\\'t been granted');\n }),\n tap(() => {\n this.metamaskActivated = true;\n }),\n );\n }\n\n getPluginAccountAddress(): void {\n fromPromise(this.pluginWeb3.eth.getAccounts()).subscribe((accounts: string[]) => {\n this.accountAddress = accounts[0];\n });\n }\n\n createAccount() {\n return !!this.web3 ? this.web3.eth.accounts.create() : null;\n }\n\n /*protected _openAccount(privateKey: string) {\n if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) {\n privateKey = '0x' + privateKey;\n }\n if (privateKey.length !== 66) {\n throw Error('Given private key is not valid');\n }\n try {\n this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey);\n } catch (e) {\n throw e;\n }\n return this.account;\n }*/\n\n closeAccount() {\n this.account = null;\n this.accountAddress = null;\n this.accountBalance = null;\n }\n\n /*getBalance() {\n return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe(\n map((balance: string) => {\n this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString();\n return this.accountBalance;\n }),\n );\n }*/\n\n sendSignedTx(signed: SignedTransaction): Observable {\n return fromPromise(this.gochainWeb3.eth.sendSignedTransaction(signed.rawTransaction));\n }\n\n isAddress(address: string) {\n return this.gochainWeb3.utils.isAddress(address);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAUA,MAAM,UAAU;CAEf;;;IADC,4BAAe;;;;;AAGjB,kCAgBC;;;;;;IAfC,iEAA+B;;;;IAE/B,iEAAmB;;;;IAEnB,+DAAiB;;;;IAEjB,wEAA0B;;;;IAE1B,8DAAgB;;;;IAIhB,6DAAe;;AAQjB,MAAa,oBAAoB;IAuC/B;QAjBA,uBAAkB,GAA6B,IAAI,eAAe,CAAU,IAAI,CAAC,CAAC;QAClF,wBAAmB,GAA6B,IAAI,eAAe,CAAU,IAAI,CAAC,CAAC;QACnF,uBAAkB,GAA6B,IAAI,eAAe,CAAU,IAAI,CAAC,CAAC;QAClF,WAAM,GAA6B,IAAI,eAAe,CAAU,IAAI,CAAC,CAAC;KAerE;;;;;IAjCD,IAAI,iBAAiB,CAAC,KAAc;QAClC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACrC;;;;;IAED,IAAI,kBAAkB,CAAC,KAAc;QACnC,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACjC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACtC;;;;;IAED,IAAI,iBAAiB,CAAC,KAAc;QAClC,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACrC;;;;IAYD,IAAI,I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;;;;QAAC,CAAC,QAAkB;YAC1E,IAAI,CAAC,cAAc,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;SACnC,EAAC,CAAC;KACJ;;;;IAED,aAAa;QACX,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;KAC7D;;;;;;;;;;;;;;;;;;IAiBD,YAAY;QACV,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;KAC5B;;;;;;;;;;;;;IAWD,YAAY,CAAC,MAAyB;QACpC,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,qBAAqB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;KACvF;;;;;IAED,SAAS,CAAC,OAAe;QACvB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;KAClD;;;YA1JF,UAAU,SAAC;gBACV,UAAU,EAAE,MAAM;aACnB;;;;;;;;;;IAEC,kDAAoC;;;;;IACpC,mDAAqC;;;;;IACrC,kDAAoC;;;;;IACpC,uCAA4B;;;;;IAC5B,6CAA8B;;IAiB9B,kDAAkF;;IAClF,mDAAmF;;IACnF,kDAAkF;;IAClF,sCAAsE;;IACtE,8CAAuB;;IACvB,2CAAkB;;IAClB,0CAAiB;;IACjB,8CAAuB;;IACvB,uCAAiB;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/gochain-ng-web3/fesm5/gochain-ng-web3.js b/dist/gochain-ng-web3/fesm5/gochain-ng-web3.js new file mode 100644 index 0000000..0576fdd --- /dev/null +++ b/dist/gochain-ng-web3/fesm5/gochain-ng-web3.js @@ -0,0 +1,390 @@ +import { Injectable, ɵɵdefineInjectable } from '@angular/core'; +import { BehaviorSubject, throwError } from 'rxjs'; +import { fromPromise } from 'rxjs/internal-compatibility'; +import { catchError, map, tap } from 'rxjs/operators'; +import Web3 from 'web3'; + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ +var InitConfig = /** @class */ (function () { + function InitConfig() { + } + return InitConfig; +}()); +if (false) { + /** @type {?} */ + InitConfig.prototype.rpcUrl; +} +/** + * @record + */ +function IGochainWeb3Service() { } +if (false) { + /** + * @param {?} config + * @return {?} + */ + IGochainWeb3Service.prototype.initialize = function (config) { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.initializePlugin = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.activatePlugin = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.getPluginAccountAddress = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.createAccount = function () { }; + /** + * @return {?} + */ + IGochainWeb3Service.prototype.closeAccount = function () { }; +} +var GochainNgWeb3Service = /** @class */ (function () { + function GochainNgWeb3Service() { + this.metamaskInstalled$ = new BehaviorSubject(null); + this.metamaskConfigured$ = new BehaviorSubject(null); + this.metamaskActivated$ = new BehaviorSubject(null); + this.ready$ = new BehaviorSubject(null); + } + Object.defineProperty(GochainNgWeb3Service.prototype, "metamaskInstalled", { + set: /** + * @param {?} value + * @return {?} + */ + function (value) { + this._metamaskInstalled = value; + this.metamaskInstalled$.next(value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GochainNgWeb3Service.prototype, "metamaskConfigured", { + set: /** + * @param {?} value + * @return {?} + */ + function (value) { + this._metamaskConfigured = value; + this.metamaskConfigured$.next(value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GochainNgWeb3Service.prototype, "metamaskActivated", { + set: /** + * @param {?} value + * @return {?} + */ + function (value) { + this._metamaskActivated = value; + this.metamaskActivated$.next(value); + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(GochainNgWeb3Service.prototype, "web3", { + get: /** + * @return {?} + */ + function () { + if (this._metamaskConfigured && this._metamaskInstalled) { + return this.pluginWeb3; + } + return this.gochainWeb3; + }, + enumerable: true, + configurable: true + }); + /** + * @param {?} config + * @return {?} + */ + GochainNgWeb3Service.prototype.initialize = /** + * @param {?} config + * @return {?} + */ + function (config) { + this._config = config; + if (!config.rpcUrl) { + return throwError('rpc url hasn\'t been provided'); + } + this.gochainWeb3 = new Web3(new Web3.providers.HttpProvider(config.rpcUrl), null, { transactionConfirmationBlocks: 1 }); + return fromPromise(this.gochainWeb3.eth.net.getId()).pipe(catchError((/** + * @param {?} e + * @return {?} + */ + function (e) { + return throwError('Can\'t get GoChain network id'); + })), map((/** + * @param {?} v + * @return {?} + */ + function (v) { return !!v; }))); + }; + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.initializePlugin = /** + * @return {?} + */ + function () { + var _this = this; + if (!this.gochainWeb3) { + return throwError('initialize first'); + } + if (!this._gochainNetId) { + return throwError('gochain network id is not provided'); + } + this.pluginWeb3 = new Web3(Web3.givenProvider, null, { transactionConfirmationBlocks: 1 }); + if (!this.pluginWeb3.currentProvider) { + this.metamaskInstalled = false; + this.metamaskConfigured = false; + return throwError('metamask is not installed'); + } + return fromPromise(this.pluginWeb3.eth.net.getId()).pipe(catchError((/** + * @param {?} e + * @return {?} + */ + function (e) { + _this.metamaskInstalled = true; + _this.metamaskConfigured = false; + return throwError('Metamask installed but not configured properly - can\'t get network id from Metamask'); + })), map((/** + * @param {?} metamaskNetID + * @return {?} + */ + function (metamaskNetID) { + if (_this._gochainNetId !== metamaskNetID) { + _this.metamaskInstalled = true; + _this.metamaskConfigured = false; + return throwError("Metamask installed but misconfigured - network ID mismatch (must use GoChain " + _this._gochainNetId + " - e.g. by pointing to " + _this._config.rpcUrl + ")"); + } + _this.metamaskInstalled = true; + _this.metamaskConfigured = true; + _this.getPluginAccountAddress(); + return true; + }))); + }; + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.activatePlugin = /** + * @return {?} + */ + function () { + var _this = this; + return fromPromise(((/** @type {?} */ (window))).ethereum.enable()).pipe(catchError((/** + * @param {?} e + * @return {?} + */ + function (e) { + _this.metamaskActivated = false; + return throwError('Access haven\'t been granted'); + })), tap((/** + * @return {?} + */ + function () { + _this.metamaskActivated = true; + }))); + }; + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.getPluginAccountAddress = /** + * @return {?} + */ + function () { + var _this = this; + fromPromise(this.pluginWeb3.eth.getAccounts()).subscribe((/** + * @param {?} accounts + * @return {?} + */ + function (accounts) { + _this.accountAddress = accounts[0]; + })); + }; + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.createAccount = /** + * @return {?} + */ + function () { + return !!this.web3 ? this.web3.eth.accounts.create() : null; + }; + /*protected _openAccount(privateKey: string) { + if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) { + privateKey = '0x' + privateKey; + } + if (privateKey.length !== 66) { + throw Error('Given private key is not valid'); + } + try { + this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey); + } catch (e) { + throw e; + } + return this.account; + }*/ + /*protected _openAccount(privateKey: string) { + if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) { + privateKey = '0x' + privateKey; + } + if (privateKey.length !== 66) { + throw Error('Given private key is not valid'); + } + try { + this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey); + } catch (e) { + throw e; + } + return this.account; + }*/ + /** + * @return {?} + */ + GochainNgWeb3Service.prototype.closeAccount = /*protected _openAccount(privateKey: string) { + if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) { + privateKey = '0x' + privateKey; + } + if (privateKey.length !== 66) { + throw Error('Given private key is not valid'); + } + try { + this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey); + } catch (e) { + throw e; + } + return this.account; + }*/ + /** + * @return {?} + */ + function () { + this.account = null; + this.accountAddress = null; + this.accountBalance = null; + }; + /*getBalance() { + return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe( + map((balance: string) => { + this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString(); + return this.accountBalance; + }), + ); + }*/ + /*getBalance() { + return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe( + map((balance: string) => { + this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString(); + return this.accountBalance; + }), + ); + }*/ + /** + * @param {?} signed + * @return {?} + */ + GochainNgWeb3Service.prototype.sendSignedTx = /*getBalance() { + return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe( + map((balance: string) => { + this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString(); + return this.accountBalance; + }), + ); + }*/ + /** + * @param {?} signed + * @return {?} + */ + function (signed) { + return fromPromise(this.gochainWeb3.eth.sendSignedTransaction(signed.rawTransaction)); + }; + /** + * @param {?} address + * @return {?} + */ + GochainNgWeb3Service.prototype.isAddress = /** + * @param {?} address + * @return {?} + */ + function (address) { + return this.gochainWeb3.utils.isAddress(address); + }; + GochainNgWeb3Service.decorators = [ + { type: Injectable, args: [{ + providedIn: 'root' + },] } + ]; + /** @nocollapse */ + GochainNgWeb3Service.ctorParameters = function () { return []; }; + /** @nocollapse */ GochainNgWeb3Service.ngInjectableDef = ɵɵdefineInjectable({ factory: function GochainNgWeb3Service_Factory() { return new GochainNgWeb3Service(); }, token: GochainNgWeb3Service, providedIn: "root" }); + return GochainNgWeb3Service; +}()); +if (false) { + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskInstalled; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskConfigured; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._metamaskActivated; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._config; + /** + * @type {?} + * @private + */ + GochainNgWeb3Service.prototype._gochainNetId; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskInstalled$; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskConfigured$; + /** @type {?} */ + GochainNgWeb3Service.prototype.metamaskActivated$; + /** @type {?} */ + GochainNgWeb3Service.prototype.ready$; + /** @type {?} */ + GochainNgWeb3Service.prototype.accountBalance; + /** @type {?} */ + GochainNgWeb3Service.prototype.gochainWeb3; + /** @type {?} */ + GochainNgWeb3Service.prototype.pluginWeb3; + /** @type {?} */ + GochainNgWeb3Service.prototype.accountAddress; + /** @type {?} */ + GochainNgWeb3Service.prototype.account; +} + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ + +/** + * @fileoverview added by tsickle + * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc + */ + +export { GochainNgWeb3Service }; +//# sourceMappingURL=gochain-ng-web3.js.map diff --git a/dist/gochain-ng-web3/fesm5/gochain-ng-web3.js.map b/dist/gochain-ng-web3/fesm5/gochain-ng-web3.js.map new file mode 100644 index 0000000..0f92a95 --- /dev/null +++ b/dist/gochain-ng-web3/fesm5/gochain-ng-web3.js.map @@ -0,0 +1 @@ +{"version":3,"file":"gochain-ng-web3.js","sources":["ng://gochain-ng-web3/lib/gochain-ng-web3.service.ts"],"sourcesContent":["/*CORE*/\nimport {Injectable} from '@angular/core';\nimport {BehaviorSubject, Observable, throwError} from 'rxjs';\nimport {fromPromise} from 'rxjs/internal-compatibility';\nimport {catchError, map, tap} from 'rxjs/operators';\n/*WEB3*/\nimport Web3 from 'web3';\nimport {Account} from 'web3-eth-accounts';\nimport {SignedTransaction, TransactionReceipt} from 'web3-core';\n\nclass InitConfig {\n rpcUrl: string;\n}\n\ninterface IGochainWeb3Service {\n initialize(config: InitConfig);\n\n initializePlugin();\n\n activatePlugin();\n\n getPluginAccountAddress();\n\n createAccount();\n\n /*openAccount(privateKey: string);*/\n\n closeAccount();\n\n /*getBalance();*/\n}\n\n@Injectable({\n providedIn: 'root'\n})\nexport class GochainNgWeb3Service implements IGochainWeb3Service {\n private _metamaskInstalled: boolean;\n private _metamaskConfigured: boolean;\n private _metamaskActivated: boolean;\n private _config: InitConfig;\n private _gochainNetId: number;\n\n set metamaskInstalled(value: boolean) {\n this._metamaskInstalled = value;\n this.metamaskInstalled$.next(value);\n }\n\n set metamaskConfigured(value: boolean) {\n this._metamaskConfigured = value;\n this.metamaskConfigured$.next(value);\n }\n\n set metamaskActivated(value: boolean) {\n this._metamaskActivated = value;\n this.metamaskActivated$.next(value);\n }\n\n metamaskInstalled$: BehaviorSubject = new BehaviorSubject(null);\n metamaskConfigured$: BehaviorSubject = new BehaviorSubject(null);\n metamaskActivated$: BehaviorSubject = new BehaviorSubject(null);\n ready$: BehaviorSubject = new BehaviorSubject(null);\n accountBalance: string;\n gochainWeb3: Web3;\n pluginWeb3: Web3;\n accountAddress: string;\n account: Account;\n\n get web3(): Web3 {\n if (this._metamaskConfigured && this._metamaskInstalled) {\n return this.pluginWeb3;\n }\n return this.gochainWeb3;\n }\n\n constructor() {\n }\n\n initialize(config: InitConfig): Observable {\n this._config = config;\n if (!config.rpcUrl) {\n return throwError('rpc url hasn\\'t been provided');\n }\n this.gochainWeb3 = new Web3(new Web3.providers.HttpProvider(config.rpcUrl), null, {transactionConfirmationBlocks: 1});\n\n return fromPromise(this.gochainWeb3.eth.net.getId()).pipe(\n catchError((e: Error) => {\n return throwError('Can\\'t get GoChain network id');\n }),\n map(v => !!v),\n );\n }\n\n initializePlugin(): Observable {\n if (!this.gochainWeb3) {\n return throwError('initialize first');\n }\n if (!this._gochainNetId) {\n return throwError('gochain network id is not provided');\n }\n\n this.pluginWeb3 = new Web3(Web3.givenProvider, null, {transactionConfirmationBlocks: 1});\n\n if (!this.pluginWeb3.currentProvider) {\n this.metamaskInstalled = false;\n this.metamaskConfigured = false;\n return throwError('metamask is not installed');\n }\n\n return fromPromise(this.pluginWeb3.eth.net.getId()).pipe(\n catchError((e: Error) => {\n this.metamaskInstalled = true;\n this.metamaskConfigured = false;\n return throwError('Metamask installed but not configured properly - can\\'t get network id from Metamask');\n }),\n map((metamaskNetID: number) => {\n if (this._gochainNetId !== metamaskNetID) {\n this.metamaskInstalled = true;\n this.metamaskConfigured = false;\n return throwError(`Metamask installed but misconfigured - network ID mismatch (must use GoChain ${this._gochainNetId} - e.g. by pointing to ${this._config.rpcUrl})`);\n }\n this.metamaskInstalled = true;\n this.metamaskConfigured = true;\n this.getPluginAccountAddress();\n return true;\n }),\n );\n }\n\n activatePlugin(): Observable {\n return fromPromise((window as any).ethereum.enable()).pipe(\n catchError((e) => {\n this.metamaskActivated = false;\n return throwError('Access haven\\'t been granted');\n }),\n tap(() => {\n this.metamaskActivated = true;\n }),\n );\n }\n\n getPluginAccountAddress(): void {\n fromPromise(this.pluginWeb3.eth.getAccounts()).subscribe((accounts: string[]) => {\n this.accountAddress = accounts[0];\n });\n }\n\n createAccount() {\n return !!this.web3 ? this.web3.eth.accounts.create() : null;\n }\n\n /*protected _openAccount(privateKey: string) {\n if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) {\n privateKey = '0x' + privateKey;\n }\n if (privateKey.length !== 66) {\n throw Error('Given private key is not valid');\n }\n try {\n this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey);\n } catch (e) {\n throw e;\n }\n return this.account;\n }*/\n\n closeAccount() {\n this.account = null;\n this.accountAddress = null;\n this.accountBalance = null;\n }\n\n /*getBalance() {\n return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe(\n map((balance: string) => {\n this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString();\n return this.accountBalance;\n }),\n );\n }*/\n\n sendSignedTx(signed: SignedTransaction): Observable {\n return fromPromise(this.gochainWeb3.eth.sendSignedTransaction(signed.rawTransaction));\n }\n\n isAddress(address: string) {\n return this.gochainWeb3.utils.isAddress(address);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AAUA;IAAA;KAEC;IAAD,iBAAC;CAAA,IAAA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,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC;KAC7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAiBD,2CAAY;;;;;;;;;;;;;;;;;IAAZ;QACE,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;KAC5B;;;;;;;;;;;;;;;;;;;;;IAWD,2CAAY;;;;;;;;;;;;IAAZ,UAAa,MAAyB;QACpC,OAAO,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,qBAAqB,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;KACvF;;;;;IAED,wCAAS;;;;IAAT,UAAU,OAAe;QACvB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;KAClD;;gBA1JF,UAAU,SAAC;oBACV,UAAU,EAAE,MAAM;iBACnB;;;;;+BAlCD;CAgCA,IA2JC;;;;;;IAvJC,kDAAoC;;;;;IACpC,mDAAqC;;;;;IACrC,kDAAoC;;;;;IACpC,uCAA4B;;;;;IAC5B,6CAA8B;;IAiB9B,kDAAkF;;IAClF,mDAAmF;;IACnF,kDAAkF;;IAClF,sCAAsE;;IACtE,8CAAuB;;IACvB,2CAAkB;;IAClB,0CAAiB;;IACjB,8CAAuB;;IACvB,uCAAiB;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/gochain-ng-web3/gochain-ng-web3.d.ts b/dist/gochain-ng-web3/gochain-ng-web3.d.ts new file mode 100644 index 0000000..e5daacf --- /dev/null +++ b/dist/gochain-ng-web3/gochain-ng-web3.d.ts @@ -0,0 +1,4 @@ +/** + * Generated bundle index. Do not edit. + */ +export * from './public-api'; diff --git a/dist/gochain-ng-web3/gochain-ng-web3.metadata.json b/dist/gochain-ng-web3/gochain-ng-web3.metadata.json new file mode 100644 index 0000000..7ac9a5d --- /dev/null +++ b/dist/gochain-ng-web3/gochain-ng-web3.metadata.json @@ -0,0 +1 @@ +{"__symbolic":"module","version":4,"metadata":{"GochainNgWeb3Service":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":32,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"__ctor__":[{"__symbolic":"constructor"}],"initialize":[{"__symbolic":"method"}],"initializePlugin":[{"__symbolic":"method"}],"activatePlugin":[{"__symbolic":"method"}],"getPluginAccountAddress":[{"__symbolic":"method"}],"createAccount":[{"__symbolic":"method"}],"closeAccount":[{"__symbolic":"method"}],"sendSignedTx":[{"__symbolic":"method"}],"isAddress":[{"__symbolic":"method"}]},"statics":{"ngInjectableDef":{}}}},"origins":{"GochainNgWeb3Service":"./lib/gochain-ng-web3.service"},"importAs":"gochain-ng-web3"} \ No newline at end of file diff --git a/dist/gochain-ng-web3/lib/gochain-ng-web3.service.d.ts b/dist/gochain-ng-web3/lib/gochain-ng-web3.service.d.ts new file mode 100644 index 0000000..6718d36 --- /dev/null +++ b/dist/gochain-ng-web3/lib/gochain-ng-web3.service.d.ts @@ -0,0 +1,45 @@ +import { BehaviorSubject, Observable } from 'rxjs'; +import Web3 from 'web3'; +import { Account } from 'web3-eth-accounts'; +import { SignedTransaction, TransactionReceipt } from 'web3-core'; +declare class InitConfig { + rpcUrl: string; +} +interface IGochainWeb3Service { + initialize(config: InitConfig): any; + initializePlugin(): any; + activatePlugin(): any; + getPluginAccountAddress(): any; + createAccount(): any; + closeAccount(): any; +} +export declare class GochainNgWeb3Service implements IGochainWeb3Service { + private _metamaskInstalled; + private _metamaskConfigured; + private _metamaskActivated; + private _config; + private _gochainNetId; + metamaskInstalled: boolean; + metamaskConfigured: boolean; + metamaskActivated: boolean; + metamaskInstalled$: BehaviorSubject; + metamaskConfigured$: BehaviorSubject; + metamaskActivated$: BehaviorSubject; + ready$: BehaviorSubject; + accountBalance: string; + gochainWeb3: Web3; + pluginWeb3: Web3; + accountAddress: string; + account: Account; + readonly web3: Web3; + constructor(); + initialize(config: InitConfig): Observable; + initializePlugin(): Observable; + activatePlugin(): Observable; + getPluginAccountAddress(): void; + createAccount(): Account; + closeAccount(): void; + sendSignedTx(signed: SignedTransaction): Observable; + isAddress(address: string): boolean; +} +export {}; diff --git a/dist/gochain-ng-web3/package.json b/dist/gochain-ng-web3/package.json new file mode 100644 index 0000000..c748633 --- /dev/null +++ b/dist/gochain-ng-web3/package.json @@ -0,0 +1,22 @@ +{ + "name": "gochain-ng-web3", + "version": "0.0.1", + "peerDependencies": { + "@angular/common": "^8.2.8", + "@angular/core": "^8.2.8" + }, + "dependencies": { + "web3": "^2.0.0-alpha.1", + "tslib": "^1.9.0" + }, + "main": "bundles/gochain-ng-web3.umd.js", + "module": "fesm5/gochain-ng-web3.js", + "es2015": "fesm2015/gochain-ng-web3.js", + "esm5": "esm5/gochain-ng-web3.js", + "esm2015": "esm2015/gochain-ng-web3.js", + "fesm5": "fesm5/gochain-ng-web3.js", + "fesm2015": "fesm2015/gochain-ng-web3.js", + "typings": "gochain-ng-web3.d.ts", + "metadata": "gochain-ng-web3.metadata.json", + "sideEffects": false +} diff --git a/dist/gochain-ng-web3/public-api.d.ts b/dist/gochain-ng-web3/public-api.d.ts new file mode 100644 index 0000000..5abaf10 --- /dev/null +++ b/dist/gochain-ng-web3/public-api.d.ts @@ -0,0 +1 @@ +export * from './lib/gochain-ng-web3.service'; diff --git a/gochain-ng-web3-lib-app/src/app/app.module.ts b/gochain-ng-web3-lib-app/src/app/app.module.ts deleted file mode 100644 index 5c3da9c..0000000 --- a/gochain-ng-web3-lib-app/src/app/app.module.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { BrowserModule } from '@angular/platform-browser'; -import { NgModule } from '@angular/core'; - -import { AppRoutingModule } from './app-routing.module'; -import { AppComponent } from './app.component'; - -// Libraries -import { GochainNgWeb3Module } from 'gochain-ng-web3'; - -@NgModule({ - declarations: [ - AppComponent, - ], - imports: [ - BrowserModule, - AppRoutingModule, - GochainNgWeb3Module - ], - providers: [], - bootstrap: [AppComponent] -}) -export class AppModule { } diff --git a/projects/gochain-ng-web3/ng-package.json b/projects/gochain-ng-web3/ng-package.json index be9be0e..6f1cddc 100644 --- a/projects/gochain-ng-web3/ng-package.json +++ b/projects/gochain-ng-web3/ng-package.json @@ -3,5 +3,6 @@ "dest": "../../dist/gochain-ng-web3", "lib": { "entryFile": "src/public-api.ts" - } -} \ No newline at end of file + }, + "whitelistedNonPeerDependencies": ["web3"] +} diff --git a/projects/gochain-ng-web3/package-lock.json b/projects/gochain-ng-web3/package-lock.json index c11287d..929c815 100644 --- a/projects/gochain-ng-web3/package-lock.json +++ b/projects/gochain-ng-web3/package-lock.json @@ -4,151 +4,53 @@ "lockfileVersion": 1, "requires": true, "dependencies": { - "@sindresorhus/is": { - "version": "0.14.0", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", - "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==" - }, - "@szmarczak/http-timer": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", - "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", + "@babel/runtime": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.6.0.tgz", + "integrity": "sha512-89eSBLJsxNxOERC0Op4vd+0Bqm6wRMqMbFtV3i0/fbaWw/mJ8Q3eBvgX0G4SyrOOLCtbu98HspF8o09MRT+KzQ==", "requires": { - "defer-to-connect": "^1.0.1" + "regenerator-runtime": "^0.13.2" } }, - "@types/node": { - "version": "10.14.18", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.18.tgz", - "integrity": "sha512-ryO3Q3++yZC/+b8j8BdKd/dn9JlzlHBPdm80656xwYUdmPkpTGTjkAdt6BByiNupGPE8w0FhBgvYy/fX9hRNGQ==" - }, - "accepts": { - "version": "1.3.7", - "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", - "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==", + "@types/bn.js": { + "version": "4.11.5", + "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.5.tgz", + "integrity": "sha512-AEAZcIZga0JgVMHNtl1CprA/hXX7/wPt79AgR4XqaDt7jyj3QWYw6LPoOiznPtugDmlubUnAahMs2PFxGcQrng==", "requires": { - "mime-types": "~2.1.24", - "negotiator": "0.6.2" + "@types/node": "*" } }, + "@types/node": { + "version": "12.7.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.5.tgz", + "integrity": "sha512-9fq4jZVhPNW8r+UYKnxF1e2HkDWOWKM5bC2/7c9wPV835I0aOrVbS/Hw/pWPk2uKrNXQqg9Z959Kz+IYDd5p3w==" + }, "aes-js": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" }, - "ajv": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.10.2.tgz", - "integrity": "sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw==", - "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, - "any-promise": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", - "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=" - }, - "array-flatten": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", - "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" - }, - "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "asn1.js": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", - "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", - "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=" - }, - "async-limiter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" - }, - "asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" - }, - "aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=" - }, - "aws4": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz", - "integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==" - }, - "base64-js": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.1.tgz", - "integrity": "sha512-mLQ4i2QO1ytvGWFWmcngKO//JXAQueZvwEKtjgQFM4jIK0kU+ytMfplL8j+n5mspOfjHwoAg+9yhb7BwAHm36g==" - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", "requires": { - "tweetnacl": "^0.14.3" + "file-uri-to-path": "1.0.0" } }, - "bl": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/bl/-/bl-1.2.2.tgz", - "integrity": "sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==", + "bip66": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz", + "integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=", "requires": { - "readable-stream": "^2.3.5", - "safe-buffer": "^5.1.1" + "safe-buffer": "^5.0.1" } }, - "bluebird": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.5.tgz", - "integrity": "sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==" - }, "bn.js": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==" }, - "body-parser": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.0.tgz", - "integrity": "sha512-dhEPs72UPbDnAQJ9ZKMNTP6ptJaionhP5cBb541nXPlW60Jepo9RV/a4fX4XWW9CuFNK22krhrj1+rgzifNCsw==", - "requires": { - "bytes": "3.1.0", - "content-type": "~1.0.4", - "debug": "2.6.9", - "depd": "~1.1.2", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "on-finished": "~2.3.0", - "qs": "6.7.0", - "raw-body": "2.4.0", - "type-is": "~1.6.17" - } - }, "brorand": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", @@ -188,71 +90,6 @@ "safe-buffer": "^5.1.2" } }, - "browserify-rsa": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", - "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", - "requires": { - "bn.js": "^4.1.0", - "randombytes": "^2.0.1" - } - }, - "browserify-sha3": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.4.tgz", - "integrity": "sha1-CGxHuMgjFsnUcCLCYYWVRXbdjiY=", - "requires": { - "js-sha3": "^0.6.1", - "safe-buffer": "^5.1.1" - } - }, - "browserify-sign": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", - "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", - "requires": { - "bn.js": "^4.1.1", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.2", - "elliptic": "^6.0.0", - "inherits": "^2.0.1", - "parse-asn1": "^5.0.0" - } - }, - "buffer": { - "version": "5.4.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.4.3.tgz", - "integrity": "sha512-zvj65TkFeIt3i6aj5bIvJDzjjQQGs4o/sNoezg1F1kYap9Nu2jcUdpwzRSJTHMMzG0H7bZkn4rNQpImhuxWX2A==", - "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4" - } - }, - "buffer-alloc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/buffer-alloc/-/buffer-alloc-1.2.0.tgz", - "integrity": "sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==", - "requires": { - "buffer-alloc-unsafe": "^1.1.0", - "buffer-fill": "^1.0.0" - } - }, - "buffer-alloc-unsafe": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz", - "integrity": "sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==" - }, - "buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=" - }, - "buffer-fill": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-fill/-/buffer-fill-1.0.0.tgz", - "integrity": "sha1-+PeLdniYiO858gXNY39o5wISKyw=" - }, "buffer-to-arraybuffer": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/buffer-to-arraybuffer/-/buffer-to-arraybuffer-0.0.5.tgz", @@ -263,50 +100,6 @@ "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=" }, - "bytes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", - "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" - }, - "cacheable-request": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", - "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", - "requires": { - "clone-response": "^1.0.2", - "get-stream": "^5.1.0", - "http-cache-semantics": "^4.0.0", - "keyv": "^3.0.0", - "lowercase-keys": "^2.0.0", - "normalize-url": "^4.1.0", - "responselike": "^1.0.2" - }, - "dependencies": { - "get-stream": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", - "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", - "requires": { - "pump": "^3.0.0" - } - }, - "lowercase-keys": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", - "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==" - } - } - }, - "caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=" - }, - "chownr": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.2.tgz", - "integrity": "sha512-GkfeAQh+QNy3wquu9oIZr6SS5x7wGdSgNQvD10X3r+AZr1Oys22HW8kAmDMvNg2+Dm0TeGaEuO8gFwdBXxwO8A==" - }, "cipher-base": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", @@ -316,88 +109,11 @@ "safe-buffer": "^5.0.1" } }, - "clone-response": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", - "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", - "requires": { - "mimic-response": "^1.0.0" - } - }, - "combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "requires": { - "delayed-stream": "~1.0.0" - } - }, - "commander": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", - "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", - "requires": { - "graceful-readlink": ">= 1.0.0" - } - }, - "content-disposition": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.3.tgz", - "integrity": "sha512-ExO0774ikEObIAEV9kDo50o+79VCUdEB6n6lzKgGwupcVeRlhrj3qGAfwq8G6uBJjkqLrhT0qEYFcWng8z1z0g==", - "requires": { - "safe-buffer": "5.1.2" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } - } - }, - "content-type": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz", - "integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==" - }, - "cookie": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.0.tgz", - "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" - }, - "cookie-signature": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", - "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=" - }, "cookiejar": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==" }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" - }, - "cors": { - "version": "2.8.5", - "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz", - "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==", - "requires": { - "object-assign": "^4", - "vary": "^1" - } - }, - "create-ecdh": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", - "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", - "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.0.0" - } - }, "create-hash": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", @@ -423,24 +139,6 @@ "sha.js": "^2.4.8" } }, - "crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", - "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - } - }, "d": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz", @@ -450,14 +148,6 @@ "type": "^1.0.1" } }, - "dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", - "requires": { - "assert-plus": "^1.0.0" - } - }, "debug": { "version": "2.6.9", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", @@ -471,21 +161,6 @@ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=" }, - "decompress": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/decompress/-/decompress-4.2.0.tgz", - "integrity": "sha1-eu3YVCflqS2s/lVnSnxQXpbQH50=", - "requires": { - "decompress-tar": "^4.0.0", - "decompress-tarbz2": "^4.0.0", - "decompress-targz": "^4.0.0", - "decompress-unzip": "^4.0.1", - "graceful-fs": "^4.1.10", - "make-dir": "^1.0.0", - "pify": "^2.3.0", - "strip-dirs": "^2.0.0" - } - }, "decompress-response": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", @@ -494,77 +169,6 @@ "mimic-response": "^1.0.0" } }, - "decompress-tar": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/decompress-tar/-/decompress-tar-4.1.1.tgz", - "integrity": "sha512-JdJMaCrGpB5fESVyxwpCx4Jdj2AagLmv3y58Qy4GE6HMVjWz1FeVQk1Ct4Kye7PftcdOo/7U7UKzYBJgqnGeUQ==", - "requires": { - "file-type": "^5.2.0", - "is-stream": "^1.1.0", - "tar-stream": "^1.5.2" - } - }, - "decompress-tarbz2": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/decompress-tarbz2/-/decompress-tarbz2-4.1.1.tgz", - "integrity": "sha512-s88xLzf1r81ICXLAVQVzaN6ZmX4A6U4z2nMbOwobxkLoIIfjVMBg7TeguTUXkKeXni795B6y5rnvDw7rxhAq9A==", - "requires": { - "decompress-tar": "^4.1.0", - "file-type": "^6.1.0", - "is-stream": "^1.1.0", - "seek-bzip": "^1.0.5", - "unbzip2-stream": "^1.0.9" - }, - "dependencies": { - "file-type": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-6.2.0.tgz", - "integrity": "sha512-YPcTBDV+2Tm0VqjybVd32MHdlEGAtuxS3VAYsumFokDSMG+ROT5wawGlnHDoz7bfMcMDt9hxuXvXwoKUx2fkOg==" - } - } - }, - "decompress-targz": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/decompress-targz/-/decompress-targz-4.1.1.tgz", - "integrity": "sha512-4z81Znfr6chWnRDNfFNqLwPvm4db3WuZkqV+UgXQzSngG3CEKdBkw5jrv3axjjL96glyiiKjsxJG3X6WBZwX3w==", - "requires": { - "decompress-tar": "^4.1.1", - "file-type": "^5.2.0", - "is-stream": "^1.1.0" - } - }, - "decompress-unzip": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/decompress-unzip/-/decompress-unzip-4.0.1.tgz", - "integrity": "sha1-3qrM39FK6vhVePczroIQ+bSEj2k=", - "requires": { - "file-type": "^3.8.0", - "get-stream": "^2.2.0", - "pify": "^2.3.0", - "yauzl": "^2.4.2" - }, - "dependencies": { - "file-type": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-3.9.0.tgz", - "integrity": "sha1-JXoHg4TR24CHvESdEH1SpSZyuek=" - }, - "get-stream": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-2.3.1.tgz", - "integrity": "sha1-Xzj5PzRgCWZu4BUKBUFn+Rvdld4=", - "requires": { - "object-assign": "^4.0.1", - "pinkie-promise": "^2.0.0" - } - } - } - }, - "defer-to-connect": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.0.2.tgz", - "integrity": "sha512-k09hcQcTDY+cwgiwa6PYKLm3jlagNzQ+RSvhjzESOGOx+MNOuXkxTfEvPrO1IOQ81tArCFYQgi631clB70RpQw==" - }, "define-properties": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", @@ -573,16 +177,6 @@ "object-keys": "^1.0.12" } }, - "delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" - }, - "depd": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", - "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=" - }, "des.js": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", @@ -592,45 +186,21 @@ "minimalistic-assert": "^1.0.0" } }, - "destroy": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz", - "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" - }, - "diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", - "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - } - }, "dom-walk": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/dom-walk/-/dom-walk-0.1.1.tgz", "integrity": "sha1-ZyIm3HTI95mtNTB9+TaroRrNYBg=" }, - "duplexer3": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", - "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=" - }, - "ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", + "drbg.js": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz", + "integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=", "requires": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" + "browserify-aes": "^1.0.6", + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4" } }, - "ee-first": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", - "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" - }, "elliptic": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.1.tgz", @@ -645,19 +215,6 @@ "minimalistic-crypto-utils": "^1.0.0" } }, - "encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=" - }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "requires": { - "once": "^1.4.0" - } - }, "es-abstract": { "version": "1.14.2", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.14.2.tgz", @@ -714,16 +271,6 @@ "es5-ext": "^0.10.51" } }, - "escape-html": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", - "integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg=" - }, - "etag": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", - "integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=" - }, "eth-ens-namehash": { "version": "2.0.8", "resolved": "https://registry.npmjs.org/eth-ens-namehash/-/eth-ens-namehash-2.0.8.tgz", @@ -731,33 +278,50 @@ "requires": { "idna-uts46-hx": "^2.3.1", "js-sha3": "^0.5.7" - }, - "dependencies": { - "js-sha3": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" - } } }, "eth-lib": { - "version": "0.1.27", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", - "integrity": "sha512-B8czsfkJYzn2UIEMwjc7Mbj+Cy72V+/OXH/tb44LV8jhrjizQJJ325xMOMyk3+ETa6r6oi0jsUY14+om8mQMWA==", + "version": "0.2.8", + "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz", + "integrity": "sha512-ArJ7x1WcWOlSpzdoTBX8vkwlkSQ85CjjifSZtV4co64vWxSV8geWfPI9x4SVYu3DSxnX4yWFVTtGL+j9DUFLNw==", "requires": { "bn.js": "^4.11.6", "elliptic": "^6.4.0", - "keccakjs": "^0.2.1", - "nano-json-stream-parser": "^0.1.2", - "servify": "^0.1.12", - "ws": "^3.0.0", "xhr-request-promise": "^0.1.2" } }, + "ethereum-common": { + "version": "0.0.18", + "resolved": "https://registry.npmjs.org/ethereum-common/-/ethereum-common-0.0.18.tgz", + "integrity": "sha1-L9w1dvIykDNYl26znaeDIT/5Uj8=" + }, + "ethereumjs-tx": { + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/ethereumjs-tx/-/ethereumjs-tx-1.3.7.tgz", + "integrity": "sha512-wvLMxzt1RPhAQ9Yi3/HKZTn0FZYpnsmQdbKYfUUpi4j1SEIcbkd9tndVjcPrufY3V7j2IebOpC00Zp2P/Ay2kA==", + "requires": { + "ethereum-common": "^0.0.18", + "ethereumjs-util": "^5.0.0" + } + }, + "ethereumjs-util": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-5.2.0.tgz", + "integrity": "sha512-CJAKdI0wgMbQFLlLRtZKGcy/L6pzVRgelIZqRqNbuVFM3K9VEnyfbcvz0ncWMRNCe4kaHWjwRYQcYMucmwsnWA==", + "requires": { + "bn.js": "^4.11.0", + "create-hash": "^1.1.2", + "ethjs-util": "^0.1.3", + "keccak": "^1.0.2", + "rlp": "^2.0.0", + "safe-buffer": "^5.1.1", + "secp256k1": "^3.0.1" + } + }, "ethers": { - "version": "4.0.0-beta.3", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.0-beta.3.tgz", - "integrity": "sha512-YYPogooSknTwvHg3+Mv71gM/3Wcrx+ZpCzarBj3mqs9njjRkrOo2/eufzhHloOCo3JSoNI4TQJJ6yU5ABm3Uog==", + "version": "4.0.37", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.37.tgz", + "integrity": "sha512-B7bDdyQ45A5lPr6k2HOkEKMtYOuqlfy+nNf8glnRvWidkDQnToKw1bv7UyrwlbsIgY2mE03UxTVtouXcT6Vvcw==", "requires": { "@types/node": "^10.3.2", "aes-js": "3.0.0", @@ -765,12 +329,17 @@ "elliptic": "6.3.3", "hash.js": "1.1.3", "js-sha3": "0.5.7", - "scrypt-js": "2.0.3", + "scrypt-js": "2.0.4", "setimmediate": "1.0.4", "uuid": "2.0.1", "xmlhttprequest": "1.8.0" }, "dependencies": { + "@types/node": { + "version": "10.14.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.18.tgz", + "integrity": "sha512-ryO3Q3++yZC/+b8j8BdKd/dn9JlzlHBPdm80656xwYUdmPkpTGTjkAdt6BByiNupGPE8w0FhBgvYy/fX9hRNGQ==" + }, "elliptic": { "version": "6.3.3", "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.3.3.tgz", @@ -790,21 +359,6 @@ "inherits": "^2.0.3", "minimalistic-assert": "^1.0.0" } - }, - "js-sha3": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", - "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" - }, - "setimmediate": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", - "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" - }, - "uuid": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", - "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" } } }, @@ -824,10 +378,19 @@ } } }, + "ethjs-util": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/ethjs-util/-/ethjs-util-0.1.6.tgz", + "integrity": "sha512-CUnVOQq7gSpDHZVVrQW8ExxUETWrnrvXYvYz55wOU8Uj4VCgw56XC2B/fVqQN+f7gmrnRHSLVnFAwsCuNwji8w==", + "requires": { + "is-hex-prefixed": "1.0.0", + "strip-hex-prefix": "1.0.0" + } + }, "eventemitter3": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.2.tgz", - "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-3.1.0.tgz", + "integrity": "sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA==" }, "evp_bytestokey": { "version": "1.0.3", @@ -838,96 +401,10 @@ "safe-buffer": "^5.1.1" } }, - "express": { - "version": "4.17.1", - "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", - "integrity": "sha512-mHJ9O79RqluphRrcw2X/GTh3k9tVv8YcoyY4Kkh4WDMUYKRZUq0h1o0w2rrrxBqM7VoeUVqgb27xlEMXTnYt4g==", - "requires": { - "accepts": "~1.3.7", - "array-flatten": "1.1.1", - "body-parser": "1.19.0", - "content-disposition": "0.5.3", - "content-type": "~1.0.4", - "cookie": "0.4.0", - "cookie-signature": "1.0.6", - "debug": "2.6.9", - "depd": "~1.1.2", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "finalhandler": "~1.1.2", - "fresh": "0.5.2", - "merge-descriptors": "1.0.1", - "methods": "~1.1.2", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "path-to-regexp": "0.1.7", - "proxy-addr": "~2.0.5", - "qs": "6.7.0", - "range-parser": "~1.2.1", - "safe-buffer": "5.1.2", - "send": "0.17.1", - "serve-static": "1.14.1", - "setprototypeof": "1.1.1", - "statuses": "~1.5.0", - "type-is": "~1.6.18", - "utils-merge": "1.0.1", - "vary": "~1.1.2" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } - } - }, - "extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=" - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=" - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" - }, - "fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", - "requires": { - "pend": "~1.2.0" - } - }, - "file-type": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/file-type/-/file-type-5.2.0.tgz", - "integrity": "sha1-LdvqfHP/42No365J3DOMBYwritY=" - }, - "finalhandler": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz", - "integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==", - "requires": { - "debug": "2.6.9", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "on-finished": "~2.3.0", - "parseurl": "~1.3.3", - "statuses": "~1.5.0", - "unpipe": "~1.0.0" - } + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" }, "for-each": { "version": "0.3.3", @@ -937,75 +414,11 @@ "is-callable": "^1.1.3" } }, - "forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=" - }, - "form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - } - }, - "forwarded": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.2.tgz", - "integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ=" - }, - "fresh": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz", - "integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=" - }, - "fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==" - }, - "fs-extra": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs-minipass": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz", - "integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==", - "requires": { - "minipass": "^2.6.0" - } - }, "function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" }, - "get-stream": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", - "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", - "requires": { - "pump": "^3.0.0" - } - }, - "getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", - "requires": { - "assert-plus": "^1.0.0" - } - }, "global": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/global/-/global-4.3.2.tgz", @@ -1015,48 +428,6 @@ "process": "~0.5.1" } }, - "got": { - "version": "9.6.0", - "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", - "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", - "requires": { - "@sindresorhus/is": "^0.14.0", - "@szmarczak/http-timer": "^1.1.2", - "cacheable-request": "^6.0.0", - "decompress-response": "^3.3.0", - "duplexer3": "^0.1.4", - "get-stream": "^4.1.0", - "lowercase-keys": "^1.0.1", - "mimic-response": "^1.0.1", - "p-cancelable": "^1.0.0", - "to-readable-stream": "^1.0.0", - "url-parse-lax": "^3.0.0" - } - }, - "graceful-fs": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.2.tgz", - "integrity": "sha512-IItsdsea19BoLC7ELy13q1iJFNmd7ofZH5+X/pJr90/nRoPEX0DJo1dHDbgtYWOhJhcCgMDTOw84RZ72q6lB+Q==" - }, - "graceful-readlink": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=" - }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=" - }, - "har-validator": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz", - "integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==", - "requires": { - "ajv": "^6.5.5", - "har-schema": "^2.0.0" - } - }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -1065,24 +436,11 @@ "function-bind": "^1.1.1" } }, - "has-symbol-support-x": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/has-symbol-support-x/-/has-symbol-support-x-1.4.2.tgz", - "integrity": "sha512-3ToOva++HaW+eCpgqZrCfN51IPB+7bJNVT6CUATzueB5Heb8o6Nam0V3HG5dlDvZU1Gn5QLcbahiKw/XVk5JJw==" - }, "has-symbols": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" }, - "has-to-string-tag-x": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/has-to-string-tag-x/-/has-to-string-tag-x-1.4.1.tgz", - "integrity": "sha512-vdbKfmw+3LoOYVr+mtxHaX5a96+0f3DljYd8JOqvOLsf5mw2Otda2qCDT9qRqLAhrjyQ0h7ual5nOiASpsGNFw==", - "requires": { - "has-symbol-support-x": "^1.4.1" - } - }, "hash-base": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", @@ -1111,83 +469,19 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "http-cache-semantics": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz", - "integrity": "sha512-TcIMG3qeVLgDr1TEd2XvHaTnMPwYQUQMIBLy+5pLSDKYFc7UIqj39w8EGzZkaxoLv/l2K8HaI0t5AVA+YYgUew==" - }, - "http-errors": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.7.2.tgz", - "integrity": "sha512-uUQBt3H/cSIVfch6i1EuPNy/YsRSOUBXTVfZ+yR7Zjez3qjBz6i9+i4zjNaoqcoFVI4lQJ5plg63TvGfRSDCRg==", + "idna-uts46-hx": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz", + "integrity": "sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA==", "requires": { - "depd": "~1.1.2", - "inherits": "2.0.3", - "setprototypeof": "1.1.1", - "statuses": ">= 1.5.0 < 2", - "toidentifier": "1.0.0" - }, - "dependencies": { - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" - } + "punycode": "2.1.0" } }, - "http-https": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz", - "integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs=" - }, - "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", - "requires": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - } - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "idna-uts46-hx": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/idna-uts46-hx/-/idna-uts46-hx-2.3.1.tgz", - "integrity": "sha512-PWoF9Keq6laYdIRwwCdhTPl60xRqAloYNMQLiyUnG42VjT53oW07BXIRM+NK7eQjzXjAk2gUvX9caRxlnF9TAA==", - "requires": { - "punycode": "2.1.0" - }, - "dependencies": { - "punycode": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", - "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=" - } - } - }, - "ieee754": { - "version": "1.1.13", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.13.tgz", - "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg==" - }, "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "ipaddr.js": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.0.tgz", - "integrity": "sha512-M4Sjn6N/+O6/IXSJseKqHoFc+5FdGJ22sXqnjTpdZweHK64MzEPAyQZyEU3R/KRv2GLoa7nNtg/C2Ev6m7z+eA==" - }, "is-callable": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", @@ -1208,21 +502,6 @@ "resolved": "https://registry.npmjs.org/is-hex-prefixed/-/is-hex-prefixed-1.0.0.tgz", "integrity": "sha1-fY035q135dEnFIkTxXPggtd39VQ=" }, - "is-natural-number": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-natural-number/-/is-natural-number-4.0.1.tgz", - "integrity": "sha1-q5124dtM7VHjXeDHLr7PCfc0zeg=" - }, - "is-object": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.1.tgz", - "integrity": "sha1-iVJojF7C/9awPsyF52ngKQMINHA=" - }, - "is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=" - }, "is-regex": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", @@ -1231,16 +510,6 @@ "has": "^1.0.1" } }, - "is-retry-allowed": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.2.0.tgz", - "integrity": "sha512-RUbUeKwvm3XG2VYamhJL1xFktgjvPzL0Hq8C+6yrWIswDy3BIXGqCxhxkc30N9jqK311gVU137K8Ei55/zVJRg==" - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=" - }, "is-symbol": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.2.tgz", @@ -1254,110 +523,26 @@ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=" }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" - }, - "isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" - }, - "isurl": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isurl/-/isurl-1.0.0.tgz", - "integrity": "sha512-1P/yWsxPlDtn7QeRD+ULKQPaIaN6yF368GZ2vDfv0AL0NwpStafjWCDDdn0k8wgFMWpVAqG7oJhxHnlud42i9w==", - "requires": { - "has-to-string-tag-x": "^1.2.0", - "is-object": "^1.0.1" - } - }, "js-sha3": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.6.1.tgz", - "integrity": "sha1-W4n3enR3Z5h39YxKB1JAk0sflcA=" - }, - "jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=" - }, - "json-buffer": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", - "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=" - }, - "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=" + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.5.7.tgz", + "integrity": "sha1-DU/9gALVMzqrr0oj7tL2N0yfKOc=" }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", - "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.2.3", - "verror": "1.10.0" - } - }, - "keccakjs": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.3.tgz", - "integrity": "sha512-BjLkNDcfaZ6l8HBG9tH0tpmDv3sS2mA7FNQxFHpCdzP3Gb2MVruXBSuoM66SnVxKJpAr5dKGdkHD+bDokt8fTg==", - "requires": { - "browserify-sha3": "^0.0.4", - "sha3": "^1.2.2" - } - }, - "keyv": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", - "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", + "keccak": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-1.4.0.tgz", + "integrity": "sha512-eZVaCpblK5formjPjeTBik7TAg+pqnDrMHIffSvi9Lh7PQgM1+hSzakUeZFCk9DVVG0dacZJuaz2ntwlzZUIBw==", "requires": { - "json-buffer": "3.0.0" + "bindings": "^1.2.1", + "inherits": "^2.0.3", + "nan": "^2.2.1", + "safe-buffer": "^5.1.0" } }, - "lowercase-keys": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", - "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==" - }, - "make-dir": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", - "requires": { - "pify": "^3.0.0" - }, - "dependencies": { - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=" - } - } + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==" }, "md5.js": { "version": "1.3.5", @@ -1369,48 +554,6 @@ "safe-buffer": "^5.1.2" } }, - "media-typer": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", - "integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=" - }, - "merge-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz", - "integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E=" - }, - "methods": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz", - "integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=" - }, - "miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", - "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - } - }, - "mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==" - }, - "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==" - }, - "mime-types": { - "version": "2.1.24", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.24.tgz", - "integrity": "sha512-WaFHS3MCl5fapm3oLxU4eYDw77IQM2ACcxQ9RIxfaC3ooc6PFuBMGZZsYpvoXS5D5QTWPieo1jjLdAm3TBP3cQ==", - "requires": { - "mime-db": "1.40.0" - } - }, "mimic-response": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", @@ -1434,79 +577,21 @@ "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" - }, - "minipass": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.6.2.tgz", - "integrity": "sha512-38Jwdc8AttUDaQAIRX8Iaw3QoCDWjAwKMGeGDF9JUi9QCPMjH5qAQg/hdO8o1nC7Nmh1/CqzMg5FQPEKuKwznQ==", - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.2.tgz", - "integrity": "sha512-hR3At21uSrsjjDTWrbu0IMLTpnkpv8IIMFDFaoz43Tmu4LkmAXfH44vNNzpTnf+OAQQCHrb91y/wc2J4x5XgSQ==", - "requires": { - "minipass": "^2.2.1" - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "requires": { - "minimist": "0.0.8" - } - }, - "mkdirp-promise": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/mkdirp-promise/-/mkdirp-promise-5.0.1.tgz", - "integrity": "sha1-6bj2jlUsaKnBcTuEiD96HdA5uKE=", - "requires": { - "mkdirp": "*" - } - }, - "mock-fs": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-4.10.1.tgz", - "integrity": "sha512-w22rOL5ZYu6HbUehB5deurghGM0hS/xBVyHMGKOuQctkk93J9z9VEOhDsiWrXOprVNQpP9uzGKdl8v9mFspKuw==" - }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" }, "nan": { - "version": "2.13.2", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", - "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==" - }, - "nano-json-stream-parser": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/nano-json-stream-parser/-/nano-json-stream-parser-0.1.2.tgz", - "integrity": "sha1-DMj20OK2IrR5xA1JnEbWS3Vcb18=" - }, - "negotiator": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.2.tgz", - "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" + "version": "2.14.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", + "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==" }, "next-tick": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz", "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=" }, - "normalize-url": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.3.0.tgz", - "integrity": "sha512-0NLtR71o4k6GLP+mr6Ty34c5GA6CMoEsncKJxvQd8NzPxaHRJNnb5gZE8R1XF4CPIS7QPHLJ74IFszwtNVAHVQ==" - }, "number-to-bn": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/number-to-bn/-/number-to-bn-1.7.0.tgz", @@ -1523,11 +608,6 @@ } } }, - "oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==" - }, "object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", @@ -1543,22 +623,6 @@ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" }, - "oboe": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/oboe/-/oboe-2.1.4.tgz", - "integrity": "sha1-IMiM2wwVNxuwQRklfU/dNLCqSfY=", - "requires": { - "http-https": "^1.0.0" - } - }, - "on-finished": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", - "integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=", - "requires": { - "ee-first": "1.1.1" - } - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -1567,37 +631,6 @@ "wrappy": "1" } }, - "p-cancelable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", - "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==" - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" - }, - "p-timeout": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-1.2.1.tgz", - "integrity": "sha1-XrOzU7f86Z8QGhA4iAuwVOu+o4Y=", - "requires": { - "p-finally": "^1.0.0" - } - }, - "parse-asn1": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.4.tgz", - "integrity": "sha512-Qs5duJcuvNExRfFZ99HDD3z4mAi3r9Wl/FOjEOijlxwCZs7E7mW2vjTpgQ4J8LpTF8x5v+1Vn5UQFejmWT11aw==", - "requires": { - "asn1.js": "^4.0.0", - "browserify-aes": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3", - "safe-buffer": "^5.1.1" - } - }, "parse-headers": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.2.tgz", @@ -1607,16 +640,6 @@ "string.prototype.trim": "^1.1.2" } }, - "parseurl": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", - "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==" - }, - "path-to-regexp": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", - "integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w=" - }, "pbkdf2": { "version": "3.0.17", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.17.tgz", @@ -1629,94 +652,15 @@ "sha.js": "^2.4.8" } }, - "pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=" - }, - "performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=" - }, - "pinkie": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", - "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=" - }, - "pinkie-promise": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", - "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", - "requires": { - "pinkie": "^2.0.0" - } - }, - "prepend-http": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", - "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" - }, "process": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/process/-/process-0.5.2.tgz", "integrity": "sha1-FjjYqONML0QKkduVq5rrZ3/Bhc8=" }, - "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" - }, - "proxy-addr": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", - "integrity": "sha512-t/7RxHXPH6cJtP0pRG6smSr9QJidhB+3kXu0KgXnbGYMgzEnUxRQ4/LDdfOwZEMyIh3/xHb8PX3t+lfL9z+YVQ==", - "requires": { - "forwarded": "~0.1.2", - "ipaddr.js": "1.9.0" - } - }, - "psl": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz", - "integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==" - }, - "public-encrypt": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", - "integrity": "sha512-zVpa8oKZSz5bTMTFClc1fQOnyyEzpl5ozpi1B5YcvBrdohMjH2rfsBtyXcuNuwjsDIXmBYlF2N5FlJYhR29t8Q==", - "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" - }, - "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.0.tgz", + "integrity": "sha1-X4Y+3Im5bbCQdLrXlHvwkFbKTn0=" }, "query-string": { "version": "5.1.1", @@ -1728,6 +672,11 @@ "strict-uri-encode": "^1.0.0" } }, + "querystringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.1.1.tgz", + "integrity": "sha512-w7fLxIRCRT7U8Qu53jQnJyPkYZIaR4n5151KMfcJlO/A9397Wxb1amJvROTK6TOnp7PfoAmg/qXiNHI+08jRfA==" + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -1736,98 +685,15 @@ "safe-buffer": "^5.1.0" } }, - "randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "randomhex": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/randomhex/-/randomhex-0.1.5.tgz", - "integrity": "sha1-us7vmCMpCRQA8qKRLGzQLxCU9YU=" - }, - "range-parser": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", - "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==" - }, - "raw-body": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz", - "integrity": "sha512-4Oz8DUIwdvoa5qMJelxipzi/iJIi40O5cGV1wNYp5hvZP8ZN0T+jiNkL0QepXs+EsQ9XJ8ipEDoiH70ySUJP3Q==", - "requires": { - "bytes": "3.1.0", - "http-errors": "1.7.2", - "iconv-lite": "0.4.24", - "unpipe": "1.0.0" - } - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } - } - }, - "request": { - "version": "2.88.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", - "integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==", - "requires": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.0", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.4.3", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "dependencies": { - "qs": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz", - "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA==" - } - } + "regenerator-runtime": { + "version": "0.13.3", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz", + "integrity": "sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw==" }, - "responselike": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", - "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", - "requires": { - "lowercase-keys": "^1.0.0" - } + "requires-port": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", + "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" }, "ripemd160": { "version": "2.0.2", @@ -1838,32 +704,51 @@ "inherits": "^2.0.1" } }, + "rlp": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.3.tgz", + "integrity": "sha512-l6YVrI7+d2vpW6D6rS05x2Xrmq8oW7v3pieZOJKBEdjuTF4Kz/iwk55Zyh1Zaz+KOB2kC8+2jZlp2u9L4tTzCQ==", + "requires": { + "bn.js": "^4.11.1", + "safe-buffer": "^5.1.1" + } + }, + "rxjs": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz", + "integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==", + "requires": { + "tslib": "^1.9.0" + } + }, "safe-buffer": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.0.tgz", "integrity": "sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==" }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, "scrypt-js": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.3.tgz", - "integrity": "sha1-uwBAvgMEPamgEqLOqfyfhSz8h9Q=" + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.4.tgz", + "integrity": "sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw==" }, "scryptsy": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-2.1.0.tgz", "integrity": "sha512-1CdSqHQowJBnMAFyPEBRfqag/YP9OF394FV+4YREIJX4ljD7OxvQRDayyoyyCk+senRjSkP6VnUNQmVQqB6g7w==" }, - "seek-bzip": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/seek-bzip/-/seek-bzip-1.0.5.tgz", - "integrity": "sha1-z+kXyz0nS8/6x5J1ivUxc+sfq9w=", - "requires": { - "commander": "~2.8.1" + "secp256k1": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.7.1.tgz", + "integrity": "sha512-1cf8sbnRreXrQFdH6qsg2H71Xw91fCCS9Yp021GnUNJzWJS/py96fS4lHbnTnouLp08Xj6jBoBB6V78Tdbdu5g==", + "requires": { + "bindings": "^1.5.0", + "bip66": "^1.1.5", + "bn.js": "^4.11.8", + "create-hash": "^1.2.0", + "drbg.js": "^1.0.1", + "elliptic": "^6.4.1", + "nan": "^2.14.0", + "safe-buffer": "^5.1.2" } }, "semver": { @@ -1871,65 +756,10 @@ "resolved": "https://registry.npmjs.org/semver/-/semver-6.2.0.tgz", "integrity": "sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A==" }, - "send": { - "version": "0.17.1", - "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", - "integrity": "sha512-BsVKsiGcQMFwT8UxypobUKyv7irCNRHk1T0G680vk88yf6LBByGcZJOTJCrTP2xVN6yI+XjPJcNuE3V4fT9sAg==", - "requires": { - "debug": "2.6.9", - "depd": "~1.1.2", - "destroy": "~1.0.4", - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "etag": "~1.8.1", - "fresh": "0.5.2", - "http-errors": "~1.7.2", - "mime": "1.6.0", - "ms": "2.1.1", - "on-finished": "~2.3.0", - "range-parser": "~1.2.1", - "statuses": "~1.5.0" - }, - "dependencies": { - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==" - } - } - }, - "serve-static": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.1.tgz", - "integrity": "sha512-JMrvUwE54emCYWlTI+hGrGv5I8dEwmco/00EvkzIIsR7MqrHonbD9pO2MOfFnpFntl7ecpZs+3mW+XbQZu9QCg==", - "requires": { - "encodeurl": "~1.0.2", - "escape-html": "~1.0.3", - "parseurl": "~1.3.3", - "send": "0.17.1" - } - }, - "servify": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/servify/-/servify-0.1.12.tgz", - "integrity": "sha512-/xE6GvsKKqyo1BAY+KxOWXcLpPsUUyji7Qg3bVD7hh1eRze5bR1uYiuDA/k3Gof1s9BTzQZEJK8sNcNGFIzeWw==", - "requires": { - "body-parser": "^1.16.0", - "cors": "^2.8.1", - "express": "^4.14.0", - "request": "^2.79.0", - "xhr": "^2.3.3" - } - }, "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=" - }, - "setprototypeof": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.1.1.tgz", - "integrity": "sha512-JvdAWfbXeIGaZ9cILp38HntZSFSo3mWg6xGcJJsd+d4aRMOqauag1C63dJfDw7OaMYwEbHMOxEZ1lqVRYP2OAw==" + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz", + "integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=" }, "sha.js": { "version": "2.4.11", @@ -1940,14 +770,6 @@ "safe-buffer": "^5.0.1" } }, - "sha3": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.3.tgz", - "integrity": "sha512-sOWDZi8cDBRkLfWOw18wvJyNblXDHzwMGnRWut8zNNeIeLnmMRO17bjpLc7OzMuj1ASUgx2IyohzUCAl+Kx5vA==", - "requires": { - "nan": "2.13.2" - } - }, "simple-concat": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", @@ -1963,27 +785,6 @@ "simple-concat": "^1.0.0" } }, - "sshpk": { - "version": "1.16.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz", - "integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==", - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" - } - }, - "statuses": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", - "integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=" - }, "strict-uri-encode": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-1.1.0.tgz", @@ -2017,29 +818,6 @@ "function-bind": "^1.1.1" } }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "requires": { - "safe-buffer": "~5.1.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } - } - }, - "strip-dirs": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/strip-dirs/-/strip-dirs-2.1.0.tgz", - "integrity": "sha512-JOCxOeKLm2CAS73y/U4ZeZPTkE+gNVCzKt7Eox84Iej1LT/2pTWYpZKJuxwQpvX1LiZb1xokNR7RLfuBAa7T3g==", - "requires": { - "is-natural-number": "^4.0.1" - } - }, "strip-hex-prefix": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-hex-prefix/-/strip-hex-prefix-1.0.0.tgz", @@ -2048,166 +826,20 @@ "is-hex-prefixed": "1.0.0" } }, - "swarm-js": { - "version": "0.1.39", - "resolved": "https://registry.npmjs.org/swarm-js/-/swarm-js-0.1.39.tgz", - "integrity": "sha512-QLMqL2rzF6n5s50BptyD6Oi0R1aWlJC5Y17SRIVXRj6OR1DRIPM7nepvrxxkjA1zNzFz6mUOMjfeqeDaWB7OOg==", - "requires": { - "bluebird": "^3.5.0", - "buffer": "^5.0.5", - "decompress": "^4.0.0", - "eth-lib": "^0.1.26", - "fs-extra": "^4.0.2", - "got": "^7.1.0", - "mime-types": "^2.1.16", - "mkdirp-promise": "^5.0.1", - "mock-fs": "^4.1.0", - "setimmediate": "^1.0.5", - "tar": "^4.0.2", - "xhr-request-promise": "^0.1.2" - }, - "dependencies": { - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=" - }, - "got": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/got/-/got-7.1.0.tgz", - "integrity": "sha512-Y5WMo7xKKq1muPsxD+KmrR8DH5auG7fBdDVueZwETwV6VytKyU9OX/ddpq2/1hp1vIPvVb4T81dKQz3BivkNLw==", - "requires": { - "decompress-response": "^3.2.0", - "duplexer3": "^0.1.4", - "get-stream": "^3.0.0", - "is-plain-obj": "^1.1.0", - "is-retry-allowed": "^1.0.0", - "is-stream": "^1.0.0", - "isurl": "^1.0.0-alpha5", - "lowercase-keys": "^1.0.0", - "p-cancelable": "^0.3.0", - "p-timeout": "^1.1.1", - "safe-buffer": "^5.0.1", - "timed-out": "^4.0.0", - "url-parse-lax": "^1.0.0", - "url-to-options": "^1.0.1" - } - }, - "p-cancelable": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-0.3.0.tgz", - "integrity": "sha512-RVbZPLso8+jFeq1MfNvgXtCRED2raz/dKpacfTNxsx6pLEpEomM7gah6VeHSYV3+vo0OAi4MkArtQcWWXuQoyw==" - }, - "prepend-http": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", - "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=" - }, - "url-parse-lax": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", - "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", - "requires": { - "prepend-http": "^1.0.1" - } - } - } - }, - "tar": { - "version": "4.4.10", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.10.tgz", - "integrity": "sha512-g2SVs5QIxvo6OLp0GudTqEf05maawKUxXru104iaayWA09551tFCTI8f1Asb4lPfkBr91k07iL4c11XO3/b0tA==", - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.3.5", - "minizlib": "^1.2.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.3" - } - }, - "tar-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-1.6.2.tgz", - "integrity": "sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==", - "requires": { - "bl": "^1.0.0", - "buffer-alloc": "^1.2.0", - "end-of-stream": "^1.0.0", - "fs-constants": "^1.0.0", - "readable-stream": "^2.3.0", - "to-buffer": "^1.1.1", - "xtend": "^4.0.0" - } - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" - }, "timed-out": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=" }, - "to-buffer": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.1.1.tgz", - "integrity": "sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==" - }, - "to-readable-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", - "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==" - }, - "toidentifier": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz", - "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw==" - }, - "tough-cookie": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", - "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", - "requires": { - "psl": "^1.1.24", - "punycode": "^1.4.1" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=" - } - } - }, - "tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==" }, "type": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/type/-/type-1.0.3.tgz", - "integrity": "sha512-51IMtNfVcee8+9GJvj0spSuFcZHe9vSib6Xtgsny1Km9ugyz2mbS08I3rsUIRYgJohFRFU1160sgRodYz378Hg==" - }, - "type-is": { - "version": "1.6.18", - "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", - "integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==", - "requires": { - "media-typer": "0.3.0", - "mime-types": "~2.1.24" - } + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz", + "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==" }, "typedarray-to-buffer": { "version": "3.1.5", @@ -2217,49 +849,13 @@ "is-typedarray": "^1.0.0" } }, - "ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" - }, - "unbzip2-stream": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/unbzip2-stream/-/unbzip2-stream-1.3.3.tgz", - "integrity": "sha512-fUlAF7U9Ah1Q6EieQ4x4zLNejrRvDWUYmxXUpN3uziFYCHapjWFaCAnreY9bGgxzaMCFAPPpYNng57CypwJVhg==", - "requires": { - "buffer": "^5.2.1", - "through": "^2.3.8" - } - }, - "underscore": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz", - "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==" - }, - "universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" - }, - "unpipe": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", - "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" - }, - "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "url-parse": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.4.4.tgz", + "integrity": "sha512-/92DTTorg4JjktLNLe6GPS2/RvAd/RGr6LuktmWSMLEOa6rjnlrFXNgSbSmkNvCoL2T028A0a1JaJLzRMlFoHg==", "requires": { - "punycode": "^2.1.0" - } - }, - "url-parse-lax": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", - "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", - "requires": { - "prepend-http": "^2.0.0" + "querystringify": "^2.0.0", + "requires-port": "^1.0.0" } }, "url-set-query": { @@ -2267,192 +863,145 @@ "resolved": "https://registry.npmjs.org/url-set-query/-/url-set-query-1.0.0.tgz", "integrity": "sha1-AW6M/Xwg7gXK/neV6JK9BwL6ozk=" }, - "url-to-options": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/url-to-options/-/url-to-options-1.0.1.tgz", - "integrity": "sha1-FQWgOiiaSMvXpDTvuu7FBV9WM6k=" - }, "utf8": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", - "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "utils-merge": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", - "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.1.tgz", + "integrity": "sha1-LgHbAvfY0JRPdxBPFgnrDDBM92g=" }, "uuid": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", - "integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" - }, - "vary": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", - "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=" - }, - "verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=", - "requires": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" - } + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", + "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=" }, "web3": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3/-/web3-1.2.1.tgz", - "integrity": "sha512-nNMzeCK0agb5i/oTWNdQ1aGtwYfXzHottFP2Dz0oGIzavPMGSKyVlr8ibVb1yK5sJBjrWVnTdGaOC2zKDFuFRw==", - "requires": { - "web3-bzz": "1.2.1", - "web3-core": "1.2.1", - "web3-eth": "1.2.1", - "web3-eth-personal": "1.2.1", - "web3-net": "1.2.1", - "web3-shh": "1.2.1", - "web3-utils": "1.2.1" - } - }, - "web3-bzz": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.2.1.tgz", - "integrity": "sha512-LdOO44TuYbGIPfL4ilkuS89GQovxUpmLz6C1UC7VYVVRILeZS740FVB3j9V4P4FHUk1RenaDfKhcntqgVCHtjw==", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3/-/web3-2.0.0-alpha.1.tgz", + "integrity": "sha512-njwdP8MsziYYu9BGXvq9326xViWe6Q4/I/sq/AKOqfLWgLhAJ9xYkP8U6v0AclNE8Ow447dV3b9eK3sOLS1/WQ==", "requires": { - "got": "9.6.0", - "swarm-js": "0.1.39", - "underscore": "1.9.1" + "@babel/runtime": "^7.3.1", + "@types/node": "^12.6.1", + "web3-core": "2.0.0-alpha.1", + "web3-eth": "2.0.0-alpha.1", + "web3-eth-personal": "2.0.0-alpha.1", + "web3-net": "2.0.0-alpha.1", + "web3-providers": "2.0.0-alpha.1", + "web3-shh": "2.0.0-alpha.1", + "web3-utils": "2.0.0-alpha.1" } }, "web3-core": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.2.1.tgz", - "integrity": "sha512-5ODwIqgl8oIg/0+Ai4jsLxkKFWJYE0uLuE1yUKHNVCL4zL6n3rFjRMpKPokd6id6nJCNgeA64KdWQ4XfpnjdMg==", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-2.0.0-alpha.1.tgz", + "integrity": "sha512-7fBl1h9Z46q0n8ugjYWMZsBP1tLlt8Rp4dRDF11EUNFQo1ll60tHj9PdjQIcKqoTd9EKhjYeZUWIsLf7YuipqA==", "requires": { - "web3-core-helpers": "1.2.1", - "web3-core-method": "1.2.1", - "web3-core-requestmanager": "1.2.1", - "web3-utils": "1.2.1" + "@babel/runtime": "^7.3.1", + "@types/bn.js": "^4.11.4", + "@types/node": "^12.6.1", + "lodash": "^4.17.11", + "web3-core-method": "2.0.0-alpha.1", + "web3-providers": "2.0.0-alpha.1", + "web3-utils": "2.0.0-alpha.1" } }, "web3-core-helpers": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.2.1.tgz", - "integrity": "sha512-Gx3sTEajD5r96bJgfuW377PZVFmXIH4TdqDhgGwd2lZQCcMi+DA4TgxJNJGxn0R3aUVzyyE76j4LBrh412mXrw==", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-2.0.0-alpha.1.tgz", + "integrity": "sha512-YUDECwESRI2Bw3ijEaGGkYhEAyqQF17KFtul9Y6OZLtYx6W7bJCMKbSFigLl99F3zFLZ8E/dwzCizSrD+DuWIQ==", "requires": { - "underscore": "1.9.1", - "web3-eth-iban": "1.2.1", - "web3-utils": "1.2.1" + "@babel/runtime": "^7.3.1", + "lodash": "^4.17.11", + "web3-core": "2.0.0-alpha.1", + "web3-eth-iban": "2.0.0-alpha.1", + "web3-utils": "2.0.0-alpha.1" } }, "web3-core-method": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.2.1.tgz", - "integrity": "sha512-Ghg2WS23qi6Xj8Od3VCzaImLHseEA7/usvnOItluiIc5cKs00WYWsNy2YRStzU9a2+z8lwQywPYp0nTzR/QXdQ==", - "requires": { - "underscore": "1.9.1", - "web3-core-helpers": "1.2.1", - "web3-core-promievent": "1.2.1", - "web3-core-subscriptions": "1.2.1", - "web3-utils": "1.2.1" - } - }, - "web3-core-promievent": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.2.1.tgz", - "integrity": "sha512-IVUqgpIKoeOYblwpex4Hye6npM0aMR+kU49VP06secPeN0rHMyhGF0ZGveWBrGvf8WDPI7jhqPBFIC6Jf3Q3zw==", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-2.0.0-alpha.1.tgz", + "integrity": "sha512-RlKYn9spgKAbIU9IV5UCQBLAcblLf5O6LYCGacRk0Iyz2SE0bVMtd7CY1pcsIXegNFiT3CPk+XvcpOIehZBhVQ==", "requires": { - "any-promise": "1.3.0", - "eventemitter3": "3.1.2" - } - }, - "web3-core-requestmanager": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.2.1.tgz", - "integrity": "sha512-xfknTC69RfYmLKC+83Jz73IC3/sS2ZLhGtX33D4Q5nQ8yc39ElyAolxr9sJQS8kihOcM6u4J+8gyGMqsLcpIBg==", - "requires": { - "underscore": "1.9.1", - "web3-core-helpers": "1.2.1", - "web3-providers-http": "1.2.1", - "web3-providers-ipc": "1.2.1", - "web3-providers-ws": "1.2.1" + "@babel/runtime": "^7.3.1", + "eventemitter3": "3.1.0", + "lodash": "^4.17.11", + "rxjs": "^6.4.0", + "web3-core": "2.0.0-alpha.1", + "web3-core-helpers": "2.0.0-alpha.1", + "web3-core-subscriptions": "2.0.0-alpha.1", + "web3-utils": "2.0.0-alpha.1" } }, "web3-core-subscriptions": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.2.1.tgz", - "integrity": "sha512-nmOwe3NsB8V8UFsY1r+sW6KjdOS68h8nuh7NzlWxBQT/19QSUGiERRTaZXWu5BYvo1EoZRMxCKyCQpSSXLc08g==", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-2.0.0-alpha.1.tgz", + "integrity": "sha512-fOr5DCz1QjwBPf/ssJ49Q0LVi5PUOkHmJ1y+5aSSJZmcuAZ9h1FJp7ANqAI7p7ssXnm9RpCDMg5vGa8tyYyAXA==", "requires": { - "eventemitter3": "3.1.2", - "underscore": "1.9.1", - "web3-core-helpers": "1.2.1" + "@babel/runtime": "^7.3.1", + "eventemitter3": "^4.0.0", + "lodash": "^4.17.11" + }, + "dependencies": { + "eventemitter3": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.0.tgz", + "integrity": "sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg==" + } } }, "web3-eth": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.2.1.tgz", - "integrity": "sha512-/2xly4Yry5FW1i+uygPjhfvgUP/MS/Dk+PDqmzp5M88tS86A+j8BzKc23GrlA8sgGs0645cpZK/999LpEF5UdA==", - "requires": { - "underscore": "1.9.1", - "web3-core": "1.2.1", - "web3-core-helpers": "1.2.1", - "web3-core-method": "1.2.1", - "web3-core-subscriptions": "1.2.1", - "web3-eth-abi": "1.2.1", - "web3-eth-accounts": "1.2.1", - "web3-eth-contract": "1.2.1", - "web3-eth-ens": "1.2.1", - "web3-eth-iban": "1.2.1", - "web3-eth-personal": "1.2.1", - "web3-net": "1.2.1", - "web3-utils": "1.2.1" + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-2.0.0-alpha.1.tgz", + "integrity": "sha512-XJro1RPdhxKLYaOhUsTU5TuEPVdGyWbuPOTuqGUFZjyVnJ2dd6ETQIwmz9q7A6cIoYy9XZhni99mJ3ILLZzrMg==", + "requires": { + "@babel/runtime": "^7.3.1", + "ethereumjs-tx": "^1.3.7", + "rxjs": "^6.4.0", + "web3-core": "2.0.0-alpha.1", + "web3-core-helpers": "2.0.0-alpha.1", + "web3-core-method": "2.0.0-alpha.1", + "web3-core-subscriptions": "2.0.0-alpha.1", + "web3-eth-abi": "2.0.0-alpha.1", + "web3-eth-accounts": "2.0.0-alpha.1", + "web3-eth-contract": "2.0.0-alpha.1", + "web3-eth-ens": "2.0.0-alpha.1", + "web3-eth-iban": "2.0.0-alpha.1", + "web3-eth-personal": "2.0.0-alpha.1", + "web3-net": "2.0.0-alpha.1", + "web3-providers": "2.0.0-alpha.1", + "web3-utils": "2.0.0-alpha.1" } }, "web3-eth-abi": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.2.1.tgz", - "integrity": "sha512-jI/KhU2a/DQPZXHjo2GW0myEljzfiKOn+h1qxK1+Y9OQfTcBMxrQJyH5AP89O6l6NZ1QvNdq99ThAxBFoy5L+g==", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-2.0.0-alpha.1.tgz", + "integrity": "sha512-EcNgLm8dHqjGN5IjgAAPIGFgBowO2FKQbdLzk6Zc7WY5kpRA/EcJen4PzVZpH1THfqpIlmHAV2YimYUTIz6cDQ==", "requires": { - "ethers": "4.0.0-beta.3", - "underscore": "1.9.1", - "web3-utils": "1.2.1" + "@babel/runtime": "^7.3.1", + "ethers": "^4.0.27", + "lodash": "^4.17.11", + "web3-utils": "2.0.0-alpha.1" } }, "web3-eth-accounts": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.2.1.tgz", - "integrity": "sha512-26I4qq42STQ8IeKUyur3MdQ1NzrzCqPsmzqpux0j6X/XBD7EjZ+Cs0lhGNkSKH5dI3V8CJasnQ5T1mNKeWB7nQ==", - "requires": { - "any-promise": "1.3.0", - "crypto-browserify": "3.12.0", - "eth-lib": "0.2.7", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-2.0.0-alpha.1.tgz", + "integrity": "sha512-yvpF+PZFU3HP285lzq4QYglLny/1xJba+PbJmJ9NHepeZRrJj73jF172q3LlmpQh1CWjmWL8qlzdh/bwfdJIYA==", + "requires": { + "@babel/runtime": "^7.3.1", + "browserify-cipher": "^1.0.1", + "eth-lib": "0.2.8", + "lodash": "^4.17.11", + "pbkdf2": "^3.0.17", + "randombytes": "^2.1.0", "scryptsy": "2.1.0", "semver": "6.2.0", - "underscore": "1.9.1", "uuid": "3.3.2", - "web3-core": "1.2.1", - "web3-core-helpers": "1.2.1", - "web3-core-method": "1.2.1", - "web3-utils": "1.2.1" + "web3-core": "2.0.0-alpha.1", + "web3-core-helpers": "2.0.0-alpha.1", + "web3-core-method": "2.0.0-alpha.1", + "web3-providers": "2.0.0-alpha.1", + "web3-utils": "2.0.0-alpha.1" }, "dependencies": { - "eth-lib": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", - "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", - "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "xhr-request-promise": "^0.1.2" - } - }, "uuid": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", @@ -2461,130 +1010,136 @@ } }, "web3-eth-contract": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.2.1.tgz", - "integrity": "sha512-kYFESbQ3boC9bl2rYVghj7O8UKMiuKaiMkxvRH5cEDHil8V7MGEGZNH0slSdoyeftZVlaWSMqkRP/chfnKND0g==", - "requires": { - "underscore": "1.9.1", - "web3-core": "1.2.1", - "web3-core-helpers": "1.2.1", - "web3-core-method": "1.2.1", - "web3-core-promievent": "1.2.1", - "web3-core-subscriptions": "1.2.1", - "web3-eth-abi": "1.2.1", - "web3-utils": "1.2.1" + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-2.0.0-alpha.1.tgz", + "integrity": "sha512-V/rzm0c0LopreTuGDCEwIQZ8lXTFjHV2XrGmIXfmUycyWVQ/Ulct/Ct9m7kRA/R/cfkf1ocSkyN8vj9i8a7Qag==", + "requires": { + "@babel/runtime": "^7.3.1", + "@types/bn.js": "^4.11.4", + "lodash": "^4.17.11", + "web3-core": "2.0.0-alpha.1", + "web3-core-helpers": "2.0.0-alpha.1", + "web3-core-method": "2.0.0-alpha.1", + "web3-core-subscriptions": "2.0.0-alpha.1", + "web3-eth-abi": "2.0.0-alpha.1", + "web3-eth-accounts": "2.0.0-alpha.1", + "web3-providers": "2.0.0-alpha.1", + "web3-utils": "2.0.0-alpha.1" } }, "web3-eth-ens": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-1.2.1.tgz", - "integrity": "sha512-lhP1kFhqZr2nnbu3CGIFFrAnNxk2veXpOXBY48Tub37RtobDyHijHgrj+xTh+mFiPokyrapVjpFsbGa+Xzye4Q==", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-eth-ens/-/web3-eth-ens-2.0.0-alpha.1.tgz", + "integrity": "sha512-bf6o8yWxdkxb+AieUYRQe1n6R5UvInGkNZCDx2T955UrpLL5Xexgm/WBJVanRTn5//YK4o8Iudj9N3SgdfU0sA==", "requires": { + "@babel/runtime": "^7.3.1", "eth-ens-namehash": "2.0.8", - "underscore": "1.9.1", - "web3-core": "1.2.1", - "web3-core-helpers": "1.2.1", - "web3-core-promievent": "1.2.1", - "web3-eth-abi": "1.2.1", - "web3-eth-contract": "1.2.1", - "web3-utils": "1.2.1" + "lodash": "^4.17.11", + "web3-core": "2.0.0-alpha.1", + "web3-core-helpers": "2.0.0-alpha.1", + "web3-core-method": "2.0.0-alpha.1", + "web3-eth-abi": "2.0.0-alpha.1", + "web3-eth-accounts": "2.0.0-alpha.1", + "web3-eth-contract": "2.0.0-alpha.1", + "web3-net": "2.0.0-alpha.1", + "web3-providers": "2.0.0-alpha.1", + "web3-utils": "2.0.0-alpha.1" } }, "web3-eth-iban": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.2.1.tgz", - "integrity": "sha512-9gkr4QPl1jCU+wkgmZ8EwODVO3ovVj6d6JKMos52ggdT2YCmlfvFVF6wlGLwi0VvNa/p+0BjJzaqxnnG/JewjQ==", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-2.0.0-alpha.1.tgz", + "integrity": "sha512-I9oD+kjiF/RPYslndfr4UlhU/zdP67+LYG5dMx6zEM+KUmHdwQeMTp4w3NVZny7/pOtXA1w6dJJ2tL/OVfGkkw==", "requires": { + "@babel/runtime": "^7.3.1", "bn.js": "4.11.8", - "web3-utils": "1.2.1" + "web3-utils": "2.0.0-alpha.1" } }, "web3-eth-personal": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.2.1.tgz", - "integrity": "sha512-RNDVSiaSoY4aIp8+Hc7z+X72H7lMb3fmAChuSBADoEc7DsJrY/d0R5qQDK9g9t2BO8oxgLrLNyBP/9ub2Hc6Bg==", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-2.0.0-alpha.1.tgz", + "integrity": "sha512-IqBerCcfYSmuRpzXki/M/FKVu+lNVGP+RvjeNoE5l6Qy5W1m5X2AeI+P3ekN/HAwUhLNRVlzO6fSlNy0UaQtgg==", "requires": { - "web3-core": "1.2.1", - "web3-core-helpers": "1.2.1", - "web3-core-method": "1.2.1", - "web3-net": "1.2.1", - "web3-utils": "1.2.1" + "@babel/runtime": "^7.3.1", + "web3-core": "2.0.0-alpha.1", + "web3-core-helpers": "2.0.0-alpha.1", + "web3-core-method": "2.0.0-alpha.1", + "web3-eth-accounts": "2.0.0-alpha.1", + "web3-net": "2.0.0-alpha.1", + "web3-providers": "2.0.0-alpha.1", + "web3-utils": "2.0.0-alpha.1" } }, "web3-net": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.2.1.tgz", - "integrity": "sha512-Yt1Bs7WgnLESPe0rri/ZoPWzSy55ovioaP35w1KZydrNtQ5Yq4WcrAdhBzcOW7vAkIwrsLQsvA+hrOCy7mNauw==", - "requires": { - "web3-core": "1.2.1", - "web3-core-method": "1.2.1", - "web3-utils": "1.2.1" - } - }, - "web3-providers-http": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.2.1.tgz", - "integrity": "sha512-BDtVUVolT9b3CAzeGVA/np1hhn7RPUZ6YYGB/sYky+GjeO311Yoq8SRDUSezU92x8yImSC2B+SMReGhd1zL+bQ==", - "requires": { - "web3-core-helpers": "1.2.1", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-2.0.0-alpha.1.tgz", + "integrity": "sha512-hdqGElUjLSiY3KRsy3YhtugSSCI22UA2p99BtD10GtYmziTEaQGnx5g+T/TWomOHW4wSMNy/QIFsiGL8ZVF5Ig==", + "requires": { + "@babel/runtime": "^7.3.1", + "lodash": "^4.17.11", + "web3-core": "2.0.0-alpha.1", + "web3-core-helpers": "2.0.0-alpha.1", + "web3-core-method": "2.0.0-alpha.1", + "web3-providers": "2.0.0-alpha.1", + "web3-utils": "2.0.0-alpha.1" + } + }, + "web3-providers": { + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-providers/-/web3-providers-2.0.0-alpha.1.tgz", + "integrity": "sha512-X7hDkLKVN1U5aWeNQeErev494VSgt4gHJpHTgXn2rxrdJYUf7+6e6Al7yvRHlDxoTzhycX+j11HQC+CZlA+uhQ==", + "requires": { + "@babel/runtime": "^7.3.1", + "@types/node": "^10.12.18", + "eventemitter3": "3.1.0", + "lodash": "^4.17.11", + "url-parse": "1.4.4", + "web3-core": "2.0.0-alpha.1", + "web3-core-helpers": "2.0.0-alpha.1", + "web3-core-method": "2.0.0-alpha.1", + "web3-utils": "2.0.0-alpha.1", + "websocket": "github:web3-js/WebSocket-Node#polyfill/globalThis", "xhr2-cookies": "1.1.0" - } - }, - "web3-providers-ipc": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.2.1.tgz", - "integrity": "sha512-oPEuOCwxVx8L4CPD0TUdnlOUZwGBSRKScCz/Ws2YHdr9Ium+whm+0NLmOZjkjQp5wovQbyBzNa6zJz1noFRvFA==", - "requires": { - "oboe": "2.1.4", - "underscore": "1.9.1", - "web3-core-helpers": "1.2.1" - } - }, - "web3-providers-ws": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.2.1.tgz", - "integrity": "sha512-oqsQXzu+ejJACVHy864WwIyw+oB21nw/pI65/sD95Zi98+/HQzFfNcIFneF1NC4bVF3VNX4YHTNq2I2o97LAiA==", - "requires": { - "underscore": "1.9.1", - "web3-core-helpers": "1.2.1", - "websocket": "github:web3-js/WebSocket-Node#polyfill/globalThis" + }, + "dependencies": { + "@types/node": { + "version": "10.14.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.14.18.tgz", + "integrity": "sha512-ryO3Q3++yZC/+b8j8BdKd/dn9JlzlHBPdm80656xwYUdmPkpTGTjkAdt6BByiNupGPE8w0FhBgvYy/fX9hRNGQ==" + } } }, "web3-shh": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.2.1.tgz", - "integrity": "sha512-/3Cl04nza5kuFn25bV3FJWa0s3Vafr5BlT933h26xovQ6HIIz61LmvNQlvX1AhFL+SNJOTcQmK1SM59vcyC8bA==", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-2.0.0-alpha.1.tgz", + "integrity": "sha512-Be6nizwB9ZQ/oCy1smPE30Y6rTDxjV+zmW+89kk1e9B6nLuTQwE/5DoHUU5+7AzfouKZcMI2QMH3Kf6M8BpalQ==", "requires": { - "web3-core": "1.2.1", - "web3-core-method": "1.2.1", - "web3-core-subscriptions": "1.2.1", - "web3-net": "1.2.1" + "@babel/runtime": "^7.3.1", + "web3-core": "2.0.0-alpha.1", + "web3-core-helpers": "2.0.0-alpha.1", + "web3-core-method": "2.0.0-alpha.1", + "web3-core-subscriptions": "2.0.0-alpha.1", + "web3-net": "2.0.0-alpha.1", + "web3-providers": "2.0.0-alpha.1", + "web3-utils": "2.0.0-alpha.1" } }, "web3-utils": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.2.1.tgz", - "integrity": "sha512-Mrcn3l58L+yCKz3zBryM6JZpNruWuT0OCbag8w+reeNROSGVlXzUQkU+gtAwc9JCZ7tKUyg67+2YUGqUjVcyBA==", + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-2.0.0-alpha.1.tgz", + "integrity": "sha512-xZY9rPC/5S2utQV26x2oeWlBjs1cGwO+AAwv0smK2zjNi6UeTZjG9aZ/RJZJpToIapKhdtmQI6yZ8/ZQNDRGGg==", "requires": { + "@babel/runtime": "^7.3.1", + "@types/bn.js": "^4.11.4", + "@types/node": "^12.6.1", "bn.js": "4.11.8", - "eth-lib": "0.2.7", - "ethjs-unit": "0.1.6", + "eth-lib": "0.2.8", + "ethjs-unit": "^0.1.6", + "lodash": "^4.17.11", "number-to-bn": "1.7.0", - "randomhex": "0.1.5", - "underscore": "1.9.1", - "utf8": "3.0.0" - }, - "dependencies": { - "eth-lib": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.7.tgz", - "integrity": "sha1-L5Pxex4jrsN1nNSj/iDBKGo/wco=", - "requires": { - "bn.js": "^4.11.6", - "elliptic": "^6.4.0", - "xhr-request-promise": "^0.1.2" - } - } + "randombytes": "^2.1.0", + "utf8": "2.1.1" } }, "websocket": { @@ -2596,13 +1151,6 @@ "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==" - } } }, "wrappy": { @@ -2610,23 +1158,6 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, - "ws": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", - "requires": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - } - } - }, "xhr": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/xhr/-/xhr-2.5.0.tgz", @@ -2682,20 +1213,6 @@ "version": "0.0.6", "resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz", "integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=" - }, - "yallist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", - "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==" - }, - "yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", - "requires": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" - } } } } diff --git a/projects/gochain-ng-web3/package.json b/projects/gochain-ng-web3/package.json index 3087f81..5195736 100644 --- a/projects/gochain-ng-web3/package.json +++ b/projects/gochain-ng-web3/package.json @@ -2,10 +2,10 @@ "name": "gochain-ng-web3", "version": "0.0.1", "peerDependencies": { - "@angular/common": "^8.2.0", - "@angular/core": "^8.2.0" + "@angular/common": "^8.2.8", + "@angular/core": "^8.2.8" }, "dependencies": { - "web3": "^1.2.1" + "web3": "^2.0.0-alpha.1" } } diff --git a/projects/gochain-ng-web3/src/lib/gochain-ng-web3.component.spec.ts b/projects/gochain-ng-web3/src/lib/gochain-ng-web3.component.spec.ts deleted file mode 100644 index 222dd60..0000000 --- a/projects/gochain-ng-web3/src/lib/gochain-ng-web3.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { GochainNgWeb3Component } from './gochain-ng-web3.component'; - -describe('GochainNgWeb3Component', () => { - let component: GochainNgWeb3Component; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ GochainNgWeb3Component ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(GochainNgWeb3Component); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/projects/gochain-ng-web3/src/lib/gochain-ng-web3.component.ts b/projects/gochain-ng-web3/src/lib/gochain-ng-web3.component.ts deleted file mode 100644 index 942246e..0000000 --- a/projects/gochain-ng-web3/src/lib/gochain-ng-web3.component.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'go-gochain-ng-web3', - template: ` -

- gochain-ng-web3 works! -

- `, - styles: [] -}) -export class GochainNgWeb3Component implements OnInit { - - constructor() { } - - ngOnInit() { - } - -} diff --git a/projects/gochain-ng-web3/src/lib/gochain-ng-web3.module.ts b/projects/gochain-ng-web3/src/lib/gochain-ng-web3.module.ts deleted file mode 100644 index d55cda2..0000000 --- a/projects/gochain-ng-web3/src/lib/gochain-ng-web3.module.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { NgModule } from '@angular/core'; -import { GochainNgWeb3Component } from './gochain-ng-web3.component'; - - -@NgModule({ - declarations: [GochainNgWeb3Component], - imports: [ - ], - exports: [GochainNgWeb3Component] -}) -export class GochainNgWeb3Module { } diff --git a/projects/gochain-ng-web3/src/lib/gochain-ng-web3.service.ts b/projects/gochain-ng-web3/src/lib/gochain-ng-web3.service.ts index 47fb2bb..73fab4b 100644 --- a/projects/gochain-ng-web3/src/lib/gochain-ng-web3.service.ts +++ b/projects/gochain-ng-web3/src/lib/gochain-ng-web3.service.ts @@ -1,9 +1,188 @@ -import { Injectable } from '@angular/core'; +/*CORE*/ +import {Injectable} from '@angular/core'; +import {BehaviorSubject, Observable, throwError} from 'rxjs'; +import {fromPromise} from 'rxjs/internal-compatibility'; +import {catchError, map, tap} from 'rxjs/operators'; +/*WEB3*/ +import Web3 from 'web3'; +import {Account} from 'web3-eth-accounts'; +import {SignedTransaction, TransactionReceipt} from 'web3-core'; + +class InitConfig { + rpcUrl: string; +} + +interface IGochainWeb3Service { + initialize(config: InitConfig); + + initializePlugin(); + + activatePlugin(); + + getPluginAccountAddress(); + + createAccount(); + + /*openAccount(privateKey: string);*/ + + closeAccount(); + + /*getBalance();*/ +} @Injectable({ providedIn: 'root' }) -export class GochainNgWeb3Service { +export class GochainNgWeb3Service implements IGochainWeb3Service { + private _metamaskInstalled: boolean; + private _metamaskConfigured: boolean; + private _metamaskActivated: boolean; + private _config: InitConfig; + private _gochainNetId: number; + + set metamaskInstalled(value: boolean) { + this._metamaskInstalled = value; + this.metamaskInstalled$.next(value); + } + + set metamaskConfigured(value: boolean) { + this._metamaskConfigured = value; + this.metamaskConfigured$.next(value); + } + + set metamaskActivated(value: boolean) { + this._metamaskActivated = value; + this.metamaskActivated$.next(value); + } + + metamaskInstalled$: BehaviorSubject = new BehaviorSubject(null); + metamaskConfigured$: BehaviorSubject = new BehaviorSubject(null); + metamaskActivated$: BehaviorSubject = new BehaviorSubject(null); + ready$: BehaviorSubject = new BehaviorSubject(null); + accountBalance: string; + gochainWeb3: Web3; + pluginWeb3: Web3; + accountAddress: string; + account: Account; + + get web3(): Web3 { + if (this._metamaskConfigured && this._metamaskInstalled) { + return this.pluginWeb3; + } + return this.gochainWeb3; + } + + constructor() { + } + + initialize(config: InitConfig): Observable { + this._config = config; + if (!config.rpcUrl) { + return throwError('rpc url hasn\'t been provided'); + } + this.gochainWeb3 = new Web3(new Web3.providers.HttpProvider(config.rpcUrl), null, {transactionConfirmationBlocks: 1}); + + return fromPromise(this.gochainWeb3.eth.net.getId()).pipe( + catchError((e: Error) => { + return throwError('Can\'t get GoChain network id'); + }), + map(v => !!v), + ); + } + + initializePlugin(): Observable { + if (!this.gochainWeb3) { + return throwError('initialize first'); + } + if (!this._gochainNetId) { + return throwError('gochain network id is not provided'); + } + + this.pluginWeb3 = new Web3(Web3.givenProvider, null, {transactionConfirmationBlocks: 1}); + + if (!this.pluginWeb3.currentProvider) { + this.metamaskInstalled = false; + this.metamaskConfigured = false; + return throwError('metamask is not installed'); + } + + return fromPromise(this.pluginWeb3.eth.net.getId()).pipe( + catchError((e: Error) => { + this.metamaskInstalled = true; + this.metamaskConfigured = false; + return throwError('Metamask installed but not configured properly - can\'t get network id from Metamask'); + }), + map((metamaskNetID: number) => { + if (this._gochainNetId !== metamaskNetID) { + this.metamaskInstalled = true; + this.metamaskConfigured = false; + return throwError(`Metamask installed but misconfigured - network ID mismatch (must use GoChain ${this._gochainNetId} - e.g. by pointing to ${this._config.rpcUrl})`); + } + this.metamaskInstalled = true; + this.metamaskConfigured = true; + this.getPluginAccountAddress(); + return true; + }), + ); + } + + activatePlugin(): Observable { + return fromPromise((window as any).ethereum.enable()).pipe( + catchError((e) => { + this.metamaskActivated = false; + return throwError('Access haven\'t been granted'); + }), + tap(() => { + this.metamaskActivated = true; + }), + ); + } + + getPluginAccountAddress(): void { + fromPromise(this.pluginWeb3.eth.getAccounts()).subscribe((accounts: string[]) => { + this.accountAddress = accounts[0]; + }); + } + + createAccount() { + return !!this.web3 ? this.web3.eth.accounts.create() : null; + } + + /*protected _openAccount(privateKey: string) { + if (privateKey.length === 64 && privateKey.indexOf('0x') !== 0) { + privateKey = '0x' + privateKey; + } + if (privateKey.length !== 66) { + throw Error('Given private key is not valid'); + } + try { + this.account = this.gochainWeb3.eth.accounts.privateKeyToAccount(privateKey); + } catch (e) { + throw e; + } + return this.account; + }*/ + + closeAccount() { + this.account = null; + this.accountAddress = null; + this.accountBalance = null; + } + + /*getBalance() { + return fromPromise(this.gochainWeb3.eth.getBalance(this.account.address)).pipe( + map((balance: string) => { + this.accountBalance = this.gochainWeb3.utils.fromWei(balance, 'ether').toString(); + return this.accountBalance; + }), + ); + }*/ + + sendSignedTx(signed: SignedTransaction): Observable { + return fromPromise(this.gochainWeb3.eth.sendSignedTransaction(signed.rawTransaction)); + } - constructor() { } + isAddress(address: string) { + return this.gochainWeb3.utils.isAddress(address); + } } diff --git a/projects/gochain-ng-web3/src/public-api.ts b/projects/gochain-ng-web3/src/public-api.ts index 7e93825..448133a 100644 --- a/projects/gochain-ng-web3/src/public-api.ts +++ b/projects/gochain-ng-web3/src/public-api.ts @@ -3,7 +3,3 @@ */ export * from './lib/gochain-ng-web3.service'; -export * from './lib/gochain-ng-web3.component'; -export * from './lib/gochain-ng-web3.module'; - -// export * from './lib/gochain-ng-web3/foo.component'; \ No newline at end of file diff --git a/projects/gochain-ng-web3/tslint.json b/projects/gochain-ng-web3/tslint.json index a5a5785..379e1d4 100644 --- a/projects/gochain-ng-web3/tslint.json +++ b/projects/gochain-ng-web3/tslint.json @@ -12,6 +12,7 @@ "element", "go", "kebab-case" - ] + ], + "variable-name": false } }