├── .editorconfig ├── .gitignore ├── .travis.yml ├── .github ├── ISSUE_TEMPLATE.md ├── PULL_REQUEST_TEMPLATE.md └── CONTRIBUTING.md ├── docs ├── README.md ├── developer-guide.md └── user-guide.md ├── LICENSE ├── internals └── webpack │ └── webpack.config.js ├── .gitattributes ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── src ├── index.js └── tests │ └── test.index.js ├── package.json ├── README.md └── dist └── ethjs-query.min.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | insert_final_newline = false 6 | indent_style = space 7 | indent_size = 2 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Don't check auto-generated stuff into git 2 | node_modules 3 | coverage 4 | lib 5 | 6 | # Cruft 7 | .DS_Store 8 | npm-debug.log 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: true 2 | language: node_js 3 | node_js: 4 | - "8" 5 | compiler: 6 | - gcc 7 | - clang 8 | install: 9 | env: 10 | - CXX=g++-4.8 11 | addons: 12 | apt: 13 | sources: 14 | - ubuntu-toolchain-r-test 15 | packages: 16 | - gcc-4.8 17 | - g++-4.8 18 | - clang 19 | after_success: npm run coveralls 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # ethjs-query 2 | 3 | Before opening a new issue, please take a moment to review our [**community guidelines**](https://github.com/ethjs/ethjs-query/blob/master/.github/CONTRIBUTING.md) to make the contribution process easy and effective for everyone involved. 4 | 5 | **Before opening a new issue, you may find an answer in already closed issues**: 6 | https://github.com/ethjs/ethjs-query/issues?q=is%3Aissue+is%3Aclosed 7 | 8 | ## Issue Type 9 | 10 | - [ ] Bug (https://github.com/ethjs/ethjs-query/blob/master/.github/CONTRIBUTING.md#bug-reports) 11 | - [ ] Feature (https://github.com/ethjs/ethjs-query/blob/master/.github/CONTRIBUTING.md#feature-requests) 12 | 13 | ## Description 14 | 15 | (Add images if possible) 16 | 17 | ## Steps to reproduce 18 | 19 | (Add link to a demo on https://jsfiddle.net or similar if possible) 20 | 21 | # Versions 22 | 23 | - Node/NPM: 24 | - Browser: 25 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # Documentation 2 | 3 | ## Table of Contents 4 | 5 | - [General](general) 6 | - [**Developer Guide**](developer-guide.md) 7 | - [**User Guide**](user-guide.md) 8 | 9 | ## Overview 10 | 11 | ### Structure 12 | 13 | The [`src/`](../../../tree/master/src) directory contains your entire application code, including JavaScript, and tests. 14 | 15 | The rest of the folders and files only exist to make your life easier, and 16 | should not need to be touched. 17 | 18 | For more in-depth structure, see the developer-guide.md. 19 | 20 | *(If they do have to be changed, please [submit an issue](https://github.com/ethjs/ethjs-query/issues)!)* 21 | 22 | ### Testing 23 | 24 | For a thorough explanation of the testing procedure, see the 25 | [testing documentation](./developer-guide/README.md)! 26 | 27 | #### Unit testing 28 | 29 | Unit tests live in `src/tests/` directories right next to the components being tested 30 | and are run with `npm test`. 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2016 Nick Dodson. nickdodson.com 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## ethjs-query 2 | 3 | Thank you for contributing! Please take a moment to review our [**contributing guidelines**](https://github.com/ethjs/ethjs-query/blob/master/.github/CONTRIBUTING.md) 4 | to make the process easy and effective for everyone involved. 5 | 6 | **Please open an issue** before embarking on any significant pull request, especially those that 7 | add a new library or change existing tests, otherwise you risk spending a lot of time working 8 | on something that might not end up being merged into the project. 9 | 10 | Before opening a pull request, please ensure: 11 | 12 | - [ ] You have followed our [**contributing guidelines**](https://github.com/ethjs/ethjs-query/blob/master/.github/CONTRIBUTING.md) 13 | - [ ] Pull request has tests (we are going for 100% coverage!) 14 | - [ ] Code is well-commented, linted and follows project conventions 15 | - [ ] Documentation is updated (if necessary) 16 | - [ ] Internal code generators and templates are updated (if necessary) 17 | - [ ] Description explains the issue/use-case resolved and auto-closes related issues 18 | 19 | Be kind to code reviewers, please try to keep pull requests as small and focused as possible :) 20 | 21 | **IMPORTANT**: By submitting a patch, you agree to allow the project 22 | owners to license your work under the terms of the [MIT License](https://github.com/ethjs/ethjs-query/blob/master/LICENSE.md). 23 | -------------------------------------------------------------------------------- /internals/webpack/webpack.config.js: -------------------------------------------------------------------------------- 1 | var webpack = require('webpack'); // eslint-disable-line 2 | 3 | var env = process.env.NODE_ENV; // eslint-disable-line 4 | var filename = 'ethjs-query'; // eslint-disable-line 5 | var library = 'Eth'; // eslint-disable-line 6 | var config = { // eslint-disable-line 7 | module: { 8 | loaders: [ 9 | { 10 | test: /\.js$/, 11 | loaders: ['babel-loader'], 12 | include: /src|node_modules\/json-rpc-random-id/, 13 | }, 14 | { 15 | test: /\.json$/, 16 | loader: 'json', 17 | }, 18 | ], 19 | }, 20 | devtool: 'cheap-module-source-map', 21 | output: { 22 | path: 'dist', 23 | filename: filename + '.js', // eslint-disable-line 24 | library: library, // eslint-disable-line 25 | libraryTarget: 'umd', 26 | umdNamedDefine: true, 27 | }, 28 | plugins: [ 29 | new webpack.BannerPlugin({ banner: ' /* eslint-disable */ ', raw: true, entryOnly: true }), 30 | new webpack.optimize.OccurrenceOrderPlugin(), 31 | new webpack.DefinePlugin({ 32 | 'process.env.NODE_ENV': JSON.stringify(env), 33 | }), 34 | ], 35 | }; 36 | 37 | if (env === 'production') { 38 | config.output.filename = filename + '.min.js'; // eslint-disable-line 39 | config.plugins 40 | .push(new webpack.optimize.UglifyJsPlugin({ 41 | compressor: { 42 | pure_getters: true, 43 | unsafe: true, 44 | unsafe_comps: true, 45 | warnings: false, 46 | screw_ie8: false, 47 | }, 48 | mangle: { 49 | screw_ie8: false, 50 | }, 51 | output: { 52 | screw_ie8: false, 53 | }, 54 | })); 55 | config.plugins.push(new webpack.optimize.DedupePlugin()); 56 | } 57 | 58 | module.exports = config; 59 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # From https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes 2 | 3 | # Handle line endings automatically for files detected as text 4 | # and leave all files detected as binary untouched. 5 | * text=auto 6 | 7 | # 8 | # The above will handle all files NOT found below 9 | # 10 | 11 | # 12 | ## These files are text and should be normalized (Convert crlf => lf) 13 | # 14 | 15 | # source code 16 | *.php text 17 | *.css text 18 | *.sass text 19 | *.scss text 20 | *.less text 21 | *.styl text 22 | *.js text eol=lf 23 | *.coffee text 24 | *.json text 25 | *.htm text 26 | *.html text 27 | *.xml text 28 | *.svg text 29 | *.txt text 30 | *.ini text 31 | *.inc text 32 | *.pl text 33 | *.rb text 34 | *.py text 35 | *.scm text 36 | *.sql text 37 | *.sh text 38 | *.bat text 39 | 40 | # templates 41 | *.ejs text 42 | *.hbt text 43 | *.jade text 44 | *.haml text 45 | *.hbs text 46 | *.dot text 47 | *.tmpl text 48 | *.phtml text 49 | 50 | # server config 51 | .htaccess text 52 | 53 | # git config 54 | .gitattributes text 55 | .gitignore text 56 | .gitconfig text 57 | 58 | # code analysis config 59 | .jshintrc text 60 | .jscsrc text 61 | .jshintignore text 62 | .csslintrc text 63 | 64 | # misc config 65 | *.yaml text 66 | *.yml text 67 | .editorconfig text 68 | 69 | # build config 70 | *.npmignore text 71 | *.bowerrc text 72 | 73 | # Heroku 74 | Procfile text 75 | .slugignore text 76 | 77 | # Documentation 78 | *.md text 79 | LICENSE text 80 | AUTHORS text 81 | 82 | 83 | # 84 | ## These files are binary and should be left untouched 85 | # 86 | 87 | # (binary is a macro for -text -diff) 88 | *.png binary 89 | *.jpg binary 90 | *.jpeg binary 91 | *.gif binary 92 | *.ico binary 93 | *.mov binary 94 | *.mp4 binary 95 | *.mp3 binary 96 | *.flv binary 97 | *.fla binary 98 | *.swf binary 99 | *.gz binary 100 | *.zip binary 101 | *.7z binary 102 | *.ttf binary 103 | *.eot binary 104 | *.woff binary 105 | *.pyc binary 106 | *.pdf binary 107 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 0.3.5 -- new eth filter ID changes 2 | 3 | 1. Adds padded quantities 4 | 2. Fixed problem where number ID 1 for filter ID encodes to 0x1, when it should be 0x01 (with padding) 5 | 3. Methods affected: `eth.getFilterChanges` `eth.uninstallFilter` `eth.getFilterLogs` 6 | 7 | # 0.3.4 -- added new ethjs-format 8 | 9 | 1. Unhandled promise rejection fixed, and is no longer being swolloed. 10 | 2. ethjs-rpc bump to 0.1.9 11 | 12 | # 0.2.6 -- added new ethjs-format 13 | 14 | 1. no longer padds quantity hex values, as per standard. 15 | 16 | # 0.2.4 -- personal sign and ecrecover 17 | 18 | # 0.2.3 -- package updates 19 | 20 | 1. Update ethjs-rpc, handle 405 errors better 21 | 22 | # 0.2.1 -- handle non RPC errors better 23 | 24 | 1. Handle non rpc errors better 25 | 26 | # 0.2.0 -- handle 500 errors better 27 | 28 | 1. Handles 500/404/303 errors 29 | 30 | # 0.1.8 -- bn formatting update 31 | 32 | 1. Bignumber formatting update 33 | 34 | # 0.1.7 -- Better RPC error handling 35 | 36 | 1. Better RPC error handling 37 | 38 | # 0.1.6 -- Strinigy RPC error 39 | 40 | 1. Added JSON.strinify for RPC error handling 41 | 42 | # 0.1.5 -- format update 43 | 44 | 1. Tigher formatting enforcement 45 | 2. Small schema update 46 | 47 | # 0.1.4 -- less dependencies 48 | 49 | 1. Better formatting 50 | 2. Less dependencies 51 | 3. ID generation done in house 52 | 4. 25kb less file size 53 | 5. More docs 54 | 55 | # 0.1.2 -- config fixes 56 | 57 | 1. webpack config updates 58 | 2. build config updates 59 | 60 | # 0.1.1 -- new packages 61 | 62 | 1. new ethjs-format 63 | 2. more docs 64 | 65 | # 0.0.5 -- refactor 66 | 67 | 1. code cleanup 68 | 2. more coverage 69 | 3. better error handling 70 | 4. less dependencies 71 | 72 | # 0.0.4 -- promises, louder errors, more tests 73 | 74 | 1. added promises 75 | 2. louder errors 76 | 3. more test coverage 77 | 78 | # 0.0.3 -- options with debug logging and other features 79 | 80 | 1. added low level complete logging `new Eth(provider, { debug: false, logger: console, jsonSpace: 0 })` 81 | 2. more tests 82 | 83 | # 0.0.2 -- handle eth_getFilterChanges during Block and Pending Tx filter 84 | 85 | 1. handle getFilterChanges during BlockFilter and PendingTxFilter. 86 | 87 | # 0.0.1 -- ethjs-query 88 | 89 | 1. Basic testing 90 | 2. Basic docs 91 | 3. License 92 | 4. linting 93 | 5. basic exports 94 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Code of Conduct 2 | 3 | As contributors and maintainers of this project, and in the interest of 4 | fostering an open and welcoming community, we pledge to respect all people who 5 | contribute through reporting issues, posting feature requests, updating 6 | documentation, submitting pull requests or patches, and other activities. 7 | 8 | We are committed to making participation in this project a harassment-free 9 | experience for everyone, regardless of level of experience, gender, gender 10 | identity and expression, sexual orientation, disability, personal appearance, 11 | body size, race, ethnicity, age, religion, or nationality. 12 | 13 | Examples of unacceptable behavior by participants include: 14 | 15 | * The use of sexualized language or imagery 16 | * Personal attacks 17 | * Trolling or insulting/derogatory comments 18 | * Public or private harassment 19 | * Publishing other's private information, such as physical or electronic 20 | addresses, without explicit permission 21 | * Other unethical or unprofessional conduct 22 | 23 | Project maintainers have the right and responsibility to remove, edit, or 24 | reject comments, commits, code, wiki edits, issues, and other contributions 25 | that are not aligned to this Code of Conduct, or to ban temporarily or 26 | permanently any contributor for other behaviors that they deem inappropriate, 27 | threatening, offensive, or harmful. 28 | 29 | By adopting this Code of Conduct, project maintainers commit themselves to 30 | fairly and consistently applying these principles to every aspect of managing 31 | this project. Project maintainers who do not follow or enforce the Code of 32 | Conduct may be permanently removed from the project team. 33 | 34 | This Code of Conduct applies both within project spaces and in public spaces 35 | when an individual is representing the project or its community. 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 38 | reported by contacting the project maintainer at nick.dodson@consensys.net. All 39 | complaints will be reviewed and investigated and will result in a response that 40 | is deemed necessary and appropriate to the circumstances. Maintainers are 41 | obligated to maintain confidentiality with regard to the reporter of an 42 | incident. 43 | 44 | 45 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 46 | version 1.3.0, available at 47 | [http://contributor-covenant.org/version/1/3/0/][version] 48 | 49 | [homepage]: http://contributor-covenant.org 50 | [version]: http://contributor-covenant.org/version/1/3/0/ 51 | -------------------------------------------------------------------------------- /docs/developer-guide.md: -------------------------------------------------------------------------------- 1 | # Developer Guide 2 | 3 | All information regarding contributing to and progressing `ethjs-query` module can be found in this document. 4 | 5 | ## Install 6 | 7 | ``` 8 | npm install --save ethjs-query 9 | ``` 10 | 11 | ## Install from Source 12 | 13 | ``` 14 | git clone http://github.com/ethjs/ethjs-query 15 | npm install 16 | ``` 17 | 18 | ## Test 19 | 20 | ``` 21 | npm test 22 | ``` 23 | 24 | ## Build 25 | 26 | ``` 27 | npm run build 28 | ``` 29 | 30 | ## Linting 31 | 32 | ``` 33 | npm run lint 34 | ``` 35 | 36 | ## Travis-ci and Coveralls Testing 37 | 38 | Note, this will generate a `coveralls` report locally. 39 | 40 | ``` 41 | npm run test-travis 42 | ``` 43 | 44 | You can find the coveralls report and view the percentages and stats, by going to the [index.html](coverage/lcov-report/index.html) file generated after running the `test-travis` script. Open this in Chrome to see the generated report. Travis will run mocha as usual, but collect information about the testing coverage. This report will be sent by TravisCI during the automated build process. 45 | 46 | ## Build Staging 47 | 48 | The build staging for this module is as follows: 49 | 50 | 1. Cleanup 51 | 2. Linting 52 | 3. Testing 53 | 4. Babel processing (output to lib) 54 | 5. Webpack (output to dist) 55 | 6. Webpack production (output to dist) 56 | 7. Retest lib folder for babel processing solidity 57 | 8. Report build stats 58 | 59 | ## Folder Structure 60 | 61 | All module source code is found in the `src` directory. All module helper scripts can be found in the `scripts` folder. These will not need to be touched, and are purely configuration for this repository. 62 | 63 | ``` 64 | ./ethjs-query 65 | ./.github 66 | ./dist 67 | ./lib 68 | ./tests 69 | ./internals 70 | ./webpack 71 | ./coverage 72 | ./docs 73 | ./src 74 | ./tests 75 | ``` 76 | 77 | Note, the `./lib` dir is generated from the babel build staging. `./coverage` is generated from the `npm run test-travis` script. All internals and helper scripts (i.e. `webpack`) are in `./internals`. All distribution builds are in `./dist` (usually a minified and unminified production build of the package). 78 | 79 | ## NPM Practice 80 | 81 | Across all `ethjs-` repos, we enforce version hardening (i.e. "0.0.3" not "^0.0.3"). We want to reduce potential hazardous install changes from dependancies as much as possible to ensure package preformace, testing, security and design. Please make sure all your commits and PR's are version hardend if you are installing or removing new packages. 82 | 83 | After build staging it is the `lib` folder which actually gets published to NPM. This allows for easy inclusion into other modules which may not use babel transpiling or which may not support es2015+. 84 | 85 | ## NPM/Node Version Requirements 86 | 87 | `ethjs` requires you have: 88 | - `nodejs` -v 6.5.0+ 89 | - `npm` -v 3.0+ 90 | 91 | This is a requirement to run, test, lint and build this module. 92 | 93 | ## Webpack 94 | 95 | `ethjs` uses webpack across all its browser focused repos. Webpack is used to package down project files into distribution builds for the browser. You can see the builds it produces by going to the [dist](dist) folder. 96 | 97 | Read more about webpack here: 98 | https://github.com/webpack/docs 99 | 100 | ## Changelog 101 | 102 | All relevant changes are notated in the `CHANGELOG.md` file, moniter this file for changes to this repository. 103 | 104 | ## Travis-ci and Coveralls Practice 105 | 106 | Across all `ethjs-` repos, we enforce mandatory travis-ci and coveralls testing. We never `commit to master`. As a general policy, Coveralls.io results must always be above 95% for any `ethjs-` PR or commit. We want to ensure complete coverage across the board. 107 | 108 | ## Contributing 109 | 110 | Please help better the ecosystem by submitting issues and pull requests. We need all the help we can get to build the absolute best linting standards and utilities. We follow the AirBNB linting standard. Please read more about contributing to `ethjs-query` in the `.github/CONTRIBUTING.md`. 111 | 112 | ## Licence 113 | 114 | This project is licensed under the MIT license, Copyright (c) 2016 Nick Dodson. For more information see LICENSE. 115 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | const format = require('ethjs-format'); 2 | const EthRPC = require('ethjs-rpc'); 3 | const promiseToCallback = require('promise-to-callback'); 4 | 5 | module.exports = Eth; 6 | 7 | function Eth(provider, options) { 8 | const self = this; 9 | const optionsObject = options || {}; 10 | 11 | if (!(this instanceof Eth)) { throw new Error('[ethjs-query] the Eth object requires the "new" flag in order to function normally (i.e. `const eth = new Eth(provider);`).'); } 12 | if (typeof provider !== 'object') { throw new Error(`[ethjs-query] the Eth object requires that the first input 'provider' must be an object, got '${typeof provider}' (i.e. 'const eth = new Eth(provider);')`); } 13 | 14 | self.options = Object.assign({ 15 | debug: optionsObject.debug || false, 16 | logger: optionsObject.logger || console, 17 | jsonSpace: optionsObject.jsonSpace || 0, 18 | }); 19 | self.rpc = new EthRPC(provider); 20 | self.setProvider = self.rpc.setProvider; 21 | } 22 | 23 | Eth.prototype.log = function log(message) { 24 | const self = this; 25 | if (self.options.debug) self.options.logger.log(`[ethjs-query log] ${message}`); 26 | }; 27 | 28 | Object.keys(format.schema.methods).forEach((rpcMethodName) => { 29 | Object.defineProperty(Eth.prototype, rpcMethodName.replace('eth_', ''), { 30 | enumerable: true, 31 | value: generateFnFor(rpcMethodName, format.schema.methods[rpcMethodName]), 32 | }); 33 | }); 34 | 35 | function generateFnFor(rpcMethodName, methodObject) { 36 | return function outputMethod() { 37 | let callback = null; // eslint-disable-line 38 | let inputs = null; // eslint-disable-line 39 | let inputError = null; // eslint-disable-line 40 | const self = this; 41 | const args = [].slice.call(arguments); // eslint-disable-line 42 | const protoMethodName = rpcMethodName.replace('eth_', ''); // eslint-disable-line 43 | 44 | if (args.length > 0 && typeof args[args.length - 1] === 'function') { 45 | callback = args.pop(); 46 | } 47 | 48 | const promise = performCall.call(this); 49 | 50 | // if callback provided, convert promise to callback 51 | if (callback) { 52 | return promiseToCallback(promise)(callback); 53 | } 54 | 55 | // only return promise if no callback provided 56 | return promise; 57 | 58 | async function performCall() { 59 | // validate arg length 60 | if (args.length < methodObject[2]) { 61 | throw new Error(`[ethjs-query] method '${protoMethodName}' requires at least ${methodObject[2]} input (format type ${methodObject[0][0]}), ${args.length} provided. For more information visit: https://github.com/ethereum/wiki/wiki/JSON-RPC#${rpcMethodName.toLowerCase()}`); 62 | } 63 | if (args.length > methodObject[0].length) { 64 | throw new Error(`[ethjs-query] method '${protoMethodName}' requires at most ${methodObject[0].length} params, ${args.length} provided '${JSON.stringify(args, null, self.options.jsonSpace)}'. For more information visit: https://github.com/ethereum/wiki/wiki/JSON-RPC#${rpcMethodName.toLowerCase()}`); 65 | } 66 | 67 | // set default block 68 | if (methodObject[3] && args.length < methodObject[3]) { 69 | args.push('latest'); 70 | } 71 | 72 | // format inputs 73 | this.log(`attempting method formatting for '${protoMethodName}' with inputs ${JSON.stringify(args, null, this.options.jsonSpace)}`); 74 | try { 75 | inputs = format.formatInputs(rpcMethodName, args); 76 | this.log(`method formatting success for '${protoMethodName}' with formatted result: ${JSON.stringify(inputs, null, this.options.jsonSpace)}`); 77 | } catch (formattingError) { 78 | throw new Error(`[ethjs-query] while formatting inputs '${JSON.stringify(args, null, this.options.jsonSpace)}' for method '${protoMethodName}' error: ${formattingError}`); 79 | } 80 | 81 | // perform rpc call 82 | const result = await this.rpc.sendAsync({ method: rpcMethodName, params: inputs }); 83 | 84 | // format result 85 | try { 86 | this.log(`attempting method formatting for '${protoMethodName}' with raw outputs: ${JSON.stringify(result, null, this.options.jsonSpace)}`); 87 | const methodOutputs = format.formatOutputs(rpcMethodName, result); 88 | this.log(`method formatting success for '${protoMethodName}' formatted result: ${JSON.stringify(methodOutputs, null, this.options.jsonSpace)}`); 89 | return methodOutputs; 90 | } catch (outputFormattingError) { 91 | const outputError = new Error(`[ethjs-query] while formatting outputs from RPC '${JSON.stringify(result, null, this.options.jsonSpace)}' for method '${protoMethodName}' ${outputFormattingError}`); 92 | throw outputError; 93 | } 94 | } 95 | }; 96 | } 97 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to ethjs-query 2 | 3 | Love ethjs-query and want to help? Thanks so much, there's something to do for everybody! 4 | 5 | Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved. 6 | 7 | Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open source project. In return, they should reciprocate that respect in addressing your issue or assessing patches and features. 8 | 9 | ## Using the issue tracker 10 | 11 | The [issue tracker](https://github.com/ethjs/ethjs-query/issues) is 12 | the preferred channel for [bug reports](#bugs), [features requests](#features) 13 | and [submitting pull requests](#pull-requests). 14 | 15 | 16 | ## Bug reports 17 | 18 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 19 | Good bug reports are extremely helpful - thank you! 20 | 21 | Guidelines for bug reports: 22 | 23 | 1. **Use the GitHub issue search** — check if the issue has already been reported. 24 | 25 | 2. **Check if the issue has been fixed** — try to reproduce it using the latest `master` or development branch in the repository. 26 | 27 | 3. **Isolate the problem** — 28 | 29 | A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report. What is your environment? What steps will reproduce the issue? What browser(s) and OS 30 | experience the problem? What would you expect to be the outcome? All these details will help people to fix any potential bugs. 31 | 32 | Example: 33 | 34 | > Short and descriptive example bug report title 35 | > 36 | > A summary of the issue and the browser/OS environment in which it occurs. If 37 | > suitable, include the steps required to reproduce the bug. 38 | > 39 | > 1. This is the first step 40 | > 2. This is the second step 41 | > 3. Further steps, etc. 42 | > 43 | > `` - a link to the reduced test case 44 | > 45 | > Any other information you want to share that is relevant to the issue being 46 | > reported. This might include the lines of code that you have identified as 47 | > causing the bug, and potential solutions (and your opinions on their 48 | > merits). 49 | 50 | 51 | 52 | ## Feature requests 53 | 54 | Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to *you* to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible. 55 | 56 | 57 | 58 | ## Pull requests 59 | 60 | Good pull requests - patches, improvements, new features - are a fantastic 61 | help. They should remain focused in scope and avoid containing unrelated 62 | commits. 63 | 64 | **Please ask first** before embarking on any significant pull request (e.g. 65 | implementing features, refactoring code, porting to a different language), 66 | otherwise you risk spending a lot of time working on something that the 67 | project's developers might not want to merge into the project. 68 | 69 | Please adhere to the coding conventions used throughout a project (indentation, 70 | accurate comments, etc.) and any other requirements (such as test coverage). 71 | 72 | Adhering to the following process is the best way to get your work 73 | included in the project: 74 | 75 | 1. [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your fork, and configure the remotes: 76 | 77 | ```bash 78 | # Clone your fork of the repo into the current directory 79 | git clone https://github.com//ethjs-query.git 80 | # Navigate to the newly cloned directory 81 | cd ethjs-query 82 | # Assign the original repo to a remote called "upstream" 83 | git remote add upstream https://github.com/ethjs/ethjs-query.git 84 | ``` 85 | 86 | 2. If you cloned a while ago, get the latest changes from upstream: 87 | 88 | ```bash 89 | git checkout master 90 | git pull upstream master 91 | ``` 92 | 93 | 3. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix: 94 | 95 | ```bash 96 | git checkout -b 97 | ``` 98 | 99 | 4. Commit your changes in logical chunks. Please adhere to these [git commit message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) or your code is unlikely be merged into the main project. Use Git's [interactive rebase](https://help.github.com/articles/about-git-rebase/) feature to tidy up your commits before making them public. 100 | 101 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 102 | 103 | ```bash 104 | git pull [--rebase] upstream master 105 | ``` 106 | 107 | 6. Push your topic branch up to your fork: 108 | 109 | ```bash 110 | git push origin 111 | ``` 112 | 113 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 114 | with a clear title and description. 115 | 116 | **DESIGN NOTE**: ethjs-query follows the UNIX programming philosophy. Please consider this before contributing, keep your commits/modules concise and to the point. 117 | 118 | Read more here: 119 | http://www.catb.org/esr/writings/taoup/html/ch01s06.html 120 | 121 | **IMPORTANT**: By submitting a patch, you agree to allow the project 122 | owners to license your work under the terms of the [MIT License](LICENSE.txt). 123 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ethjs-query", 3 | "version": "0.3.7", 4 | "description": "A simple query layer for the Ethereum RPC.", 5 | "main": "lib/index.js", 6 | "files": [ 7 | "dist", 8 | "internals", 9 | "lib", 10 | "src" 11 | ], 12 | "scripts": { 13 | "start": "npm test", 14 | "release": "npmpub", 15 | "pretest": "npm run lint", 16 | "prepublish": "npm run build", 17 | "prebuild": "npm run build:clean && npm run test", 18 | "build:clean": "npm run test:clean && rimraf ./dist", 19 | "build:commonjs": "cross-env BABEL_ENV=commonjs babel src --out-dir lib --copy-files", 20 | "build:umd": "cross-env BABEL_ENV=commonjs NODE_ENV=development webpack --config ./internals/webpack/webpack.config.js ./lib/index.js --progress", 21 | "build:umd:min": "cross-env BABEL_ENV=commonjs NODE_ENV=production webpack --config ./internals/webpack/webpack.config.js ./lib/index.js --progress", 22 | "build": "npm run build:commonjs && npm run test:lib && npm run build:umd && npm run build:umd:min", 23 | "lint": "npm run lint:js", 24 | "lint:eslint": "eslint --ignore-path .gitignore --ignore-pattern **/**.min.js", 25 | "lint:js": "npm run lint:eslint -- . ", 26 | "lint:staged": "lint-staged", 27 | "test:clean": "rimraf ./coverage", 28 | "test": "mocha ./src/tests/**/*.js -R spec --timeout 2000000", 29 | "test:lib": "mocha ./lib/tests/**/*.js -R spec --timeout 2000000", 30 | "test-travis": "node ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- src/tests/**/*.js -R spec --timeout 2000000", 31 | "coveralls": "npm run test-travis && cat ./coverage/lcov.info | coveralls" 32 | }, 33 | "repository": { 34 | "type": "git", 35 | "url": "git+ssh://git@github.com/ethjs/ethjs-query.git" 36 | }, 37 | "keywords": [ 38 | "ethereum", 39 | "query", 40 | "rpc", 41 | "web3" 42 | ], 43 | "engines": { 44 | "npm": ">=3", 45 | "node": ">=6.5.0" 46 | }, 47 | "author": "Nick Dodson ", 48 | "license": "MIT", 49 | "bugs": { 50 | "url": "https://github.com/ethjs/ethjs-query/issues" 51 | }, 52 | "homepage": "https://github.com/ethjs/ethjs-query#readme", 53 | "babel": { 54 | "plugins": [ 55 | [ 56 | "transform-es2015-template-literals", 57 | { 58 | "loose": true 59 | } 60 | ], 61 | "transform-es2015-literals", 62 | "transform-es2015-function-name", 63 | "transform-es2015-arrow-functions", 64 | "transform-es2015-block-scoped-functions", 65 | [ 66 | "transform-es2015-classes", 67 | { 68 | "loose": true 69 | } 70 | ], 71 | "transform-es2015-object-super", 72 | "transform-es2015-shorthand-properties", 73 | [ 74 | "transform-es2015-computed-properties", 75 | { 76 | "loose": true 77 | } 78 | ], 79 | [ 80 | "transform-es2015-for-of", 81 | { 82 | "loose": true 83 | } 84 | ], 85 | "transform-es2015-sticky-regex", 86 | "transform-es2015-unicode-regex", 87 | "check-es2015-constants", 88 | [ 89 | "transform-es2015-spread", 90 | { 91 | "loose": true 92 | } 93 | ], 94 | "transform-es2015-parameters", 95 | [ 96 | "transform-es2015-destructuring", 97 | { 98 | "loose": true 99 | } 100 | ], 101 | "transform-es2015-block-scoping", 102 | "transform-object-rest-spread", 103 | "transform-es3-member-expression-literals", 104 | "transform-es3-property-literals", 105 | "transform-async-to-generator", 106 | "transform-regenerator", 107 | "transform-runtime" 108 | ], 109 | "env": { 110 | "commonjs": { 111 | "plugins": [ 112 | [ 113 | "transform-es2015-modules-commonjs", 114 | { 115 | "loose": true 116 | } 117 | ] 118 | ] 119 | } 120 | } 121 | }, 122 | "dependencies": { 123 | "ethjs-format": "0.2.7", 124 | "ethjs-rpc": "0.2.0", 125 | "promise-to-callback": "^1.0.0" 126 | }, 127 | "devDependencies": { 128 | "babel-cli": "6.18.0", 129 | "babel-core": "6.18.2", 130 | "babel-eslint": "7.1.0", 131 | "babel-loader": "6.2.8", 132 | "babel-plugin-check-es2015-constants": "6.8.0", 133 | "babel-plugin-transform-async-to-generator": "^6.24.1", 134 | "babel-plugin-transform-es2015-arrow-functions": "6.8.0", 135 | "babel-plugin-transform-es2015-block-scoped-functions": "6.8.0", 136 | "babel-plugin-transform-es2015-block-scoping": "6.18.0", 137 | "babel-plugin-transform-es2015-classes": "6.18.0", 138 | "babel-plugin-transform-es2015-computed-properties": "6.8.0", 139 | "babel-plugin-transform-es2015-destructuring": "6.19.0", 140 | "babel-plugin-transform-es2015-for-of": "6.18.0", 141 | "babel-plugin-transform-es2015-function-name": "6.9.0", 142 | "babel-plugin-transform-es2015-literals": "6.8.0", 143 | "babel-plugin-transform-es2015-modules-commonjs": "6.18.0", 144 | "babel-plugin-transform-es2015-object-super": "6.8.0", 145 | "babel-plugin-transform-es2015-parameters": "6.18.0", 146 | "babel-plugin-transform-es2015-shorthand-properties": "6.18.0", 147 | "babel-plugin-transform-es2015-spread": "6.8.0", 148 | "babel-plugin-transform-es2015-sticky-regex": "6.8.0", 149 | "babel-plugin-transform-es2015-template-literals": "6.8.0", 150 | "babel-plugin-transform-es2015-unicode-regex": "6.11.0", 151 | "babel-plugin-transform-es3-member-expression-literals": "6.5.0", 152 | "babel-plugin-transform-es3-property-literals": "6.5.0", 153 | "babel-plugin-transform-object-rest-spread": "6.19.0", 154 | "babel-plugin-transform-regenerator": "^6.26.0", 155 | "babel-plugin-transform-runtime": "^6.23.0", 156 | "babel-register": "6.18.0", 157 | "check-es3-syntax-cli": "0.1.3", 158 | "webpack": "2.1.0-beta.15", 159 | "json-loader": "0.5.4", 160 | "rimraf": "2.3.4", 161 | "cross-env": "1.0.7", 162 | "hard-rejection": "^1.0.0", 163 | "bignumber.js": "3.0.1", 164 | "chai": "3.5.0", 165 | "coveralls": "2.11.9", 166 | "eslint": "2.10.1", 167 | "eslint-config-airbnb": "9.0.1", 168 | "eslint-import-resolver-webpack": "0.2.4", 169 | "eslint-plugin-import": "1.8.0", 170 | "eslint-plugin-jsx-a11y": "1.2.0", 171 | "eslint-plugin-react": "5.1.1", 172 | "ethjs-abi": "0.0.1", 173 | "ganache-core": "^2.1.0", 174 | "istanbul": "0.4.5", 175 | "lint-staged": "1.0.1", 176 | "mocha": "3.2.0", 177 | "pre-commit": "1.1.3" 178 | }, 179 | "lint-staged": { 180 | "lint:eslint": "*.js" 181 | }, 182 | "eslintConfig": { 183 | "parser": "babel-eslint", 184 | "extends": "airbnb", 185 | "env": { 186 | "node": true, 187 | "mocha": true, 188 | "es6": true 189 | }, 190 | "parserOptions": { 191 | "ecmaVersion": 6, 192 | "sourceType": "module" 193 | }, 194 | "rules": { 195 | "import/no-unresolved": 2, 196 | "comma-dangle": [ 197 | 2, 198 | "always-multiline" 199 | ], 200 | "indent": [ 201 | 2, 202 | 2, 203 | { 204 | "SwitchCase": 1 205 | } 206 | ], 207 | "no-console": 1, 208 | "max-len": 0, 209 | "prefer-template": 2, 210 | "no-use-before-define": 0, 211 | "newline-per-chained-call": 0, 212 | "arrow-body-style": [ 213 | 2, 214 | "as-needed" 215 | ] 216 | } 217 | }, 218 | "pre-commit": "build" 219 | } 220 | -------------------------------------------------------------------------------- /docs/user-guide.md: -------------------------------------------------------------------------------- 1 | # User Guide 2 | 3 | All information for developers using `ethjs-query` should consult this document. 4 | 5 | ## Install 6 | 7 | ``` 8 | npm install --save ethjs-query 9 | ``` 10 | 11 | ## Usage 12 | 13 | ```js 14 | const HttpProvider = require('ethjs-provider-http'); 15 | const Eth = require('ethjs-query'); 16 | const eth = new Eth(new HttpProvider('http://localhost:8545')); 17 | 18 | eth.getBalance('0x407d73d8a49eeb85d32cf465507dd71d507100c1', cb); 19 | 20 | // result null 21 | 22 | eth.sendTransaction({ 23 | from: '0x407d73d8a49eeb85d32cf465507dd71d507100c1', 24 | to: '0x987d73d8a49eeb85d32cf462207dd71d50710033', 25 | value: new BN('29384'), 26 | gas: 3000000, 27 | data: '0x', 28 | }).then(cb).catch(cb); 29 | 30 | // result null 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 31 | ``` 32 | 33 | ## Debugging Options 34 | 35 | `ethjs-query` comes equip with a full debug options for all data inputs and outputs. 36 | 37 | ```js 38 | const HttpProvider = require('ethjs-provider-http'); 39 | const Eth = require('ethjs-query'); 40 | const eth = new Eth(new HttpProvider('http://localhost:8545'), { debug: true, logger: console, jsonSpace: 0 }); 41 | 42 | eth.accounts(cb); 43 | 44 | /* result 45 | [ethjs-query 2016-11-27T19:37:54.917Z] attempting method accounts with params [null] 46 | [ethjs-query 2016-11-27T19:37:54.917Z] [method 'accounts'] callback provided: true 47 | [ethjs-query 2016-11-27T19:37:54.917Z] [method 'accounts'] attempting input formatting of 0 inputs 48 | [ethjs-query 2016-11-27T19:37:54.917Z] [method 'accounts'] formatted inputs: [] 49 | [ethjs-query 2016-11-27T19:37:54.917Z] [method 'accounts'] attempting query with formatted inputs... 50 | [ethjs-query 2016-11-27T19:37:54.919Z] [method 'accounts'] callback success, attempting formatting of raw outputs: ["0xb88643569c19d05dc67b960f91d9d696eebf808e","0xf...] 51 | [ethjs-query 2016-11-27T19:37:54.919Z] [method 'accounts'] formatted outputs: ["0xb88643569c19d05dc67b960f91d9d696eebf808e","0xf...] 52 | */ 53 | ``` 54 | 55 | ## Amorphic Data Formatting 56 | 57 | `ethjs-query` uses the `ethjs-format` module to format incoming and outgoing RPC data payloads. The primary formatting task is numbers. Number values can be inputed as: `BigNumber`, `BN`, `string`, `hex` or `actual numbers`. Because the blockchain does not support decimal or negative numbers, any kind of decimal or negative number will cause an error return. All received number values are returned as BN.js object instances. 58 | 59 | Read more about the formatting layer here: [ethjs-format](http://github.com/ethjs/ethjs-format) 60 | 61 | ## Async Only 62 | 63 | All methods are `async` only, requiring either a callback or promise. `ethjs-query` supports both callbacks and promises for all RPC methods. 64 | 65 | ## Error handling 66 | 67 | Error handling is done through function callbacks or promised catches. 68 | 69 | ## Supported Methods 70 | 71 | `ethjs-query` supports all Ethereum spec RPC methods. Note, all `eth` RPC methods are attached as methods to the `Eth` object without the `eth_` prefix. All other methods (e.g. `web3_`, `net_` and `ssh_` etc.) require the full RPC method name (note, this policy may change in the future). 72 | 73 | * [eth.protocolVersion](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_protocolversion) 74 | * [eth.syncing](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_syncing) 75 | * [eth.coinbase](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_coinbase) 76 | * [eth.mining](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_mining) 77 | * [eth.hashrate](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_hashrate) 78 | * [eth.gasPrice](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gasprice) 79 | * [eth.accounts](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_accounts) 80 | * [eth.blockNumber](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_blocknumber) 81 | * [eth.getBalance](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance) 82 | * [eth.getStorageAt](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getstorageat) 83 | * [eth.getTransactionCount](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount) 84 | * [eth.getBlockTransactionCountByHash](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbyhash) 85 | * [eth.getBlockTransactionCountByNumber](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbynumber) 86 | * [eth.getUncleCountByBlockHash](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblockhash) 87 | * [eth.getUncleCountByBlockNumber](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblocknumber) 88 | * [eth.getCode](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode) 89 | * [eth.sign](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign) 90 | * [eth.sendTransaction](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction) 91 | * [eth.sendRawTransaction](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendrawtransaction) 92 | * [eth.call](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_call) 93 | * [eth.estimateGas](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas) 94 | * [eth.getBlockByHash](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash) 95 | * [eth.getBlockByNumber](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber) 96 | * [eth.getTransactionByHash](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyhash) 97 | * [eth.getTransactionByBlockHashAndIndex](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblockhashandindex) 98 | * [eth.getTransactionByBlockNumberAndIndex](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblocknumberandindex) 99 | * [eth.getTransactionReceipt](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt) 100 | * [eth.getUncleByBlockHashAndIndex](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblockhashandindex) 101 | * [eth.getUncleByBlockNumberAndIndex](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblocknumberandindex) 102 | * [eth.getCompilers](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcompilers) 103 | * [eth.compileLLL](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilelll) 104 | * [eth.compileSolidity](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilesolidity) 105 | * [eth.compileSerpent](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compileserpent) 106 | * [eth.newFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter) 107 | * [eth.newBlockFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter) 108 | * [eth.newPendingTransactionFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newpendingtransactionfilter) 109 | * [eth.uninstallFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_uninstallfilter) 110 | * [eth.getFilterChanges](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges) 111 | * [eth.getFilterLogs](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs) 112 | * [eth.getLogs](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs) 113 | * [eth.getWork](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getwork) 114 | * [eth.submitWork](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submitwork) 115 | * [eth.submitHashrate](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submithashrate) 116 | 117 | * [eth.web3_clientVersion](https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_clientversion) 118 | * [eth.web3_sha3](https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_sha3) 119 | 120 | * [eth.net_version](https://github.com/ethereum/wiki/wiki/JSON-RPC#net_version) 121 | * [eth.net_peerCount](https://github.com/ethereum/wiki/wiki/JSON-RPC#net_peercount) 122 | * [eth.net_listening](https://github.com/ethereum/wiki/wiki/JSON-RPC#net_listening) 123 | 124 | * [eth.db_putString](https://github.com/ethereum/wiki/wiki/JSON-RPC#db_putstring) 125 | * [eth.db_getString](https://github.com/ethereum/wiki/wiki/JSON-RPC#db_getstring) 126 | * [eth.db_putHex](https://github.com/ethereum/wiki/wiki/JSON-RPC#db_puthex) 127 | * [eth.db_getHex](https://github.com/ethereum/wiki/wiki/JSON-RPC#db_gethex) 128 | 129 | * [eth.shh_post](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_post) 130 | * [eth.shh_version](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_version) 131 | * [eth.shh_newIdentity](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newidentity) 132 | * [eth.shh_hasIdentity](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_hasidentity) 133 | * [eth.shh_newGroup](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newgroup) 134 | * [eth.shh_addToGroup](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_addtogroup) 135 | * [eth.shh_newFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newfilter) 136 | * [eth.shh_uninstallFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_uninstallfilter) 137 | * [eth.shh_getFilterChanges](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_getfilterchanges) 138 | * [eth.shh_getMessages](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_getmessages) 139 | 140 | ## Why BN.js? 141 | 142 | `ethjs` has made a policy of using `BN.js` across all of its repositories. Here are some of the reasons why: 143 | 144 | 1. lighter than alternatives (BigNumber.js) 145 | 2. faster than most alternatives, see [benchmarks](https://github.com/indutny/bn.js/issues/89) 146 | 3. used by the Ethereum foundation across all [`ethereumjs`](https://github.com/ethereumjs) repositories 147 | 4. is already used by a critical JS dependency of many ethereum packages, see package [`elliptic`](https://github.com/indutny/elliptic) 148 | 5. purposefully **does not support decimals or floats numbers** (for greater precision), remember, the Ethereum blockchain cannot and will not support float values or decimal numbers. 149 | 150 | ## Browser Builds 151 | 152 | `ethjs` provides production distributions for all of its modules that are ready for use in the browser right away. Simply include either `dist/ethjs-query.js` or `dist/ethjs-query.min.js` directly into an HTML file to start using this module. Note, an `Eth` object is made available globally. 153 | 154 | ```html 155 | 156 | 159 | ``` 160 | 161 | Note, even though `ethjs` should have transformed and polyfilled most of the requirements to run this module across most modern browsers. You may want to look at an additional polyfill for extra support. 162 | 163 | Use a polyfill service such as `Polyfill.io` to ensure complete cross-browser support: 164 | https://polyfill.io/ 165 | 166 | ## Latest Webpack Figures 167 | 168 | ``` 169 | Hash: e5b1a721ec5ba5bc55c9 170 | Version: webpack 2.1.0-beta.15 171 | Time: 891ms 172 | Asset Size Chunks Chunk Names 173 | ethjs-query.js 177 kB 0 [emitted] main 174 | ethjs-query.js.map 222 kB 0 [emitted] main 175 | [5] ./lib/index.js 4.45 kB {0} [built] 176 | + 14 hidden modules 177 | 178 | Version: webpack 2.1.0-beta.15 179 | Time: 2786ms 180 | Asset Size Chunks Chunk Names 181 | ethjs-query.min.js 79.4 kB 0 [emitted] main 182 | [5] ./lib/index.js 4.45 kB {0} [built] 183 | + 14 hidden modules 184 | ``` 185 | 186 | ## Other Awesome Modules, Tools and Frameworks 187 | 188 | ### Foundation 189 | - [web3.js](https://github.com/ethereum/web3.js) -- the original Ethereum JS swiss army knife **Ethereum Foundation** 190 | - [ethereumjs](https://github.com/ethereumjs) -- critical ethereum javascript infrastructure **Ethereum Foundation** 191 | - [browser-solidity](https://ethereum.github.io/browser-solidity) -- an in browser Solidity IDE **Ethereum Foundation** 192 | 193 | ### Nodes 194 | - [geth](https://github.com/ethereum/go-ethereum) Go-Ethereum 195 | - [parity](https://github.com/ethcore/parity) Rust-Ethereum build in Rust 196 | - [testrpc](https://github.com/ethereumjs/testrpc) Testing Node (ethereumjs-vm) 197 | 198 | ### Testing 199 | - [wafr](https://github.com/silentcicero/wafr) -- a super simple Solidity testing framework 200 | - [truffle](https://github.com/ConsenSys/truffle) -- a solidity/js dApp framework 201 | - [embark](https://github.com/iurimatias/embark-framework) -- a solidity/js dApp framework 202 | - [dapple](https://github.com/nexusdev/dapple) -- a solidity dApp framework 203 | - [chaitherium](https://github.com/SafeMarket/chaithereum) -- a JS web3 unit testing framework 204 | - [contest](https://github.com/DigixGlobal/contest) -- a JS testing framework for contracts 205 | 206 | ### Wallets 207 | - [ethers-wallet](https://github.com/ethers-io/ethers-wallet) -- an amazingly small Ethereum wallet 208 | - [metamask](https://metamask.io/) -- turns your browser into an Ethereum enabled browser =D 209 | 210 | ## Our Relationship with Ethereum & EthereumJS 211 | 212 | We would like to mention that we are not in any way affiliated with the Ethereum Foundation or `ethereumjs`. However, we love the work they do and work with them often to make Ethereum great! Our aim is to support the Ethereum ecosystem with a policy of diversity, modularity, simplicity, transparency, clarity, optimization and extensibility. 213 | 214 | Many of our modules use code from `web3.js` and the `ethereumjs-` repositories. We thank the authors where we can in the relevant repositories. We use their code carefully, and make sure all test coverage is ported over and where possible, expanded on. 215 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## ethjs-query 2 | 3 |
4 | 5 | 6 | Dependency Status 8 | 9 | 10 | 11 | 12 | devDependency Status 13 | 14 | 15 | 16 | 17 | Build Status 19 | 20 | 21 | 22 | 23 | NPM version 25 | 26 | 27 | 28 | 29 | Test Coverage 30 | 31 | 32 | 33 | 34 | js-airbnb-style 35 | 36 |
37 | 38 |
39 | 40 | A simple module for querying the Ethereum RPC layer. 41 | 42 | ## Install 43 | 44 | ``` 45 | npm install --save ethjs-query 46 | ``` 47 | 48 | ## Usage 49 | 50 | ```js 51 | const BN = require('bn.js'); 52 | const HttpProvider = require('ethjs-provider-http'); 53 | const Eth = require('ethjs-query'); 54 | const eth = new Eth(new HttpProvider('http://localhost:8545')); 55 | 56 | eth.getBalance('0x407d73d8a49eeb85d32cf465507dd71d507100c1', cb); 57 | 58 | // result null 59 | 60 | eth.sendTransaction({ 61 | from: '0x407d73d8a49eeb85d32cf465507dd71d507100c1', 62 | to: '0x987d73d8a49eeb85d32cf462207dd71d50710033', 63 | value: new BN('6500000'), 64 | gas: 3000000, 65 | data: '0x', 66 | }).then(cb).catch(cb); 67 | 68 | // result null 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 69 | ``` 70 | 71 | ## About 72 | 73 | A simple Ethereum RPC module for querying data from an Ethereum node such as a geth (go-etherem), parity (rust-ethereum) or TestRPC (local js-ethereum). 74 | 75 | This module supports all Ethereum RPC methods and is designed completely to specification. 76 | 77 | ## Amorphic Data Formatting 78 | 79 | `ethjs-query` uses the `ethjs-format` module to format incoming and outgoing RPC data payloads. The primary formatting task is numbers. Number values can be inputed as: `BigNumber`, `BN`, `string`, `hex` or `actual numbers`. Because the blockchain does not support decimal or negative numbers, any kind of decimal or negative number will cause an error return. All received number values are returned as BN.js object instances. 80 | 81 | Read more about the formatting layer here: [ethjs-format](http://github.com/ethjs/ethjs-format) 82 | 83 | ## Async Only 84 | 85 | All methods are `async` only, requiring either a callback or promise. 86 | 87 | ## Error handling 88 | 89 | Error handling is done through function callbacks or promised catches. 90 | 91 | ## Debugging Options 92 | 93 | `ethjs-query` comes equip with a full debug options for all data inputs and outputs. 94 | 95 | ```js 96 | const HttpProvider = require('ethjs-provider-http'); 97 | const Eth = require('ethjs-query'); 98 | const eth = new Eth(new HttpProvider('http://localhost:8545'), { debug: true, logger: console, jsonSpace: 0 }); 99 | 100 | eth.accounts(cb); 101 | 102 | /* result 103 | [ethjs-query 2016-11-27T19:37:54.917Z] attempting method accounts with params [null] 104 | [ethjs-query 2016-11-27T19:37:54.917Z] [method 'accounts'] callback provided: true 105 | [ethjs-query 2016-11-27T19:37:54.917Z] [method 'accounts'] attempting input formatting of 0 inputs 106 | [ethjs-query 2016-11-27T19:37:54.917Z] [method 'accounts'] formatted inputs: [] 107 | [ethjs-query 2016-11-27T19:37:54.917Z] [method 'accounts'] attempting query with formatted inputs... 108 | [ethjs-query 2016-11-27T19:37:54.919Z] [method 'accounts'] callback success, attempting formatting of raw outputs: ["0xb88643569c19d05dc67b960f91d9d696eebf808e","0xf...] 109 | [ethjs-query 2016-11-27T19:37:54.919Z] [method 'accounts'] formatted outputs: ["0xb88643569c19d05dc67b960f91d9d696eebf808e","0xf...] 110 | */ 111 | ``` 112 | 113 | ## Supported Methods 114 | 115 | `ethjs-query` supports all Ethereum specified RPC methods. 116 | 117 | ```js 118 | const HttpProvider = require('ethjs-provider-http'); 119 | const Eth = require('ethjs-query'); 120 | const eth = new Eth(new HttpProvider('http://localhost:8545')); 121 | 122 | eth.protocolVersion(cb); 123 | 124 | // .... 125 | ``` 126 | 127 | * [eth.protocolVersion](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_protocolversion) 128 | * [eth.syncing](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_syncing) 129 | * [eth.coinbase](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_coinbase) 130 | * [eth.mining](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_mining) 131 | * [eth.hashrate](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_hashrate) 132 | * [eth.gasPrice](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gasprice) 133 | * [eth.accounts](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_accounts) 134 | * [eth.blockNumber](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_blocknumber) 135 | * [eth.getBalance](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getbalance) 136 | * [eth.getStorageAt](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getstorageat) 137 | * [eth.getTransactionCount](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactioncount) 138 | * [eth.getBlockTransactionCountByHash](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbyhash) 139 | * [eth.getBlockTransactionCountByNumber](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblocktransactioncountbynumber) 140 | * [eth.getUncleCountByBlockHash](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblockhash) 141 | * [eth.getUncleCountByBlockNumber](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclecountbyblocknumber) 142 | * [eth.getCode](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcode) 143 | * [eth.sign](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign) 144 | * [eth.sendTransaction](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendtransaction) 145 | * [eth.sendRawTransaction](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendrawtransaction) 146 | * [eth.call](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_call) 147 | * [eth.estimateGas](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_estimategas) 148 | * [eth.getBlockByHash](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbyhash) 149 | * [eth.getBlockByNumber](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getblockbynumber) 150 | * [eth.getTransactionByHash](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyhash) 151 | * [eth.getTransactionByBlockHashAndIndex](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblockhashandindex) 152 | * [eth.getTransactionByBlockNumberAndIndex](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionbyblocknumberandindex) 153 | * [eth.getTransactionReceipt](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_gettransactionreceipt) 154 | * [eth.getUncleByBlockHashAndIndex](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblockhashandindex) 155 | * [eth.getUncleByBlockNumberAndIndex](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getunclebyblocknumberandindex) 156 | * [eth.getCompilers](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getcompilers) 157 | * [eth.compileLLL](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilelll) 158 | * [eth.compileSolidity](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compilesolidity) 159 | * [eth.compileSerpent](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_compileserpent) 160 | * [eth.newFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter) 161 | * [eth.newBlockFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter) 162 | * [eth.newPendingTransactionFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newpendingtransactionfilter) 163 | * [eth.uninstallFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_uninstallfilter) 164 | * [eth.getFilterChanges](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges) 165 | * [eth.getFilterLogs](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs) 166 | * [eth.getLogs](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs) 167 | * [eth.getWork](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getwork) 168 | * [eth.submitWork](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submitwork) 169 | * [eth.submitHashrate](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_submithashrate) 170 | 171 | * [eth.web3_clientVersion](https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_clientversion) 172 | * [eth.web3_sha3](https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_sha3) 173 | 174 | * [eth.net_version](https://github.com/ethereum/wiki/wiki/JSON-RPC#net_version) 175 | * [eth.net_peerCount](https://github.com/ethereum/wiki/wiki/JSON-RPC#net_peercount) 176 | * [eth.net_listening](https://github.com/ethereum/wiki/wiki/JSON-RPC#net_listening) 177 | 178 | * [eth.db_putString](https://github.com/ethereum/wiki/wiki/JSON-RPC#db_putstring) 179 | * [eth.db_getString](https://github.com/ethereum/wiki/wiki/JSON-RPC#db_getstring) 180 | * [eth.db_putHex](https://github.com/ethereum/wiki/wiki/JSON-RPC#db_puthex) 181 | * [eth.db_getHex](https://github.com/ethereum/wiki/wiki/JSON-RPC#db_gethex) 182 | 183 | * [eth.shh_post](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_post) 184 | * [eth.shh_version](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_version) 185 | * [eth.shh_newIdentity](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newidentity) 186 | * [eth.shh_hasIdentity](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_hasidentity) 187 | * [eth.shh_newGroup](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newgroup) 188 | * [eth.shh_addToGroup](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_addtogroup) 189 | * [eth.shh_newFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_newfilter) 190 | * [eth.shh_uninstallFilter](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_uninstallfilter) 191 | * [eth.shh_getFilterChanges](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_getfilterchanges) 192 | * [eth.shh_getMessages](https://github.com/ethereum/wiki/wiki/JSON-RPC#shh_getmessages) 193 | 194 | ## Contributing 195 | 196 | Please help better the ecosystem by submitting issues and pull requests to `ethjs-query`. We need all the help we can get to build the absolute best linting standards and utilities. We follow the AirBNB linting standard and the unix philosophy. 197 | 198 | ## Guides 199 | 200 | You'll find more detailed information on using `ethjs-query` and tailoring it to your needs in our guides: 201 | 202 | - [User guide](docs/user-guide.md) - Usage, configuration, FAQ and complementary tools. 203 | - [Developer guide](docs/developer-guide.md) - Contributing to `ethjs-query` and writing your own code and coverage. 204 | 205 | ## Help out 206 | 207 | There is always a lot of work to do, and will have many rules to maintain. So please help out in any way that you can: 208 | 209 | - Create, enhance, and debug ethjs rules (see our guide to ["Working on rules"](./github/CONTRIBUTING.md)). 210 | - Improve documentation. 211 | - Chime in on any open issue or pull request. 212 | - Open new issues about your ideas for making `ethjs-query` better, and pull requests to show us how your idea works. 213 | - Add new tests to *absolutely anything*. 214 | - Create or contribute to ecosystem tools, like modules for encoding or contracts. 215 | - Spread the word. 216 | 217 | Please consult our [Code of Conduct](CODE_OF_CONDUCT.md) docs before helping out. 218 | 219 | We communicate via [issues](https://github.com/ethjs/ethjs-query/issues) and [pull requests](https://github.com/ethjs/ethjs-query/pulls). 220 | 221 | ## Important documents 222 | 223 | - [Changelog](CHANGELOG.md) 224 | - [Code of Conduct](CODE_OF_CONDUCT.md) 225 | - [License](https://raw.githubusercontent.com/ethjs/ethjs-query/master/LICENSE) 226 | 227 | ## Licence 228 | 229 | This project is licensed under the MIT license, Copyright (c) 2016 Nick Dodson. For more information see LICENSE.md. 230 | 231 | ``` 232 | The MIT License 233 | 234 | Copyright (c) 2016 Nick Dodson. nickdodson.com 235 | 236 | Permission is hereby granted, free of charge, to any person obtaining a copy 237 | of this software and associated documentation files (the "Software"), to deal 238 | in the Software without restriction, including without limitation the rights 239 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 240 | copies of the Software, and to permit persons to whom the Software is 241 | furnished to do so, subject to the following conditions: 242 | 243 | The above copyright notice and this permission notice shall be included in 244 | all copies or substantial portions of the Software. 245 | 246 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 247 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 248 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 249 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 250 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 251 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 252 | THE SOFTWARE. 253 | ``` 254 | -------------------------------------------------------------------------------- /src/tests/test.index.js: -------------------------------------------------------------------------------- 1 | require('hard-rejection')(); 2 | const Eth = require('../index.js'); 3 | const Eth2 = require('../index.js'); 4 | const assert = require('chai').assert; 5 | const util = require('ethjs-util'); 6 | const GanacheCore = require('ganache-core'); 7 | const BigNumber = require('bn.js'); 8 | const abi = require('ethjs-abi'); 9 | 10 | describe('ethjs-query', () => { 11 | let provider; 12 | 13 | beforeEach(() => { 14 | provider = GanacheCore.provider(); 15 | }); 16 | 17 | describe('construction', () => { 18 | it('should construct normally', () => { 19 | const eth = new Eth(provider); 20 | 21 | assert.equal(typeof eth, 'object'); 22 | assert.equal(typeof eth.accounts, 'function'); 23 | assert.equal(typeof eth.getBalance, 'function'); 24 | assert.equal(typeof eth.sendTransaction, 'function'); 25 | assert.equal(typeof eth.sendRawTransaction, 'function'); 26 | assert.equal(typeof eth.personal_sign, 'function'); 27 | assert.equal(typeof eth.personal_ecRecover, 'function'); 28 | }); 29 | 30 | it('should construct normally with non Eth name', () => { 31 | const eth = new Eth2(provider); 32 | 33 | assert.equal(typeof eth, 'object'); 34 | assert.equal(typeof eth.accounts, 'function'); 35 | assert.equal(typeof eth.getBalance, 'function'); 36 | assert.equal(typeof eth.sendTransaction, 'function'); 37 | assert.equal(typeof eth.sendRawTransaction, 'function'); 38 | }); 39 | 40 | it('should fail when provider is not valid', (done) => { 41 | try { 42 | const eth = new Eth(''); // eslint-disable-line 43 | } catch (error) { 44 | assert.equal(typeof error, 'object'); 45 | done(); 46 | } 47 | }); 48 | 49 | it('should fail when provider is not valid', (done) => { 50 | try { 51 | const eth = new Eth(342323); // eslint-disable-line 52 | } catch (error) { 53 | assert.equal(typeof error, 'object'); 54 | done(); 55 | } 56 | }); 57 | 58 | it('debugger should function', (done) => { 59 | const eth = new Eth(provider, { debug: true, logger: { log: (message) => { 60 | assert.equal(typeof message, 'string'); 61 | }}}); // eslint-disable-line 62 | 63 | eth.accounts((err, result) => { 64 | assert.equal(err, null); 65 | assert.equal(Array.isArray(result), true); 66 | done(); 67 | }); 68 | }); 69 | 70 | it('should fail with response error payload', (done) => { 71 | const eth = new Eth({ 72 | sendAsync: (opts, cb) => { 73 | cb(false, { error: 'bad data..' }); 74 | }, 75 | }); // eslint-disable-line 76 | 77 | eth.accounts((err, result) => { 78 | assert.equal(typeof err, 'object'); 79 | assert.equal(result, null); 80 | done(); 81 | }); 82 | }); 83 | 84 | it('should handle empty getTransactionReceipt', (done) => { 85 | const eth = new Eth(provider); // eslint-disable-line 86 | 87 | eth.getTransactionReceipt('0x7f9de10bdd8686734c1b2dd2b7e53ea3e1ffe7fd4698a3a521ec8e09570ca121', (err, result) => { 88 | assert.equal(typeof err, 'object'); 89 | assert.equal(result, null); 90 | done(); 91 | }); 92 | }); 93 | 94 | it('should fail with invalid payload response (formatting error)', (done) => { 95 | const eth = new Eth({ 96 | sendAsync: (opts, cb) => { 97 | cb(false, { result: [38274978, 983428943] }); 98 | }, 99 | }); // eslint-disable-line 100 | 101 | eth.accounts((err, result) => { 102 | assert.equal(typeof err, 'object'); 103 | assert.equal(result, null); 104 | done(); 105 | }); 106 | }); 107 | 108 | it('should fail with invalid method input (formatting error)', (done) => { 109 | const eth = new Eth(provider); // eslint-disable-line 110 | 111 | eth.getBalance(234842387, (err, result) => { 112 | assert.equal(typeof err, 'object'); 113 | assert.equal(result, null); 114 | done(); 115 | }); 116 | }); 117 | 118 | it('should fail when no new flag is present', (done) => { 119 | try { 120 | const eth = Eth2(provider); // eslint-disable-line 121 | } catch (error) { 122 | assert.equal(typeof error, 'object'); 123 | done(); 124 | } 125 | }); 126 | 127 | it('should fail nicely when too little params on getBalance', (done) => { 128 | const eth = new Eth(provider); // eslint-disable-line 129 | 130 | eth.getBalance((err, result) => { 131 | assert.equal(typeof err, 'object'); 132 | assert.equal(result, null); 133 | 134 | done(); 135 | }); 136 | }); 137 | 138 | it('should fail nicely when too many paramsEncoded on getBalance', (done) => { 139 | const eth = new Eth(provider); // eslint-disable-line 140 | 141 | eth.getBalance('fsdfsd', 'sdffsd', 'dsfdfssf', (error, result) => { 142 | assert.equal(typeof error, 'object'); 143 | assert.equal(result, null); 144 | 145 | done(); 146 | }); 147 | }); 148 | 149 | it('should check if the rpc is eth_syncing', (done) => { 150 | const eth = new Eth(provider); 151 | 152 | eth.syncing((err, result) => { 153 | assert.equal(err, null); 154 | assert.equal(typeof result, 'boolean'); 155 | 156 | done(); 157 | }); 158 | }); 159 | 160 | it('should function while eth_coinbase', (done) => { 161 | const eth = new Eth(provider); 162 | 163 | eth.coinbase((err, result) => { 164 | assert.equal(err, null); 165 | assert.equal(typeof result, 'string'); 166 | assert.equal(util.getBinarySize(result), 42); 167 | 168 | done(); 169 | }); 170 | }); 171 | 172 | it('should function while eth_coinbase using promise', (done) => { 173 | const eth = new Eth(provider); 174 | 175 | eth.coinbase() 176 | .then((result) => { 177 | assert.equal(typeof result, 'string'); 178 | assert.equal(util.getBinarySize(result), 42); 179 | 180 | done(); 181 | }) 182 | .catch((err) => { 183 | assert.equal(err, null); 184 | }); 185 | }); 186 | 187 | it('should get acconts with promise', (done) => { 188 | const eth = new Eth(provider); 189 | 190 | eth.accounts() 191 | .then((result) => { 192 | assert.equal(typeof result, 'object'); 193 | assert.equal(result.length > 0, true); 194 | 195 | done(); 196 | }) 197 | .catch((err) => { 198 | assert.equal(err, null); 199 | }); 200 | }); 201 | 202 | it('should reject bad getBalance call with an error', (done) => { 203 | const eth = new Eth(provider); 204 | 205 | eth.accounts((accountsError, accounts) => { 206 | eth.sendTransaction({ 207 | from: accounts[0], 208 | to: accounts[1], 209 | gas: 10, 210 | value: 100000, 211 | data: '0x', 212 | }).catch((err) => { 213 | assert.equal(typeof err, 'object'); 214 | done(); 215 | }); 216 | }); 217 | }); 218 | 219 | it('should function while eth_getBalance using promise', (done) => { 220 | const eth = new Eth(provider); 221 | 222 | eth.coinbase() 223 | .then((result) => { 224 | assert.equal(typeof result, 'string'); 225 | assert.equal(util.getBinarySize(result), 42); 226 | 227 | eth.getBalance(result) 228 | .then((balance) => { 229 | assert.equal(typeof balance, 'object'); 230 | 231 | done(); 232 | }) 233 | .catch((err) => { 234 | assert.equal(err, null); 235 | }); 236 | }) 237 | .catch((err) => { 238 | assert.equal(err, null); 239 | }); 240 | }); 241 | 242 | it('should function while eth_getBalance, optional and non optional latest', (done) => { 243 | const eth = new Eth(provider); 244 | 245 | eth.coinbase((err, coinbase) => { 246 | assert.equal(err, null); 247 | assert.equal(typeof coinbase, 'string'); 248 | assert.equal(util.getBinarySize(coinbase), 42); 249 | 250 | eth.getBalance(coinbase, (balanceError, balance) => { 251 | assert.equal(balanceError, null); 252 | assert.equal(typeof balance, 'object'); 253 | 254 | eth.getBalance(coinbase, 'latest', (balanceLatestError, balanceLatest) => { 255 | assert.equal(balanceLatestError, null); 256 | assert.equal(typeof balanceLatest, 'object'); 257 | assert.equal(balance.toString(10), balanceLatest.toString(10)); 258 | 259 | done(); 260 | }); 261 | }); 262 | }); 263 | }); 264 | 265 | it('should function while get_accounts', (done) => { 266 | const eth = new Eth(provider); 267 | 268 | eth.accounts((err, result) => { 269 | assert.equal(err, null); 270 | assert.equal(typeof result, 'object'); 271 | assert.equal(Array.isArray(result), true); 272 | assert.equal(result.length > 0, true); 273 | assert.equal(typeof result[0], 'string'); 274 | assert.equal(util.getBinarySize(result[0]), 42); 275 | 276 | done(); 277 | }); 278 | }); 279 | 280 | it('should function while eth_blockNumber', (done) => { 281 | const eth = new Eth(provider); 282 | 283 | eth.blockNumber((err, result) => { 284 | assert.equal(err, null); 285 | assert.equal(typeof result, 'object'); 286 | assert.equal(result.toNumber() >= 0, true); 287 | done(); 288 | }); 289 | }); 290 | 291 | it('should function while eth_compileSolidity', (done) => { 292 | const eth = new Eth(provider); 293 | const testSolidity = `pragma solidity ^0.4.0; 294 | 295 | /// @title Voting with delegation. 296 | contract Ballot { 297 | function () public payable { 298 | } 299 | 300 | uint256 public cool; 301 | } 302 | `; 303 | 304 | eth.compileSolidity(testSolidity, (err, result) => { 305 | assert.ok(err); 306 | assert.ok(err.message.includes('Method eth_compileSolidity not supported.')); 307 | assert.equal(result, null); 308 | done(); 309 | }); 310 | }); 311 | 312 | it('should function while eth_estimateGas', (done) => { 313 | const eth = new Eth(provider); 314 | eth.accounts((accountsError, accounts) => { 315 | assert.equal(accountsError, null); 316 | assert.equal(typeof accounts, 'object'); 317 | 318 | const testTransactionObject = { 319 | from: accounts[0], 320 | to: accounts[4], 321 | gas: new BigNumber(23472), 322 | gasPrice: '92384242', 323 | data: '0x', 324 | }; 325 | 326 | eth.estimateGas(testTransactionObject, (err, result) => { 327 | assert.equal(err, null); 328 | assert.equal(typeof result, 'object'); 329 | assert.equal(typeof result.toString(10), 'string'); 330 | assert.equal(result.toNumber(10) > 0, true); 331 | done(); 332 | }); 333 | }); 334 | }); 335 | 336 | it('should function while eth_gasPrice', (done) => { 337 | const eth = new Eth(provider); 338 | 339 | eth.gasPrice((err, result) => { 340 | assert.equal(err, null); 341 | assert.equal(typeof result, 'object'); 342 | assert.equal(result.toNumber() > 0, true); 343 | done(); 344 | }); 345 | }); 346 | 347 | it('should function while eth_getBalance', (done) => { 348 | const eth = new Eth(provider); 349 | 350 | eth.accounts((accountsError, accounts) => { 351 | assert.equal(accountsError, null); 352 | assert.equal(typeof accounts, 'object'); 353 | 354 | eth.getBalance(accounts[0], (err, result) => { 355 | assert.equal(err, null); 356 | assert.equal(typeof result, 'object'); 357 | assert.equal(result.gt(0), true); 358 | 359 | eth.getBalance(accounts[0], 'latest', (err2, result2) => { 360 | assert.equal(err2, null); 361 | assert.equal(typeof result2, 'object'); 362 | assert.equal(result2.gt(0), true); 363 | done(); 364 | }); 365 | }); 366 | }); 367 | }); 368 | 369 | it('should function while eth_getBlockByNumber', (done) => { // eslint-disable-line 370 | const eth = new Eth(provider); 371 | 372 | eth.getBlockByNumber(0, true, (blockError, result) => { 373 | assert.equal(blockError, null); 374 | assert.equal(typeof result, 'object'); 375 | assert.equal(util.getBinarySize(result.hash), 66); 376 | assert.equal(util.getBinarySize(result.sha3Uncles), 66); 377 | assert.equal(util.getBinarySize(result.parentHash), 66); 378 | assert.equal(result.size.toNumber(10) > 0, true); 379 | assert.equal(result.gasLimit.toNumber(10) > 0, true); 380 | assert.equal(result.timestamp.toNumber(10) > 0, true); 381 | done(); 382 | }); 383 | }); 384 | 385 | it('should function while eth_getBlockByHash', (done) => { 386 | const eth = new Eth(provider); 387 | 388 | eth.getBlockByNumber(0, true, (blockError, block) => { 389 | assert.equal(blockError, null); 390 | assert.equal(typeof block, 'object'); 391 | 392 | eth.getBlockByHash(block.hash, true, (error, result) => { 393 | assert.equal(error, null); 394 | assert.equal(typeof result, 'object'); 395 | assert.equal(util.getBinarySize(result.hash), 66); 396 | assert.equal(util.getBinarySize(result.sha3Uncles), 66); 397 | assert.equal(util.getBinarySize(result.parentHash), 66); 398 | assert.equal(result.size.toNumber(10) > 0, true); 399 | assert.equal(result.gasLimit.toNumber(10) > 0, true); 400 | assert.equal(result.timestamp.toNumber(10) > 0, true); 401 | done(); 402 | }); 403 | }); 404 | }); 405 | 406 | it('should function while eth_getCode', (done) => { 407 | const eth = new Eth(provider); // eslint-disable-line 408 | done(); 409 | }); 410 | 411 | it('should function while eth_getCompilers', (done) => { 412 | const eth = new Eth(provider); // eslint-disable-line 413 | 414 | eth.getCompilers((error, result) => { 415 | assert.equal(error, null); 416 | assert.equal(typeof result, 'object'); 417 | assert.equal(Array.isArray(result), true); 418 | assert.equal(typeof result[0], 'string'); 419 | 420 | done(); 421 | }); 422 | }); 423 | 424 | it('should function while eth_hashrate', (done) => { 425 | const eth = new Eth(provider); // eslint-disable-line 426 | 427 | eth.hashrate((error, result) => { 428 | assert.equal(error, null); 429 | assert.equal(typeof result, 'object'); 430 | assert.equal(result.toNumber(10) >= 0, true); 431 | 432 | done(); 433 | }); 434 | }); 435 | 436 | it('should function while eth_mining', (done) => { 437 | const eth = new Eth(provider); // eslint-disable-line 438 | 439 | eth.mining((error, result) => { 440 | assert.equal(error, null); 441 | assert.equal(typeof result, 'boolean'); 442 | 443 | done(); 444 | }); 445 | }); 446 | 447 | it('should function while eth_getTransactionCount', (done) => { 448 | const eth = new Eth(provider); // eslint-disable-line 449 | 450 | eth.accounts((accountsError, accounts) => { 451 | assert.equal(accountsError, null); 452 | assert.equal(typeof accounts, 'object'); 453 | 454 | eth.getTransactionCount(accounts[0], (error, result) => { 455 | assert.equal(error, null); 456 | assert.equal(typeof result, 'object'); 457 | assert.equal(result.toNumber(10) >= 0, true); 458 | 459 | done(); 460 | }); 461 | }); 462 | }); 463 | 464 | it('should function while eth_getTransactionByBlockHashAndIndex', (done) => { 465 | const eth = new Eth(provider); // eslint-disable-line 466 | 467 | eth.accounts((accountsError, accounts) => { 468 | assert.equal(accountsError, null); 469 | assert.equal(typeof accounts, 'object'); 470 | 471 | const testTransaction = { 472 | from: accounts[0], 473 | to: accounts[2], 474 | gas: 3000000, 475 | data: '0x', 476 | }; 477 | 478 | eth.sendTransaction(testTransaction, (error, result) => { 479 | assert.equal(error, null); 480 | assert.equal(typeof result, 'string'); 481 | assert.equal(util.getBinarySize(result), 66); 482 | 483 | eth.getTransactionReceipt(result, (receiptError, receipt) => { 484 | assert.equal(receiptError, null); 485 | assert.equal(typeof receipt, 'object'); 486 | 487 | eth.getTransactionByBlockHashAndIndex(receipt.blockHash, 0, (blockError, block) => { 488 | assert.equal(blockError, null); 489 | assert.equal(typeof block, 'object'); 490 | assert.equal(util.getBinarySize(block.blockHash), 66); 491 | assert.equal(block.gas.toNumber(10) >= 0, true); 492 | assert.equal(block.gasPrice.toNumber(10) >= 0, true); 493 | assert.equal(block.transactionIndex.toNumber(10) >= 0, true); 494 | assert.equal(block.blockNumber.toNumber(10) >= 0, true); 495 | 496 | done(); 497 | }); 498 | }); 499 | }); 500 | }); 501 | }); 502 | 503 | it('should function while eth_getTransactionByBlockNumberAndIndex', (done) => { 504 | const eth = new Eth(provider); // eslint-disable-line 505 | 506 | eth.accounts((accountsError, accounts) => { 507 | assert.equal(accountsError, null); 508 | assert.equal(typeof accounts, 'object'); 509 | 510 | const testTransaction = { 511 | from: accounts[0], 512 | to: accounts[2], 513 | gas: 3000000, 514 | data: '0x', 515 | }; 516 | 517 | eth.sendTransaction(testTransaction, (error, result) => { 518 | assert.equal(error, null); 519 | assert.equal(typeof result, 'string'); 520 | assert.equal(util.getBinarySize(result), 66); 521 | 522 | eth.getTransactionReceipt(result, (receiptError, receipt) => { 523 | assert.equal(receiptError, null); 524 | assert.equal(typeof receipt, 'object'); 525 | 526 | eth.getTransactionByBlockNumberAndIndex(1, 0, (blockError, block) => { 527 | assert.equal(blockError, null); 528 | assert.equal(typeof block, 'object'); 529 | assert.equal(util.getBinarySize(block.blockHash), 66); 530 | assert.equal(block.gas.toNumber(10) >= 0, true); 531 | assert.equal(block.gasPrice.toNumber(10) >= 0, true); 532 | assert.equal(block.transactionIndex.toNumber(10) >= 0, true); 533 | assert.equal(block.blockNumber.toNumber(10) >= 0, true); 534 | 535 | done(); 536 | }); 537 | }); 538 | }); 539 | }); 540 | }); 541 | 542 | it('should function while eth_sendTransaction', (done) => { 543 | const eth = new Eth(provider); // eslint-disable-line 544 | 545 | eth.accounts((accountsError, accounts) => { 546 | assert.equal(accountsError, null); 547 | assert.equal(typeof accounts, 'object'); 548 | 549 | const testTransaction = { 550 | from: accounts[0], 551 | to: accounts[2], 552 | gas: 3000000, 553 | data: '0x', 554 | }; 555 | 556 | eth.sendTransaction(testTransaction, (error, result) => { 557 | assert.equal(error, null); 558 | assert.equal(typeof result, 'string'); 559 | assert.equal(util.getBinarySize(result), 66); 560 | 561 | done(); 562 | }); 563 | }); 564 | }); 565 | 566 | it('should function while eth_sendTransaction with contract', (done) => { 567 | const eth = new Eth(provider); // eslint-disable-line 568 | 569 | eth.accounts((accountsError, accounts) => { 570 | assert.equal(accountsError, null); 571 | assert.equal(typeof accounts, 'object'); 572 | 573 | const testTransaction = { 574 | from: accounts[0], 575 | gas: '3000000', 576 | data: '606060405234610000575b61016a806100186000396000f360606040526000357c010000000000000000000000000000000000000000000000000000000090048063119c56bd1461004e57806360fe47b11461008e5780636d4ce63c146100c1575b610000565b346100005761005b6100e4565b604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b34610000576100a960048080359060200190919050506100f5565b60405180821515815260200191505060405180910390f35b34610000576100ce61015f565b6040518082815260200191505060405180910390f35b60006000610d7d91503390505b9091565b6000816000819055507f10e8e9bc5a1bde3dd6bb7245b52503fcb9d9b1d7c7b26743f82c51cc7cce917d60005433604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1600190505b919050565b600060005490505b9056', 577 | }; 578 | 579 | eth.sendTransaction(testTransaction, (error, result) => { 580 | assert.equal(error, null); 581 | assert.equal(typeof result, 'string'); 582 | assert.equal(util.getBinarySize(result), 66); 583 | 584 | done(); 585 | }); 586 | }); 587 | }); 588 | 589 | it('should function while eth_sign', (done) => { 590 | const eth = new Eth(provider); // eslint-disable-line 591 | 592 | eth.accounts((accountsError, accounts) => { 593 | assert.equal(accountsError, null); 594 | assert.equal(typeof accounts, 'object'); 595 | 596 | const testTxData = '0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470'; 597 | 598 | eth.sign(accounts[0], testTxData, (error, result) => { 599 | assert.equal(error, null); 600 | assert.equal(typeof result, 'string'); 601 | assert.equal(util.getBinarySize(result) > 0, true); 602 | 603 | done(); 604 | }); 605 | }); 606 | }); 607 | 608 | it('should function while eth_getTransactionReceipt', (done) => { 609 | const eth = new Eth(provider); // eslint-disable-line 610 | 611 | eth.accounts((accountsError, accounts) => { 612 | assert.equal(accountsError, null); 613 | assert.equal(typeof accounts, 'object'); 614 | 615 | const testTransaction = { 616 | from: accounts[0], 617 | to: accounts[2], 618 | gas: 3000000, 619 | data: '0x', 620 | }; 621 | 622 | eth.sendTransaction(testTransaction, (error, result) => { 623 | assert.equal(error, null); 624 | assert.equal(typeof result, 'string'); 625 | assert.equal(util.getBinarySize(result), 66); 626 | 627 | setTimeout(() => { 628 | eth.getTransactionReceipt(result, (receiptError, receipt) => { 629 | assert.equal(receiptError, null); 630 | assert.equal(typeof receipt, 'object'); 631 | 632 | assert.equal(util.getBinarySize(receipt.transactionHash), 66); 633 | assert.equal(receipt.transactionIndex.toNumber(10) >= 0, true); 634 | assert.equal(receipt.blockNumber.toNumber(10) >= 0, true); 635 | assert.equal(receipt.cumulativeGasUsed.toNumber(10) >= 0, true); 636 | assert.equal(receipt.gasUsed.toNumber(10) >= 0, true); 637 | assert.equal(Array.isArray(receipt.logs), true); 638 | 639 | done(); 640 | }); 641 | }, 340); 642 | }); 643 | }); 644 | }); 645 | 646 | it('should function while deploy, use contract via eth_call, eth_getCode', (done) => { 647 | const eth = new Eth(provider); // eslint-disable-line 648 | 649 | eth.accounts((accountsError, accounts) => { 650 | assert.equal(accountsError, null); 651 | assert.equal(typeof accounts, 'object'); 652 | 653 | const testContractTransaction = { 654 | from: accounts[0], 655 | gas: 3000000, 656 | data: '606060405234610000575b61016a806100186000396000f360606040526000357c010000000000000000000000000000000000000000000000000000000090048063119c56bd1461004e57806360fe47b11461008e5780636d4ce63c146100c1575b610000565b346100005761005b6100e4565b604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b34610000576100a960048080359060200190919050506100f5565b60405180821515815260200191505060405180910390f35b34610000576100ce61015f565b6040518082815260200191505060405180910390f35b60006000610d7d91503390505b9091565b6000816000819055507f10e8e9bc5a1bde3dd6bb7245b52503fcb9d9b1d7c7b26743f82c51cc7cce917d60005433604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1600190505b919050565b600060005490505b9056', 657 | }; 658 | 659 | const contractABI = [{'constant': false,'inputs': [],'name': 'setcompeltereturn','outputs': [{'name': '_newValue','type': 'uint256'},{'name': '_sender','type': 'address'}],'payable': false,'type': 'function'},{'constant': false,'inputs': [{'name': '_value','type': 'uint256'}],'name': 'set','outputs': [{'name': '','type': 'bool'}],'payable': false,'type': 'function'},{'constant': false,'inputs': [],'name': 'get','outputs': [{'name': 'storeValue','type': 'uint256'}],'payable': false,'type': 'function'},{'anonymous':false,'inputs':[{'indexed':false,'name':'_newValue','type':'uint256'},{'indexed':false,'name':'_sender','type':'address'}],'name':'SetComplete','type':'event'}]; // eslint-disable-line 660 | 661 | eth.sendTransaction(testContractTransaction, (error, result) => { 662 | assert.equal(error, null); 663 | assert.equal(typeof result, 'string'); 664 | assert.equal(util.getBinarySize(result), 66); 665 | 666 | setTimeout(() => { 667 | eth.getTransactionReceipt(result, (receiptError, receipt) => { 668 | assert.equal(receiptError, null); 669 | assert.equal(typeof receipt, 'object'); 670 | 671 | assert.equal(util.getBinarySize(receipt.transactionHash), 66); 672 | assert.equal(receipt.transactionIndex.toNumber(10) >= 0, true); 673 | assert.equal(receipt.blockNumber.toNumber(10) >= 0, true); 674 | assert.equal(receipt.cumulativeGasUsed.toNumber(10) >= 0, true); 675 | assert.equal(receipt.gasUsed.toNumber(10) >= 0, true); 676 | assert.equal(Array.isArray(receipt.logs), true); 677 | assert.equal(typeof receipt.contractAddress, 'string'); 678 | 679 | const uintValue = 350000; 680 | const setMethodTransaction = { 681 | from: accounts[0], 682 | to: receipt.contractAddress, 683 | gas: 3000000, 684 | data: abi.encodeMethod(contractABI[1], [uintValue]), 685 | }; 686 | 687 | eth.sendTransaction(setMethodTransaction, (setMethodError, setMethodTx) => { 688 | assert.equal(setMethodError, null); 689 | assert.equal(typeof setMethodTx, 'string'); 690 | assert.equal(util.getBinarySize(setMethodTx), 66); 691 | 692 | setTimeout(() => { 693 | const callMethodTransaction = { 694 | to: receipt.contractAddress, 695 | data: abi.encodeMethod(contractABI[2], []), 696 | }; 697 | 698 | eth.call(callMethodTransaction, (callError, callResult) => { // eslint-disable-line 699 | assert.equal(setMethodError, null); 700 | const decodedUint = abi.decodeMethod(contractABI[2], callResult); 701 | 702 | assert.equal(decodedUint[0].toNumber(10), uintValue); 703 | 704 | eth.getCode(receipt.contractAddress, 'latest', (codeError, codeResult) => { 705 | assert.equal(codeError, null); 706 | assert.equal(typeof codeResult, 'string'); 707 | 708 | done(); 709 | }); 710 | }); 711 | }, 400); 712 | }); 713 | }); 714 | }, 1000); 715 | }); 716 | }); 717 | }); 718 | 719 | it('should function while deploy, use contract via eth_call, eth_getCode with debug, logger', (done) => { 720 | const eth = new Eth(provider, { debug: true, logger: { log: () => {} }, jsonSpace: 2 }); // eslint-disable-line 721 | 722 | eth.accounts((accountsError, accounts) => { 723 | assert.equal(accountsError, null); 724 | assert.equal(typeof accounts, 'object'); 725 | 726 | const testContractTransaction = { 727 | from: accounts[0], 728 | gas: 3000000, 729 | data: '606060405234610000575b61016a806100186000396000f360606040526000357c010000000000000000000000000000000000000000000000000000000090048063119c56bd1461004e57806360fe47b11461008e5780636d4ce63c146100c1575b610000565b346100005761005b6100e4565b604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390f35b34610000576100a960048080359060200190919050506100f5565b60405180821515815260200191505060405180910390f35b34610000576100ce61015f565b6040518082815260200191505060405180910390f35b60006000610d7d91503390505b9091565b6000816000819055507f10e8e9bc5a1bde3dd6bb7245b52503fcb9d9b1d7c7b26743f82c51cc7cce917d60005433604051808381526020018273ffffffffffffffffffffffffffffffffffffffff1681526020019250505060405180910390a1600190505b919050565b600060005490505b9056', 730 | }; 731 | 732 | const contractABI = [{'constant': false,'inputs': [],'name': 'setcompeltereturn','outputs': [{'name': '_newValue','type': 'uint256'},{'name': '_sender','type': 'address'}],'payable': false,'type': 'function'},{'constant': false,'inputs': [{'name': '_value','type': 'uint256'}],'name': 'set','outputs': [{'name': '','type': 'bool'}],'payable': false,'type': 'function'},{'constant': false,'inputs': [],'name': 'get','outputs': [{'name': 'storeValue','type': 'uint256'}],'payable': false,'type': 'function'},{'anonymous':false,'inputs':[{'indexed':false,'name':'_newValue','type':'uint256'},{'indexed':false,'name':'_sender','type':'address'}],'name':'SetComplete','type':'event'}]; // eslint-disable-line 733 | 734 | eth.sendTransaction(testContractTransaction, (error, result) => { 735 | assert.equal(error, null); 736 | assert.equal(typeof result, 'string'); 737 | assert.equal(util.getBinarySize(result), 66); 738 | 739 | setTimeout(() => { 740 | eth.getTransactionReceipt(result, (receiptError, receipt) => { 741 | assert.equal(receiptError, null); 742 | assert.equal(typeof receipt, 'object'); 743 | 744 | assert.equal(util.getBinarySize(receipt.transactionHash), 66); 745 | assert.equal(receipt.transactionIndex.toNumber(10) >= 0, true); 746 | assert.equal(receipt.blockNumber.toNumber(10) >= 0, true); 747 | assert.equal(receipt.cumulativeGasUsed.toNumber(10) >= 0, true); 748 | assert.equal(receipt.gasUsed.toNumber(10) >= 0, true); 749 | assert.equal(Array.isArray(receipt.logs), true); 750 | assert.equal(typeof receipt.contractAddress, 'string'); 751 | 752 | const uintValue = 350000; 753 | const setMethodTransaction = { 754 | from: accounts[0], 755 | to: receipt.contractAddress, 756 | gas: 3000000, 757 | data: abi.encodeMethod(contractABI[1], [uintValue]), 758 | }; 759 | 760 | eth.sendTransaction(setMethodTransaction, (setMethodError, setMethodTx) => { 761 | assert.equal(setMethodError, null); 762 | assert.equal(typeof setMethodTx, 'string'); 763 | assert.equal(util.getBinarySize(setMethodTx), 66); 764 | 765 | setTimeout(() => { 766 | const callMethodTransaction = { 767 | to: receipt.contractAddress, 768 | data: abi.encodeMethod(contractABI[2], []), 769 | }; 770 | 771 | eth.call(callMethodTransaction, (callError, callResult) => { // eslint-disable-line 772 | assert.equal(setMethodError, null); 773 | const decodedUint = abi.decodeMethod(contractABI[2], callResult); 774 | 775 | assert.equal(decodedUint[0].toNumber(10), uintValue); 776 | 777 | eth.getCode(receipt.contractAddress, 'latest', (codeError, codeResult) => { 778 | assert.equal(codeError, null); 779 | assert.equal(typeof codeResult, 'string'); 780 | 781 | done(); 782 | }); 783 | }); 784 | }, 400); 785 | }); 786 | }); 787 | }, 1000); 788 | }); 789 | }); 790 | }); 791 | }); 792 | }); 793 | -------------------------------------------------------------------------------- /dist/ethjs-query.min.js: -------------------------------------------------------------------------------- 1 | !function(t,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define("Eth",[],r):"object"==typeof exports?exports.Eth=r():t.Eth=r()}(this,function(){return function(t){function r(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}var e={};return r.m=t,r.c=e,r.i=function(t){return t},r.d=function(t,r,e){Object.defineProperty(t,r,{configurable:!1,enumerable:!0,get:e})},r.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},r.p="",r(r.s=51)}([function(t,r){var e=t.exports={version:"2.5.4"};"number"==typeof __e&&(__e=e)},function(t,r){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t,r,e){var n=e(39)("wks"),i=e(43),o=e(1).Symbol,u="function"==typeof o,s=t.exports=function(t){return n[t]||(n[t]=u&&o[t]||(u?o:i)("Symbol."+t))};s.store=n},function(t,r,e){var n=e(7);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},function(t,r,e){var n=e(1),i=e(0),o=e(12),u=e(6),s=e(14),h="prototype",a=function(t,r,e){var f,l,c,p=t&a.F,m=t&a.G,d=t&a.S,g=t&a.P,v=t&a.B,y=t&a.W,w=m?i:i[r]||(i[r]={}),M=w[h],b=m?n:d?n[r]:(n[r]||{})[h];m&&(e=r);for(f in e)l=!p&&b&&void 0!==b[f],l&&s(w,f)||(c=l?b[f]:e[f],w[f]=m&&"function"!=typeof b[f]?e[f]:v&&l?o(c,n):y&&b[f]==c?function(t){var r=function(r,e,n){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(r);case 2:return new t(r,e)}return new t(r,e,n)}return t.apply(this,arguments)};return r[h]=t[h],r}(c):g&&"function"==typeof c?o(Function.call,c):c,g&&((w.virtual||(w.virtual={}))[f]=c,t&a.R&&M&&!M[f]&&u(M,f,c)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,r,e){t.exports=!e(13)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,r,e){var n=e(9),i=e(38);t.exports=e(5)?function(t,r,e){return n.f(t,r,i(1,e))}:function(t,r,e){return t[r]=e,t}},function(t,r){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,r){t.exports={}},function(t,r,e){var n=e(3),i=e(65),o=e(86),u=Object.defineProperty;r.f=e(5)?Object.defineProperty:function(t,r,e){if(n(t),r=o(r,!0),n(e),i)try{return u(t,r,e)}catch(s){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[r]=e.value),t}},function(t,r){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,r){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,r,e){var n=e(10);t.exports=function(t,r,e){if(n(t),void 0===r)return t;switch(e){case 1:return function(e){return t.call(r,e)};case 2:return function(e,n){return t.call(r,e,n)};case 3:return function(e,n,i){return t.call(r,e,n,i)}}return function(){return t.apply(r,arguments)}}},function(t,r){t.exports=function(t){try{return!!t()}catch(r){return!0}}},function(t,r){var e={}.hasOwnProperty;t.exports=function(t,r){return e.call(t,r)}},function(t,r,e){"use strict";var n=e(29);t.exports=function(t){return"string"!=typeof t?t:n(t)?t.slice(2):t}},function(t,r,e){"use strict";(function(t,n){function i(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}function o(){return t.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(r,e){if(o()t)throw new RangeError('"size" argument must not be negative')}function a(t,r,e,n){return h(r),r>0&&void 0!==e?"string"==typeof n?u(t,r).fill(e,n):u(t,r).fill(e):u(t,r)}function f(r,e){if(h(e),r=u(r,0>e?0:0|d(e)),!t.TYPED_ARRAY_SUPPORT)for(var n=0;e>n;++n)r[n]=0;return r}function l(r,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!t.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var i=0|v(e,n);r=u(r,i);var o=r.write(e,n);return o!==i&&(r=r.slice(0,o)),r}function c(t,r){var e=0>r.length?0:0|d(r.length);t=u(t,e);for(var n=0;e>n;n+=1)t[n]=255&r[n];return t}function p(r,e,n,i){if(0>n||n>e.byteLength)throw new RangeError("'offset' is out of bounds");if(n+(i||0)>e.byteLength)throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,n):new Uint8Array(e,n,i),t.TYPED_ARRAY_SUPPORT?(r=e,r.__proto__=t.prototype):r=c(r,e),r}function m(r,e){if(t.isBuffer(e)){var n=0|d(e.length);return r=u(r,n),0===r.length?r:(e.copy(r,0,0,n),r)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||$(e.length)?u(r,0):c(r,e);if("Buffer"===e.type&&X(e.data))return c(r,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function d(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function g(r){return+r!=r&&(r=0),t.alloc(+r)}function v(r,e){if(t.isBuffer(r))return r.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(r)||r instanceof ArrayBuffer))return r.byteLength;"string"!=typeof r&&(r=""+r);var n=r.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Z(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(r).length;default:if(i)return Z(r).length;e=(""+e).toLowerCase(),i=!0}}function y(t,r,e){var n=!1;if((void 0===r||0>r)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),0>=e)return"";if(e>>>=0,r>>>=0,r>=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return k(this,r,e);case"utf8":case"utf-8":return B(this,r,e);case"ascii":return j(this,r,e);case"latin1":case"binary":return D(this,r,e);case"base64":return P(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function w(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function M(r,e,n,i,o){if(0===r.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:-2147483648>n&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:r.length-1),0>n&&(n=r.length+n),r.length>n){if(0>n){if(!o)return-1;n=0}}else{if(o)return-1;n=r.length-1}if("string"==typeof e&&(e=t.from(e,i)),t.isBuffer(e))return 0===e.length?-1:b(r,e,n,i,o);if("number"==typeof e)return e=255&e,t.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(r,e,n):Uint8Array.prototype.lastIndexOf.call(r,e,n):b(r,[e],n,i,o);throw new TypeError("val must be string, number or Buffer")}function b(t,r,e,n,i){function o(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}var u=1,s=t.length,h=r.length;if(void 0!==n&&(n=(n+"").toLowerCase(),"ucs2"===n||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(2>t.length||2>r.length)return-1;u=2,s/=2,h/=2,e/=2}var a;if(i){var f=-1;for(a=e;s>a;a++)if(o(t,a)===o(r,f===-1?0:a-f)){if(f===-1&&(f=a),a-f+1===h)return f*u}else f!==-1&&(a-=a-f),f=-1}else for(e+h>s&&(e=s-h),a=e;a>=0;a--){for(var l=!0,c=0;h>c;c++)if(o(t,a+c)!==o(r,c)){l=!1;break}if(l)return a}return-1}function _(t,r,e,n){e=+e||0;var i=t.length-e;n?(n=+n,n>i&&(n=i)):n=i;var o=r.length;if(o%2!==0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;n>u;++u){var s=parseInt(r.substr(2*u,2),16);if(isNaN(s))return u;t[e+u]=s}return u}function x(t,r,e,n){return J(Z(r,t.length-e),t,e,n)}function A(t,r,e,n){return J(z(r),t,e,n)}function E(t,r,e,n){return A(t,r,e,n)}function S(t,r,e,n){return J(V(r),t,e,n)}function T(t,r,e,n){return J(G(r,t.length-e),t,e,n)}function P(t,r,e){return K.fromByteArray(0===r&&e===t.length?t:t.slice(r,e))}function B(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;e>i;){var o=t[i],u=null,s=o>239?4:o>223?3:o>191?2:1;if(e>=i+s){var h,a,f,l;switch(s){case 1:128>o&&(u=o);break;case 2:h=t[i+1],128===(192&h)&&(l=(31&o)<<6|63&h,l>127&&(u=l));break;case 3:h=t[i+1],a=t[i+2],128===(192&h)&&128===(192&a)&&(l=(15&o)<<12|(63&h)<<6|63&a,l>2047&&(55296>l||l>57343)&&(u=l));break;case 4:h=t[i+1],a=t[i+2],f=t[i+3],128===(192&h)&&128===(192&a)&&128===(192&f)&&(l=(15&o)<<18|(63&h)<<12|(63&a)<<6|63&f,l>65535&&1114112>l&&(u=l))}}null===u?(u=65533,s=1):u>65535&&(u-=65536,n.push(u>>>10&1023|55296),u=56320|1023&u),n.push(u),i+=s}return R(n)}function R(t){var r=t.length;if(tt>=r)return String.fromCharCode.apply(String,t);for(var e="",n=0;r>n;)e+=String.fromCharCode.apply(String,t.slice(n,n+=tt));return e}function j(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;e>i;++i)n+=String.fromCharCode(127&t[i]);return n}function D(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;e>i;++i)n+=String.fromCharCode(t[i]);return n}function k(t,r,e){var n=t.length;r&&r>=0||(r=0),(!e||0>e||e>n)&&(e=n);for(var i="",o=r;e>o;++o)i+=H(t[o]);return i}function O(t,r,e){for(var n=t.slice(r,e),i="",o=0;n.length>o;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function L(t,r,e){if(t%1!==0||0>t)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function I(r,e,n,i,o,u){if(!t.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||u>e)throw new RangeError('"value" argument is out of bounds');if(n+i>r.length)throw new RangeError("Index out of range")}function C(t,r,e,n){0>r&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);o>i;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function Q(t,r,e,n){0>r&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);o>i;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function N(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(0>e)throw new RangeError("Index out of range")}function U(t,r,e,n,i){return i||N(t,r,e,4,3.4028234663852886e38,-3.4028234663852886e38),W.write(t,r,e,n,23,4),e+4}function F(t,r,e,n,i){return i||N(t,r,e,8,1.7976931348623157e308,-1.7976931348623157e308),W.write(t,r,e,n,52,8),e+8}function q(t){if(t=Y(t).replace(rt,""),2>t.length)return"";for(;t.length%4!==0;)t+="=";return t}function Y(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function H(t){return 16>t?"0"+t.toString(16):t.toString(16)}function Z(t,r){r=r||1/0;for(var e,n=t.length,i=null,o=[],u=0;n>u;++u){if(e=t.charCodeAt(u),e>55295&&57344>e){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(u+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(56320>e){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=(i-55296<<10|e-56320)+65536}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,128>e){if((r-=1)<0)break;o.push(e)}else if(2048>e){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(65536>e){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(e>=1114112)throw Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function z(t){for(var r=[],e=0;t.length>e;++e)r.push(255&t.charCodeAt(e));return r}function G(t,r){for(var e,n,i,o=[],u=0;t.length>u&&(r-=2)>=0;++u)e=t.charCodeAt(u),n=e>>8,i=e%256,o.push(i),o.push(n);return o}function V(t){return K.toByteArray(q(t))}function J(t,r,e,n){for(var i=0;n>i&&(i+eo;++o)if(r[o]!==e[o]){n=r[o],i=e[o];break}return i>n?-1:n>i?1:0},t.isEncoding=function(t){switch((t+"").toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},t.concat=function(r,e){if(!X(r))throw new TypeError('"list" argument must be an Array of Buffers');if(0===r.length)return t.alloc(0);var n;if(void 0===e)for(e=0,n=0;r.length>n;++n)e+=r[n].length;var i=t.allocUnsafe(e),o=0;for(n=0;r.length>n;++n){var u=r[n];if(!t.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(i,o),o+=u.length}return i},t.byteLength=v,t.prototype._isBuffer=!0,t.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;t>r;r+=2)w(this,r,r+1);return this},t.prototype.swap32=function(){var t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;t>r;r+=4)w(this,r,r+3),w(this,r+1,r+2);return this},t.prototype.swap64=function(){var t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;t>r;r+=8)w(this,r,r+7),w(this,r+1,r+6),w(this,r+2,r+5),w(this,r+3,r+4);return this},t.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?B(this,0,t):y.apply(this,arguments)},t.prototype.equals=function(r){if(!t.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r||0===t.compare(this,r)},t.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},t.prototype.compare=function(r,e,n,i,o){if(!t.isBuffer(r))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=r?r.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),0>e||n>r.length||0>i||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,i>>>=0,o>>>=0,this===r)return 0;for(var u=o-i,s=n-e,h=Math.min(u,s),a=this.slice(i,o),f=r.slice(e,n),l=0;h>l;++l)if(a[l]!==f[l]){u=a[l],s=f[l];break}return s>u?-1:u>s?1:0},t.prototype.includes=function(t,r,e){return this.indexOf(t,r,e)!==-1},t.prototype.indexOf=function(t,r,e){return M(this,t,r,e,!0)},t.prototype.lastIndexOf=function(t,r,e){return M(this,t,r,e,!1)},t.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r=0|r,isFinite(e)?(e=0|e,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(0>e||0>r)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return _(this,t,r,e);case"utf8":case"utf-8":return x(this,t,r,e);case"ascii":return A(this,t,r,e);case"latin1":case"binary":return E(this,t,r,e);case"base64":return S(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},t.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var tt=4096;t.prototype.slice=function(r,e){var n=this.length;r=~~r,e=void 0===e?n:~~e,0>r?(r+=n,0>r&&(r=0)):r>n&&(r=n),0>e?(e+=n,0>e&&(e=0)):e>n&&(e=n),r>e&&(e=r);var i;if(t.TYPED_ARRAY_SUPPORT)i=this.subarray(r,e),i.__proto__=t.prototype;else{var o=e-r;i=new t(o,(void 0));for(var u=0;o>u;++u)i[u]=this[u+r]}return i},t.prototype.readUIntLE=function(t,r,e){t=0|t,r=0|r,e||L(t,r,this.length);for(var n=this[t],i=1,o=0;++o0&&(i*=256);)n+=this[t+--r]*i;return n},t.prototype.readUInt8=function(t,r){return r||L(t,1,this.length),this[t]},t.prototype.readUInt16LE=function(t,r){return r||L(t,2,this.length),this[t]|this[t+1]<<8},t.prototype.readUInt16BE=function(t,r){return r||L(t,2,this.length),this[t]<<8|this[t+1]},t.prototype.readUInt32LE=function(t,r){return r||L(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},t.prototype.readUInt32BE=function(t,r){return r||L(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},t.prototype.readIntLE=function(t,r,e){t=0|t,r=0|r,e||L(t,r,this.length);for(var n=this[t],i=1,o=0;++on||(n-=Math.pow(2,8*r)),n},t.prototype.readIntBE=function(t,r,e){t=0|t,r=0|r,e||L(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return i*=128,i>o||(o-=Math.pow(2,8*r)),o},t.prototype.readInt8=function(t,r){return r||L(t,1,this.length),128&this[t]?(255-this[t]+1)*-1:this[t]},t.prototype.readInt16LE=function(t,r){r||L(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},t.prototype.readInt16BE=function(t,r){r||L(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},t.prototype.readInt32LE=function(t,r){return r||L(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},t.prototype.readInt32BE=function(t,r){return r||L(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},t.prototype.readFloatLE=function(t,r){return r||L(t,4,this.length),W.read(this,t,!0,23,4)},t.prototype.readFloatBE=function(t,r){return r||L(t,4,this.length),W.read(this,t,!1,23,4)},t.prototype.readDoubleLE=function(t,r){return r||L(t,8,this.length),W.read(this,t,!0,52,8)},t.prototype.readDoubleBE=function(t,r){return r||L(t,8,this.length),W.read(this,t,!1,52,8)},t.prototype.writeUIntLE=function(t,r,e,n){if(t=+t,r=0|r,e=0|e,!n){var i=Math.pow(2,8*e)-1;I(this,t,r,e,i,0)}var o=1,u=0;for(this[r]=255&t;++u=0&&(u*=256);)this[r+o]=t/u&255;return r+e},t.prototype.writeUInt8=function(r,e,n){return r=+r,e=0|e,n||I(this,r,e,1,255,0),t.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),this[e]=255&r,e+1},t.prototype.writeUInt16LE=function(r,e,n){return r=+r,e=0|e,n||I(this,r,e,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[e]=255&r,this[e+1]=r>>>8):C(this,r,e,!0),e+2},t.prototype.writeUInt16BE=function(r,e,n){return r=+r,e=0|e,n||I(this,r,e,2,65535,0),t.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=255&r):C(this,r,e,!1),e+2},t.prototype.writeUInt32LE=function(r,e,n){return r=+r,e=0|e,n||I(this,r,e,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[e+3]=r>>>24,this[e+2]=r>>>16,this[e+1]=r>>>8,this[e]=255&r):Q(this,r,e,!0),e+4},t.prototype.writeUInt32BE=function(r,e,n){return r=+r,e=0|e,n||I(this,r,e,4,4294967295,0),t.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=255&r):Q(this,r,e,!1),e+4},t.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r=0|r,!n){var i=Math.pow(2,8*e-1);I(this,t,r,e,i-1,-i)}var o=0,u=1,s=0;for(this[r]=255&t;++ot&&0===s&&0!==this[r+o-1]&&(s=1),this[r+o]=(t/u>>0)-s&255;return r+e},t.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r=0|r,!n){var i=Math.pow(2,8*e-1);I(this,t,r,e,i-1,-i)}var o=e-1,u=1,s=0;for(this[r+o]=255&t;--o>=0&&(u*=256);)0>t&&0===s&&0!==this[r+o+1]&&(s=1),this[r+o]=(t/u>>0)-s&255;return r+e},t.prototype.writeInt8=function(r,e,n){return r=+r,e=0|e,n||I(this,r,e,1,127,-128),t.TYPED_ARRAY_SUPPORT||(r=Math.floor(r)),0>r&&(r=255+r+1),this[e]=255&r,e+1},t.prototype.writeInt16LE=function(r,e,n){return r=+r,e=0|e,n||I(this,r,e,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[e]=255&r,this[e+1]=r>>>8):C(this,r,e,!0),e+2},t.prototype.writeInt16BE=function(r,e,n){return r=+r,e=0|e,n||I(this,r,e,2,32767,-32768),t.TYPED_ARRAY_SUPPORT?(this[e]=r>>>8,this[e+1]=255&r):C(this,r,e,!1),e+2},t.prototype.writeInt32LE=function(r,e,n){return r=+r,e=0|e,n||I(this,r,e,4,2147483647,-2147483648),t.TYPED_ARRAY_SUPPORT?(this[e]=255&r,this[e+1]=r>>>8,this[e+2]=r>>>16,this[e+3]=r>>>24):Q(this,r,e,!0),e+4},t.prototype.writeInt32BE=function(r,e,n){return r=+r,e=0|e,n||I(this,r,e,4,2147483647,-2147483648),0>r&&(r=4294967295+r+1),t.TYPED_ARRAY_SUPPORT?(this[e]=r>>>24,this[e+1]=r>>>16,this[e+2]=r>>>8,this[e+3]=255&r):Q(this,r,e,!1),e+4},t.prototype.writeFloatLE=function(t,r,e){return U(this,t,r,!0,e)},t.prototype.writeFloatBE=function(t,r,e){return U(this,t,r,!1,e)},t.prototype.writeDoubleLE=function(t,r,e){return F(this,t,r,!0,e)},t.prototype.writeDoubleBE=function(t,r,e){return F(this,t,r,!1,e)},t.prototype.copy=function(r,e,n,i){if(n||(n=0),i||0===i||(i=this.length),r.length>e||(e=r.length),e||(e=0),i>0&&n>i&&(i=n),i===n)return 0;if(0===r.length||0===this.length)return 0;if(0>e)throw new RangeError("targetStart out of bounds");if(0>n||n>=this.length)throw new RangeError("sourceStart out of bounds");if(0>i)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),i-n>r.length-e&&(i=r.length-e+n);var o,u=i-n;if(this===r&&e>n&&i>e)for(o=u-1;o>=0;--o)r[o+e]=this[o+n];else if(1e3>u||!t.TYPED_ARRAY_SUPPORT)for(o=0;u>o;++o)r[o+e]=this[o+n];else Uint8Array.prototype.set.call(r,this.subarray(n,n+u),e);return u},t.prototype.fill=function(r,e,n,i){if("string"==typeof r){if("string"==typeof e?(i=e,e=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===r.length){var o=r.charCodeAt(0);256>o&&(r=o)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!t.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof r&&(r=255&r);if(0>e||e>this.length||n>this.length)throw new RangeError("Out of range index");if(e>=n)return this;e>>>=0,n=void 0===n?this.length:n>>>0,r||(r=0);var u;if("number"==typeof r)for(u=e;n>u;++u)this[u]=r;else{var s=t.isBuffer(r)?r:Z(""+new t(r,i)),h=s.length;for(u=0;n-e>u;++u)this[u+e]=s[u%h]}return this};var rt=/[^+\/0-9A-Za-z-_]/g}).call(r,e(16).Buffer,e(107))},function(t,r){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,r,e){var n=e(7),i=e(1).document,o=n(i)&&n(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},function(t,r,e){"use strict";function n(t){var r,e;this.promise=new t(function(t,n){if(void 0!==r||void 0!==e)throw TypeError("Bad Promise constructor");r=t,e=n}),this.resolve=i(r),this.reject=i(e)}var i=e(10);t.exports.f=function(t){return new n(t)}},function(t,r,e){var n=e(78),i=e(31);t.exports=Object.keys||function(t){return n(t,i)}},function(t,r,e){var n=e(9).f,i=e(14),o=e(2)("toStringTag");t.exports=function(t,r,e){t&&!i(t=e?t:t.prototype,o)&&n(t,o,{configurable:!0,value:r})}},function(t,r,e){var n=e(39)("keys"),i=e(43);t.exports=function(t){return n[t]||(n[t]=i(t))}},function(t,r){var e=Math.ceil,n=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?n:e)(t)}},function(t,r,e){var n=e(33),i=e(17);t.exports=function(t){return n(i(t))}},function(t,r,e){var n=e(17);t.exports=function(t){return Object(n(t))}},function(t,r,e){(function(t,n){function i(t,r){this._id=t,this._clearFn=r}var o=e(106).nextTick,u=Function.prototype.apply,s=Array.prototype.slice,h={},a=0;r.setTimeout=function(){return new i(u.call(setTimeout,window,arguments),clearTimeout)},r.setInterval=function(){return new i(u.call(setInterval,window,arguments),clearInterval)},r.clearTimeout=r.clearInterval=function(t){t.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(window,this._id)},r.enroll=function(t,r){clearTimeout(t._idleTimeoutId),t._idleTimeout=r},r.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},r._unrefActive=r.active=function(t){clearTimeout(t._idleTimeoutId);var r=t._idleTimeout;0>r||(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},r))},r.setImmediate="function"==typeof t?t:function(t){var e=a++,n=arguments.length>=2&&s.call(arguments,1);return h[e]=!0,o(function(){h[e]&&(n?t.apply(null,n):t.call(null),r.clearImmediate(e))}),e},r.clearImmediate="function"==typeof n?n:function(t){delete h[t]}}).call(r,e(26).setImmediate,e(26).clearImmediate)},function(t,r,e){t.exports={"default":e(56),__esModule:!0}},function(t,r,e){"use strict";var n=e(100),i=e(105);t.exports=function(t){if(!n(t.then))throw new TypeError("Expected a promise");return function(r){t.then(function(t){i(r,null,t)},function(t){i(r,t)})}}},function(t,r){"use strict";t.exports=function(t){if("string"!=typeof t)throw Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof t+", while checking isHexPrefixed.");return"0x"===t.slice(0,2)}},function(t,r,e){var n=e(11),i=e(2)("toStringTag"),o="Arguments"==n(function(){return arguments}()),u=function(t,r){try{return t[r]}catch(e){}};t.exports=function(t){var r,e,s;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=u(r=Object(t),i))?e:o?n(r):"Object"==(s=n(r))&&"function"==typeof r.callee?"Arguments":s}},function(t,r){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,r,e){var n=e(1).document;t.exports=n&&n.documentElement},function(t,r,e){var n=e(11);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==n(t)?t.split(""):Object(t)}},function(t,r,e){"use strict";var n=e(35),i=e(4),o=e(82),u=e(6),s=e(8),h=e(69),a=e(21),f=e(77),l=e(2)("iterator"),c=!([].keys&&"next"in[].keys()),p="@@iterator",m="keys",d="values",g=function(){return this};t.exports=function(t,r,e,v,y,w,M){h(e,r,v);var b,_,x,A=function(t){if(!c&&t in P)return P[t];switch(t){case m:return function(){return new e(this,t)};case d:return function(){return new e(this,t)}}return function(){return new e(this,t)}},E=r+" Iterator",S=y==d,T=!1,P=t.prototype,B=P[l]||P[p]||y&&P[y],R=B||A(y),j=y?S?A("entries"):R:void 0,D="Array"==r?P.entries||B:B;if(D&&(x=f(D.call(new t)),x!==Object.prototype&&x.next&&(a(x,E,!0),n||"function"==typeof x[l]||u(x,l,g))),S&&B&&B.name!==d&&(T=!0,R=function(){return B.call(this)}),n&&!M||!c&&!T&&P[l]||u(P,l,R),s[r]=R,s[E]=g,y)if(b={values:S?R:A(d),keys:w?R:A(m),entries:j},M)for(_ in b)_ in P||o(P,_,b[_]);else i(i.P+i.F*(c||T),r,b);return b}},function(t,r){t.exports=!0},function(t,r){t.exports=function(t){try{return{e:!1,v:t()}}catch(r){return{e:!0,v:r}}}},function(t,r,e){var n=e(3),i=e(7),o=e(19);t.exports=function(t,r){if(n(t),i(r)&&r.constructor===t)return r;var e=o.f(t),u=e.resolve;return u(r),e.promise}},function(t,r){t.exports=function(t,r){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:r}}},function(t,r,e){var n=e(1),i="__core-js_shared__",o=n[i]||(n[i]={});t.exports=function(t){return o[t]||(o[t]={})}},function(t,r,e){var n=e(3),i=e(10),o=e(2)("species");t.exports=function(t,r){var e,u=n(t).constructor;return void 0===u||void 0==(e=n(u)[o])?r:i(e)}},function(t,r,e){var n,i,o,u=e(12),s=e(66),h=e(32),a=e(18),f=e(1),l=f.process,c=f.setImmediate,p=f.clearImmediate,m=f.MessageChannel,d=f.Dispatch,g=0,v={},y="onreadystatechange",w=function(){var t=+this;if(v.hasOwnProperty(t)){var r=v[t];delete v[t],r()}},M=function(t){w.call(t.data)};c&&p||(c=function(t){for(var r=[],e=1;arguments.length>e;)r.push(arguments[e++]);return v[++g]=function(){s("function"==typeof t?t:Function(t),r)},n(g),g},p=function(t){delete v[t]},"process"==e(11)(l)?n=function(t){l.nextTick(u(w,t,1))}:d&&d.now?n=function(t){d.now(u(w,t,1))}:m?(i=new m,o=i.port2,i.port1.onmessage=M,n=u(o.postMessage,o,1)):f.addEventListener&&"function"==typeof postMessage&&!f.importScripts?(n=function(t){f.postMessage(t+"","*")},f.addEventListener("message",M,!1)):n=y in a("script")?function(t){h.appendChild(a("script"))[y]=function(){h.removeChild(this),w.call(t)}}:function(t){setTimeout(u(w,t,1),0)}),t.exports={set:c,clear:p}},function(t,r,e){var n=e(23),i=Math.min;t.exports=function(t){return t>0?i(n(t),9007199254740991):0}},function(t,r){var e=0,n=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+n).toString(36))}},function(t,r,e){t.exports={"default":e(57),__esModule:!0}},function(t,r,e){t.exports={"default":e(58),__esModule:!0}},function(t,r,e){t.exports={"default":e(59),__esModule:!0}},function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}r.__esModule=!0;var i=e(53),o=n(i);r["default"]=function(t){return function(){var r=t.apply(this,arguments);return new o["default"](function(t,e){function n(i,u){try{var s=r[i](u),h=s.value}catch(a){return void e(a)}return s.done?void t(h):o["default"].resolve(h).then(function(t){n("next",t)},function(t){n("throw",t)})}return n("next")})}}},function(t,r,e){t.exports=e(103)},function(t,r,e){"use strict";function n(t,r,e){if(["string","number","object"].indexOf(typeof t)===-1||null===t)return t;var n=p(t),i=e&&n.toString(16).length%2?"0":"";if(p(t).isNeg())throw Error("[ethjs-format] while formatting quantity '"+n.toString(10)+"', invalid negative number. Number must be positive or zero.");return r?"0x"+i+n.toString(16):n}function i(t,r){var e=t;return l.tags.indexOf(t)===-1&&(e=n(t,r)),e}function o(t,r){var e=t,n=0;if("string"==typeof t&&(e="0x"+d(m(t)),n=v(e)),"0x00"===e&&(e="0x0"),"number"==typeof r&&null!==t&&"0x"!==e&&"0x0"!==e&&(!/^[0-9A-Fa-f]+$/.test(m(e))||n!==2+2*r))throw Error("[ethjs-format] hex string '"+e+"' must be an alphanumeric "+(2+2*r)+" utf8 byte hex (chars: a-fA-F) string, is "+n+" bytes");return e}function u(t,r,e){var n=Object.assign({},r),i=null;if("string"==typeof t&&(i="Boolean|EthSyncing"===t?Object.assign({},l.objects.EthSyncing):"DATA|Transaction"===t?Object.assign({},l.objects.Transaction):Object.assign({},l.objects[t])),!g(Object.keys(r),i.__required))throw Error("[ethjs-format] object "+JSON.stringify(r)+" must contain properties: "+i.__required.join(", "));return Object.keys(i).forEach(function(t){"__required"!==t&&void 0!==r[t]&&(n[t]=h(i[t],r[t],e))}),n}function s(t,r,e,n){var i=r.slice(),o=t;if("Array|DATA"===t&&(o=["D"]),"FilterChange"===t&&"string"==typeof r[0]&&(o=["D32"]),e===!0&&"number"==typeof n&&n>r.length)throw Error("array "+JSON.stringify(r)+" must contain at least "+n+" params, but only contains "+r.length+".");return o=o.slice(),r.forEach(function(t,r){var n=0;o.length>1&&(n=r),i[r]=h(o[n],t,e)}),i}function h(t,r,e,h){var a=r;return"Q"===t?a=n(r,e):"QP"===t?a=n(r,e,!0):"Q|T"===t?a=i(r,e):"D"===t?a=o(r):"D20"===t?a=o(r,20):"D32"===t?a=o(r,32):"object"==typeof r&&null!==r&&Array.isArray(r)===!1?a=u(t,r,e):Array.isArray(r)&&(a=s(t,r,e,h)),a}function a(t,r){return h(l.methods[t][0],r,!0,l.methods[t][2])}function f(t,r){return h(l.methods[t][1],r,!1)}var l=e(102),c=e(98),p=e(52),m=e(15),d=c.padToEven,g=c.arrayContainsArray,v=c.getBinarySize;t.exports={schema:l,formatQuantity:n,formatQuantityOrTag:i,formatObject:u,formatArray:s,format:h,formatInputs:a,formatOutputs:f}},function(t,r,e){ 2 | "use strict";function n(t,r){var e=this,i=r||{};if(!(this instanceof n))throw Error('[ethjs-rpc] the EthRPC object requires the "new" flag in order to function normally (i.e. `const eth = new EthRPC(provider);`).');e.options=Object.assign({jsonSpace:i.jsonSpace||0,max:i.max||9999999999999}),e.idCounter=Math.floor(Math.random()*e.options.max),(e.setProvider=function(t){if("object"!=typeof t)throw Error("[ethjs-rpc] the EthRPC object requires that the first input 'provider' must be an object, got '"+typeof t+"' (i.e. 'const eth = new EthRPC(provider);')");e.currentProvider=t})(t)}function i(t,r){return Object.assign({},{id:r,jsonrpc:"2.0",params:[]},t)}var o=e(28);t.exports=n,n.prototype.sendAsync=function(t,r){var e=this;e.idCounter=e.idCounter%e.options.max;var n=i(t,e.idCounter++),u=new Promise(function(t,r){e.currentProvider.sendAsync(n,function(i,o){var u=o||{};if(i||u.error){var s="[ethjs-rpc] "+(u.error&&"rpc"||"")+" error with payload "+JSON.stringify(n,null,e.options.jsonSpace)+" "+(i?i+"":JSON.stringify(u.error,null,e.options.jsonSpace)),h=Error(s);return h.value=i||u.error,void r(h)}t(u.result)})});return r?o(u)(r):u}},function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function i(t,r){var e=this,n=r||{};if(!(this instanceof i))throw Error('[ethjs-query] the Eth object requires the "new" flag in order to function normally (i.e. `const eth = new Eth(provider);`).');if("object"!=typeof t)throw Error("[ethjs-query] the Eth object requires that the first input 'provider' must be an object, got '"+typeof t+"' (i.e. 'const eth = new Eth(provider);')");e.options=(0,v["default"])({debug:n.debug||!1,logger:n.logger||console,jsonSpace:n.jsonSpace||0}),e.rpc=new w(t),e.setProvider=e.rpc.setProvider}function o(t,r){return function(){var e=function(){var e=(0,l["default"])(s["default"].mark(function n(){var e,f,l;return s["default"].wrap(function(n){for(;;)switch(n.prev=n.next){case 0:if(r[2]<=u.length){n.next=2;break}throw Error("[ethjs-query] method '"+h+"' requires at least "+r[2]+" input (format type "+r[0][0]+"), "+u.length+" provided. For more information visit: https://github.com/ethereum/wiki/wiki/JSON-RPC#"+t.toLowerCase());case 2:if(u.length<=r[0].length){n.next=4;break}throw Error("[ethjs-query] method '"+h+"' requires at most "+r[0].length+" params, "+u.length+" provided '"+(0,a["default"])(u,null,o.options.jsonSpace)+"'. For more information visit: https://github.com/ethereum/wiki/wiki/JSON-RPC#"+t.toLowerCase());case 4:r[3]&&r[3]>u.length&&u.push("latest"),this.log("attempting method formatting for '"+h+"' with inputs "+(0,a["default"])(u,null,this.options.jsonSpace)),n.prev=6,i=y.formatInputs(t,u),this.log("method formatting success for '"+h+"' with formatted result: "+(0,a["default"])(i,null,this.options.jsonSpace)),n.next=14;break;case 11:throw n.prev=11,n.t0=n["catch"](6),Error("[ethjs-query] while formatting inputs '"+(0,a["default"])(u,null,this.options.jsonSpace)+"' for method '"+h+"' error: "+n.t0);case 14:return n.next=16,this.rpc.sendAsync({method:t,params:i});case 16:return e=n.sent,n.prev=17,this.log("attempting method formatting for '"+h+"' with raw outputs: "+(0,a["default"])(e,null,this.options.jsonSpace)),f=y.formatOutputs(t,e),this.log("method formatting success for '"+h+"' formatted result: "+(0,a["default"])(f,null,this.options.jsonSpace)),n.abrupt("return",f);case 24:throw n.prev=24,n.t1=n["catch"](17),l=Error("[ethjs-query] while formatting outputs from RPC '"+(0,a["default"])(e,null,this.options.jsonSpace)+"' for method '"+h+"' "+n.t1);case 28:case"end":return n.stop()}},n,this,[[6,11],[17,24]])}));return function(){return e.apply(this,arguments)}}(),n=null,i=null,o=this,u=[].slice.call(arguments),h=t.replace("eth_","");u.length>0&&"function"==typeof u[u.length-1]&&(n=u.pop());var f=e.call(this);return n?M(f)(n):f}}var u=e(48),s=n(u),h=e(27),a=n(h),f=e(47),l=n(f),c=e(45),p=n(c),m=e(46),d=n(m),g=e(44),v=n(g),y=e(49),w=e(50),M=e(28);t.exports=i,i.prototype.log=function(t){var r=this;r.options.debug&&r.options.logger.log("[ethjs-query log] "+t)},(0,d["default"])(y.schema.methods).forEach(function(t){(0,p["default"])(i.prototype,t.replace("eth_",""),{enumerable:!0,value:o(t,y.schema.methods[t])})})},function(t,r,e){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var i=e(27),o=n(i),u=e(55),s=e(15);t.exports=function(t){if("string"==typeof t||"number"==typeof t){var r=new u(1),e=(t+"").toLowerCase().trim(),n="0x"===e.substr(0,2)||"-0x"===e.substr(0,3),i=s(e);if("-"===i.substr(0,1)&&(i=s(i.slice(1)),r=new u((-1),10)),i=""===i?"0":i,!i.match(/^-?[0-9]+$/)&&i.match(/^[0-9A-Fa-f]+$/)||i.match(/^[a-fA-F]+$/)||n===!0&&i.match(/^[0-9A-Fa-f]+$/))return new u(i,16).mul(r);if((i.match(/^-?[0-9]+$/)||""===i)&&n===!1)return new u(i,10).mul(r)}else if("object"==typeof t&&t.toString&&!t.pop&&!t.push&&t.toString(10).match(/^-?[0-9]+$/)&&(t.mul||t.dividedToIntegerBy))return new u(t.toString(10),10);throw Error("[number-to-bn] while converting number "+(0,o["default"])(t)+" to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.")}},function(t,r,e){t.exports={"default":e(60),__esModule:!0}},function(t,r){"use strict";function e(t){var r=t.length;if(r%4>0)throw Error("Invalid string. Length must be a multiple of 4");return"="===t[r-2]?2:"="===t[r-1]?1:0}function n(t){return 3*t.length/4-e(t)}function i(t){var r,n,i,o,u,s=t.length;o=e(t),u=new f(3*s/4-o),n=o>0?s-4:s;var h=0;for(r=0;n>r;r+=4)i=a[t.charCodeAt(r)]<<18|a[t.charCodeAt(r+1)]<<12|a[t.charCodeAt(r+2)]<<6|a[t.charCodeAt(r+3)],u[h++]=i>>16&255,u[h++]=i>>8&255,u[h++]=255&i;return 2===o?(i=a[t.charCodeAt(r)]<<2|a[t.charCodeAt(r+1)]>>4,u[h++]=255&i):1===o&&(i=a[t.charCodeAt(r)]<<10|a[t.charCodeAt(r+1)]<<4|a[t.charCodeAt(r+2)]>>2,u[h++]=i>>8&255,u[h++]=255&i),u}function o(t){return h[t>>18&63]+h[t>>12&63]+h[t>>6&63]+h[63&t]}function u(t,r,e){for(var n,i=[],u=r;e>u;u+=3)n=(t[u]<<16&16711680)+(t[u+1]<<8&65280)+(255&t[u+2]),i.push(o(n));return i.join("")}function s(t){for(var r,e=t.length,n=e%3,i="",o=[],s=16383,a=0,f=e-n;f>a;a+=s)o.push(u(t,a,a+s>f?f:a+s));return 1===n?(r=t[e-1],i+=h[r>>2],i+=h[r<<4&63],i+="=="):2===n&&(r=(t[e-2]<<8)+t[e-1],i+=h[r>>10],i+=h[r>>4&63],i+=h[r<<2&63],i+="="),o.push(i),o.join("")}r.byteLength=n,r.toByteArray=i,r.fromByteArray=s;for(var h=[],a=[],f="undefined"!=typeof Uint8Array?Uint8Array:Array,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",c=0,p=l.length;p>c;++c)h[c]=l[c],a[l.charCodeAt(c)]=c;a["-".charCodeAt(0)]=62,a["_".charCodeAt(0)]=63},function(t,r,e){(function(t){!function(t,r){"use strict";function n(t,r){if(!t)throw Error(r||"Assertion failed")}function i(t,r){t.super_=r;var e=function(){};e.prototype=r.prototype,t.prototype=new e,t.prototype.constructor=t}function o(t,r,e){return o.isBN(t)?t:(this.negative=0,this.words=null,this.length=0,this.red=null,void(null!==t&&("le"!==r&&"be"!==r||(e=r,r=10),this._init(t||0,r||10,e||"be"))))}function u(t,r,e){for(var n=0,i=Math.min(t.length,e),o=r;i>o;o++){var u=t.charCodeAt(o)-48;n<<=4,n|=49>u||u>54?17>u||u>22?15&u:u-17+10:u-49+10}return n}function s(t,r,e,n){for(var i=0,o=Math.min(t.length,e),u=r;o>u;u++){var s=t.charCodeAt(u)-48;i*=n,i+=49>s?17>s?s:s-17+10:s-49+10}return i}function h(t){for(var r=Array(t.bitLength()),e=0;r.length>e;e++){var n=e/26|0,i=e%26;r[e]=(t.words[n]&1<>>i}return r}function a(t,r,e){e.negative=r.negative^t.negative;var n=t.length+r.length|0;e.length=n,n=n-1|0;var i=0|t.words[0],o=0|r.words[0],u=i*o,s=67108863&u,h=u/67108864|0;e.words[0]=s;for(var a=1;n>a;a++){for(var f=h>>>26,l=67108863&h,c=Math.min(a,r.length-1),p=Math.max(0,a-t.length+1);c>=p;p++){var m=a-p|0;i=0|t.words[m],o=0|r.words[p],u=i*o+l,f+=u/67108864|0,l=67108863&u}e.words[a]=0|l,h=0|f}return 0!==h?e.words[a]=0|h:e.length--,e.strip()}function f(t,r,e){e.negative=r.negative^t.negative,e.length=t.length+r.length;for(var n=0,i=0,o=0;e.length-1>o;o++){var u=i;i=0;for(var s=67108863&n,h=Math.min(o,r.length-1),a=Math.max(0,o-t.length+1);h>=a;a++){var f=o-a,l=0|t.words[f],c=0|r.words[a],p=l*c,m=67108863&p;u=u+(p/67108864|0)|0,m=m+s|0,s=67108863&m,u=u+(m>>>26)|0,i+=u>>>26,u&=67108863}e.words[o]=s,n=u,u=i}return 0!==n?e.words[o]=n:e.length--,e.strip()}function l(t,r,e){var n=new c;return n.mulp(t,r,e)}function c(t,r){this.x=t,this.y=r}function p(t,r){this.name=t,this.p=new o(r,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function m(){p.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function d(){p.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function g(){p.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function v(){p.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function y(t){if("string"==typeof t){var r=o._prime(t);this.m=r.p,this.prime=r}else n(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function w(t){y.call(this,t),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}"object"==typeof t?t.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var M;try{M=e(16).Buffer}catch(b){}o.isBN=function(t){return t instanceof o||null!==t&&"object"==typeof t&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,r){return t.cmp(r)>0?t:r},o.min=function(t,r){return t.cmp(r)<0?t:r},o.prototype._init=function(t,r,e){if("number"==typeof t)return this._initNumber(t,r,e);if("object"==typeof t)return this._initArray(t,r,e);"hex"===r&&(r=16),n(r===(0|r)&&r>=2&&36>=r),t=(""+t).replace(/\s+/g,"");var i=0;"-"===t[0]&&i++,16===r?this._parseHex(t,i):this._parseBase(t,r,i),"-"===t[0]&&(this.negative=1),this.strip(),"le"===e&&this._initArray(this.toArray(),r,e)},o.prototype._initNumber=function(t,r,e){0>t&&(this.negative=1,t=-t),67108864>t?(this.words=[67108863&t],this.length=1):4503599627370496>t?(this.words=[67108863&t,t/67108864&67108863],this.length=2):(n(9007199254740992>t),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===e&&this._initArray(this.toArray(),r,e)},o.prototype._initArray=function(t,r,e){if(n("number"==typeof t.length),0>=t.length)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=Array(this.length);for(var i=0;this.length>i;i++)this.words[i]=0;var o,u,s=0;if("be"===e)for(i=t.length-1,o=0;i>=0;i-=3)u=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[o]|=u<>>26-s&67108863,s+=24,26>s||(s-=26,o++);else if("le"===e)for(i=0,o=0;t.length>i;i+=3)u=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[o]|=u<>>26-s&67108863,s+=24,26>s||(s-=26,o++);return this.strip()},o.prototype._parseHex=function(t,r){this.length=Math.ceil((t.length-r)/6),this.words=Array(this.length);for(var e=0;this.length>e;e++)this.words[e]=0;var n,i,o=0;for(e=t.length-6,n=0;e>=r;e-=6)i=u(t,e,e+6),this.words[n]|=i<>>26-o&4194303,o+=24,26>o||(o-=26,n++);e+6!==r&&(i=u(t,r,e+6),this.words[n]|=i<>>26-o&4194303),this.strip()},o.prototype._parseBase=function(t,r,e){this.words=[0],this.length=1;for(var n=0,i=1;67108863>=i;i*=r)n++;n--,i=i/r|0;for(var o=t.length-e,u=o%n,h=Math.min(o,o-u)+e,a=0,f=e;h>f;f+=n)a=s(t,f,f+n,r),this.imuln(i),67108864>this.words[0]+a?this.words[0]+=a:this._iaddn(a);if(0!==u){var l=1;for(a=s(t,f,t.length,r),f=0;u>f;f++)l*=r;this.imuln(l),67108864>this.words[0]+a?this.words[0]+=a:this._iaddn(a)}},o.prototype.copy=function(t){t.words=Array(this.length);for(var r=0;this.length>r;r++)t.words[r]=this.words[r];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;t>this.length;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},o.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?""};var _=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],x=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],A=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(t,r){t=t||10,r=0|r||1;var e;if(16===t||"hex"===t){e="";for(var i=0,o=0,u=0;this.length>u;u++){var s=this.words[u],h=(16777215&(s<>>24-i&16777215,e=0!==o||u!==this.length-1?_[6-h.length]+h+e:h+e,i+=2,26>i||(i-=26,u--)}for(0!==o&&(e=o.toString(16)+e);e.length%r!==0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}if(t===(0|t)&&t>=2&&36>=t){var a=x[t],f=A[t];e="";var l=this.clone();for(l.negative=0;!l.isZero();){var c=l.modn(f).toString(t);l=l.idivn(f),e=l.isZero()?c+e:_[a-c.length]+c+e}for(this.isZero()&&(e="0"+e);e.length%r!==0;)e="0"+e;return 0!==this.negative&&(e="-"+e),e}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,r){return n(void 0!==M),this.toArrayLike(M,t,r)},o.prototype.toArray=function(t,r){return this.toArrayLike(Array,t,r)},o.prototype.toArrayLike=function(t,r,e){var i=this.byteLength(),o=e||Math.max(1,i);n(o>=i,"byte array longer than desired length"),n(o>0,"Requested array length <= 0"),this.strip();var u,s,h="le"===r,a=new t(o),f=this.clone();if(h){for(s=0;!f.isZero();s++)u=f.andln(255),f.iushrn(8),a[s]=u;for(;o>s;s++)a[s]=0}else{for(s=0;o-i>s;s++)a[s]=0;for(s=0;!f.isZero();s++)u=f.andln(255),f.iushrn(8),a[o-s-1]=u}return a},o.prototype._countBits=Math.clz32?function(t){return 32-Math.clz32(t)}:function(t){var r=t,e=0;return 4096>r||(e+=13,r>>>=13),64>r||(e+=7,r>>>=7),8>r||(e+=4,r>>>=4),2>r||(e+=2,r>>>=2),e+r},o.prototype._zeroBits=function(t){if(0===t)return 26;var r=t,e=0;return 0===(8191&r)&&(e+=13,r>>>=13),0===(127&r)&&(e+=7,r>>>=7),0===(15&r)&&(e+=4,r>>>=4),0===(3&r)&&(e+=2,r>>>=2),0===(1&r)&&e++,e},o.prototype.bitLength=function(){var t=this.words[this.length-1],r=this._countBits(t);return 26*(this.length-1)+r},o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,r=0;this.length>r;r++){var e=this._zeroBits(this.words[r]);if(t+=e,26!==e)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return 0!==this.negative},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;t.length>this.length;)this.words[this.length++]=0;for(var r=0;t.length>r;r++)this.words[r]=this.words[r]|t.words[r];return this.strip()},o.prototype.ior=function(t){return n(0===(this.negative|t.negative)),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var r;r=this.length>t.length?t:this;for(var e=0;r.length>e;e++)this.words[e]=this.words[e]&t.words[e];return this.length=r.length,this.strip()},o.prototype.iand=function(t){return n(0===(this.negative|t.negative)),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var r,e;this.length>t.length?(r=this,e=t):(r=t,e=this);for(var n=0;e.length>n;n++)this.words[n]=r.words[n]^e.words[n];if(this!==r)for(;r.length>n;n++)this.words[n]=r.words[n];return this.length=r.length,this.strip()},o.prototype.ixor=function(t){return n(0===(this.negative|t.negative)),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var r=0|Math.ceil(t/26),e=t%26;this._expand(r),e>0&&r--;for(var i=0;r>i;i++)this.words[i]=67108863&~this.words[i];return e>0&&(this.words[i]=~this.words[i]&67108863>>26-e),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,r){n("number"==typeof t&&t>=0);var e=t/26|0,i=t%26;return this._expand(e+1),this.words[e]=r?this.words[e]|1<t.length?(e=this,n=t):(e=t,n=this);for(var i=0,o=0;n.length>o;o++)r=(0|e.words[o])+(0|n.words[o])+i,this.words[o]=67108863&r,i=r>>>26;for(;0!==i&&e.length>o;o++)r=(0|e.words[o])+i,this.words[o]=67108863&r,i=r>>>26;if(this.length=e.length,0!==i)this.words[this.length]=i,this.length++;else if(e!==this)for(;e.length>o;o++)this.words[o]=e.words[o];return this},o.prototype.add=function(t){var r;return 0!==t.negative&&0===this.negative?(t.negative=0,r=this.sub(t),t.negative^=1,r):0===t.negative&&0!==this.negative?(this.negative=0,r=t.sub(this),this.negative=1,r):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var r=this.iadd(t);return t.negative=1,r._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var e=this.cmp(t);if(0===e)return this.negative=0,this.length=1,this.words[0]=0,this;var n,i;e>0?(n=this,i=t):(n=t,i=this);for(var o=0,u=0;i.length>u;u++)r=(0|n.words[u])-(0|i.words[u])+o,o=r>>26,this.words[u]=67108863&r;for(;0!==o&&n.length>u;u++)r=(0|n.words[u])+o,o=r>>26,this.words[u]=67108863&r;if(0===o&&n.length>u&&n!==this)for(;n.length>u;u++)this.words[u]=n.words[u];return this.length=Math.max(this.length,u),n!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};var E=function(t,r,e){var n,i,o,u=t.words,s=r.words,h=e.words,a=0,f=0|u[0],l=8191&f,c=f>>>13,p=0|u[1],m=8191&p,d=p>>>13,g=0|u[2],v=8191&g,y=g>>>13,w=0|u[3],M=8191&w,b=w>>>13,_=0|u[4],x=8191&_,A=_>>>13,E=0|u[5],S=8191&E,T=E>>>13,P=0|u[6],B=8191&P,R=P>>>13,j=0|u[7],D=8191&j,k=j>>>13,O=0|u[8],L=8191&O,I=O>>>13,C=0|u[9],Q=8191&C,N=C>>>13,U=0|s[0],F=8191&U,q=U>>>13,Y=0|s[1],H=8191&Y,Z=Y>>>13,z=0|s[2],G=8191&z,V=z>>>13,J=0|s[3],$=8191&J,K=J>>>13,W=0|s[4],X=8191&W,tt=W>>>13,rt=0|s[5],et=8191&rt,nt=rt>>>13,it=0|s[6],ot=8191&it,ut=it>>>13,st=0|s[7],ht=8191&st,at=st>>>13,ft=0|s[8],lt=8191&ft,ct=ft>>>13,pt=0|s[9],mt=8191&pt,dt=pt>>>13;e.negative=t.negative^r.negative,e.length=19,n=Math.imul(l,F),i=Math.imul(l,q),i=i+Math.imul(c,F)|0,o=Math.imul(c,q);var gt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(m,F),i=Math.imul(m,q),i=i+Math.imul(d,F)|0,o=Math.imul(d,q),n=n+Math.imul(l,H)|0,i=i+Math.imul(l,Z)|0,i=i+Math.imul(c,H)|0,o=o+Math.imul(c,Z)|0;var vt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,F),i=Math.imul(v,q),i=i+Math.imul(y,F)|0,o=Math.imul(y,q),n=n+Math.imul(m,H)|0,i=i+Math.imul(m,Z)|0,i=i+Math.imul(d,H)|0,o=o+Math.imul(d,Z)|0,n=n+Math.imul(l,G)|0,i=i+Math.imul(l,V)|0,i=i+Math.imul(c,G)|0,o=o+Math.imul(c,V)|0;var yt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(M,F),i=Math.imul(M,q),i=i+Math.imul(b,F)|0,o=Math.imul(b,q),n=n+Math.imul(v,H)|0,i=i+Math.imul(v,Z)|0,i=i+Math.imul(y,H)|0,o=o+Math.imul(y,Z)|0,n=n+Math.imul(m,G)|0,i=i+Math.imul(m,V)|0,i=i+Math.imul(d,G)|0,o=o+Math.imul(d,V)|0,n=n+Math.imul(l,$)|0,i=i+Math.imul(l,K)|0,i=i+Math.imul(c,$)|0,o=o+Math.imul(c,K)|0;var wt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(x,F),i=Math.imul(x,q),i=i+Math.imul(A,F)|0,o=Math.imul(A,q),n=n+Math.imul(M,H)|0,i=i+Math.imul(M,Z)|0,i=i+Math.imul(b,H)|0,o=o+Math.imul(b,Z)|0,n=n+Math.imul(v,G)|0,i=i+Math.imul(v,V)|0,i=i+Math.imul(y,G)|0,o=o+Math.imul(y,V)|0,n=n+Math.imul(m,$)|0,i=i+Math.imul(m,K)|0,i=i+Math.imul(d,$)|0,o=o+Math.imul(d,K)|0,n=n+Math.imul(l,X)|0,i=i+Math.imul(l,tt)|0,i=i+Math.imul(c,X)|0,o=o+Math.imul(c,tt)|0;var Mt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(S,F),i=Math.imul(S,q),i=i+Math.imul(T,F)|0,o=Math.imul(T,q),n=n+Math.imul(x,H)|0,i=i+Math.imul(x,Z)|0,i=i+Math.imul(A,H)|0,o=o+Math.imul(A,Z)|0,n=n+Math.imul(M,G)|0,i=i+Math.imul(M,V)|0,i=i+Math.imul(b,G)|0,o=o+Math.imul(b,V)|0,n=n+Math.imul(v,$)|0,i=i+Math.imul(v,K)|0,i=i+Math.imul(y,$)|0,o=o+Math.imul(y,K)|0,n=n+Math.imul(m,X)|0,i=i+Math.imul(m,tt)|0,i=i+Math.imul(d,X)|0,o=o+Math.imul(d,tt)|0,n=n+Math.imul(l,et)|0,i=i+Math.imul(l,nt)|0,i=i+Math.imul(c,et)|0,o=o+Math.imul(c,nt)|0;var bt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(B,F),i=Math.imul(B,q),i=i+Math.imul(R,F)|0,o=Math.imul(R,q),n=n+Math.imul(S,H)|0,i=i+Math.imul(S,Z)|0,i=i+Math.imul(T,H)|0,o=o+Math.imul(T,Z)|0,n=n+Math.imul(x,G)|0,i=i+Math.imul(x,V)|0,i=i+Math.imul(A,G)|0,o=o+Math.imul(A,V)|0,n=n+Math.imul(M,$)|0,i=i+Math.imul(M,K)|0,i=i+Math.imul(b,$)|0,o=o+Math.imul(b,K)|0,n=n+Math.imul(v,X)|0,i=i+Math.imul(v,tt)|0,i=i+Math.imul(y,X)|0,o=o+Math.imul(y,tt)|0,n=n+Math.imul(m,et)|0,i=i+Math.imul(m,nt)|0,i=i+Math.imul(d,et)|0,o=o+Math.imul(d,nt)|0,n=n+Math.imul(l,ot)|0,i=i+Math.imul(l,ut)|0,i=i+Math.imul(c,ot)|0,o=o+Math.imul(c,ut)|0;var _t=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(D,F),i=Math.imul(D,q),i=i+Math.imul(k,F)|0,o=Math.imul(k,q),n=n+Math.imul(B,H)|0,i=i+Math.imul(B,Z)|0,i=i+Math.imul(R,H)|0,o=o+Math.imul(R,Z)|0,n=n+Math.imul(S,G)|0,i=i+Math.imul(S,V)|0,i=i+Math.imul(T,G)|0,o=o+Math.imul(T,V)|0,n=n+Math.imul(x,$)|0,i=i+Math.imul(x,K)|0,i=i+Math.imul(A,$)|0,o=o+Math.imul(A,K)|0,n=n+Math.imul(M,X)|0,i=i+Math.imul(M,tt)|0,i=i+Math.imul(b,X)|0,o=o+Math.imul(b,tt)|0,n=n+Math.imul(v,et)|0,i=i+Math.imul(v,nt)|0,i=i+Math.imul(y,et)|0,o=o+Math.imul(y,nt)|0,n=n+Math.imul(m,ot)|0,i=i+Math.imul(m,ut)|0,i=i+Math.imul(d,ot)|0,o=o+Math.imul(d,ut)|0,n=n+Math.imul(l,ht)|0,i=i+Math.imul(l,at)|0,i=i+Math.imul(c,ht)|0,o=o+Math.imul(c,at)|0;var xt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(L,F),i=Math.imul(L,q),i=i+Math.imul(I,F)|0,o=Math.imul(I,q),n=n+Math.imul(D,H)|0,i=i+Math.imul(D,Z)|0,i=i+Math.imul(k,H)|0,o=o+Math.imul(k,Z)|0,n=n+Math.imul(B,G)|0,i=i+Math.imul(B,V)|0,i=i+Math.imul(R,G)|0,o=o+Math.imul(R,V)|0,n=n+Math.imul(S,$)|0,i=i+Math.imul(S,K)|0,i=i+Math.imul(T,$)|0,o=o+Math.imul(T,K)|0,n=n+Math.imul(x,X)|0,i=i+Math.imul(x,tt)|0,i=i+Math.imul(A,X)|0,o=o+Math.imul(A,tt)|0,n=n+Math.imul(M,et)|0,i=i+Math.imul(M,nt)|0,i=i+Math.imul(b,et)|0,o=o+Math.imul(b,nt)|0,n=n+Math.imul(v,ot)|0,i=i+Math.imul(v,ut)|0,i=i+Math.imul(y,ot)|0,o=o+Math.imul(y,ut)|0,n=n+Math.imul(m,ht)|0,i=i+Math.imul(m,at)|0,i=i+Math.imul(d,ht)|0,o=o+Math.imul(d,at)|0,n=n+Math.imul(l,lt)|0,i=i+Math.imul(l,ct)|0,i=i+Math.imul(c,lt)|0,o=o+Math.imul(c,ct)|0;var At=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(Q,F),i=Math.imul(Q,q),i=i+Math.imul(N,F)|0,o=Math.imul(N,q),n=n+Math.imul(L,H)|0,i=i+Math.imul(L,Z)|0,i=i+Math.imul(I,H)|0,o=o+Math.imul(I,Z)|0,n=n+Math.imul(D,G)|0,i=i+Math.imul(D,V)|0,i=i+Math.imul(k,G)|0,o=o+Math.imul(k,V)|0,n=n+Math.imul(B,$)|0,i=i+Math.imul(B,K)|0,i=i+Math.imul(R,$)|0,o=o+Math.imul(R,K)|0,n=n+Math.imul(S,X)|0,i=i+Math.imul(S,tt)|0,i=i+Math.imul(T,X)|0,o=o+Math.imul(T,tt)|0,n=n+Math.imul(x,et)|0,i=i+Math.imul(x,nt)|0,i=i+Math.imul(A,et)|0,o=o+Math.imul(A,nt)|0,n=n+Math.imul(M,ot)|0,i=i+Math.imul(M,ut)|0,i=i+Math.imul(b,ot)|0,o=o+Math.imul(b,ut)|0,n=n+Math.imul(v,ht)|0,i=i+Math.imul(v,at)|0,i=i+Math.imul(y,ht)|0,o=o+Math.imul(y,at)|0,n=n+Math.imul(m,lt)|0,i=i+Math.imul(m,ct)|0,i=i+Math.imul(d,lt)|0,o=o+Math.imul(d,ct)|0,n=n+Math.imul(l,mt)|0,i=i+Math.imul(l,dt)|0,i=i+Math.imul(c,mt)|0,o=o+Math.imul(c,dt)|0;var Et=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(Q,H),i=Math.imul(Q,Z),i=i+Math.imul(N,H)|0,o=Math.imul(N,Z),n=n+Math.imul(L,G)|0,i=i+Math.imul(L,V)|0,i=i+Math.imul(I,G)|0,o=o+Math.imul(I,V)|0,n=n+Math.imul(D,$)|0,i=i+Math.imul(D,K)|0,i=i+Math.imul(k,$)|0,o=o+Math.imul(k,K)|0,n=n+Math.imul(B,X)|0,i=i+Math.imul(B,tt)|0,i=i+Math.imul(R,X)|0,o=o+Math.imul(R,tt)|0,n=n+Math.imul(S,et)|0,i=i+Math.imul(S,nt)|0,i=i+Math.imul(T,et)|0,o=o+Math.imul(T,nt)|0,n=n+Math.imul(x,ot)|0,i=i+Math.imul(x,ut)|0,i=i+Math.imul(A,ot)|0,o=o+Math.imul(A,ut)|0,n=n+Math.imul(M,ht)|0,i=i+Math.imul(M,at)|0,i=i+Math.imul(b,ht)|0,o=o+Math.imul(b,at)|0,n=n+Math.imul(v,lt)|0,i=i+Math.imul(v,ct)|0,i=i+Math.imul(y,lt)|0,o=o+Math.imul(y,ct)|0,n=n+Math.imul(m,mt)|0,i=i+Math.imul(m,dt)|0,i=i+Math.imul(d,mt)|0,o=o+Math.imul(d,dt)|0;var St=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(Q,G),i=Math.imul(Q,V),i=i+Math.imul(N,G)|0,o=Math.imul(N,V),n=n+Math.imul(L,$)|0,i=i+Math.imul(L,K)|0,i=i+Math.imul(I,$)|0,o=o+Math.imul(I,K)|0,n=n+Math.imul(D,X)|0,i=i+Math.imul(D,tt)|0,i=i+Math.imul(k,X)|0,o=o+Math.imul(k,tt)|0,n=n+Math.imul(B,et)|0,i=i+Math.imul(B,nt)|0,i=i+Math.imul(R,et)|0,o=o+Math.imul(R,nt)|0,n=n+Math.imul(S,ot)|0,i=i+Math.imul(S,ut)|0,i=i+Math.imul(T,ot)|0,o=o+Math.imul(T,ut)|0,n=n+Math.imul(x,ht)|0,i=i+Math.imul(x,at)|0,i=i+Math.imul(A,ht)|0,o=o+Math.imul(A,at)|0,n=n+Math.imul(M,lt)|0,i=i+Math.imul(M,ct)|0,i=i+Math.imul(b,lt)|0,o=o+Math.imul(b,ct)|0,n=n+Math.imul(v,mt)|0,i=i+Math.imul(v,dt)|0,i=i+Math.imul(y,mt)|0,o=o+Math.imul(y,dt)|0;var Tt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(Q,$),i=Math.imul(Q,K),i=i+Math.imul(N,$)|0,o=Math.imul(N,K),n=n+Math.imul(L,X)|0,i=i+Math.imul(L,tt)|0,i=i+Math.imul(I,X)|0,o=o+Math.imul(I,tt)|0,n=n+Math.imul(D,et)|0,i=i+Math.imul(D,nt)|0,i=i+Math.imul(k,et)|0,o=o+Math.imul(k,nt)|0,n=n+Math.imul(B,ot)|0,i=i+Math.imul(B,ut)|0,i=i+Math.imul(R,ot)|0,o=o+Math.imul(R,ut)|0,n=n+Math.imul(S,ht)|0,i=i+Math.imul(S,at)|0,i=i+Math.imul(T,ht)|0,o=o+Math.imul(T,at)|0,n=n+Math.imul(x,lt)|0,i=i+Math.imul(x,ct)|0,i=i+Math.imul(A,lt)|0,o=o+Math.imul(A,ct)|0,n=n+Math.imul(M,mt)|0,i=i+Math.imul(M,dt)|0,i=i+Math.imul(b,mt)|0,o=o+Math.imul(b,dt)|0;var Pt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(Q,X),i=Math.imul(Q,tt),i=i+Math.imul(N,X)|0,o=Math.imul(N,tt),n=n+Math.imul(L,et)|0,i=i+Math.imul(L,nt)|0,i=i+Math.imul(I,et)|0,o=o+Math.imul(I,nt)|0,n=n+Math.imul(D,ot)|0,i=i+Math.imul(D,ut)|0,i=i+Math.imul(k,ot)|0,o=o+Math.imul(k,ut)|0,n=n+Math.imul(B,ht)|0,i=i+Math.imul(B,at)|0,i=i+Math.imul(R,ht)|0,o=o+Math.imul(R,at)|0,n=n+Math.imul(S,lt)|0,i=i+Math.imul(S,ct)|0,i=i+Math.imul(T,lt)|0,o=o+Math.imul(T,ct)|0,n=n+Math.imul(x,mt)|0,i=i+Math.imul(x,dt)|0,i=i+Math.imul(A,mt)|0,o=o+Math.imul(A,dt)|0;var Bt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,n=Math.imul(Q,et),i=Math.imul(Q,nt),i=i+Math.imul(N,et)|0,o=Math.imul(N,nt),n=n+Math.imul(L,ot)|0,i=i+Math.imul(L,ut)|0,i=i+Math.imul(I,ot)|0,o=o+Math.imul(I,ut)|0,n=n+Math.imul(D,ht)|0,i=i+Math.imul(D,at)|0,i=i+Math.imul(k,ht)|0,o=o+Math.imul(k,at)|0,n=n+Math.imul(B,lt)|0,i=i+Math.imul(B,ct)|0,i=i+Math.imul(R,lt)|0,o=o+Math.imul(R,ct)|0,n=n+Math.imul(S,mt)|0,i=i+Math.imul(S,dt)|0,i=i+Math.imul(T,mt)|0,o=o+Math.imul(T,dt)|0;var Rt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(Rt>>>26)|0,Rt&=67108863,n=Math.imul(Q,ot),i=Math.imul(Q,ut),i=i+Math.imul(N,ot)|0,o=Math.imul(N,ut),n=n+Math.imul(L,ht)|0,i=i+Math.imul(L,at)|0,i=i+Math.imul(I,ht)|0,o=o+Math.imul(I,at)|0,n=n+Math.imul(D,lt)|0,i=i+Math.imul(D,ct)|0,i=i+Math.imul(k,lt)|0,o=o+Math.imul(k,ct)|0,n=n+Math.imul(B,mt)|0,i=i+Math.imul(B,dt)|0,i=i+Math.imul(R,mt)|0,o=o+Math.imul(R,dt)|0;var jt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(jt>>>26)|0,jt&=67108863,n=Math.imul(Q,ht),i=Math.imul(Q,at),i=i+Math.imul(N,ht)|0,o=Math.imul(N,at),n=n+Math.imul(L,lt)|0,i=i+Math.imul(L,ct)|0,i=i+Math.imul(I,lt)|0,o=o+Math.imul(I,ct)|0,n=n+Math.imul(D,mt)|0,i=i+Math.imul(D,dt)|0,i=i+Math.imul(k,mt)|0,o=o+Math.imul(k,dt)|0;var Dt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(Q,lt),i=Math.imul(Q,ct),i=i+Math.imul(N,lt)|0,o=Math.imul(N,ct),n=n+Math.imul(L,mt)|0,i=i+Math.imul(L,dt)|0,i=i+Math.imul(I,mt)|0,o=o+Math.imul(I,dt)|0;var kt=(a+n|0)+((8191&i)<<13)|0;a=(o+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(Q,mt),i=Math.imul(Q,dt),i=i+Math.imul(N,mt)|0,o=Math.imul(N,dt);var Ot=(a+n|0)+((8191&i)<<13)|0;return a=(o+(i>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,h[0]=gt,h[1]=vt,h[2]=yt,h[3]=wt,h[4]=Mt,h[5]=bt,h[6]=_t,h[7]=xt,h[8]=At,h[9]=Et,h[10]=St,h[11]=Tt,h[12]=Pt,h[13]=Bt,h[14]=Rt,h[15]=jt,h[16]=Dt,h[17]=kt,h[18]=Ot,0!==a&&(h[19]=a,e.length++),e};Math.imul||(E=a),o.prototype.mulTo=function(t,r){var e,n=this.length+t.length;return e=10===this.length&&10===t.length?E(this,t,r):63>n?a(this,t,r):1024>n?f(this,t,r):l(this,t,r)},c.prototype.makeRBT=function(t){for(var r=Array(t),e=o.prototype._countBits(t)-1,n=0;t>n;n++)r[n]=this.revBin(n,e,t);return r},c.prototype.revBin=function(t,r,e){if(0===t||t===e-1)return t;for(var n=0,i=0;r>i;i++)n|=(1&t)<>=1;return n},c.prototype.permute=function(t,r,e,n,i,o){for(var u=0;o>u;u++)n[u]=r[t[u]],i[u]=e[t[u]]},c.prototype.transform=function(t,r,e,n,i,o){this.permute(o,t,r,e,n,i);for(var u=1;i>u;u<<=1)for(var s=u<<1,h=Math.cos(2*Math.PI/s),a=Math.sin(2*Math.PI/s),f=0;i>f;f+=s)for(var l=h,c=a,p=0;u>p;p++){var m=e[f+p],d=n[f+p],g=e[f+p+u],v=n[f+p+u],y=l*g-c*v;v=l*v+c*g,g=y,e[f+p]=m+g,n[f+p]=d+v,e[f+p+u]=m-g,n[f+p+u]=d-v,p!==s&&(y=h*l-a*c,c=h*c+a*l,l=y)}},c.prototype.guessLen13b=function(t,r){var e=1|Math.max(r,t),n=1&e,i=0;for(e=e/2|0;e;e>>>=1)i++;return 1<1)for(var n=0;e/2>n;n++){var i=t[n];t[n]=t[e-n-1],t[e-n-1]=i,i=r[n],r[n]=-r[e-n-1],r[e-n-1]=-i}},c.prototype.normalize13b=function(t,r){for(var e=0,n=0;r/2>n;n++){var i=8192*Math.round(t[2*n+1]/r)+Math.round(t[2*n]/r)+e;t[n]=67108863&i,e=67108864>i?0:i/67108864|0}return t},c.prototype.convert13b=function(t,r,e,i){for(var o=0,u=0;r>u;u++)o+=0|t[u],e[2*u]=8191&o,o>>>=13,e[2*u+1]=8191&o,o>>>=13;for(u=2*r;i>u;++u)e[u]=0;n(0===o),n(0===(o&-8192))},c.prototype.stub=function(t){for(var r=Array(t),e=0;t>e;e++)r[e]=0;return r},c.prototype.mulp=function(t,r,e){var n=2*this.guessLen13b(t.length,r.length),i=this.makeRBT(n),o=this.stub(n),u=Array(n),s=Array(n),h=Array(n),a=Array(n),f=Array(n),l=Array(n),c=e.words;c.length=n,this.convert13b(t.words,t.length,u,n),this.convert13b(r.words,r.length,a,n),this.transform(u,o,s,h,n,i),this.transform(a,o,f,l,n,i);for(var p=0;n>p;p++){var m=s[p]*f[p]-h[p]*l[p]; 3 | h[p]=s[p]*l[p]+h[p]*f[p],s[p]=m}return this.conjugate(s,h,n),this.transform(s,h,c,o,n,i),this.conjugate(c,o,n),this.normalize13b(c,n),e.negative=t.negative^r.negative,e.length=t.length+r.length,e.strip()},o.prototype.mul=function(t){var r=new o(null);return r.words=Array(this.length+t.length),this.mulTo(t,r)},o.prototype.mulf=function(t){var r=new o(null);return r.words=Array(this.length+t.length),l(this,t,r)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){n("number"==typeof t),n(67108864>t);for(var r=0,e=0;this.length>e;e++){var i=(0|this.words[e])*t,o=(67108863&i)+(67108863&r);r>>=26,r+=i/67108864|0,r+=o>>>26,this.words[e]=67108863&o}return 0!==r&&(this.words[e]=r,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var r=h(t);if(0===r.length)return new o(1);for(var e=this,n=0;r.length>n&&0===r[n];n++,e=e.sqr());if(++nn;n++,i=i.sqr())0!==r[n]&&(e=e.mul(i));return e},o.prototype.iushln=function(t){n("number"==typeof t&&t>=0);var r,e=t%26,i=(t-e)/26,o=67108863>>>26-e<<26-e;if(0!==e){var u=0;for(r=0;this.length>r;r++){var s=this.words[r]&o,h=(0|this.words[r])-s<>>26-e}u&&(this.words[r]=u,this.length++)}if(0!==i){for(r=this.length-1;r>=0;r--)this.words[r+i]=this.words[r];for(r=0;i>r;r++)this.words[r]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},o.prototype.iushrn=function(t,r,e){n("number"==typeof t&&t>=0);var i;i=r?(r-r%26)/26:0;var o=t%26,u=Math.min((t-o)/26,this.length),s=67108863^67108863>>>o<a;a++)h.words[a]=this.words[a];h.length=u}if(0===u);else if(this.length>u)for(this.length-=u,a=0;this.length>a;a++)this.words[a]=this.words[a+u];else this.words[0]=0,this.length=1;var f=0;for(a=this.length-1;!(0>a||0===f&&i>a);a--){var l=0|this.words[a];this.words[a]=f<<26-o|l>>>o,f=l&s}return h&&0!==f&&(h.words[h.length++]=f),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,r,e){return n(0===this.negative),this.iushrn(t,r,e)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){n("number"==typeof t&&t>=0);var r=t%26,e=(t-r)/26,i=1<=this.length)return!1;var o=this.words[e];return!!(o&i)},o.prototype.imaskn=function(t){n("number"==typeof t&&t>=0);var r=t%26,e=(t-r)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),e>=this.length)return this;if(0!==r&&e++,this.length=Math.min(e,this.length),0!==r){var i=67108863^67108863>>>r<t),0>t?this.isubn(-t):0!==this.negative?1===this.length&&t>(0|this.words[0])?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var r=0;this.length>r&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},o.prototype.isubn=function(t){if(n("number"==typeof t),n(67108864>t),0>t)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&0>this.words[0])this.words[0]=-this.words[0],this.negative=1;else for(var r=0;this.length>r&&0>this.words[r];r++)this.words[r]+=67108864,this.words[r+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,r,e){var i,o=t.length+e;this._expand(o);var u,s=0;for(i=0;t.length>i;i++){u=(0|this.words[i+e])+s;var h=(0|t.words[i])*r;u-=67108863&h,s=(u>>26)-(h/67108864|0),this.words[i+e]=67108863&u}for(;this.length-e>i;i++)u=(0|this.words[i+e])+s,s=u>>26,this.words[i+e]=67108863&u;if(0===s)return this.strip();for(n(s===-1),s=0,i=0;this.length>i;i++)u=-(0|this.words[i])+s,s=u>>26,this.words[i]=67108863&u;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,r){var e=this.length-t.length,n=this.clone(),i=t,u=0|i.words[i.length-1],s=this._countBits(u);e=26-s,0!==e&&(i=i.ushln(e),n.iushln(e),u=0|i.words[i.length-1]);var h,a=n.length-i.length;if("mod"!==r){h=new o(null),h.length=a+1,h.words=Array(h.length);for(var f=0;h.length>f;f++)h.words[f]=0}var l=n.clone()._ishlnsubmul(i,1,a);0===l.negative&&(n=l,h&&(h.words[a]=1));for(var c=a-1;c>=0;c--){var p=67108864*(0|n.words[i.length+c])+(0|n.words[i.length+c-1]);for(p=Math.min(p/u|0,67108863),n._ishlnsubmul(i,p,c);0!==n.negative;)p--,n.negative=0,n._ishlnsubmul(i,1,c),n.isZero()||(n.negative^=1);h&&(h.words[c]=p)}return h&&h.strip(),n.strip(),"div"!==r&&0!==e&&n.iushrn(e),{div:h||null,mod:n}},o.prototype.divmod=function(t,r,e){if(n(!t.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var i,u,s;return 0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,r),"mod"!==r&&(i=s.div.neg()),"div"!==r&&(u=s.mod.neg(),e&&0!==u.negative&&u.iadd(t)),{div:i,mod:u}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),r),"mod"!==r&&(i=s.div.neg()),{div:i,mod:s.mod}):0!==(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),r),"div"!==r&&(u=s.mod.neg(),e&&0!==u.negative&&u.isub(t)),{div:s.div,mod:u}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:1===t.length?"div"===r?{div:this.divn(t.words[0]),mod:null}:"mod"===r?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,r)},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var r=this.divmod(t);if(r.mod.isZero())return r.div;var e=0!==r.div.negative?r.mod.isub(t):r.mod,n=t.ushrn(1),i=t.andln(1),o=e.cmp(n);return 0>o||1===i&&0===o?r.div:0!==r.div.negative?r.div.isubn(1):r.div.iaddn(1)},o.prototype.modn=function(t){n(67108863>=t);for(var r=(1<<26)%t,e=0,i=this.length-1;i>=0;i--)e=(r*e+(0|this.words[i]))%t;return e},o.prototype.idivn=function(t){n(67108863>=t);for(var r=0,e=this.length-1;e>=0;e--){var i=(0|this.words[e])+67108864*r;this.words[e]=i/t|0,r=i%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){n(0===t.negative),n(!t.isZero());var r=this,e=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var i=new o(1),u=new o(0),s=new o(0),h=new o(1),a=0;r.isEven()&&e.isEven();)r.iushrn(1),e.iushrn(1),++a;for(var f=e.clone(),l=r.clone();!r.isZero();){for(var c=0,p=1;0===(r.words[0]&p)&&26>c;++c,p<<=1);if(c>0)for(r.iushrn(c);c-- >0;)(i.isOdd()||u.isOdd())&&(i.iadd(f),u.isub(l)),i.iushrn(1),u.iushrn(1);for(var m=0,d=1;0===(e.words[0]&d)&&26>m;++m,d<<=1);if(m>0)for(e.iushrn(m);m-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(f),h.isub(l)),s.iushrn(1),h.iushrn(1);r.cmp(e)<0?(e.isub(r),s.isub(i),h.isub(u)):(r.isub(e),i.isub(s),u.isub(h))}return{a:s,b:h,gcd:e.iushln(a)}},o.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var r=this,e=t.clone();r=0!==r.negative?r.umod(t):r.clone();for(var i=new o(1),u=new o(0),s=e.clone();r.cmpn(1)>0&&e.cmpn(1)>0;){for(var h=0,a=1;0===(r.words[0]&a)&&26>h;++h,a<<=1);if(h>0)for(r.iushrn(h);h-- >0;)i.isOdd()&&i.iadd(s),i.iushrn(1);for(var f=0,l=1;0===(e.words[0]&l)&&26>f;++f,l<<=1);if(f>0)for(e.iushrn(f);f-- >0;)u.isOdd()&&u.iadd(s),u.iushrn(1);r.cmp(e)<0?(e.isub(r),u.isub(i)):(r.isub(e),i.isub(u))}var c;return c=0===r.cmpn(1)?i:u,c.cmpn(0)<0&&c.iadd(t),c},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var r=this.clone(),e=t.clone();r.negative=0,e.negative=0;for(var n=0;r.isEven()&&e.isEven();n++)r.iushrn(1),e.iushrn(1);for(;;){for(;r.isEven();)r.iushrn(1);for(;e.isEven();)e.iushrn(1);var i=r.cmp(e);if(0>i){var o=r;r=e,e=o}else if(0===i||0===e.cmpn(1))break;r.isub(e)}return e.iushln(n)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return 0===(1&this.words[0])},o.prototype.isOdd=function(){return 1===(1&this.words[0])},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){n("number"==typeof t);var r=t%26,e=(t-r)/26,i=1<=this.length)return this._expand(e+1),this.words[e]|=i,this;for(var o=i,u=e;0!==o&&this.length>u;u++){var s=0|this.words[u];s+=o,o=s>>>26,s&=67108863,this.words[u]=s}return 0!==o&&(this.words[u]=o,this.length++),this},o.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},o.prototype.cmpn=function(t){var r=0>t;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;this.strip();var e;if(this.length>1)e=1;else{r&&(t=-t),n(67108863>=t,"Number is too big");var i=0|this.words[0];e=i===t?0:t>i?-1:1}return 0!==this.negative?0|-e:e},o.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var r=this.ucmp(t);return 0!==this.negative?0|-r:r},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(t.length>this.length)return-1;for(var r=0,e=this.length-1;e>=0;e--){var n=0|this.words[e],i=0|t.words[e];if(n!==i){i>n?r=-1:n>i&&(r=1);break}}return r},o.prototype.gtn=function(t){return 1===this.cmpn(t)},o.prototype.gt=function(t){return 1===this.cmp(t)},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return this.cmpn(t)===-1},o.prototype.lt=function(t){return this.cmp(t)===-1},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return 0===this.cmpn(t)},o.prototype.eq=function(t){return 0===this.cmp(t)},o.red=function(t){return new y(t)},o.prototype.toRed=function(t){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return n(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return n(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var S={k256:null,p224:null,p192:null,p25519:null};p.prototype._tmp=function(){var t=new o(null);return t.words=Array(Math.ceil(this.n/13)),t},p.prototype.ireduce=function(t){var r,e=t;do this.split(e,this.tmp),e=this.imulK(e),e=e.iadd(this.tmp),r=e.bitLength();while(r>this.n);var n=this.n>r?-1:e.ucmp(this.p);return 0===n?(e.words[0]=0,e.length=1):n>0?e.isub(this.p):e.strip(),e},p.prototype.split=function(t,r){t.iushrn(this.n,0,r)},p.prototype.imulK=function(t){return t.imul(this.k)},i(m,p),m.prototype.split=function(t,r){for(var e=4194303,n=Math.min(t.length,9),i=0;n>i;i++)r.words[i]=t.words[i];if(r.length=n,9>=t.length)return t.words[0]=0,void(t.length=1);var o=t.words[9];for(r.words[r.length++]=o&e,i=10;t.length>i;i++){var u=0|t.words[i];t.words[i-10]=(u&e)<<4|o>>>22,o=u}o>>>=22,t.words[i-10]=o,t.length-=0===o&&t.length>10?10:9},m.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var r=0,e=0;t.length>e;e++){var n=0|t.words[e];r+=977*n,t.words[e]=67108863&r,r=64*n+(r/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(d,p),i(g,p),i(v,p),v.prototype.imulK=function(t){for(var r=0,e=0;t.length>e;e++){var n=19*(0|t.words[e])+r,i=67108863&n;n>>>=26,t.words[e]=i,r=n}return 0!==r&&(t.words[t.length++]=r),t},o._prime=function T(t){if(S[t])return S[t];var T;if("k256"===t)T=new m;else if("p224"===t)T=new d;else if("p192"===t)T=new g;else{if("p25519"!==t)throw Error("Unknown prime "+t);T=new v}return S[t]=T,T},y.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},y.prototype._verify2=function(t,r){n(0===(t.negative|r.negative),"red works only with positives"),n(t.red&&t.red===r.red,"red works only with red numbers")},y.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},y.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},y.prototype.add=function(t,r){this._verify2(t,r);var e=t.add(r);return e.cmp(this.m)<0||e.isub(this.m),e._forceRed(this)},y.prototype.iadd=function(t,r){this._verify2(t,r);var e=t.iadd(r);return e.cmp(this.m)<0||e.isub(this.m),e},y.prototype.sub=function(t,r){this._verify2(t,r);var e=t.sub(r);return e.cmpn(0)<0&&e.iadd(this.m),e._forceRed(this)},y.prototype.isub=function(t,r){this._verify2(t,r);var e=t.isub(r);return e.cmpn(0)<0&&e.iadd(this.m),e},y.prototype.shl=function(t,r){return this._verify1(t),this.imod(t.ushln(r))},y.prototype.imul=function(t,r){return this._verify2(t,r),this.imod(t.imul(r))},y.prototype.mul=function(t,r){return this._verify2(t,r),this.imod(t.mul(r))},y.prototype.isqr=function(t){return this.imul(t,t.clone())},y.prototype.sqr=function(t){return this.mul(t,t)},y.prototype.sqrt=function(t){if(t.isZero())return t.clone();var r=this.m.andln(3);if(n(r%2===1),3===r){var e=this.m.add(new o(1)).iushrn(2);return this.pow(t,e)}for(var i=this.m.subn(1),u=0;!i.isZero()&&0===i.andln(1);)u++,i.iushrn(1);n(!i.isZero());var s=new o(1).toRed(this),h=s.redNeg(),a=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);0!==this.pow(f,a).cmp(h);)f.redIAdd(h);for(var l=this.pow(f,i),c=this.pow(t,i.addn(1).iushrn(1)),p=this.pow(t,i),m=u;0!==p.cmp(s);){for(var d=p,g=0;0!==d.cmp(s);g++)d=d.redSqr();n(m>g);var v=this.pow(l,new o(1).iushln(m-g-1));c=c.redMul(v),l=v.redSqr(),p=p.redMul(l),m=g}return c},y.prototype.invm=function(t){var r=t._invmp(this.m);return 0!==r.negative?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},y.prototype.pow=function(t,r){if(r.isZero())return new o(1);if(0===r.cmpn(1))return t.clone();var e=4,n=Array(1<i;i++)n[i]=this.mul(n[i-1],t);var u=n[0],s=0,h=0,a=r.bitLength()%26;for(0===a&&(a=26),i=r.length-1;i>=0;i--){for(var f=r.words[i],l=a-1;l>=0;l--){var c=f>>l&1;u!==n[0]&&(u=this.sqr(u)),0!==c||0!==s?(s<<=1,s|=c,h++,(h===e||0===i&&0===l)&&(u=this.mul(u,n[s]),h=0,s=0)):h=0}a=26}return u},y.prototype.convertTo=function(t){var r=t.umod(this.m);return r===t?r.clone():r},y.prototype.convertFrom=function(t){var r=t.clone();return r.red=null,r},o.mont=function(t){return new w(t)},i(w,y),w.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},w.prototype.convertFrom=function(t){var r=this.imod(t.mul(this.rinv));return r.red=null,r},w.prototype.imul=function(t,r){if(t.isZero()||r.isZero())return t.words[0]=0,t.length=1,t;var e=t.imul(r),n=e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=e.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)<0?i.cmpn(0)<0&&(o=i.iadd(this.m)):o=i.isub(this.m),o._forceRed(this)},w.prototype.mul=function(t,r){if(t.isZero()||r.isZero())return new o(0)._forceRed(this);var e=t.mul(r),n=e.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=e.isub(n).iushrn(this.shift),u=i;return i.cmp(this.m)<0?i.cmpn(0)<0&&(u=i.iadd(this.m)):u=i.isub(this.m),u._forceRed(this)},w.prototype.invm=function(t){var r=this.imod(t._invmp(this.m).mul(this.r2));return r._forceRed(this)}}(void 0===t||t,this)}).call(r,e(108)(t))},function(t,r,e){var n=e(0),i=n.JSON||(n.JSON={stringify:JSON.stringify});t.exports=function(t){return i.stringify.apply(i,arguments)}},function(t,r,e){e(89),t.exports=e(0).Object.assign},function(t,r,e){e(90);var n=e(0).Object;t.exports=function(t,r,e){return n.defineProperty(t,r,e)}},function(t,r,e){e(91),t.exports=e(0).Object.keys},function(t,r,e){e(92),e(94),e(97),e(93),e(95),e(96),t.exports=e(0).Promise},function(t,r){t.exports=function(){}},function(t,r){t.exports=function(t,r,e,n){if(!(t instanceof r)||void 0!==n&&n in t)throw TypeError(e+": incorrect invocation!");return t}},function(t,r,e){var n=e(24),i=e(42),o=e(85);t.exports=function(t){return function(r,e,u){var s,h=n(r),a=i(h.length),f=o(u,a);if(t&&e!=e){for(;a>f;)if(s=h[f++],s!=s)return!0}else for(;a>f;f++)if((t||f in h)&&h[f]===e)return t||f||0;return!t&&-1}}},function(t,r,e){var n=e(12),i=e(68),o=e(67),u=e(3),s=e(42),h=e(87),a={},f={},r=t.exports=function(t,r,e,l,c){var p,m,d,g,v=c?function(){return t}:h(t),y=n(e,l,r?2:1),w=0;if("function"!=typeof v)throw TypeError(t+" is not iterable!");if(o(v)){for(p=s(t.length);p>w;w++)if(g=r?y(u(m=t[w])[0],m[1]):y(t[w]),g===a||g===f)return g}else for(d=v.call(t);!(m=d.next()).done;)if(g=i(d,y,m.value,r),g===a||g===f)return g};r.BREAK=a,r.RETURN=f},function(t,r,e){t.exports=!e(5)&&!e(13)(function(){return 7!=Object.defineProperty(e(18)("div"),"a",{get:function(){return 7}}).a})},function(t,r){t.exports=function(t,r,e){var n=void 0===e;switch(r.length){case 0:return n?t():t.call(e);case 1:return n?t(r[0]):t.call(e,r[0]);case 2:return n?t(r[0],r[1]):t.call(e,r[0],r[1]);case 3:return n?t(r[0],r[1],r[2]):t.call(e,r[0],r[1],r[2]);case 4:return n?t(r[0],r[1],r[2],r[3]):t.call(e,r[0],r[1],r[2],r[3])}return t.apply(e,r)}},function(t,r,e){var n=e(8),i=e(2)("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(n.Array===t||o[i]===t)}},function(t,r,e){var n=e(3);t.exports=function(t,r,e,i){try{return i?r(n(e)[0],e[1]):r(e)}catch(o){var u=t["return"];throw void 0!==u&&n(u.call(t)),o}}},function(t,r,e){"use strict";var n=e(74),i=e(38),o=e(21),u={};e(6)(u,e(2)("iterator"),function(){return this}),t.exports=function(t,r,e){t.prototype=n(u,{next:i(1,e)}),o(t,r+" Iterator")}},function(t,r,e){var n=e(2)("iterator"),i=!1;try{var o=[7][n]();o["return"]=function(){i=!0},Array.from(o,function(){throw 2})}catch(u){}t.exports=function(t,r){if(!r&&!i)return!1;var e=!1;try{var o=[7],u=o[n]();u.next=function(){return{done:e=!0}},o[n]=function(){return u},t(o)}catch(s){}return e}},function(t,r){t.exports=function(t,r){return{value:r,done:!!t}}},function(t,r,e){var n=e(1),i=e(41).set,o=n.MutationObserver||n.WebKitMutationObserver,u=n.process,s=n.Promise,h="process"==e(11)(u);t.exports=function(){var t,r,e,a=function(){var n,i;for(h&&(n=u.domain)&&n.exit();t;){i=t.fn,t=t.next;try{i()}catch(o){throw t?e():r=void 0,o}}r=void 0,n&&n.enter()};if(h)e=function(){u.nextTick(a)};else if(!o||n.navigator&&n.navigator.standalone)if(s&&s.resolve){var f=s.resolve();e=function(){f.then(a)}}else e=function(){i.call(n,a)};else{var l=!0,c=document.createTextNode("");new o(a).observe(c,{characterData:!0}),e=function(){c.data=l=!l}}return function(n){var i={fn:n,next:void 0};r&&(r.next=i),t||(t=i,e()),r=i}}},function(t,r,e){"use strict";var n=e(20),i=e(76),o=e(79),u=e(25),s=e(33),h=Object.assign;t.exports=!h||e(13)(function(){var t={},r={},e=Symbol(),n="abcdefghijklmnopqrst";return t[e]=7,n.split("").forEach(function(t){r[t]=t}),7!=h({},t)[e]||Object.keys(h({},r)).join("")!=n})?function(t,r){for(var e=u(t),h=arguments.length,a=1,f=i.f,l=o.f;h>a;)for(var c,p=s(arguments[a++]),m=f?n(p).concat(f(p)):n(p),d=m.length,g=0;d>g;)l.call(p,c=m[g++])&&(e[c]=p[c]);return e}:h},function(t,r,e){var n=e(3),i=e(75),o=e(31),u=e(22)("IE_PROTO"),s=function(){},h="prototype",a=function(){var t,r=e(18)("iframe"),n=o.length,i="<",u=">";for(r.style.display="none",e(32).appendChild(r),r.src="javascript:",t=r.contentWindow.document,t.open(),t.write(i+"script"+u+"document.F=Object"+i+"/script"+u),t.close(),a=t.F;n--;)delete a[h][o[n]];return a()};t.exports=Object.create||function(t,r){var e;return null!==t?(s[h]=n(t),e=new s,s[h]=null,e[u]=t):e=a(),void 0===r?e:i(e,r)}},function(t,r,e){var n=e(9),i=e(3),o=e(20);t.exports=e(5)?Object.defineProperties:function(t,r){i(t);for(var e,u=o(r),s=u.length,h=0;s>h;)n.f(t,e=u[h++],r[e]);return t}},function(t,r){r.f=Object.getOwnPropertySymbols},function(t,r,e){var n=e(14),i=e(25),o=e(22)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),n(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,r,e){var n=e(14),i=e(24),o=e(63)(!1),u=e(22)("IE_PROTO");t.exports=function(t,r){var e,s=i(t),h=0,a=[];for(e in s)e!=u&&n(s,e)&&a.push(e);for(;r.length>h;)n(s,e=r[h++])&&(~o(a,e)||a.push(e));return a}},function(t,r){r.f={}.propertyIsEnumerable},function(t,r,e){var n=e(4),i=e(0),o=e(13);t.exports=function(t,r){var e=(i.Object||{})[t]||Object[t],u={};u[t]=r(e),n(n.S+n.F*o(function(){e(1)}),"Object",u)}},function(t,r,e){var n=e(6);t.exports=function(t,r,e){for(var i in r)e&&t[i]?t[i]=r[i]:n(t,i,r[i]);return t}},function(t,r,e){t.exports=e(6)},function(t,r,e){"use strict";var n=e(1),i=e(0),o=e(9),u=e(5),s=e(2)("species");t.exports=function(t){var r="function"==typeof i[t]?i[t]:n[t];u&&r&&!r[s]&&o.f(r,s,{configurable:!0,get:function(){return this}})}},function(t,r,e){var n=e(23),i=e(17);t.exports=function(t){return function(r,e){var o,u,s=i(r)+"",h=n(e),a=s.length;return 0>h||h>=a?t?"":void 0:(o=s.charCodeAt(h),55296>o||o>56319||h+1===a||(u=s.charCodeAt(h+1))<56320||u>57343?t?s.charAt(h):o:t?s.slice(h,h+2):(o-55296<<10)+(u-56320)+65536)}}},function(t,r,e){var n=e(23),i=Math.max,o=Math.min;t.exports=function(t,r){return t=n(t),0>t?i(t+r,0):o(t,r)}},function(t,r,e){var n=e(7);t.exports=function(t,r){if(!n(t))return t;var e,i;if(r&&"function"==typeof(e=t.toString)&&!n(i=e.call(t)))return i;if("function"==typeof(e=t.valueOf)&&!n(i=e.call(t)))return i;if(!r&&"function"==typeof(e=t.toString)&&!n(i=e.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},function(t,r,e){var n=e(30),i=e(2)("iterator"),o=e(8);t.exports=e(0).getIteratorMethod=function(t){if(void 0!=t)return t[i]||t["@@iterator"]||o[n(t)]}},function(t,r,e){"use strict";var n=e(61),i=e(71),o=e(8),u=e(24);t.exports=e(34)(Array,"Array",function(t,r){this._t=u(t),this._i=0,this._k=r},function(){var t=this._t,r=this._k,e=this._i++;return t&&t.length>e?"keys"==r?i(0,e):"values"==r?i(0,t[e]):i(0,[e,t[e]]):(this._t=void 0,i(1))},"values"),o.Arguments=o.Array,n("keys"),n("values"),n("entries")},function(t,r,e){var n=e(4);n(n.S+n.F,"Object",{assign:e(73)})},function(t,r,e){var n=e(4);n(n.S+n.F*!e(5),"Object",{defineProperty:e(9).f})},function(t,r,e){var n=e(25),i=e(20);e(80)("keys",function(){return function(t){return i(n(t))}})},function(t,r){},function(t,r,e){"use strict";var n,i,o,u,s=e(35),h=e(1),a=e(12),f=e(30),l=e(4),c=e(7),p=e(10),m=e(62),d=e(64),g=e(40),v=e(41).set,y=e(72)(),w=e(19),M=e(36),b=e(37),_="Promise",x=h.TypeError,A=h.process,E=h[_],S="process"==f(A),T=function(){},P=i=w.f,B=!!function(){try{var t=E.resolve(1),r=(t.constructor={})[e(2)("species")]=function(t){t(T,T)};return(S||"function"==typeof PromiseRejectionEvent)&&t.then(T)instanceof r}catch(n){}}(),R=function(t){var r;return!(!c(t)||"function"!=typeof(r=t.then))&&r},j=function(t,r){if(!t._n){t._n=!0;var e=t._c;y(function(){for(var n=t._v,i=1==t._s,o=0,u=function(r){var e,o,u,s=i?r.ok:r.fail,h=r.resolve,a=r.reject,f=r.domain;try{s?(i||(2==t._h&&O(t),t._h=1),s===!0?e=n:(f&&f.enter(),e=s(n),f&&(f.exit(),u=!0)),e===r.promise?a(x("Promise-chain cycle")):(o=R(e))?o.call(e,h,a):h(e)):a(n)}catch(l){f&&!u&&f.exit(),a(l)}};e.length>o;)u(e[o++]);t._c=[],t._n=!1,r&&!t._h&&D(t)})}},D=function(t){v.call(h,function(){var r,e,n,i=t._v,o=k(t);if(o&&(r=M(function(){S?A.emit("unhandledRejection",i,t):(e=h.onunhandledrejection)?e({promise:t,reason:i}):(n=h.console)&&n.error&&n.error("Unhandled promise rejection",i)}),t._h=S||k(t)?2:1),t._a=void 0,o&&r.e)throw r.v})},k=function(t){return 1!==t._h&&0===(t._a||t._c).length},O=function(t){v.call(h,function(){var r;S?A.emit("rejectionHandled",t):(r=h.onrejectionhandled)&&r({promise:t,reason:t._v})})},L=function(t){var r=this;r._d||(r._d=!0,r=r._w||r,r._v=t,r._s=2,r._a||(r._a=r._c.slice()),j(r,!0))},I=function(t){var r,e=this;if(!e._d){e._d=!0,e=e._w||e;try{if(e===t)throw x("Promise can't be resolved itself");(r=R(t))?y(function(){var n={_w:e,_d:!1};try{r.call(t,a(I,n,1),a(L,n,1))}catch(i){L.call(n,i)}}):(e._v=t,e._s=1,j(e,!1))}catch(n){L.call({_w:e,_d:!1},n)}}};B||(E=function(t){m(this,E,_,"_h"),p(t),n.call(this);try{t(a(I,this,1),a(L,this,1))}catch(r){L.call(this,r)}},n=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},n.prototype=e(81)(E.prototype,{then:function(t,r){var e=P(g(this,E));return e.ok="function"!=typeof t||t,e.fail="function"==typeof r&&r,e.domain=S?A.domain:void 0,this._c.push(e),this._a&&this._a.push(e),this._s&&j(this,!1),e.promise},"catch":function(t){return this.then(void 0,t)}}),o=function(){var t=new n;this.promise=t,this.resolve=a(I,t,1),this.reject=a(L,t,1)},w.f=P=function(t){return t===E||t===u?new o(t):i(t)}),l(l.G+l.W+l.F*!B,{Promise:E}),e(21)(E,_),e(83)(_),u=e(0)[_],l(l.S+l.F*!B,_,{reject:function(t){var r=P(this),e=r.reject;return e(t),r.promise}}),l(l.S+l.F*(s||!B),_,{resolve:function(t){return b(s&&this===u?E:this,t)}}),l(l.S+l.F*!(B&&e(70)(function(t){E.all(t)["catch"](T)})),_,{all:function(t){var r=this,e=P(r),n=e.resolve,i=e.reject,o=M(function(){var e=[],o=0,u=1;d(t,!1,function(t){var s=o++,h=!1;e.push(void 0),u++,r.resolve(t).then(function(t){h||(h=!0,e[s]=t,--u||n(e))},i)}),--u||n(e)});return o.e&&i(o.v),e.promise},race:function(t){var r=this,e=P(r),n=e.reject,i=M(function(){d(t,!1,function(t){r.resolve(t).then(e.resolve,n)})});return i.e&&n(i.v),e.promise}})},function(t,r,e){"use strict";var n=e(84)(!0);e(34)(String,"String",function(t){this._t=t+"",this._i=0},function(){var t,r=this._t,e=this._i;return r.length>e?(t=n(r,e),this._i+=t.length,{value:t,done:!1}):{value:void 0,done:!0}})},function(t,r,e){"use strict";var n=e(4),i=e(0),o=e(1),u=e(40),s=e(37);n(n.P+n.R,"Promise",{"finally":function(t){var r=u(this,i.Promise||o.Promise),e="function"==typeof t;return this.then(e?function(e){return s(r,t()).then(function(){return e})}:t,e?function(e){return s(r,t()).then(function(){throw e})}:t)}})},function(t,r,e){"use strict";var n=e(4),i=e(19),o=e(36);n(n.S,"Promise",{"try":function(t){var r=i.f(this),e=o(t);return(e.e?r.reject:r.resolve)(e.v),r.promise}})},function(t,r,e){e(88);for(var n=e(1),i=e(6),o=e(8),u=e(2)("toStringTag"),s="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),h=0;s.length>h;h++){var a=s[h],f=n[a],l=f&&f.prototype;l&&!l[u]&&i(l,u,a),o[a]=o.Array}},function(t,r,e){"use strict";(function(r){function n(t){var r=t;if("string"!=typeof r)throw Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof r+", while padToEven.");return r.length%2&&(r="0"+r),r}function i(t){var r=t.toString(16);return"0x"+n(r)}function o(t){var e=i(t);return r.from(e.slice(2),"hex")}function u(t){if("string"!=typeof t)throw Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof t+"'.");return r.byteLength(t,"utf8")}function s(t,r,e){if(Array.isArray(t)!==!0)throw Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof t+"'");if(Array.isArray(r)!==!0)throw Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof r+"'");return r[!!e&&"some"||"every"](function(r){return t.indexOf(r)>=0})}function h(t){var e=new r(n(d(t).replace(/^0+|0+$/g,"")),"hex");return e.toString("utf8")}function a(t){var r="",e=0,n=t.length;for("0x"===t.substring(0,2)&&(e=2);n>e;e+=2){var i=parseInt(t.substr(e,2),16);r+=String.fromCharCode(i)}return r}function f(t){var e=new r(t,"utf8");return"0x"+n(e.toString("hex")).replace(/^0+|0+$/g,"")}function l(t){for(var r="",e=0;t.length>e;e++){var n=t.charCodeAt(e),i=n.toString(16);r+=2>i.length?"0"+i:i}return"0x"+r}function c(t,r,e){if(!Array.isArray(t))throw Error("[ethjs-util] method getKeys expecting type Array as 'params' input, got '"+typeof t+"'");if("string"!=typeof r)throw Error("[ethjs-util] method getKeys expecting type String for input 'key' got '"+typeof r+"'.");for(var n=[],i=0;t.length>i;i++){var o=t[i][r];if(e&&!o)o="";else if("string"!=typeof o)throw Error("invalid abi");n.push(o)}return n}function p(t,r){return!("string"!=typeof t||!t.match(/^0x[0-9A-Fa-f]*$/))&&(!r||t.length===2+2*r)}var m=e(29),d=e(15);t.exports={arrayContainsArray:s,intToBuffer:o,getBinarySize:u,isHexPrefixed:m,stripHexPrefix:d,padToEven:n,intToHex:i,fromAscii:l,fromUtf8:f,toAscii:a,toUtf8:h,getKeys:c,isHexString:p}}).call(r,e(16).Buffer)},function(t,r){r.read=function(t,r,e,n,i){var o,u,s=8*i-n-1,h=(1<>1,f=-7,l=e?i-1:0,c=e?-1:1,p=t[r+l];for(l+=c,o=p&(1<<-f)-1,p>>=-f,f+=s;f>0;o=256*o+t[r+l],l+=c,f-=8);for(u=o&(1<<-f)-1,o>>=-f,f+=n;f>0;u=256*u+t[r+l],l+=c,f-=8);if(0===o)o=1-a;else{if(o===h)return u?NaN:(p?-1:1)*(1/0);u+=Math.pow(2,n),o-=a}return(p?-1:1)*u*Math.pow(2,o-n)},r.write=function(t,r,e,n,i,o){var u,s,h,a=8*o-i-1,f=(1<>1,c=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:o-1,m=n?1:-1,d=0>r||0===r&&0>1/r?1:0;for(r=Math.abs(r),isNaN(r)||r===1/0?(s=isNaN(r)?1:0,u=f):(u=Math.floor(Math.log(r)/Math.LN2),r*(h=Math.pow(2,-u))<1&&(u--,h*=2),r+=1>u+l?c*Math.pow(2,1-l):c/h,2>r*h||(u++,h/=2),f>u+l?1>u+l?(s=r*Math.pow(2,l-1)*Math.pow(2,i),u=0):(s=(r*h-1)*Math.pow(2,i),u+=l):(s=0,u=f));i>=8;t[e+p]=255&s,p+=m,s/=256,i-=8);for(u=u<0;t[e+p]=255&u,p+=m,u/=256,a-=8);t[e+p-m]|=128*d}},function(t,r){"use strict";var e=Object.prototype.toString;t.exports=function(t){return"[object Function]"===e.call(t)}},function(t,r){var e={}.toString; 4 | t.exports=Array.isArray||function(t){return"[object Array]"==e.call(t)}},function(t,r){t.exports={methods:{web3_clientVersion:[[],"S"],web3_sha3:[["S"],"D",1],net_version:[[],"S"],net_peerCount:[[],"Q"],net_listening:[[],"B"],personal_sign:[["D","D20","S"],"D",2],personal_ecRecover:[["D","D"],"D20",2],eth_protocolVersion:[[],"S"],eth_syncing:[[],"B|EthSyncing"],eth_coinbase:[[],"D20"],eth_mining:[[],"B"],eth_hashrate:[[],"Q"],eth_gasPrice:[[],"Q"],eth_accounts:[[],["D20"]],eth_blockNumber:[[],"Q"],eth_getBalance:[["D20","Q|T"],"Q",1,2],eth_getStorageAt:[["D20","Q","Q|T"],"D",2,2],eth_getTransactionCount:[["D20","Q|T"],"Q",1,2],eth_getBlockTransactionCountByHash:[["D32"],"Q",1],eth_getBlockTransactionCountByNumber:[["Q|T"],"Q",1],eth_getUncleCountByBlockHash:[["D32"],"Q",1],eth_getUncleCountByBlockNumber:[["Q"],"Q",1],eth_getCode:[["D20","Q|T"],"D",1,2],eth_sign:[["D20","D"],"D",2],eth_signTypedData:[["Array|DATA","D20"],"D",1],eth_sendTransaction:[["SendTransaction"],"D",1],eth_sendRawTransaction:[["D"],"D32",1],eth_call:[["CallTransaction","Q|T"],"D",1,2],eth_estimateGas:[["EstimateTransaction","Q|T"],"Q",1],eth_getBlockByHash:[["D32","B"],"Block",2],eth_getBlockByNumber:[["Q|T","B"],"Block",2],eth_getTransactionByHash:[["D32"],"Transaction",1],eth_getTransactionByBlockHashAndIndex:[["D32","Q"],"Transaction",2],eth_getTransactionByBlockNumberAndIndex:[["Q|T","Q"],"Transaction",2],eth_getTransactionReceipt:[["D32"],"Receipt",1],eth_getUncleByBlockHashAndIndex:[["D32","Q"],"Block",1],eth_getUncleByBlockNumberAndIndex:[["Q|T","Q"],"Block",2],eth_getCompilers:[[],["S"]],eth_compileLLL:[["S"],"D",1],eth_compileSolidity:[["S"],"D",1],eth_compileSerpent:[["S"],"D",1],eth_newFilter:[["Filter"],"Q",1],eth_newBlockFilter:[[],"Q"],eth_newPendingTransactionFilter:[[],"Q"],eth_uninstallFilter:[["QP"],"B",1],eth_getFilterChanges:[["QP"],["FilterChange"],1],eth_getFilterLogs:[["QP"],["FilterChange"],1],eth_getLogs:[["Filter"],["FilterChange"],1],eth_getWork:[[],["D"]],eth_submitWork:[["D","D32","D32"],"B",3],eth_submitHashrate:[["D","D"],"B",2],db_putString:[["S","S","S"],"B",2],db_getString:[["S","S"],"S",2],db_putHex:[["S","S","D"],"B",2],db_getHex:[["S","S"],"D",2],shh_post:[["SHHPost"],"B",1],shh_version:[[],"S"],shh_newIdentity:[[],"D"],shh_hasIdentity:[["D"],"B"],shh_newGroup:[[],"D"],shh_addToGroup:[["D"],"B",1],shh_newFilter:[["SHHFilter"],"Q",1],shh_uninstallFilter:[["Q"],"B",1],shh_getFilterChanges:[["Q"],["SHHFilterChange"],1],shh_getMessages:[["Q"],["SHHFilterChange"],1]},tags:["latest","earliest","pending"],objects:{EthSyncing:{__required:[],startingBlock:"Q",currentBlock:"Q",highestBlock:"Q"},SendTransaction:{__required:["from","data"],from:"D20",to:"D20",gas:"Q",gasPrice:"Q",value:"Q",data:"D",nonce:"Q"},EstimateTransaction:{__required:[],from:"D20",to:"D20",gas:"Q",gasPrice:"Q",value:"Q",data:"D",nonce:"Q"},CallTransaction:{__required:["to"],from:"D20",to:"D20",gas:"Q",gasPrice:"Q",value:"Q",data:"D",nonce:"Q"},Block:{__required:[],number:"Q",hash:"D32",parentHash:"D32",nonce:"D",sha3Uncles:"D",logsBloom:"D",transactionsRoot:"D",stateRoot:"D",receiptsRoot:"D",miner:"D",difficulty:"Q",totalDifficulty:"Q",extraData:"D",size:"Q",gasLimit:"Q",gasUsed:"Q",timestamp:"Q",transactions:["DATA|Transaction"],uncles:["D"]},Transaction:{__required:[],hash:"D32",nonce:"Q",blockHash:"D32",blockNumber:"Q",transactionIndex:"Q",from:"D20",to:"D20",value:"Q",gasPrice:"Q",gas:"Q",input:"D"},Receipt:{__required:[],transactionHash:"D32",transactionIndex:"Q",blockHash:"D32",blockNumber:"Q",cumulativeGasUsed:"Q",gasUsed:"Q",contractAddress:"D20",logs:["FilterChange"]},Filter:{__required:[],fromBlock:"Q|T",toBlock:"Q|T",address:"D20",topics:["D"]},FilterChange:{__required:[],removed:"B",logIndex:"Q",transactionIndex:"Q",transactionHash:"D32",blockHash:"D32",blockNumber:"Q",address:"D20",data:"Array|DATA",topics:["D"]},SHHPost:{__required:["topics","payload","priority","ttl"],from:"D",to:"D",topics:["D"],payload:"D",priority:"Q",ttl:"Q"},SHHFilter:{__required:["topics"],to:"D",topics:["D"]},SHHFilterChange:{__required:[],hash:"D",from:"D",to:"D",expiry:"Q",ttl:"Q",sent:"Q",topics:["D"],payload:"D",workProved:"Q"},SHHMessage:{__required:[],hash:"D",from:"D",to:"D",expiry:"Q",ttl:"Q",sent:"Q",topics:["D"],payload:"D",workProved:"Q"}}}},function(t,r,e){var n=function(){return this}()||Function("return this")(),i=n.regeneratorRuntime&&Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime")>=0,o=i&&n.regeneratorRuntime;if(n.regeneratorRuntime=void 0,t.exports=e(104),i)n.regeneratorRuntime=o;else try{delete n.regeneratorRuntime}catch(u){n.regeneratorRuntime=void 0}},function(t,r){!function(r){"use strict";function e(t,r,e,n){var o=r&&r.prototype instanceof i?r:i,u=Object.create(o.prototype),s=new p(n||[]);return u._invoke=a(t,e,s),u}function n(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(n){return{type:"throw",arg:n}}}function i(){}function o(){}function u(){}function s(t){["next","throw","return"].forEach(function(r){t[r]=function(t){return this._invoke(r,t)}})}function h(t){function r(e,i,o,u){var s=n(t[e],t,i);if("throw"!==s.type){var h=s.arg,a=h.value;return a&&"object"==typeof a&&y.call(a,"__await")?Promise.resolve(a.__await).then(function(t){r("next",t,o,u)},function(t){r("throw",t,o,u)}):Promise.resolve(a).then(function(t){h.value=t,o(h)},u)}u(s.arg)}function e(t,e){function n(){return new Promise(function(n,i){r(t,e,n,i)})}return i=i?i.then(n,n):n()}var i;this._invoke=e}function a(t,r,e){var i=E;return function(o,u){if(i===T)throw Error("Generator is already running");if(i===P){if("throw"===o)throw u;return d()}for(e.method=o,e.arg=u;;){var s=e.delegate;if(s){var h=f(s,e);if(h){if(h===B)continue;return h}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(i===E)throw i=P,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);i=T;var a=n(t,r,e);if("normal"===a.type){if(i=e.done?P:S,a.arg===B)continue;return{value:a.arg,done:e.done}}"throw"===a.type&&(i=P,e.method="throw",e.arg=a.arg)}}}function f(t,r){var e=t.iterator[r.method];if(e===g){if(r.delegate=null,"throw"===r.method){if(t.iterator["return"]&&(r.method="return",r.arg=g,f(t,r),"throw"===r.method))return B;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return B}var i=n(e,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,B;var o=i.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=g),r.delegate=null,B):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,B)}function l(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function c(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function p(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(l,this),this.reset(!0)}function m(t){if(t){var r=t[M];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,n=function i(){for(;++e=0;--n){var i=this.tryEntries[n],o=i.completion;if("root"===i.tryLoc)return r("end");if(this.prev>=i.tryLoc){var u=y.call(i,"catchLoc"),s=y.call(i,"finallyLoc");if(u&&s){if(i.catchLoc>this.prev)return r(i.catchLoc,!0);if(i.finallyLoc>this.prev)return r(i.finallyLoc)}else if(u){if(i.catchLoc>this.prev)return r(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return r(i.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(this.prev>=n.tryLoc&&y.call(n,"finallyLoc")&&n.finallyLoc>this.prev){var i=n;break}}!i||"break"!==t&&"continue"!==t||i.tryLoc>r||r>i.finallyLoc||(i=null);var o=i?i.completion:{};return o.type=t,o.arg=r,i?(this.method="next",this.next=i.finallyLoc,B):this.complete(o)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),B},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),c(e),B}},"catch":function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var i=n.arg;c(e)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:m(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=g),B}}}(function(){return this}()||Function("return this")())},function(t,r,e){"use strict";(function(r){t.exports="function"==typeof r?r:function(){var t=[].slice.apply(arguments);t.splice(1,0,0),setTimeout.apply(null,t)}}).call(r,e(26).setImmediate)},function(t,r){function e(){throw Error("setTimeout has not been defined")}function n(){throw Error("clearTimeout has not been defined")}function i(t){if(f===setTimeout)return setTimeout(t,0);if((f===e||!f)&&setTimeout)return f=setTimeout,setTimeout(t,0);try{return f(t,0)}catch(r){try{return f.call(null,t,0)}catch(r){return f.call(this,t,0)}}}function o(t){if(l===clearTimeout)return clearTimeout(t);if((l===n||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(r){try{return l.call(null,t)}catch(r){return l.call(this,t)}}}function u(){d&&p&&(d=!1,p.length?m=p.concat(m):g=-1,m.length&&s())}function s(){if(!d){var t=i(u);d=!0;for(var r=m.length;r;){for(p=m,m=[];++g1)for(var e=1;arguments.length>e;e++)r[e-1]=arguments[e];m.push(new h(t,r)),1!==m.length||d||i(s)},h.prototype.run=function(){this.fun.apply(null,this.array)},c.title="browser",c.browser=!0,c.env={},c.argv=[],c.version="",c.versions={},c.on=a,c.addListener=a,c.once=a,c.off=a,c.removeListener=a,c.removeAllListeners=a,c.emit=a,c.prependListener=a,c.prependOnceListener=a,c.listeners=function(t){return[]},c.binding=function(t){throw Error("process.binding is not supported")},c.cwd=function(){return"/"},c.chdir=function(t){throw Error("process.chdir is not supported")},c.umask=function(){return 0}},function(t,r){var e;e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(n){"object"==typeof window&&(e=window)}t.exports=e},function(t,r){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,configurable:!1,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,configurable:!1,get:function(){return t.i}}),t.webpackPolyfill=1),t}}])}); --------------------------------------------------------------------------------