[
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\ncharset = utf-8\nend_of_line = lf\nindent_style = tab\ninsert_final_newline = true\ntrim_trailing_whitespace = true\n"
  },
  {
    "path": ".gitignore",
    "content": "# General\n.DS_Store\n*.swp\n*.orig\n\n# Logs\nlogs\n*.log\nnpm-debug.log*\n\n# Runtime data\npids\n*.pid\n*.seed\n\n# Directory for instrumented libs generated by jscoverage/JSCover\nlib-cov\n\n# Coverage directory used by tools like istanbul\ncoverage\ntest/.coverage-unit\n\n# nyc test coverage\n.nyc_output\n\n# cypress media\ntemplates/cypress.tmpl/screenshots/\ntemplates/cypress.tmpl/videos/\ntemplates/cypress.tmpl/plugins/\ntemplates/cypress.tmpl/support/\ncypress/screenshots\ncypress/videos\ncypress/plugins\n\n# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)\n.grunt\n\n# node-waf configuration\n.lock-wscript\n\n# Compiled binary addons (http://nodejs.org/api/addons.html)\nbuild/Release\n\n# Dependency directories\nnode_modules\njspm_packages\n\n# Optional npm cache directory\n.npm\n\n# Optional REPL history\n.node_repl_history\n\n# IDE directories\n.idea\ntmp\n.vscode\n\n# Distribution folders\ndist-node/\ndist-browser/\nbrowsertest.build/\nbrowsertest/package.json\nbrowsertest/browsertest.js\nbrowsertest/browsertest.min.js\nbrowsertest/src\nbrowsertest/test\n\n# Unsupported lock files\nyarn.lock\n"
  },
  {
    "path": ".lintstagedrc.json",
    "content": "{\n\t\"*.{ts,js}\": [\"prettier --write\", \"git add\"]\n}\n"
  },
  {
    "path": ".nvmrc",
    "content": "8.12.0\n"
  },
  {
    "path": "Jenkinsfile",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\n@Library('lisk-jenkins') _\npipeline {\n\tagent { node { label 'lisk-elements' } }\n\tstages {\n\t\tstage('Cancel previous running PR') {\n\t\t\tsteps {\n\t\t\t\tscript{\n\t\t\t\t\tif (env.CHANGE_ID) {\n\t\t\t\t\t\t// This is a Pull Request\n\t\t\t\t\t\tcancelPreviousBuild()\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tstage('Install dependencies') {\n\t\t\tsteps {\n\t\t\t\tscript {\n\t\t\t\t\tcache_file = restoreCache(\"package.json\")\n\t\t\t\t}\n\t\t\t\tnvm(getNodejsVersion()) {\n\t\t\t\t\tsh 'npm install --verbose'\n\t\t\t\t}\n\t\t\t\tscript {\n\t\t\t\t\tsaveCache(cache_file, './node_modules', 10)\n\t\t\t\t\tsh '''\n\t\t\t\t\tif [ ! -f \"/home/lisk/.cache/Cypress/$(jq -r .devDependencies.cypress ./packages/lisk-constants/package.json)/Cypress/Cypress\" ]; then\n\t\t\t\t\t\t./packages/lisk-constants/node_modules/.bin/cypress install --force\n\t\t\t\t\tfi\n\t\t\t\t\t'''\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tstage('Build') {\n\t\t\tsteps {\n\t\t\t\tnvm(getNodejsVersion()) {\n\t\t\t\t\tsh 'npm run build'\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tstage('Run lint') {\n\t\t\tsteps {\n\t\t\t\tansiColor('xterm') {\n\t\t\t\t\tnvm(getNodejsVersion()) {\n\t\t\t\t\t\tsh 'npm run lint'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tstage('Run tests') {\n\t\t\tsteps {\n\t\t\t\tansiColor('xterm') {\n\t\t\t\t\tnvm(getNodejsVersion()) {\n\t\t\t\t\t\tsh 'npm run test'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tstage('Run node tests') {\n\t\t\tsteps {\n\t\t\t\tansiColor('xterm') {\n\t\t\t\t\tnvm(getNodejsVersion()) {\n\t\t\t\t\t\tsh 'npm run test:node'\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tstage('Run browser tests') {\n\t\t\tsteps {\n\t\t\t\tnvm(getNodejsVersion()) {\n\t\t\t\t\tsh '''\n\t\t\t\t\tnpm run build:browsertest\n\t\t\t\t\tnpm run test:browser\n\t\t\t\t\t'''\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tpost {\n\t\tsuccess {\n\t\t\tscript {\n\t\t\t\tbuild_info = getBuildInfo()\n\t\t\t\tliskSlackSend('good', \"Recovery: build ${build_info} was successful.\")\n\t\t\t}\n\t\t\tdeleteDir()\n\t\t\tgithubNotify context: 'continuous-integration/jenkins/lisk-elements', description: 'The build passed.', status: 'SUCCESS'\n\t\t}\n\t\tfailure {\n\t\t\tscript {\n\t\t\t\tbuild_info = getBuildInfo()\n\t\t\t\tliskSlackSend('danger', \"Build ${build_info} failed (<${env.BUILD_URL}/console|console>, <${env.BUILD_URL}/changes|changes>)\\n\")\n\t\t\t}\n\t\t\tarchiveArtifacts allowEmptyArchive: true, artifacts: 'cypress/screenshots/'\n\t\t\tgithubNotify context: 'continuous-integration/jenkins/lisk-elements', description: 'The build failed.', status: 'FAILURE'\n\t\t}\n\t\taborted {\n\t\t\tgithubNotify context: 'continuous-integration/jenkins/lisk-elements', description: 'The build was aborted.', status: 'ERROR'\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "Jenkinsfile.nightly",
    "content": "pipeline {\n\tagent { node { label 'lisk-elements' } }\n\tstages {\n\t\tstage('Cache dependencies') {\n\t\t\tsteps {\n\t\t\t\tnvm(getNodejsVersion()) {\n\t\t\t\t\tsh 'npm install --verbose'\n\t\t\t\t}\n\t\t\t\tscript {\n\t\t\t\t\tsh '''\n\t\t\t\t\tBRANCH=${CHANGE_TARGET:-${BRANCH_NAME:-development}}\n\t\t\t\t\tif [ ! -d ~/cache/$BRANCH ]; then\n\t\t\t\t\t\tmkdir ~/cache/$BRANCH\n\t\t\t\t\tfi\n\t\t\t\t\trsync -axl --delete ./node_modules ~/cache/$BRANCH/\n\t\t\t\t\t'''\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tpost {\n\t\tsuccess {\n\t\t\tdeleteDir()\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    {one line to give the program's name and a brief idea of what it does.}\n    Copyright (C) {year}  {name of author}\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    {project}  Copyright (C) {year}  {fullname}\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "docs/CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nIn the interest of fostering an open and welcoming environment, we as\ncontributors and maintainers pledge to making participation in our project and\nour community a harassment-free experience for everyone, regardless of age, body\nsize, disability, ethnicity, gender identity and expression, level of experience,\nnationality, personal appearance, race, religion, or sexual identity and\norientation.\n\n## Our Standards\n\nExamples of behavior that contributes to creating a positive environment\ninclude:\n\n* Using welcoming and inclusive language\n* Being respectful of differing viewpoints and experiences\n* Gracefully accepting constructive criticism\n* Focusing on what is best for the community\n* Showing empathy towards other community members\n\nExamples of unacceptable behavior by participants include:\n\n* The use of sexualized language or imagery and unwelcome sexual attention or\n  advances\n* Trolling, insulting/derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or electronic\n  address, without explicit permission\n* Other conduct which could reasonably be considered inappropriate in a\n  professional setting\n\n## Our Responsibilities\n\nProject maintainers are responsible for clarifying the standards of acceptable\nbehavior and are expected to take appropriate and fair corrective action in\nresponse to any instances of unacceptable behavior.\n\nProject maintainers have the right and responsibility to remove, edit, or\nreject comments, commits, code, wiki edits, issues, and other contributions\nthat are not aligned to this Code of Conduct, or to ban temporarily or\npermanently any contributor for other behaviors that they deem inappropriate,\nthreatening, offensive, or harmful.\n\n## Scope\n\nThis Code of Conduct applies both within project spaces and in public spaces\nwhen an individual is representing the project or its community. Examples of\nrepresenting a project or community include using an official project e-mail\naddress, posting via an official social media account, or acting as an appointed\nrepresentative at an online or offline event. Representation of a project may be\nfurther defined and clarified by project maintainers.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be\nreported by contacting the project team at [info@lisk.io](mailto:info@lisk.io). All\ncomplaints will be reviewed and investigated and will result in a response that\nis deemed necessary and appropriate to the circumstances. The project team is\nobligated to maintain confidentiality with regard to the reporter of an incident.\nFurther details of specific enforcement policies may be posted separately.\n\nProject maintainers who do not follow or enforce the Code of Conduct in good\nfaith may face temporary or permanent repercussions as determined by other\nmembers of the project's leadership.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,\navailable at https://www.contributor-covenant.org/version/1/4/code-of-conduct/\n\n[homepage]: https://www.contributor-covenant.org\n"
  },
  {
    "path": "docs/CONTRIBUTING.md",
    "content": "# Contributing to Lisk Elements\n\nFirst off, thanks for taking the time to contribute! :raised_hands:\n\nThe following is a set of guidelines for contributing to Lisk Elements, which are hosted in the [LiskHQ Organization](https://github.com/LiskHQ) on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.\n\n#### Table Of Contents\n\n1. [Code of Conduct](#code-of-conduct)\n\n1. [Help! I don't want to read this whole thing, I just have one question. :mag_right:](#help!-i-dont-want-to-read-this-whole-thing-i-just-have-a-question)\n\n1. [How Can I Contribute?](#how-can-i-contribute)\n\t1. [Reporting Bugs](#reporting-bugs)\n\t1. [Suggesting Enhancements](#suggesting-enhancements)\n\t1. [Pull Requests](#pull-requests)\n\n1. [Styleguides](#styleguides)\n\t1. [Git Commit Messages](#git-commit-messages)\n\t1. [JavaScript Styleguide](#javascript-styleguide)\n\n## Code of Conduct\n\nThis project and everyone participating in it is governed by the [Lisk Elements Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [info@lisk.io](mailto:info@lisk.io).\n\n## Project License\n\nEvery repository within LiskHQ comes with a LICENSE file. Please read it carefully before commiting your code to one of the repositories.\n\n\n## Help! I don't want to read this whole thing, I just have a question. :mag_right:\n\nLisk is an open-source decentralized project, there are many ways and platforms to get help. These are some of them:\n\n* [Discuss and Ask on Reddit](https://www.reddit.com/r/Lisk/)\n* [Lisk FAQ](https://docs.lisk.io/docs/faq)\n\nIf you prefer to chat with LiskHQ and other developers directly:\n\n* [Join the LiskHQ Gitter](https://gitter.im/LiskHQ/lisk)\n* Even though Gitter is a chat service, sometimes it takes several hours for community members to respond &mdash; please be patient!\n\n## How Can I Contribute?\n\nLiskHQ uses GitHub as its sole source of truth. Everything happens here. Lightcurve employees who contribute to Lisk are expected to do so in the same way as everyone else. In other words, this document applies equally to all contributors.\n\n### `master` is unsafe for production use\n\nWe will do our best to keep `master` in good shape, with tests passing at all times. But in order to move fast, we will make API changes that your application might not be compatible with. We will do our best to communicate these changes and always version appropriately so you can lock into a specific, stable version.\n\n### Pull Requests\n\nBroadly speaking, we conform to the git flow branching model. For a description of this model, see [this introduction](https://datasift.github.io/gitflow/IntroducingGitFlow.html).\n\nIn case you've never submitted a pull request (PR) via GitHub before, please read [this short tutorial](https://help.github.com/articles/creating-a-pull-request). If you've submitted a PR before, there should be nothing surprising about our procedures for Lisk.\n\n*Before* submitting a pull request, please make sure the following is done:\n\n1. Fork the repo.\n1. If you are creating a pull request that addresses a specific issue, take a look at the projects that issue is a part of (in the right-hand sidebar). Most issues will be a part of a project for a specific version, such as \"Version 1.0.0\". If this is the case, create your branch from the relevant version branch, e.g. `1.0.0`, and submit your pull request against that branch as a base. Otherwise, create your branch from master.\n1. Add tests to the code you have contributed! All new code must come with complete test coverage. End all files with a newline. In general, your code should conform to the rules listed in the .editorconfig file. There are plugins for most editors/IDEs to do this for you automatically. Update the README for the changes that adhere to your new code.\n1. Ensure the test and linting suite passes (`npm run prepush` runs both). Follow the JavaScript styleguide from Airbnb with the lisk extension.\n1. Submit a pull request via GitHub. Include issue numbers in the PR title, at the end with: Description - Closes #IssueNumber. Also mention the #IssueNumber in the Comment, to easier browse to the issue.\n1. Check that Jenkins CI tests pass (pull request turns green). First time contributors will need to wait for a trusted team member to start Jenkins CI on a Pull Request.\n\n### Reporting Bugs\n\nThis section guides you through submitting a bug report for Lisk Elements. Following these guidelines helps maintainers and the community understand your report :pencil:, reproduce the behavior :computer: :computer:, and find related reports :mag_right:.\n\nBefore creating bug reports, please check [this list](#before-submitting-a-bug-report) as you might find out that you don't need to create one. When you are creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](ISSUE_TEMPLATE.md), the information it asks for helps us resolve issues faster.\n\n> **Note:** If you find a **Closed** issue that seems like it is the same thing that you're experiencing, open a new issue and include a link to the original issue in the body of your new one.\n\n#### Before Submitting A Bug Report\n\n* **Check the [FAQs](https://docs.lisk.io/docs/faq)** for a list of common questions and problems.\n* **Determine [which repository the problem should be reported in](https://github.com/LiskHQ)**.\n* **Perform a [cursory search](https://github.com/search?utf8=%E2%9C%93&q=+is%3Aissue+org%3ALiskHQ&type=)** to see if the problem has already been reported. If it has **and the issue is still open**, add a comment to the existing issue instead of opening a new one.\n\n#### How Do I Submit A (Good) Bug Report?\n\nBugs are tracked as [GitHub issues](https://guides.github.com/features/issues/). After you've determined [which repository](https://github.com/LiskHQ) your bug is related to, create an issue on that repository and provide the following information by filling in [the template](ISSUE_TEMPLATE.md).\n\nExplain the problem and include additional details to help maintainers reproduce the problem:\n\n* **Use a clear and descriptive title** for the issue to identify the problem.\n* **Describe the exact steps which reproduce the problem** in as many details as possible. For example, start by explaining how you started Lisk Elements, e.g. with Node.js or in the Browser (which one? which version?), or how you started Lisk Elements otherwise. When listing steps, **don't just say what you did, but explain how you did it**. For example, if you have used an API model provide the configuration you have chosen and the functions you have executed. **Make sure to erase sensitive information from the configuration or details you are passing - NEVER SHARE YOUR SECRET PASSPHRASES OR PRIVATE KEYS**.\n* **Provide specific examples to demonstrate the steps**. Include links to files or GitHub projects, or copy/pasteable snippets, which you use in those examples. If you're providing snippets in the issue, use [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).\n* **Describe the behavior you observed after following the steps** and point out what exactly is the problem with that behavior.\n* **Explain which behavior you expected to see instead and why.**\n* **Include screenshots and animated GIFs** which show you following the described steps and clearly demonstrate the problem. You can use [this tool](http://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.\n* **If the problem wasn't triggered by a specific action**, describe what you were doing before the problem happened and share more information using the guidelines below.\n\nProvide more context by answering these questions:\n\n* **Did the problem start happening recently** (e.g. after updating to a new version of Lisk Elements, Lisk or any other repository) or was this always a problem?\n* If the problem started happening recently, **can you reproduce the problem in an older version of Lisk Elements?** What's the most recent version in which the problem doesn't happen? You can download older versions of Lisk Elements from [the releases page](https://github.com/LiskHQ/lisk-elements/releases).\n* **Can you reliably reproduce the issue?** If not, provide details about how often the problem happens and under which conditions it normally happens.\n\n### Suggesting Enhancements\n\nThis section guides you through submitting an enhancement suggestion for Lisk Elements, including completely new features and minor improvements to existing functionality. Following these guidelines helps maintainers and the community understand your suggestion :pencil: and find related suggestions :mag_right:.\n\n When you are creating an enhancement suggestion, please include as many details as possible. Fill in [the template](ISSUE_TEMPLATE.md), including the steps that you imagine you would take if the feature you're requesting existed.\n\n#### How Do I Submit A (Good) Enhancement Suggestion?\n\nEnhancement suggestions are tracked as [GitHub issues](https://guides.github.com/features/issues/). After you've determined [which repository](https://github.com/LiskHQ) your enhancement suggestion is related to, create an issue on that repository and provide the following information:\n\n* **Use a clear and descriptive title** for the issue to identify the suggestion.\n* **Provide a step-by-step description of the suggested enhancement** in as many details as possible.\n* **Provide specific examples to demonstrate the steps**. Include copy/pasteable snippets which you use in those examples, as [Markdown code blocks](https://help.github.com/articles/markdown-basics/#multiple-lines).\n* **Describe the current behavior** and **explain which behavior you expected to see instead** and why.\n* **Include screenshots and animated GIFs** which help you demonstrate the steps or point out the part of Lisk Elements which the suggestion is related to. You can use [this tool](http://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and [this tool](https://github.com/colinkeenan/silentcast) or [this tool](https://github.com/GNOME/byzanz) on Linux.\n* **Explain why this enhancement would be useful** to most Lisk and Lisk Elements users.\n* **Specify which version of Lisk and Lisk Elements you're using.**\n* **Specify the name and version of the OS you're using.**\n\n## Styleguides\n\n### Git Commit Messages\n\n* Use the present tense (\"Add feature\" not \"Added feature\")\n* Use the imperative mood (\"Move cursor to...\" not \"Moves cursor to...\")\n* Limit the first line to 72 characters or less\n* Reference issues and pull requests liberally after the first line\n* Consider starting the commit message with an applicable emoji:\n\t* :seedling: `:seedling:` when adding a new feature\n\t* :bug: `:bug:` when fixing a bug\n\t* :books: `:books:` when adding or updating documentation\n\t* :nail_care: `:nail_care:` when making changes to code style (e.g. lint settings)\n\t* :recycle: `:recycle:` when refactoring code\n\t* :fire: `:fire:` when removing code or files (including dependencies)\n\t* :racehorse: `:racehorse:` when improving performance\n\t* :white_check_mark: `:white_check_mark:` when adding or updating tests\n\t* :construction_worker: `:construction_worker:` when updating the build process\n\t* :bowtie: `:bowtie:` when updating CI\n\t* :house: `:house:` when performing chores\n\t* :new: `:new:` when adding a new dependency\n\t* :arrow_up: `:arrow_up:` when upgrading a dependency\n\t* :arrow_down: `:arrow_down:` when downgrading a dependency\n\t* :back: `:back:` when reverting changes\n\n### JavaScript Styleguide\n\nOn Lisk Elements we are using [ESLint](https://eslint.org/).\nOur JavaScript style expands [Airbnb's](https://github.com/airbnb/javascript) style. You can get more details here: https://github.com/LiskHQ/eslint-config-lisk-base\n\nThese contribution guidelines were inspired by and are based on Atom's contribution guidelines. They were modified for the purposes of this repository. https://github.com/atom/atom/blob/master/CONTRIBUTING.md - Copyright (c) 2011-2017 GitHub Inc. (MIT)\n"
  },
  {
    "path": "docs/ISSUE_TEMPLATE.md",
    "content": "### Expected behavior\n\n### Actual behavior\n\n### Steps to reproduce\n\n### Which version(s) does this affect? (Environment, OS, etc...)\n"
  },
  {
    "path": "docs/PULL_REQUEST_TEMPLATE.md",
    "content": "### What was the problem?\n\n### How did I fix it?\n\n### How to test it?\n\n### Review checklist\n\n* The PR resolves #INSERT_ISSUE_NUMBER\n* All new code is covered with unit tests\n* All new code was formatted with Prettier\n* Linting passes\n* Tests pass\n* Commit messages follow the [commit guidelines](CONTRIBUTING.md#git-commit-messages)\n* Documentation has been added/updated\n"
  },
  {
    "path": "lerna.json",
    "content": "{\n\t\"lerna\": \"2.11.0\",\n\t\"packages\": [\"packages/*\"],\n\t\"version\": \"independent\",\n\t\"stream\": true\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n\t\"name\": \"lisk-elements-monorepo\",\n\t\"private\": true,\n\t\"version\": \"1.0.0\",\n\t\"description\": \"Reusable packages for use with the Lisk ecosystem\",\n\t\"author\": \"Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>\",\n\t\"license\": \"GPL-3.0\",\n\t\"keywords\": [\n\t\t\"lisk\",\n\t\t\"blockchain\"\n\t],\n\t\"homepage\": \"https://github.com/LiskHQ/lisk-elements#readme\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/LiskHQ/lisk-elements.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/LiskHQ/lisk-elements/issues\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=8.10 <=10\",\n\t\t\"npm\": \">=3 <=6\"\n\t},\n\t\"scripts\": {\n\t\t\"bootstrap\": \"lerna bootstrap\",\n\t\t\"clean\": \"lerna run clean\",\n\t\t\"clean:node_modules\": \"lerna clean --yes\",\n\t\t\"format\": \"npm run format:root && lerna run format\",\n\t\t\"format:root\": \"prettier types/**/*.ts --write\",\n\t\t\"lint\": \"npm run lint:root && lerna run lint\",\n\t\t\"lint:fix\": \"npm run lint:root -- --fix && lerna run lint:fix\",\n\t\t\"lint:root\": \"tslint -p tsconfig.json types/**/*.ts\",\n\t\t\"test\": \"lerna run test\",\n\t\t\"test:node\": \"lerna run test:node\",\n\t\t\"test:browser\": \"lerna run test:browser\",\n\t\t\"build\": \"lerna run build\",\n\t\t\"build:browsertest\": \"lerna run build:browsertest\",\n\t\t\"cover\": \"lerna run cover\",\n\t\t\"init\": \"./scripts/init.sh\",\n\t\t\"postinstall\": \"npm run bootstrap\",\n\t\t\"precommit\": \"lint-staged && npm run lint\",\n\t\t\"prepush\": \"npm run lint && npm test\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@types/node\": \"10.12.0\",\n\t\t\"@types/sinon\": \"5.0.5\",\n\t\t\"husky\": \"0.14.3\",\n\t\t\"lerna\": \"3.4.1\",\n\t\t\"lint-staged\": \"7.3.0\",\n\t\t\"prettier\": \"1.14.2\",\n\t\t\"tslint\": \"5.11.0\",\n\t\t\"tslint-config-prettier\": \"1.15.0\",\n\t\t\"tslint-immutable\": \"4.7.0\",\n\t\t\"typescript\": \"3.1.1\"\n\t},\n\t\"dependencies\": {}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    {one line to give the program's name and a brief idea of what it does.}\n    Copyright (C) {year}  {name of author}\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    {project}  Copyright (C) {year}  {fullname}\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "packages/lisk-api-client/README.md",
    "content": "# @liskhq/lisk-api-client\n@liskhq/lisk-api-client is containing an API client for the Lisk network\n\n## Installation\n\n```sh\n$ npm install --save @liskhq/lisk-api-client\n```\n\n## License\n\nCopyright © 2016-2018 Lisk Foundation\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the [GNU General Public License](https://github.com/LiskHQ/lisk-elements/tree/master/LICENSE) along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n***\n\nThis program also incorporates work previously released with lisk-js `v0.5.2` (and earlier) versions under the [MIT License](https://opensource.org/licenses/MIT). To comply with the requirements of that license, the following permission notice, applicable to those parts of the code only, is included below:\n\nCopyright © 2016-2017 Lisk Foundation\n\nCopyright © 2015 Crypti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[Lisk Core GitHub]: https://github.com/LiskHQ/lisk\n[Lisk documentation site]: https://lisk.io/documentation/lisk-elements\n"
  },
  {
    "path": "packages/lisk-api-client/package.json",
    "content": "{\n\t\"name\": \"@liskhq/lisk-api-client\",\n\t\"version\": \"2.0.0\",\n\t\"description\": \"An API client for the Lisk network\",\n\t\"author\": \"Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>\",\n\t\"license\": \"GPL-3.0\",\n\t\"keywords\": [\n\t\t\"lisk\",\n\t\t\"blockchain\"\n\t],\n\t\"homepage\": \"https://github.com/LiskHQ/lisk-elements/tree/master/packages/lisk-api-client#readme\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/LiskHQ/lisk-elements.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/LiskHQ/lisk-elements/issues\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=8.10 <=10\",\n\t\t\"npm\": \">=5\"\n\t},\n\t\"main\": \"dist-node/index.js\",\n\t\"scripts\": {\n\t\t\"transpile\": \"tsc\",\n\t\t\"transpile:browsertest\": \"tsc -p tsconfig.browsertest.json\",\n\t\t\"browserify\": \"browserify ./dist-node/index.js -o ./dist-browser/index.js -s liskAPIClient\",\n\t\t\"browserify:browsertest\": \"browserify ./browsertest.build/test/*.js ./browsertest.build/test/**/*.js -o ./browsertest.build/browsertest.js -s liskAPIClient\",\n\t\t\"uglify\": \"uglifyjs -nm -o ./dist-browser/index.min.js ./dist-browser/index.js\",\n\t\t\"uglify:browsertest\": \"uglifyjs -o ./browsertest.build/browsertest.min.js ./browsertest.build/browsertest.js\",\n\t\t\"clean\": \"./scripts/clean.sh\",\n\t\t\"format\": \"prettier --write \\\"*.{ts,js,json}\\\" \\\"{src,test}/**/*.{ts,js,json}\\\"\",\n\t\t\"lint\": \"tslint --format verbose --project .\",\n\t\t\"lint:fix\": \"npm run lint -- --fix\",\n\t\t\"test\": \"TS_NODE_PROJECT=./test/tsconfig.json nyc mocha test/{,/**/}/*.ts\",\n\t\t\"test:watch\": \"npm test -- --watch\",\n\t\t\"test:watch:min\": \"npm run test:watch -- --reporter=min\",\n\t\t\"test:node\": \"npm run build:check\",\n\t\t\"serve:start\": \"http-server -p 11541 ./browsertest &\",\n\t\t\"serve:stop\": \"kill $(lsof -t -i:11541) || true\",\n\t\t\"pretest:browser\": \"npm run serve:stop && npm run build:browsertest && npm run serve:start\",\n\t\t\"test:browser\": \"wait-on http://localhost:11541 && cypress run --config baseUrl=http://localhost:11541 --env ROOT_DIR=\\\"${PWD##*/}\\\"\",\n\t\t\"posttest:browser\": \"npm run serve:stop\",\n\t\t\"cover\": \"if [ -z $JENKINS_HOME ]; then npm run cover:local; else npm run cover:ci; fi\",\n\t\t\"cover:base\": \"nyc report\",\n\t\t\"cover:local\": \"npm run cover:base -- --reporter=html --reporter=text\",\n\t\t\"cover:ci\": \"npm run cover:base -- --reporter=text\",\n\t\t\"build:browsertest\": \"npm run transpile:browsertest && npm run browserify:browsertest && npm run uglify:browsertest\",\n\t\t\"postbuild:browsertest\": \"rm -r browsertest.build/src browsertest.build/test\",\n\t\t\"prebuild:node\": \"rm -r dist-node/* || mkdir dist-node || true\",\n\t\t\"build:node\": \"npm run transpile\",\n\t\t\"prebuild:browser\": \"rm ./dist-browser/index.js ./dist-browser/index.min.js || true\",\n\t\t\"build:browser\": \"npm run build:node && npm run browserify && npm run uglify\",\n\t\t\"prebuild\": \"npm run prebuild:browser\",\n\t\t\"build\": \"npm run build:browser\",\n\t\t\"build:check\": \"node -e \\\"require('./dist-node')\\\"\",\n\t\t\"prepublishOnly\": \"npm run lint && npm test && npm run build && npm run build:check\"\n\t},\n\t\"dependencies\": {\n\t\t\"@types/node\": \"10.10.1\",\n\t\t\"@types/verror\": \"1.10.3\",\n\t\t\"axios\": \"0.18.0\",\n\t\t\"verror\": \"1.10.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@types/chai\": \"4.1.5\",\n\t\t\"@types/chai-as-promised\": \"7.1.0\",\n\t\t\"@types/expect\": \"1.20.3\",\n\t\t\"@types/jquery\": \"3.3.9\",\n\t\t\"@types/mocha\": \"5.2.5\",\n\t\t\"@types/sinon\": \"5.0.5\",\n\t\t\"@types/sinon-chai\": \"3.2.0\",\n\t\t\"browserify\": \"16.2.2\",\n\t\t\"chai\": \"4.1.2\",\n\t\t\"chai-as-promised\": \"7.1.1\",\n\t\t\"cypress\": \"3.1.0\",\n\t\t\"http-server\": \"0.11.1\",\n\t\t\"mocha\": \"5.2.0\",\n\t\t\"nyc\": \"13.0.1\",\n\t\t\"prettier\": \"1.14.2\",\n\t\t\"sinon\": \"6.2.0\",\n\t\t\"sinon-chai\": \"3.2.0\",\n\t\t\"source-map-support\": \"0.5.9\",\n\t\t\"ts-node\": \"7.0.1\",\n\t\t\"tsconfig-paths\": \"3.6.0\",\n\t\t\"tslint\": \"5.11.0\",\n\t\t\"tslint-config-prettier\": \"1.15.0\",\n\t\t\"tslint-immutable\": \"4.7.0\",\n\t\t\"typescript\": \"3.0.3\",\n\t\t\"uglify-es\": \"3.3.9\",\n\t\t\"wait-on\": \"3.0.1\"\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/api_client.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as os from 'os';\nimport { HashMap, InitOptions } from './api_types';\nimport * as constants from './constants';\nimport { AccountsResource } from './resources/accounts';\nimport { BlocksResource } from './resources/blocks';\nimport { DappsResource } from './resources/dapps';\nimport { DelegatesResource } from './resources/delegates';\nimport { NodeResource } from './resources/node';\nimport { PeersResource } from './resources/peers';\nimport { SignaturesResource } from './resources/signatures';\nimport { TransactionsResource } from './resources/transactions';\nimport { VotersResource } from './resources/voters';\nimport { VotesResource } from './resources/votes';\n\nconst defaultOptions = {\n\tbannedNodes: [],\n\trandomizeNodes: true,\n};\n\nconst commonHeaders: HashMap = {\n\tAccept: 'application/json',\n\t'Content-Type': 'application/json',\n};\n\nconst getClientHeaders = (clientOptions: ClientOptions): HashMap => {\n\tconst { name = '????', version = '????', engine = '????' } = clientOptions;\n\n\tconst liskElementsInformation =\n\t\t'LiskElements/1.0 (+https://github.com/LiskHQ/lisk-elements)';\n\tconst locale: string | undefined =\n\t\tprocess.env.LC_ALL ||\n\t\tprocess.env.LC_MESSAGES ||\n\t\tprocess.env.LANG ||\n\t\tprocess.env.LANGUAGE;\n\tconst systemInformation = `${os.platform()} ${os.release()}; ${os.arch()}${\n\t\tlocale ? `; ${locale}` : ''\n\t}`;\n\n\treturn {\n\t\t'User-Agent': `${name}/${version} (${engine}) ${liskElementsInformation} ${systemInformation}`,\n\t};\n};\n\nexport interface ClientOptions {\n\treadonly engine?: string;\n\treadonly name?: string;\n\treadonly version?: string;\n}\n\nexport class APIClient {\n\tpublic static get constants(): typeof constants {\n\t\treturn constants;\n\t}\n\n\tpublic static createMainnetAPIClient(options?: InitOptions): APIClient {\n\t\treturn new APIClient(constants.MAINNET_NODES, {\n\t\t\tnethash: constants.MAINNET_NETHASH,\n\t\t\t...options,\n\t\t});\n\t}\n\n\tpublic static createTestnetAPIClient(options?: InitOptions): APIClient {\n\t\treturn new APIClient(constants.TESTNET_NODES, {\n\t\t\tnethash: constants.TESTNET_NETHASH,\n\t\t\t...options,\n\t\t});\n\t}\n\n\tpublic accounts: AccountsResource;\n\tpublic bannedNodes!: ReadonlyArray<string>;\n\tpublic blocks: BlocksResource;\n\tpublic currentNode!: string;\n\tpublic dapps: DappsResource;\n\tpublic delegates: DelegatesResource;\n\tpublic headers!: HashMap;\n\tpublic node: NodeResource;\n\tpublic nodes!: ReadonlyArray<string>;\n\tpublic peers: PeersResource;\n\tpublic randomizeNodes!: boolean;\n\tpublic signatures: SignaturesResource;\n\tpublic transactions: TransactionsResource;\n\tpublic voters: VotersResource;\n\tpublic votes: VotesResource;\n\n\tpublic constructor(\n\t\tnodes: ReadonlyArray<string>,\n\t\tprovidedOptions: InitOptions = {},\n\t) {\n\t\tthis.initialize(nodes, providedOptions);\n\t\tthis.accounts = new AccountsResource(this);\n\t\tthis.blocks = new BlocksResource(this);\n\t\tthis.dapps = new DappsResource(this);\n\t\tthis.delegates = new DelegatesResource(this);\n\t\tthis.node = new NodeResource(this);\n\t\tthis.peers = new PeersResource(this);\n\t\tthis.signatures = new SignaturesResource(this);\n\t\tthis.transactions = new TransactionsResource(this);\n\t\tthis.voters = new VotersResource(this);\n\t\tthis.votes = new VotesResource(this);\n\t}\n\n\tpublic banActiveNode(): boolean {\n\t\treturn this.banNode(this.currentNode);\n\t}\n\n\tpublic banActiveNodeAndSelect(): boolean {\n\t\tconst banned = this.banActiveNode();\n\t\tif (banned) {\n\t\t\tthis.currentNode = this.getNewNode();\n\t\t}\n\n\t\treturn banned;\n\t}\n\n\tpublic banNode(node: string): boolean {\n\t\tif (!this.isBanned(node)) {\n\t\t\tthis.bannedNodes = [...this.bannedNodes, node];\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic getNewNode(): string {\n\t\tconst nodes = this.nodes.filter(\n\t\t\t(node: string): boolean => !this.isBanned(node),\n\t\t);\n\n\t\tif (nodes.length === 0) {\n\t\t\tthrow new Error('Cannot get new node: all nodes have been banned.');\n\t\t}\n\n\t\tconst randomIndex = Math.floor(Math.random() * nodes.length);\n\n\t\treturn nodes[randomIndex];\n\t}\n\n\tpublic hasAvailableNodes(): boolean {\n\t\treturn this.nodes.some((node: string): boolean => !this.isBanned(node));\n\t}\n\n\tpublic initialize(\n\t\tnodes: ReadonlyArray<string>,\n\t\tprovidedOptions: InitOptions = {},\n\t): void {\n\t\tif (!Array.isArray(nodes) || nodes.length <= 0) {\n\t\t\tthrow new Error('APIClient requires nodes for initialization.');\n\t\t}\n\n\t\tif (typeof providedOptions !== 'object' || Array.isArray(providedOptions)) {\n\t\t\tthrow new Error(\n\t\t\t\t'APIClient takes an optional object as the second parameter.',\n\t\t\t);\n\t\t}\n\n\t\tconst options: InitOptions = { ...defaultOptions, ...providedOptions };\n\n\t\tthis.headers = {\n\t\t\t...commonHeaders,\n\t\t\t...(options.nethash ? { nethash: options.nethash } : {}),\n\t\t\t...(options.client ? getClientHeaders(options.client) : {}),\n\t\t};\n\n\t\tthis.nodes = nodes;\n\t\tthis.bannedNodes = [...(options.bannedNodes || [])];\n\t\tthis.currentNode = options.node || this.getNewNode();\n\t\tthis.randomizeNodes = options.randomizeNodes !== false;\n\t}\n\n\tpublic isBanned(node: string): boolean {\n\t\treturn this.bannedNodes.includes(node);\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/api_method.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { AxiosRequestConfig } from 'axios';\nimport {\n\tAPIHandler,\n\tAPIResponse,\n\tHashMap,\n\tRequestConfig,\n\tResource,\n} from './api_types';\nimport { GET } from './constants';\nimport { solveURLParams, toQueryString } from './utils';\n\n// Bind to resource class\nexport const apiMethod = (options: RequestConfig = {}): APIHandler =>\n\tasync function apiHandler(\n\t\tthis: Resource,\n\t\t// tslint:disable-next-line readonly-array\n\t\t...args: Array<number | string | object>\n\t): Promise<APIResponse> {\n\t\tconst {\n\t\t\tmethod = GET,\n\t\t\tpath = '',\n\t\t\turlParams = [],\n\t\t\tvalidator,\n\t\t\tdefaultData = {},\n\t\t\tretry = false,\n\t\t} = options;\n\n\t\tif (urlParams.length > 0 && args.length < urlParams.length) {\n\t\t\treturn Promise.reject(\n\t\t\t\tnew Error(\n\t\t\t\t\t`This endpoint must be supplied with the following parameters: ${urlParams.toString()}`,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\n\t\tconst data = {\n\t\t\t...defaultData,\n\t\t\t...(args.length > urlParams.length &&\n\t\t\ttypeof args[urlParams.length] === 'object'\n\t\t\t\t? (args[urlParams.length] as object)\n\t\t\t\t: {}),\n\t\t};\n\n\t\tif (validator) {\n\t\t\ttry {\n\t\t\t\tvalidator(data);\n\t\t\t} catch (err) {\n\t\t\t\treturn Promise.reject(err);\n\t\t\t}\n\t\t}\n\n\t\tconst resolvedURLObject = urlParams.reduce(\n\t\t\t// tslint:disable-next-line no-inferred-empty-object-type\n\t\t\t(accumulator: HashMap, param: string, i: number): HashMap => {\n\t\t\t\tconst value = args[i];\n\t\t\t\tif (typeof value !== 'string' && typeof value !== 'number') {\n\t\t\t\t\tthrow new Error('Parameter must be a string or a number');\n\t\t\t\t}\n\n\t\t\t\treturn {\n\t\t\t\t\t...accumulator,\n\t\t\t\t\t[param]: typeof value === 'number' ? value.toString() : value,\n\t\t\t\t};\n\t\t\t},\n\t\t\t{},\n\t\t);\n\n\t\tconst requestData: AxiosRequestConfig = {\n\t\t\theaders: this.headers,\n\t\t\tmethod,\n\t\t\turl: solveURLParams(`${this.resourcePath}${path}`, resolvedURLObject),\n\t\t};\n\n\t\tif (Object.keys(data).length > 0) {\n\t\t\tif (method === GET) {\n\t\t\t\trequestData.url += `?${toQueryString(data)}`;\n\t\t\t} else {\n\t\t\t\trequestData.data = data;\n\t\t\t}\n\t\t}\n\n\t\treturn this.request(requestData, retry);\n\t};\n"
  },
  {
    "path": "packages/lisk-api-client/src/api_resource.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport Axios, { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';\nimport { APIClient } from './api_client';\nimport { APIErrorResponse, APIResponse, HashMap } from './api_types';\nimport { APIError } from './errors';\n\nconst API_RECONNECT_MAX_RETRY_COUNT = 3;\n\nconst REQUEST_RETRY_TIMEOUT = 1000;\n\nexport class APIResource {\n\tpublic apiClient: APIClient;\n\tpublic path: string;\n\n\tpublic constructor(apiClient: APIClient) {\n\t\tthis.apiClient = apiClient;\n\t\tthis.path = '';\n\t}\n\n\tpublic get headers(): HashMap {\n\t\treturn this.apiClient.headers;\n\t}\n\n\tpublic get resourcePath(): string {\n\t\treturn `${this.apiClient.currentNode}/api${this.path}`;\n\t}\n\n\tpublic async handleRetry(\n\t\terror: Error,\n\t\treq: AxiosRequestConfig,\n\t\tretryCount: number,\n\t): Promise<APIResponse> {\n\t\tif (this.apiClient.hasAvailableNodes()) {\n\t\t\treturn new Promise<APIResponse>(resolve =>\n\t\t\t\tsetTimeout(resolve, REQUEST_RETRY_TIMEOUT),\n\t\t\t).then(\n\t\t\t\tasync (): Promise<APIResponse> => {\n\t\t\t\t\tif (retryCount > API_RECONNECT_MAX_RETRY_COUNT) {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t\tif (this.apiClient.randomizeNodes) {\n\t\t\t\t\t\tthis.apiClient.banActiveNodeAndSelect();\n\t\t\t\t\t}\n\n\t\t\t\t\treturn this.request(req, true, retryCount + 1);\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\treturn Promise.reject(error);\n\t}\n\n\tpublic async request(\n\t\treq: AxiosRequestConfig,\n\t\tretry: boolean,\n\t\tretryCount: number = 1,\n\t): Promise<APIResponse> {\n\t\tconst request = Axios.request(req)\n\t\t\t.then((res: AxiosResponse) => res.data)\n\t\t\t.catch(\n\t\t\t\t(error: AxiosError): void => {\n\t\t\t\t\tif (error.response) {\n\t\t\t\t\t\tconst { status } = error.response;\n\t\t\t\t\t\tif (error.response.data) {\n\t\t\t\t\t\t\tconst {\n\t\t\t\t\t\t\t\terror: errorString,\n\t\t\t\t\t\t\t\terrors,\n\t\t\t\t\t\t\t\tmessage,\n\t\t\t\t\t\t\t}: APIErrorResponse = error.response.data;\n\t\t\t\t\t\t\tthrow new APIError(\n\t\t\t\t\t\t\t\tmessage || errorString || 'An unknown error has occurred.',\n\t\t\t\t\t\t\t\tstatus,\n\t\t\t\t\t\t\t\terrors,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tthrow new APIError('An unknown error has occurred.', status);\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t},\n\t\t\t);\n\n\t\tif (retry) {\n\t\t\treturn request.catch(async (err: Error) =>\n\t\t\t\tthis.handleRetry(err, req, retryCount),\n\t\t\t);\n\t\t}\n\n\t\treturn request;\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/api_types.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\n/* tslint:disable no-mixed-interface */\nexport type APIHandler = (\n\t// tslint:disable-next-line readonly-array\n\t...args: Array<number | string | object>\n) => Promise<APIResponse>;\n\nexport interface APIResponse {\n\treadonly data: unknown;\n\treadonly links: object;\n\treadonly meta: object;\n}\n\nexport interface APIErrorResponse {\n\treadonly error?: string;\n\treadonly errors?: ReadonlyArray<APIErrorContents>;\n\treadonly message?: string;\n}\n\nexport interface APIErrorContents {\n\treadonly code?: string;\n\treadonly message?: string;\n}\n\nexport interface HashMap {\n\treadonly [key: string]: string;\n}\n\nexport interface InitOptions {\n\treadonly bannedNodes?: ReadonlyArray<string>;\n\treadonly client?: object;\n\treadonly nethash?: string;\n\treadonly node?: string;\n\treadonly randomizeNodes?: boolean;\n}\n\nexport interface RequestConfig {\n\treadonly defaultData?: object;\n\treadonly method?: string;\n\treadonly path?: string;\n\treadonly retry?: boolean;\n\treadonly urlParams?: ReadonlyArray<string>;\n\treadonly validator?: (data: { readonly needed?: string }) => void;\n}\n\nexport interface Resource {\n\treadonly headers: HashMap;\n\treadonly path: string;\n\treadonly request: (data: object, retry: boolean) => Promise<APIResponse>;\n\treadonly resourcePath: string;\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/constants.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nexport const GET = 'GET';\nexport const POST = 'POST';\nexport const PUT = 'PUT';\n\nexport const TESTNET_NETHASH =\n\t'da3ed6a45429278bac2666961289ca17ad86595d33b31037615d4b8e8f158bba';\nexport const MAINNET_NETHASH =\n\t'ed14889723f24ecc54871d058d98ce91ff2f973192075c0155ba2b7b70ad2511';\n\nexport const TESTNET_NODES: ReadonlyArray<string> = [\n\t'https://testnet.lisk.io:443',\n];\nexport const MAINNET_NODES: ReadonlyArray<string> = [\n\t'https://node01.lisk.io:443',\n\t'https://node02.lisk.io:443',\n\t'https://node03.lisk.io:443',\n\t'https://node04.lisk.io:443',\n\t'https://node05.lisk.io:443',\n\t'https://node06.lisk.io:443',\n\t'https://node07.lisk.io:443',\n\t'https://node08.lisk.io:443',\n];\n"
  },
  {
    "path": "packages/lisk-api-client/src/errors.ts",
    "content": "import { VError } from 'verror';\n\nconst defaultErrorNo = 500;\n\nexport interface APIErrorData {\n\treadonly code?: string;\n\treadonly message?: string;\n}\n\nexport class APIError extends VError {\n\tpublic errno: number;\n\tpublic errors?: ReadonlyArray<APIErrorData>;\n\n\tpublic constructor(\n\t\tmessage: string = '',\n\t\terrno: number = defaultErrorNo,\n\t\terrors?: ReadonlyArray<APIErrorData>,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = 'APIError';\n\t\tthis.errno = errno;\n\t\tthis.errors = errors;\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nexport * from './api_client';\n"
  },
  {
    "path": "packages/lisk-api-client/src/resources/accounts.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient } from '../api_client';\nimport { apiMethod } from '../api_method';\nimport { APIResource } from '../api_resource';\nimport { APIHandler } from '../api_types';\nimport { GET } from '../constants';\n\nexport class AccountsResource extends APIResource {\n\tpublic get: APIHandler;\n\tpublic getMultisignatureGroups: APIHandler;\n\tpublic getMultisignatureMemberships: APIHandler;\n\tpublic path: string;\n\n\tpublic constructor(apiClient: APIClient) {\n\t\tsuper(apiClient);\n\t\tthis.path = '/accounts';\n\n\t\tthis.get = apiMethod({\n\t\t\tmethod: GET,\n\t\t}).bind(this);\n\n\t\tthis.getMultisignatureGroups = apiMethod({\n\t\t\tmethod: GET,\n\t\t\tpath: '/{address}/multisignature_groups',\n\t\t\turlParams: ['address'],\n\t\t}).bind(this);\n\n\t\tthis.getMultisignatureMemberships = apiMethod({\n\t\t\tmethod: GET,\n\t\t\tpath: '/{address}/multisignature_memberships',\n\t\t\turlParams: ['address'],\n\t\t}).bind(this);\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/resources/blocks.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient } from '../api_client';\nimport { apiMethod } from '../api_method';\nimport { APIResource } from '../api_resource';\nimport { APIHandler } from '../api_types';\nimport { GET } from '../constants';\n\nexport class BlocksResource extends APIResource {\n\tpublic get: APIHandler;\n\tpublic path: string;\n\n\tpublic constructor(apiClient: APIClient) {\n\t\tsuper(apiClient);\n\t\tthis.path = '/blocks';\n\n\t\tthis.get = apiMethod({\n\t\t\tmethod: GET,\n\t\t}).bind(this);\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/resources/dapps.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient } from '../api_client';\nimport { apiMethod } from '../api_method';\nimport { APIResource } from '../api_resource';\nimport { APIHandler } from '../api_types';\nimport { GET } from '../constants';\n\nexport class DappsResource extends APIResource {\n\tpublic get: APIHandler;\n\tpublic path: string;\n\n\tpublic constructor(apiClient: APIClient) {\n\t\tsuper(apiClient);\n\t\tthis.path = '/dapps';\n\n\t\tthis.get = apiMethod({\n\t\t\tmethod: GET,\n\t\t}).bind(this);\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/resources/delegates.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient } from '../api_client';\nimport { apiMethod } from '../api_method';\nimport { APIResource } from '../api_resource';\nimport { APIHandler } from '../api_types';\nimport { GET } from '../constants';\n\nexport class DelegatesResource extends APIResource {\n\tpublic get: APIHandler;\n\tpublic getForgers: APIHandler;\n\tpublic getForgingStatistics: APIHandler;\n\tpublic getStandby: APIHandler;\n\tpublic path: string;\n\n\tpublic constructor(apiClient: APIClient) {\n\t\tsuper(apiClient);\n\t\tthis.path = '/delegates';\n\n\t\tthis.get = apiMethod({\n\t\t\tdefaultData: {\n\t\t\t\tsort: 'rank:asc',\n\t\t\t},\n\t\t\tmethod: GET,\n\t\t}).bind(this);\n\n\t\tthis.getStandby = apiMethod({\n\t\t\tdefaultData: {\n\t\t\t\toffset: 101,\n\t\t\t\tsort: 'rank:asc',\n\t\t\t},\n\t\t\tmethod: GET,\n\t\t}).bind(this);\n\n\t\tthis.getForgers = apiMethod({\n\t\t\tmethod: GET,\n\t\t\tpath: '/forgers',\n\t\t}).bind(this);\n\n\t\tthis.getForgingStatistics = apiMethod({\n\t\t\tmethod: GET,\n\t\t\tpath: '/{address}/forging_statistics',\n\t\t\turlParams: ['address'],\n\t\t}).bind(this);\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/resources/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nexport { default as AccountsResource } from './accounts';\nexport { default as BlocksResource } from './blocks';\nexport { default as DappsResource } from './dapps';\nexport { default as DelegatesResource } from './delegates';\nexport { default as NodeResource } from './node';\nexport { default as PeersResource } from './peers';\nexport { default as SignaturesResource } from './signatures';\nexport { default as TransactionsResource } from './transactions';\nexport { default as VotersResource } from './voters';\nexport { default as VotesResource } from './votes';\n"
  },
  {
    "path": "packages/lisk-api-client/src/resources/node.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient } from '../api_client';\nimport { apiMethod } from '../api_method';\nimport { APIResource } from '../api_resource';\nimport { APIHandler } from '../api_types';\nimport { GET, PUT } from '../constants';\n\nexport class NodeResource extends APIResource {\n\tpublic getConstants: APIHandler;\n\tpublic getForgingStatus: APIHandler;\n\tpublic getStatus: APIHandler;\n\tpublic getTransactions: APIHandler;\n\tpublic path: string;\n\tpublic updateForgingStatus: APIHandler;\n\n\tpublic constructor(apiClient: APIClient) {\n\t\tsuper(apiClient);\n\t\tthis.path = '/node';\n\n\t\tthis.getConstants = apiMethod({\n\t\t\tmethod: GET,\n\t\t\tpath: '/constants',\n\t\t}).bind(this);\n\n\t\tthis.getStatus = apiMethod({\n\t\t\tmethod: GET,\n\t\t\tpath: '/status',\n\t\t}).bind(this);\n\n\t\tthis.getForgingStatus = apiMethod({\n\t\t\tmethod: GET,\n\t\t\tpath: '/status/forging',\n\t\t}).bind(this);\n\n\t\tthis.updateForgingStatus = apiMethod({\n\t\t\tmethod: PUT,\n\t\t\tpath: '/status/forging',\n\t\t}).bind(this);\n\n\t\tthis.getTransactions = apiMethod({\n\t\t\tmethod: GET,\n\t\t\tpath: '/transactions/{state}',\n\t\t\turlParams: ['state'],\n\t\t}).bind(this);\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/resources/peers.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient } from '../api_client';\nimport { apiMethod } from '../api_method';\nimport { APIResource } from '../api_resource';\nimport { APIHandler } from '../api_types';\nimport { GET } from '../constants';\n\nexport class PeersResource extends APIResource {\n\tpublic get: APIHandler;\n\tpublic path: string;\n\n\tpublic constructor(apiClient: APIClient) {\n\t\tsuper(apiClient);\n\t\tthis.path = '/peers';\n\n\t\tthis.get = apiMethod({\n\t\t\tmethod: GET,\n\t\t}).bind(this);\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/resources/signatures.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient } from '../api_client';\nimport { apiMethod } from '../api_method';\nimport { APIResource } from '../api_resource';\nimport { APIHandler } from '../api_types';\nimport { POST } from '../constants';\n\nexport class SignaturesResource extends APIResource {\n\tpublic broadcast: APIHandler;\n\tpublic path: string;\n\n\tpublic constructor(apiClient: APIClient) {\n\t\tsuper(apiClient);\n\t\tthis.path = '/signatures';\n\n\t\tthis.broadcast = apiMethod({\n\t\t\tmethod: POST,\n\t\t}).bind(this);\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/resources/transactions.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient } from '../api_client';\nimport { apiMethod } from '../api_method';\nimport { APIResource } from '../api_resource';\nimport { APIHandler } from '../api_types';\nimport { GET, POST } from '../constants';\n\nexport class TransactionsResource extends APIResource {\n\tpublic broadcast: APIHandler;\n\tpublic get: APIHandler;\n\tpublic path: string;\n\tpublic constructor(apiClient: APIClient) {\n\t\tsuper(apiClient);\n\t\tthis.path = '/transactions';\n\n\t\tthis.get = apiMethod({\n\t\t\tmethod: GET,\n\t\t}).bind(this);\n\n\t\tthis.broadcast = apiMethod({\n\t\t\tmethod: POST,\n\t\t}).bind(this);\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/resources/voters.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient } from '../api_client';\nimport { apiMethod } from '../api_method';\nimport { APIResource } from '../api_resource';\nimport { APIHandler } from '../api_types';\nimport { GET } from '../constants';\n\nexport class VotersResource extends APIResource {\n\tpublic get: APIHandler;\n\tpublic path: string;\n\n\tpublic constructor(apiClient: APIClient) {\n\t\tsuper(apiClient);\n\t\tthis.path = '/voters';\n\n\t\tthis.get = apiMethod({\n\t\t\tmethod: GET,\n\t\t}).bind(this);\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/resources/votes.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient } from '../api_client';\nimport { apiMethod } from '../api_method';\nimport { APIResource } from '../api_resource';\nimport { APIHandler } from '../api_types';\nimport { GET } from '../constants';\n\nexport class VotesResource extends APIResource {\n\tpublic get: APIHandler;\n\tpublic path: string;\n\n\tpublic constructor(apiClient: APIClient) {\n\t\tsuper(apiClient);\n\t\tthis.path = '/votes';\n\t\tthis.get = apiMethod({\n\t\t\tmethod: GET,\n\t\t}).bind(this);\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-api-client/src/utils.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { HashMap } from './api_types';\n\nexport const toQueryString = (obj: HashMap): string => {\n\tconst parts = Object.keys(obj).reduce(\n\t\t(\n\t\t\taccumulator: ReadonlyArray<string>,\n\t\t\tkey: string,\n\t\t): ReadonlyArray<string> => [\n\t\t\t...accumulator,\n\t\t\t`${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`,\n\t\t],\n\t\t[],\n\t);\n\n\treturn parts.join('&');\n};\n\nconst urlParamRegex = /{[^}]+}/;\nexport const solveURLParams = (url: string, params: HashMap = {}): string => {\n\tif (Object.keys(params).length === 0) {\n\t\tif (url.match(urlParamRegex) !== null) {\n\t\t\tthrow new Error('URL is not completely solved');\n\t\t}\n\n\t\treturn url;\n\t}\n\tconst solvedURL = Object.keys(params).reduce(\n\t\t(accumulator: string, key: string): string =>\n\t\t\taccumulator.replace(`{${key}}`, params[key]),\n\t\turl,\n\t);\n\n\tif (solvedURL.match(urlParamRegex) !== null) {\n\t\tthrow new Error('URL is not completely solved');\n\t}\n\n\treturn encodeURI(solvedURL);\n};\n"
  },
  {
    "path": "packages/lisk-api-client/test/_global_hooks.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nafterEach(() => {\n\treturn sandbox.restore();\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/_setup.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport chai from 'chai';\nimport chaiAsPromised from 'chai-as-promised';\nimport 'chai/register-expect';\nimport sinonChai from 'sinon-chai';\nimport sinon from 'sinon';\n\nprocess.env.NODE_ENV = 'test';\n\n[sinonChai, chaiAsPromised].forEach(plugin => chai.use(plugin));\n\nglobal.sandbox = sinon.createSandbox({\n\tuseFakeTimers: true,\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/api_client.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport os from 'os';\nimport { APIClient } from '../src/api_client';\n\ndescribe('APIClient module', () => {\n\tconst mainnetHash =\n\t\t'ed14889723f24ecc54871d058d98ce91ff2f973192075c0155ba2b7b70ad2511';\n\tconst mainnetNodes: ReadonlyArray<string> = [\n\t\t'https://node01.lisk.io:443',\n\t\t'https://node02.lisk.io:443',\n\t\t'https://node03.lisk.io:443',\n\t\t'https://node04.lisk.io:443',\n\t\t'https://node05.lisk.io:443',\n\t\t'https://node06.lisk.io:443',\n\t\t'https://node07.lisk.io:443',\n\t\t'https://node08.lisk.io:443',\n\t];\n\tconst testnetHash =\n\t\t'da3ed6a45429278bac2666961289ca17ad86595d33b31037615d4b8e8f158bba';\n\tconst testnetNodes: ReadonlyArray<string> = ['https://testnet.lisk.io:443'];\n\tconst locale =\n\t\tprocess.env.LC_ALL ||\n\t\tprocess.env.LC_MESSAGES ||\n\t\tprocess.env.LANG ||\n\t\tprocess.env.LANGUAGE;\n\tconst platformInfo = `${os.platform()} ${os.release()}; ${os.arch()}${\n\t\tlocale ? `; ${locale}` : ''\n\t}`;\n\tconst baseUserAgent = `LiskElements/1.0 (+https://github.com/LiskHQ/lisk-elements) ${platformInfo}`;\n\tconst customUserAgent = `LiskHub/5.0 (+https://github.com/LiskHQ/lisk-hub) ${baseUserAgent}`;\n\tconst defaultHeaders = {\n\t\tAccept: 'application/json',\n\t\t'Content-Type': 'application/json',\n\t};\n\n\tconst customHeaders = {\n\t\tAccept: 'application/json',\n\t\t'Content-Type': 'application/json',\n\t\t'User-Agent': customUserAgent,\n\t\tnethash: testnetHash,\n\t};\n\n\tconst localNode = 'http://localhost:7000';\n\tconst externalNode = 'https://googIe.com:8080';\n\tconst sslNode = 'https://external.lisk.io:443';\n\tconst externalTestnetNode = 'http://testnet.lisk.io';\n\tconst defaultNodes: ReadonlyArray<string> = [\n\t\tlocalNode,\n\t\texternalNode,\n\t\tsslNode,\n\t];\n\tconst defaultSelectedNode = 'selected_node';\n\n\tlet apiClient: APIClient;\n\n\tbeforeEach(() => {\n\t\tapiClient = new APIClient(defaultNodes);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tlet initializeStub: () => void;\n\n\t\tbeforeEach(() => {\n\t\t\tinitializeStub = sandbox.stub(APIClient.prototype, 'initialize');\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should create a new instance of APIClient', () => {\n\t\t\treturn expect(apiClient)\n\t\t\t\t.to.be.an('object')\n\t\t\t\t.and.be.instanceof(APIClient);\n\t\t});\n\n\t\tit('should call initialize with the nodes and default options', () => {\n\t\t\tapiClient = new APIClient(defaultNodes);\n\t\t\treturn expect(initializeStub).to.be.calledWithExactly(defaultNodes, {});\n\t\t});\n\n\t\tit('should call initialize with the nodes and provided options', () => {\n\t\t\tconst providedOptions = {\n\t\t\t\tnethash:\n\t\t\t\t\t'0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',\n\t\t\t};\n\t\t\tapiClient = new APIClient(defaultNodes, providedOptions);\n\t\t\treturn expect(initializeStub).to.be.calledWithExactly(\n\t\t\t\tdefaultNodes,\n\t\t\t\tprovidedOptions,\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('#createMainnetAPIClient', () => {\n\t\tlet client: APIClient;\n\t\tbeforeEach(() => {\n\t\t\tclient = APIClient.createMainnetAPIClient();\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should return APIClient instance', () => {\n\t\t\treturn expect(client).to.be.instanceof(APIClient);\n\t\t});\n\n\t\tit('should contain mainnet nodes', () => {\n\t\t\treturn expect(client.nodes).to.eql(mainnetNodes);\n\t\t});\n\n\t\tit('should be set to mainnet hash', () => {\n\t\t\treturn expect(client.headers.nethash).to.equal(mainnetHash);\n\t\t});\n\t});\n\n\tdescribe('#createTestnetAPIClient', () => {\n\t\tlet client: APIClient;\n\t\tbeforeEach(() => {\n\t\t\tclient = APIClient.createTestnetAPIClient();\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should return APIClient instance', () => {\n\t\t\treturn expect(client).to.be.instanceof(APIClient);\n\t\t});\n\n\t\tit('should contain testnet nodes', () => {\n\t\t\treturn expect(client.nodes).to.eql(testnetNodes);\n\t\t});\n\n\t\tit('should be set to testnet hash', () => {\n\t\t\treturn expect(client.headers.nethash).to.equal(testnetHash);\n\t\t});\n\t});\n\n\tdescribe('#constants', () => {\n\t\tit('should expose API constants', () => {\n\t\t\treturn expect(APIClient.constants).to.be.an('object');\n\t\t});\n\t});\n\n\tdescribe('#initialize', () => {\n\t\tit('should throw an error if no arguments are passed to constructor', () => {\n\t\t\treturn expect(apiClient.initialize.bind(apiClient)).to.throw(\n\t\t\t\tError,\n\t\t\t\t'APIClient requires nodes for initialization.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw an error if first argument passed to constructor is not array', () => {\n\t\t\treturn expect(apiClient.initialize.bind(apiClient, 'non-array')).to.throw(\n\t\t\t\tError,\n\t\t\t\t'APIClient requires nodes for initialization.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw an error if first argument passed to constructor is empty array', () => {\n\t\t\treturn expect(apiClient.initialize.bind(apiClient, [])).to.throw(\n\t\t\t\tError,\n\t\t\t\t'APIClient requires nodes for initialization.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw an error if second argument passed to constructor is a string', () => {\n\t\t\treturn expect(\n\t\t\t\tapiClient.initialize.bind(apiClient, defaultNodes, 'option string'),\n\t\t\t).to.throw(\n\t\t\t\tError,\n\t\t\t\t'APIClient takes an optional object as the second parameter.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw an error if second argument passed to constructor is an array', () => {\n\t\t\treturn expect(\n\t\t\t\tapiClient.initialize.bind(apiClient, defaultNodes, []),\n\t\t\t).to.throw(\n\t\t\t\tError,\n\t\t\t\t'APIClient takes an optional object as the second parameter.',\n\t\t\t);\n\t\t});\n\n\t\tdescribe('headers', () => {\n\t\t\tit('should set with passed nethash, with default options', () => {\n\t\t\t\treturn expect(apiClient)\n\t\t\t\t\t.to.have.property('headers')\n\t\t\t\t\t.and.eql(defaultHeaders);\n\t\t\t});\n\n\t\t\tit('should set custom headers with supplied options', () => {\n\t\t\t\tapiClient = new APIClient(defaultNodes, {\n\t\t\t\t\tnethash: testnetHash,\n\t\t\t\t\tclient: {\n\t\t\t\t\t\tname: 'LiskHub',\n\t\t\t\t\t\tversion: '5.0',\n\t\t\t\t\t\tengine: '+https://github.com/LiskHQ/lisk-hub',\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\treturn expect(apiClient)\n\t\t\t\t\t.to.have.property('headers')\n\t\t\t\t\t.and.eql(customHeaders);\n\t\t\t});\n\n\t\t\tit('should not set User-Agent header when client options were not given', () => {\n\t\t\t\tapiClient = new APIClient(defaultNodes, {\n\t\t\t\t\tnethash: testnetHash,\n\t\t\t\t});\n\t\t\t\treturn expect(apiClient.headers).to.not.have.property('User-Agent');\n\t\t\t});\n\t\t});\n\n\t\tdescribe('nodes', () => {\n\t\t\tit('should have nodes supplied to constructor', () => {\n\t\t\t\treturn expect(apiClient)\n\t\t\t\t\t.to.have.property('nodes')\n\t\t\t\t\t.and.equal(defaultNodes);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('bannedNodes', () => {\n\t\t\tit('should set empty array if no option is passed', () => {\n\t\t\t\treturn expect(apiClient)\n\t\t\t\t\t.to.have.property('bannedNodes')\n\t\t\t\t\t.be.eql([]);\n\t\t\t});\n\n\t\t\tit('should set bannedNodes when passed as an option', () => {\n\t\t\t\tconst bannedNodes = ['a', 'b'];\n\t\t\t\tapiClient = new APIClient(defaultNodes, { bannedNodes });\n\t\t\t\treturn expect(apiClient)\n\t\t\t\t\t.to.have.property('bannedNodes')\n\t\t\t\t\t.be.eql(bannedNodes);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('currentNode', () => {\n\t\t\tit('should set with random node with initialized setup if no node is specified by options', () => {\n\t\t\t\treturn expect(apiClient).to.have.property('currentNode').and.not.be\n\t\t\t\t\t.empty;\n\t\t\t});\n\n\t\t\tit('should set with supplied node if node is specified by options', () => {\n\t\t\t\tapiClient = new APIClient(defaultNodes, {\n\t\t\t\t\tnode: externalTestnetNode,\n\t\t\t\t});\n\t\t\t\treturn expect(apiClient)\n\t\t\t\t\t.to.have.property('currentNode')\n\t\t\t\t\t.and.equal(externalTestnetNode);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('randomizeNodes', () => {\n\t\t\tit('should set randomizeNodes to true when randomizeNodes not explicitly set', () => {\n\t\t\t\tapiClient = new APIClient(defaultNodes, {\n\t\t\t\t\trandomizeNodes: undefined,\n\t\t\t\t});\n\t\t\t\treturn expect(apiClient).to.have.property('randomizeNodes').be.true;\n\t\t\t});\n\n\t\t\tit('should set randomizeNodes to true on initialization when passed as an option', () => {\n\t\t\t\tapiClient = new APIClient(defaultNodes, {\n\t\t\t\t\trandomizeNodes: true,\n\t\t\t\t});\n\t\t\t\treturn expect(apiClient).to.have.property('randomizeNodes').be.true;\n\t\t\t});\n\n\t\t\tit('should set randomizeNodes to false on initialization when passed as an option', () => {\n\t\t\t\tapiClient = new APIClient(defaultNodes, {\n\t\t\t\t\trandomizeNodes: false,\n\t\t\t\t});\n\t\t\t\treturn expect(apiClient).to.have.property('randomizeNodes').be.false;\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('#getNewNode', () => {\n\t\tit('should throw an error if all relevant nodes are banned', () => {\n\t\t\tapiClient.bannedNodes = [...defaultNodes];\n\t\t\treturn expect(apiClient.getNewNode.bind(apiClient)).to.throw(\n\t\t\t\t'Cannot get new node: all nodes have been banned.',\n\t\t\t);\n\t\t});\n\n\t\tit('should return a node', () => {\n\t\t\tconst result = apiClient.getNewNode();\n\t\t\treturn expect(defaultNodes).to.contain(result);\n\t\t});\n\n\t\tit('should randomly select the node', () => {\n\t\t\tconst firstResult = apiClient.getNewNode();\n\t\t\tlet nextResult = apiClient.getNewNode();\n\t\t\t// Test will almost certainly time out if not random\n\t\t\twhile (nextResult === firstResult) {\n\t\t\t\tnextResult = apiClient.getNewNode();\n\t\t\t}\n\t\t\treturn Promise.resolve();\n\t\t});\n\t});\n\n\tdescribe('#banNode', () => {\n\t\tit('should add node to banned nodes', () => {\n\t\t\tconst banned = apiClient.banNode(localNode);\n\t\t\texpect(banned).to.be.true;\n\t\t\treturn expect(apiClient.isBanned(localNode)).to.be.true;\n\t\t});\n\n\t\tit('should not duplicate a banned node', () => {\n\t\t\tconst bannedNodes = [localNode];\n\t\t\tapiClient.bannedNodes = bannedNodes;\n\t\t\tconst banned = apiClient.banNode(localNode);\n\n\t\t\texpect(banned).to.be.false;\n\t\t\treturn expect(apiClient.bannedNodes).to.be.eql(bannedNodes);\n\t\t});\n\t});\n\n\tdescribe('#banActiveNode', () => {\n\t\tlet currentNode: string;\n\n\t\tbeforeEach(() => {\n\t\t\t({ currentNode } = apiClient);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should add current node to banned nodes', () => {\n\t\t\tconst banned = apiClient.banActiveNode();\n\t\t\texpect(banned).to.be.true;\n\t\t\treturn expect(apiClient.isBanned(currentNode)).to.be.true;\n\t\t});\n\n\t\tit('should not duplicate a banned node', () => {\n\t\t\tconst bannedNodes = [currentNode];\n\t\t\tapiClient.bannedNodes = bannedNodes;\n\t\t\tconst banned = apiClient.banActiveNode();\n\n\t\t\texpect(banned).to.be.false;\n\t\t\treturn expect(apiClient.bannedNodes).to.be.eql(bannedNodes);\n\t\t});\n\t});\n\n\tdescribe('#banActiveNodeAndSelect', () => {\n\t\tlet currentNode: string;\n\t\tlet getNewNodeStub: () => string;\n\n\t\tbeforeEach(() => {\n\t\t\t({ currentNode } = apiClient);\n\t\t\tgetNewNodeStub = sandbox\n\t\t\t\t.stub(apiClient, 'getNewNode')\n\t\t\t\t.returns(defaultSelectedNode);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should call ban current node', () => {\n\t\t\tapiClient.banActiveNodeAndSelect();\n\t\t\treturn expect(apiClient.isBanned(currentNode)).to.be.true;\n\t\t});\n\n\t\tit('should call selectNewNode when the node is banned', () => {\n\t\t\tapiClient.banActiveNodeAndSelect();\n\t\t\treturn expect(getNewNodeStub).to.be.calledOnce;\n\t\t});\n\n\t\tit('should not call selectNewNode when the node is not banned', () => {\n\t\t\tconst bannedNodes = [currentNode];\n\t\t\tapiClient.bannedNodes = bannedNodes;\n\t\t\tapiClient.banActiveNodeAndSelect();\n\t\t\treturn expect(getNewNodeStub).not.to.be.called;\n\t\t});\n\t});\n\n\tdescribe('#isBanned', () => {\n\t\tit('should return true when provided node is banned', () => {\n\t\t\tapiClient.bannedNodes = [...apiClient.bannedNodes, localNode];\n\t\t\treturn expect(apiClient.isBanned(localNode)).to.be.true;\n\t\t});\n\n\t\tit('should return false when provided node is not banned', () => {\n\t\t\treturn expect(apiClient.isBanned(localNode)).to.be.false;\n\t\t});\n\t});\n\n\tdescribe('#hasAvailableNodes', () => {\n\t\tit('should return false without nodes left', () => {\n\t\t\tapiClient.bannedNodes = [...defaultNodes];\n\t\t\tconst result = apiClient.hasAvailableNodes();\n\t\t\treturn expect(result).to.be.false;\n\t\t});\n\n\t\tit('should return true if nodes are available', () => {\n\t\t\tconst result = apiClient.hasAvailableNodes();\n\t\t\treturn expect(result).to.be.true;\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/api_method.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { apiMethod } from '../src/api_method';\nimport { Resource, APIHandler } from '../src/api_types';\n\ndescribe('API method module', () => {\n\tconst GET = 'GET';\n\tconst POST = 'POST';\n\tconst defaultBasePath = 'http://localhost:1234/api';\n\tconst defaultResourcePath = '/resources';\n\tconst defaultFullPath = `${defaultBasePath}${defaultResourcePath}`;\n\tconst defaultHeaders = {\n\t\t'Content-Type': 'application/json',\n\t\tnethash: 'mainnetHash',\n\t\tos: 'lisk-elements-api',\n\t\tversion: '1.0.0',\n\t\tminVersion: '>=0.5.0',\n\t\tport: '443',\n\t};\n\tconst errorArgumentNumber =\n\t\t'This endpoint must be supplied with the following parameters: related,id';\n\tconst firstURLParam = 'r-123';\n\tconst secondURLParam = 123;\n\tlet resource: Resource;\n\tlet requestResult: object;\n\tlet handler: APIHandler;\n\tlet validationError: Error;\n\n\tbeforeEach(() => {\n\t\trequestResult = { success: true, sendRequest: true };\n\t\tresource = {\n\t\t\tpath: defaultResourcePath,\n\t\t\tresourcePath: defaultFullPath,\n\t\t\theaders: defaultHeaders,\n\t\t\trequest: sandbox.stub().resolves(requestResult),\n\t\t};\n\t\tvalidationError = new Error('No data');\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#apiMethod', () => {\n\t\tdescribe('when no parameters are passed', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\thandler = apiMethod().bind(resource);\n\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should return function', () => {\n\t\t\t\treturn expect(handler).to.be.a('function');\n\t\t\t});\n\n\t\t\tit('should request GET with default URL', () => {\n\t\t\t\treturn handler().then(() => {\n\t\t\t\t\texpect(resource.request).to.be.calledOnce;\n\t\t\t\t\treturn expect(resource.request).to.be.calledWithExactly(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tmethod: GET,\n\t\t\t\t\t\t\turl: defaultFullPath,\n\t\t\t\t\t\t\theaders: defaultHeaders,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tfalse,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tdescribe('when initialized with POST / parameters', () => {\n\t\t\tconst parameterStringError = 'Parameter must be a string or a number';\n\n\t\t\tbeforeEach(() => {\n\t\t\t\thandler = apiMethod({\n\t\t\t\t\tmethod: POST,\n\t\t\t\t\tpath: '/{related}/ids/{id}',\n\t\t\t\t\turlParams: ['related', 'id'],\n\t\t\t\t\tvalidator: data => {\n\t\t\t\t\t\tif (!data.needed) {\n\t\t\t\t\t\t\tthrow validationError;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tdefaultData: {\n\t\t\t\t\t\tsort: 'id',\n\t\t\t\t\t},\n\t\t\t\t\tretry: true,\n\t\t\t\t}).bind(resource);\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should return function', () => {\n\t\t\t\treturn expect(handler).to.be.a('function');\n\t\t\t});\n\n\t\t\tit('should be rejected with error without param', () => {\n\t\t\t\treturn expect(handler()).to.be.rejectedWith(Error, errorArgumentNumber);\n\t\t\t});\n\n\t\t\tit('should be rejected with error without enough param', () => {\n\t\t\t\treturn expect(handler(firstURLParam)).to.be.rejectedWith(\n\t\t\t\t\tError,\n\t\t\t\t\terrorArgumentNumber,\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should throw an error if input is not a string or a number', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\thandler({ num: 3 }, secondURLParam, { needed: true }),\n\t\t\t\t).to.be.rejectedWith(Error, parameterStringError);\n\t\t\t});\n\n\t\t\tit('should be rejected with no data', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\thandler(firstURLParam, secondURLParam),\n\t\t\t\t).to.be.rejectedWith(validationError);\n\t\t\t});\n\n\t\t\tit('should call request with the given data', () => {\n\t\t\t\treturn handler(firstURLParam, secondURLParam, { needed: true }).then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\texpect(resource.request).to.be.calledOnce;\n\t\t\t\t\t\treturn expect(resource.request).to.be.calledWithExactly(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmethod: POST,\n\t\t\t\t\t\t\t\turl: `${defaultFullPath}/${firstURLParam}/ids/${secondURLParam}`,\n\t\t\t\t\t\t\t\theaders: defaultHeaders,\n\t\t\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\t\t\tneeded: true,\n\t\t\t\t\t\t\t\t\tsort: 'id',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('when initialized with GET / parameters', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\thandler = apiMethod({\n\t\t\t\t\tmethod: GET,\n\t\t\t\t\tpath: '/{related}/ids/{id}',\n\t\t\t\t\turlParams: ['related', 'id'],\n\t\t\t\t\tvalidator: data => {\n\t\t\t\t\t\tif (!data.needed) {\n\t\t\t\t\t\t\tthrow validationError;\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tdefaultData: {\n\t\t\t\t\t\tsort: 'id',\n\t\t\t\t\t},\n\t\t\t\t}).bind(resource);\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should return a function', () => {\n\t\t\t\treturn expect(handler).to.be.a('function');\n\t\t\t});\n\n\t\t\tit('should be rejected with error without parameters', () => {\n\t\t\t\treturn expect(handler()).to.be.rejectedWith(Error, errorArgumentNumber);\n\t\t\t});\n\n\t\t\tit('should be rejected with error without enough parameters', () => {\n\t\t\t\treturn expect(handler(firstURLParam)).to.be.rejectedWith(\n\t\t\t\t\tError,\n\t\t\t\t\terrorArgumentNumber,\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should be rejected with no data', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\thandler(firstURLParam, secondURLParam),\n\t\t\t\t).to.be.rejectedWith(validationError);\n\t\t\t});\n\n\t\t\tit('should be request with the given data', () => {\n\t\t\t\treturn handler(firstURLParam, secondURLParam, { needed: true }).then(\n\t\t\t\t\t() => {\n\t\t\t\t\t\texpect(resource.request).to.be.calledOnce;\n\t\t\t\t\t\treturn expect(resource.request).to.be.calledWithExactly(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tmethod: GET,\n\t\t\t\t\t\t\t\turl: `${defaultFullPath}/${firstURLParam}/ids/${secondURLParam}?sort=id&needed=true`,\n\t\t\t\t\t\t\t\theaders: defaultHeaders,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/api_resource.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { APIClient } from '../src/api_client';\nimport { APIResource } from '../src/api_resource';\nimport sinon from 'sinon';\n// Required for stub\nconst axios = require('axios');\n\ndescribe('API resource module', () => {\n\tconst GET = 'GET';\n\tconst defaultBasePath = 'http://localhost:1234';\n\tconst defaultResourcePath = '/resources';\n\tconst defaultFullPath = `${defaultBasePath}/api${defaultResourcePath}`;\n\tconst defaultHeaders = {\n\t\tAccept: 'application/json',\n\t\t'Content-Type': 'application/json',\n\t\tnethash: 'mainnetHash',\n\t\tos: 'lisk-elements-api',\n\t\tversion: '1.0.0',\n\t\tminVersion: '>=0.5.0',\n\t\tport: '443',\n\t};\n\tconst defaultRequest = {\n\t\tmethod: GET,\n\t\turl: defaultFullPath,\n\t\theaders: defaultHeaders,\n\t};\n\n\tconst sendRequestResult = {\n\t\tdata: [],\n\t\tbody: {},\n\t\tlimit: 0,\n\t};\n\n\tinterface FakeAPIClient {\n\t\theaders: object;\n\t\tcurrentNode: string;\n\t\thasAvailableNodes: () => boolean | void;\n\t\trandomizeNodes: boolean;\n\t\tbanActiveNodeAndSelect: () => void;\n\t}\n\n\tlet resource: APIResource;\n\tlet apiClient: FakeAPIClient;\n\n\tbeforeEach(() => {\n\t\tapiClient = {\n\t\t\theaders: { ...defaultHeaders },\n\t\t\tcurrentNode: defaultBasePath,\n\t\t\thasAvailableNodes: () => true,\n\t\t\trandomizeNodes: false,\n\t\t\tbanActiveNodeAndSelect: sandbox.stub(),\n\t\t};\n\t\tresource = new APIResource(apiClient as APIClient);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tit('should create an API resource instance', () => {\n\t\t\treturn expect(resource).to.be.instanceOf(APIResource);\n\t\t});\n\t});\n\n\tdescribe('get headers', () => {\n\t\tit('should return header set to apiClient', () => {\n\t\t\treturn expect(resource.headers).to.eql(defaultHeaders);\n\t\t});\n\t});\n\n\tdescribe('get resourcePath', () => {\n\t\tit('should return the resource’s full path', () => {\n\t\t\treturn expect(resource.resourcePath).to.equal(`${defaultBasePath}/api`);\n\t\t});\n\n\t\tit('should return the resource’s full path with set path', () => {\n\t\t\tresource.path = defaultResourcePath;\n\t\t\treturn expect(resource.resourcePath).to.equal(\n\t\t\t\t`${defaultBasePath}/api${defaultResourcePath}`,\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('#request', () => {\n\t\tlet requestStub: sinon.SinonStub;\n\t\tlet handleRetryStub: () => Promise<void>;\n\n\t\tbeforeEach(() => {\n\t\t\trequestStub = sandbox.stub(axios, 'request').resolves({\n\t\t\t\tstatus: 200,\n\t\t\t\tdata: sendRequestResult,\n\t\t\t});\n\t\t\thandleRetryStub = sandbox.stub(resource, 'handleRetry');\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should make a request to API without calling retry', () => {\n\t\t\treturn resource.request(defaultRequest, false).then(res => {\n\t\t\t\texpect(requestStub).to.be.calledOnce;\n\t\t\t\texpect(requestStub).to.be.calledWithExactly(defaultRequest);\n\t\t\t\texpect(handleRetryStub).not.to.be.called;\n\t\t\t\treturn expect(res).to.eql(sendRequestResult);\n\t\t\t});\n\t\t});\n\n\t\tit('should make a request to API without calling retry when it succeeds', () => {\n\t\t\treturn resource.request(defaultRequest, true).then(res => {\n\t\t\t\texpect(requestStub).to.be.calledOnce;\n\t\t\t\texpect(requestStub).to.be.calledWithExactly(defaultRequest);\n\t\t\t\texpect(handleRetryStub).not.to.be.called;\n\t\t\t\treturn expect(res).to.eql(sendRequestResult);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('when response status is greater than 300', () => {\n\t\t\tit('should reject with errno if status code is supplied', () => {\n\t\t\t\tconst statusCode = 300;\n\t\t\t\trequestStub.rejects({\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tstatus: statusCode,\n\t\t\t\t\t\tdata: undefined,\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\treturn resource.request(defaultRequest, false).catch(err => {\n\t\t\t\t\treturn expect(err.errno).to.equal(statusCode);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('should reject with \"An unknown error has occured.\" message if there is no data is supplied', () => {\n\t\t\t\tconst statusCode = 300;\n\t\t\t\trequestStub.rejects({\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tstatus: statusCode,\n\t\t\t\t\t\tdata: undefined,\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\treturn resource.request(defaultRequest, false).catch(err => {\n\t\t\t\t\treturn expect(err.message).to.equal('An unknown error has occurred.');\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('should reject with \"An unknown error has occured.\" message if there is no message is supplied', () => {\n\t\t\t\tconst statusCode = 300;\n\t\t\t\trequestStub.rejects({\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tstatus: statusCode,\n\t\t\t\t\t\tdata: sendRequestResult,\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\treturn resource.request(defaultRequest, false).catch(err => {\n\t\t\t\t\treturn expect(err.message).to.equal('An unknown error has occurred.');\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('should reject with error message from server if message is supplied', () => {\n\t\t\t\tconst serverErrorMessage = 'validation error';\n\t\t\t\tconst statusCode = 300;\n\t\t\t\trequestStub.rejects({\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tstatus: statusCode,\n\t\t\t\t\t\tdata: { message: serverErrorMessage },\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\treturn resource.request(defaultRequest, false).catch(err => {\n\t\t\t\t\treturn expect(err.message).to.eql(serverErrorMessage);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('should reject with error message from server if message is undefined and error is supplied', () => {\n\t\t\t\tconst serverErrorMessage = 'error from server';\n\t\t\t\tconst statusCode = 300;\n\t\t\t\trequestStub.rejects({\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tstatus: statusCode,\n\t\t\t\t\t\tdata: { message: undefined, error: serverErrorMessage },\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\treturn resource.request(defaultRequest, false).catch(err => {\n\t\t\t\t\treturn expect(err.message).to.eql(serverErrorMessage);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('should reject with errors from server if errors are supplied', () => {\n\t\t\t\tconst serverErrorMessage = 'validation error';\n\t\t\t\tconst statusCode = 300;\n\t\t\t\tconst errors = [\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: 'error_code_1',\n\t\t\t\t\t\tmessage: 'message1',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcode: 'error_code_2',\n\t\t\t\t\t\tmessage: 'message2',\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t\trequestStub.rejects({\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tstatus: statusCode,\n\t\t\t\t\t\tdata: { message: serverErrorMessage, errors },\n\t\t\t\t\t},\n\t\t\t\t});\n\n\t\t\t\treturn resource.request(defaultRequest, false).catch(err => {\n\t\t\t\t\treturn expect(err.errors).to.eql(errors);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('should reject with error if client rejects with plain error', () => {\n\t\t\t\tconst clientError = new Error('client error');\n\t\t\t\trequestStub.rejects(clientError);\n\t\t\t\treturn resource.request(defaultRequest, false).catch(err => {\n\t\t\t\t\treturn expect(err).to.eql(clientError);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('should make a request to API with calling retry', () => {\n\t\t\t\tconst statusCode = 300;\n\t\t\t\trequestStub.rejects({\n\t\t\t\t\tresponse: {\n\t\t\t\t\t\tstatus: statusCode,\n\t\t\t\t\t\tdata: sendRequestResult,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t\treturn resource.request(defaultRequest, true).catch(() => {\n\t\t\t\t\texpect(requestStub).to.be.calledOnce;\n\t\t\t\t\treturn expect(handleRetryStub).to.be.calledOnce;\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('#handleRetry', () => {\n\t\tlet requestStub: sinon.SinonStub;\n\t\tlet defaultError: Error;\n\t\tbeforeEach(() => {\n\t\t\tdefaultError = new Error('could not connect to a node');\n\t\t\trequestStub = sandbox\n\t\t\t\t.stub(resource, 'request')\n\t\t\t\t.returns(Promise.resolve(sendRequestResult.body));\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tdescribe('when there is available node', () => {\n\t\t\tlet clock: sinon.SinonFakeTimers;\n\n\t\t\tbeforeEach(() => {\n\t\t\t\tclock = sinon.useFakeTimers();\n\t\t\t\tapiClient.hasAvailableNodes = () => true;\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tafterEach(() => {\n\t\t\t\treturn clock.restore();\n\t\t\t});\n\n\t\t\tit('should call banActiveNode when randomizeNodes is true', () => {\n\t\t\t\tapiClient.randomizeNodes = true;\n\t\t\t\tconst req = resource.handleRetry(defaultError, defaultRequest, 1);\n\t\t\t\tclock.tick(1000);\n\t\t\t\treturn req.then(res => {\n\t\t\t\t\texpect(apiClient.banActiveNodeAndSelect).to.be.calledOnce;\n\t\t\t\t\texpect(requestStub).to.be.calledWith(defaultRequest, true);\n\t\t\t\t\treturn expect(res).to.be.eql(sendRequestResult.body);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('should not call ban active node when randomizeNodes is false', () => {\n\t\t\t\tapiClient.randomizeNodes = false;\n\t\t\t\tconst req = resource.handleRetry(defaultError, defaultRequest, 1);\n\t\t\t\tclock.tick(1000);\n\t\t\t\treturn req.then(res => {\n\t\t\t\t\texpect(apiClient.banActiveNodeAndSelect).not.to.be.called;\n\t\t\t\t\texpect(requestStub).to.be.calledWith(defaultRequest, true);\n\t\t\t\t\treturn expect(res).to.be.eql(sendRequestResult.body);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('should throw an error when randomizeNodes is false and the maximum retry count has been reached', () => {\n\t\t\t\tapiClient.randomizeNodes = false;\n\t\t\t\tconst req = resource.handleRetry(defaultError, defaultRequest, 4);\n\t\t\t\tclock.tick(1000);\n\t\t\t\treturn expect(req).to.be.rejectedWith(defaultError);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('when there is no available node', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tapiClient.hasAvailableNodes = () => false;\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should throw an error that is the same as input error', () => {\n\t\t\t\tconst res = resource.handleRetry(defaultError, defaultRequest, 1);\n\t\t\t\treturn expect(res).to.be.rejectedWith(defaultError);\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/constants.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { GET, POST, PUT, TESTNET_NODES, MAINNET_NODES } from '../src/constants';\n\ndescribe('api constants module', () => {\n\tit('GET should be a string', () => {\n\t\treturn expect(GET).to.be.a('string');\n\t});\n\n\tit('POST should be a string', () => {\n\t\treturn expect(POST).to.be.a('string');\n\t});\n\n\tit('PUT should be a string', () => {\n\t\treturn expect(PUT).to.be.a('string');\n\t});\n\n\tit('TESTNET_NODES should be an array of strings', () => {\n\t\texpect(TESTNET_NODES).to.be.an('array');\n\t\treturn TESTNET_NODES.forEach(node => expect(node).to.be.a('string'));\n\t});\n\n\tit('MAINNET_NODES should be an array of strings', () => {\n\t\texpect(MAINNET_NODES).to.be.an('array');\n\t\treturn MAINNET_NODES.forEach(node => expect(node).to.be.a('string'));\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/errors.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { APIError, APIErrorData } from '../src/errors';\n\ndescribe('api errors module', () => {\n\tlet apiError: APIError;\n\tconst defaultMessage = 'this is an error';\n\tconst defaultErrno = 401;\n\n\tbeforeEach(() => {\n\t\tapiError = new APIError();\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tit('should create a new instance of APIError', () => {\n\t\t\treturn expect(apiError)\n\t\t\t\t.to.be.an('object')\n\t\t\t\t.and.be.instanceof(APIError);\n\t\t});\n\n\t\tit('should set error name to `APIError`', () => {\n\t\t\treturn expect(apiError.name).to.eql('APIError');\n\t\t});\n\n\t\tit('should set error message to empty string by default', () => {\n\t\t\treturn expect(apiError.message).to.eql('');\n\t\t});\n\n\t\tit('should set errno to 500 by default', () => {\n\t\t\treturn expect(apiError.errno).to.eql(500);\n\t\t});\n\n\t\tdescribe('when passed errno', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tapiError = new APIError(defaultMessage, defaultErrno);\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should set error message when passed through first argument', () => {\n\t\t\t\treturn expect(apiError.message).to.eql(defaultMessage);\n\t\t\t});\n\n\t\t\tit('should set errno when passed through second argument', () => {\n\t\t\t\treturn expect(apiError.errno).to.eql(defaultErrno);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('when passed errno and errors', () => {\n\t\t\tconst errors = [\n\t\t\t\t{\n\t\t\t\t\tcode: 'error_code_1',\n\t\t\t\t\tmessage: 'message1',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tcode: 'error_code_2',\n\t\t\t\t\tmessage: 'message2',\n\t\t\t\t},\n\t\t\t];\n\n\t\t\tbeforeEach(() => {\n\t\t\t\tapiError = new APIError(defaultMessage, defaultErrno, errors);\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should set error message when passed through first argument', () => {\n\t\t\t\treturn expect(apiError.message).to.eql(defaultMessage);\n\t\t\t});\n\n\t\t\tit('should set errno when passed through second argument', () => {\n\t\t\t\treturn expect(apiError.errno).to.eql(defaultErrno);\n\t\t\t});\n\n\t\t\tit('should set errors when passed through third argument', () => {\n\t\t\t\texpect(apiError.errors).to.have.lengthOf(2);\n\t\t\t\tconst errorData = apiError.errors as ReadonlyArray<APIErrorData>;\n\t\t\t\texpect(errorData[0].code).to.equal(errors[0].code);\n\t\t\t\treturn expect(errorData[0].message).to.equal(errors[0].message);\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient } from '../src';\nimport { expect } from 'chai';\n\ndescribe('api client', () => {\n\tdescribe('exports', () => {\n\t\tit('should have APIClient as a function', () => {\n\t\t\treturn expect(APIClient).to.be.a('function');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/mocha.opts",
    "content": "--recursive\n--require ts-node/register\n--require tsconfig-paths/register\n--require source-map-support/register\n--require ./test/_setup.ts\n--file ./test/_global_hooks.ts\n--watch-extensions ts\n"
  },
  {
    "path": "packages/lisk-api-client/test/resources/accounts.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { APIClient } from '../../src/api_client';\nimport { APIResource } from '../../src/api_resource';\nimport { AccountsResource } from '../../src/resources/accounts';\n\ndescribe('AccountsResource', () => {\n\tconst defaultBasePath = 'http://localhost:1234';\n\tconst path = '/accounts';\n\n\tlet apiClient: APIClient;\n\tlet resource: APIResource;\n\n\tbeforeEach(() => {\n\t\tapiClient = new APIClient([defaultBasePath]);\n\t\tresource = new AccountsResource(apiClient);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tit('should be instance of APIResource', () => {\n\t\t\treturn expect(resource).to.be.instanceOf(APIResource);\n\t\t});\n\n\t\tit('should have correct full path', () => {\n\t\t\treturn expect(resource.resourcePath).to.eql(\n\t\t\t\t`${defaultBasePath}/api${path}`,\n\t\t\t);\n\t\t});\n\n\t\tit('should set resource path', () => {\n\t\t\treturn expect(resource.path).to.equal(path);\n\t\t});\n\n\t\tit('should have a \"get\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('get')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\n\t\tit('should have a \"getMultisignatureGroups\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('getMultisignatureGroups')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\n\t\tit('should have a \"getMultisignatureMemberships\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('getMultisignatureMemberships')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/resources/blocks.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { APIClient } from '../../src/api_client';\nimport { APIResource } from '../../src/api_resource';\nimport { BlocksResource } from '../../src/resources/blocks';\n\ndescribe('BlocksResource', () => {\n\tconst defaultBasePath = 'http://localhost:1234';\n\tconst path = '/blocks';\n\n\tlet apiClient: APIClient;\n\tlet resource: APIResource;\n\n\tbeforeEach(() => {\n\t\tapiClient = new APIClient([defaultBasePath]);\n\t\tresource = new BlocksResource(apiClient);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tit('should be instance of APIResource', () => {\n\t\t\treturn expect(resource).to.be.instanceOf(APIResource);\n\t\t});\n\n\t\tit('should have correct full path', () => {\n\t\t\treturn expect(resource.resourcePath).to.eql(\n\t\t\t\t`${defaultBasePath}/api${path}`,\n\t\t\t);\n\t\t});\n\n\t\tit('should set resource path', () => {\n\t\t\treturn expect(resource.path).to.equal(path);\n\t\t});\n\n\t\tit('should have a \"get\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('get')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/resources/dapps.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { APIClient } from '../../src/api_client';\nimport { APIResource } from '../../src/api_resource';\nimport { DappsResource } from '../../src/resources/dapps';\n\ndescribe('DappsResource', () => {\n\tconst defaultBasePath = 'http://localhost:1234';\n\tconst path = '/dapps';\n\n\tlet apiClient: APIClient;\n\tlet resource: APIResource;\n\n\tbeforeEach(() => {\n\t\tapiClient = new APIClient([defaultBasePath]);\n\t\tresource = new DappsResource(apiClient);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tit('should be instance of APIResource', () => {\n\t\t\treturn expect(resource).to.be.instanceOf(APIResource);\n\t\t});\n\n\t\tit('should have correct full path', () => {\n\t\t\treturn expect(resource.resourcePath).to.eql(\n\t\t\t\t`${defaultBasePath}/api${path}`,\n\t\t\t);\n\t\t});\n\n\t\tit('should set resource path', () => {\n\t\t\treturn expect(resource.path).to.equal(path);\n\t\t});\n\n\t\tit('should have a \"get\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('get')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/resources/delegates.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { APIClient } from '../../src/api_client';\nimport { APIResource } from '../../src/api_resource';\nimport { DelegatesResource } from '../../src/resources/delegates';\n\ndescribe('DelegatesResource', () => {\n\tconst defaultBasePath = 'http://localhost:1234';\n\tconst path = '/delegates';\n\n\tlet apiClient: APIClient;\n\tlet resource: APIResource;\n\n\tbeforeEach(() => {\n\t\tapiClient = new APIClient([defaultBasePath]);\n\t\tresource = new DelegatesResource(apiClient);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tit('should be instance of APIResource', () => {\n\t\t\treturn expect(resource).to.be.instanceOf(APIResource);\n\t\t});\n\n\t\tit('should have correct full path', () => {\n\t\t\treturn expect(resource.resourcePath).to.eql(\n\t\t\t\t`${defaultBasePath}/api${path}`,\n\t\t\t);\n\t\t});\n\n\t\tit('should set resource path', () => {\n\t\t\treturn expect(resource.path).to.equal(path);\n\t\t});\n\n\t\tit('should have a \"get\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('get')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\n\t\tit('should have a \"getStandby\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('getStandby')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\n\t\tit('should have a \"getForgers\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('getForgers')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\n\t\tit('should have a \"getForgingStatistics\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('getForgingStatistics')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/resources/node.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { APIClient } from '../../src/api_client';\nimport { APIResource } from '../../src/api_resource';\nimport { NodeResource } from '../../src/resources/node';\n\ndescribe('NodeResource', () => {\n\tconst defaultBasePath = 'http://localhost:1234';\n\tconst path = '/node';\n\n\tlet apiClient: APIClient;\n\tlet resource: APIResource;\n\n\tbeforeEach(() => {\n\t\tapiClient = new APIClient([defaultBasePath]);\n\t\tresource = new NodeResource(apiClient);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tit('should be instance of APIResource', () => {\n\t\t\treturn expect(resource).to.be.instanceOf(APIResource);\n\t\t});\n\n\t\tit('should have correct full path', () => {\n\t\t\treturn expect(resource.resourcePath).to.eql(\n\t\t\t\t`${defaultBasePath}/api${path}`,\n\t\t\t);\n\t\t});\n\n\t\tit('should set resource path', () => {\n\t\t\treturn expect(resource.path).to.equal(path);\n\t\t});\n\n\t\tit('should have a \"getConstants\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('getConstants')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\n\t\tit('should have a \"getStatus\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('getStatus')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\n\t\tit('should have a \"getForgingStatus\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('getForgingStatus')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\n\t\tit('should have a \"updateForgingStatus\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('updateForgingStatus')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\n\t\tit('should have a \"getTransactions\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('getTransactions')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/resources/peers.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { APIClient } from '../../src/api_client';\nimport { APIResource } from '../../src/api_resource';\nimport { PeersResource } from '../../src/resources/peers';\n\ndescribe('PeersResource', () => {\n\tconst defaultBasePath = 'http://localhost:1234';\n\tconst path = '/peers';\n\n\tlet apiClient: APIClient;\n\tlet resource: APIResource;\n\n\tbeforeEach(() => {\n\t\tapiClient = new APIClient([defaultBasePath]);\n\t\tresource = new PeersResource(apiClient);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tit('should be instance of APIResource', () => {\n\t\t\treturn expect(resource).to.be.instanceOf(APIResource);\n\t\t});\n\n\t\tit('should have correct full path', () => {\n\t\t\treturn expect(resource.resourcePath).to.eql(\n\t\t\t\t`${defaultBasePath}/api${path}`,\n\t\t\t);\n\t\t});\n\n\t\tit('should set resource path', () => {\n\t\t\treturn expect(resource.path).to.equal(path);\n\t\t});\n\n\t\tit('should have a \"get\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('get')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/resources/signatures.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { APIClient } from '../../src/api_client';\nimport { APIResource } from '../../src/api_resource';\nimport { SignaturesResource } from '../../src/resources/signatures';\n\ndescribe('SignaturesResource', () => {\n\tconst defaultBasePath = 'http://localhost:1234';\n\tconst path = '/signatures';\n\n\tlet apiClient: APIClient;\n\tlet resource: APIResource;\n\n\tbeforeEach(() => {\n\t\tapiClient = new APIClient([defaultBasePath]);\n\t\tresource = new SignaturesResource(apiClient);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tit('should be instance of APIResource', () => {\n\t\t\treturn expect(resource).to.be.instanceOf(APIResource);\n\t\t});\n\n\t\tit('should have correct full path', () => {\n\t\t\treturn expect(resource.resourcePath).to.eql(\n\t\t\t\t`${defaultBasePath}/api${path}`,\n\t\t\t);\n\t\t});\n\n\t\tit('should set resource path', () => {\n\t\t\treturn expect(resource.path).to.equal(path);\n\t\t});\n\n\t\tit('should have a \"broadcast\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('broadcast')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/resources/transactions.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { APIClient } from '../../src/api_client';\nimport { APIResource } from '../../src/api_resource';\nimport { TransactionsResource } from '../../src/resources/transactions';\n\ndescribe('TransactionsResource', () => {\n\tconst defaultBasePath = 'http://localhost:1234';\n\tconst path = '/transactions';\n\n\tlet apiClient: APIClient;\n\tlet resource: APIResource;\n\n\tbeforeEach(() => {\n\t\tapiClient = new APIClient([defaultBasePath]);\n\t\tresource = new TransactionsResource(apiClient);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tit('should be instance of APIResource', () => {\n\t\t\treturn expect(resource).to.be.instanceOf(APIResource);\n\t\t});\n\n\t\tit('should have correct full path', () => {\n\t\t\treturn expect(resource.resourcePath).to.eql(\n\t\t\t\t`${defaultBasePath}/api${path}`,\n\t\t\t);\n\t\t});\n\n\t\tit('should set resource path', () => {\n\t\t\treturn expect(resource.path).to.equal(path);\n\t\t});\n\n\t\tit('should have a \"get\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('get')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\n\t\tit('should have a \"broadcast\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('broadcast')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/resources/voters.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { APIClient } from '../../src/api_client';\nimport { APIResource } from '../../src/api_resource';\nimport { VotersResource } from '../../src/resources/voters';\n\ndescribe('VotersResource', () => {\n\tconst defaultBasePath = 'http://localhost:1234';\n\tconst path = '/voters';\n\n\tlet apiClient: APIClient;\n\tlet resource: APIResource;\n\n\tbeforeEach(() => {\n\t\tapiClient = new APIClient([defaultBasePath]);\n\t\tresource = new VotersResource(apiClient);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tit('should be instance of APIResource', () => {\n\t\t\treturn expect(resource).to.be.instanceOf(APIResource);\n\t\t});\n\n\t\tit('should have correct full path', () => {\n\t\t\treturn expect(resource.resourcePath).to.eql(\n\t\t\t\t`${defaultBasePath}/api${path}`,\n\t\t\t);\n\t\t});\n\n\t\tit('should set resource path', () => {\n\t\t\treturn expect(resource.path).to.equal(path);\n\t\t});\n\n\t\tit('should have a \"get\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('get')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/resources/votes.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { APIClient } from '../../src/api_client';\nimport { APIResource } from '../../src/api_resource';\nimport { VotesResource } from '../../src/resources/votes';\n\ndescribe('VotesResource', () => {\n\tconst defaultBasePath = 'http://localhost:1234';\n\tconst path = '/votes';\n\n\tlet apiClient: APIClient;\n\tlet resource: APIResource;\n\n\tbeforeEach(() => {\n\t\tapiClient = new APIClient([defaultBasePath]);\n\t\tresource = new VotesResource(apiClient);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#constructor', () => {\n\t\tit('should be instance of APIResource', () => {\n\t\t\treturn expect(resource).to.be.instanceOf(APIResource);\n\t\t});\n\n\t\tit('should have correct full path', () => {\n\t\t\treturn expect(resource.resourcePath).to.eql(\n\t\t\t\t`${defaultBasePath}/api${path}`,\n\t\t\t);\n\t\t});\n\n\t\tit('should set resource path', () => {\n\t\t\treturn expect(resource.path).to.equal(path);\n\t\t});\n\n\t\tit('should have a \"get\" function', () => {\n\t\t\treturn expect(resource)\n\t\t\t\t.to.have.property('get')\n\t\t\t\t.which.is.a('function');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-api-client/test/utils.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { toQueryString, solveURLParams } from '../src/utils';\n\ndescribe('api utils module', () => {\n\tconst defaultURL = 'http://localhost:8080/api/resources';\n\n\tdescribe('#toQueryString', () => {\n\t\tit('should create a query string from an object', () => {\n\t\t\tconst queryString = toQueryString({\n\t\t\t\tkey1: 'value1',\n\t\t\t\tkey2: 'value2',\n\t\t\t\tkey3: 'value3',\n\t\t\t});\n\t\t\treturn expect(queryString).to.be.equal(\n\t\t\t\t'key1=value1&key2=value2&key3=value3',\n\t\t\t);\n\t\t});\n\n\t\tit('should escape invalid special characters', () => {\n\t\t\tconst queryString = toQueryString({\n\t\t\t\t'key:/;?': 'value:/;?',\n\t\t\t});\n\t\t\treturn expect(queryString).to.be.equal(\n\t\t\t\t'key%3A%2F%3B%3F=value%3A%2F%3B%3F',\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('#solveURLParams', () => {\n\t\tit('should return original URL with no param', () => {\n\t\t\tconst solvedURL = solveURLParams(defaultURL);\n\t\t\treturn expect(solvedURL).to.be.equal(defaultURL);\n\t\t});\n\n\t\tit('should throw error if url has variable but no param', () => {\n\t\t\treturn expect(solveURLParams.bind(null, `${defaultURL}/{id}`)).to.throw(\n\t\t\t\tError,\n\t\t\t\t'URL is not completely solved',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw error if url has variable but not matching params', () => {\n\t\t\treturn expect(\n\t\t\t\tsolveURLParams.bind(null, `${defaultURL}/{id}`, { accountId: '123' }),\n\t\t\t).to.throw(Error, 'URL is not completely solved');\n\t\t});\n\n\t\tit('should replace variable with correct id', () => {\n\t\t\tconst solvedURL = solveURLParams(`${defaultURL}/{id}`, {\n\t\t\t\tid: '456',\n\t\t\t\taccountId: '123',\n\t\t\t});\n\t\t\treturn expect(solvedURL).to.be.equal(`${defaultURL}/456`);\n\t\t});\n\n\t\tit('should replace multiple variables with correct id and accountId', () => {\n\t\t\tconst solvedURL = solveURLParams(`${defaultURL}/{accountId}/{id}`, {\n\t\t\t\tid: '456',\n\t\t\t\taccountId: '123',\n\t\t\t});\n\t\t\treturn expect(solvedURL).to.be.equal(`${defaultURL}/123/456`);\n\t\t});\n\n\t\tit('should replace variable with correct id and encode special characters', () => {\n\t\t\tconst solvedURL = solveURLParams(`${defaultURL}/{id}`, {\n\t\t\t\tid: '456ß1234sd',\n\t\t\t\taccountId: '123',\n\t\t\t});\n\t\t\treturn expect(solvedURL).to.be.equal(`${defaultURL}/456%C3%9F1234sd`);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-client/README.md",
    "content": "# @liskhq/lisk-client\n\nA default set of Elements for use by clients of the Lisk network\n\n## Installation\n\n### Installation via npm\n\nAdd Lisk Client as a dependency of your project:\n\n```sh\n$ npm install --save @liskhq/lisk-client\n```\n\nImport using ES6 modules syntax:\n\n```js\nimport lisk from '@liskhq/lisk-client';\n```\n\nOr using Node.js modules:\n\n```js\nconst lisk = require('@liskhq/lisk-client');\n```\n\nOr import specific namespaced functionality:\n\n```js\nimport { APIClient, transactions } from '@liskhq/lisk-client';\n// or\nconst { APIClient, transactions } = require('@liskhq/lisk-client');\n```\n\n### Installation via CDN\n\nInclude the following script using the following HTML. The `lisk` variable will be exposed.\n\n```html\n<script src=\"https://js.lisk.io/lisk-client-1.1.0.js\"></script>\n```\n\nOr minified:\n\n```html\n<script src=\"https://js.lisk.io/lisk-client-1.1.0.min.js\"></script>\n```\n\n## Packages\n\n| Package                                                 |                                                      Version                                                      | Description                                                        |\n| ------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------: | ------------------------------------------------------------------ |\n| [@liskhq/lisk-api-client](../lisk-api-client)     |  [![](https://img.shields.io/badge/npm-v2.0.0-green.svg)](https://www.npmjs.com/package/@liskhq/lisk-api-client)  | An API client for the Lisk network                                 |\n| [@liskhq/lisk-constants](../lisk-constants)       |  [![](https://img.shields.io/badge/npm-v1.2.0-green.svg)](https://www.npmjs.com/package/@liskhq/lisk-constants)   | General constants for use with Lisk-related software               |\n| [@liskhq/lisk-cryptography](../lisk-cryptography) | [![](https://img.shields.io/badge/npm-v2.0.0-green.svg)](https://www.npmjs.com/package/@liskhq/lisk-cryptography) | General cryptographic functions for use with Lisk-related software |\n| [@liskhq/lisk-passphrase](../lisk-passphrase)     |  [![](https://img.shields.io/badge/npm-v2.0.0-green.svg)](https://www.npmjs.com/package/@liskhq/lisk-passphrase)  | Mnemonic passphrase helpers for use with Lisk-related software     |\n| [@liskhq/lisk-transactions](../lisk-transactions) | [![](https://img.shields.io/badge/npm-v2.0.0-green.svg)](https://www.npmjs.com/package/@liskhq/lisk-transactions) | Everything related to transactions according to the Lisk protocol  |\n\n## License\n\nCopyright © 2016-2018 Lisk Foundation\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the [GNU General Public License](https://github.com/LiskHQ/lisk-elements/tree/master/LICENSE) along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n***\n\nThis program also incorporates work previously released with lisk-js `v0.5.2` (and earlier) versions under the [MIT License](https://opensource.org/licenses/MIT). To comply with the requirements of that license, the following permission notice, applicable to those parts of the code only, is included below:\n\nCopyright © 2016-2017 Lisk Foundation\n\nCopyright © 2015 Crypti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[Lisk Core GitHub]: https://github.com/LiskHQ/lisk\n[Lisk documentation site]: https://lisk.io/documentation/lisk-elements\n"
  },
  {
    "path": "packages/lisk-client/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Title</title>\n</head>\n<body>\nOpen the console to get started with Lisk Client.\n<div id=\"output\"></div>\n\n<script src=\"dist-browser/lisk-client.min.js\"></script>\n\n</body>\n</html>\n"
  },
  {
    "path": "packages/lisk-client/package.json",
    "content": "{\n\t\"name\": \"@liskhq/lisk-client\",\n\t\"version\": \"2.0.0\",\n\t\"description\": \"A default set of Elements for use by clients of the Lisk network\",\n\t\"author\": \"Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>\",\n\t\"license\": \"GPL-3.0\",\n\t\"keywords\": [\n\t\t\"lisk\",\n\t\t\"blockchain\"\n\t],\n\t\"homepage\": \"https://github.com/LiskHQ/lisk-elements/tree/master/packages/lisk-client#readme\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/LiskHQ/lisk-elements.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/LiskHQ/lisk-elements/issues\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=8.10 <=10\",\n\t\t\"npm\": \">=5\"\n\t},\n\t\"main\": \"dist-node/index.js\",\n\t\"scripts\": {\n\t\t\"prestart\": \"./scripts/prestart.sh\",\n\t\t\"start\": \"./scripts/start.sh\",\n\t\t\"transpile\": \"tsc\",\n\t\t\"transpile:browsertest\": \"tsc -p tsconfig.browsertest.json\",\n\t\t\"browserify\": \"browserify ./dist-node/index.js -o ./dist-browser/index.js -s lisk\",\n\t\t\"browserify:browsertest\": \"browserify ./browsertest.build/test/*.js -o ./browsertest.build/browsertest.js -s lisk\",\n\t\t\"uglify\": \"uglifyjs -nm -o ./dist-browser/index.min.js ./dist-browser/index.js\",\n\t\t\"uglify:browsertest\": \"uglifyjs -o ./browsertest.build/browsertest.min.js ./browsertest.build/browsertest.js\",\n\t\t\"clean\": \"./scripts/clean.sh\",\n\t\t\"format\": \"prettier --write \\\"*.{js,json}\\\" \\\"{src,test}/**/*.{js,json}\\\"\",\n\t\t\"lint\": \"tslint --format verbose --project .\",\n\t\t\"lint:fix\": \"npm run lint -- --fix\",\n\t\t\"test\": \"TS_NODE_PROJECT=./test/tsconfig.json nyc mocha test/**/*.ts test/**/**/*.ts\",\n\t\t\"test:watch\": \"npm test -- --watch\",\n\t\t\"test:watch:min\": \"npm run test:watch -- --reporter=min\",\n\t\t\"test:node\": \"npm run build:check\",\n\t\t\"serve:start\": \"http-server -p 11546 ./browsertest &\",\n\t\t\"serve:stop\": \"kill $(lsof -t -i:11546) || true\",\n\t\t\"pretest:browser\": \"npm run serve:stop && npm run build:browsertest && npm run serve:start\",\n\t\t\"test:browser\": \"wait-on http://localhost:11546 && cypress run --config baseUrl=http://localhost:11546 --env ROOT_DIR=\\\"${PWD##*/}\\\"\",\n\t\t\"posttest:browser\": \"npm run serve:stop\",\n\t\t\"cover\": \"if [ -z $JENKINS_HOME ]; then npm run cover:local; else npm run cover:ci; fi\",\n\t\t\"cover:base\": \"NODE_ENV=test nyc report\",\n\t\t\"cover:local\": \"npm run cover:base -- --reporter=html --reporter=text\",\n\t\t\"cover:ci\": \"npm run cover:base -- --reporter=text\",\n\t\t\"build:browsertest\": \"npm run transpile:browsertest && npm run browserify:browsertest && npm run uglify:browsertest\",\n\t\t\"postbuild:browsertest\": \"rm -r browsertest.build/src browsertest.build/test\",\n\t\t\"prebuild:node\": \"rm -r dist-node/* || mkdir dist-node || true\",\n\t\t\"build:node\": \"npm run transpile\",\n\t\t\"prebuild:browser\": \"rm ./dist-browser/index.js ./dist-browser/index.min.js || true\",\n\t\t\"build:browser\": \"npm run build:node && npm run browserify && npm run uglify\",\n\t\t\"prebuild\": \"npm run prebuild:browser\",\n\t\t\"build\": \"npm run build:browser\",\n\t\t\"build:check\": \"node -e \\\"require('./dist-node')\\\"\",\n\t\t\"prepublishOnly\": \"npm run lint && npm test && npm run build && npm run build:check\"\n\t},\n\t\"dependencies\": {\n\t\t\"@liskhq/lisk-api-client\": \"2.0.0\",\n\t\t\"@liskhq/lisk-constants\": \"1.2.0\",\n\t\t\"@liskhq/lisk-cryptography\": \"2.0.0\",\n\t\t\"@liskhq/lisk-passphrase\": \"2.0.0\",\n\t\t\"@liskhq/lisk-transactions\": \"2.0.0\",\n\t\t\"@types/node\": \"10.10.1\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@types/chai\": \"4.1.5\",\n\t\t\"@types/expect\": \"1.20.3\",\n\t\t\"@types/jquery\": \"3.3.22\",\n\t\t\"@types/mocha\": \"5.2.5\",\n\t\t\"browserify\": \"16.2.2\",\n\t\t\"chai\": \"4.1.2\",\n\t\t\"cypress\": \"3.1.0\",\n\t\t\"http-server\": \"0.11.1\",\n\t\t\"mocha\": \"5.2.0\",\n\t\t\"nyc\": \"13.0.1\",\n\t\t\"prettier\": \"1.14.2\",\n\t\t\"source-map-support\": \"0.5.9\",\n\t\t\"ts-node\": \"7.0.1\",\n\t\t\"tsconfig-paths\": \"3.6.0\",\n\t\t\"tslint\": \"5.11.0\",\n\t\t\"tslint-config-prettier\": \"1.15.0\",\n\t\t\"tslint-immutable\": \"4.7.0\",\n\t\t\"typescript\": \"3.0.3\",\n\t\t\"uglify-es\": \"3.3.9\",\n\t\t\"wait-on\": \"3.0.1\"\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-client/scripts/prestart.sh",
    "content": "read -r -p $'\\e[96mDo you want to build Lisk Client first? [y/N]\\e[0m ' should_build\nif [[ $should_build =~ ^[Yy]$ ]]\nthen\n\tnpm run build:node\nfi\n"
  },
  {
    "path": "packages/lisk-client/scripts/start.sh",
    "content": "node -i -e \"global.lisk = require('./dist-node').default; console.log('\\\\x1b[34m', 'The global \\`lisk\\` was initialised', '\\\\x1b[0m')\"\n"
  },
  {
    "path": "packages/lisk-client/src/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient as APIClientModule } from '@liskhq/lisk-api-client';\nimport * as constantsModule from '@liskhq/lisk-constants';\nimport * as cryptographyModule from '@liskhq/lisk-cryptography';\nimport * as passphraseModule from '@liskhq/lisk-passphrase';\nimport * as transactionModule from '@liskhq/lisk-transactions';\n\n// tslint:disable-next-line variable-name\nexport const APIClient = APIClientModule;\nexport const constants = constantsModule;\nexport const cryptography = cryptographyModule;\nexport const passphrase = passphraseModule;\nexport const transaction = transactionModule;\n\n// tslint:disable-next-line no-default-export\nexport default {\n\tAPIClient,\n\tconstants,\n\tcryptography,\n\tpassphrase,\n\ttransaction,\n};\n"
  },
  {
    "path": "packages/lisk-client/test/_setup.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport 'chai/register-expect';\n\nprocess.env.NODE_ENV = 'test';\n"
  },
  {
    "path": "packages/lisk-client/test/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport {\n\tAPIClient,\n\tconstants,\n\tcryptography,\n\tpassphrase,\n\ttransaction,\n} from '../src';\n\ndescribe('lisk-client', () => {\n\tit('APIClient should be a function', () => {\n\t\treturn expect(APIClient).to.be.a('function');\n\t});\n\n\tit('constants should be an object', () => {\n\t\treturn expect(constants).to.be.an('object');\n\t});\n\n\tit('cryptography should be an object', () => {\n\t\treturn expect(cryptography).to.be.an('object');\n\t});\n\n\tit('passphrase should be an object', () => {\n\t\treturn expect(passphrase).to.be.an('object');\n\t});\n\n\tit('transaction should be an object', () => {\n\t\treturn expect(transaction).to.be.an('object');\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-constants/.gitignore",
    "content": "# Compiled files\nsrc/**/*.js\ntest/**/*.js\n"
  },
  {
    "path": "packages/lisk-constants/LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    {one line to give the program's name and a brief idea of what it does.}\n    Copyright (C) {year}  {name of author}\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    {project}  Copyright (C) {year}  {fullname}\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "packages/lisk-constants/README.md",
    "content": "# lisk-constants\n\n@liskhq/lisk-constants is containing general constants for use with Lisk-related software\n\n## Installation\n\n```sh\n$ npm install --save @liskhq/lisk-constants\n```\n\n## License\n\nCopyright © 2016-2018 Lisk Foundation\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the [GNU General Public License](https://github.com/LiskHQ/lisk-elements/tree/master/LICENSE) along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n***\n\nThis program also incorporates work previously released with lisk-js `v0.5.2` (and earlier) versions under the [MIT License](https://opensource.org/licenses/MIT). To comply with the requirements of that license, the following permission notice, applicable to those parts of the code only, is included below:\n\nCopyright © 2016-2017 Lisk Foundation\n\nCopyright © 2015 Crypti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[Lisk Core GitHub]: https://github.com/LiskHQ/lisk\n[Lisk documentation site]: https://lisk.io/documentation/lisk-elements\n"
  },
  {
    "path": "packages/lisk-constants/package.json",
    "content": "{\n\t\"name\": \"@liskhq/lisk-constants\",\n\t\"version\": \"1.2.0\",\n\t\"description\": \"General constants for use with Lisk-related software\",\n\t\"author\": \"Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>\",\n\t\"license\": \"GPL-3.0\",\n\t\"keywords\": [\n\t\t\"lisk\",\n\t\t\"blockchain\"\n\t],\n\t\"homepage\": \"https://github.com/LiskHQ/lisk-elements/tree/master/packages/lisk-constants#readme\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/LiskHQ/lisk-elements.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/LiskHQ/lisk-elements/issues\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=8.10 <=10\",\n\t\t\"npm\": \">=5\"\n\t},\n\t\"main\": \"dist-node/index.js\",\n\t\"scripts\": {\n\t\t\"transpile\": \"tsc\",\n\t\t\"transpile:browsertest\": \"tsc -p tsconfig.browsertest.json\",\n\t\t\"browserify\": \"browserify ./dist-node/index.js -o ./dist-browser/index.js -s liskConstants\",\n\t\t\"browserify:browsertest\": \"browserify ./browsertest.build/test/*.js -o ./browsertest.build/browsertest.js -s liskConstants\",\n\t\t\"uglify\": \"uglifyjs -nm -o ./dist-browser/index.min.js ./dist-browser/index.js\",\n\t\t\"uglify:browsertest\": \"uglifyjs -o ./browsertest.build/browsertest.min.js ./browsertest.build/browsertest.js\",\n\t\t\"clean\": \"./scripts/clean.sh\",\n\t\t\"format\": \"prettier --write \\\"*.{ts,js,json}\\\" \\\"{src,test}/**/*.{ts,js,json}\\\"\",\n\t\t\"lint\": \"tslint --format verbose --project .\",\n\t\t\"lint:fix\": \"npm run lint -- --fix\",\n\t\t\"test\": \"TS_NODE_PROJECT=./test/tsconfig.json nyc mocha test/**/*.ts\",\n\t\t\"test:watch\": \"npm test -- --watch\",\n\t\t\"test:watch:min\": \"npm run test:watch -- --reporter=min\",\n\t\t\"test:node\": \"npm run build:check\",\n\t\t\"serve:start\": \"http-server -p 11542 ./browsertest &\",\n\t\t\"serve:stop\": \"kill $(lsof -t -i:11542) || true\",\n\t\t\"pretest:browser\": \"npm run serve:stop && npm run build:browsertest && npm run serve:start\",\n\t\t\"test:browser\": \"wait-on http://localhost:11542 && cypress run --config baseUrl=http://localhost:11542 --env ROOT_DIR=\\\"${PWD##*/}\\\"\",\n\t\t\"posttest:browser\": \"npm run serve:stop\",\n\t\t\"cover\": \"if [ -z $JENKINS_HOME ]; then npm run cover:local; else npm run cover:ci; fi\",\n\t\t\"cover:base\": \"nyc report\",\n\t\t\"cover:local\": \"npm run cover:base -- --reporter=html --reporter=text\",\n\t\t\"cover:ci\": \"npm run cover:base -- --reporter=text\",\n\t\t\"build:browsertest\": \"npm run transpile:browsertest && npm run browserify:browsertest && npm run uglify:browsertest\",\n\t\t\"postbuild:browsertest\": \"rm -r browsertest.build/src browsertest.build/test\",\n\t\t\"prebuild:node\": \"rm -r dist-node/* || mkdir dist-node || true\",\n\t\t\"build:node\": \"npm run transpile\",\n\t\t\"prebuild:browser\": \"rm ./dist-browser/index.js ./dist-browser/index.min.js || true\",\n\t\t\"build:browser\": \"npm run build:node && npm run browserify && npm run uglify\",\n\t\t\"prebuild\": \"npm run prebuild:browser\",\n\t\t\"build\": \"npm run build:browser\",\n\t\t\"build:check\": \"node -e \\\"require('./dist-node')\\\"\",\n\t\t\"prepublishOnly\": \"npm run lint && npm test && npm run build && npm run build:check\"\n\t},\n\t\"dependencies\": {\n\t\t\"@types/node\": \"10.10.1\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@types/chai\": \"4.1.5\",\n\t\t\"@types/expect\": \"1.20.3\",\n\t\t\"@types/jquery\": \"3.3.9\",\n\t\t\"@types/mocha\": \"5.2.5\",\n\t\t\"browserify\": \"16.2.2\",\n\t\t\"chai\": \"4.1.2\",\n\t\t\"cypress\": \"3.1.0\",\n\t\t\"eslint\": \"5.5.0\",\n\t\t\"eslint-config-airbnb-base\": \"13.1.0\",\n\t\t\"eslint-config-lisk-base\": \"1.0.0\",\n\t\t\"eslint-plugin-import\": \"2.14.0\",\n\t\t\"eslint-plugin-mocha\": \"5.2.0\",\n\t\t\"http-server\": \"0.11.1\",\n\t\t\"mocha\": \"5.2.0\",\n\t\t\"nyc\": \"13.0.1\",\n\t\t\"prettier\": \"1.14.2\",\n\t\t\"source-map-support\": \"0.5.9\",\n\t\t\"ts-node\": \"7.0.1\",\n\t\t\"tsconfig-paths\": \"3.6.0\",\n\t\t\"tslint\": \"5.11.0\",\n\t\t\"tslint-config-prettier\": \"1.15.0\",\n\t\t\"tslint-immutable\": \"4.7.0\",\n\t\t\"typescript\": \"3.0.3\",\n\t\t\"uglify-es\": \"3.3.9\",\n\t\t\"wait-on\": \"3.0.1\"\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-constants/src/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\n// tslint:disable-next-line:no-magic-numbers\nexport const EPOCH_TIME = new Date(Date.UTC(2016, 4, 24, 17, 0, 0, 0));\nexport const EPOCH_TIME_MILLISECONDS = EPOCH_TIME.getTime();\nconst MS_FACTOR = 1000;\nexport const EPOCH_TIME_SECONDS = Math.floor(EPOCH_TIME.getTime() / MS_FACTOR);\n\n// Largest possible number which can be stored in eight bytes.\n// Derived from bignum.fromBuffer(Buffer.from(new Array(8).fill(255))).\nconst MAX_EIGHT_BYTE_NUMBER = '18446744073709551615';\n\nexport const MAX_ADDRESS_NUMBER = MAX_EIGHT_BYTE_NUMBER;\nexport const MAX_TRANSACTION_ID = MAX_EIGHT_BYTE_NUMBER;\n// Largest possible amount. Maximum value for PostgreSQL bigint.\nexport const MAX_TRANSACTION_AMOUNT = '9223372036854775807';\n\nexport const SIGNED_MESSAGE_PREFIX = 'Lisk Signed Message:\\n';\n\nexport const TESTNET_NETHASH =\n\t'da3ed6a45429278bac2666961289ca17ad86595d33b31037615d4b8e8f158bba';\nexport const MAINNET_NETHASH =\n\t'ed14889723f24ecc54871d058d98ce91ff2f973192075c0155ba2b7b70ad2511';\n"
  },
  {
    "path": "packages/lisk-constants/test/_setup.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { Assertion } from 'chai';\n\nprocess.env.NODE_ENV = 'test';\n\nAssertion.addProperty('hexString', function handleAssert(\n\tthis: Chai.ChaiStatic,\n) {\n\tconst actual = this._obj;\n\n\tnew Assertion(actual).to.be.a('string');\n\n\tconst expected = Buffer.from(actual, 'hex').toString('hex');\n\tthis.assert(\n\t\texpected === actual,\n\t\t'expected #{this} to be a hexString',\n\t\t'expected #{this} not to be a hexString',\n\t);\n});\n\nAssertion.addProperty('integer', function handleAssert(this: Chai.ChaiStatic) {\n\tconst actual = this._obj;\n\n\tnew Assertion(actual).to.be.a('number');\n\n\tconst expected = parseInt(actual, 10);\n\tthis.assert(\n\t\tactual === expected,\n\t\t'expected #{this} to be an integer',\n\t\t'expected #{this} not to be an integer',\n\t);\n});\n"
  },
  {
    "path": "packages/lisk-constants/test/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport {\n\tEPOCH_TIME,\n\tEPOCH_TIME_SECONDS,\n\tEPOCH_TIME_MILLISECONDS,\n\tMAX_ADDRESS_NUMBER,\n\tMAX_TRANSACTION_ID,\n\tMAX_TRANSACTION_AMOUNT,\n\tTESTNET_NETHASH,\n\tMAINNET_NETHASH,\n\tSIGNED_MESSAGE_PREFIX,\n} from '../src';\n\ndescribe('lisk-constants', () => {\n\tit('EPOCH_TIME should be a Date instance', () => {\n\t\treturn expect(EPOCH_TIME).to.be.instanceOf(Date);\n\t});\n\n\tit('EPOCH_TIME_SECONDS should be an integer', () => {\n\t\treturn expect(EPOCH_TIME_SECONDS).to.be.an.integer;\n\t});\n\n\tit('EPOCH_TIME_MILLISECONDS should be an integer', () => {\n\t\treturn expect(EPOCH_TIME_MILLISECONDS).to.be.an.integer;\n\t});\n\n\tit('MAX_ADDRESS_NUMBER should be a string', () => {\n\t\treturn expect(MAX_ADDRESS_NUMBER).to.be.a('string');\n\t});\n\n\tit('MAX_TRANSACTION_ID should be a string', () => {\n\t\treturn expect(MAX_TRANSACTION_ID).to.be.a('string');\n\t});\n\n\tit('MAX_TRANSACTION_AMOUNT should be a string', () => {\n\t\treturn expect(MAX_TRANSACTION_AMOUNT).to.be.a('string');\n\t});\n\n\tit('TESTNET_NETHASH should be a string', () => {\n\t\treturn expect(TESTNET_NETHASH).to.be.a.hexString;\n\t});\n\n\tit('MAINNET_NETHASH should be a string', () => {\n\t\treturn expect(MAINNET_NETHASH).to.be.a.hexString;\n\t});\n\n\tit('SIGNED_MESSAGE_PREFIX should be a string', () => {\n\t\treturn expect(SIGNED_MESSAGE_PREFIX).to.be.a('string');\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    {one line to give the program's name and a brief idea of what it does.}\n    Copyright (C) {year}  {name of author}\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    {project}  Copyright (C) {year}  {fullname}\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "packages/lisk-cryptography/README.md",
    "content": "# @liskhq/lisk-cryptography\n\n@liskhq/lisk-cryptography is containing general cryptographic functions for use with Lisk-related software\n\n\n## Installation\n\n```sh\n$ npm install --save @liskhq/lisk-cryptography\n```\n\n## Benchmarking\n\nInstall optional dependencies:\n\n```sh\n$ npm i -D benchmark sodium-native\n```\n\nBenchmark nacl functions:\n\n```sh\n$ npx babel-node ./benchmark/nacl\n```\n\nBenchmark results for nacl functions:\n\n| Function            | Fast                     | Slow                     | Winner |\n| :-----------------: | :-----------------------:|:-----------------------: | :----: |\n| box                 | x 23,982 ops/sec ±0.59%  | x 771 ops/sec ±0.44%     |  Fast  |\n| openBox             | x 24,247 ops/sec ±0.42%  | x 770 ops/sec ±0.69%     |  Fast  |\n| signDetached        | x 46,402 ops/sec ±0.32%  | x 236 ops/sec ±1.63%     |  Fast  |\n| verifyDetached      | x 17,153 ops/sec ±0.19%  | x 122 ops/sec ±0.61%     |  Fast  |\n| getRandomBytes      | x 207,866 ops/sec ±0.23% | x 299,959 ops/sec ±0.39% |  Slow  |\n| getKeyPair          | x 38,815 ops/sec ±0.16%  | x 242 ops/sec ±0.62%     |  Fast  |\n\n## License\n\nCopyright © 2016-2018 Lisk Foundation\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the [GNU General Public License](https://github.com/LiskHQ/lisk-elements/tree/master/LICENSE) along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n***\n\nThis program also incorporates work previously released with lisk-js `v0.5.2` (and earlier) versions under the [MIT License](https://opensource.org/licenses/MIT). To comply with the requirements of that license, the following permission notice, applicable to those parts of the code only, is included below:\n\nCopyright © 2016-2017 Lisk Foundation\n\nCopyright © 2015 Crypti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[Lisk Core GitHub]: https://github.com/LiskHQ/lisk\n[Lisk documentation site]: https://lisk.io/documentation/lisk-elements\n"
  },
  {
    "path": "packages/lisk-cryptography/benchmark/nacl.js",
    "content": "/*\n* Copyright © 2018 Lisk Foundation\n*\n* See the LICENSE file at the top-level directory of this distribution\n* for licensing information.\n*\n* Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n* no part of this software, including this file, may be copied, modified,\n* propagated, or distributed except according to the terms contained in the\n* LICENSE file.\n*\n* Removal or modification of this copyright notice is prohibited.\n*\n*/\nimport Benchmark from 'benchmark';\nimport * as fast from '../src/nacl/fast';\nimport * as slow from '../src/nacl/slow';\n\nBenchmark.options.minSamples = 100;\n\nconst defaultPublicKey =\n\t'7ef45cd525e95b7a86244bbd4eb4550914ad06301013958f4dd64d32ef7bc588';\nconst defaultPrivateKey =\n\t'314852d7afb0d4c283692fef8a2cb40e30c7a5df2ed79994178c10ac168d6d977ef45cd525e95b7a86244bbd4eb4550914ad06301013958f4dd64d32ef7bc588';\nconst defaultMessage = 'Some default text.';\nconst defaultSignature =\n\t'68937004b6720d7e1902ef05a577e6d9f9ab2756286b1f2ae918f8a0e5153c15e4f410916076f750b708f8979be2430e4cfc7ebb523ae1905d2ea1f5d24ce700';\nconst defaultEncryptedMessage =\n\t'a232e5ea10e18249efc5a0aa8ed68271fc494d02245c52277ee2e14cddd960144a65';\nconst defaultNonce = 'df4c8b09e270d2cb3f7b3d53dfa8a6f3441ad3b14a13fb66';\nconst defaultHash =\n\t'314852d7afb0d4c283692fef8a2cb40e30c7a5df2ed79994178c10ac168d6d97';\nconst defaultDigest =\n\t'aba8462bb7a1460f1e36c36a71f0b7f67d1606562001907c1b2dad08a8ce74ae';\nconst defaultConvertedPublicKeyEd2Curve =\n\t'b8c0eecfd16c1cc4f057a6fc6d8dd3d46e4aa9625408d4bd0ba00e991326fe00';\nconst defaultConvertedPrivateKeyEd2Curve =\n\t'b0e3276b64b086b381e11928e56f966d062dc677b7801cc594aeb2d4193e8d57';\n\nconst boxBenchmark = new Benchmark.Suite('box')\n\t.add('fast.box', () => {\n\t\tfast.box(\n\t\t\tBuffer.from(defaultMessage, 'utf8'),\n\t\t\tBuffer.from(defaultNonce, 'hex'),\n\t\t\tBuffer.from(defaultConvertedPublicKeyEd2Curve, 'hex'),\n\t\t\tBuffer.from(defaultConvertedPrivateKeyEd2Curve, 'hex'),\n\t\t);\n\t})\n\t.add('slow.box', () => {\n\t\tslow.box(\n\t\t\tBuffer.from(defaultMessage, 'utf8'),\n\t\t\tBuffer.from(defaultNonce, 'hex'),\n\t\t\tBuffer.from(defaultConvertedPublicKeyEd2Curve, 'hex'),\n\t\t\tBuffer.from(defaultConvertedPrivateKeyEd2Curve, 'hex'),\n\t\t);\n\t});\n\nconst openBoxBenchmark = new Benchmark.Suite('openBox')\n\t.add('fast.openBox', () => {\n\t\tfast.openBox(\n\t\t\tBuffer.from(defaultEncryptedMessage, 'hex'),\n\t\t\tBuffer.from(defaultNonce, 'hex'),\n\t\t\tBuffer.from(defaultConvertedPublicKeyEd2Curve, 'hex'),\n\t\t\tBuffer.from(defaultConvertedPrivateKeyEd2Curve, 'hex'),\n\t\t);\n\t})\n\t.add('slow.openBox', () => {\n\t\tslow.openBox(\n\t\t\tBuffer.from(defaultEncryptedMessage, 'hex'),\n\t\t\tBuffer.from(defaultNonce, 'hex'),\n\t\t\tBuffer.from(defaultConvertedPublicKeyEd2Curve, 'hex'),\n\t\t\tBuffer.from(defaultConvertedPrivateKeyEd2Curve, 'hex'),\n\t\t);\n\t});\n\nconst signDetachedBenchmark = new Benchmark.Suite('signDetached')\n\t.add('fast.signDetached', () => {\n\t\tfast.signDetached(\n\t\t\tBuffer.from(defaultDigest, 'hex'),\n\t\t\tBuffer.from(defaultPrivateKey, 'hex'),\n\t\t);\n\t})\n\t.add('slow.signDetached', () => {\n\t\tslow.signDetached(\n\t\t\tBuffer.from(defaultDigest, 'hex'),\n\t\t\tBuffer.from(defaultPrivateKey, 'hex'),\n\t\t);\n\t});\n\nconst verifyDetachedBenchmark = new Benchmark.Suite('verifyDetached')\n\t.add('fast.verifyDetached', () => {\n\t\tfast.verifyDetached(\n\t\t\tBuffer.from(defaultDigest, 'hex'),\n\t\t\tBuffer.from(defaultSignature, 'hex'),\n\t\t\tBuffer.from(defaultPublicKey, 'hex'),\n\t\t);\n\t})\n\t.add('slow.verifyDetached', () => {\n\t\tslow.verifyDetached(\n\t\t\tBuffer.from(defaultDigest, 'hex'),\n\t\t\tBuffer.from(defaultSignature, 'hex'),\n\t\t\tBuffer.from(defaultPublicKey, 'hex'),\n\t\t);\n\t});\n\nconst getRandomBytesBenchmark = new Benchmark.Suite('getRandomBytes')\n\t.add('fast.getRandomBytes', () => {\n\t\tfast.getRandomBytes(24);\n\t})\n\t.add('slow.getRandomBytes', () => {\n\t\tslow.getRandomBytes(24);\n\t});\n\nconst getKeyPairBenchmark = new Benchmark.Suite('getKeyPair')\n\t.add('fast.getKeyPair', () => {\n\t\tfast.getKeyPair(Buffer.from(defaultHash, 'hex'));\n\t})\n\t.add('slow.getKeyPair', () => {\n\t\tslow.getKeyPair(Buffer.from(defaultHash, 'hex'));\n\t});\n\n[\n\tboxBenchmark,\n\topenBoxBenchmark,\n\tsignDetachedBenchmark,\n\tverifyDetachedBenchmark,\n\tgetRandomBytesBenchmark,\n\tgetKeyPairBenchmark,\n].forEach(benchmark => {\n\tbenchmark\n\t\t.on('start', () => {\n\t\t\tconsole.info(`Evaluating ${benchmark.name}..`);\n\t\t})\n\t\t.on('cycle', event => {\n\t\t\tconsole.info(String(event.target));\n\t\t})\n\t\t.on('complete', function callback() {\n\t\t\tconsole.info(`Winner is ${this.filter('fastest').map('name')}!`);\n\t\t})\n\t\t.run();\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/package.json",
    "content": "{\n\t\"name\": \"@liskhq/lisk-cryptography\",\n\t\"version\": \"2.0.0\",\n\t\"description\": \"General cryptographic functions for use with Lisk-related software\",\n\t\"author\": \"Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>\",\n\t\"license\": \"GPL-3.0\",\n\t\"keywords\": [\n\t\t\"lisk\",\n\t\t\"blockchain\"\n\t],\n\t\"homepage\": \"https://github.com/LiskHQ/lisk-elements/tree/master/packages/lisk-cryptography#readme\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/LiskHQ/lisk-elements.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/LiskHQ/lisk-elements/issues\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=8.10 <=10\",\n\t\t\"npm\": \">=5\"\n\t},\n\t\"main\": \"dist-node/index.js\",\n\t\"scripts\": {\n\t\t\"transpile\": \"tsc\",\n\t\t\"transpile:browsertest\": \"tsc -p tsconfig.browsertest.json\",\n\t\t\"browserify\": \"browserify ./dist-node/index.js -o ./dist-browser/index.js -s liskCryptography\",\n\t\t\"browserify:browsertest\": \"browserify ./browsertest.build/test/*.js -o ./browsertest.build/browsertest.js -s liskCryptography\",\n\t\t\"uglify\": \"uglifyjs -nm -o ./dist-browser/index.min.js ./dist-browser/index.js\",\n\t\t\"uglify:browsertest\": \"uglifyjs -o ./browsertest.build/browsertest.min.js ./browsertest.build/browsertest.js\",\n\t\t\"clean\": \"./scripts/clean.sh\",\n\t\t\"format\": \"prettier --write \\\"*.{ts,json}\\\" \\\"{src,test}/**/*.{ts,json}\\\"\",\n\t\t\"lint\": \"tslint --format verbose --project .\",\n\t\t\"lint:fix\": \"npm run lint -- --fix\",\n\t\t\"test\": \"TS_NODE_PROJECT=./test/tsconfig.json nyc mocha test/{,/**/}/*.ts\",\n\t\t\"test:watch\": \"npm test -- --watch\",\n\t\t\"test:watch:min\": \"npm run test:watch -- --reporter=min\",\n\t\t\"test:node\": \"npm run build:check\",\n\t\t\"serve:start\": \"http-server -p 11543 ./browsertest &\",\n\t\t\"serve:stop\": \"kill $(lsof -t -i:11543) || true\",\n\t\t\"pretest:browser\": \"npm run serve:stop && npm run build:browsertest && npm run serve:start\",\n\t\t\"test:browser\": \"wait-on http://localhost:11543 && cypress run --config baseUrl=http://localhost:11543 --env ROOT_DIR=\\\"${PWD##*/}\\\"\",\n\t\t\"posttest:browser\": \"npm run serve:stop\",\n\t\t\"cover\": \"if [ -z $JENKINS_HOME ]; then npm run cover:local; else npm run cover:ci; fi\",\n\t\t\"cover:base\": \"NODE_ENV=test nyc report\",\n\t\t\"cover:local\": \"npm run cover:base -- --reporter=html --reporter=text\",\n\t\t\"cover:ci\": \"npm run cover:base -- --reporter=text\",\n\t\t\"build:browsertest\": \"npm run transpile:browsertest && npm run browserify:browsertest && npm run uglify:browsertest\",\n\t\t\"postbuild:browsertest\": \"rm -r browsertest.build/src browsertest.build/test\",\n\t\t\"prebuild:node\": \"rm -r dist-node/* || mkdir dist-node || true\",\n\t\t\"build:node\": \"npm run transpile\",\n\t\t\"prebuild:browser\": \"rm ./dist-browser/index.js ./dist-browser/index.min.js || true\",\n\t\t\"build:browser\": \"npm run build:node && npm run browserify && npm run uglify\",\n\t\t\"prebuild\": \"npm run prebuild:browser\",\n\t\t\"build\": \"npm run build:browser\",\n\t\t\"build:check\": \"node -e \\\"require('./dist-node')\\\"\",\n\t\t\"prepublishOnly\": \"npm run lint && npm test && npm run build && npm run build:check\"\n\t},\n\t\"dependencies\": {\n\t\t\"@types/ed2curve\": \"0.2.2\",\n\t\t\"@types/node\": \"10.12.0\",\n\t\t\"browserify-bignum\": \"1.3.0-2\",\n\t\t\"buffer-reverse\": \"1.0.1\",\n\t\t\"ed2curve\": \"0.2.1\",\n\t\t\"tweetnacl\": \"1.0.0\",\n\t\t\"varuint-bitcoin\": \"1.1.0\"\n\t},\n\t\"optionalDependencies\": {\n\t\t\"sodium-native\": \"2.2.1\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@types/jquery\": \"3.3.22\",\n\t\t\"@types/mocha\": \"5.2.5\",\n\t\t\"benchmark\": \"2.1.4\",\n\t\t\"browserify\": \"16.2.2\",\n\t\t\"chai\": \"4.1.2\",\n\t\t\"cypress\": \"3.1.0\",\n\t\t\"http-server\": \"0.11.1\",\n\t\t\"mocha\": \"5.2.0\",\n\t\t\"nyc\": \"13.0.1\",\n\t\t\"prettier\": \"1.14.2\",\n\t\t\"sinon\": \"6.2.0\",\n\t\t\"sodium-native\": \"2.2.1\",\n\t\t\"source-map-support\": \"0.5.9\",\n\t\t\"ts-node\": \"7.0.1\",\n\t\t\"tsconfig-paths\": \"3.6.0\",\n\t\t\"tslint\": \"5.11.0\",\n\t\t\"tslint-immutable\": \"4.8.0\",\n\t\t\"typescript\": \"3.0.3\",\n\t\t\"uglify-es\": \"3.3.9\",\n\t\t\"wait-on\": \"3.0.1\"\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-cryptography/src/buffer.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport BigNum from 'browserify-bignum';\n\nexport const bigNumberToBuffer = (bignumber: string, size: number) =>\n\tnew BigNum(bignumber).toBuffer({ size, endian: 'big' });\n\nexport const bufferToBigNumberString = (bigNumberBuffer: Buffer): string =>\n\tBigNum.fromBuffer(bigNumberBuffer).toString();\n\nexport const bufferToHex = (buffer: Buffer): string =>\n\tBuffer.from(buffer).toString('hex');\n\nconst hexRegex = /^[0-9a-f]+/i;\nexport const hexToBuffer = (hex: string, argumentName = 'Argument'): Buffer => {\n\tif (typeof hex !== 'string') {\n\t\tthrow new TypeError(`${argumentName} must be a string.`);\n\t}\n\tconst matchedHex = (hex.match(hexRegex) || [])[0];\n\tif (!matchedHex || matchedHex.length !== hex.length) {\n\t\tthrow new TypeError(`${argumentName} must be a valid hex string.`);\n\t}\n\t// tslint:disable-next-line no-magic-numbers\n\tif (matchedHex.length % 2 !== 0) {\n\t\tthrow new TypeError(\n\t\t\t`${argumentName} must have a valid length of hex string.`,\n\t\t);\n\t}\n\n\treturn Buffer.from(matchedHex, 'hex');\n};\n"
  },
  {
    "path": "packages/lisk-cryptography/src/constants.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nexport const SIGNED_MESSAGE_PREFIX = 'Lisk Signed Message:\\n';\n"
  },
  {
    "path": "packages/lisk-cryptography/src/convert.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport reverseBuffer from 'buffer-reverse';\nimport ed2curve from 'ed2curve';\nimport querystring from 'querystring';\nimport { bufferToBigNumberString } from './buffer';\nimport { EncryptedPassphraseObject } from './encrypt';\nimport { hash } from './hash';\n\nexport const getFirstEightBytesReversed = (input: string | Buffer): Buffer => {\n\tconst BUFFER_SIZE = 8;\n\t// Union type arguments on overloaded functions do not work in typescript.\n\t// Relevant discussion: https://github.com/Microsoft/TypeScript/issues/23155\n\tif (typeof input === 'string') {\n\t\treturn reverseBuffer(Buffer.from(input).slice(0, BUFFER_SIZE));\n\t}\n\n\treturn reverseBuffer(Buffer.from(input).slice(0, BUFFER_SIZE));\n};\n\nexport const toAddress = (buffer: Buffer): string => {\n\tconst BUFFER_SIZE = 8;\n\tif (\n\t\t!Buffer.from(buffer)\n\t\t\t.slice(0, BUFFER_SIZE)\n\t\t\t.equals(buffer)\n\t) {\n\t\tthrow new Error(\n\t\t\t'The buffer for Lisk addresses must not have more than 8 bytes',\n\t\t);\n\t}\n\n\treturn `${bufferToBigNumberString(buffer)}L`;\n};\n\nexport const getAddressFromPublicKey = (publicKey: string): string => {\n\tconst publicKeyHash = hash(publicKey, 'hex');\n\n\tconst publicKeyTransform = getFirstEightBytesReversed(publicKeyHash);\n\tconst address = toAddress(publicKeyTransform);\n\n\treturn address;\n};\n\nexport const convertPublicKeyEd2Curve = ed2curve.convertPublicKey;\n\nexport const convertPrivateKeyEd2Curve = ed2curve.convertSecretKey;\n\nexport const stringifyEncryptedPassphrase = (\n\tencryptedPassphrase: EncryptedPassphraseObject,\n): string => {\n\tif (typeof encryptedPassphrase !== 'object' || encryptedPassphrase === null) {\n\t\tthrow new Error('Encrypted passphrase to stringify must be an object.');\n\t}\n\tconst objectToStringify = encryptedPassphrase.iterations\n\t\t? encryptedPassphrase\n\t\t: {\n\t\t\t\tsalt: encryptedPassphrase.salt,\n\t\t\t\tcipherText: encryptedPassphrase.cipherText,\n\t\t\t\tiv: encryptedPassphrase.iv,\n\t\t\t\ttag: encryptedPassphrase.tag,\n\t\t\t\tversion: encryptedPassphrase.version,\n\t\t  };\n\n\treturn querystring.stringify(objectToStringify);\n};\n\nconst parseIterations = (iterationsString?: string): number | undefined => {\n\tconst iterations =\n\t\titerationsString === undefined ? undefined : parseInt(iterationsString, 10);\n\n\tif (typeof iterations !== 'undefined' && Number.isNaN(iterations)) {\n\t\tthrow new Error('Could not parse iterations.');\n\t}\n\n\treturn iterations;\n};\n\nexport const parseEncryptedPassphrase = (\n\tencryptedPassphrase: string,\n): EncryptedPassphraseObject => {\n\tif (typeof encryptedPassphrase !== 'string') {\n\t\tthrow new Error('Encrypted passphrase to parse must be a string.');\n\t}\n\tconst keyValuePairs = querystring.parse(encryptedPassphrase);\n\n\tconst { iterations, salt, cipherText, iv, tag, version } = keyValuePairs;\n\n\t// Review, and find a better solution\n\tif (\n\t\t(typeof iterations !== 'string' && typeof iterations !== 'undefined') ||\n\t\ttypeof salt !== 'string' ||\n\t\ttypeof cipherText !== 'string' ||\n\t\ttypeof iv !== 'string' ||\n\t\ttypeof tag !== 'string' ||\n\t\ttypeof version !== 'string'\n\t) {\n\t\tthrow new Error(\n\t\t\t'Encrypted passphrase to parse must have only one value per key.',\n\t\t);\n\t}\n\n\treturn {\n\t\titerations: parseIterations(iterations),\n\t\tsalt,\n\t\tcipherText,\n\t\tiv,\n\t\ttag,\n\t\tversion,\n\t};\n};\n"
  },
  {
    "path": "packages/lisk-cryptography/src/encrypt.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport crypto from 'crypto';\nimport { bufferToHex, hexToBuffer } from './buffer';\nimport { convertPrivateKeyEd2Curve, convertPublicKeyEd2Curve } from './convert';\nimport { getPrivateAndPublicKeyBytesFromPassphrase } from './keys';\nimport { box, getRandomBytes, openBox } from './nacl';\n\nconst PBKDF2_ITERATIONS = 1e6;\nconst PBKDF2_KEYLEN = 32;\nconst PBKDF2_HASH_FUNCTION = 'sha256';\nconst ENCRYPTION_VERSION = '1';\n\nexport interface EncryptedMessageWithNonce {\n\treadonly encryptedMessage: string;\n\treadonly nonce: string;\n}\n\nexport const encryptMessageWithPassphrase = (\n\tmessage: string,\n\tpassphrase: string,\n\trecipientPublicKey: string,\n): EncryptedMessageWithNonce => {\n\tconst {\n\t\tprivateKeyBytes: senderPrivateKeyBytes,\n\t} = getPrivateAndPublicKeyBytesFromPassphrase(passphrase);\n\tconst convertedPrivateKey = Buffer.from(\n\t\tconvertPrivateKeyEd2Curve(senderPrivateKeyBytes),\n\t);\n\tconst recipientPublicKeyBytes = hexToBuffer(recipientPublicKey);\n\tconst messageInBytes = Buffer.from(message, 'utf8');\n\tconst nonceSize = 24;\n\tconst nonce = getRandomBytes(nonceSize);\n\tconst publicKeyUint8Array = convertPublicKeyEd2Curve(recipientPublicKeyBytes);\n\n\t// This cannot be reproduced, but external library have type union with null\n\tif (publicKeyUint8Array === null) {\n\t\tthrow new Error('given public key is not a valid Ed25519 public key');\n\t}\n\n\tconst convertedPublicKey = Buffer.from(publicKeyUint8Array);\n\n\tconst cipherBytes = box(\n\t\tmessageInBytes,\n\t\tnonce,\n\t\tconvertedPublicKey,\n\t\tconvertedPrivateKey,\n\t);\n\n\tconst nonceHex = bufferToHex(nonce);\n\tconst encryptedMessage = bufferToHex(cipherBytes);\n\n\treturn {\n\t\tnonce: nonceHex,\n\t\tencryptedMessage,\n\t};\n};\n\nexport const decryptMessageWithPassphrase = (\n\tcipherHex: string,\n\tnonce: string,\n\tpassphrase: string,\n\tsenderPublicKey: string,\n): string => {\n\tconst {\n\t\tprivateKeyBytes: recipientPrivateKeyBytes,\n\t} = getPrivateAndPublicKeyBytesFromPassphrase(passphrase);\n\tconst convertedPrivateKey = Buffer.from(\n\t\tconvertPrivateKeyEd2Curve(recipientPrivateKeyBytes),\n\t);\n\tconst senderPublicKeyBytes = hexToBuffer(senderPublicKey);\n\tconst cipherBytes = hexToBuffer(cipherHex);\n\tconst nonceBytes = hexToBuffer(nonce);\n\n\tconst publicKeyUint8Array = convertPublicKeyEd2Curve(senderPublicKeyBytes);\n\n\t// This cannot be reproduced, but external library have type union with null\n\tif (publicKeyUint8Array === null) {\n\t\tthrow new Error('given public key is not a valid Ed25519 public key');\n\t}\n\n\tconst convertedPublicKey = Buffer.from(publicKeyUint8Array);\n\n\ttry {\n\t\tconst decoded = openBox(\n\t\t\tcipherBytes,\n\t\t\tnonceBytes,\n\t\t\tconvertedPublicKey,\n\t\t\tconvertedPrivateKey,\n\t\t);\n\n\t\treturn Buffer.from(decoded).toString();\n\t} catch (error) {\n\t\tif (\n\t\t\terror.message.match(\n\t\t\t\t/bad nonce size|nonce must be a buffer of size crypto_box_NONCEBYTES/,\n\t\t\t)\n\t\t) {\n\t\t\tthrow new Error('Expected nonce to be 24 bytes.');\n\t\t}\n\t\tthrow new Error(\n\t\t\t'Something went wrong during decryption. Is this the full encrypted message?',\n\t\t);\n\t}\n};\n\nconst getKeyFromPassword = (\n\tpassword: string,\n\tsalt: Buffer,\n\titerations: number,\n): Buffer =>\n\tcrypto.pbkdf2Sync(\n\t\tpassword,\n\t\tsalt,\n\t\titerations,\n\t\tPBKDF2_KEYLEN,\n\t\tPBKDF2_HASH_FUNCTION,\n\t);\n\nexport interface EncryptedPassphraseObject {\n\treadonly cipherText: string;\n\treadonly iterations?: number;\n\treadonly iv: string;\n\treadonly salt: string;\n\treadonly tag: string;\n\treadonly version: string;\n}\n\nconst encryptAES256GCMWithPassword = (\n\tplainText: string,\n\tpassword: string,\n\titerations: number = PBKDF2_ITERATIONS,\n): EncryptedPassphraseObject => {\n\tconst IV_BUFFER_SIZE = 12;\n\tconst SALT_BUFFER_SIZE = 16;\n\tconst iv = crypto.randomBytes(IV_BUFFER_SIZE);\n\tconst salt = crypto.randomBytes(SALT_BUFFER_SIZE);\n\tconst key = getKeyFromPassword(password, salt, iterations);\n\n\tconst cipher = crypto.createCipheriv('aes-256-gcm', key, iv);\n\tconst firstBlock = cipher.update(plainText, 'utf8');\n\tconst encrypted = Buffer.concat([firstBlock, cipher.final()]);\n\tconst tag = cipher.getAuthTag();\n\n\treturn {\n\t\titerations,\n\t\tcipherText: encrypted.toString('hex'),\n\t\tiv: iv.toString('hex'),\n\t\tsalt: salt.toString('hex'),\n\t\ttag: tag.toString('hex'),\n\t\tversion: ENCRYPTION_VERSION,\n\t};\n};\n\nconst getTagBuffer = (tag: string): Buffer => {\n\tconst TAG_BUFFER_SIZE = 16;\n\tconst tagBuffer = hexToBuffer(tag, 'Tag');\n\tif (tagBuffer.length !== TAG_BUFFER_SIZE) {\n\t\tthrow new Error('Tag must be 16 bytes.');\n\t}\n\n\treturn tagBuffer;\n};\n\nconst decryptAES256GCMWithPassword = (\n\tencryptedPassphrase: EncryptedPassphraseObject,\n\tpassword: string,\n): string => {\n\tconst {\n\t\titerations = PBKDF2_ITERATIONS,\n\t\tcipherText,\n\t\tiv,\n\t\tsalt,\n\t\ttag,\n\t} = encryptedPassphrase;\n\n\tconst tagBuffer = getTagBuffer(tag);\n\tconst key = getKeyFromPassword(\n\t\tpassword,\n\t\thexToBuffer(salt, 'Salt'),\n\t\titerations,\n\t);\n\n\tconst decipher = crypto.createDecipheriv(\n\t\t'aes-256-gcm',\n\t\tkey,\n\t\thexToBuffer(iv, 'IV'),\n\t);\n\tdecipher.setAuthTag(tagBuffer);\n\tconst firstBlock = decipher.update(hexToBuffer(cipherText, 'Cipher text'));\n\tconst decrypted = Buffer.concat([firstBlock, decipher.final()]);\n\n\treturn decrypted.toString();\n};\n\nexport const encryptPassphraseWithPassword = encryptAES256GCMWithPassword;\n\nexport const decryptPassphraseWithPassword = decryptAES256GCMWithPassword;\n"
  },
  {
    "path": "packages/lisk-cryptography/src/hash.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport crypto from 'crypto';\nimport { hexToBuffer } from './buffer';\n\nconst cryptoHashSha256 = (data: Buffer): Buffer => {\n\tconst dataHash = crypto.createHash('sha256');\n\tdataHash.update(data);\n\n\treturn dataHash.digest();\n};\n\nexport const hash = (data: Buffer | string, format?: string): Buffer => {\n\tif (Buffer.isBuffer(data)) {\n\t\treturn cryptoHashSha256(data);\n\t}\n\n\tif (typeof data === 'string' && typeof format === 'string') {\n\t\tif (!['utf8', 'hex'].includes(format)) {\n\t\t\tthrow new Error(\n\t\t\t\t'Unsupported string format. Currently only `hex` and `utf8` are supported.',\n\t\t\t);\n\t\t}\n\t\tconst encoded =\n\t\t\tformat === 'utf8' ? Buffer.from(data, 'utf8') : hexToBuffer(data);\n\n\t\treturn cryptoHashSha256(encoded);\n\t}\n\n\tthrow new Error(\n\t\t'Unsupported data format. Currently only Buffers or `hex` and `utf8` strings are supported.',\n\t);\n};\n"
  },
  {
    "path": "packages/lisk-cryptography/src/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as constants from './constants';\n\nexport * from './buffer';\nexport * from './convert';\nexport * from './encrypt';\nexport * from './hash';\nexport * from './keys';\nexport * from './sign';\n\nexport { constants };\n"
  },
  {
    "path": "packages/lisk-cryptography/src/keys.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { bufferToHex } from './buffer';\nimport { getAddressFromPublicKey } from './convert';\nimport { hash } from './hash';\nimport { getKeyPair } from './nacl';\n\nexport interface KeypairBytes {\n\treadonly privateKeyBytes: Buffer;\n\treadonly publicKeyBytes: Buffer;\n}\n\nexport interface Keypair {\n\treadonly privateKey: string;\n\treadonly publicKey: string;\n}\n\nexport const getPrivateAndPublicKeyBytesFromPassphrase = (\n\tpassphrase: string,\n): KeypairBytes => {\n\tconst hashed = hash(passphrase, 'utf8');\n\tconst { publicKeyBytes, privateKeyBytes } = getKeyPair(hashed);\n\n\treturn {\n\t\tprivateKeyBytes,\n\t\tpublicKeyBytes,\n\t};\n};\n\nexport const getPrivateAndPublicKeyFromPassphrase = (\n\tpassphrase: string,\n): Keypair => {\n\tconst {\n\t\tprivateKeyBytes,\n\t\tpublicKeyBytes,\n\t} = getPrivateAndPublicKeyBytesFromPassphrase(passphrase);\n\n\treturn {\n\t\tprivateKey: bufferToHex(privateKeyBytes),\n\t\tpublicKey: bufferToHex(publicKeyBytes),\n\t};\n};\n\nexport const getKeys = getPrivateAndPublicKeyFromPassphrase;\n\nexport const getAddressAndPublicKeyFromPassphrase = (\n\tpassphrase: string,\n): { readonly address: string; readonly publicKey: string } => {\n\tconst { publicKey } = getKeys(passphrase);\n\tconst address = getAddressFromPublicKey(publicKey);\n\n\treturn {\n\t\taddress,\n\t\tpublicKey,\n\t};\n};\n\nexport const getAddressFromPassphrase = (passphrase: string): string => {\n\tconst { publicKey } = getKeys(passphrase);\n\n\treturn getAddressFromPublicKey(publicKey);\n};\n"
  },
  {
    "path": "packages/lisk-cryptography/src/nacl/fast.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\n// tslint:disable-next-line no-implicit-dependencies\nimport sodium from 'sodium-native';\nimport { NaclInterface } from './nacl_types';\n\nexport const box: NaclInterface['box'] = (\n\tmessageInBytes,\n\tnonceInBytes,\n\tconvertedPublicKey,\n\tconvertedPrivateKey,\n) => {\n\tconst cipherBytes = Buffer.alloc(\n\t\tmessageInBytes.length + sodium.crypto_box_MACBYTES,\n\t);\n\tsodium.crypto_box_easy(\n\t\tcipherBytes,\n\t\tmessageInBytes,\n\t\tnonceInBytes,\n\t\tconvertedPublicKey,\n\t\tconvertedPrivateKey,\n\t);\n\n\treturn cipherBytes;\n};\n\nexport const openBox: NaclInterface['openBox'] = (\n\tcipherBytes,\n\tnonceBytes,\n\tconvertedPublicKey,\n\tconvertedPrivateKey,\n) => {\n\tconst plainText = Buffer.alloc(\n\t\tcipherBytes.length - sodium.crypto_box_MACBYTES,\n\t);\n\t// Returns false if decryption fails\n\tif (\n\t\t!sodium.crypto_box_open_easy(\n\t\t\tplainText,\n\t\t\tcipherBytes,\n\t\t\tnonceBytes,\n\t\t\tconvertedPublicKey,\n\t\t\tconvertedPrivateKey,\n\t\t)\n\t) {\n\t\tthrow new Error('Failed to decrypt message');\n\t}\n\n\treturn plainText;\n};\n\nexport const signDetached: NaclInterface['signDetached'] = (\n\tmessageBytes,\n\tprivateKeyBytes,\n) => {\n\tconst signatureBytes = Buffer.alloc(sodium.crypto_sign_BYTES);\n\tsodium.crypto_sign_detached(signatureBytes, messageBytes, privateKeyBytes);\n\n\treturn signatureBytes;\n};\n\nexport const verifyDetached: NaclInterface['verifyDetached'] = (\n\tmessageBytes,\n\tsignatureBytes,\n\tpublicKeyBytes,\n) =>\n\tsodium.crypto_sign_verify_detached(\n\t\tsignatureBytes,\n\t\tmessageBytes,\n\t\tpublicKeyBytes,\n\t);\n\nexport const getRandomBytes: NaclInterface['getRandomBytes'] = length => {\n\tconst nonce = Buffer.alloc(length);\n\tsodium.randombytes_buf(nonce);\n\n\treturn nonce;\n};\n\nexport const getKeyPair: NaclInterface['getKeyPair'] = hashedSeed => {\n\tconst publicKeyBytes = Buffer.alloc(sodium.crypto_sign_PUBLICKEYBYTES);\n\tconst privateKeyBytes = Buffer.alloc(sodium.crypto_sign_SECRETKEYBYTES);\n\n\tsodium.crypto_sign_seed_keypair(publicKeyBytes, privateKeyBytes, hashedSeed);\n\n\treturn {\n\t\tpublicKeyBytes,\n\t\tprivateKeyBytes,\n\t};\n};\n"
  },
  {
    "path": "packages/lisk-cryptography/src/nacl/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { NaclInterface } from './nacl_types';\n\n// tslint:disable-next-line no-let\nlet lib: NaclInterface;\n\ntry {\n\tif (process.env.NACL_FAST === 'disable') {\n\t\tthrow new Error('Use tweetnacl');\n\t}\n\t// Require used for conditional importing\n\t// tslint:disable-next-line no-var-requires no-require-imports\n\tlib = require('./fast');\n} catch (err) {\n\tprocess.env.NACL_FAST = 'disable';\n\t// tslint:disable-next-line no-var-requires no-require-imports\n\tlib = require('./slow');\n}\n\nexport const NACL_SIGN_PUBLICKEY_LENGTH = 32;\n\nexport const NACL_SIGN_SIGNATURE_LENGTH = 64;\n\nexport const {\n\tbox,\n\topenBox,\n\tsignDetached,\n\tverifyDetached,\n\tgetRandomBytes,\n\tgetKeyPair,\n} = lib;\n"
  },
  {
    "path": "packages/lisk-cryptography/src/nacl/nacl_types.ts",
    "content": "import { KeypairBytes } from '../keys';\n\nexport interface NaclInterface {\n\tbox(\n\t\tmessageInBytes: Buffer,\n\t\tnonceInBytes: Buffer,\n\t\tconvertedPublicKey: Buffer,\n\t\tconvertedPrivateKey: Buffer,\n\t): Buffer;\n\tgetKeyPair(hashedSeed: Buffer): KeypairBytes;\n\tgetRandomBytes(length: number): Buffer;\n\topenBox(\n\t\tcipherBytes: Buffer,\n\t\tnonceBytes: Buffer,\n\t\tconvertedPublicKey: Buffer,\n\t\tconvertedPrivateKey: Buffer,\n\t): Buffer;\n\tsignDetached(messageBytes: Buffer, privateKeyBytes: Buffer): Buffer;\n\tverifyDetached(\n\t\tmessageBytes: Buffer,\n\t\tsignatureBytes: Buffer,\n\t\tpublicKeyBytes: Buffer,\n\t): boolean;\n}\n"
  },
  {
    "path": "packages/lisk-cryptography/src/nacl/slow.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport tweetnacl from 'tweetnacl';\nimport { NaclInterface } from './nacl_types';\n\nexport const box: NaclInterface['box'] = (\n\tmessageInBytes,\n\tnonceInBytes,\n\tconvertedPublicKey,\n\tconvertedPrivateKey,\n) =>\n\tBuffer.from(\n\t\ttweetnacl.box(\n\t\t\tmessageInBytes,\n\t\t\tnonceInBytes,\n\t\t\tconvertedPublicKey,\n\t\t\tconvertedPrivateKey,\n\t\t),\n\t);\n\nexport const openBox: NaclInterface['openBox'] = (\n\tcipherBytes,\n\tnonceBytes,\n\tconvertedPublicKey,\n\tconvertedPrivateKey,\n) => {\n\tconst originalMessage = tweetnacl.box.open(\n\t\tcipherBytes,\n\t\tnonceBytes,\n\t\tconvertedPublicKey,\n\t\tconvertedPrivateKey,\n\t);\n\t// Returns null if decryption fails\n\tif (originalMessage === null) {\n\t\tthrow new Error('Failed to decrypt message');\n\t}\n\n\treturn Buffer.from(originalMessage);\n};\n\nexport const signDetached: NaclInterface['signDetached'] = (\n\tmessageBytes,\n\tprivateKeyBytes,\n) => Buffer.from(tweetnacl.sign.detached(messageBytes, privateKeyBytes));\n\nexport const verifyDetached: NaclInterface['verifyDetached'] =\n\ttweetnacl.sign.detached.verify;\n\nexport const getRandomBytes: NaclInterface['getRandomBytes'] = length =>\n\tBuffer.from(tweetnacl.randomBytes(length));\n\nexport const getKeyPair: NaclInterface['getKeyPair'] = hashedSeed => {\n\tconst { publicKey, secretKey } = tweetnacl.sign.keyPair.fromSeed(hashedSeed);\n\n\treturn {\n\t\tprivateKeyBytes: Buffer.from(secretKey),\n\t\tpublicKeyBytes: Buffer.from(publicKey),\n\t};\n};\n"
  },
  {
    "path": "packages/lisk-cryptography/src/sign.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { encode as encodeVarInt } from 'varuint-bitcoin';\nimport { bufferToHex, hexToBuffer } from './buffer';\nimport { SIGNED_MESSAGE_PREFIX } from './constants';\nimport { hash } from './hash';\nimport { getPrivateAndPublicKeyBytesFromPassphrase } from './keys';\nimport {\n\tNACL_SIGN_PUBLICKEY_LENGTH,\n\tNACL_SIGN_SIGNATURE_LENGTH,\n\tsignDetached,\n\tverifyDetached,\n} from './nacl';\n\nconst createHeader = (text: string): string => `-----${text}-----`;\nconst signedMessageHeader = createHeader('BEGIN LISK SIGNED MESSAGE');\nconst messageHeader = createHeader('MESSAGE');\nconst publicKeyHeader = createHeader('PUBLIC KEY');\nconst secondPublicKeyHeader = createHeader('SECOND PUBLIC KEY');\nconst signatureHeader = createHeader('SIGNATURE');\nconst secondSignatureHeader = createHeader('SECOND SIGNATURE');\nconst signatureFooter = createHeader('END LISK SIGNED MESSAGE');\n\nconst SIGNED_MESSAGE_PREFIX_BYTES = Buffer.from(SIGNED_MESSAGE_PREFIX, 'utf8');\nconst SIGNED_MESSAGE_PREFIX_LENGTH = encodeVarInt(SIGNED_MESSAGE_PREFIX.length);\n\nexport interface SignedMessageWithOnePassphrase {\n\treadonly message: string;\n\treadonly publicKey: string;\n\treadonly signature: string;\n}\nexport const digestMessage = (message: string): Buffer => {\n\tconst msgBytes = Buffer.from(message, 'utf8');\n\tconst msgLenBytes = encodeVarInt(message.length);\n\tconst dataBytes = Buffer.concat([\n\t\tSIGNED_MESSAGE_PREFIX_LENGTH,\n\t\tSIGNED_MESSAGE_PREFIX_BYTES,\n\t\tmsgLenBytes,\n\t\tmsgBytes,\n\t]);\n\n\treturn hash(hash(dataBytes));\n};\n\nexport const signMessageWithPassphrase = (\n\tmessage: string,\n\tpassphrase: string,\n): SignedMessageWithOnePassphrase => {\n\tconst msgBytes = digestMessage(message);\n\tconst {\n\t\tprivateKeyBytes,\n\t\tpublicKeyBytes,\n\t} = getPrivateAndPublicKeyBytesFromPassphrase(passphrase);\n\tconst signature = signDetached(msgBytes, privateKeyBytes);\n\n\treturn {\n\t\tmessage,\n\t\tpublicKey: bufferToHex(publicKeyBytes),\n\t\tsignature: bufferToHex(signature),\n\t};\n};\n\nexport const verifyMessageWithPublicKey = ({\n\tmessage,\n\tpublicKey,\n\tsignature,\n}: SignedMessageWithOnePassphrase): boolean => {\n\tconst msgBytes = digestMessage(message);\n\tconst signatureBytes = hexToBuffer(signature);\n\tconst publicKeyBytes = hexToBuffer(publicKey);\n\n\tif (publicKeyBytes.length !== NACL_SIGN_PUBLICKEY_LENGTH) {\n\t\tthrow new Error(\n\t\t\t`Invalid publicKey, expected ${NACL_SIGN_PUBLICKEY_LENGTH}-byte publicKey`,\n\t\t);\n\t}\n\n\tif (signatureBytes.length !== NACL_SIGN_SIGNATURE_LENGTH) {\n\t\tthrow new Error(\n\t\t\t`Invalid signature length, expected ${NACL_SIGN_SIGNATURE_LENGTH}-byte signature`,\n\t\t);\n\t}\n\n\treturn verifyDetached(msgBytes, signatureBytes, publicKeyBytes);\n};\n\nexport interface SignedMessageWithTwoPassphrases {\n\treadonly message: string;\n\treadonly publicKey: string;\n\treadonly secondPublicKey: string;\n\treadonly secondSignature: string;\n\treadonly signature: string;\n}\n\nexport const signMessageWithTwoPassphrases = (\n\tmessage: string,\n\tpassphrase: string,\n\tsecondPassphrase: string,\n): SignedMessageWithTwoPassphrases => {\n\tconst msgBytes = digestMessage(message);\n\tconst keypairBytes = getPrivateAndPublicKeyBytesFromPassphrase(passphrase);\n\tconst secondKeypairBytes = getPrivateAndPublicKeyBytesFromPassphrase(\n\t\tsecondPassphrase,\n\t);\n\n\tconst signature = signDetached(msgBytes, keypairBytes.privateKeyBytes);\n\tconst secondSignature = signDetached(\n\t\tmsgBytes,\n\t\tsecondKeypairBytes.privateKeyBytes,\n\t);\n\n\treturn {\n\t\tmessage,\n\t\tpublicKey: bufferToHex(keypairBytes.publicKeyBytes),\n\t\tsecondPublicKey: bufferToHex(secondKeypairBytes.publicKeyBytes),\n\t\tsignature: bufferToHex(signature),\n\t\tsecondSignature: bufferToHex(secondSignature),\n\t};\n};\n\nexport const verifyMessageWithTwoPublicKeys = ({\n\tmessage,\n\tsignature,\n\tsecondSignature,\n\tpublicKey,\n\tsecondPublicKey,\n}: SignedMessageWithTwoPassphrases) => {\n\tconst messageBytes = digestMessage(message);\n\tconst signatureBytes = hexToBuffer(signature);\n\tconst secondSignatureBytes = hexToBuffer(secondSignature);\n\tconst publicKeyBytes = hexToBuffer(publicKey);\n\tconst secondPublicKeyBytes = hexToBuffer(secondPublicKey);\n\n\tif (signatureBytes.length !== NACL_SIGN_SIGNATURE_LENGTH) {\n\t\tthrow new Error(\n\t\t\t`Invalid first signature length, expected ${NACL_SIGN_SIGNATURE_LENGTH}-byte signature`,\n\t\t);\n\t}\n\n\tif (secondSignatureBytes.length !== NACL_SIGN_SIGNATURE_LENGTH) {\n\t\tthrow new Error(\n\t\t\t`Invalid second signature length, expected ${NACL_SIGN_SIGNATURE_LENGTH}-byte signature`,\n\t\t);\n\t}\n\n\tif (publicKeyBytes.length !== NACL_SIGN_PUBLICKEY_LENGTH) {\n\t\tthrow new Error(\n\t\t\t`Invalid first publicKey, expected ${NACL_SIGN_PUBLICKEY_LENGTH}-byte publicKey`,\n\t\t);\n\t}\n\n\tif (secondPublicKeyBytes.length !== NACL_SIGN_PUBLICKEY_LENGTH) {\n\t\tthrow new Error(\n\t\t\t`Invalid second publicKey, expected ${NACL_SIGN_PUBLICKEY_LENGTH}-byte publicKey`,\n\t\t);\n\t}\n\n\tconst verifyFirstSignature = () =>\n\t\tverifyDetached(messageBytes, signatureBytes, publicKeyBytes);\n\tconst verifySecondSignature = () =>\n\t\tverifyDetached(messageBytes, secondSignatureBytes, secondPublicKeyBytes);\n\n\treturn verifyFirstSignature() && verifySecondSignature();\n};\n\nexport interface SingleOrDoubleSignedMessage {\n\treadonly message: string;\n\treadonly publicKey: string;\n\treadonly secondPublicKey?: string;\n\treadonly secondSignature?: string;\n\treadonly signature: string;\n}\n\nexport const printSignedMessage = ({\n\tmessage,\n\tsignature,\n\tpublicKey,\n\tsecondSignature,\n\tsecondPublicKey,\n}: SingleOrDoubleSignedMessage): string =>\n\t[\n\t\tsignedMessageHeader,\n\t\tmessageHeader,\n\t\tmessage,\n\t\tpublicKeyHeader,\n\t\tpublicKey,\n\t\tsecondPublicKey ? secondPublicKeyHeader : undefined,\n\t\tsecondPublicKey,\n\t\tsignatureHeader,\n\t\tsignature,\n\t\tsecondSignature ? secondSignatureHeader : undefined,\n\t\tsecondSignature,\n\t\tsignatureFooter,\n\t]\n\t\t.filter(Boolean)\n\t\t.join('\\n');\n\nexport const signAndPrintMessage = (\n\tmessage: string,\n\tpassphrase: string,\n\tsecondPassphrase?: string,\n): string => {\n\tconst signedMessage:\n\t\t| SignedMessageWithOnePassphrase\n\t\t| SignedMessageWithTwoPassphrases = secondPassphrase\n\t\t? signMessageWithTwoPassphrases(message, passphrase, secondPassphrase)\n\t\t: signMessageWithPassphrase(message, passphrase);\n\n\treturn printSignedMessage(signedMessage);\n};\n\nexport const signDataWithPrivateKey = (\n\tdata: Buffer,\n\tprivateKey: Buffer,\n): string => {\n\tconst signature = signDetached(data, privateKey);\n\n\treturn bufferToHex(signature);\n};\n\nexport const signDataWithPassphrase = (\n\tdata: Buffer,\n\tpassphrase: string,\n): string => {\n\tconst { privateKeyBytes } = getPrivateAndPublicKeyBytesFromPassphrase(\n\t\tpassphrase,\n\t);\n\n\treturn signDataWithPrivateKey(data, privateKeyBytes);\n};\n\nexport const signData = signDataWithPassphrase;\n\nexport const verifyData = (\n\tdata: Buffer,\n\tsignature: string,\n\tpublicKey: string,\n): boolean =>\n\tverifyDetached(data, hexToBuffer(signature), hexToBuffer(publicKey));\n"
  },
  {
    "path": "packages/lisk-cryptography/test/_global_hooks.ts",
    "content": "afterEach(() => {\n\treturn sandbox.restore();\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/test/_setup.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { Assertion } from 'chai';\nimport 'chai/register-expect';\nimport sinon from 'sinon';\n\nprocess.env.NODE_ENV = 'test';\n\nAssertion.addProperty('hexString', function handleAssert(\n\tthis: Chai.ChaiStatic,\n) {\n\tconst actual = this._obj;\n\n\tnew Assertion(actual).to.be.a('string');\n\n\tconst expected = Buffer.from(actual, 'hex').toString('hex');\n\tthis.assert(\n\t\texpected === actual,\n\t\t'expected #{this} to be a hexString',\n\t\t'expected #{this} not to be a hexString',\n\t);\n});\n\nAssertion.addProperty('integer', function handleAssert(this: Chai.ChaiStatic) {\n\tconst actual = this._obj;\n\n\tnew Assertion(actual).to.be.a('number');\n\n\tconst expected = parseInt(actual, 10);\n\tthis.assert(\n\t\tactual === expected,\n\t\t'expected #{this} to be an integer',\n\t\t'expected #{this} not to be an integer',\n\t);\n});\n\nglobal.sandbox = sinon.createSandbox({\n\tuseFakeTimers: true,\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/test/buffer.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport {\n\tbigNumberToBuffer,\n\tbufferToBigNumberString,\n\tbufferToHex,\n\thexToBuffer,\n} from '../src/buffer';\n\ndescribe('buffer', () => {\n\tconst defaultBuffer = Buffer.from('\\xe5\\xe4\\xf6');\n\tconst defaultHex = 'c3a5c3a4c3b6';\n\n\tdescribe('#bufferToHex', () => {\n\t\tit('should create a hex string from a Buffer', () => {\n\t\t\tconst hex = bufferToHex(defaultBuffer);\n\t\t\treturn expect(hex).to.be.equal(defaultHex);\n\t\t});\n\t});\n\n\tdescribe('#hexToBuffer', () => {\n\t\tit('should create a Buffer from a hex string', () => {\n\t\t\tconst buffer = hexToBuffer(defaultHex);\n\t\t\treturn expect(buffer).to.be.eql(defaultBuffer);\n\t\t});\n\n\t\tit('should throw TypeError with number', () => {\n\t\t\treturn expect(hexToBuffer.bind(null, 123)).to.throw(\n\t\t\t\tTypeError,\n\t\t\t\t'Argument must be a string.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw TypeError with object', () => {\n\t\t\treturn expect(hexToBuffer.bind(null, {})).to.throw(\n\t\t\t\tTypeError,\n\t\t\t\t'Argument must be a string.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw an error for a non-string input with custom argument name', () => {\n\t\t\treturn expect(hexToBuffer.bind(null, {}, 'Custom')).to.throw(\n\t\t\t\t'Custom must be a string.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw TypeError with non hex string', () => {\n\t\t\treturn expect(hexToBuffer.bind(null, 'yKJj')).to.throw(\n\t\t\t\tTypeError,\n\t\t\t\t'Argument must be a valid hex string.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw TypeError with partially correct hex string', () => {\n\t\t\treturn expect(hexToBuffer.bind(null, 'Abxzzzz')).to.throw(\n\t\t\t\tTypeError,\n\t\t\t\t'Argument must be a valid hex string.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw TypeError with odd number of string with partially correct hex string', () => {\n\t\t\treturn expect(hexToBuffer.bind(null, 'Abxzzab')).to.throw(\n\t\t\t\tTypeError,\n\t\t\t\t'Argument must be a valid hex string.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw TypeError with odd number hex string with invalid hex', () => {\n\t\t\treturn expect(hexToBuffer.bind(null, '123xxxx')).to.throw(\n\t\t\t\tTypeError,\n\t\t\t\t'Argument must be a valid hex string.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw an error for a non-hex string input with custom argument name', () => {\n\t\t\treturn expect(hexToBuffer.bind(null, 'yKJj', 'Custom')).to.throw(\n\t\t\t\t'Custom must be a valid hex string.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw TypeError with odd-length hex string', () => {\n\t\t\treturn expect(hexToBuffer.bind(null, 'c3a5c3a4c3b6a')).to.throw(\n\t\t\t\tTypeError,\n\t\t\t\t'Argument must have a valid length of hex string.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw an error for an odd-length hex string input with custom argument name', () => {\n\t\t\treturn expect(hexToBuffer.bind(null, 'c3a5c3a4c3b6a', 'Custom')).to.throw(\n\t\t\t\t'Custom must have a valid length of hex string.',\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('#bigNumberToBuffer', () => {\n\t\tit('should convert a big number to a buffer', () => {\n\t\t\tconst bigNumber = '58191285901858109';\n\t\t\tconst addressSize = 8;\n\t\t\tconst expectedBuffer = Buffer.from('00cebcaa8d34153d', 'hex');\n\t\t\treturn expect(bigNumberToBuffer(bigNumber, addressSize)).to.be.eql(\n\t\t\t\texpectedBuffer,\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('#bufferToBigNumberString', () => {\n\t\tit('should convert a buffer to a big number', () => {\n\t\t\tconst bigNumber = '58191285901858109';\n\t\t\tconst buffer = Buffer.from('00cebcaa8d34153d', 'hex');\n\t\t\treturn expect(bufferToBigNumberString(buffer)).to.be.equal(bigNumber);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/test/convert.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport {\n\tgetFirstEightBytesReversed,\n\ttoAddress,\n\tgetAddressFromPublicKey,\n\tconvertPublicKeyEd2Curve,\n\tconvertPrivateKeyEd2Curve,\n\tstringifyEncryptedPassphrase,\n\tparseEncryptedPassphrase,\n} from '../src/convert';\n// Require is used for stubbing\nconst hashModule = require('../src/hash');\n\ndescribe('convert', () => {\n\t// keys for passphrase 'secret';\n\tconst defaultPrivateKey =\n\t\t'2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst defaultPublicKey =\n\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst defaultPublicKeyHash = Buffer.from(\n\t\t'3a971fd02b4a07fc20aad1936d3cb1d263b96e0ffd938625e5c0db1ad8ba2a29',\n\t\t'hex',\n\t);\n\tconst defaultPrivateKeyCurve = Buffer.from(\n\t\t'68b211b2c01cc88690ba76a07895a5b4805e1c11fdd3af4c863e6d4efeb14378',\n\t\t'hex',\n\t);\n\tconst defaultPublicKeyCurve = Buffer.from(\n\t\t'6f9d780305bda43dd47a291d897f2d8845a06160632d82fb1f209fdd46ed3c1e',\n\t\t'hex',\n\t);\n\tconst defaultAddress = '18160565574430594874L';\n\tconst defaultStringWithMoreThanEightCharacters = '0123456789';\n\tconst defaultFirstEightCharactersReversed = '76543210';\n\tconst defaultDataForBuffer = 'Hello!';\n\tconst defaultAddressFromBuffer = '79600447942433L';\n\n\tdescribe('#getFirstEightBytesReversed', () => {\n\t\tit('should get the first eight bytes reversed from a Buffer', () => {\n\t\t\tconst bufferEntry = Buffer.from(defaultStringWithMoreThanEightCharacters);\n\t\t\tconst reversedAndCut = getFirstEightBytesReversed(bufferEntry);\n\t\t\treturn expect(reversedAndCut).to.be.eql(\n\t\t\t\tBuffer.from(defaultFirstEightCharactersReversed),\n\t\t\t);\n\t\t});\n\n\t\tit('should get the first eight bytes reversed from a string', () => {\n\t\t\tconst reversedAndCut = getFirstEightBytesReversed(\n\t\t\t\tdefaultStringWithMoreThanEightCharacters,\n\t\t\t);\n\t\t\treturn expect(reversedAndCut).to.be.eql(\n\t\t\t\tBuffer.from(defaultFirstEightCharactersReversed),\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('#toAddress', () => {\n\t\tit('should create an address from a buffer', () => {\n\t\t\tconst bufferInit = Buffer.from(defaultDataForBuffer);\n\t\t\tconst address = toAddress(bufferInit);\n\t\t\treturn expect(address).to.be.eql(defaultAddressFromBuffer);\n\t\t});\n\n\t\tit('should throw on more than 8 bytes as input', () => {\n\t\t\tconst bufferExceedError =\n\t\t\t\t'The buffer for Lisk addresses must not have more than 8 bytes';\n\t\t\tconst bufferInit = Buffer.from(defaultStringWithMoreThanEightCharacters);\n\t\t\treturn expect(toAddress.bind(null, bufferInit)).to.throw(\n\t\t\t\tbufferExceedError,\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('#getAddressFromPublicKey', () => {\n\t\tbeforeEach(() => {\n\t\t\treturn sandbox.stub(hashModule, 'hash').returns(defaultPublicKeyHash);\n\t\t});\n\n\t\tit('should generate address from publicKey', () => {\n\t\t\tconst address = getAddressFromPublicKey(defaultPublicKey);\n\t\t\treturn expect(address).to.be.equal(defaultAddress);\n\t\t});\n\t});\n\n\tdescribe('#convertPublicKeyEd2Curve', () => {\n\t\tit('should convert publicKey ED25519 to Curve25519 key', () => {\n\t\t\tconst result = convertPublicKeyEd2Curve(\n\t\t\t\tBuffer.from(defaultPublicKey, 'hex'),\n\t\t\t);\n\t\t\texpect(result).to.not.be.null;\n\t\t\tconst curveRepresentation = result as Buffer;\n\t\t\treturn expect(\n\t\t\t\tdefaultPublicKeyCurve.equals(Buffer.from(curveRepresentation)),\n\t\t\t).to.be.true;\n\t\t});\n\t});\n\n\tdescribe('#convertPrivateKeyEd2Curve', () => {\n\t\tit('should convert privateKey ED25519 to Curve25519 key', () => {\n\t\t\tconst curveRepresentation = convertPrivateKeyEd2Curve(\n\t\t\t\tBuffer.from(defaultPrivateKey, 'hex'),\n\t\t\t);\n\t\t\treturn expect(\n\t\t\t\tdefaultPrivateKeyCurve.equals(Buffer.from(curveRepresentation)),\n\t\t\t).to.be.true;\n\t\t});\n\t});\n\n\tdescribe('#stringifyEncryptedPassphrase', () => {\n\t\tit('should throw an error if encrypted passphrase is not an object', () => {\n\t\t\tconst encryptedPassphrase =\n\t\t\t\t'salt=e8c7dae4c893e458e0ebb8bff9a36d84&cipherText=c0fab123d83c386ffacef9a171b6e0e0e9d913e58b7972df8e5ef358afbc65f99c9a2b6fe7716f708166ed72f59f007d2f96a91f48f0428dd51d7c9962e0c6a5fc27ca0722038f1f2cf16333&iv=1a2206e426c714091b7e48f6&tag=3a9d9f9f9a92c9a58296b8df64820c15&version=1';\n\t\t\treturn expect(\n\t\t\t\tstringifyEncryptedPassphrase.bind(null, encryptedPassphrase),\n\t\t\t).to.throw('Encrypted passphrase to stringify must be an object.');\n\t\t});\n\n\t\tit('should format an encrypted passphrase as a string', () => {\n\t\t\tconst encryptedPassphrase = {\n\t\t\t\tsalt: 'e8c7dae4c893e458e0ebb8bff9a36d84',\n\t\t\t\tcipherText:\n\t\t\t\t\t'c0fab123d83c386ffacef9a171b6e0e0e9d913e58b7972df8e5ef358afbc65f99c9a2b6fe7716f708166ed72f59f007d2f96a91f48f0428dd51d7c9962e0c6a5fc27ca0722038f1f2cf16333',\n\t\t\t\tiv: '1a2206e426c714091b7e48f6',\n\t\t\t\ttag: '3a9d9f9f9a92c9a58296b8df64820c15',\n\t\t\t\tversion: '1',\n\t\t\t};\n\t\t\tconst stringifiedEncryptedPassphrase =\n\t\t\t\t'salt=e8c7dae4c893e458e0ebb8bff9a36d84&cipherText=c0fab123d83c386ffacef9a171b6e0e0e9d913e58b7972df8e5ef358afbc65f99c9a2b6fe7716f708166ed72f59f007d2f96a91f48f0428dd51d7c9962e0c6a5fc27ca0722038f1f2cf16333&iv=1a2206e426c714091b7e48f6&tag=3a9d9f9f9a92c9a58296b8df64820c15&version=1';\n\t\t\treturn expect(stringifyEncryptedPassphrase(encryptedPassphrase)).to.equal(\n\t\t\t\tstringifiedEncryptedPassphrase,\n\t\t\t);\n\t\t});\n\n\t\tit('should format an encrypted passphrase with custom iterations as a string', () => {\n\t\t\tconst encryptedPassphrase = {\n\t\t\t\titerations: 1,\n\t\t\t\tsalt: 'e8c7dae4c893e458e0ebb8bff9a36d84',\n\t\t\t\tcipherText:\n\t\t\t\t\t'c0fab123d83c386ffacef9a171b6e0e0e9d913e58b7972df8e5ef358afbc65f99c9a2b6fe7716f708166ed72f59f007d2f96a91f48f0428dd51d7c9962e0c6a5fc27ca0722038f1f2cf16333',\n\t\t\t\tiv: '1a2206e426c714091b7e48f6',\n\t\t\t\ttag: '3a9d9f9f9a92c9a58296b8df64820c15',\n\t\t\t\tversion: '1',\n\t\t\t};\n\t\t\tconst stringifiedEncryptedPassphrase =\n\t\t\t\t'iterations=1&salt=e8c7dae4c893e458e0ebb8bff9a36d84&cipherText=c0fab123d83c386ffacef9a171b6e0e0e9d913e58b7972df8e5ef358afbc65f99c9a2b6fe7716f708166ed72f59f007d2f96a91f48f0428dd51d7c9962e0c6a5fc27ca0722038f1f2cf16333&iv=1a2206e426c714091b7e48f6&tag=3a9d9f9f9a92c9a58296b8df64820c15&version=1';\n\t\t\treturn expect(stringifyEncryptedPassphrase(encryptedPassphrase)).to.equal(\n\t\t\t\tstringifiedEncryptedPassphrase,\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('#parseEncryptedPassphrase', () => {\n\t\tit('should throw an error if encrypted passphrase is not a string', () => {\n\t\t\tconst stringifiedEncryptedPassphrase = { abc: 'def' };\n\t\t\treturn expect(\n\t\t\t\tparseEncryptedPassphrase.bind(null, stringifiedEncryptedPassphrase),\n\t\t\t).to.throw('Encrypted passphrase to parse must be a string.');\n\t\t});\n\n\t\tit('should throw an error if iterations is present but not a valid number', () => {\n\t\t\tconst stringifiedEncryptedPassphrase =\n\t\t\t\t'iterations=null&salt=e8c7dae4c893e458e0ebb8bff9a36d84&cipherText=c0fab123d83c386ffacef9a171b6e0e0e9d913e58b7972df8e5ef358afbc65f99c9a2b6fe7716f708166ed72f59f007d2f96a91f48f0428dd51d7c9962e0c6a5fc27ca0722038f1f2cf16333&iv=1a2206e426c714091b7e48f6&tag=3a9d9f9f9a92c9a58296b8df64820c15&version=1';\n\t\t\treturn expect(\n\t\t\t\tparseEncryptedPassphrase.bind(null, stringifiedEncryptedPassphrase),\n\t\t\t).to.throw('Could not parse iterations.');\n\t\t});\n\n\t\tit('should throw an error if multiple values are in a key', () => {\n\t\t\tconst stringifiedEncryptedPassphrase =\n\t\t\t\t'salt=xxx&salt=e8c7dae4c893e458e0ebb8bff9a36d84&cipherText=c0fab123d83c386ffacef9a171b6e0e0e9d913e58b7972df8e5ef358afbc65f99c9a2b6fe7716f708166ed72f59f007d2f96a91f48f0428dd51d7c9962e0c6a5fc27ca0722038f1f2cf16333&iv=1a2206e426c714091b7e48f6&tag=3a9d9f9f9a92c9a58296b8df64820c15&version=1';\n\t\t\treturn expect(\n\t\t\t\tparseEncryptedPassphrase.bind(null, stringifiedEncryptedPassphrase),\n\t\t\t).to.throw(\n\t\t\t\t'Encrypted passphrase to parse must have only one value per key.',\n\t\t\t);\n\t\t});\n\n\t\tit('should parse an encrypted passphrase string', () => {\n\t\t\tconst stringifiedEncryptedPassphrase =\n\t\t\t\t'salt=e8c7dae4c893e458e0ebb8bff9a36d84&cipherText=c0fab123d83c386ffacef9a171b6e0e0e9d913e58b7972df8e5ef358afbc65f99c9a2b6fe7716f708166ed72f59f007d2f96a91f48f0428dd51d7c9962e0c6a5fc27ca0722038f1f2cf16333&iv=1a2206e426c714091b7e48f6&tag=3a9d9f9f9a92c9a58296b8df64820c15&version=1';\n\t\t\tconst encryptedPassphrase = {\n\t\t\t\titerations: undefined,\n\t\t\t\tsalt: 'e8c7dae4c893e458e0ebb8bff9a36d84',\n\t\t\t\tcipherText:\n\t\t\t\t\t'c0fab123d83c386ffacef9a171b6e0e0e9d913e58b7972df8e5ef358afbc65f99c9a2b6fe7716f708166ed72f59f007d2f96a91f48f0428dd51d7c9962e0c6a5fc27ca0722038f1f2cf16333',\n\t\t\t\tiv: '1a2206e426c714091b7e48f6',\n\t\t\t\ttag: '3a9d9f9f9a92c9a58296b8df64820c15',\n\t\t\t\tversion: '1',\n\t\t\t};\n\t\t\treturn expect(\n\t\t\t\tparseEncryptedPassphrase(stringifiedEncryptedPassphrase),\n\t\t\t).to.eql(encryptedPassphrase);\n\t\t});\n\n\t\tit('should parse an encrypted passphrase string with custom iterations', () => {\n\t\t\tconst stringifiedEncryptedPassphrase =\n\t\t\t\t'iterations=1&salt=e8c7dae4c893e458e0ebb8bff9a36d84&cipherText=c0fab123d83c386ffacef9a171b6e0e0e9d913e58b7972df8e5ef358afbc65f99c9a2b6fe7716f708166ed72f59f007d2f96a91f48f0428dd51d7c9962e0c6a5fc27ca0722038f1f2cf16333&iv=1a2206e426c714091b7e48f6&tag=3a9d9f9f9a92c9a58296b8df64820c15&version=1';\n\t\t\tconst encryptedPassphrase = {\n\t\t\t\titerations: 1,\n\t\t\t\tsalt: 'e8c7dae4c893e458e0ebb8bff9a36d84',\n\t\t\t\tcipherText:\n\t\t\t\t\t'c0fab123d83c386ffacef9a171b6e0e0e9d913e58b7972df8e5ef358afbc65f99c9a2b6fe7716f708166ed72f59f007d2f96a91f48f0428dd51d7c9962e0c6a5fc27ca0722038f1f2cf16333',\n\t\t\t\tiv: '1a2206e426c714091b7e48f6',\n\t\t\t\ttag: '3a9d9f9f9a92c9a58296b8df64820c15',\n\t\t\t\tversion: '1',\n\t\t\t};\n\t\t\treturn expect(\n\t\t\t\tparseEncryptedPassphrase(stringifiedEncryptedPassphrase),\n\t\t\t).to.eql(encryptedPassphrase);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/test/encrypt.ts",
    "content": "/** Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport * as sinon from 'sinon';\nimport {\n\tEncryptedPassphraseObject,\n\tEncryptedMessageWithNonce,\n\tencryptMessageWithPassphrase,\n\tdecryptMessageWithPassphrase,\n\tencryptPassphraseWithPassword,\n\tdecryptPassphraseWithPassword,\n} from '../src/encrypt';\n// Require is used for stubbing\nconst convert = require('../src/convert');\nconst keys = require('../src/keys');\nconst hashModule = require('../src/hash');\n\ndescribe('encrypt', () => {\n\tconst PBKDF2_ITERATIONS = 1e6;\n\tconst ENCRYPTION_VERSION = '1';\n\tconst defaultPassphrase =\n\t\t'minute omit local rare sword knee banner pair rib museum shadow juice';\n\tconst defaultPrivateKey =\n\t\t'314852d7afb0d4c283692fef8a2cb40e30c7a5df2ed79994178c10ac168d6d977ef45cd525e95b7a86244bbd4eb4550914ad06301013958f4dd64d32ef7bc588';\n\tconst defaultPublicKey =\n\t\t'7ef45cd525e95b7a86244bbd4eb4550914ad06301013958f4dd64d32ef7bc588';\n\tconst defaultSecondPassphrase = 'second secret';\n\tconst defaultSecondPrivateKey =\n\t\t'9ef4146f8166d32dc8051d3d9f3a0c4933e24aa8ccb439b5d9ad00078a89e2fc0401c8ac9f29ded9e1e4d5b6b43051cb25b22f27c7b7b35092161e851946f82f';\n\tconst defaultSecondPublicKey =\n\t\t'0401c8ac9f29ded9e1e4d5b6b43051cb25b22f27c7b7b35092161e851946f82f';\n\tconst defaultMessage = 'Some default text.';\n\tconst defaultPassword = 'myTotal53cr3t%&';\n\tconst customIterations = 12;\n\n\tlet defaultEncryptedMessageWithNonce: EncryptedMessageWithNonce;\n\n\tlet getPrivateAndPublicKeyBytesFromPassphraseStub;\n\tlet hashStub: sinon.SinonStub;\n\n\tbeforeEach(() => {\n\t\tdefaultEncryptedMessageWithNonce = {\n\t\t\tencryptedMessage:\n\t\t\t\t'299390b9cbb92fe6a43daece2ceaecbacd01c7c03cfdba51d693b5c0e2b65c634115',\n\t\t\tnonce: 'df4c8b09e270d2cb3f7b3d53dfa8a6f3441ad3b14a13fb66',\n\t\t};\n\t\tsandbox\n\t\t\t.stub(convert, 'convertPrivateKeyEd2Curve')\n\t\t\t.returns(\n\t\t\t\tBuffer.from(\n\t\t\t\t\t'd8be8cacb03fb02f34e85030f902b635f364d6c23f090c7640e9dc9c568e7d5e',\n\t\t\t\t\t'hex',\n\t\t\t\t),\n\t\t\t);\n\t\tsandbox\n\t\t\t.stub(convert, 'convertPublicKeyEd2Curve')\n\t\t\t.returns(\n\t\t\t\tBuffer.from(\n\t\t\t\t\t'f245e78c83196d73452e55581ef924a1b792d352c142257aa3af13cded2e7905',\n\t\t\t\t\t'hex',\n\t\t\t\t),\n\t\t\t);\n\n\t\tgetPrivateAndPublicKeyBytesFromPassphraseStub = sandbox.stub(\n\t\t\tkeys,\n\t\t\t'getPrivateAndPublicKeyBytesFromPassphrase',\n\t\t);\n\t\tgetPrivateAndPublicKeyBytesFromPassphraseStub\n\t\t\t.withArgs(defaultPassphrase)\n\t\t\t.returns({\n\t\t\t\tprivateKey: Buffer.from(defaultPrivateKey, 'hex'),\n\t\t\t\tpublicKey: Buffer.from(defaultPublicKey, 'hex'),\n\t\t\t});\n\t\tgetPrivateAndPublicKeyBytesFromPassphraseStub\n\t\t\t.withArgs(defaultSecondPassphrase)\n\t\t\t.returns({\n\t\t\t\tprivateKey: Buffer.from(defaultSecondPrivateKey, 'hex'),\n\t\t\t\tpublicKey: Buffer.from(defaultSecondPublicKey, 'hex'),\n\t\t\t});\n\n\t\thashStub = sandbox\n\t\t\t.stub(hashModule, 'hash')\n\t\t\t.returns(\n\t\t\t\tBuffer.from(\n\t\t\t\t\t'd43eed9049dd8f35106c720669a1148b2c6288d9ea517b936c33a1d84117a760',\n\t\t\t\t\t'hex',\n\t\t\t\t),\n\t\t\t);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('#encryptMessageWithPassphrase', () => {\n\t\tlet encryptedMessage: EncryptedMessageWithNonce;\n\n\t\tbeforeEach(() => {\n\t\t\tencryptedMessage = encryptMessageWithPassphrase(\n\t\t\t\tdefaultMessage,\n\t\t\t\tdefaultPassphrase,\n\t\t\t\tdefaultPublicKey,\n\t\t\t);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should encrypt a message', () => {\n\t\t\treturn expect(encryptedMessage)\n\t\t\t\t.to.have.property('encryptedMessage')\n\t\t\t\t.be.hexString.with.length(68);\n\t\t});\n\n\t\tit('should output the nonce', () => {\n\t\t\treturn expect(encryptedMessage)\n\t\t\t\t.to.have.property('nonce')\n\t\t\t\t.be.hexString.with.length(48);\n\t\t});\n\t});\n\n\tdescribe('#decryptMessageWithPassphrase', () => {\n\t\tit('should be able to decrypt the message correctly using the receiver’s secret passphrase', () => {\n\t\t\tconst decryptedMessage = decryptMessageWithPassphrase(\n\t\t\t\tdefaultEncryptedMessageWithNonce.encryptedMessage,\n\t\t\t\tdefaultEncryptedMessageWithNonce.nonce,\n\t\t\t\tdefaultPassphrase,\n\t\t\t\tdefaultPublicKey,\n\t\t\t);\n\n\t\t\treturn expect(decryptedMessage).to.be.equal(defaultMessage);\n\t\t});\n\n\t\tit('should inform the user if the nonce is the wrong length', () => {\n\t\t\treturn expect(\n\t\t\t\tdecryptMessageWithPassphrase.bind(\n\t\t\t\t\tnull,\n\t\t\t\t\tdefaultEncryptedMessageWithNonce.encryptedMessage,\n\t\t\t\t\tdefaultEncryptedMessageWithNonce.encryptedMessage.slice(0, 2),\n\t\t\t\t\tdefaultPassphrase,\n\t\t\t\t\tdefaultPublicKey,\n\t\t\t\t),\n\t\t\t).to.throw('Expected nonce to be 24 bytes.');\n\t\t});\n\n\t\tit('should inform the user if something goes wrong during decryption', () => {\n\t\t\treturn expect(\n\t\t\t\tdecryptMessageWithPassphrase.bind(\n\t\t\t\t\tnull,\n\t\t\t\t\tdefaultEncryptedMessageWithNonce.encryptedMessage.slice(0, 2),\n\t\t\t\t\tdefaultEncryptedMessageWithNonce.nonce,\n\t\t\t\t\tdefaultSecondPassphrase,\n\t\t\t\t\tdefaultPublicKey,\n\t\t\t\t),\n\t\t\t).to.throw(\n\t\t\t\t'Something went wrong during decryption. Is this the full encrypted message?',\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('encrypt and decrypt passphrase with password', () => {\n\t\tbeforeEach(() => {\n\t\t\treturn hashStub.returns(\n\t\t\t\tBuffer.from(\n\t\t\t\t\t'e09dfc943d65d63f4f31e444c81afc6d5cf442c988fb87180165dd7119d3ae61',\n\t\t\t\t\t'hex',\n\t\t\t\t),\n\t\t\t);\n\t\t});\n\n\t\tdescribe('#encryptPassphraseWithPassword', () => {\n\t\t\tlet startTime: number;\n\t\t\tlet encryptedPassphrase: EncryptedPassphraseObject;\n\n\t\t\tbeforeEach(() => {\n\t\t\t\tstartTime = Date.now();\n\t\t\t\tencryptedPassphrase = encryptPassphraseWithPassword(\n\t\t\t\t\tdefaultPassphrase,\n\t\t\t\t\tdefaultPassword,\n\t\t\t\t);\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should encrypt a passphrase', () => {\n\t\t\t\treturn expect(encryptedPassphrase).to.have.property('cipherText').and.be\n\t\t\t\t\t.hexString;\n\t\t\t});\n\n\t\t\tit('should output the IV', () => {\n\t\t\t\treturn expect(encryptedPassphrase)\n\t\t\t\t\t.to.have.property('iv')\n\t\t\t\t\t.and.be.hexString.and.have.length(24);\n\t\t\t});\n\n\t\t\tit('should output the salt', () => {\n\t\t\t\treturn expect(encryptedPassphrase)\n\t\t\t\t\t.to.have.property('salt')\n\t\t\t\t\t.and.be.hexString.and.have.length(32);\n\t\t\t});\n\n\t\t\tit('should output the tag', () => {\n\t\t\t\treturn expect(encryptedPassphrase)\n\t\t\t\t\t.to.have.property('tag')\n\t\t\t\t\t.and.be.hexString.and.have.length(32);\n\t\t\t});\n\n\t\t\tit('should output the current version of Lisk Elements', () => {\n\t\t\t\treturn expect(encryptedPassphrase)\n\t\t\t\t\t.to.have.property('version')\n\t\t\t\t\t.which.is.equal(ENCRYPTION_VERSION);\n\t\t\t});\n\n\t\t\tit('should output the default number of iterations', () => {\n\t\t\t\treturn expect(encryptedPassphrase)\n\t\t\t\t\t.to.have.property('iterations')\n\t\t\t\t\t.equal(PBKDF2_ITERATIONS);\n\t\t\t});\n\n\t\t\tit('should take more than 0.5 seconds @node-only', () => {\n\t\t\t\tconst endTime = Date.now();\n\t\t\t\treturn expect(endTime - startTime).to.be.above(500);\n\t\t\t});\n\n\t\t\tit('should take less than 2 seconds @node-only', () => {\n\t\t\t\tconst endTime = Date.now();\n\t\t\t\treturn expect(endTime - startTime).to.be.below(2e3);\n\t\t\t});\n\n\t\t\tit('should accept and output a custom number of iterations', () => {\n\t\t\t\tconst encryptedPassphraseWithIterations = encryptPassphraseWithPassword(\n\t\t\t\t\tdefaultPassphrase,\n\t\t\t\t\tdefaultPassword,\n\t\t\t\t\tcustomIterations,\n\t\t\t\t);\n\t\t\t\treturn expect(encryptedPassphraseWithIterations)\n\t\t\t\t\t.to.have.property('iterations')\n\t\t\t\t\t.and.equal(customIterations);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#decryptPassphraseWithPassword', () => {\n\t\t\tlet encryptedPassphrase = {\n\t\t\t\titerations: undefined,\n\t\t\t\tcipherText:\n\t\t\t\t\t'5cfd7bcc13022a482e7c8bd250cd73ef3eb7c49c849d5e761ce717608293f777cca8e0e18587ee307beab65bcc1b273caeb23d4985010b675391b354c38f8e84e342c1e7aa',\n\t\t\t\tiv: '7b820ad6936a63152d13ffa2',\n\t\t\t\tsalt: 'b60036ab30da7af68c6ecf370471ce1b',\n\t\t\t\ttag: '336c68fa92d414c229e5638249847774',\n\t\t\t\tversion: '1',\n\t\t\t};\n\n\t\t\tit('should decrypt a passphrase with a password', () => {\n\t\t\t\tconst decrypted = decryptPassphraseWithPassword(\n\t\t\t\t\tencryptedPassphrase,\n\t\t\t\t\tdefaultPassword,\n\t\t\t\t);\n\t\t\t\treturn expect(decrypted).to.be.equal(defaultPassphrase);\n\t\t\t});\n\n\t\t\tit('should inform the user if cipherText is missing', () => {\n\t\t\t\tconst {\n\t\t\t\t\tcipherText,\n\t\t\t\t\t...encryptedPassphraseWithoutCipherText\n\t\t\t\t} = encryptedPassphrase;\n\t\t\t\treturn expect(\n\t\t\t\t\tdecryptPassphraseWithPassword.bind(\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tencryptedPassphraseWithoutCipherText,\n\t\t\t\t\t\tdefaultPassword,\n\t\t\t\t\t),\n\t\t\t\t).to.throw('Cipher text must be a string.');\n\t\t\t});\n\n\t\t\tit('should inform the user if iv is missing', () => {\n\t\t\t\tconst { iv, ...encryptedPassphraseWithoutIv } = encryptedPassphrase;\n\t\t\t\treturn expect(\n\t\t\t\t\tdecryptPassphraseWithPassword.bind(\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tencryptedPassphraseWithoutIv,\n\t\t\t\t\t\tdefaultPassword,\n\t\t\t\t\t),\n\t\t\t\t).to.throw('IV must be a string.');\n\t\t\t});\n\n\t\t\tit('should inform the user if salt is missing', () => {\n\t\t\t\tconst { salt, ...encryptedPassphraseWithoutSalt } = encryptedPassphrase;\n\t\t\t\treturn expect(\n\t\t\t\t\tdecryptPassphraseWithPassword.bind(\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tencryptedPassphraseWithoutSalt,\n\t\t\t\t\t\tdefaultPassword,\n\t\t\t\t\t),\n\t\t\t\t).to.throw('Salt must be a string.');\n\t\t\t});\n\n\t\t\tit('should inform the user if tag is missing', () => {\n\t\t\t\tconst { tag, ...encryptedPassphraseWithoutTag } = encryptedPassphrase;\n\t\t\t\treturn expect(\n\t\t\t\t\tdecryptPassphraseWithPassword.bind(\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tencryptedPassphraseWithoutTag,\n\t\t\t\t\t\tdefaultPassword,\n\t\t\t\t\t),\n\t\t\t\t).to.throw('Tag must be a string.');\n\t\t\t});\n\n\t\t\tit('should inform the user if the salt has been altered', () => {\n\t\t\t\tconst { salt, ...encryptedPassphraseWithoutSalt } = encryptedPassphrase;\n\t\t\t\tconst encryptedPassphraseWithAlteredSalt = {\n\t\t\t\t\tsalt: `00${encryptedPassphrase.salt.slice(2)}`,\n\t\t\t\t\t...encryptedPassphraseWithoutSalt,\n\t\t\t\t};\n\t\t\t\treturn expect(\n\t\t\t\t\tdecryptPassphraseWithPassword.bind(\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tencryptedPassphraseWithAlteredSalt,\n\t\t\t\t\t\tdefaultPassword,\n\t\t\t\t\t),\n\t\t\t\t).to.throw('Unsupported state or unable to authenticate data');\n\t\t\t});\n\n\t\t\tit('should inform the user if the tag has been shortened', () => {\n\t\t\t\tconst { tag, ...encryptedPassphraseWithoutTag } = encryptedPassphrase;\n\t\t\t\tconst encryptedPassphraseWithAlteredTag = {\n\t\t\t\t\ttag: encryptedPassphrase.tag.slice(0, 30),\n\t\t\t\t\t...encryptedPassphraseWithoutTag,\n\t\t\t\t};\n\t\t\t\treturn expect(\n\t\t\t\t\tdecryptPassphraseWithPassword.bind(\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tencryptedPassphraseWithAlteredTag,\n\t\t\t\t\t\tdefaultPassword,\n\t\t\t\t\t),\n\t\t\t\t).to.throw('Tag must be 16 bytes.');\n\t\t\t});\n\n\t\t\tit('should inform the user if the tag is not a hex string', () => {\n\t\t\t\tconst { tag, ...encryptedPassphraseWithoutTag } = encryptedPassphrase;\n\t\t\t\tconst encryptedPassphraseWithAlteredTag = {\n\t\t\t\t\ttag: `${encryptedPassphrase.tag.slice(0, 30)}gg`,\n\t\t\t\t\t...encryptedPassphraseWithoutTag,\n\t\t\t\t};\n\t\t\t\treturn expect(\n\t\t\t\t\tdecryptPassphraseWithPassword.bind(\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tencryptedPassphraseWithAlteredTag,\n\t\t\t\t\t\tdefaultPassword,\n\t\t\t\t\t),\n\t\t\t\t).to.throw('Tag must be a valid hex string.');\n\t\t\t});\n\n\t\t\tit('should inform the user if the tag has been altered', () => {\n\t\t\t\tconst { tag, ...encryptedPassphraseWithoutTag } = encryptedPassphrase;\n\t\t\t\tconst encryptedPassphraseWithAlteredTag = {\n\t\t\t\t\ttag: `00${encryptedPassphrase.tag.slice(2)}`,\n\t\t\t\t\t...encryptedPassphraseWithoutTag,\n\t\t\t\t};\n\t\t\t\treturn expect(\n\t\t\t\t\tdecryptPassphraseWithPassword.bind(\n\t\t\t\t\t\tnull,\n\t\t\t\t\t\tencryptedPassphraseWithAlteredTag,\n\t\t\t\t\t\tdefaultPassword,\n\t\t\t\t\t),\n\t\t\t\t).to.throw('Unsupported state or unable to authenticate data');\n\t\t\t});\n\n\t\t\tit('should decrypt a passphrase with a password and a custom number of iterations', () => {\n\t\t\t\tconst encryptedPassphraseWithCustomIterations = {\n\t\t\t\t\titerations: 12,\n\t\t\t\t\tcipherText:\n\t\t\t\t\t\t'1f06671e13c0329aee057fee995e08a516bdacd287c7ff2714a74be6099713c87bbc3e005c63d4d3d02f8ba89b42810a5854444ad2b76855007a0925fafa7d870875beb010',\n\t\t\t\t\tiv: '3a583b21bbac609c7df3e7e0',\n\t\t\t\t\tsalt: '245c6859a96339a7735a6cac78ccf625',\n\t\t\t\t\ttag: '63653f1d4e8d422a42d98b25d3844792',\n\t\t\t\t\tversion: '1',\n\t\t\t\t};\n\t\t\t\tconst decrypted = decryptPassphraseWithPassword(\n\t\t\t\t\tencryptedPassphraseWithCustomIterations,\n\t\t\t\t\tdefaultPassword,\n\t\t\t\t);\n\t\t\t\treturn expect(decrypted).to.be.equal(defaultPassphrase);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('integration test', () => {\n\t\t\tit('should encrypt a given passphrase with a password and decrypt it back to the original passphrase @node-only', () => {\n\t\t\t\tconst encryptedPassphrase = encryptPassphraseWithPassword(\n\t\t\t\t\tdefaultPassphrase,\n\t\t\t\t\tdefaultPassword,\n\t\t\t\t);\n\t\t\t\tconst decryptedString = decryptPassphraseWithPassword(\n\t\t\t\t\tencryptedPassphrase,\n\t\t\t\t\tdefaultPassword,\n\t\t\t\t);\n\t\t\t\treturn expect(decryptedString).to.be.equal(defaultPassphrase);\n\t\t\t}).timeout(5000);\n\n\t\t\tit('should encrypt a given passphrase with a password and custom number of iterations and decrypt it back to the original passphrase @node-only', () => {\n\t\t\t\tconst encryptedPassphrase = encryptPassphraseWithPassword(\n\t\t\t\t\tdefaultPassphrase,\n\t\t\t\t\tdefaultPassword,\n\t\t\t\t\tcustomIterations,\n\t\t\t\t);\n\t\t\t\tconst decryptedString = decryptPassphraseWithPassword(\n\t\t\t\t\tencryptedPassphrase,\n\t\t\t\t\tdefaultPassword,\n\t\t\t\t);\n\t\t\t\treturn expect(decryptedString).to.equal(defaultPassphrase);\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/test/hash.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { hash as hashFunction } from '../src/hash';\nimport { expect } from 'chai';\n\ndescribe('hash', () => {\n\tconst defaultText = 'text123*';\n\tlet arrayToHash: ReadonlyArray<number>;\n\tlet defaultHash: Buffer;\n\n\tbeforeEach(() => {\n\t\tdefaultHash = Buffer.from(\n\t\t\t'7607d6792843d6003c12495b54e34517a508d2a8622526aff1884422c5478971',\n\t\t\t'hex',\n\t\t);\n\t\tarrayToHash = [1, 2, 3];\n\t\treturn Promise.resolve();\n\t});\n\n\tit('should generate a sha256 hash from a Buffer', () => {\n\t\tconst testBuffer = Buffer.from(defaultText);\n\t\tconst hash = hashFunction(testBuffer);\n\t\treturn expect(hash).to.be.eql(defaultHash);\n\t});\n\n\tit('should generate a sha256 hash from a utf8 string', () => {\n\t\tconst hash = hashFunction(defaultText, 'utf8');\n\t\treturn expect(hash).to.be.eql(defaultHash);\n\t});\n\n\tit('should generate a sha256 hash from a hex string', () => {\n\t\tconst testHex = Buffer.from(defaultText).toString('hex');\n\t\tconst hash = hashFunction(testHex, 'hex');\n\t\treturn expect(hash).to.be.eql(defaultHash);\n\t});\n\n\tit('should throw on unknown format when trying a string with format \"utf32\"', () => {\n\t\treturn expect(hashFunction.bind(null, defaultText, 'utf32')).to.throw(\n\t\t\t'Unsupported string format. Currently only `hex` and `utf8` are supported.',\n\t\t);\n\t});\n\n\tit('should throw on unknown format when using an array', () => {\n\t\treturn expect(hashFunction.bind(null, arrayToHash)).to.throw(\n\t\t\t'Unsupported data format. Currently only Buffers or `hex` and `utf8` strings are supported.',\n\t\t);\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/test/helpers/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nexport const makeInvalid = (str: string): string => {\n\tconst char = str[0] === '0' ? '1' : '0';\n\treturn `${char}${str.slice(1)}`;\n};\n"
  },
  {
    "path": "packages/lisk-cryptography/test/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '../src';\nimport { expect } from 'chai';\n\ndescribe('cryptography index.js', () => {\n\tit('should export an object', () => {\n\t\treturn expect(cryptography).to.be.an('object');\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/test/keys.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport {\n\tKeypair,\n\tKeypairBytes,\n\tgetPrivateAndPublicKeyFromPassphrase,\n\tgetPrivateAndPublicKeyBytesFromPassphrase,\n\tgetKeys,\n\tgetAddressAndPublicKeyFromPassphrase,\n\tgetAddressFromPassphrase,\n} from '../src/keys';\n// Require is used for stubbing\nconst buffer = require('../src/buffer');\nconst hashModule = require('../src/hash');\n\ndescribe('keys', () => {\n\tconst defaultPassphrase = 'secret';\n\tconst defaultPassphraseHash =\n\t\t'2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b';\n\tconst defaultPrivateKey =\n\t\t'2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst defaultPublicKey =\n\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst defaultAddress = '16402986683325069355L';\n\tconst defaultAddressAndPublicKey = {\n\t\tpublicKey: defaultPublicKey,\n\t\taddress: defaultAddress,\n\t};\n\n\tlet bufferToHexStub;\n\n\tbeforeEach(() => {\n\t\tbufferToHexStub = sandbox.stub(buffer, 'bufferToHex');\n\t\tbufferToHexStub\n\t\t\t.withArgs(Buffer.from(defaultPrivateKey, 'hex'))\n\t\t\t.returns(defaultPrivateKey);\n\t\tbufferToHexStub\n\t\t\t.withArgs(Buffer.from(defaultPublicKey, 'hex'))\n\t\t\t.returns(defaultPublicKey);\n\t\treturn sandbox\n\t\t\t.stub(hashModule, 'hash')\n\t\t\t.returns(Buffer.from(defaultPassphraseHash, 'hex'));\n\t});\n\n\tdescribe('#getPrivateAndPublicKeyBytesFromPassphrase', () => {\n\t\tlet keyPair: KeypairBytes;\n\n\t\tbeforeEach(() => {\n\t\t\tkeyPair = getPrivateAndPublicKeyBytesFromPassphrase(defaultPassphrase);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should create buffer publicKey', () => {\n\t\t\treturn expect(\n\t\t\t\tBuffer.from(keyPair.publicKeyBytes).toString('hex'),\n\t\t\t).to.be.equal(defaultPublicKey);\n\t\t});\n\n\t\tit('should create buffer privateKey', () => {\n\t\t\treturn expect(\n\t\t\t\tBuffer.from(keyPair.privateKeyBytes).toString('hex'),\n\t\t\t).to.be.equal(defaultPrivateKey);\n\t\t});\n\t});\n\n\tdescribe('#getPrivateAndPublicKeyFromPassphrase', () => {\n\t\tlet keyPair: Keypair;\n\n\t\tbeforeEach(() => {\n\t\t\tkeyPair = getPrivateAndPublicKeyFromPassphrase(defaultPassphrase);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should generate the correct publicKey from a passphrase', () => {\n\t\t\treturn expect(keyPair)\n\t\t\t\t.to.have.property('publicKey')\n\t\t\t\t.and.be.equal(defaultPublicKey);\n\t\t});\n\n\t\tit('should generate the correct privateKey from a passphrase', () => {\n\t\t\treturn expect(keyPair)\n\t\t\t\t.to.have.property('privateKey')\n\t\t\t\t.and.be.equal(defaultPrivateKey);\n\t\t});\n\t});\n\n\tdescribe('#getKeys', () => {\n\t\tlet keyPair: Keypair;\n\n\t\tbeforeEach(() => {\n\t\t\tkeyPair = getKeys(defaultPassphrase);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should generate the correct publicKey from a passphrase', () => {\n\t\t\treturn expect(keyPair)\n\t\t\t\t.to.have.property('publicKey')\n\t\t\t\t.and.be.equal(defaultPublicKey);\n\t\t});\n\n\t\tit('should generate the correct privateKey from a passphrase', () => {\n\t\t\treturn expect(keyPair)\n\t\t\t\t.to.have.property('privateKey')\n\t\t\t\t.and.be.equal(defaultPrivateKey);\n\t\t});\n\t});\n\n\tdescribe('#getAddressAndPublicKeyFromPassphrase', () => {\n\t\tit('should create correct address and publicKey', () => {\n\t\t\treturn expect(\n\t\t\t\tgetAddressAndPublicKeyFromPassphrase(defaultPassphrase),\n\t\t\t).to.eql(defaultAddressAndPublicKey);\n\t\t});\n\t});\n\n\tdescribe('#getAddressFromPassphrase', () => {\n\t\tit('should create correct address', () => {\n\t\t\treturn expect(getAddressFromPassphrase(defaultPassphrase)).to.equal(\n\t\t\t\tdefaultAddress,\n\t\t\t);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/test/mocha.opts",
    "content": "--recursive\n--require ts-node/register\n--require tsconfig-paths/register\n--require source-map-support/register\n--require ./test/_setup.ts\n--file ./test/_global_hooks.ts\n--watch-extensions ts\n"
  },
  {
    "path": "packages/lisk-cryptography/test/nacl/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { NaclInterface } from '../../src/nacl/nacl_types';\nimport * as fast from '../../src/nacl/fast';\nimport * as slow from '../../src/nacl/slow';\n// Require is used for stubbing\nconst moduleLibrary = require('module');\n\nconst resetTest = () => {\n\t// Reset environment variable\n\tdelete process.env.NACL_FAST;\n\t// Delete require cache to force it to re-load module\n\tdelete require.cache[require.resolve('../../src/nacl')];\n};\n\ninterface naclLibrary extends NaclInterface {\n\tNACL_SIGN_PUBLICKEY_LENGTH: number;\n\tNACL_SIGN_SIGNATURE_LENGTH: number;\n}\n\nconst stripConstants = (library: naclLibrary) => {\n\t// Constants are added in ../../src/nacl/index.js\n\tconst {\n\t\tNACL_SIGN_PUBLICKEY_LENGTH,\n\t\tNACL_SIGN_SIGNATURE_LENGTH,\n\t\t...strippedLib\n\t} = library;\n\treturn strippedLib;\n};\n\ndescribe('nacl index.js', () => {\n\tlet initialEnvVar: string | undefined;\n\tbefore(() => {\n\t\tinitialEnvVar = process.env.NACL_FAST;\n\t\treturn Promise.resolve();\n\t});\n\n\tafter(() => {\n\t\tif (initialEnvVar) {\n\t\t\tprocess.env.NACL_FAST = initialEnvVar;\n\t\t} else {\n\t\t\tdelete process.env.NACL_FAST;\n\t\t}\n\t\treturn Promise.resolve();\n\t});\n\n\tbeforeEach(() => {\n\t\tresetTest();\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('nacl fast installed', () => {\n\t\tbeforeEach(() => {\n\t\t\tresetTest();\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should load nacl fast if process.env.NACL_FAST is set to enable', () => {\n\t\t\tprocess.env.NACL_FAST = 'enable';\n\t\t\tconst loadedLibrary = require('../../src/nacl');\n\t\t\tconst strippedLibrary = stripConstants(loadedLibrary);\n\t\t\treturn expect(strippedLibrary).to.be.eql(fast);\n\t\t});\n\n\t\tit('should load nacl slow if process.env.NACL_FAST is set to disable', () => {\n\t\t\tprocess.env.NACL_FAST = 'disable';\n\t\t\tconst loadedLibrary = require('../../src/nacl');\n\t\t\tconst strippedLibrary = stripConstants(loadedLibrary);\n\t\t\treturn expect(strippedLibrary).to.be.eql(slow);\n\t\t});\n\n\t\tit('should load nacl fast if process.env.NACL_FAST is undefined', () => {\n\t\t\tprocess.env.NACL_FAST = undefined;\n\t\t\tconst loadedLibrary = require('../../src/nacl');\n\t\t\tconst strippedLibrary = stripConstants(loadedLibrary);\n\t\t\treturn expect(strippedLibrary).to.be.eql(fast);\n\t\t});\n\t});\n\n\tdescribe('nacl fast not installed', () => {\n\t\tconst moduleNotFoundError = new Error('MODULE_NOT_FOUND');\n\t\tbeforeEach(() => {\n\t\t\tresetTest();\n\n\t\t\t// \"require\" is a wrapper around Module._load which handles the actual loading\n\t\t\tsandbox\n\t\t\t\t.stub(moduleLibrary, '_load')\n\t\t\t\t.callThrough()\n\t\t\t\t.withArgs('./fast')\n\t\t\t\t.throws(moduleNotFoundError);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should set process.env.NACL_FAST to disable', () => {\n\t\t\trequire('../../src/nacl');\n\t\t\treturn expect(process.env.NACL_FAST).to.eql('disable');\n\t\t});\n\n\t\tit('should load nacl slow if process.env.NACL_FAST is set to enable', () => {\n\t\t\tprocess.env.NACL_FAST = 'enable';\n\t\t\tconst loadedLibrary = require('../../src/nacl');\n\t\t\tconst strippedLibrary = stripConstants(loadedLibrary);\n\t\t\treturn expect(strippedLibrary).to.eql(slow);\n\t\t});\n\n\t\tit('should load nacl slow if process.env.NACL_FAST is set to disable', () => {\n\t\t\tprocess.env.NACL_FAST = 'disable';\n\t\t\tconst loadedLibrary = require('../../src/nacl');\n\t\t\tconst strippedLibrary = stripConstants(loadedLibrary);\n\t\t\treturn expect(strippedLibrary).to.eql(slow);\n\t\t});\n\n\t\tit('should load nacl slow if process.env.NACL_FAST is undefined', () => {\n\t\t\tprocess.env.NACL_FAST = undefined;\n\t\t\tconst loadedLibrary = require('../../src/nacl');\n\t\t\tconst strippedLibrary = stripConstants(loadedLibrary);\n\t\t\treturn expect(strippedLibrary).to.eql(slow);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/test/nacl/nacl.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { KeypairBytes } from '../../src/keys';\nimport { makeInvalid } from '../helpers';\nimport { NaclInterface } from '../../src/nacl/nacl_types';\nimport * as fast from '../../src/nacl/fast';\nimport * as slow from '../../src/nacl/slow';\n\ndescribe('nacl', () => {\n\tconst defaultPublicKey =\n\t\t'7ef45cd525e95b7a86244bbd4eb4550914ad06301013958f4dd64d32ef7bc588';\n\tconst defaultPrivateKey =\n\t\t'314852d7afb0d4c283692fef8a2cb40e30c7a5df2ed79994178c10ac168d6d977ef45cd525e95b7a86244bbd4eb4550914ad06301013958f4dd64d32ef7bc588';\n\tconst defaultMessage = 'Some default text.';\n\tconst defaultSignature =\n\t\t'68937004b6720d7e1902ef05a577e6d9f9ab2756286b1f2ae918f8a0e5153c15e4f410916076f750b708f8979be2430e4cfc7ebb523ae1905d2ea1f5d24ce700';\n\tconst defaultEncryptedMessage =\n\t\t'a232e5ea10e18249efc5a0aa8ed68271fc494d02245c52277ee2e14cddd960144a65';\n\tconst defaultNonce = 'df4c8b09e270d2cb3f7b3d53dfa8a6f3441ad3b14a13fb66';\n\tconst defaultHash =\n\t\t'314852d7afb0d4c283692fef8a2cb40e30c7a5df2ed79994178c10ac168d6d97';\n\tconst defaultDigest =\n\t\t'aba8462bb7a1460f1e36c36a71f0b7f67d1606562001907c1b2dad08a8ce74ae';\n\tconst defaultConvertedPublicKeyEd2Curve =\n\t\t'b8c0eecfd16c1cc4f057a6fc6d8dd3d46e4aa9625408d4bd0ba00e991326fe00';\n\tconst defaultConvertedPrivateKeyEd2Curve =\n\t\t'b0e3276b64b086b381e11928e56f966d062dc677b7801cc594aeb2d4193e8d57';\n\n\tconst libraries = [\n\t\t{\n\t\t\tname: 'fast',\n\t\t\tlibrary: fast,\n\t\t},\n\t\t{\n\t\t\tname: 'slow',\n\t\t\tlibrary: slow,\n\t\t},\n\t];\n\n\tinterface library {\n\t\tname: string;\n\t\tlibrary: NaclInterface;\n\t}\n\n\tlibraries.forEach((nacl: library) => {\n\t\tdescribe(`${nacl.name}`, () => {\n\t\t\tconst {\n\t\t\t\tbox,\n\t\t\t\tgetRandomBytes,\n\t\t\t\tgetKeyPair,\n\t\t\t\topenBox,\n\t\t\t\tsignDetached,\n\t\t\t\tverifyDetached,\n\t\t\t}: NaclInterface = nacl.library;\n\n\t\t\tdescribe('#getRandomBytes', () => {\n\t\t\t\tconst size = 24;\n\t\t\t\tlet randomBuffer: Buffer;\n\n\t\t\t\tbeforeEach(() => {\n\t\t\t\t\trandomBuffer = getRandomBytes(size);\n\t\t\t\t\treturn Promise.resolve();\n\t\t\t\t});\n\n\t\t\t\tit('should return an uint8array', () => {\n\t\t\t\t\treturn expect(randomBuffer).to.be.instanceOf(Uint8Array);\n\t\t\t\t});\n\n\t\t\t\tit('should return an uint8array of size 24', () => {\n\t\t\t\t\treturn expect(randomBuffer.length).to.be.eql(24);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('#getKeyPair', () => {\n\t\t\t\tlet signedKeys: KeypairBytes;\n\n\t\t\t\tbeforeEach(() => {\n\t\t\t\t\tsignedKeys = getKeyPair(Buffer.from(defaultHash, 'hex'));\n\t\t\t\t\treturn Promise.resolve();\n\t\t\t\t});\n\n\t\t\t\tit('should create a publicKey', () => {\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tBuffer.from(signedKeys.publicKeyBytes).toString('hex'),\n\t\t\t\t\t).to.be.eql(defaultPublicKey);\n\t\t\t\t});\n\n\t\t\t\tit('should create a publicKey of type uint8array', () => {\n\t\t\t\t\treturn expect(signedKeys.publicKeyBytes).to.be.instanceOf(Uint8Array);\n\t\t\t\t});\n\n\t\t\t\tit('should create a privateKey', () => {\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tBuffer.from(signedKeys.privateKeyBytes).toString('hex'),\n\t\t\t\t\t).to.be.eql(defaultPrivateKey);\n\t\t\t\t});\n\n\t\t\t\tit('should create a privateKey of type uint8array', () => {\n\t\t\t\t\treturn expect(signedKeys.privateKeyBytes).to.be.instanceOf(\n\t\t\t\t\t\tUint8Array,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('#signDetached', () => {\n\t\t\t\tlet signatureBytes: Buffer;\n\n\t\t\t\tbeforeEach(() => {\n\t\t\t\t\tsignatureBytes = signDetached(\n\t\t\t\t\t\tBuffer.from(defaultDigest, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultPrivateKey, 'hex'),\n\t\t\t\t\t);\n\t\t\t\t\treturn Promise.resolve();\n\t\t\t\t});\n\n\t\t\t\tit('should create a signature', () => {\n\t\t\t\t\treturn expect(Buffer.from(signatureBytes).toString('hex')).to.be.eql(\n\t\t\t\t\t\tdefaultSignature,\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tit('should create a signature of type uint8array', () => {\n\t\t\t\t\treturn expect(signatureBytes).to.be.instanceOf(Uint8Array);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('#verifyDetached', () => {\n\t\t\t\tit('should return false if the signature is invalid', () => {\n\t\t\t\t\tconst verification = verifyDetached(\n\t\t\t\t\t\tBuffer.from(defaultDigest, 'hex'),\n\t\t\t\t\t\tBuffer.from(makeInvalid(defaultSignature), 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultPublicKey, 'hex'),\n\t\t\t\t\t);\n\t\t\t\t\treturn expect(verification).to.be.false;\n\t\t\t\t});\n\n\t\t\t\tit('should return true if the signature is valid', () => {\n\t\t\t\t\tconst verification = verifyDetached(\n\t\t\t\t\t\tBuffer.from(defaultDigest, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultSignature, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultPublicKey, 'hex'),\n\t\t\t\t\t);\n\t\t\t\t\treturn expect(verification).to.be.true;\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('#box', () => {\n\t\t\t\tlet encryptedMessageBytes: Buffer;\n\n\t\t\t\tbeforeEach(() => {\n\t\t\t\t\tencryptedMessageBytes = box(\n\t\t\t\t\t\tBuffer.from(defaultMessage, 'utf8'),\n\t\t\t\t\t\tBuffer.from(defaultNonce, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultConvertedPublicKeyEd2Curve, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultConvertedPrivateKeyEd2Curve, 'hex'),\n\t\t\t\t\t);\n\t\t\t\t\treturn Promise.resolve();\n\t\t\t\t});\n\n\t\t\t\tit('should encrypt a message', () => {\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tBuffer.from(encryptedMessageBytes).toString('hex'),\n\t\t\t\t\t).to.be.eql(defaultEncryptedMessage);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('#openBox', () => {\n\t\t\t\tlet decryptedMessageBytes: Buffer;\n\n\t\t\t\tbeforeEach(() => {\n\t\t\t\t\tdecryptedMessageBytes = openBox(\n\t\t\t\t\t\tBuffer.from(defaultEncryptedMessage, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultNonce, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultConvertedPublicKeyEd2Curve, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultConvertedPrivateKeyEd2Curve, 'hex'),\n\t\t\t\t\t);\n\t\t\t\t\treturn Promise.resolve();\n\t\t\t\t});\n\n\t\t\t\tit('should decrypt a message', () => {\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tBuffer.from(decryptedMessageBytes).toString('utf8'),\n\t\t\t\t\t).to.be.eql(defaultMessage);\n\t\t\t\t});\n\n\t\t\t\tit('should throw an error for an invalid message', () => {\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\topenBox.bind(\n\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\tBuffer.from(\n\t\t\t\t\t\t\t\t'abcdef1234567890abcdef1234567890abcdef1234567890',\n\t\t\t\t\t\t\t\t'hex',\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\tBuffer.from(defaultNonce, 'hex'),\n\t\t\t\t\t\t\tBuffer.from(defaultConvertedPublicKeyEd2Curve, 'hex'),\n\t\t\t\t\t\t\tBuffer.from(defaultConvertedPrivateKeyEd2Curve, 'hex'),\n\t\t\t\t\t\t),\n\t\t\t\t\t).to.throw(Error, 'Failed to decrypt message');\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('integration tests', () => {\n\t\t\t\tit('should encrypt a given message with a nonce and converted key pair, and decrypt it back to the original message', () => {\n\t\t\t\t\tconst encryptedMessageBytes = box(\n\t\t\t\t\t\tBuffer.from(defaultMessage, 'utf8'),\n\t\t\t\t\t\tBuffer.from(defaultNonce, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultConvertedPublicKeyEd2Curve, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultConvertedPrivateKeyEd2Curve, 'hex'),\n\t\t\t\t\t);\n\t\t\t\t\tconst decryptedMessageBytes = openBox(\n\t\t\t\t\t\tencryptedMessageBytes,\n\t\t\t\t\t\tBuffer.from(defaultNonce, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultConvertedPublicKeyEd2Curve, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultConvertedPrivateKeyEd2Curve, 'hex'),\n\t\t\t\t\t);\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tBuffer.from(decryptedMessageBytes).toString('utf8'),\n\t\t\t\t\t).to.equal(defaultMessage);\n\t\t\t\t});\n\n\t\t\t\tit('should sign a given message and verify it using the same signature', () => {\n\t\t\t\t\tconst signatureBytes = signDetached(\n\t\t\t\t\t\tBuffer.from(defaultDigest, 'hex'),\n\t\t\t\t\t\tBuffer.from(defaultPrivateKey, 'hex'),\n\t\t\t\t\t);\n\t\t\t\t\tconst verification = verifyDetached(\n\t\t\t\t\t\tBuffer.from(defaultDigest, 'hex'),\n\t\t\t\t\t\tsignatureBytes,\n\t\t\t\t\t\tBuffer.from(defaultPublicKey, 'hex'),\n\t\t\t\t\t);\n\t\t\t\t\treturn expect(verification).to.be.true;\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/test/sign.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { makeInvalid } from './helpers';\nimport {\n\tSignedMessageWithOnePassphrase,\n\tSignedMessageWithTwoPassphrases,\n\tsignMessageWithPassphrase,\n\tsignMessageWithTwoPassphrases,\n\tverifyMessageWithPublicKey,\n\tverifyMessageWithTwoPublicKeys,\n\tprintSignedMessage,\n\tsignAndPrintMessage,\n\tsignData,\n\tsignDataWithPassphrase,\n\tsignDataWithPrivateKey,\n\tverifyData,\n\tdigestMessage,\n} from '../src/sign';\n// Require is used for stubbing\nconst keys = require('../src/keys');\n\nconst changeLength = (str: string): string => `00${str}`;\n\ndescribe('sign', () => {\n\tconst defaultPassphrase =\n\t\t'minute omit local rare sword knee banner pair rib museum shadow juice';\n\tconst defaultPrivateKey =\n\t\t'314852d7afb0d4c283692fef8a2cb40e30c7a5df2ed79994178c10ac168d6d977ef45cd525e95b7a86244bbd4eb4550914ad06301013958f4dd64d32ef7bc588';\n\tconst defaultPublicKey =\n\t\t'7ef45cd525e95b7a86244bbd4eb4550914ad06301013958f4dd64d32ef7bc588';\n\tconst defaultSecondPassphrase = 'second secret';\n\tconst defaultSecondPrivateKey =\n\t\t'9ef4146f8166d32dc8051d3d9f3a0c4933e24aa8ccb439b5d9ad00078a89e2fc0401c8ac9f29ded9e1e4d5b6b43051cb25b22f27c7b7b35092161e851946f82f';\n\tconst defaultSecondPublicKey =\n\t\t'0401c8ac9f29ded9e1e4d5b6b43051cb25b22f27c7b7b35092161e851946f82f';\n\tconst defaultMessage = 'Some default text.';\n\tconst defaultSignature =\n\t\t'68937004b6720d7e1902ef05a577e6d9f9ab2756286b1f2ae918f8a0e5153c15e4f410916076f750b708f8979be2430e4cfc7ebb523ae1905d2ea1f5d24ce700';\n\tconst defaultSecondSignature =\n\t\t'58013cd8dbc4c194cedb5bdc27232f9de225d077b4dfe817ba810189486bd43e8600e0e8295623882e9db0ba5685bd30e7b7c81f38bc1b668fd9e2370ab9d905';\n\tconst defaultPrintedMessage = `\n-----BEGIN LISK SIGNED MESSAGE-----\n-----MESSAGE-----\n${defaultMessage}\n-----PUBLIC KEY-----\n${defaultPublicKey}\n-----SIGNATURE-----\n${defaultSignature}\n-----END LISK SIGNED MESSAGE-----\n`.trim();\n\tconst defaultSecondSignedPrintedMessage = `\n-----BEGIN LISK SIGNED MESSAGE-----\n-----MESSAGE-----\n${defaultMessage}\n-----PUBLIC KEY-----\n${defaultPublicKey}\n-----SECOND PUBLIC KEY-----\n${defaultSecondPublicKey}\n-----SIGNATURE-----\n${defaultSignature}\n-----SECOND SIGNATURE-----\n${defaultSecondSignature}\n-----END LISK SIGNED MESSAGE-----\n`.trim();\n\tconst defaultData = Buffer.from('This is some data');\n\tconst defaultDataSignature =\n\t\t'b8704e11c4d9fad9960c7b6a69dcf48c1bede5b74ed8974cd005d9a407deef618dd800fe69ceed1fd52bb1e0881e71aec137c35b90eda9afe93716a5652ee009';\n\n\tlet defaultSignedMessage: SignedMessageWithOnePassphrase;\n\tlet defaultDoubleSignedMessage: SignedMessageWithTwoPassphrases;\n\n\tlet getPrivateAndPublicKeyBytesFromPassphraseStub;\n\n\tbeforeEach(() => {\n\t\tdefaultSignedMessage = {\n\t\t\tmessage: defaultMessage,\n\t\t\tpublicKey: defaultPublicKey,\n\t\t\tsignature: defaultSignature,\n\t\t};\n\t\tdefaultDoubleSignedMessage = {\n\t\t\tmessage: defaultMessage,\n\t\t\tpublicKey: defaultPublicKey,\n\t\t\tsecondPublicKey: defaultSecondPublicKey,\n\t\t\tsignature: defaultSignature,\n\t\t\tsecondSignature: defaultSecondSignature,\n\t\t};\n\n\t\tgetPrivateAndPublicKeyBytesFromPassphraseStub = sandbox.stub(\n\t\t\tkeys,\n\t\t\t'getPrivateAndPublicKeyBytesFromPassphrase',\n\t\t);\n\t\tgetPrivateAndPublicKeyBytesFromPassphraseStub\n\t\t\t.withArgs(defaultPassphrase)\n\t\t\t.returns({\n\t\t\t\tprivateKeyBytes: Buffer.from(defaultPrivateKey, 'hex'),\n\t\t\t\tpublicKeyBytes: Buffer.from(defaultPublicKey, 'hex'),\n\t\t\t});\n\t\treturn getPrivateAndPublicKeyBytesFromPassphraseStub\n\t\t\t.withArgs(defaultSecondPassphrase)\n\t\t\t.returns({\n\t\t\t\tprivateKeyBytes: Buffer.from(defaultSecondPrivateKey, 'hex'),\n\t\t\t\tpublicKeyBytes: Buffer.from(defaultSecondPublicKey, 'hex'),\n\t\t\t});\n\t});\n\n\tdescribe('#digestMessage', () => {\n\t\tconst strGenerator = (len: number, chr: string): string => chr.repeat(len);\n\n\t\tit('should create message digest for message with length = 0', () => {\n\t\t\tconst msgBytes = digestMessage('');\n\t\t\tconst expectedMessageBytes = Buffer.from(\n\t\t\t\t'3fdb82ac2a879b647f4f27f3fbd1c27e0d4e278f830b76295604035330163b79',\n\t\t\t\t'hex',\n\t\t\t);\n\t\t\treturn expect(msgBytes).to.be.eql(expectedMessageBytes);\n\t\t});\n\t\tit('should create message digest for message in length range 1 - 253', () => {\n\t\t\tconst msgBytes = digestMessage(strGenerator(250, 'a'));\n\t\t\tconst expectedMessageBytes = Buffer.from(\n\t\t\t\t'12832c687d950513aa5db6198b84809eb8fd7ff1c8963dca48ea57278523ec67',\n\t\t\t\t'hex',\n\t\t\t);\n\t\t\treturn expect(msgBytes).to.be.eql(expectedMessageBytes);\n\t\t});\n\t\tit('should create message digest for message in length range 254 - 65536', () => {\n\t\t\tconst msgBytes = digestMessage(strGenerator(65535, 'a'));\n\t\t\tconst expectedMessageBytes = Buffer.from(\n\t\t\t\t'73da94220312e71eb5c55c94fdddca3c06a6c18cb74a4a4a2cee1a82875c2450',\n\t\t\t\t'hex',\n\t\t\t);\n\t\t\treturn expect(msgBytes).to.be.eql(expectedMessageBytes);\n\t\t});\n\t\tit('should create message digest for message in length range 65537 - 4294967296', () => {\n\t\t\tconst msgBytes = digestMessage(strGenerator(6710886, 'a'));\n\t\t\tconst expectedMessageBytes = Buffer.from(\n\t\t\t\t'7c51817b5c31c4d04e9ffcf2e78859d6522b124f218c789a8f721b5f3e6b295d',\n\t\t\t\t'hex',\n\t\t\t);\n\t\t\treturn expect(msgBytes).to.be.eql(expectedMessageBytes);\n\t\t});\n\t\t// higest range (length > 4294967296) is not practical to test\n\t\t// but it is covered by `varuint-bitcoin` library\n\t});\n\n\tdescribe('#signMessageWithPassphrase', () => {\n\t\tit('should create a signed message using a secret passphrase', () => {\n\t\t\tconst signedMessage = signMessageWithPassphrase(\n\t\t\t\tdefaultMessage,\n\t\t\t\tdefaultPassphrase,\n\t\t\t);\n\t\t\treturn expect(signedMessage).to.be.eql(defaultSignedMessage);\n\t\t});\n\t});\n\n\tdescribe('#verifyMessageWithPublicKey', () => {\n\t\tit('should detect invalid publicKeys', () => {\n\t\t\treturn expect(\n\t\t\t\tverifyMessageWithPublicKey.bind(null, {\n\t\t\t\t\tmessage: defaultMessage,\n\t\t\t\t\tsignature: defaultSignature,\n\t\t\t\t\tpublicKey: changeLength(defaultPublicKey),\n\t\t\t\t}),\n\t\t\t).to.throw('Invalid publicKey, expected 32-byte publicKey');\n\t\t});\n\n\t\tit('should detect invalid signatures', () => {\n\t\t\treturn expect(\n\t\t\t\tverifyMessageWithPublicKey.bind(null, {\n\t\t\t\t\tmessage: defaultMessage,\n\t\t\t\t\tsignature: changeLength(defaultSignature),\n\t\t\t\t\tpublicKey: defaultPublicKey,\n\t\t\t\t}),\n\t\t\t).to.throw('Invalid signature length, expected 64-byte signature');\n\t\t});\n\n\t\tit('should return false if the signature is invalid', () => {\n\t\t\tconst verification = verifyMessageWithPublicKey({\n\t\t\t\tmessage: defaultMessage,\n\t\t\t\tsignature: makeInvalid(defaultSignature),\n\t\t\t\tpublicKey: defaultPublicKey,\n\t\t\t});\n\t\t\treturn expect(verification).to.be.false;\n\t\t});\n\n\t\tit('should return true if the signature is valid', () => {\n\t\t\tconst verification = verifyMessageWithPublicKey(defaultSignedMessage);\n\t\t\treturn expect(verification).to.be.true;\n\t\t});\n\t});\n\n\tdescribe('#signMessageWithTwoPassphrases', () => {\n\t\tit('should create a message signed by two secret passphrases', () => {\n\t\t\tconst signature = signMessageWithTwoPassphrases(\n\t\t\t\tdefaultMessage,\n\t\t\t\tdefaultPassphrase,\n\t\t\t\tdefaultSecondPassphrase,\n\t\t\t);\n\n\t\t\treturn expect(signature).to.be.eql(defaultDoubleSignedMessage);\n\t\t});\n\t});\n\n\tdescribe('#verifyMessageWithTwoPublicKeys', () => {\n\t\tit('should throw on invalid first publicKey length', () => {\n\t\t\tconst {\n\t\t\t\tpublicKey,\n\t\t\t\t...messageWithoutPublicKey\n\t\t\t} = defaultDoubleSignedMessage;\n\t\t\treturn expect(\n\t\t\t\tverifyMessageWithTwoPublicKeys.bind(null, {\n\t\t\t\t\tpublicKey: changeLength(defaultPublicKey),\n\t\t\t\t\t...messageWithoutPublicKey,\n\t\t\t\t}),\n\t\t\t).to.throw('Invalid first publicKey, expected 32-byte publicKey');\n\t\t});\n\n\t\tit('should throw on invalid second publicKey length', () => {\n\t\t\tconst {\n\t\t\t\tsecondPublicKey,\n\t\t\t\t...messageWithoutSecondPublicKey\n\t\t\t} = defaultDoubleSignedMessage;\n\t\t\treturn expect(\n\t\t\t\tverifyMessageWithTwoPublicKeys.bind(null, {\n\t\t\t\t\tsecondPublicKey: changeLength(defaultSecondPublicKey),\n\t\t\t\t\t...messageWithoutSecondPublicKey,\n\t\t\t\t}),\n\t\t\t).to.throw('Invalid second publicKey, expected 32-byte publicKey');\n\t\t});\n\n\t\tit('should throw on invalid primary signature length', () => {\n\t\t\tconst {\n\t\t\t\tsignature,\n\t\t\t\t...messageWithoutSignature\n\t\t\t} = defaultDoubleSignedMessage;\n\t\t\treturn expect(\n\t\t\t\tverifyMessageWithTwoPublicKeys.bind(null, {\n\t\t\t\t\tsignature: changeLength(defaultSignature),\n\t\t\t\t\t...messageWithoutSignature,\n\t\t\t\t}),\n\t\t\t).to.throw('Invalid first signature length, expected 64-byte signature');\n\t\t});\n\n\t\tit('should throw on invalid secondary signature length', () => {\n\t\t\tconst {\n\t\t\t\tsecondSignature,\n\t\t\t\t...messageWithoutSecondSignature\n\t\t\t} = defaultDoubleSignedMessage;\n\t\t\treturn expect(\n\t\t\t\tverifyMessageWithTwoPublicKeys.bind(null, {\n\t\t\t\t\tsecondSignature: changeLength(defaultSecondSignature),\n\t\t\t\t\t...messageWithoutSecondSignature,\n\t\t\t\t}),\n\t\t\t).to.throw('Invalid second signature length, expected 64-byte signature');\n\t\t});\n\n\t\tit('should return false for incorrect first signature', () => {\n\t\t\tconst {\n\t\t\t\tsignature,\n\t\t\t\t...messageWithoutSignature\n\t\t\t} = defaultDoubleSignedMessage;\n\t\t\tconst verified = verifyMessageWithTwoPublicKeys({\n\t\t\t\tsignature: makeInvalid(defaultSignature),\n\t\t\t\t...messageWithoutSignature,\n\t\t\t});\n\t\t\treturn expect(verified).to.be.false;\n\t\t});\n\n\t\tit('should return false for incorrect second signature', () => {\n\t\t\tconst {\n\t\t\t\tsecondSignature,\n\t\t\t\t...messageWithoutSecondSignature\n\t\t\t} = defaultDoubleSignedMessage;\n\t\t\tconst verified = verifyMessageWithTwoPublicKeys({\n\t\t\t\tsecondSignature: makeInvalid(defaultSecondSignature),\n\t\t\t\t...messageWithoutSecondSignature,\n\t\t\t});\n\t\t\treturn expect(verified).to.be.false;\n\t\t});\n\n\t\tit('should return true for two valid signatures', () => {\n\t\t\tconst verified = verifyMessageWithTwoPublicKeys(\n\t\t\t\tdefaultDoubleSignedMessage,\n\t\t\t);\n\t\t\treturn expect(verified).to.be.true;\n\t\t});\n\t});\n\n\tdescribe('#printSignedMessage', () => {\n\t\tit('should wrap a single signed message into a printed Lisk template', () => {\n\t\t\tconst printedMessage = printSignedMessage({\n\t\t\t\tmessage: defaultMessage,\n\t\t\t\tsignature: defaultSignature,\n\t\t\t\tpublicKey: defaultPublicKey,\n\t\t\t});\n\t\t\treturn expect(printedMessage).to.be.equal(defaultPrintedMessage);\n\t\t});\n\n\t\tit('should wrap a second signed message into a printed Lisk template', () => {\n\t\t\tconst printedMessage = printSignedMessage({\n\t\t\t\tmessage: defaultMessage,\n\t\t\t\tsignature: defaultSignature,\n\t\t\t\tpublicKey: defaultPublicKey,\n\t\t\t\tsecondSignature: defaultSecondSignature,\n\t\t\t\tsecondPublicKey: defaultSecondPublicKey,\n\t\t\t});\n\t\t\treturn expect(printedMessage).to.be.equal(\n\t\t\t\tdefaultSecondSignedPrintedMessage,\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('#signAndPrintMessage', () => {\n\t\tit('should sign the message once and wrap it into a printed Lisk template', () => {\n\t\t\tconst signedAndPrintedMessage = signAndPrintMessage(\n\t\t\t\tdefaultMessage,\n\t\t\t\tdefaultPassphrase,\n\t\t\t);\n\t\t\treturn expect(signedAndPrintedMessage).to.be.equal(defaultPrintedMessage);\n\t\t});\n\n\t\tit('should sign the message twice and wrap it into a printed Lisk template', () => {\n\t\t\tconst signedAndPrintedMessage = signAndPrintMessage(\n\t\t\t\tdefaultMessage,\n\t\t\t\tdefaultPassphrase,\n\t\t\t\tdefaultSecondPassphrase,\n\t\t\t);\n\t\t\treturn expect(signedAndPrintedMessage).to.be.equal(\n\t\t\t\tdefaultSecondSignedPrintedMessage,\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('#signData', () => {\n\t\tlet signature: string;\n\n\t\tbeforeEach(() => {\n\t\t\tsignature = signData(defaultData, defaultPassphrase);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should sign a transaction', () => {\n\t\t\treturn expect(signature).to.be.equal(defaultDataSignature);\n\t\t});\n\t});\n\n\tdescribe('#signDataWithPassphrase', () => {\n\t\tlet signature: string;\n\n\t\tbeforeEach(() => {\n\t\t\tsignature = signDataWithPassphrase(defaultData, defaultPassphrase);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should sign a transaction', () => {\n\t\t\treturn expect(signature).to.be.equal(defaultDataSignature);\n\t\t});\n\t});\n\n\tdescribe('#signDataWithPrivateKey', () => {\n\t\tlet signature: string;\n\n\t\tbeforeEach(() => {\n\t\t\tsignature = signDataWithPrivateKey(\n\t\t\t\tdefaultData,\n\t\t\t\tBuffer.from(defaultPrivateKey, 'hex'),\n\t\t\t);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should sign a transaction', () => {\n\t\t\treturn expect(signature).to.be.equal(defaultDataSignature);\n\t\t});\n\t});\n\n\tdescribe('#verifyData', () => {\n\t\tit('should return false for an invalid signature', () => {\n\t\t\tconst verification = verifyData(\n\t\t\t\tdefaultData,\n\t\t\t\tmakeInvalid(defaultDataSignature),\n\t\t\t\tdefaultPublicKey,\n\t\t\t);\n\t\t\treturn expect(verification).to.be.false;\n\t\t});\n\n\t\tit('should return true for a valid signature', () => {\n\t\t\tconst verification = verifyData(\n\t\t\t\tdefaultData,\n\t\t\t\tdefaultDataSignature,\n\t\t\t\tdefaultPublicKey,\n\t\t\t);\n\t\t\treturn expect(verification).to.be.true;\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-cryptography/test/tsconfig.json",
    "content": "{\n\t\"extends\": \"../tsconfig\",\n\t\"compilerOptions\": {\n\t\t\"baseUrl\": \".\",\n\t\t\"declaration\": false,\n\t\t\"target\": \"es2017\",\n\t\t\"typeRoots\": [\"../types\", \"../../../types\", \"../node_modules/@types\"]\n\t},\n\t\"include\": [\"../../../types/**/*\", \"./**/*\"]\n}\n"
  },
  {
    "path": "packages/lisk-cryptography/types/browserify-bignum/index.d.ts",
    "content": "/* tslint:disable:only-arrow-functions member-access readonly-keyword no-any */\n/// <reference types=\"node\" />\n\ndeclare module 'browserify-bignum' {\n\tclass BigNum {\n\t\t/**\n\t\t * Create a new BigNum from a Buffer.\n\t\t *\n\t\t * The default options are: {endian: 'big', size: 1}.\n\t\t */\n\t\tstatic fromBuffer(buffer: Buffer, options?: BigNum.BufferOptions): BigNum;\n\n\t\t/** Return true if num is identified as a BigNum instance. Otherwise, return false. */\n\t\tstatic isBigNum(num: any): boolean;\n\n\t\t/**\n\t\t * Generate a probable prime of length bits.\n\t\t *\n\t\t * If safe is true, it will be a \"safe\" prime of the form p=2p'+1 where p' is also prime.\n\t\t */\n\t\tstatic prime(bits: number, safe?: boolean): BigNum;\n\n\t\t/** Create a new BigNum from n. */\n\t\tconstructor(n: number | BigNum);\n\n\t\t/** Create a new BigNum from n and a base. */\n\t\tconstructor(n: string, base?: number);\n\n\t\t/** Return a new BigNum with the absolute value of the instance. */\n\t\tabs(): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value plus n. */\n\t\tadd(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return the number of bits used to represent the current BigNum. */\n\t\tbitLength(): number;\n\n\t\t/**\n\t\t * Compare the instance value to n.\n\t\t *\n\t\t * Return a positive integer if > n, a negative integer if < n, and 0 if == n.\n\t\t */\n\t\tcmp(n: BigNum.BigNumCompatible): number;\n\n\t\t/** Return a new BigNum containing the instance value integrally divided by n. */\n\t\tdiv(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return a boolean: whether the instance value is equal to n (== n). */\n\t\teq(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a boolean: whether the instance value is greater than or equal to n (>= n). */\n\t\tge(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a boolean: whether the instance value is greater than n (> n). */\n\t\tgt(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a boolean: whether the instance value is greater than n (>= n). */\n\t\tgte(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a boolean: whether the instance value is less than or equal to n (<= n). */\n\t\tle(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a boolean: whether the instance value is less than n (< n). */\n\t\tlt(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a boolean: whether the instance value is less than or equal to n (<= n). */\n\t\tlte(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a new BigNum with the instance value modulo n. */\n\t\tmod(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value multiplied by n. */\n\t\tmul(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return a new BigNum with the negative of the instance value. */\n\t\tneg(): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value plus n. */\n\t\tplus(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return a new BigNum with the instance value raised to the nth power. */\n\t\tpow(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return a new BigNum with the instance value raised to the nth power modulo m. */\n\t\tpowm(n: BigNum.BigNumCompatible, m: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value minus n. */\n\t\tsub(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/**\n\t\t * Return a new Buffer with the data from the BigNum.\n\t\t *\n\t\t * The default options are: {endian: 'big', size: 1}.\n\t\t */\n\t\ttoBuffer(options?: BigNum.BufferOptions): Buffer;\n\n\t\t/**\n\t\t * Turn a BigNum into a Number.\n\t\t *\n\t\t * If the BigNum is too big you'll lose precision or you'll get ±Infinity.\n\t\t */\n\t\ttoNumber(): number;\n\n\t\t/** Print out the BigNum instance in the requested base as a string. Default: base 10 */\n\t\ttoString(base?: number): string;\n\n\t\t/** Print out the BigNum instance in the requested base as a string. Default: base 10 */\n\t\ttoString(base?: number): string;\n\t}\n\n\texport = BigNum;\n\n\tnamespace BigNum {\n\t\t/** Anything that can be converted to BigNum. */\n\t\ttype BigNumCompatible = BigNum | number | string;\n\n\t\texport interface BufferOptions {\n\t\t\t/** Can be either 'big' or 'little'. Also accepts 1 for big and -1 for little. Doesn't matter when size = 1. */\n\t\t\tendian: string | number;\n\n\t\t\t/** Number of bytes per word, or 'auto' to flip entire Buffer. */\n\t\t\tsize: number | string;\n\t\t}\n\n\t\t/**\n\t\t * Turn a BigNum into a Number.\n\t\t *\n\t\t * If the BigNum is too big you'll lose precision or you'll get ±Infinity.\n\t\t */\n\t\texport function toNumber(n: BigNumCompatible): number;\n\n\t\t/**\n\t\t * Return a new Buffer with the data from the BigNum.\n\t\t *\n\t\t * The default options are: {endian: 'big', size: 1}.\n\t\t */\n\t\texport function toBuffer(\n\t\t\tn: BigNumCompatible,\n\t\t\toptions?: BufferOptions,\n\t\t): Buffer;\n\n\t\t/** Return a new BigNum containing the instance value plus n. */\n\t\texport function add(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value plus n. */\n\t\texport function plus(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value minus n. */\n\t\texport function sub(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value multiplied by n. */\n\t\texport function mul(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value integrally divided by n. */\n\t\texport function div(\n\t\t\tdividend: BigNumCompatible,\n\t\t\tdivisor: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum with the absolute value of the instance. */\n\t\texport function abs(n: BigNumCompatible): BigNum;\n\n\t\t/** Return a new BigNum with the negative of the instance value. */\n\t\texport function neg(n: BigNumCompatible): BigNum;\n\n\t\t/**\n\t\t * Compare the instance value to n.\n\t\t *\n\t\t * Return a positive integer if > n, a negative integer if < n, and 0 if == n.\n\t\t */\n\t\texport function cmp(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): number;\n\n\t\t/** Return a boolean: whether the instance value is greater than n (> n). */\n\t\texport function gt(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a boolean: whether the instance value is greater than or equal to n (>= n). */\n\t\texport function gte(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a boolean: whether the instance value is greater than or equal to n (>= n). */\n\t\texport function ge(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a boolean: whether the instance value is equal to n (== n). */\n\t\texport function eq(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a boolean: whether the instance value is less than n (< n). */\n\t\texport function lt(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a boolean: whether the instance value is less than or equal to n (<= n). */\n\t\texport function lte(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a boolean: whether the instance value is less than or equal to n (<= n). */\n\t\texport function le(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a new BigNum with the instance value modulo n. */\n\t\texport function mod(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum with the instance value raised to the nth power. */\n\t\texport function pow(\n\t\t\tbase: BigNumCompatible,\n\t\t\texponent: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum with the instance value raised to the nth power modulo m. */\n\t\texport function powm(\n\t\t\tbase: BigNumCompatible,\n\t\t\texponent: BigNumCompatible,\n\t\t\tm: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/**\n\t\t * If upperBound is supplied, return a random BigNum between the instance value and upperBound - 1, inclusive.\n\t\t * Otherwise, return a random BigNum between 0 and the instance value - 1, inclusive.\n\t\t */\n\t\texport function rand(\n\t\t\tn: BigNumCompatible,\n\t\t\tupperBound?: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return the number of bits used to represent the current BigNum. */\n\t\texport function bitLength(n: BigNumCompatible): number;\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-cryptography/types/buffer-reverse/index.d.ts",
    "content": "// tslint:disable only-arrow-functions\ndeclare module 'buffer-reverse' {\n\texport default function(buffer: Buffer): Buffer;\n}\n"
  },
  {
    "path": "packages/lisk-cryptography/types/sodium-native/index.d.ts",
    "content": "// tslint:disable only-arrow-functions variable-name\ndeclare module 'sodium-native' {\n\texport const crypto_box_MACBYTES: number;\n\texport const crypto_sign_BYTES: number;\n\texport const crypto_sign_PUBLICKEYBYTES: number;\n\texport const crypto_sign_SECRETKEYBYTES: number;\n\texport function crypto_box_easy(\n\t\tcipher: Buffer,\n\t\tmessage: Buffer,\n\t\tnonce: Buffer,\n\t\tpublicKey: Buffer,\n\t\tsecretKey: Buffer,\n\t): void;\n\texport function crypto_box_open_easy(\n\t\tmessage: Buffer,\n\t\tcipherText: Buffer,\n\t\tnonce: Buffer,\n\t\tpublicKey: Buffer,\n\t\tsecretKey: Buffer,\n\t): boolean;\n\texport function crypto_sign_detached(\n\t\tsignature: Buffer,\n\t\tmessage: Buffer,\n\t\tsecretKey: Buffer,\n\t): void;\n\texport function crypto_sign_verify_detached(\n\t\tsignature: Buffer,\n\t\tmessage: Buffer,\n\t\tpublicKey: Buffer,\n\t): boolean;\n\texport function randombytes_buf(buffer: Buffer): void;\n\texport function crypto_sign_seed_keypair(\n\t\tpublicKey: Buffer,\n\t\tprivateKey: Buffer,\n\t\thashSeed: Buffer,\n\t): void;\n}\n"
  },
  {
    "path": "packages/lisk-cryptography/types/varuint-bitcoin/index.d.ts",
    "content": "// tslint:disable only-arrow-functions\ndeclare module 'varuint-bitcoin' {\n\texport function encode(num: number, buffer?: Buffer, offset?: number): Buffer;\n}\n"
  },
  {
    "path": "packages/lisk-elements/README.md",
    "content": "# Lisk Elements\n\nLisk Elements is a JavaScript library for [Lisk][Lisk Core GitHub], the blockchain application platform.\n\n[![Build Status](https://jenkins.lisk.io/buildStatus/icon?job=lisk-elements/development)](https://jenkins.lisk.io/job/lisk-elements/job/development/)\n<a href=\"https://david-dm.org/LiskHQ/lisk-elements\"><img src=\"https://david-dm.org/LiskHQ/lisk-elements.svg\" alt=\"Dependency Status\"></a>\n<a href=\"https://david-dm.org/LiskHQ/lisk-elements/?type=dev\"><img src=\"https://david-dm.org/LiskHQ/lisk-elements/dev-status.svg\" alt=\"devDependency Status\"></a>\n[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)\n\n## Installation\n\n### Installation via npm\n\nAdd Lisk Elements as a dependency of your project:\n\n```sh\n$ npm install --save lisk-elements\n```\n\nImport using ES6 modules syntax:\n\n```js\nimport lisk from 'lisk-elements';\n```\n\nOr using Node.js modules:\n\n```js\nconst lisk = require('lisk-elements');\n```\n\nOr import specific namespaced functionality:\n\n```js\nimport { APIClient, transactions } from 'lisk-elements';\n// or\nconst { APIClient, transactions } = require('lisk-elements');\n```\n\n**Note:** If you are installing Lisk Elements as an npm dependency via a GitHub reference, you will need to manually build the distribution files by running the following commands from the root directory of your project:\n\n```\ncd node_modules/lisk-elements\nnpm run build\n```\n\n### Installation from source\n\nOur source code is hosted on GitHub. You can build the distribution yourself by cloning the repository, installing the relevant dependencies and running our build script as follows:\n\n```\ngit clone https://github.com/LiskHQ/lisk-elements.git\ncd lisk-elements/packages/lisk-elements\nnpm install\nnpm run build\n```\n\n## Usage\n\nAccess functionality via the relevant namespace. For example, the following will create and (locally) sign a transfer (type 0) transaction, and then broadcast it to the Lisk Testnet.\n\n```js\nconst transaction = lisk.transaction.transfer({\n\tamount: '123000000',\n\trecipientId: '12668885769632475474L',\n\tpassphrase: 'robust swift grocery peasant forget share enable convince deputy road keep cheap',\n});\n\nconst client = lisk.APIClient.createTestnetAPIClient();\n\nclient.transactions.broadcast(transaction)\n\t.then(console.info)\n\t.catch(console.error);\n```\n\nFull documentation can be found on the [Lisk documentation site][].\n\n## Packages\n\n| Package                                                 |                                                      Version                                                      | Description                                                        |\n| ------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------: | ------------------------------------------------------------------ |\n| [lisk-elements](/packages/lisk-elements)                 |       [![](https://img.shields.io/badge/npm-v2.0.0-green.svg)](https://www.npmjs.com/package/lisk-elements)       | Package contains everything                                        |\n| [@liskhq/lisk-client](/packages/lisk-client)             |    [![](https://img.shields.io/badge/npm-v2.0.0-green.svg)](https://www.npmjs.com/package/@liskhq/lisk-client)    | A default set of Elements for use by clients of the Lisk network   |\n| [@liskhq/lisk-api-client](/packages/lisk-api-client)     |  [![](https://img.shields.io/badge/npm-v2.0.0-green.svg)](https://www.npmjs.com/package/@liskhq/lisk-api-client)  | An API client for the Lisk network                                 |\n| [@liskhq/lisk-constants](/packages/lisk-constants)       |  [![](https://img.shields.io/badge/npm-v1.2.0-green.svg)](https://www.npmjs.com/package/@liskhq/lisk-constants)   | General constants for use with Lisk-related software               |\n| [@liskhq/lisk-cryptography](/packages/lisk-cryptography) | [![](https://img.shields.io/badge/npm-v2.0.0-green.svg)](https://www.npmjs.com/package/@liskhq/lisk-cryptography) | General cryptographic functions for use with Lisk-related software |\n| [@liskhq/lisk-passphrase](/packages/lisk-passphrase)     |  [![](https://img.shields.io/badge/npm-v2.0.0-green.svg)](https://www.npmjs.com/package/@liskhq/lisk-passphrase)  | Mnemonic passphrase helpers for use with Lisk-related software     |\n| [@liskhq/lisk-transactions](/packages/lisk-transactions) | [![](https://img.shields.io/badge/npm-v2.0.0-green.svg)](https://www.npmjs.com/package/@liskhq/lisk-transactions) | Everything related to transactions according to the Lisk protocol  |\n\n## Tests\n\nTo run tests for all packages in lisk-elements, run the following command in the root folder:\n\n```\nnpm test\n```\n\nTo run tests for a specific package, run the same command in the relevant package directory.\n\nExample:\n\n```\ncd packages/lisk-cryptography\nnpm test\n```\n\n## FAQ\n\nInstallation is failing, what should I do?\n\n```\nMake sure you are installing in the root folder, not on the package level.\nRun `npm run clean` and `npm run clean:node_modules`, then install again.\n```\n\nI can't build the package, what should I do?\n\n```\nMake sure you first run `npm i`, and then `npm run build` in the root directory.\n```\n\nTests are failing!\n\n```\nMake sure you are using the correct version of node and npm.\nIn our current build we recommend node v8.12.0 and npm v6.4.1.\n```\n\n\n\n## Contributors\n\nhttps://github.com/LiskHQ/lisk-elements/graphs/contributors\n\n## License\n\nCopyright © 2016-2018 Lisk Foundation\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the [GNU General Public License](https://github.com/LiskHQ/lisk-elements/tree/master/LICENSE) along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n***\n\nThis program also incorporates work previously released with lisk-js `v0.5.2` (and earlier) versions under the [MIT License](https://opensource.org/licenses/MIT). To comply with the requirements of that license, the following permission notice, applicable to those parts of the code only, is included below:\n\nCopyright © 2016-2017 Lisk Foundation\n\nCopyright © 2015 Crypti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[Lisk Core GitHub]: https://github.com/LiskHQ/lisk\n[Lisk documentation site]: https://lisk.io/documentation/lisk-elements\n"
  },
  {
    "path": "packages/lisk-elements/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>Title</title>\n</head>\n<body>\nOpen the console to get started with Lisk Elements.\n<div id=\"output\"></div>\n\n<script src=\"dist-browser/lisk-elements.min.js\"></script>\n\n</body>\n</html>\n"
  },
  {
    "path": "packages/lisk-elements/package.json",
    "content": "{\n\t\"name\": \"lisk-elements\",\n\t\"version\": \"2.0.0\",\n\t\"description\": \"Elements for building blockchain applications in the Lisk network\",\n\t\"author\": \"Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>\",\n\t\"license\": \"GPL-3.0\",\n\t\"keywords\": [\n\t\t\"lisk\",\n\t\t\"blockchain\"\n\t],\n\t\"homepage\": \"https://github.com/LiskHQ/lisk-elements/tree/master/packages/lisk-elements#readme\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/LiskHQ/lisk-elements.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/LiskHQ/lisk-elements/issues\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=8.10 <=10\",\n\t\t\"npm\": \">=5\"\n\t},\n\t\"main\": \"dist-node/index.js\",\n\t\"scripts\": {\n\t\t\"prestart\": \"./scripts/prestart.sh\",\n\t\t\"start\": \"./scripts/start.sh\",\n\t\t\"transpile\": \"tsc\",\n\t\t\"transpile:browsertest\": \"tsc -p tsconfig.browsertest.json\",\n\t\t\"browserify\": \"browserify ./dist-node/index.js -o ./dist-browser/index.js -s lisk\",\n\t\t\"browserify:browsertest\": \"browserify ./browsertest.build/test/*.js -o ./browsertest.build/browsertest.js -s lisk\",\n\t\t\"uglify\": \"uglifyjs -nm -o ./dist-browser/index.min.js ./dist-browser/index.js\",\n\t\t\"uglify:browsertest\": \"uglifyjs -o ./browsertest.build/browsertest.min.js ./browsertest.build/browsertest.js\",\n\t\t\"clean\": \"./scripts/clean.sh\",\n\t\t\"format\": \"prettier --write \\\"*.{js,json}\\\" \\\"{src,test}/**/*.{js,json}\\\"\",\n\t\t\"lint\": \"tslint --format verbose --project .\",\n\t\t\"lint:fix\": \"npm run lint -- --fix\",\n\t\t\"test\": \"TS_NODE_PROJECT=./test/tsconfig.json nyc mocha test/{,/**/}/*.ts\",\n\t\t\"test:watch\": \"npm test -- --watch\",\n\t\t\"test:watch:min\": \"npm run test:watch -- --reporter=min\",\n\t\t\"test:node\": \"npm run build:check\",\n\t\t\"serve:start\": \"http-server -p 11540 ./browsertest &\",\n\t\t\"serve:stop\": \"kill $(lsof -t -i:11540) || true\",\n\t\t\"pretest:browser\": \"npm run serve:stop && npm run build:browsertest && npm run serve:start\",\n\t\t\"test:browser\": \"wait-on http://localhost:11540 && cypress run --config baseUrl=http://localhost:11540 --env ROOT_DIR=\\\"${PWD##*/}\\\"\",\n\t\t\"posttest:browser\": \"npm run serve:stop\",\n\t\t\"cover\": \"if [ -z $JENKINS_HOME ]; then npm run cover:local; else npm run cover:ci; fi\",\n\t\t\"cover:base\": \"NODE_ENV=test nyc report\",\n\t\t\"cover:local\": \"npm run cover:base -- --reporter=html --reporter=text\",\n\t\t\"cover:ci\": \"npm run cover:base -- --reporter=text\",\n\t\t\"build:browsertest\": \"npm run transpile:browsertest && npm run browserify:browsertest && npm run uglify:browsertest\",\n\t\t\"postbuild:browsertest\": \"rm -r browsertest.build/src browsertest.build/test\",\n\t\t\"prebuild:node\": \"rm -r dist-node/* || mkdir dist-node || true\",\n\t\t\"build:node\": \"npm run transpile\",\n\t\t\"prebuild:browser\": \"rm ./dist-browser/index.js ./dist-browser/index.min.js || true\",\n\t\t\"build:browser\": \"npm run build:node && npm run browserify && npm run uglify\",\n\t\t\"prebuild\": \"npm run prebuild:browser\",\n\t\t\"build\": \"npm run build:browser\",\n\t\t\"build:check\": \"node -e \\\"require('./dist-node')\\\"\",\n\t\t\"prepublishOnly\": \"npm run lint && npm test && npm run build && npm run build:check\"\n\t},\n\t\"dependencies\": {\n\t\t\"@liskhq/lisk-api-client\": \"2.0.0\",\n\t\t\"@liskhq/lisk-constants\": \"1.2.0\",\n\t\t\"@liskhq/lisk-cryptography\": \"2.0.0\",\n\t\t\"@liskhq/lisk-passphrase\": \"2.0.0\",\n\t\t\"@liskhq/lisk-transactions\": \"2.0.0\",\n\t\t\"@types/node\": \"10.10.1\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@types/chai\": \"4.1.5\",\n\t\t\"@types/expect\": \"1.20.3\",\n\t\t\"@types/jquery\": \"3.3.22\",\n\t\t\"@types/mocha\": \"5.2.5\",\n\t\t\"browserify\": \"16.2.2\",\n\t\t\"chai\": \"4.1.2\",\n\t\t\"cypress\": \"3.1.0\",\n\t\t\"http-server\": \"0.11.1\",\n\t\t\"mocha\": \"5.2.0\",\n\t\t\"nyc\": \"13.0.1\",\n\t\t\"prettier\": \"1.14.2\",\n\t\t\"source-map-support\": \"0.5.9\",\n\t\t\"ts-node\": \"7.0.1\",\n\t\t\"tsconfig-paths\": \"3.6.0\",\n\t\t\"tslint\": \"5.11.0\",\n\t\t\"tslint-config-prettier\": \"1.15.0\",\n\t\t\"tslint-immutable\": \"4.7.0\",\n\t\t\"typescript\": \"3.0.3\",\n\t\t\"uglify-es\": \"3.3.9\",\n\t\t\"wait-on\": \"3.0.1\"\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-elements/scripts/prestart.sh",
    "content": "read -r -p $'\\e[96mDo you want to build Lisk Elements first? [y/N]\\e[0m ' should_build\nif [[ $should_build =~ ^[Yy]$ ]]\nthen\n\tnpm run build:node\nfi\n"
  },
  {
    "path": "packages/lisk-elements/scripts/start.sh",
    "content": "node -i -e \"global.lisk = require('./dist-node').default; console.log('\\\\x1b[34m', 'The global \\`lisk\\` was initialised', '\\\\x1b[0m')\"\n"
  },
  {
    "path": "packages/lisk-elements/src/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { APIClient } from '@liskhq/lisk-api-client';\nimport * as constants from '@liskhq/lisk-constants';\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport * as passphrase from '@liskhq/lisk-passphrase';\nimport * as transaction from '@liskhq/lisk-transactions';\n\nexport { APIClient, constants, cryptography, passphrase, transaction };\n"
  },
  {
    "path": "packages/lisk-elements/test/_setup.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport 'chai/register-expect';\n\nprocess.env.NODE_ENV = 'test';\n"
  },
  {
    "path": "packages/lisk-elements/test/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport {\n\tAPIClient,\n\tconstants,\n\tcryptography,\n\tpassphrase,\n\ttransaction,\n} from '../src';\n\ndescribe('lisk-elements', () => {\n\tit('APIClient should be a function', () => {\n\t\treturn expect(APIClient).to.be.a('function');\n\t});\n\n\tit('constants should be an object', () => {\n\t\treturn expect(constants).to.be.an('object');\n\t});\n\n\tit('cryptography should be an object', () => {\n\t\treturn expect(cryptography).to.be.an('object');\n\t});\n\n\tit('passphrase should be an object', () => {\n\t\treturn expect(passphrase).to.be.an('object');\n\t});\n\n\tit('transaction should be an object', () => {\n\t\treturn expect(transaction).to.be.an('object');\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-passphrase/LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    {one line to give the program's name and a brief idea of what it does.}\n    Copyright (C) {year}  {name of author}\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    {project}  Copyright (C) {year}  {fullname}\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "packages/lisk-passphrase/README.md",
    "content": "# @liskhq/lisk-passphrase\n\n@liskhq/lisk-passphrase is containing mnemonic passphrase helpers for use with Lisk-related software\n\n## Installation\n\n```sh\n$ npm install --save @liskhq/lisk-passphrase\n```\n\n## License\n\nCopyright © 2016-2018 Lisk Foundation\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the [GNU General Public License](https://github.com/LiskHQ/lisk-elements/tree/master/LICENSE) along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n***\n\nThis program also incorporates work previously released with lisk-js `v0.5.2` (and earlier) versions under the [MIT License](https://opensource.org/licenses/MIT). To comply with the requirements of that license, the following permission notice, applicable to those parts of the code only, is included below:\n\nCopyright © 2016-2017 Lisk Foundation\n\nCopyright © 2015 Crypti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[Lisk Core GitHub]: https://github.com/LiskHQ/lisk\n[Lisk documentation site]: https://lisk.io/documentation/lisk-elements\n"
  },
  {
    "path": "packages/lisk-passphrase/package.json",
    "content": "{\n\t\"name\": \"@liskhq/lisk-passphrase\",\n\t\"version\": \"2.0.0\",\n\t\"description\": \"Mnemonic passphrase helpers for use with Lisk-related software\",\n\t\"author\": \"Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>\",\n\t\"license\": \"GPL-3.0\",\n\t\"keywords\": [\n\t\t\"lisk\",\n\t\t\"blockchain\"\n\t],\n\t\"homepage\": \"https://github.com/LiskHQ/lisk-elements/tree/master/packages/lisk-passphrase#readme\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/LiskHQ/lisk-elements.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/LiskHQ/lisk-elements/issues\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=8.10 <=10\",\n\t\t\"npm\": \">=5\"\n\t},\n\t\"main\": \"dist-node/index.js\",\n\t\"scripts\": {\n\t\t\"transpile\": \"tsc\",\n\t\t\"transpile:browsertest\": \"tsc -p tsconfig.browsertest.json\",\n\t\t\"browserify\": \"browserify ./dist-node/index.js -o ./dist-browser/index.js -s liskPassphrase\",\n\t\t\"browserify:browsertest\": \"browserify ./browsertest.build/test/*.js -o ./browsertest.build/browsertest.js -s liskPassphrase\",\n\t\t\"uglify\": \"uglifyjs -nm -o ./dist-browser/index.min.js ./dist-browser/index.js\",\n\t\t\"uglify:browsertest\": \"uglifyjs -o ./browsertest.build/browsertest.min.js ./browsertest.build/browsertest.js\",\n\t\t\"clean\": \"./scripts/clean.sh\",\n\t\t\"format\": \"prettier --write \\\"*.{ts,js,json}\\\" \\\"{src,test}/**/*.{ts,js,json}\\\"\",\n\t\t\"lint\": \"tslint --format verbose --project .\",\n\t\t\"lint:fix\": \"npm run lint -- --fix\",\n\t\t\"test\": \"TS_NODE_PROJECT=./test/tsconfig.json nyc mocha test/**/*.ts\",\n\t\t\"test:watch\": \"npm test -- --watch\",\n\t\t\"test:watch:min\": \"npm run test:watch -- --reporter=min\",\n\t\t\"test:node\": \"npm run build:check\",\n\t\t\"serve:start\": \"http-server -p 11544 ./browsertest &\",\n\t\t\"serve:stop\": \"kill $(lsof -t -i:11544) || true\",\n\t\t\"pretest:browser\": \"npm run serve:stop && npm run build:browsertest && npm run serve:start\",\n\t\t\"test:browser\": \"wait-on http://localhost:11544 && cypress run --config baseUrl=http://localhost:11544 --env ROOT_DIR=\\\"${PWD##*/}\\\"\",\n\t\t\"posttest:browser\": \"npm run serve:stop\",\n\t\t\"cover\": \"if [ -z $JENKINS_HOME ]; then npm run cover:local; else npm run cover:ci; fi\",\n\t\t\"cover:base\": \"nyc report\",\n\t\t\"cover:local\": \"npm run cover:base -- --reporter=html --reporter=text\",\n\t\t\"cover:ci\": \"npm run cover:base -- --reporter=text\",\n\t\t\"build:browsertest\": \"npm run transpile:browsertest && npm run browserify:browsertest && npm run uglify:browsertest\",\n\t\t\"postbuild:browsertest\": \"rm -r browsertest.build/src browsertest.build/test\",\n\t\t\"prebuild:node\": \"rm -r dist-node/* || mkdir dist-node || true\",\n\t\t\"build:node\": \"npm run transpile\",\n\t\t\"prebuild:browser\": \"rm ./dist-browser/index.js ./dist-browser/index.min.js || true\",\n\t\t\"build:browser\": \"npm run build:node && npm run browserify && npm run uglify\",\n\t\t\"prebuild\": \"npm run prebuild:browser\",\n\t\t\"build\": \"npm run build:browser\",\n\t\t\"build:check\": \"node -e \\\"require('./dist-node')\\\"\",\n\t\t\"prepublishOnly\": \"npm run lint && npm test && npm run build && npm run build:check\"\n\t},\n\t\"dependencies\": {\n\t\t\"@types/bip39\": \"2.4.0\",\n\t\t\"@types/node\": \"10.10.1\",\n\t\t\"bip39\": \"2.5.0\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@types/chai\": \"4.1.5\",\n\t\t\"@types/expect\": \"1.20.3\",\n\t\t\"@types/jquery\": \"3.3.9\",\n\t\t\"@types/mocha\": \"5.2.5\",\n\t\t\"browserify\": \"16.2.2\",\n\t\t\"chai\": \"4.1.2\",\n\t\t\"cypress\": \"3.1.0\",\n\t\t\"http-server\": \"0.11.1\",\n\t\t\"mocha\": \"5.2.0\",\n\t\t\"nyc\": \"13.0.1\",\n\t\t\"prettier\": \"1.14.2\",\n\t\t\"source-map-support\": \"0.5.9\",\n\t\t\"ts-node\": \"7.0.1\",\n\t\t\"tsconfig-paths\": \"3.6.0\",\n\t\t\"tslint\": \"5.11.0\",\n\t\t\"tslint-config-prettier\": \"1.15.0\",\n\t\t\"tslint-immutable\": \"4.7.0\",\n\t\t\"typescript\": \"3.0.3\",\n\t\t\"uglify-es\": \"3.3.9\",\n\t\t\"wait-on\": \"3.0.1\"\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-passphrase/src/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport Mnemonic from 'bip39';\nimport * as validation from './validation';\n\nexport { Mnemonic, validation };\n"
  },
  {
    "path": "packages/lisk-passphrase/src/validation.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport Mnemonic from 'bip39';\n\ninterface PassphraseRegularExpression {\n\treadonly uppercaseRegExp: RegExp;\n\treadonly whitespaceRegExp: RegExp;\n}\ninterface PassphraseError {\n\treadonly actual: number | boolean | string;\n\treadonly code: string;\n\treadonly expected: number | boolean | string;\n\treadonly location?: ReadonlyArray<number>;\n\treadonly message: string;\n}\n\nconst passphraseRegularExpression: PassphraseRegularExpression = {\n\tuppercaseRegExp: /[A-Z]/g,\n\twhitespaceRegExp: /\\s/g,\n};\n\nexport const countPassphraseWhitespaces = (passphrase: string): number => {\n\tconst whitespaceMatches = passphrase.match(\n\t\tpassphraseRegularExpression.whitespaceRegExp,\n\t);\n\n\treturn whitespaceMatches !== null ? whitespaceMatches.length : 0;\n};\n\nexport const countPassphraseWords = (passphrase: string): number =>\n\tpassphrase.split(' ').filter(Boolean).length;\n\nexport const countUppercaseCharacters = (passphrase: string): number => {\n\tconst uppercaseCharacterMatches = passphrase.match(\n\t\tpassphraseRegularExpression.uppercaseRegExp,\n\t);\n\n\treturn uppercaseCharacterMatches !== null\n\t\t? uppercaseCharacterMatches.length\n\t\t: 0;\n};\n\nexport const locateUppercaseCharacters = (\n\tpassphrase: string,\n): ReadonlyArray<number> =>\n\tpassphrase\n\t\t.split('')\n\t\t.reduce(\n\t\t\t(\n\t\t\t\tupperCaseIndexes: ReadonlyArray<number>,\n\t\t\t\tcharacter: string,\n\t\t\t\tindex: number,\n\t\t\t) => {\n\t\t\t\tif (\n\t\t\t\t\tcharacter.match(passphraseRegularExpression.uppercaseRegExp) !== null\n\t\t\t\t) {\n\t\t\t\t\treturn [...upperCaseIndexes, index];\n\t\t\t\t}\n\n\t\t\t\treturn upperCaseIndexes;\n\t\t\t},\n\t\t\t[],\n\t\t);\n\nexport const locateConsecutiveWhitespaces = (\n\tpassphrase: string,\n): ReadonlyArray<number> =>\n\tpassphrase\n\t\t.split('')\n\t\t.reduce(\n\t\t\t(\n\t\t\t\twhitespaceIndexes: ReadonlyArray<number>,\n\t\t\t\tcharacter: string,\n\t\t\t\tindex: number,\n\t\t\t) => {\n\t\t\t\tif (\n\t\t\t\t\tindex === 0 &&\n\t\t\t\t\tcharacter.match(passphraseRegularExpression.whitespaceRegExp) !== null\n\t\t\t\t) {\n\t\t\t\t\treturn [...whitespaceIndexes, index];\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\tindex !== passphrase.length - 1 &&\n\t\t\t\t\tcharacter.match(passphraseRegularExpression.whitespaceRegExp) !==\n\t\t\t\t\t\tnull &&\n\t\t\t\t\tpassphrase\n\t\t\t\t\t\t.split('')\n\t\t\t\t\t\t[index - 1].match(passphraseRegularExpression.whitespaceRegExp) !==\n\t\t\t\t\t\tnull\n\t\t\t\t) {\n\t\t\t\t\treturn [...whitespaceIndexes, index];\n\t\t\t\t}\n\t\t\t\tif (\n\t\t\t\t\tindex === passphrase.length - 1 &&\n\t\t\t\t\tcharacter.match(passphraseRegularExpression.whitespaceRegExp) !== null\n\t\t\t\t) {\n\t\t\t\t\treturn [...whitespaceIndexes, index];\n\t\t\t\t}\n\n\t\t\t\treturn whitespaceIndexes;\n\t\t\t},\n\t\t\t[],\n\t\t);\n\nexport const getPassphraseValidationErrors = (\n\tpassphrase: string,\n\twordlists?: ReadonlyArray<string>,\n\texpectedWords: number = 12,\n): ReadonlyArray<PassphraseError> => {\n\tconst expectedWhitespaces = expectedWords - 1;\n\tconst expectedUppercaseCharacterCount = 0;\n\tconst wordsInPassphrase = countPassphraseWords(passphrase);\n\tconst whiteSpacesInPassphrase = countPassphraseWhitespaces(passphrase);\n\tconst uppercaseCharacterInPassphrase = countUppercaseCharacters(passphrase);\n\tconst passphraseWordError: PassphraseError = {\n\t\tactual: wordsInPassphrase,\n\t\tcode: 'INVALID_AMOUNT_OF_WORDS',\n\t\texpected: expectedWords,\n\t\tmessage: `Passphrase contains ${wordsInPassphrase} words instead of expected ${expectedWords}. Please check the passphrase.`,\n\t};\n\tconst whiteSpaceError: PassphraseError = {\n\t\tactual: whiteSpacesInPassphrase,\n\t\tcode: 'INVALID_AMOUNT_OF_WHITESPACES',\n\t\texpected: expectedWhitespaces,\n\t\tlocation: locateConsecutiveWhitespaces(passphrase),\n\t\tmessage: `Passphrase contains ${whiteSpacesInPassphrase} whitespaces instead of expected ${expectedWhitespaces}. Please check the passphrase.`,\n\t};\n\tconst uppercaseCharacterError: PassphraseError = {\n\t\tactual: uppercaseCharacterInPassphrase,\n\t\tcode: 'INVALID_AMOUNT_OF_UPPERCASE_CHARACTER',\n\t\texpected: expectedUppercaseCharacterCount,\n\t\tlocation: locateUppercaseCharacters(passphrase),\n\t\tmessage: `Passphrase contains ${uppercaseCharacterInPassphrase} uppercase character instead of expected ${expectedUppercaseCharacterCount}. Please check the passphrase.`,\n\t};\n\tconst validationError: PassphraseError = {\n\t\tactual: false,\n\t\tcode: 'INVALID_MNEMONIC',\n\t\texpected: true,\n\t\tmessage:\n\t\t\t'Passphrase is not a valid mnemonic passphrase. Please check the passphrase.',\n\t};\n\n\tconst finalWordList =\n\t\twordlists !== undefined ? [...wordlists] : Mnemonic.wordlists.english;\n\n\treturn [\n\t\tpassphraseWordError,\n\t\twhiteSpaceError,\n\t\tuppercaseCharacterError,\n\t\tvalidationError,\n\t].reduce(\n\t\t(errorArray: ReadonlyArray<PassphraseError>, error: PassphraseError) => {\n\t\t\tif (\n\t\t\t\terror.code === passphraseWordError.code &&\n\t\t\t\twordsInPassphrase !== expectedWords\n\t\t\t) {\n\t\t\t\treturn [...errorArray, error];\n\t\t\t}\n\t\t\tif (\n\t\t\t\terror.code === whiteSpaceError.code &&\n\t\t\t\twhiteSpacesInPassphrase !== expectedWhitespaces\n\t\t\t) {\n\t\t\t\treturn [...errorArray, error];\n\t\t\t}\n\t\t\tif (\n\t\t\t\terror.code === uppercaseCharacterError.code &&\n\t\t\t\tuppercaseCharacterInPassphrase !== expectedUppercaseCharacterCount\n\t\t\t) {\n\t\t\t\treturn [...errorArray, error];\n\t\t\t}\n\t\t\tif (\n\t\t\t\terror.code === validationError.code &&\n\t\t\t\t!Mnemonic.validateMnemonic(passphrase, finalWordList)\n\t\t\t) {\n\t\t\t\treturn [...errorArray, error];\n\t\t\t}\n\n\t\t\treturn errorArray;\n\t\t},\n\t\t[],\n\t);\n};\n"
  },
  {
    "path": "packages/lisk-passphrase/test/_setup.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { Assertion } from 'chai';\n\nprocess.env.NODE_ENV = 'test';\n\nAssertion.addProperty('hexString', function handleAssert(\n\tthis: Chai.ChaiStatic,\n) {\n\tconst actual = this._obj;\n\n\tnew Assertion(actual).to.be.a('string');\n\n\tconst expected = Buffer.from(actual, 'hex').toString('hex');\n\tthis.assert(\n\t\texpected === actual,\n\t\t'expected #{this} to be a hexString',\n\t\t'expected #{this} not to be a hexString',\n\t);\n});\n\nAssertion.addProperty('integer', function handleAssert(this: Chai.ChaiStatic) {\n\tconst actual = this._obj;\n\n\tnew Assertion(actual).to.be.a('number');\n\n\tconst expected = parseInt(actual, 10);\n\tthis.assert(\n\t\tactual === expected,\n\t\t'expected #{this} to be an integer',\n\t\t'expected #{this} not to be an integer',\n\t);\n});\n"
  },
  {
    "path": "packages/lisk-passphrase/test/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport * as passphrase from '../src';\n\ndescribe('passphrase index.js', () => {\n\tit('should export an object', () => {\n\t\treturn expect(passphrase).to.be.an('object');\n\t});\n\n\tdescribe('menmonic module', () => {\n\t\tit('should have the BIP39 Mnemonic module', () => {\n\t\t\treturn expect(passphrase.Mnemonic).to.be.ok;\n\t\t});\n\t});\n\n\tdescribe('validation module', () => {\n\t\tit('should have the validation module', () => {\n\t\t\treturn expect(passphrase.validation).to.be.ok;\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-passphrase/test/validation.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport Mnemonic from 'bip39';\nimport { expect } from 'chai';\nimport {\n\tcountPassphraseWhitespaces,\n\tcountPassphraseWords,\n\tcountUppercaseCharacters,\n\tgetPassphraseValidationErrors,\n\tlocateUppercaseCharacters,\n\tlocateConsecutiveWhitespaces,\n} from '../src/validation';\n\n/* tslint:disable: no-magic-numbers */\ndescribe('passphrase validation', () => {\n\tdescribe('countPassphraseWhitespaces', () => {\n\t\tdescribe('given a valid passphrase', () => {\n\t\t\tconst expectedAmountOfWhitespaces = 11;\n\t\t\tconst passphrase =\n\t\t\t\t'model actor shallow eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should return the expected amount of whitespaces', () => {\n\t\t\t\treturn expect(countPassphraseWhitespaces(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWhitespaces,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with an extra whitespace at the end', () => {\n\t\t\tconst expectedAmountOfWhitespaces = 12;\n\t\t\tconst passphrase =\n\t\t\t\t'model actor shallow eight glue upper seat lobster reason label enlist bridge ';\n\n\t\t\tit('should return the expected amount of whitespaces', () => {\n\t\t\t\treturn expect(countPassphraseWhitespaces(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWhitespaces,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with an extra whitespace at the beginning', () => {\n\t\t\tconst expectedAmountOfWhitespaces = 12;\n\t\t\tconst passphrase =\n\t\t\t\t' model actor shallow eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should return the expected amount of whitespaces', () => {\n\t\t\t\treturn expect(countPassphraseWhitespaces(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWhitespaces,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with extra whitespaces between the first words', () => {\n\t\t\tconst expectedAmountOfWhitespaces = 12;\n\t\t\tconst passphrase =\n\t\t\t\t'model  actor shallow eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should return the expected amount of whitespaces', () => {\n\t\t\t\treturn expect(countPassphraseWhitespaces(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWhitespaces,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with extra whitespaces between all words', () => {\n\t\t\tconst expectedAmountOfWhitespaces = 22;\n\t\t\tconst passphrase =\n\t\t\t\t'model  actor  shallow  eight  glue  upper  seat  lobster  reason  label  enlist  bridge';\n\n\t\t\tit('should return the expected amount of whitespaces', () => {\n\t\t\t\treturn expect(countPassphraseWhitespaces(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWhitespaces,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with tab in the beginning', () => {\n\t\t\tconst expectedAmountOfWhitespaces = 12;\n\t\t\tconst passphrase =\n\t\t\t\t'\\tmodel actor shallow eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should return the expected amount of whitespaces', () => {\n\t\t\t\treturn expect(countPassphraseWhitespaces(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWhitespaces,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with vertical tab in the beginning', () => {\n\t\t\tconst expectedAmountOfWhitespaces = 12;\n\t\t\tconst passphrase =\n\t\t\t\t'\\vmodel actor shallow eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should return the expected amount of whitespaces', () => {\n\t\t\t\treturn expect(countPassphraseWhitespaces(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWhitespaces,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with form feed in the beginning', () => {\n\t\t\tconst expectedAmountOfWhitespaces = 12;\n\t\t\tconst passphrase =\n\t\t\t\t'\\fmodel actor shallow eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should return the expected amount of whitespaces', () => {\n\t\t\t\treturn expect(countPassphraseWhitespaces(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWhitespaces,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with nonbreaking space in the beginning', () => {\n\t\t\tconst expectedAmountOfWhitespaces = 12;\n\t\t\tconst passphrase =\n\t\t\t\t'\\u00A0model actor shallow eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should return the expected amount of whitespaces', () => {\n\t\t\t\treturn expect(countPassphraseWhitespaces(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWhitespaces,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with byte order mark in the beginning', () => {\n\t\t\tconst expectedAmountOfWhitespaces = 12;\n\t\t\tconst passphrase =\n\t\t\t\t'\\uFEFFmodel actor shallow eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should return the expected amount of whitespaces', () => {\n\t\t\t\treturn expect(countPassphraseWhitespaces(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWhitespaces,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with no whitespaces', () => {\n\t\t\tconst expectedAmountOfWhitespaces = 0;\n\t\t\tconst passphrase =\n\t\t\t\t'modelactorshalloweightglueupperseatlobsterreasonlabelenlistbridge';\n\n\t\t\tit('should return the expected amount of whitespaces', () => {\n\t\t\t\treturn expect(countPassphraseWhitespaces(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWhitespaces,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('countPassphraseWords', () => {\n\t\tdescribe('given a valid passphrase', () => {\n\t\t\tconst expectedAmountOfWords = 12;\n\t\t\tconst passphrase =\n\t\t\t\t'model actor shallow eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should return the amount of words', () => {\n\t\t\t\treturn expect(countPassphraseWords(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWords,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with 13 words', () => {\n\t\t\tconst expectedAmountOfWords = 13;\n\t\t\tconst passphrase =\n\t\t\t\t'model actor shallow eight glue upper seat lobster reason label enlist bridge model';\n\n\t\t\tit('should return the amount of words', () => {\n\t\t\t\treturn expect(countPassphraseWords(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWords,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with 9 words', () => {\n\t\t\tconst expectedAmountOfWords = 9;\n\t\t\tconst passphrase =\n\t\t\t\t'model actor shallow eight glue upper seat lobster reason';\n\n\t\t\tit('should return the amount of words', () => {\n\t\t\t\treturn expect(countPassphraseWords(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWords,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with 12 words and extra whitespaces', () => {\n\t\t\tconst expectedAmountOfWords = 12;\n\t\t\tconst passphrase =\n\t\t\t\t'model  actor  shallow  eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should ignore the whitespaces and return the amount of words', () => {\n\t\t\t\treturn expect(countPassphraseWords(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWords,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with no words but whitespaces', () => {\n\t\t\tconst expectedAmountOfWords = 0;\n\t\t\tconst passphrase = '     ';\n\n\t\t\tit('should ignore the whitespaces and return the amount of words', () => {\n\t\t\t\treturn expect(countPassphraseWords(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWords,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given an empty string passphrase', () => {\n\t\t\tconst expectedAmountOfWords = 0;\n\t\t\tconst passphrase = '';\n\n\t\t\tit('should return the amount of words', () => {\n\t\t\t\treturn expect(countPassphraseWords(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfWords,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('countUppercaseCharacters', () => {\n\t\tdescribe('given a passphrase without uppercase character', () => {\n\t\t\tconst expectedAmountUppercaseCharacter = 0;\n\t\t\tconst passphrase =\n\t\t\t\t'model actor shallow eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should return the number of uppercase characters', () => {\n\t\t\t\tconst uppercased = countUppercaseCharacters(passphrase);\n\n\t\t\t\treturn expect(uppercased).to.be.equal(expectedAmountUppercaseCharacter);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with uppercase character', () => {\n\t\t\tconst expectedAmountOfCapitalCharacters = 4;\n\t\t\tconst passphrase =\n\t\t\t\t'Model Actor shallow eight glue upPer seat lobSter reason label enlist bridge';\n\n\t\t\tit('should return the amount of uppercase character', () => {\n\t\t\t\tconst uppercased = countUppercaseCharacters(passphrase);\n\n\t\t\t\treturn expect(uppercased).to.be.equal(\n\t\t\t\t\texpectedAmountOfCapitalCharacters,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with all uppercase character', () => {\n\t\t\tconst expectedAmountOfCapitalCharacters = 65;\n\t\t\tconst passphrase =\n\t\t\t\t'MODEL ACTOR SHALLOW EIGHT GLUE UPPER SEAT LOBSTER REASON LABEL ENLIST BRIDGE';\n\n\t\t\tit('should return the amount of uppercase character', () => {\n\t\t\t\treturn expect(countUppercaseCharacters(passphrase)).to.be.equal(\n\t\t\t\t\texpectedAmountOfCapitalCharacters,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('locateUppercaseCharacters', () => {\n\t\tdescribe('given a string without uppercase character', () => {\n\t\t\tconst testString = 'a string without uppercase character';\n\t\t\tit('should return an empty array', () => {\n\t\t\t\treturn expect(locateUppercaseCharacters(testString)).to.be.eql([]);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a string with uppercase character', () => {\n\t\t\tconst testString = 'a String with SOME uppercase characteR';\n\t\t\tconst uppercaseCharacters = [2, 14, 15, 16, 17, 37];\n\t\t\tit('should return the array with the location of the uppercase character', () => {\n\t\t\t\treturn expect(locateUppercaseCharacters(testString)).to.be.eql(\n\t\t\t\t\tuppercaseCharacters,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('locateConsecutiveWhitespaces', () => {\n\t\tdescribe('given a string without whitespaces', () => {\n\t\t\tconst testString = 'abcdefghijklkmnop';\n\t\t\tit('should return an empty array', () => {\n\t\t\t\treturn expect(locateConsecutiveWhitespaces(testString)).to.be.eql([]);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a string with whitespaces', () => {\n\t\t\tconst testString = 'abc defghijk lkmnop';\n\t\t\tit('should return an empty array', () => {\n\t\t\t\treturn expect(locateConsecutiveWhitespaces(testString)).to.be.eql([]);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a string with a whitespace in the beginning', () => {\n\t\t\tconst testString = ' abc defghijk lkmnop';\n\t\t\tconst expectedWhitespaceLocation = [0];\n\t\t\tit('should return the array with the location of the whitespace', () => {\n\t\t\t\treturn expect(locateConsecutiveWhitespaces(testString)).to.be.eql(\n\t\t\t\t\texpectedWhitespaceLocation,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a string with a whitespace in the end', () => {\n\t\t\tconst testString = 'abc defghijk lkmnop ';\n\t\t\tconst expectedWhitespaceLocation = [19];\n\t\t\tit('should return the array with the location of the whitespace', () => {\n\t\t\t\treturn expect(locateConsecutiveWhitespaces(testString)).to.be.eql(\n\t\t\t\t\texpectedWhitespaceLocation,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a string with extra whitespaces', () => {\n\t\t\tconst testString = 'abc  defghijk  lkmnop ';\n\t\t\tconst expectedWhitespaceLocation = [4, 14, 21];\n\t\t\tit('should return the array with the location of the whitespaces', () => {\n\t\t\t\treturn expect(locateConsecutiveWhitespaces(testString)).to.be.eql(\n\t\t\t\t\texpectedWhitespaceLocation,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a string with extra whitespaces with special characters', () => {\n\t\t\tconst testString = 'abc  defghijk\\t \\nlkmnop \\u00A0';\n\t\t\tconst expectedWhitespaceLocation = [4, 14, 15, 23];\n\t\t\tit('should return the array with the location of the whitespaces', () => {\n\t\t\t\treturn expect(locateConsecutiveWhitespaces(testString)).to.be.eql(\n\t\t\t\t\texpectedWhitespaceLocation,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('getPassphraseValidationErrors', () => {\n\t\tdescribe('given a valid passphrase', () => {\n\t\t\tconst passphrase =\n\t\t\t\t'model actor shallow eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should return an empty array', () => {\n\t\t\t\treturn expect(getPassphraseValidationErrors(passphrase)).to.be.eql([]);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with valid 15 words passphrase', () => {\n\t\t\tconst passphrase =\n\t\t\t\t'post dumb recycle buddy round normal scrap better people corn crystal again never shrimp kidney';\n\n\t\t\tit('should return an array with the errors when validating with default expectedWords', () => {\n\t\t\t\tconst errors = [\n\t\t\t\t\t{\n\t\t\t\t\t\tactual: 15,\n\t\t\t\t\t\tcode: 'INVALID_AMOUNT_OF_WORDS',\n\t\t\t\t\t\texpected: 12,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'Passphrase contains 15 words instead of expected 12. Please check the passphrase.',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tactual: 14,\n\t\t\t\t\t\tcode: 'INVALID_AMOUNT_OF_WHITESPACES',\n\t\t\t\t\t\texpected: 11,\n\t\t\t\t\t\tlocation: [],\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'Passphrase contains 14 whitespaces instead of expected 11. Please check the passphrase.',\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t\treturn expect(getPassphraseValidationErrors(passphrase)).to.be.eql(\n\t\t\t\t\terrors,\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should return an array with the errors when validating with lower expectedWords', () => {\n\t\t\t\tconst errors = [\n\t\t\t\t\t{\n\t\t\t\t\t\tactual: 15,\n\t\t\t\t\t\tcode: 'INVALID_AMOUNT_OF_WORDS',\n\t\t\t\t\t\texpected: 12,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'Passphrase contains 15 words instead of expected 12. Please check the passphrase.',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tactual: 14,\n\t\t\t\t\t\tcode: 'INVALID_AMOUNT_OF_WHITESPACES',\n\t\t\t\t\t\texpected: 11,\n\t\t\t\t\t\tlocation: [],\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'Passphrase contains 14 whitespaces instead of expected 11. Please check the passphrase.',\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t\treturn expect(\n\t\t\t\t\tgetPassphraseValidationErrors(passphrase, undefined, 12),\n\t\t\t\t).to.be.eql(errors);\n\t\t\t});\n\n\t\t\tit('should return an array with the errors when validating with higher expectedWords', () => {\n\t\t\t\tconst errors = [\n\t\t\t\t\t{\n\t\t\t\t\t\tactual: 15,\n\t\t\t\t\t\tcode: 'INVALID_AMOUNT_OF_WORDS',\n\t\t\t\t\t\texpected: 18,\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'Passphrase contains 15 words instead of expected 18. Please check the passphrase.',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tactual: 14,\n\t\t\t\t\t\tcode: 'INVALID_AMOUNT_OF_WHITESPACES',\n\t\t\t\t\t\texpected: 17,\n\t\t\t\t\t\tlocation: [],\n\t\t\t\t\t\tmessage:\n\t\t\t\t\t\t\t'Passphrase contains 14 whitespaces instead of expected 17. Please check the passphrase.',\n\t\t\t\t\t},\n\t\t\t\t];\n\t\t\t\treturn expect(\n\t\t\t\t\tgetPassphraseValidationErrors(\n\t\t\t\t\t\tpassphrase,\n\t\t\t\t\t\tMnemonic.wordlists.english,\n\t\t\t\t\t\t18,\n\t\t\t\t\t),\n\t\t\t\t).to.be.eql(errors);\n\t\t\t});\n\n\t\t\tit('should return an empty array when validating with exact expectedWords', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tgetPassphraseValidationErrors(passphrase, undefined, 15),\n\t\t\t\t).to.be.eql([]);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with an extra whitespace in the beginning', () => {\n\t\t\tconst passphrase =\n\t\t\t\t' model actor shallow eight glue upper seat lobster reason label enlist bridge';\n\t\t\tconst passphraseInvalidMnemonicErrors = [\n\t\t\t\t{\n\t\t\t\t\tactual: 12,\n\t\t\t\t\tcode: 'INVALID_AMOUNT_OF_WHITESPACES',\n\t\t\t\t\texpected: 11,\n\t\t\t\t\tlocation: [0],\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'Passphrase contains 12 whitespaces instead of expected 11. Please check the passphrase.',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tactual: false,\n\t\t\t\t\tcode: 'INVALID_MNEMONIC',\n\t\t\t\t\texpected: true,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'Passphrase is not a valid mnemonic passphrase. Please check the passphrase.',\n\t\t\t\t},\n\t\t\t];\n\n\t\t\tit('should return the array with the errors', () => {\n\t\t\t\treturn expect(getPassphraseValidationErrors(passphrase)).to.be.eql(\n\t\t\t\t\tpassphraseInvalidMnemonicErrors,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with an extra whitespace in the end', () => {\n\t\t\tconst passphrase =\n\t\t\t\t'model actor shallow eight glue upper seat lobster reason label enlist bridge ';\n\t\t\tconst passphraseInvalidMnemonicErrors = [\n\t\t\t\t{\n\t\t\t\t\tactual: 12,\n\t\t\t\t\tcode: 'INVALID_AMOUNT_OF_WHITESPACES',\n\t\t\t\t\texpected: 11,\n\t\t\t\t\tlocation: [76],\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'Passphrase contains 12 whitespaces instead of expected 11. Please check the passphrase.',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tactual: false,\n\t\t\t\t\tcode: 'INVALID_MNEMONIC',\n\t\t\t\t\texpected: true,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'Passphrase is not a valid mnemonic passphrase. Please check the passphrase.',\n\t\t\t\t},\n\t\t\t];\n\n\t\t\tit('should return the array with the errors', () => {\n\t\t\t\treturn expect(getPassphraseValidationErrors(passphrase)).to.be.eql(\n\t\t\t\t\tpassphraseInvalidMnemonicErrors,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with too many whitespaces in between words', () => {\n\t\t\tconst passphrase =\n\t\t\t\t'model actor shallow eight glue  upper seat  lobster reason label enlist bridge';\n\t\t\tconst passphraseInvalidMnemonicErrors = [\n\t\t\t\t{\n\t\t\t\t\tactual: 13,\n\t\t\t\t\tcode: 'INVALID_AMOUNT_OF_WHITESPACES',\n\t\t\t\t\texpected: 11,\n\t\t\t\t\tlocation: [31, 43],\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'Passphrase contains 13 whitespaces instead of expected 11. Please check the passphrase.',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tactual: false,\n\t\t\t\t\tcode: 'INVALID_MNEMONIC',\n\t\t\t\t\texpected: true,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'Passphrase is not a valid mnemonic passphrase. Please check the passphrase.',\n\t\t\t\t},\n\t\t\t];\n\n\t\t\tit('should return the array with the errors', () => {\n\t\t\t\treturn expect(getPassphraseValidationErrors(passphrase)).to.be.eql(\n\t\t\t\t\tpassphraseInvalidMnemonicErrors,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase with uppercase characters', () => {\n\t\t\tconst passphrase =\n\t\t\t\t'modEl actor shallow eight glue upper sEat lobster reaSon label enlist bridge';\n\t\t\tconst passphraseWithUppercaseCharacterErrors = [\n\t\t\t\t{\n\t\t\t\t\tactual: 3,\n\t\t\t\t\tcode: 'INVALID_AMOUNT_OF_UPPERCASE_CHARACTER',\n\t\t\t\t\texpected: 0,\n\t\t\t\t\tlocation: [3, 38, 53],\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'Passphrase contains 3 uppercase character instead of expected 0. Please check the passphrase.',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tactual: false,\n\t\t\t\t\tcode: 'INVALID_MNEMONIC',\n\t\t\t\t\texpected: true,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'Passphrase is not a valid mnemonic passphrase. Please check the passphrase.',\n\t\t\t\t},\n\t\t\t];\n\n\t\t\tit('should return the array with the errors', () => {\n\t\t\t\treturn expect(getPassphraseValidationErrors(passphrase)).to.be.eql(\n\t\t\t\t\tpassphraseWithUppercaseCharacterErrors,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase that is an invalid mnemonic passphrase', () => {\n\t\t\tconst passphrase =\n\t\t\t\t'model actor shallow eight glue upper seat lobster reason label engage bridge';\n\t\t\tconst passphraseInvalidMnemonicError = [\n\t\t\t\t{\n\t\t\t\t\tactual: false,\n\t\t\t\t\tcode: 'INVALID_MNEMONIC',\n\t\t\t\t\texpected: true,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'Passphrase is not a valid mnemonic passphrase. Please check the passphrase.',\n\t\t\t\t},\n\t\t\t];\n\n\t\t\tit('should return the array with the error', () => {\n\t\t\t\treturn expect(getPassphraseValidationErrors(passphrase)).to.be.eql(\n\t\t\t\t\tpassphraseInvalidMnemonicError,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase that uses the correct wordlist for the passphrase', () => {\n\t\t\tconst wordlist = Mnemonic.wordlists.english;\n\t\t\tconst passphrase =\n\t\t\t\t'model actor shallow eight glue upper seat lobster reason label enlist bridge';\n\n\t\t\tit('should return an empty array', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tgetPassphraseValidationErrors(passphrase, wordlist),\n\t\t\t\t).to.be.eql([]);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('given a passphrase that uses a different wordlist for the passphrase', () => {\n\t\t\tconst wordlist = Mnemonic.wordlists.spanish;\n\t\t\tconst passphrase =\n\t\t\t\t'model actor shallow eight glue upper seat lobster reason label enlist bridge';\n\t\t\tconst passphraseInvalidMnemonicError = [\n\t\t\t\t{\n\t\t\t\t\tactual: false,\n\t\t\t\t\tcode: 'INVALID_MNEMONIC',\n\t\t\t\t\texpected: true,\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'Passphrase is not a valid mnemonic passphrase. Please check the passphrase.',\n\t\t\t\t},\n\t\t\t];\n\n\t\t\tit('should return the array with the error', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tgetPassphraseValidationErrors(passphrase, wordlist),\n\t\t\t\t).to.be.eql(passphraseInvalidMnemonicError);\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    {one line to give the program's name and a brief idea of what it does.}\n    Copyright (C) {year}  {name of author}\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    {project}  Copyright (C) {year}  {fullname}\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<http://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "packages/lisk-transactions/README.md",
    "content": "# @liskhq/lisk-transactions\n\n@liskhq/lisk-transactions is containing everything related to transactions according to the Lisk protocol\n\n## Installation\n\n```sh\n$ npm install --save @liskhq/lisk-transactions\n```\n\n## License\n\nCopyright © 2016-2018 Lisk Foundation\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\n\nYou should have received a copy of the [GNU General Public License](https://github.com/LiskHQ/lisk-elements/tree/master/LICENSE) along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n***\n\nThis program also incorporates work previously released with lisk-js `v0.5.2` (and earlier) versions under the [MIT License](https://opensource.org/licenses/MIT). To comply with the requirements of that license, the following permission notice, applicable to those parts of the code only, is included below:\n\nCopyright © 2016-2017 Lisk Foundation\n\nCopyright © 2015 Crypti\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n[Lisk Core GitHub]: https://github.com/LiskHQ/lisk\n[Lisk documentation site]: https://lisk.io/documentation/lisk-elements\n"
  },
  {
    "path": "packages/lisk-transactions/fixtures/invalid_transactions.json",
    "content": "[\n\t{\n\t\t\"type\":4,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"3000000000\",\n\t\t\"recipientId\":null,\n\t\t\"senderPublicKey\":\n\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\":54196079,\n\t\t\"asset\": {\n\t\t\"multisignature\": {\n\t\t\t\t\"min\": 0,\n\t\t\t\t\"lifetime\": 35,\n\t\t\t\t\"keysgroup\": [\n\t\t\t\t\t\"+cac3545e2fa5b9fe4a41a66ce86adbb0322587137e5289b06ba4527673a85574\",\n\t\t\t\t\t\"+09e85edafad8b6e6191e1d989c58c5825b0596d5d5f5598e854eeabdffd2a850\",\n\t\t\t\t\t\"+29d8260d35f110f33d988f6a23d29153c1a344a339894774690fb9b6b6bb494e\",\n\t\t\t\t\t\"+346719e114848b4fbf9839836ebeb066b2898d872aef0dd315594b83d2fca1a2\",\n\t\t\t\t\t\"+01b014d50765d9f705b720d6376c792afca3da4ba2798bc65626a97494579790\"\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t\"signature\": \"5d2acb6cc15f8de7a2531ba6a1e7725d82d07789672605e286f4ff11a19e0fb69034411f99c66267ead9245ceee54977d46a5427bdf651f8277d6908d2fd5e03\",\n\t\t\"id\": \"14026504139568973606\"\n\t},\n\t{\n\t\t\"type\": 4,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"3000000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": {\n\t\t\t\"multisignature\": {\n\t\t\t\t\"min\": 0,\n\t\t\t\t\"lifetime\": 18,\n\t\t\t\t\"keysgroup\": [\n\t\t\t\t\t\"+740834a59435d283fd3fb30ad5d7cbde2550e82471b73abedcffb61eaa6298e4\",\n\t\t\t\t\t\"+9bc8972fb01b70eb4624df5d4d4c7c00a51fd73958c50efaefe55260889aedd6\",\n\t\t\t\t\t\"+66a68de8047bbe788f5ec5fbae6baf84c6438606f4e6fdf91b791113a0506ea6\",\n\t\t\t\t\t\"+5f7c4b9b6f976a400dba8d0cc7f904603ea4ffe1d8702c80576a396037c49970\",\n\t\t\t\t\t\"+4e4a6b5cf7b8840ba521dfae5914f55ec3805c7d5cf25dfbf44fac57f9c5f183\"\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"57b54da646c7567df86fec60aa57a40bfadb6cdc65cccecfc442c822a7b0372f4958a280edd3fc2d83d38e2d3bf922a1da01249c500f0309a9638e941a21c501\",\n\t\t\"id\": \"13916871066741078807\"\n\t},\n\t{\n\t\t\"type\": 6,\n\t\t\"amount\": \"897386\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": { \"inTransfer\": { \"dappId\": \"1000000\" } },\n\t\t\"signature\":\n\t\t\t\"81db12eccf99f92ffc5963383acb0b275777de860e7d2251d1432a1eeb46fb858d41737e68ac5cb61eab5adc7d8f6f6db8905767e997bb445babf6004ab1bb00\",\n\t\t\"id\": \"14834734940279241743\"\n\t},\n\t{\n\t\t\"type\": 7,\n\t\t\"amount\": \"761715\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"outTransfer\": { \"dappId\": \"720987408\", \"transactionId\": \"40486129\" }\n\t\t},\n\t\t\"signature\":\n\t\t\t\"69a84e9a883a8f624cb5dfc80f7d734f0eff9c2d2193f94238a0636b1a56afaeed8261b46de518f9ca7c9efe910628bdce9ff4a78fe86ef1a08a913486142e02\"\n\t},\n\t{\n\t\t\"type\": 6,\n\t\t\"amount\": \"737434\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": { \"inTransfer\": { \"dappId\": \"1000000\" } },\n\t\t\"signature\":\n\t\t\t\"7cb7d1c9f37aa5d753cd241d74b20fcd2a1540b27f7d5628b865b9b0e806eba23a0ca7ed043f73a5a881778c9cabd40ef836e0742226c60389075433b725860d\",\n\t\t\"id\": \"10020668765583935219\"\n\t},\n\t{\n\t\t\"type\": 7,\n\t\t\"amount\": \"646565\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"outTransfer\": { \"dappId\": \"336803878\", \"transactionId\": \"856503447\" }\n\t\t},\n\t\t\"signature\":\n\t\t\t\"caae702b9b12bd423cd2f3c742135b459149fb484f9479551bb0f1374c6f805cf881cb64f52b797770a512bdaaabf8404a22857af6713ac70035f5e9359fb60b\"\n\t},\n\t{\n\t\t\"type\": 6,\n\t\t\"amount\": \"33067\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": { \"inTransfer\": { \"dappId\": \"1000000\" } },\n\t\t\"signature\":\n\t\t\t\"33ce5ae051be0a10ad91ce33ee7636856e53eb0d6dfc3532333bbd11d832d7fa5a7f1cf3a3221625cd4c4c4a743587c5286a0e0166e7c2a4317bb4439f3ff008\",\n\t\t\"id\": \"12483552871112483989\"\n\t},\n\t{\n\t\t\"type\": 7,\n\t\t\"amount\": \"966482\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"outTransfer\": { \"dappId\": \"275792609\", \"transactionId\": \"421790462\" }\n\t\t},\n\t\t\"signature\":\n\t\t\t\"7d4cc20b24d9486a26bd74b14ba24ef1d12381f04434f125e8efaa322c1b3c1cb5c357a3b7c47fb4097fa88a0751360a37c28e6b03890f4955d51fff7948ff05\"\n\t},\n\t{\n\t\t\"type\": 6,\n\t\t\"amount\": \"693810\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": { \"inTransfer\": { \"dappId\": \"1000000\" } },\n\t\t\"signature\":\n\t\t\t\"1fdab67596b6201fc73d741c1d5e0c0b8fa8536ce19fc8625a0cd41db84e97575e862037db1377cdd4b7d2520b0541fe52800117ae5297a42bb10de13b451b02\",\n\t\t\"signSignature\":\n\t\t\t\"839c9397237065c0e676db1687ebf307c261382f34ac0c356d4a009d9f997c2bbeee0d48fa0ccd538543181efee63ce2810e9de144b13c1d5c78e95e8d097008\",\n\t\t\"id\": \"9781155639793361245\"\n\t},\n\t{\n\t\t\"type\": 7,\n\t\t\"amount\": \"476088\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"outTransfer\": { \"dappId\": \"102606108\", \"transactionId\": \"549685977\" }\n\t\t},\n\t\t\"signature\":\n\t\t\t\"01c46d39654e2b7708c998fe813e32f37fe1fe9a3f6547faefcec8743392909f119a8c76a63cce76d2bf9969b7adb80c75d31c72e2f9f98aa6d9ac9418e07e0c\",\n\t\t\"signSignature\":\n\t\t\t\"272815f308cabb04e4d8a817925758dc9d63e97425593c8e344089fead1936e6bcc51d3c49141fc97ea4eb7fbed67cd3f5bb89a979d121e174aaf526d23b210a\"\n\t},\n\t{\n\t\t\"type\": 6,\n\t\t\"amount\": \"166413\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": { \"inTransfer\": { \"dappId\": \"1000000\" } },\n\t\t\"signature\":\n\t\t\t\"f2b1a66d9bd8ae0c1b3404fe397a11bd696e5aea274e6a8d9fea2f976503d006b8ca65484daf2498f854a0c0109b924b653a8d6ba31a568cb70727b7d3472902\",\n\t\t\"id\": \"9501694969515165251\"\n\t},\n\t{\n\t\t\"type\": 7,\n\t\t\"amount\": \"835151\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": {\n\t\t\t\"outTransfer\": { \"dappId\": \"614143983\", \"transactionId\": \"749591467\" }\n\t\t},\n\t\t\"signature\":\n\t\t\t\"646cd6cbe9f385bfa4f914b66a675a77080a3c1093278cfbca16d3d7fbf768350c9a7e270a8e5a72347e2792d3cfc770f3a3bb9ea542c300cba3976f34bd040e\"\n\t},\n\t{\n\t\t\"type\": 6,\n\t\t\"amount\": \"270355\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": { \"inTransfer\": { \"dappId\": \"1000000\" } },\n\t\t\"signature\":\n\t\t\t\"8a22d0b245bccd8f53ea7acd9b137bc3c7ed76a666318e7969aee45e67e75ab552dff73ec7c95c0653c2308691d068499be792d7229507c23ddd6d126a905d00\",\n\t\t\"signSignature\":\n\t\t\t\"a504c8a7ef794b6ec99aa9c914f9e562ce8e18a5797bdc92ff03a7cc479600e3f3d8cd2b3cf478b7006f996d174ceae94297568c27aab3c43c8925c1e760af08\",\n\t\t\"id\": \"4482291724705265307\"\n\t},\n\t{\n\t\t\"type\": 7,\n\t\t\"amount\": \"621696\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": {\n\t\t\t\"outTransfer\": { \"dappId\": \"31057994\", \"transactionId\": \"377678276\" }\n\t\t},\n\t\t\"signature\":\n\t\t\t\"8c9abc118100d6aa016acae15ed4d10ce168b3aab9cc7d25f3bde38f2f198a3fcb729f670bdfeaba1b8e5a73192d3e115fa174e784e224a61439c00f1fef1304\",\n\t\t\"signSignature\":\n\t\t\t\"fdbab8d4029624fc82e372dae3ebc8636142b83e894c5c8c32f1b912a751b894640e0ed514b72ee1c67d8bcf6ee9ea140de7e45e58c849c16598ffe4dbb85b06\"\n\t},\n\t{\n\t\t\"type\": 6,\n\t\t\"amount\": \"825188\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": { \"inTransfer\": { \"dappId\": \"1000000\" } },\n\t\t\"signature\":\n\t\t\t\"ea3a2b7655d2be581f0c08af121ce114f5ffff7b3149727558f8c6775b266c738a7abc8f3fc2baa55d4f445f09ec206996f196a59c5f8502fc36121f9149ed0c\",\n\t\t\"id\": \"6562982313425129534\"\n\t},\n\t{\n\t\t\"type\": 7,\n\t\t\"amount\": \"628348\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": {\n\t\t\t\"outTransfer\": { \"dappId\": \"49615750\", \"transactionId\": \"296407938\" }\n\t\t},\n\t\t\"signature\":\n\t\t\t\"67d0443b82b67d4fc2c287c3241fe44c40f68fc2df14e30d3746e463df2b7533f0cb4b4bca055a3f767d07f81a84c5843ad4b346554bfbe9cb1244a69b345e0d\"\n\t},\n\t{\n\t\t\"type\": 6,\n\t\t\"amount\": \"369464\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": { \"inTransfer\": { \"dappId\": \"1000000\" } },\n\t\t\"signature\":\n\t\t\t\"6042833a4578b512a0dc8451ad4a92aec63d684eb2ba4fd9602b4c7235ec72fac12bda1ff984132f7ec36c440a3f4b9f20c4634169309ed430f4434968fa8b03\",\n\t\t\"id\": \"4907759462496699682\"\n\t},\n\t{\n\t\t\"type\": 7,\n\t\t\"amount\": \"426107\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": {\n\t\t\t\"outTransfer\": { \"dappId\": \"170489289\", \"transactionId\": \"11189562\" }\n\t\t},\n\t\t\"signature\":\n\t\t\t\"fc703ab98d6f25eb9617fab51a22cebdc8e340047c0b600bbf0fb216f9ac73520b10bbc6375ee3eafceb3c459f57dd0b661b4c19d114364cefec6e964bad5b08\"\n\t},\n\t{\n\t\t\"type\": 6,\n\t\t\"amount\": \"405432\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": { \"inTransfer\": { \"dappId\": \"1000000\" } },\n\t\t\"signature\":\n\t\t\t\"cac1442ade22a5ca056fcd157188a54f7f3648513ed1d8bbcd0656d7a0ae8aae1711b008623493f174d6318323e7e99ce7b9033a2f2b63d5fdb0406c598eec07\",\n\t\t\"id\": \"11187309556374500080\"\n\t},\n\t{\n\t\t\"type\": 7,\n\t\t\"amount\": \"728029\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"outTransfer\": { \"dappId\": \"433910011\", \"transactionId\": \"995526027\" }\n\t\t},\n\t\t\"signature\":\n\t\t\t\"e817a3bfe8570d13a7a728bcfd108168e47ab48e748424793dd866f61617f1786fc3908c8eaa20f470ae1e11363f8fdc55d64d8e08d0dbc399cccea38ecacc05\"\n\t},\n\t{\n\t\t\"type\": 6,\n\t\t\"amount\": \"881374\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": { \"inTransfer\": { \"dappId\": \"1000000\" } },\n\t\t\"signature\":\n\t\t\t\"f9facd4dd0b278e3fdca44e6b5527ff4d71f65fb05d1a993cc094f7a6e08118d96ad9103c7577c9efff41d3deec08ffb06346ab27aeff800d499785b53bea40d\",\n\t\t\"signSignature\":\n\t\t\t\"ddbe2671cb80cf478b581772242e20d49b8f88445928f8c685ea06a83733a7c7abec31c53f52f1962126abc6e1e03b2c8c7b881f6a3d6808496eb500498b730b\",\n\t\t\"id\": \"10748675444711410396\"\n\t},\n\t{\n\t\t\"type\": 7,\n\t\t\"amount\": \"370999\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": {\n\t\t\t\"outTransfer\": { \"dappId\": \"763580659\", \"transactionId\": \"89998498\" }\n\t\t},\n\t\t\"signature\":\n\t\t\t\"8041323c405e23fc8ebaaf7ded1a61e1922c29643d6ab5cf536655fb69380d7e64a158198a21cd34faa06ed1777321f403421fe59fc1b4c40087c19ab47eda0c\",\n\t\t\"signSignature\":\n\t\t\t\"177664c1e4afc88462f44f8af6192d36d435bf9457d2466e9ced8b52d44eb740be03232a6a9e0467762cf336bbd155fba04dd0a74cb7a6938ee976453bf6070b\"\n\t}\n]\n"
  },
  {
    "path": "packages/lisk-transactions/fixtures/transactions.json",
    "content": "[\n\t{\n\t\t\"type\": 1,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54316324,\n\t\t\"asset\": {\n\t\t\t\"signature\": {\n\t\t\t\t\"publicKey\":\n\t\t\t\t\t\"f9666bfed9ef2ff52a04408f22f2bfffaa81384c9433463697330224f10032a4\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"69d0c7bc50b82465e2b0885cebc422aa9cd575050dc89905e22a6e2cc88802935c6809a59a2daa04ca99623a6fef76b7d03215ed7f401b74ef5301b12bfe2002\",\n\t\t\"id\": \"6998015087494860094\"\n\t},\n\t{\n\t\t\"type\": 0,\n\t\t\"amount\": \"4008489300000000\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"timestamp\": 54196076,\n\t\t\"asset\": {},\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"signature\":\n\t\t\t\"1518a69983e348359f62a8e740f6f5f08c0c3cad651e5116bf991bc5a4b4cfb8bf8c033a86e30f596fac80142df5a4121400ac2e9307614a143ffd75cc07c20b\",\n\t\t\"id\": \"7507990258936015021\"\n\t},\n\t{\n\t\t\"type\": 3,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"100000000\",\n\t\t\"recipientId\": \"16313739661670634666L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196076,\n\t\t\"asset\": {\n\t\t\t\"votes\": [\n\t\t\t\t\"+0d720b72d179bdd07621cf0b6b68fd23a96777e0833f35b9d22b873c80f9b336\",\n\t\t\t\t\"+44b58b4a9d8d0af057ada7c90bb90e30be47326c8a102c8bc6604e98ca93d1ef\",\n\t\t\t\t\"+a8bde4a93381d7cb756611262af04844fb0a182fb9de515a3c4f068daa05c695\",\n\t\t\t\t\"+7c5c08669e9d1366bfe6ae17ca6a054e92610358e2dc82865a826eac738fdb6a\",\n\t\t\t\t\"-7742a72b4eb62bd994e2f1e4b44637fbce9fc1fa900080636b2f7eff40872fa6\"\n\t\t\t]\n\t\t},\n\t\t\"signature\":\n\t\t\t\"1d9b94e30ff2206b9de6406d9d221c751af00a300ea26fa479da3dd3bb1266d4461f8ae19a08b42ecf6648a86dc6969e965f8a617cd18c1d1ce6126d683e8605\",\n\t\t\"id\": \"6128439024328469721\"\n\t},\n\t{\n\t\t\"type\": 2,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196076,\n\t\t\"asset\": {\n\t\t\t\"delegate\": {\n\t\t\t\t\"username\": \"RLI0\",\n\t\t\t\t\"publicKey\":\n\t\t\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"3147b031c6fa71cbfc3f8a74b9cd5ed85b56b01f00e9df13244c354d43bfa90ec89dd2fe66d8e5107233073b5aac387cb54d1454ac68e73d43203d1f14ec0900\",\n\t\t\"id\": \"5337978774712629501\"\n\t},\n\t{\n\t\t\"type\": 4,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"3000000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"multisignature\": {\n\t\t\t\t\"min\": 5,\n\t\t\t\t\"lifetime\": 1,\n\t\t\t\t\"keysgroup\": [\n\t\t\t\t\t\"+6638548d991d49e2b41bf15b595fa19749b25c58483e7e8fc926038074571ebf\",\n\t\t\t\t\t\"+a0ed6137800e9a65f796e423d9ebece0a7df53f0049e90eebc2e597452de69ed\",\n\t\t\t\t\t\"+4bb9e15fa15cbe87d19b6854474d57c3aa515deb586548bb515630dc7121d021\",\n\t\t\t\t\t\"+068bcac57c9d988f0a03bab381785c67ef4b63ca8047f41863fb2a0202aa88a5\",\n\t\t\t\t\t\"+261fb86d60785e208ba7541db9ab56d3e02fcf9357a25bf859f826e87cadb816\"\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"46f6ce8da1b5948aaa63a51cf28913210d356cc27a2cc952a2bf1b88f47d6cd6f250f8d907b9a4e0c531a66c601b50aa483a461e803412f2ae9543d99155970f\",\n\t\t\"id\": \"15911083597203956215\"\n\t},\n\t{\n\t\t\"type\": 5,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"dapp\": {\n\t\t\t\t\"category\": 0,\n\t\t\t\t\"name\": \"jSFFSiM4HZ91x7DXnOu\",\n\t\t\t\t\"description\": \"HQWQewqxZ0AA330r\",\n\t\t\t\t\"tags\": \"HReDOT69QpOGfR1ELav\",\n\t\t\t\t\"type\": 0,\n\t\t\t\t\"link\": \"qEXks\",\n\t\t\t\t\"icon\": \"mJM14TJiZSe3OmvYXpkaSqk6pr\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"d4888d8e916127358c5f6417ae4cc110e5509f32ef35589401e1a147e6b20a32fd280567d10f2d11224a94a32db0088a834138408d3a6d490f6be34a57e36207\",\n\t\t\"id\": \"6368378298793859048\"\n\t},\n\t{\n\t\t\"type\": 0,\n\t\t\"amount\": \"8969127700000000\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {},\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"signature\":\n\t\t\t\"335033784ce58916373bfdec8c6b0a279155d3bf1f418e42e8a0804fa45906e5f71e8d0a34cb1bcd38397788efaf231e56d6d3527c3a08625ca46c1512d51c0b\",\n\t\t\"id\": \"4937270977123783749\"\n\t},\n\t{\n\t\t\"type\": 3,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"100000000\",\n\t\t\"recipientId\": \"16313739661670634666L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"votes\": [\n\t\t\t\t\"+900fcb60a949a9269af36f0da4a7da6e5b9a81bafb1929b2882f8aeda5960ff0\",\n\t\t\t\t\"+083d534a51c358e6dce6d43f4f0de8abf5bb1d8b8ee7fe817c5b225bb4c46fd8\",\n\t\t\t\t\"+2027d6af78cc6b10d1fa9712dbb6241b67531552c2d3a688d8565c37b8a307ff\",\n\t\t\t\t\"+9e3f52823ebdb0e07649b1d260f864691b81a4f7e18fdf8935bbb1bcfe454663\",\n\t\t\t\t\"-18982fb4caf0cae685a3ca44fe91445c26bef542f09fc8ea0e25fd33fd948fd7\"\n\t\t\t]\n\t\t},\n\t\t\"signature\":\n\t\t\t\"45010721b4ed0424a003da5e82f5917a8895d99adb0bf9509b65cd7dbd14653efd9ed0b4f52a4d1ab7da89e3b8ef33337a67737af451df06bee51b124f741c0b\",\n\t\t\"id\": \"9048233810524582722\"\n\t},\n\t{\n\t\t\"type\": 2,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"delegate\": {\n\t\t\t\t\"username\": \"TYX\",\n\t\t\t\t\"publicKey\":\n\t\t\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"660ba7172a25a19819344c1ac99f0b2532915ede18405563fcf454ff22278f1c8f33bf6fe44a29ac2a4daabf3edd1551809bb081766ef1a5b8a0251c5a656103\",\n\t\t\"id\": \"17457098940654976683\"\n\t},\n\t{\n\t\t\"type\": 4,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"3000000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"multisignature\": {\n\t\t\t\t\"min\": 3,\n\t\t\t\t\"lifetime\": 34,\n\t\t\t\t\"keysgroup\": [\n\t\t\t\t\t\"+ed2f2b9e8f377f77ad721ad572de0575796789b7a5b29cbafdc294a1f86f8a72\",\n\t\t\t\t\t\"+d2e3dfb830bbbd6dd10ec6022dffac9d189343e7255f89346ede6ffbd66327fd\",\n\t\t\t\t\t\"+e77283fe326d473aff78c74dac627538b7e761a7efd65edbc425c14916657b7a\",\n\t\t\t\t\t\"+5124a5c4f48714c52e5242a124545fe7bf47e4bcdc03f80c485d55c886a98013\",\n\t\t\t\t\t\"+ced89d652d99de651d8d1e5f30661c9a5780bb9b2955d11bf84ed1ed08abe60f\"\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"97f663b356609227009f664e6072f58b43dbd5dc17f7586e9dad9511fe3272c813f81353135b5831e3c930c5669f0223402047694bc31f61276254c0ec5b170d\",\n\t\t\"id\": \"16196080519305519880\"\n\t},\n\t{\n\t\t\"type\": 5,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"dapp\": {\n\t\t\t\t\"category\": 0,\n\t\t\t\t\"name\": \"\",\n\t\t\t\t\"description\": \"wE3f2s3OYt7eY7WjbFy\",\n\t\t\t\t\"tags\": \"BcnXy7fBVgp\",\n\t\t\t\t\"type\": 0,\n\t\t\t\t\"link\": \"4\",\n\t\t\t\t\"icon\": \"IBaIGbiH\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"8ad74d9fe9db6e9750986bce3890821e8611fa840f86019b891a9d30d5d53371372f0ebc79dab2854e5c0bb62cab3e3a49d76ae05f1f424a1112df0fda771b03\",\n\t\t\"id\": \"4804584599866287174\"\n\t},\n\t{\n\t\t\"type\": 0,\n\t\t\"amount\": \"4054494300000000\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {},\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"signature\":\n\t\t\t\"7b3f813eb3b130e9d31b74371b2a221fa2915fed0fc4fd435d42ea89c7cb76d7eafb105a973080e00bf54e62f48eb969cb88a4371ffec3c225c2821f9619af08\",\n\t\t\"id\": \"11811758250853952228\"\n\t},\n\t{\n\t\t\"type\": 3,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"100000000\",\n\t\t\"recipientId\": \"16313739661670634666L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"votes\": [\n\t\t\t\t\"+3b458651eb45887a10a95489dad3f14a708c8eb2c50af6abfcfb753d4b01dcb3\",\n\t\t\t\t\"+0a8e2446495959401daa8adcf7646276eaf49e1cf10993e36ac5a21a39945a7d\",\n\t\t\t\t\"+765a399060d14680c7a12246e642b7cb46fede3dfc8f43c6cb57dfefbc1a4533\",\n\t\t\t\t\"+586e1f97641d9c736737e9755f658461ed961aa475be28361b8331468a2b8fa0\",\n\t\t\t\t\"-332438da41f1c8019098b148482d51fa58dc026cd3fb49d77d4f7356ff0c063d\"\n\t\t\t]\n\t\t},\n\t\t\"signature\":\n\t\t\t\"15cbfa6843efa6c6574c986d371ab689cfdddc958ad6ec7b7a8024f98559478cbfae09c7cf4e62e30ffd1331e24951c534db96d3349f828ae9514578f98b120e\",\n\t\t\"id\": \"11944214126253524732\"\n\t},\n\t{\n\t\t\"type\": 2,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"delegate\": {\n\t\t\t\t\"username\": \"g0chqJUQp\",\n\t\t\t\t\"publicKey\":\n\t\t\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"0271091d6055e831ad6c14b6a9fecd77dbf44c4a20285e4df51302134f8ffccc3dcc73ba2a8a5ea1fcebeafd65943f503ffee41a4283f798e7a9996b5eb5a807\",\n\t\t\"id\": \"10417213059747712454\"\n\t},\n\t{\n\t\t\"type\": 4,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"3000000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"multisignature\": {\n\t\t\t\t\"min\": 3,\n\t\t\t\t\"lifetime\": 13,\n\t\t\t\t\"keysgroup\": [\n\t\t\t\t\t\"+9f207919be15e45a5fd89ec5d699d72390a2ccc6eaaf587d88eefa46a7f7c01c\",\n\t\t\t\t\t\"+f209131118dd05585d3131b5250caf8737b712c63dfc56dcf7d9678e0551b4a8\",\n\t\t\t\t\t\"+9d2a2afd25ee6c48b4aef7f673bffde98c6bf278997a917cce739568eefd99e3\",\n\t\t\t\t\t\"+163cb0f7d9da97611350f72741fececd41d066e45dc8370076b0fabc951232a7\",\n\t\t\t\t\t\"+66c085d46ec6c3b7c9270f9e62b113ce4248c7bd0e5924355307c57fb8ef93ae\"\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"76a4b1df52bb97bedeaeff199a8ee7408d1bdab3ba735ff70b7e0a362d891d622726814b12499ef2b01b825717f92ba6d3c4ffc5c6fb0a22035b63a140ad4407\",\n\t\t\"id\": \"8904533490777066124\"\n\t},\n\t{\n\t\t\"type\": 5,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"dapp\": {\n\t\t\t\t\"category\": 0,\n\t\t\t\t\"name\": \"lF7s\",\n\t\t\t\t\"description\": \"BZqgVHKUZjsyr5\",\n\t\t\t\t\"tags\": \"AYV\",\n\t\t\t\t\"type\": 0,\n\t\t\t\t\"link\": \"dzQ3leCut\",\n\t\t\t\t\"icon\": \"sJoKLJOdAvtdktEl5hzaIttiN\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"99c6e43a6a06caab60b6147dd0eba6c7afbdc4b4f6b82e6911100a454ca1252dfca560a5ec65f01bb03f71fb5e37d8f3ad0255f77b809991acfcf42504eb0e01\",\n\t\t\"id\": \"16584586901330410057\"\n\t},\n\t{\n\t\t\"type\": 0,\n\t\t\"amount\": \"8184360100000000\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {},\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"signature\":\n\t\t\t\"53c1cb90f379c1afa1b7fb7b7c79689d02ed96da32cc337b511d48573da35fdf261f2f85f744a01a62866c2d672ad1a73286f94ef6af494eb4890f0b6a4a0c02\",\n\t\t\"id\": \"8699527477254187757\"\n\t},\n\t{\n\t\t\"type\": 3,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"100000000\",\n\t\t\"recipientId\": \"16313739661670634666L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"votes\": [\n\t\t\t\t\"+dd8fb02b092402d4bb4114cc7b79b83fe7b30a18fceaa62d8a47f737604a34ff\",\n\t\t\t\t\"+82e42e6f8f9f4d910d8a883e9163fa46190064c3d112b05f4802fd92fa55b431\",\n\t\t\t\t\"+ffcf0152971388d89b007ab293349e55979bf3c81dfb2a41bc5304d3b4140503\",\n\t\t\t\t\"+2771daeae7b042c8927c7cf86821bee85f27914c8be3b185a9ff2d749852f923\",\n\t\t\t\t\"-64b517fc24df9e1cbc2797b6bdb0747912f3efa5c2b863d53fba95788ef6d099\"\n\t\t\t]\n\t\t},\n\t\t\"signature\":\n\t\t\t\"e1ea529a6c252e4a50408693378a38aec68bbd474ee8562b33a3572d5ce38a69a515f7448de5185be0fb2dfc23652c43ea0cc3490683df185b052952f9ec610e\",\n\t\t\"id\": \"1804328474810539521\"\n\t},\n\t{\n\t\t\"type\": 2,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"delegate\": {\n\t\t\t\t\"username\": \"mUUn\",\n\t\t\t\t\"publicKey\":\n\t\t\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"f5a2c0946bcae73ce24a29dbbdc16c1f3fd897ece7de5ae6d2a891f98673b54106f0d516398960f545b00cc0cdbd131a14590b796185e7e72d66fecdb9eab206\",\n\t\t\"id\": \"13111698433238994230\"\n\t},\n\t{\n\t\t\"type\": 4,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"3000000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"multisignature\": {\n\t\t\t\t\"min\": 5,\n\t\t\t\t\"lifetime\": 14,\n\t\t\t\t\"keysgroup\": [\n\t\t\t\t\t\"+465f0eed0a5614af4c282b35e4f8cc7b8010783aaf848a8c073386f619208864\",\n\t\t\t\t\t\"+a5df78890691147c6b13c9330e2e5fabebfa52ef1eb5d79dfeb3d9892d4c8f8b\",\n\t\t\t\t\t\"+ad8a0767c7cc1e566888902c5588c35c6f75ba985777f6d2f23e428a9c7c470d\",\n\t\t\t\t\t\"+f7b14239c88d7c1e6931532c1a248080bf24591b2b4226748fa0b4b0b060808d\",\n\t\t\t\t\t\"+744d25d065b806d6a4028a8f9de7a4342b8cc8b647e04e7ff66f7ea53df9f8c4\"\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"c0f3f4ec468b647823511b81e199af569211269f898cbd872291b0f609608815526f837ba18038cfca3b5002e01a0f7054cbc6b6f74de66a275eda4909124206\",\n\t\t\"id\": \"8649508251318979973\"\n\t},\n\t{\n\t\t\"type\": 5,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"dapp\": {\n\t\t\t\t\"category\": 0,\n\t\t\t\t\"name\": \"5pATdfOO\",\n\t\t\t\t\"description\": \"MwNovspfAO0jTsY0o\",\n\t\t\t\t\"tags\": \"HP2qmZaRajMVNaSxB9NypeS19HRfoknG1WlE4l\",\n\t\t\t\t\"type\": 0,\n\t\t\t\t\"link\": \"EblohNQI\",\n\t\t\t\t\"icon\": \"D\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"f56cca3239759dca1db8be70124e8a3ba1a64e4d1d8e7299e27d82d96fa386cc84bed703897bd60f3b862dc1d201c1688af75dcb572f048ccfc3e69a38c24d0e\",\n\t\t\"id\": \"6415932520816963164\"\n\t},\n\t{\n\t\t\"type\": 0,\n\t\t\"amount\": \"3649003300000000\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {},\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"signature\":\n\t\t\t\"8953d989a4be6d2d0ab25dbb11b1268a21ce3681aba6c0fe391b2b7c18179f52af5440aca8b27794eb27d29b41a306f931882190a1ad922c274fb9bc5be63303\",\n\t\t\"signSignature\":\n\t\t\t\"0ccd222e27835d041622c469da6d69c1720202f6bb8258b7199a690b86d1671b45ef8ad03ff0b78a8dd91c38a9fad694d9186f414e83f9ad076e69b72ab02c0d\",\n\t\t\"id\": \"10897127897715572989\"\n\t},\n\t{\n\t\t\"type\": 3,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"100000000\",\n\t\t\"recipientId\": \"16313739661670634666L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"votes\": [\n\t\t\t\t\"+791dbbf8e7f52eb253611c92758a25aed0b1ced2c1449272c251dde27a63e164\",\n\t\t\t\t\"+2b0fa724137c99da93590c1fbe2f2a988cc28b1b7f66e17942d7c3026b19bd65\",\n\t\t\t\t\"+bc97c09776318348138aaf7031b642a665bb3d2bd5e76ccc525dcf74fae960fe\",\n\t\t\t\t\"+b3036b5bde0f106f86f72245ca238148e7871235c236fb41bb08d8d0960ca807\",\n\t\t\t\t\"-e97c6e9027d940686a92cc56069822ef64e17926ff677f12c88196d0441b8a8a\"\n\t\t\t]\n\t\t},\n\t\t\"signature\":\n\t\t\t\"ebf2a10ef69c5282b554b9d23c21c9884e558376f42972515d4d4397b535bb2d521ccfe48f28468a0371e00f2af7550fec1e17d374d75c1abc15051341b4cc00\",\n\t\t\"signSignature\":\n\t\t\t\"640fd85321213dcfa16ce7fcad219aeeb284119016cab7650b83beca2634650e834308996b85861c8046997344d1ff64be7c56bb43f77cea26655d2c17b6b608\",\n\t\t\"id\": \"17799333624445334933\"\n\t},\n\t{\n\t\t\"type\": 2,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"delegate\": {\n\t\t\t\t\"username\": \"r9bGwAqXG1pOnVL\",\n\t\t\t\t\"publicKey\":\n\t\t\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"5c0b596006acb565cee01d22b5de2e60dde69df3c5cbf2e96c4242cb80811f205ae05fcf1110810bd477ad3e67cf42e103c3160e63207bd7d78aa1dbe1496300\",\n\t\t\"signSignature\":\n\t\t\t\"5030bf9be108b4a4084a32a7f35d74b893bdf4c67678b7f94b923b3cf1048d890e94e816a210e4442fe8e7bdab3ab45c1959adae14d6200cf552d3413a10900d\",\n\t\t\"id\": \"12155900509392441171\"\n\t},\n\t{\n\t\t\"type\": 4,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"3000000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"multisignature\": {\n\t\t\t\t\"min\": 2,\n\t\t\t\t\"lifetime\": 9,\n\t\t\t\t\"keysgroup\": [\n\t\t\t\t\t\"+56364190bc7dd833b37450a45a4beddf1bd7408324b75bf52f85decb424a159b\",\n\t\t\t\t\t\"+11364ec15a0060b0e07846a5dfa81d2f43351bf35b360dc9f780ececb6402ad4\",\n\t\t\t\t\t\"+e29841ce6c5147027b52eb2551ece8c3aa62090f563093e243a978a0dccee692\",\n\t\t\t\t\t\"+f079d3f68a1b0b03824b229efb0814df113f255f1cfb06f26bac205bcadb2840\",\n\t\t\t\t\t\"+95c11960a7deacab27f59518f1b47b3a7f9c37819ca80e9c0fad8a39a2eb3917\"\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"2afa46bb4563de7f56254b06c8752a4bdf76a798971b1c9644d7e74bac7e58c8d234b0650d49462b2ca9fa6cdf26c572da8cd680e8de62bd9cc14f65f97a180e\",\n\t\t\"signSignature\":\n\t\t\t\"b8d0ab01ca30cd06f792fcc3e82ad1df451f6239fb470444d026c9e5b32fc9ccee3ab9deb398119b9d23ff76c3a807d210f32310a3b4c43e7ec3d7e05e6b6203\",\n\t\t\"id\": \"14759833290133825198\"\n\t},\n\t{\n\t\t\"type\": 5,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"dapp\": {\n\t\t\t\t\"category\": 0,\n\t\t\t\t\"name\": \"nryO\",\n\t\t\t\t\"description\": \"7qs1Iv\",\n\t\t\t\t\"tags\": \"fZdhM1QGdTlJWjhSZzPsH\",\n\t\t\t\t\"type\": 0,\n\t\t\t\t\"link\": \"OzG0whsxmEda24cfdA\",\n\t\t\t\t\"icon\": \"pMOY8WpXagaPdVptqR1prGPdM\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"bb5f425e4c7aeed0f4899b22692e240e22e41756cae85113c73a200cdc607005c28d218bd29de212d4b2c65919b174ea097719341f5f023ade9c26c90d75ea05\",\n\t\t\"signSignature\":\n\t\t\t\"2597f3aa8afea57a1b8ab2328db3ee5abf315f0b367b686e50677da0ffabceee6694d9bb1c6613b7b218ee6c68ca5457261255dba185709fc44956a4eb523707\",\n\t\t\"id\": \"12078587542208625234\"\n\t},\n\t{\n\t\t\"type\": 0,\n\t\t\"amount\": \"2312331300000000\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {},\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"signature\":\n\t\t\t\"1cc982da7c70f06b32debb6bd3032c469a3ad5444b0257745297dbccf71050f382191e797daeb707a0eaba9286917fab90c5a37c8f2f49301febecc777c1eb0c\",\n\t\t\"id\": \"8974713600754318131\"\n\t},\n\t{\n\t\t\"type\": 3,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"100000000\",\n\t\t\"recipientId\": \"16313739661670634666L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"votes\": [\n\t\t\t\t\"+2af82af1fd00f4c0e36037e124309a083769e307025c10ff29c66cac577cafec\",\n\t\t\t\t\"+186521db6b809b250113a5bba66a1a6507251b8abba1d24f047b0984c050a1b5\",\n\t\t\t\t\"+28cf88ac965648c238a2fabb8ac7b8fe4aba6327bb32bcc6aa291a8ce59a4c78\",\n\t\t\t\t\"+77731ea9884dd4c684b7571b7e78b998fabbda4a66715854c40b7ee368ae446b\",\n\t\t\t\t\"-d6124c312884182d2fd4c51a829a480cb30d00052daf257d224e62ab1969d268\"\n\t\t\t]\n\t\t},\n\t\t\"signature\":\n\t\t\t\"d0d603149cdac8ebd24d2617daca259d7cb0d7e14429421468e1a93f8c118e78ba78e0080e4b9b0d57daeefa0b973afff8cf2e984db2878730b5d868b3eabc09\",\n\t\t\"id\": \"5300315452366475326\"\n\t},\n\t{\n\t\t\"type\": 2,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"delegate\": {\n\t\t\t\t\"username\": \"BmgeSxNgl7gWN4\",\n\t\t\t\t\"publicKey\":\n\t\t\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"ebc920b067e78f2350b7baceae66f4a74397912beed8ac9a8d1656fc28187b8849bbb593762b62843e7009cb15a626a7157eb3a0e6c828f69364932e8c0a2204\",\n\t\t\"id\": \"14549490938474611289\"\n\t},\n\t{\n\t\t\"type\": 4,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"3000000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"multisignature\": {\n\t\t\t\t\"min\": 2,\n\t\t\t\t\"lifetime\": 1,\n\t\t\t\t\"keysgroup\": [\n\t\t\t\t\t\"+e64df51060a2ce43f91b24ae75cc83f1866f9fead2ca2420cf3df153e6368a97\",\n\t\t\t\t\t\"+4ef26ed51f4b82134b16f25a2556bed98a0b3963a17c0d2f0fa87f67cc6f29fe\",\n\t\t\t\t\t\"+818d34925549e0aea67f1b82190c3e288b1c66de95ce699c2f5c87f1e622012c\",\n\t\t\t\t\t\"+a2eece2bf0ee74e492939ac84723646270bfefab84914a5cf68baffd9bb84858\",\n\t\t\t\t\t\"+46f3ec44dbcffe28c6bcd4eb494ce24ceea51677eb67005bdd4dd3202db55251\"\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"4c8a3bfaacfab18a7ef34ce8d7176ea2701dfd7221a1c95ecbc1cce778bbccdb7cbbe1a87b3e9e47330f1cae6665c4a44666e132aa324de9a5ab9b6a1e2b1d0c\",\n\t\t\"id\": \"18066659039293493823\"\n\t},\n\t{\n\t\t\"type\": 5,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196078,\n\t\t\"asset\": {\n\t\t\t\"dapp\": {\n\t\t\t\t\"category\": 0,\n\t\t\t\t\"name\": \"y2OPqyGLuw3F5u2Sxd\",\n\t\t\t\t\"description\": \"xBIt2niD\",\n\t\t\t\t\"tags\": \"qQvydic4uuw61X7a7cZ6tjrUKK2C\",\n\t\t\t\t\"type\": 0,\n\t\t\t\t\"link\": \"MaRhi5E7G6EZu7dxaaE\",\n\t\t\t\t\"icon\": \"To900QF\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"a2910f485580a903e125b02198b0d9d8f2a9509bcd4e491932b2c30c06fad3d81969547f84073516ee24ce3036dbf388e63eede7e80848b555669c6d2392040b\",\n\t\t\"id\": \"13459454681692221740\"\n\t},\n\t{\n\t\t\"type\": 0,\n\t\t\"amount\": \"2801887300000000\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": {},\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"signature\":\n\t\t\t\"be08dc16b70c47f58520f93599e72ad087d323adc312fc5cf89d57938f7a098686686551a834e52180e5b07a2b7339982581871b2da69f38fdf72df93c022901\",\n\t\t\"signSignature\":\n\t\t\t\"f2367e1be7450922a72168390dc1e1dfa7e3a685bb4755938b7f0ff48c18bbda4a11ea3309aaeb2398a5b110ec341d7d0b30f0f9cf6337231936b444dd4bb502\",\n\t\t\"id\": \"13907564008476426594\"\n\t},\n\t{\n\t\t\"type\": 3,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"100000000\",\n\t\t\"recipientId\": \"16313739661670634666L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": {\n\t\t\t\"votes\": [\n\t\t\t\t\"+6af5a4fdf2fdd10e565cd22dbc0bf942fa8c59786a29a4b3706ffe559331d636\",\n\t\t\t\t\"+5bc0c67294e9a5be07c00fe051a50409502a62aa87032b60e737a15d58449333\",\n\t\t\t\t\"+79d64906a7a4cf89736ad1fb1819aeb69b07982718b45b590b1102d2ee99c1cf\",\n\t\t\t\t\"+2b0acc7ba95b1971c60f9a6da39c947fb79a1c8b359b4f054c371d40541afaac\",\n\t\t\t\t\"-9e117730c9a4adf1f031d122635db1f84214690cd0632302103c682c2115074e\"\n\t\t\t]\n\t\t},\n\t\t\"signature\":\n\t\t\t\"f47f4b4b5b58140281e5d61a279ff4d009004114261e3ff39a8aa6119e8de6e7975bd9b49eb10aef58edd81061f395141828e5c267131add7e50a02297e64207\",\n\t\t\"signSignature\":\n\t\t\t\"95528967d585ec9a71352ce753fb5475e54c272102d6808eee4b99e6a64561806767b5bb1e5dbd7500ca46cdddecd1bab03e5507f4d70b5132afa04c7df47b0d\",\n\t\t\"id\": \"408170376416400414\"\n\t},\n\t{\n\t\t\"type\": 2,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": {\n\t\t\t\"delegate\": {\n\t\t\t\t\"username\": \"h9iWcquSm9iKpFw\",\n\t\t\t\t\"publicKey\":\n\t\t\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"e051ee9441a04d046d390e70e15eac640dbd0289a27c2e82942be648194b9684e9eb86c9ac19f50293567ab8238047abf2d04c73f52ae7ff03230016c840440c\",\n\t\t\"signSignature\":\n\t\t\t\"25f2e872b5c20445e5c8551ae0488edf3773736f401052d3689b061c418a79f9563c0b388ba2432608a67ba57cc6e8d7292550a626ad3f1a7e29e4dab631890c\",\n\t\t\"id\": \"8936243264570089909\"\n\t},\n\t{\n\t\t\"type\": 4,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"3000000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": {\n\t\t\t\"multisignature\": {\n\t\t\t\t\"min\": 4,\n\t\t\t\t\"lifetime\": 30,\n\t\t\t\t\"keysgroup\": [\n\t\t\t\t\t\"+5bf096b1964c2a8035a1836e20aa72e775d8ed2d15b13b50c170da8f49e1c13b\",\n\t\t\t\t\t\"+7167b3f440be68d7811b054f90906c595ee127e26e146ca27ebf728449b9ba63\",\n\t\t\t\t\t\"+c472e853cf1e706c4e3025ec0300ed1fb03df590a7bdda8a0badca6888476591\",\n\t\t\t\t\t\"+7902cd178a000cb672530ff982276e1b2b94c845988ac773abd775e5fda04a4b\",\n\t\t\t\t\t\"+93d29f8c7663e4aa273176bb74e35cd8bd5e09b9688b8e5f21cbac93761e4bab\"\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"615bfc47244237b3bb6eff7f032a4ba0530cce9ce1627f488b9075672383fff45b96641daaa715da37bba6c4b09ee12d77070e8a5c1493acc833d1806946c802\",\n\t\t\"signSignature\":\n\t\t\t\"a29ce1c2f682f924a68f85083ea6934edab494a2a81ffc3aaf090ba3a9aefb692317c97a0ce7187b1bf9bbaedb71d5f440ccd986279bee280b16b2ff5efd1006\",\n\t\t\"id\": \"718478589882001258\"\n\t},\n\t{\n\t\t\"type\": 5,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": {\n\t\t\t\"dapp\": {\n\t\t\t\t\"category\": 0,\n\t\t\t\t\"name\": \"0REwN\",\n\t\t\t\t\"description\": \"J82zELUzEnV\",\n\t\t\t\t\"tags\": \"e\",\n\t\t\t\t\"type\": 0,\n\t\t\t\t\"link\": \"kPfG6Bt\",\n\t\t\t\t\"icon\": \"ium\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"c15cc992aa2f1ac6effc00c894e98fce68ecece7bd4ac00664437ed711b8e1bf066ea433a613476767d14c85e1cab66d548fdec9fd56f96d1b112bee224c090c\",\n\t\t\"signSignature\":\n\t\t\t\"01b142ee1ffe3dd466fe863557500296dfd8313d098ca4d1897167e3138556999f91f8f73d337b53371fc643f713fead0461a0d3b2416585d3ca236144d4f40b\",\n\t\t\"id\": \"6479396717400039057\"\n\t},\n\t{\n\t\t\"type\": 0,\n\t\t\"amount\": \"5061165300000000\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": {},\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"signature\":\n\t\t\t\"b2cef4445fc63d3100bfe4b8c5a3988962378d5f05f3f31a874545341d1421f40f6bede8195fb41de4998454510a578490dcbc5a646bcea75fe459b8be1c6002\",\n\t\t\"id\": \"17133129148236935159\"\n\t},\n\t{\n\t\t\"type\": 3,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"100000000\",\n\t\t\"recipientId\": \"16313739661670634666L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": {\n\t\t\t\"votes\": [\n\t\t\t\t\"+be4bbac72323ecc09bfe619fa112c5dcd42191f28e1f60b6a51b84a95f248941\",\n\t\t\t\t\"+3180e1f79f626a2ebf2fc9bb4282c931becbd8858e49b370d00055a2d6b4a062\",\n\t\t\t\t\"+d47f95719687003314535dd710180f1ff0e152773a772c625212bb2f034b854a\",\n\t\t\t\t\"+7a9147a984e3555fad99d774a90831baba8cc2b2f4a7e06eb3f2be2f0d3cdb5f\",\n\t\t\t\t\"-cb201cd4887eb52834a1e1a7a59c9903393e1abe2b75d61db81ad4199bef49a0\"\n\t\t\t]\n\t\t},\n\t\t\"signature\":\n\t\t\t\"ce02d218620a527f05baf1b3f125f46a0d5faefafc3bc359f0fd65511d3b406843cbee3a4d156669267d6510f870b5d359a07402f6f1695e5de4354822a6470c\",\n\t\t\"id\": \"5473217291152754023\"\n\t},\n\t{\n\t\t\"type\": 2,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": {\n\t\t\t\"delegate\": {\n\t\t\t\t\"username\": \"6YGNabt2vP\",\n\t\t\t\t\"publicKey\":\n\t\t\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"219af05289f95a6c5c920760d77afa80c750f11f221d21b6ae47942391d83aace624edc3814655cebe77ae045613c8148cbda97b3cda95ea52e19349611e7103\",\n\t\t\"id\": \"4535306837758230670\"\n\t},\n\t{\n\t\t\"type\": 5,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196079,\n\t\t\"asset\": {\n\t\t\t\"dapp\": {\n\t\t\t\t\"category\": 0,\n\t\t\t\t\"name\": \"mZDJS\",\n\t\t\t\t\"description\": \"O1sUrkoqguTAET3O7B\",\n\t\t\t\t\"tags\": \"r2r9zWXWF3faCg\",\n\t\t\t\t\"type\": 0,\n\t\t\t\t\"link\": \"FYZZq0oT9i4UtRb3o7rLLKxQQFavCkrdgQ\",\n\t\t\t\t\"icon\": \"KgpJyKuT8AxYN9JQ\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"cb4bc3a6279b9b994ee182f3dd65628910b8e0570685797877bbb2ded9679b6b00c3a6113b034ac5bead165b78dfdc4bb71620e3f99daf871d9399758a9ba30b\",\n\t\t\"id\": \"17759930910428062541\"\n\t},\n\t{\n\t\t\"type\": 0,\n\t\t\"amount\": \"4876278400000000\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": {},\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"signature\":\n\t\t\t\"832fa468ebdad7a5accb6b16b8c82222f0a97bc00233451a89e18100dc22d9df2fc722a09549d3ef832d483c8e8c18e9765e963b5203a147c0c4b9236021cd06\",\n\t\t\"id\": \"11425498570993926585\"\n\t},\n\t{\n\t\t\"type\": 3,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"100000000\",\n\t\t\"recipientId\": \"16313739661670634666L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": {\n\t\t\t\"votes\": [\n\t\t\t\t\"+bfabfacd8fbd8d8a8aa825c07344d627c8e5b548b3c8af0bf0c447aad509c1ca\",\n\t\t\t\t\"+01da309703eb58d4e6fd1ba576ea37bf9b1d40eae756907c14434e3922900e13\",\n\t\t\t\t\"+9f7744d69fad50a9f187a6bc7a2f9847aa70302cd11459a33d7278eb0cf14dea\",\n\t\t\t\t\"+2d417477f8d4690188fa277eef6a49b0386a4c2a68643e61ed507fa14c1157d5\",\n\t\t\t\t\"-d8e2228f3bf31ab2cd455b8d04df8f37139c725c5819b328492d6e6c7a3779fe\"\n\t\t\t]\n\t\t},\n\t\t\"signature\":\n\t\t\t\"26e5a15fc5fe2e17cee68c61c73e2ca2b8c616cfcd6ae4aa9137f32bab7617bf11ba1ca41826c45244a47a0ff273c1e1eadaf24c88aeda67ff9993597ed0800b\",\n\t\t\"id\": \"912105933902813252\"\n\t},\n\t{\n\t\t\"type\": 2,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": {\n\t\t\t\"delegate\": {\n\t\t\t\t\"username\": \"a4axYoN\",\n\t\t\t\t\"publicKey\":\n\t\t\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"aa609c506bf96cd4c179cff4dacae3574ee84a075adc8b626181d7a357fa30498ac04ee4a536848674131a7629871c7e89c3d7cf5b98fe8bb0c84e7144da890f\",\n\t\t\"id\": \"13972423096514804371\"\n\t},\n\t{\n\t\t\"type\": 5,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": {\n\t\t\t\"dapp\": {\n\t\t\t\t\"category\": 0,\n\t\t\t\t\"name\": \"WRZhl8\",\n\t\t\t\t\"description\": \"xpxq9w6h\",\n\t\t\t\t\"tags\": \"bC1605OZ6RgRRj2\",\n\t\t\t\t\"type\": 0,\n\t\t\t\t\"link\": \"2RKLfLCm13xX2eZ4WMoWBAAig6QioF\",\n\t\t\t\t\"icon\": \"Yht9kxY37iCys8FVaFgBqBlk8WG\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"6cf050d618b6dc8b5e993de10eeba304d6f77eaf62e7893d976bcbdacaa194b89bac3c5bddb6e81a5cface98dafdc9be5b971768acaf8e5a820d460933f49706\",\n\t\t\"id\": \"13519964049473247354\"\n\t},\n\t{\n\t\t\"type\": 0,\n\t\t\"amount\": \"7543868600000000\",\n\t\t\"fee\": \"10000000\",\n\t\t\"recipientId\": \"1859190791819301L\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": {},\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"signature\":\n\t\t\t\"ce60ee3b844d3bbd8030b842ba9568c857e6de41aa2e19322ab6314b8e66afa419752816fd17ad88a75dc8ef763de782be68cc27d3d47e0b5cd63f38de6a2d0f\",\n\t\t\"signSignature\":\n\t\t\t\"2d572dcce12b1e8acf7e46b0a40576d3408045fd4f7e432e4a1853f8092e387e322ad390e14f091176f6fd84bcb72b7011aecd9390230ea4a21db74546abc507\",\n\t\t\"id\": \"6263613751669009115\"\n\t},\n\t{\n\t\t\"type\": 3,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"100000000\",\n\t\t\"recipientId\": \"16313739661670634666L\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": {\n\t\t\t\"votes\": [\n\t\t\t\t\"+0b8a49bb952e5ed645cddb5fb9393c2f8a1be4f261c7623ce0ddb2b6b2a1be3e\",\n\t\t\t\t\"+9cc4e085fe359f20c110ce5cf2ff30ffb4d6d613922e31afd572693be8e3f8ba\",\n\t\t\t\t\"+d2133bd20300544bc4e16ba828223dd3d58955425634a2e2cd6762821f6176a2\",\n\t\t\t\t\"+f11575b059598ffb9f0505e72041d05c685f949c4cce46c4366f50177d97dfbf\",\n\t\t\t\t\"-cdfda7456076b9025b2964ef0679e8e1a5c3b8cd0d63345d7a05ac6faeea5f8b\"\n\t\t\t]\n\t\t},\n\t\t\"signature\":\n\t\t\t\"88c499e3dd5e10fecb16a192df9f8c81c32e9a7d2ac1f473bb076c7598cb431b14eb17423bf9493d8b112ca74b7cf1c64caa4a044cbac35f895185906f1b6107\",\n\t\t\"signSignature\":\n\t\t\t\"30dec17a7d2d0b13df25e958e66481407b87da3f35a9b8c7e93044dcb4cf13970491cf2d9b0778258865b051f8eb3b53b8e15a52d2cbdd48ed67ff2d55edec07\",\n\t\t\"id\": \"15014970331019583344\"\n\t},\n\t{\n\t\t\"type\": 2,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": {\n\t\t\t\"delegate\": {\n\t\t\t\t\"username\": \"L4cPrZgeE\",\n\t\t\t\t\"publicKey\":\n\t\t\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"9e3d66ed9ba75a26b7380e09c29c38670b09233b9ca01ba93233fb0ce38e1c1fc92d66577292d2d70738d756a544878e044c3f49eb0dce22ad3c85c6211b5f09\",\n\t\t\"signSignature\":\n\t\t\t\"6ca1fe51268a786412f8f757d5fc0243f8ae00fa88812ae8501d399ed7e68326403fe68a508df4ab8ba48a98ac08d0f061ee21f5001f29cbc2f5343b0a66660f\",\n\t\t\"id\": \"9014172721793470554\"\n\t},\n\t{\n\t\t\"type\": 4,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"3000000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": {\n\t\t\t\"multisignature\": {\n\t\t\t\t\"min\": 5,\n\t\t\t\t\"lifetime\": 38,\n\t\t\t\t\"keysgroup\": [\n\t\t\t\t\t\"+617286b8de6ef7a91c7a0915a3c45ca9676216cbc8dc14bffa5e9022ea3a5683\",\n\t\t\t\t\t\"+8141def6de5e8c92843d2af9589cd2568f3bb5e475dae78d334abde60682695c\",\n\t\t\t\t\t\"+925e387ca6c63427391adb697273a4da8852944066ab33d50cb8e6279248427e\",\n\t\t\t\t\t\"+9645504d7e06135a7a5db072aef3a6d80bb7ec8ca8cb61bc8f369faaa05587a8\",\n\t\t\t\t\t\"+e1808d0e57e47bc1ffb21683c0bf98bbabe1c7e43d6bc6c2890a16d03543c100\"\n\t\t\t\t]\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"4a058d11726300ef0dd62941ce8f2ee861383f9448f17580826dcbef9cb62b0d953004eef3659a8b6d16bfd25b0732f93877f9b29e8828946ca849d9bb7b2d02\",\n\t\t\"signSignature\":\n\t\t\t\"ac3a9eec518b8c725aa8f8620546001f72b3036078242ab0c7639b6d6891ba4330448cc3e4f5c31516e896af4c5fa998fc2ba2673655a4cfb76168c8785c9109\",\n\t\t\"id\": \"2884334432991037421\"\n\t},\n\t{\n\t\t\"type\": 5,\n\t\t\"amount\": \"0\",\n\t\t\"fee\": \"2500000000\",\n\t\t\"recipientId\": \"\",\n\t\t\"senderPublicKey\":\n\t\t\t\"c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f\",\n\t\t\"timestamp\": 54196080,\n\t\t\"asset\": {\n\t\t\t\"dapp\": {\n\t\t\t\t\"category\": 0,\n\t\t\t\t\"name\": \"OpwYfwHdAfO4ncn7D\",\n\t\t\t\t\"description\": \"Ds\",\n\t\t\t\t\"tags\": \"1nkfYVcgsisKnXyn7k0\",\n\t\t\t\t\"type\": 0,\n\t\t\t\t\"link\": \"WQDusb0DgH\",\n\t\t\t\t\"icon\": \"RPAFQsBIsE\"\n\t\t\t}\n\t\t},\n\t\t\"signature\":\n\t\t\t\"524afb27d284e4e71ea44de9d23f9a1cd603f37f81a55187a61ca92391dce1994d2c4a5e3f0ae8490caac66da5125a0d03f30d0775592aa02d451a72e3ed9303\",\n\t\t\"signSignature\":\n\t\t\t\"7043b795dab467e3d3239e7c379ee1b07914a8ba04e639bda406f6ed8810d75a7b4066ad5e90ef3c2030927b917e8492db59ffad017ce51878b7217b27d3a506\",\n\t\t\"id\": \"7976119586785833934\"\n\t}\n]\n"
  },
  {
    "path": "packages/lisk-transactions/package.json",
    "content": "{\n\t\"name\": \"@liskhq/lisk-transactions\",\n\t\"version\": \"2.0.0\",\n\t\"description\": \"Everything related to transactions according to the Lisk protocol\",\n\t\"author\": \"Lisk Foundation <admin@lisk.io>, lightcurve GmbH <admin@lightcurve.io>\",\n\t\"license\": \"GPL-3.0\",\n\t\"keywords\": [\n\t\t\"lisk\",\n\t\t\"blockchain\"\n\t],\n\t\"homepage\": \"https://github.com/LiskHQ/lisk-elements/tree/master/packages/lisk-transactions#readme\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/LiskHQ/lisk-elements.git\"\n\t},\n\t\"bugs\": {\n\t\t\"url\": \"https://github.com/LiskHQ/lisk-elements/issues\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=8.10 <=10\",\n\t\t\"npm\": \">=5\"\n\t},\n\t\"main\": \"dist-node/index.js\",\n\t\"scripts\": {\n\t\t\"transpile\": \"tsc\",\n\t\t\"transpile:browsertest\": \"tsc -p tsconfig.browsertest.json\",\n\t\t\"browserify\": \"browserify ./dist-node/index.js -o ./dist-browser/index.js -s liskTransactions\",\n\t\t\"browserify:browsertest\": \"browserify ./browsertest.build/test/*.js -o ./browsertest.build/browsertest.js -s liskTransactions\",\n\t\t\"uglify\": \"uglifyjs -nm -o ./dist-browser/index.min.js ./dist-browser/index.js\",\n\t\t\"uglify:browsertest\": \"uglifyjs -o ./browsertest.build/browsertest.min.js ./browsertest.build/browsertest.js\",\n\t\t\"clean\": \"./scripts/clean.sh\",\n\t\t\"format\": \"prettier --write \\\"*.{ts,js,json}\\\" \\\"{src,test}/**/*.{ts,js,json}\\\"\",\n\t\t\"lint\": \"tslint --format verbose --project .\",\n\t\t\"lint:fix\": \"npm run lint -- --fix\",\n\t\t\"test\": \"TS_NODE_PROJECT=./test/tsconfig.json nyc mocha test/{,/**/,/**/**/}/*.ts\",\n\t\t\"test:watch\": \"npm test -- --watch\",\n\t\t\"test:watch:min\": \"npm run test:watch -- --reporter=min\",\n\t\t\"test:node\": \"npm run build:check\",\n\t\t\"serve:start\": \"http-server -p 11545 ./browsertest &\",\n\t\t\"serve:stop\": \"kill $(lsof -t -i:11545) || true\",\n\t\t\"pretest:browser\": \"npm run serve:stop && npm run build:browsertest && npm run serve:start\",\n\t\t\"test:browser\": \"wait-on http://localhost:11545 && cypress run --config baseUrl=http://localhost:11545 --env ROOT_DIR=\\\"${PWD##*/}\\\"\",\n\t\t\"posttest:browser\": \"npm run serve:stop\",\n\t\t\"cover\": \"if [ -z $JENKINS_HOME ]; then npm run cover:local; else npm run cover:ci; fi\",\n\t\t\"cover:base\": \"NODE_ENV=test nyc report\",\n\t\t\"cover:local\": \"npm run cover:base -- --reporter=html --reporter=text\",\n\t\t\"cover:ci\": \"npm run cover:base -- --reporter=text\",\n\t\t\"build:browsertest\": \"npm run transpile:browsertest && npm run browserify:browsertest && npm run uglify:browsertest\",\n\t\t\"postbuild:browsertest\": \"rm -r browsertest.build/src browsertest.build/test\",\n\t\t\"prebuild:node\": \"rm -r dist-node/* || mkdir dist-node || true\",\n\t\t\"build:node\": \"npm run transpile\",\n\t\t\"prebuild:browser\": \"rm ./dist-browser/index.js ./dist-browser/index.min.js || true\",\n\t\t\"build:browser\": \"npm run build:node && npm run browserify && npm run uglify\",\n\t\t\"prebuild\": \"npm run prebuild:browser\",\n\t\t\"build\": \"npm run build:browser\",\n\t\t\"build:check\": \"node -e \\\"require('./dist-node')\\\"\",\n\t\t\"prepublishOnly\": \"npm run lint && npm test && npm run build && npm run build:check\"\n\t},\n\t\"dependencies\": {\n\t\t\"@liskhq/lisk-cryptography\": \"2.0.0\",\n\t\t\"@types/node\": \"10.10.1\",\n\t\t\"ajv\": \"6.5.3\",\n\t\t\"ajv-merge-patch\": \"4.1.0\",\n\t\t\"browserify-bignum\": \"1.3.0-2\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@types/chai\": \"4.1.5\",\n\t\t\"@types/expect\": \"1.20.3\",\n\t\t\"@types/jquery\": \"3.3.22\",\n\t\t\"@types/mocha\": \"5.2.5\",\n\t\t\"browserify\": \"16.2.2\",\n\t\t\"chai\": \"4.1.2\",\n\t\t\"cypress\": \"3.1.0\",\n\t\t\"http-server\": \"0.11.1\",\n\t\t\"mocha\": \"5.2.0\",\n\t\t\"nyc\": \"13.0.1\",\n\t\t\"prettier\": \"1.14.2\",\n\t\t\"sinon\": \"6.2.0\",\n\t\t\"sinon-chai\": \"3.2.0\",\n\t\t\"source-map-support\": \"0.5.9\",\n\t\t\"ts-node\": \"7.0.1\",\n\t\t\"tsconfig-paths\": \"3.6.0\",\n\t\t\"tslint\": \"5.11.0\",\n\t\t\"tslint-config-prettier\": \"1.15.0\",\n\t\t\"tslint-immutable\": \"4.7.0\",\n\t\t\"typescript\": \"3.0.3\",\n\t\t\"uglify-es\": \"3.3.9\",\n\t\t\"wait-on\": \"3.0.1\"\n\t}\n}\n"
  },
  {
    "path": "packages/lisk-transactions/src/0_transfer.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { BYTESIZES, TRANSFER_FEE } from './constants';\nimport {\n\tPartialTransaction,\n\tTransferAsset,\n\tTransferTransaction,\n} from './transaction_types';\nimport {\n\tprepareTransaction,\n\tvalidateAddress,\n\tvalidatePublicKey,\n\tvalidateTransferAmount,\n} from './utils';\n\nconst createAsset = (data?: string): TransferAsset => {\n\tif (data && data.length > 0) {\n\t\treturn { data };\n\t}\n\n\treturn {};\n};\n\nexport interface TransferInputs {\n\treadonly amount: string;\n\treadonly data?: string;\n\treadonly passphrase?: string;\n\treadonly recipientId?: string;\n\treadonly recipientPublicKey?: string;\n\treadonly secondPassphrase?: string;\n\treadonly timeOffset?: number;\n}\n\nconst validateInputs = ({\n\tamount,\n\trecipientId,\n\trecipientPublicKey,\n\tdata,\n}: TransferInputs): void => {\n\tif (!validateTransferAmount(amount)) {\n\t\tthrow new Error('Amount must be a valid number in string format.');\n\t}\n\n\tif (!recipientId && !recipientPublicKey) {\n\t\tthrow new Error(\n\t\t\t'Either recipientId or recipientPublicKey must be provided.',\n\t\t);\n\t}\n\n\tif (typeof recipientId !== 'undefined') {\n\t\tvalidateAddress(recipientId);\n\t}\n\n\tif (typeof recipientPublicKey !== 'undefined') {\n\t\tvalidatePublicKey(recipientPublicKey);\n\t}\n\n\tif (\n\t\trecipientId &&\n\t\trecipientPublicKey &&\n\t\trecipientId !== cryptography.getAddressFromPublicKey(recipientPublicKey)\n\t) {\n\t\tthrow new Error('recipientId does not match recipientPublicKey.');\n\t}\n\n\tif (data && data.length > 0) {\n\t\tif (typeof data !== 'string') {\n\t\t\tthrow new Error(\n\t\t\t\t'Invalid encoding in transaction data. Data must be utf-8 encoded string.',\n\t\t\t);\n\t\t}\n\t\tif (data.length > BYTESIZES.DATA) {\n\t\t\tthrow new Error('Transaction data field cannot exceed 64 bytes.');\n\t\t}\n\t}\n};\n\nexport const transfer = (inputs: TransferInputs): TransferTransaction => {\n\tvalidateInputs(inputs);\n\tconst {\n\t\tdata,\n\t\tamount,\n\t\trecipientPublicKey,\n\t\tpassphrase,\n\t\tsecondPassphrase,\n\t\ttimeOffset,\n\t} = inputs;\n\n\tconst recipientIdFromPublicKey = recipientPublicKey\n\t\t? cryptography.getAddressFromPublicKey(recipientPublicKey)\n\t\t: undefined;\n\tconst recipientId = inputs.recipientId\n\t\t? inputs.recipientId\n\t\t: recipientIdFromPublicKey;\n\n\tconst transaction: PartialTransaction = {\n\t\ttype: 0,\n\t\tamount: amount.toString(),\n\t\tfee: TRANSFER_FEE.toString(),\n\t\trecipientId,\n\t\trecipientPublicKey,\n\t\tasset: createAsset(data),\n\t};\n\n\treturn prepareTransaction(\n\t\ttransaction,\n\t\tpassphrase,\n\t\tsecondPassphrase,\n\t\ttimeOffset,\n\t) as TransferTransaction;\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/1_register_second_passphrase.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { SIGNATURE_FEE } from './constants';\nimport {\n\tPartialTransaction,\n\tSecondSignatureTransaction,\n} from './transaction_types';\nimport { prepareTransaction } from './utils';\n\nexport interface SecondPassphraseInputs {\n\treadonly passphrase?: string;\n\treadonly secondPassphrase: string;\n\treadonly timeOffset?: number;\n}\n\nconst validateInputs = ({\n\tsecondPassphrase,\n}: {\n\treadonly secondPassphrase: string;\n}): void => {\n\tif (typeof secondPassphrase !== 'string') {\n\t\tthrow new Error('Please provide a secondPassphrase. Expected string.');\n\t}\n};\n\nexport const registerSecondPassphrase = (\n\tinputs: SecondPassphraseInputs,\n): SecondSignatureTransaction => {\n\tvalidateInputs(inputs);\n\tconst { passphrase, secondPassphrase, timeOffset } = inputs;\n\tconst { publicKey } = cryptography.getKeys(secondPassphrase);\n\n\tconst transaction: PartialTransaction = {\n\t\ttype: 1,\n\t\tfee: SIGNATURE_FEE.toString(),\n\t\tasset: {\n\t\t\tsignature: {\n\t\t\t\tpublicKey,\n\t\t\t},\n\t\t},\n\t};\n\n\treturn prepareTransaction(\n\t\ttransaction,\n\t\tpassphrase,\n\t\tsecondPassphrase,\n\t\ttimeOffset,\n\t) as SecondSignatureTransaction;\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/2_register_delegate.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { DELEGATE_FEE, USERNAME_MAX_LENGTH } from './constants';\nimport { DelegateTransaction, PartialTransaction } from './transaction_types';\nimport { prepareTransaction } from './utils';\n\nexport interface RegisterDelegateInputs {\n\treadonly passphrase?: string;\n\treadonly secondPassphrase?: string;\n\treadonly timeOffset?: number;\n\treadonly username: string;\n}\n\nconst validateInputs = ({ username }: { readonly username: string }): void => {\n\tif (!username || typeof username !== 'string') {\n\t\tthrow new Error('Please provide a username. Expected string.');\n\t}\n\n\tif (username.length > USERNAME_MAX_LENGTH) {\n\t\tthrow new Error(\n\t\t\t`Username length does not match requirements. Expected to be no more than ${USERNAME_MAX_LENGTH} characters.`,\n\t\t);\n\t}\n};\n\nexport const registerDelegate = (\n\tinputs: RegisterDelegateInputs,\n): DelegateTransaction => {\n\tvalidateInputs(inputs);\n\tconst { passphrase, secondPassphrase, timeOffset, username } = inputs;\n\n\tconst transaction: PartialTransaction = {\n\t\ttype: 2,\n\t\tfee: DELEGATE_FEE.toString(),\n\t\tasset: {\n\t\t\tdelegate: {\n\t\t\t\tusername,\n\t\t\t},\n\t\t},\n\t};\n\n\treturn prepareTransaction(\n\t\ttransaction,\n\t\tpassphrase,\n\t\tsecondPassphrase,\n\t\ttimeOffset,\n\t) as DelegateTransaction;\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/3_cast_votes.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { VOTE_FEE } from './constants';\nimport { PartialTransaction, VoteTransaction } from './transaction_types';\nimport {\n\tprepareTransaction,\n\tprependMinusToPublicKeys,\n\tprependPlusToPublicKeys,\n\tvalidatePublicKeys,\n} from './utils';\n\nexport interface CastVoteInputs {\n\treadonly passphrase?: string;\n\treadonly secondPassphrase?: string;\n\treadonly timeOffset?: number;\n\treadonly unvotes?: ReadonlyArray<string>;\n\treadonly votes?: ReadonlyArray<string>;\n}\n\ninterface VotesObject {\n\treadonly unvotes?: ReadonlyArray<string>;\n\treadonly votes?: ReadonlyArray<string>;\n}\n\nconst validateInputs = ({ votes = [], unvotes = [] }: VotesObject): void => {\n\tif (!Array.isArray(votes)) {\n\t\tthrow new Error(\n\t\t\t'Please provide a valid votes value. Expected an array if present.',\n\t\t);\n\t}\n\tif (!Array.isArray(unvotes)) {\n\t\tthrow new Error(\n\t\t\t'Please provide a valid unvotes value. Expected an array if present.',\n\t\t);\n\t}\n\n\tvalidatePublicKeys([...votes, ...unvotes]);\n};\n\nexport const castVotes = (inputs: CastVoteInputs): VoteTransaction => {\n\tvalidateInputs(inputs);\n\tconst {\n\t\tpassphrase,\n\t\tsecondPassphrase,\n\t\ttimeOffset,\n\t\tvotes = [],\n\t\tunvotes = [],\n\t} = inputs;\n\tconst recipientId = passphrase\n\t\t? cryptography.getAddressAndPublicKeyFromPassphrase(passphrase).address\n\t\t: '';\n\n\tconst plusPrependedVotes = prependPlusToPublicKeys(votes);\n\tconst minusPrependedUnvotes = prependMinusToPublicKeys(unvotes);\n\tconst allVotes: ReadonlyArray<string> = [\n\t\t...plusPrependedVotes,\n\t\t...minusPrependedUnvotes,\n\t];\n\n\tconst transaction: PartialTransaction = {\n\t\ttype: 3,\n\t\tfee: VOTE_FEE.toString(),\n\t\trecipientId,\n\t\tasset: {\n\t\t\tvotes: allVotes,\n\t\t},\n\t};\n\n\treturn prepareTransaction(\n\t\ttransaction,\n\t\tpassphrase,\n\t\tsecondPassphrase,\n\t\ttimeOffset,\n\t) as VoteTransaction;\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/4_register_multisignature_account.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport {\n\tMULTISIGNATURE_FEE,\n\tMULTISIGNATURE_MAX_KEYSGROUP,\n\tMULTISIGNATURE_MAX_LIFETIME,\n\tMULTISIGNATURE_MIN_KEYSGROUP,\n\tMULTISIGNATURE_MIN_LIFETIME,\n} from './constants';\nimport {\n\tMultiSignatureTransaction,\n\tPartialTransaction,\n} from './transaction_types';\nimport {\n\tisValidInteger,\n\tprepareTransaction,\n\tprependPlusToPublicKeys,\n\tvalidateKeysgroup,\n} from './utils';\n\nexport interface RegisterMultisignatureInputs {\n\treadonly keysgroup: ReadonlyArray<string>;\n\treadonly lifetime: number;\n\treadonly minimum: number;\n\treadonly passphrase?: string;\n\treadonly secondPassphrase?: string;\n\treadonly timeOffset?: number;\n}\n\nconst validateInputs = ({\n\tkeysgroup,\n\tlifetime,\n\tminimum,\n}: {\n\treadonly keysgroup: ReadonlyArray<string>;\n\treadonly lifetime: number;\n\treadonly minimum: number;\n}): void => {\n\tif (\n\t\t!isValidInteger(lifetime) ||\n\t\tlifetime < MULTISIGNATURE_MIN_LIFETIME ||\n\t\tlifetime > MULTISIGNATURE_MAX_LIFETIME\n\t) {\n\t\tthrow new Error(\n\t\t\t`Please provide a valid lifetime value. Expected integer between ${MULTISIGNATURE_MIN_LIFETIME} and ${MULTISIGNATURE_MAX_LIFETIME}.`,\n\t\t);\n\t}\n\n\tif (\n\t\t!isValidInteger(minimum) ||\n\t\tminimum < MULTISIGNATURE_MIN_KEYSGROUP ||\n\t\tminimum > MULTISIGNATURE_MAX_KEYSGROUP\n\t) {\n\t\tthrow new Error(\n\t\t\t`Please provide a valid minimum value. Expected integer between ${MULTISIGNATURE_MIN_KEYSGROUP} and ${MULTISIGNATURE_MAX_KEYSGROUP}.`,\n\t\t);\n\t}\n\n\tif (keysgroup.length < minimum) {\n\t\tthrow new Error(\n\t\t\t'Minimum number of signatures is larger than the number of keys in the keysgroup.',\n\t\t);\n\t}\n\tvalidateKeysgroup(keysgroup);\n};\n\nexport const registerMultisignature = (\n\tinputs: RegisterMultisignatureInputs,\n): MultiSignatureTransaction => {\n\tvalidateInputs(inputs);\n\tconst {\n\t\tkeysgroup,\n\t\tlifetime,\n\t\tminimum,\n\t\tpassphrase,\n\t\tsecondPassphrase,\n\t\ttimeOffset,\n\t} = inputs;\n\tconst plusPrependedKeysgroup = prependPlusToPublicKeys(keysgroup);\n\tconst keygroupFees = plusPrependedKeysgroup.length + 1;\n\n\tconst transaction: PartialTransaction = {\n\t\ttype: 4,\n\t\tfee: (MULTISIGNATURE_FEE * keygroupFees).toString(),\n\t\tasset: {\n\t\t\tmultisignature: {\n\t\t\t\tmin: minimum,\n\t\t\t\tlifetime,\n\t\t\t\tkeysgroup: plusPrependedKeysgroup,\n\t\t\t},\n\t\t},\n\t};\n\n\treturn prepareTransaction(\n\t\ttransaction,\n\t\tpassphrase,\n\t\tsecondPassphrase,\n\t\ttimeOffset,\n\t) as MultiSignatureTransaction;\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/5_create_dapp.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { DAPP_FEE } from './constants';\nimport { DappTransaction, PartialTransaction } from './transaction_types';\nimport { isValidInteger, prepareTransaction } from './utils';\n\nexport interface DappOptions {\n\treadonly category: number;\n\treadonly description: string;\n\treadonly icon: string;\n\treadonly link: string;\n\treadonly name: string;\n\treadonly tags: string;\n\treadonly type: number;\n}\n\nexport interface DappInputs {\n\treadonly options: DappOptions;\n\treadonly passphrase?: string;\n\treadonly secondPassphrase?: string;\n\treadonly timeOffset?: number;\n}\n\nconst validateInputs = ({ options }: DappInputs): void => {\n\tif (typeof options !== 'object') {\n\t\tthrow new Error('Options must be an object.');\n\t}\n\tconst { category, name, type, link, description, tags, icon } = options;\n\n\tif (!isValidInteger(category)) {\n\t\tthrow new Error('Dapp category must be an integer.');\n\t}\n\tif (typeof name !== 'string') {\n\t\tthrow new Error('Dapp name must be a string.');\n\t}\n\tif (!isValidInteger(type)) {\n\t\tthrow new Error('Dapp type must be an integer.');\n\t}\n\tif (typeof link !== 'string') {\n\t\tthrow new Error('Dapp link must be a string.');\n\t}\n\n\tif (typeof description !== 'undefined' && typeof description !== 'string') {\n\t\tthrow new Error('Dapp description must be a string if provided.');\n\t}\n\n\tif (typeof tags !== 'undefined' && typeof tags !== 'string') {\n\t\tthrow new Error('Dapp tags must be a string if provided.');\n\t}\n\n\tif (typeof icon !== 'undefined' && typeof icon !== 'string') {\n\t\tthrow new Error('Dapp icon must be a string if provided.');\n\t}\n};\n\nexport const createDapp = (inputs: DappInputs): DappTransaction => {\n\tvalidateInputs(inputs);\n\tconst { passphrase, secondPassphrase, timeOffset, options } = inputs;\n\n\tconst transaction: PartialTransaction = {\n\t\ttype: 5,\n\t\tfee: DAPP_FEE.toString(),\n\t\tasset: {\n\t\t\tdapp: {\n\t\t\t\tcategory: options.category,\n\t\t\t\tname: options.name,\n\t\t\t\tdescription: options.description,\n\t\t\t\ttags: options.tags,\n\t\t\t\ttype: options.type,\n\t\t\t\tlink: options.link,\n\t\t\t\ticon: options.icon,\n\t\t\t},\n\t\t},\n\t};\n\n\treturn prepareTransaction(\n\t\ttransaction,\n\t\tpassphrase,\n\t\tsecondPassphrase,\n\t\ttimeOffset,\n\t) as DappTransaction;\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/constants.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\n/* tslint:disable:no-magic-numbers */\nexport const FIXED_POINT = 10 ** 8;\n\nexport const TRANSFER_FEE = FIXED_POINT * 0.1;\nexport const IN_TRANSFER_FEE = FIXED_POINT * 0.1;\nexport const OUT_TRANSFER_FEE = FIXED_POINT * 0.1;\nexport const SIGNATURE_FEE = FIXED_POINT * 5;\nexport const DELEGATE_FEE = FIXED_POINT * 25;\nexport const VOTE_FEE = FIXED_POINT * 1;\nexport const MULTISIGNATURE_FEE = FIXED_POINT * 5;\nexport const MULTISIGNATURE_MAX_LIFETIME = 72;\nexport const MULTISIGNATURE_MIN_LIFETIME = 1;\nexport const MULTISIGNATURE_MAX_KEYSGROUP = 15;\nexport const MULTISIGNATURE_MIN_KEYSGROUP = 1;\nexport const DAPP_FEE = FIXED_POINT * 25;\nexport const USERNAME_MAX_LENGTH = 20;\n\nexport const BYTESIZES = {\n\tTYPE: 1,\n\tTIMESTAMP: 4,\n\tMULTISIGNATURE_PUBLICKEY: 32,\n\tRECIPIENT_ID: 8,\n\tAMOUNT: 8,\n\tSIGNATURE_TRANSACTION: 64,\n\tSECOND_SIGNATURE_TRANSACTION: 64,\n\tDATA: 64,\n};\n\nexport const EPOCH_TIME = new Date(Date.UTC(2016, 4, 24, 17, 0, 0, 0));\nexport const EPOCH_TIME_MILLISECONDS = EPOCH_TIME.getTime();\nconst MS_FACTOR = 1000;\nexport const EPOCH_TIME_SECONDS = Math.floor(EPOCH_TIME.getTime() / MS_FACTOR);\n\n// Largest possible number which can be stored in eight bytes.\n// Derived from bignum.fromBuffer(Buffer.from(new Array(8).fill(255))).\nconst MAX_EIGHT_BYTE_NUMBER = '18446744073709551615';\n\nexport const MAX_ADDRESS_NUMBER = MAX_EIGHT_BYTE_NUMBER;\nexport const MAX_TRANSACTION_ID = MAX_EIGHT_BYTE_NUMBER;\n// Largest possible amount. Maximum value for PostgreSQL bigint.\nexport const MAX_TRANSACTION_AMOUNT = '9223372036854775807';\n"
  },
  {
    "path": "packages/lisk-transactions/src/create_signature_object.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { BaseTransaction } from './transaction_types';\nimport { multiSignTransaction, verifyTransaction } from './utils';\n\nexport interface SignatureObject {\n\treadonly publicKey: string;\n\treadonly signature: string;\n\treadonly transactionId: string;\n}\n\nexport const createSignatureObject = (\n\ttransaction: BaseTransaction,\n\tpassphrase: string,\n): SignatureObject => {\n\tif (!verifyTransaction(transaction)) {\n\t\tthrow new Error('Invalid transaction.');\n\t}\n\n\tif (!transaction.id) {\n\t\tthrow new Error('Transaction ID is required to create a signature object.');\n\t}\n\n\tconst { publicKey } = cryptography.getPrivateAndPublicKeyFromPassphrase(\n\t\tpassphrase,\n\t);\n\n\treturn {\n\t\ttransactionId: transaction.id,\n\t\tpublicKey,\n\t\tsignature: multiSignTransaction(transaction, passphrase),\n\t};\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { transfer } from './0_transfer';\nimport { registerSecondPassphrase } from './1_register_second_passphrase';\nimport { registerDelegate } from './2_register_delegate';\nimport { castVotes } from './3_cast_votes';\nimport { registerMultisignature } from './4_register_multisignature_account';\nimport { createDapp } from './5_create_dapp';\nimport * as constants from './constants';\nimport { createSignatureObject } from './create_signature_object';\nimport * as utils from './utils';\n\nexport {\n\ttransfer,\n\tregisterSecondPassphrase,\n\tregisterDelegate,\n\tcastVotes,\n\tregisterMultisignature,\n\tcreateSignatureObject,\n\tcreateDapp,\n\tutils,\n\tconstants,\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/transaction_types.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nexport interface BaseTransaction {\n\treadonly amount: string;\n\treadonly asset: TransactionAsset;\n\treadonly fee: string;\n\treadonly id?: string;\n\treadonly recipientId: string | null;\n\treadonly recipientPublicKey?: string | null;\n\treadonly requesterPublicKey?: string;\n\treadonly senderId?: string;\n\treadonly senderPublicKey: string;\n\treadonly signature?: string;\n\treadonly signatures?: ReadonlyArray<string>;\n\treadonly signSignature?: string;\n\treadonly timestamp: number;\n\treadonly type: number;\n}\n\ntype Partial<T> = { [P in keyof T]?: T[P] };\n\nexport type PartialTransaction = Partial<BaseTransaction>;\n\nexport type TransactionAsset =\n\t| TransferAsset\n\t| SecondSignatureAsset\n\t| DelegateAsset\n\t| VoteAsset\n\t| MultiSignatureAsset\n\t| DappAsset\n\t| InTransferAsset\n\t| OutTransferAsset;\n\nexport interface TransferTransaction extends BaseTransaction {\n\treadonly asset: TransferAsset;\n}\n\nexport interface TransferAsset {\n\treadonly data?: string;\n}\n\nexport interface SecondSignatureTransaction extends BaseTransaction {\n\treadonly asset: SecondSignatureAsset;\n}\n\nexport interface SecondSignatureAsset {\n\treadonly signature: {\n\t\treadonly publicKey: string;\n\t};\n}\n\nexport interface DelegateTransaction extends BaseTransaction {\n\treadonly asset: DelegateAsset;\n}\n\nexport interface DelegateAsset {\n\treadonly delegate: {\n\t\treadonly username: string;\n\t};\n}\n\nexport interface VoteTransaction extends BaseTransaction {\n\treadonly asset: VoteAsset;\n}\n\nexport interface VoteAsset {\n\treadonly votes: ReadonlyArray<string>;\n}\n\nexport interface MultiSignatureTransaction extends BaseTransaction {\n\treadonly asset: MultiSignatureAsset;\n}\n\nexport interface MultiSignatureAsset {\n\treadonly multisignature: {\n\t\treadonly keysgroup: ReadonlyArray<string>;\n\t\treadonly lifetime: number;\n\t\treadonly min: number;\n\t};\n}\n\nexport interface DappTransaction extends BaseTransaction {\n\treadonly asset: DappAsset;\n}\n\nexport interface DappAsset {\n\treadonly dapp: {\n\t\treadonly category: number;\n\t\treadonly description?: string;\n\t\treadonly icon?: string;\n\t\treadonly link: string;\n\t\treadonly name: string;\n\t\treadonly tags?: string;\n\t\treadonly type: number;\n\t};\n}\n\nexport interface InTransferTransaction extends BaseTransaction {\n\treadonly asset: InTransferAsset;\n}\n\nexport interface InTransferAsset {\n\treadonly inTransfer: {\n\t\treadonly dappId: string;\n\t};\n}\n\nexport interface OutTransferTransaction extends BaseTransaction {\n\treadonly asset: OutTransferAsset;\n}\n\nexport interface OutTransferAsset {\n\treadonly outTransfer: {\n\t\treadonly dappId: string;\n\t\treadonly transactionId: string;\n\t};\n}\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/format.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport BigNum from 'browserify-bignum';\nimport { FIXED_POINT } from '../constants';\nimport { isGreaterThanMaxTransactionAmount } from './validation';\n\nconst BASE_10 = 10;\nconst LISK_MAX_DECIMAL_POINTS = 8;\nconst getDecimalPlaces = (amount: string): number =>\n\t(amount.split('.')[1] || '').length;\n\nexport const convertBeddowsToLSK = (beddowsAmount?: string): string => {\n\tif (typeof beddowsAmount !== 'string') {\n\t\tthrow new Error('Cannot convert non-string amount');\n\t}\n\tif (getDecimalPlaces(beddowsAmount)) {\n\t\tthrow new Error('Beddows amount should not have decimal points');\n\t}\n\tconst beddowsAmountBigNum = new BigNum(beddowsAmount);\n\tif (isGreaterThanMaxTransactionAmount(beddowsAmountBigNum)) {\n\t\tthrow new Error('Beddows amount out of range');\n\t}\n\tconst lskAmountBigNum = beddowsAmountBigNum.div(FIXED_POINT);\n\n\treturn lskAmountBigNum.toString(BASE_10);\n};\n\nexport const convertLSKToBeddows = (lskAmount?: string): string => {\n\tif (typeof lskAmount !== 'string') {\n\t\tthrow new Error('Cannot convert non-string amount');\n\t}\n\tif (getDecimalPlaces(lskAmount) > LISK_MAX_DECIMAL_POINTS) {\n\t\tthrow new Error('LSK amount has too many decimal points');\n\t}\n\tconst lskAmountBigNum = new BigNum(lskAmount);\n\tconst beddowsAmountBigNum = lskAmountBigNum.mul(FIXED_POINT);\n\tif (isGreaterThanMaxTransactionAmount(beddowsAmountBigNum)) {\n\t\tthrow new Error('LSK amount out of range');\n\t}\n\n\treturn beddowsAmountBigNum.toString();\n};\n\nexport const prependPlusToPublicKeys = (\n\tpublicKeys: ReadonlyArray<string>,\n): ReadonlyArray<string> => publicKeys.map(publicKey => `+${publicKey}`);\n\nexport const prependMinusToPublicKeys = (\n\tpublicKeys: ReadonlyArray<string>,\n): ReadonlyArray<string> => publicKeys.map(publicKey => `-${publicKey}`);\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/get_address_and_public_key_from_recipient_data.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '@liskhq/lisk-cryptography';\n\ninterface RecipientIdAndPublicKey {\n\treadonly recipientId: string;\n\treadonly recipientPublicKey?: string;\n}\n\nexport const getAddressAndPublicKeyFromRecipientData = ({\n\trecipientId,\n\trecipientPublicKey,\n}: RecipientIdAndPublicKey): {\n\treadonly address: string;\n\treadonly publicKey?: string;\n} => {\n\tif (recipientId && recipientPublicKey) {\n\t\tconst addressFromPublicKey = cryptography.getAddressFromPublicKey(\n\t\t\trecipientPublicKey,\n\t\t);\n\t\tif (recipientId === addressFromPublicKey) {\n\t\t\treturn { address: recipientId, publicKey: recipientPublicKey };\n\t\t}\n\t\tthrow new Error(\n\t\t\t'Could not create transaction: recipientId does not match recipientPublicKey.',\n\t\t);\n\t}\n\n\tif (!recipientId && recipientPublicKey) {\n\t\tconst addressFromPublicKey = cryptography.getAddressFromPublicKey(\n\t\t\trecipientPublicKey,\n\t\t);\n\n\t\treturn { address: addressFromPublicKey, publicKey: recipientPublicKey };\n\t}\n\n\treturn { address: recipientId, publicKey: undefined };\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/get_transaction_bytes.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport BigNum from 'browserify-bignum';\nimport { BYTESIZES, MAX_TRANSACTION_AMOUNT } from '../constants';\nimport {\n\tBaseTransaction,\n\tDappAsset,\n\tDelegateAsset,\n\tInTransferAsset,\n\tMultiSignatureAsset,\n\tOutTransferAsset,\n\tPartialTransaction,\n\tSecondSignatureAsset,\n\tTransactionAsset,\n\tTransferAsset,\n\tTransferTransaction,\n\tVoteAsset,\n} from '../transaction_types';\n\nexport const isValidValue = (value: unknown): boolean => {\n\tif (value === undefined) {\n\t\treturn false;\n\t}\n\tif (typeof value === 'number' && Number.isNaN(value)) {\n\t\treturn false;\n\t}\n\tif (value === false) {\n\t\treturn false;\n\t}\n\n\treturn true;\n};\n\nexport const checkRequiredFields = (\n\trequiredFields: ReadonlyArray<string>,\n\tdata: { readonly [key: string]: unknown },\n): boolean => {\n\tconst dataFields = Object.keys(data);\n\trequiredFields.forEach(parameter => {\n\t\tif (!dataFields.includes(parameter) || !isValidValue(data[parameter])) {\n\t\t\tthrow new Error(`${parameter} is a required parameter.`);\n\t\t}\n\t});\n\n\treturn true;\n};\n\nexport const getAssetDataForTransferTransaction = (\n\tasset: TransactionAsset,\n): Buffer => {\n\tconst { data } = asset as TransferAsset;\n\n\treturn data ? Buffer.from(data, 'utf8') : Buffer.alloc(0);\n};\n\nexport const getAssetDataForRegisterSecondSignatureTransaction = (\n\tasset: TransactionAsset,\n): Buffer => {\n\tconst { signature } = asset as SecondSignatureAsset;\n\tcheckRequiredFields(['publicKey'], signature);\n\tconst { publicKey } = signature;\n\n\treturn cryptography.hexToBuffer(publicKey);\n};\n\nexport const getAssetDataForRegisterDelegateTransaction = (\n\tasset: TransactionAsset,\n): Buffer => {\n\tconst { delegate } = asset as DelegateAsset;\n\tcheckRequiredFields(['username'], delegate);\n\tconst { username } = delegate;\n\n\treturn Buffer.from(username, 'utf8');\n};\n\nexport const getAssetDataForCastVotesTransaction = (\n\tasset: TransactionAsset,\n): Buffer => {\n\tconst { votes } = asset as VoteAsset;\n\tif (!Array.isArray(votes)) {\n\t\tthrow new Error('votes parameter must be an Array.');\n\t}\n\n\treturn Buffer.from(votes.join(''), 'utf8');\n};\n\nexport const getAssetDataForRegisterMultisignatureAccountTransaction = (\n\tasset: TransactionAsset,\n): Buffer => {\n\tconst { multisignature } = asset as MultiSignatureAsset;\n\tcheckRequiredFields(['min', 'lifetime', 'keysgroup'], multisignature);\n\tconst { min, lifetime, keysgroup } = multisignature;\n\tconst minBuffer = Buffer.alloc(1, min);\n\tconst lifetimeBuffer = Buffer.alloc(1, lifetime);\n\tconst keysgroupBuffer = Buffer.from(keysgroup.join(''), 'utf8');\n\n\treturn Buffer.concat([minBuffer, lifetimeBuffer, keysgroupBuffer]);\n};\n\nconst DAPP_TYPE_LENGTH = 4;\nconst DAPP_CATEGORY_LENGTH = 4;\n\nexport const getAssetDataForCreateDappTransaction = (\n\tasset: TransactionAsset,\n): Buffer => {\n\tconst { dapp } = asset as DappAsset;\n\tcheckRequiredFields(['name', 'link', 'type', 'category'], dapp);\n\tconst { name, description, tags, link, icon, type, category } = dapp;\n\tconst nameBuffer = Buffer.from(name, 'utf8');\n\tconst linkBuffer = Buffer.from(link, 'utf8');\n\tconst typeBuffer = Buffer.alloc(DAPP_TYPE_LENGTH);\n\ttypeBuffer.writeIntLE(type, 0, DAPP_TYPE_LENGTH);\n\tconst categoryBuffer = Buffer.alloc(DAPP_CATEGORY_LENGTH);\n\tcategoryBuffer.writeIntLE(category, 0, DAPP_CATEGORY_LENGTH);\n\n\tconst descriptionBuffer = description\n\t\t? Buffer.from(description, 'utf8')\n\t\t: Buffer.alloc(0);\n\tconst tagsBuffer = tags ? Buffer.from(tags, 'utf8') : Buffer.alloc(0);\n\tconst iconBuffer = icon ? Buffer.from(icon, 'utf8') : Buffer.alloc(0);\n\n\treturn Buffer.concat([\n\t\tnameBuffer,\n\t\tdescriptionBuffer,\n\t\ttagsBuffer,\n\t\tlinkBuffer,\n\t\ticonBuffer,\n\t\ttypeBuffer,\n\t\tcategoryBuffer,\n\t]);\n};\n\nexport const getAssetDataForTransferIntoDappTransaction = (\n\tasset: TransactionAsset,\n): Buffer => {\n\tconst { inTransfer } = asset as InTransferAsset;\n\tcheckRequiredFields(['dappId'], inTransfer);\n\tconst { dappId } = inTransfer;\n\n\treturn Buffer.from(dappId, 'utf8');\n};\n\nexport const getAssetDataForTransferOutOfDappTransaction = (\n\tasset: TransactionAsset,\n): Buffer => {\n\tconst { outTransfer } = asset as OutTransferAsset;\n\tcheckRequiredFields(['dappId', 'transactionId'], outTransfer);\n\tconst { dappId, transactionId } = outTransfer;\n\tconst outAppIdBuffer = Buffer.from(dappId, 'utf8');\n\tconst outTransactionIdBuffer = Buffer.from(transactionId, 'utf8');\n\n\treturn Buffer.concat([outAppIdBuffer, outTransactionIdBuffer]);\n};\n\nconst transactionTypeAssetGetBytesMap: {\n\treadonly [type: number]: (asset: TransactionAsset) => Buffer;\n} = {\n\t0: getAssetDataForTransferTransaction,\n\t1: getAssetDataForRegisterSecondSignatureTransaction,\n\t2: getAssetDataForRegisterDelegateTransaction,\n\t3: getAssetDataForCastVotesTransaction,\n\t4: getAssetDataForRegisterMultisignatureAccountTransaction,\n\t5: getAssetDataForCreateDappTransaction,\n\t6: getAssetDataForTransferIntoDappTransaction,\n\t7: getAssetDataForTransferOutOfDappTransaction,\n};\n\nexport const getAssetBytes = (transaction: BaseTransaction): Buffer =>\n\ttransactionTypeAssetGetBytesMap[transaction.type](transaction.asset);\n\nconst REQUIRED_TRANSACTION_PARAMETERS: ReadonlyArray<string> = [\n\t'type',\n\t'timestamp',\n\t'senderPublicKey',\n\t'amount',\n];\n\nexport const checkTransaction = (transaction: PartialTransaction): boolean => {\n\tcheckRequiredFields(REQUIRED_TRANSACTION_PARAMETERS, transaction);\n\tconst {\n\t\tasset: { data },\n\t} = transaction as TransferTransaction;\n\tif (data && data.length > BYTESIZES.DATA) {\n\t\tthrow new Error(\n\t\t\t`Transaction asset data exceeds size of ${BYTESIZES.DATA}.`,\n\t\t);\n\t}\n\n\treturn true;\n};\n\nexport const getTransactionBytes = (transaction: BaseTransaction): Buffer => {\n\tcheckTransaction(transaction);\n\n\tconst {\n\t\ttype,\n\t\ttimestamp,\n\t\trequesterPublicKey,\n\t\tsenderPublicKey,\n\t\trecipientId,\n\t\tamount,\n\t\tsignature,\n\t\tsignSignature,\n\t} = transaction;\n\n\tconst transactionType = Buffer.alloc(BYTESIZES.TYPE, type);\n\tconst transactionTimestamp = Buffer.alloc(BYTESIZES.TIMESTAMP);\n\ttransactionTimestamp.writeIntLE(timestamp, 0, BYTESIZES.TIMESTAMP);\n\n\tconst transactionSenderPublicKey = cryptography.hexToBuffer(senderPublicKey);\n\tconst transactionRequesterPublicKey = requesterPublicKey\n\t\t? cryptography.hexToBuffer(requesterPublicKey)\n\t\t: Buffer.alloc(0);\n\n\tconst transactionRecipientID = recipientId\n\t\t? cryptography.bigNumberToBuffer(\n\t\t\t\trecipientId.slice(0, -1),\n\t\t\t\tBYTESIZES.RECIPIENT_ID,\n\t\t  )\n\t\t: Buffer.alloc(BYTESIZES.RECIPIENT_ID);\n\n\tconst amountBigNum = new BigNum(amount);\n\tif (amountBigNum.lt(0)) {\n\t\tthrow new Error('Transaction amount must not be negative.');\n\t}\n\t// BUG in browserify-bignum prevents us using `.gt` directly.\n\t// See https://github.com/bored-engineer/browserify-bignum/pull/2\n\tif (amountBigNum.gte(new BigNum(MAX_TRANSACTION_AMOUNT).add(1))) {\n\t\tthrow new Error('Transaction amount is too large.');\n\t}\n\tconst transactionAmount = amountBigNum.toBuffer({\n\t\tendian: 'little',\n\t\tsize: BYTESIZES.AMOUNT,\n\t});\n\n\tconst transactionAssetData = getAssetBytes(transaction);\n\n\tconst transactionSignature = signature\n\t\t? cryptography.hexToBuffer(signature)\n\t\t: Buffer.alloc(0);\n\n\tconst transactionSecondSignature = signSignature\n\t\t? cryptography.hexToBuffer(signSignature)\n\t\t: Buffer.alloc(0);\n\n\treturn Buffer.concat([\n\t\ttransactionType,\n\t\ttransactionTimestamp,\n\t\ttransactionSenderPublicKey,\n\t\ttransactionRequesterPublicKey,\n\t\ttransactionRecipientID,\n\t\ttransactionAmount,\n\t\ttransactionAssetData,\n\t\ttransactionSignature,\n\t\ttransactionSecondSignature,\n\t]);\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/get_transaction_hash.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { BaseTransaction } from '../transaction_types';\nimport { getTransactionBytes } from './get_transaction_bytes';\n\nexport const getTransactionHash = (transaction: BaseTransaction): Buffer => {\n\tconst bytes = getTransactionBytes(transaction);\n\n\treturn cryptography.hash(bytes);\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/get_transaction_id.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { BaseTransaction } from '../transaction_types';\nimport { getTransactionBytes } from './get_transaction_bytes';\n\nexport const getTransactionId = (transaction: BaseTransaction): string => {\n\tconst transactionBytes = getTransactionBytes(transaction);\n\tconst transactionHash = cryptography.hash(transactionBytes);\n\tconst bufferFromFirstEntriesReversed = cryptography.getFirstEightBytesReversed(\n\t\ttransactionHash,\n\t);\n\tconst firstEntriesToNumber = cryptography.bufferToBigNumberString(\n\t\tbufferFromFirstEntriesReversed,\n\t);\n\n\treturn firstEntriesToNumber;\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nexport { getTransactionBytes } from './get_transaction_bytes';\nexport { getTransactionHash } from './get_transaction_hash';\nexport { getTransactionId } from './get_transaction_id';\nexport {\n\tconvertBeddowsToLSK,\n\tconvertLSKToBeddows,\n\tprependPlusToPublicKeys,\n\tprependMinusToPublicKeys,\n} from './format';\nexport { prepareTransaction } from './prepare_transaction';\nexport {\n\tsignTransaction,\n\tmultiSignTransaction,\n\tverifyTransaction,\n} from './sign_and_verify';\nexport { signRawTransaction } from './sign_raw_transaction';\nexport { getTimeFromBlockchainEpoch, getTimeWithOffset } from './time';\nexport {\n\tcheckPublicKeysForDuplicates,\n\tvalidatePublicKey,\n\tvalidatePublicKeys,\n\tvalidateKeysgroup,\n\tvalidateAddress,\n\tvalidateAmount,\n\tvalidateTransferAmount,\n\tvalidateFee,\n\tisValidInteger,\n\tvalidateTransaction,\n} from './validation';\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/prepare_transaction.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { BaseTransaction, PartialTransaction } from '../transaction_types';\nimport { getTransactionId } from './get_transaction_id';\nimport { signTransaction } from './sign_and_verify';\nimport { getTimeWithOffset } from './time';\n\nconst secondSignTransaction = (\n\ttransactionObject: BaseTransaction,\n\tsecondPassphrase: string,\n): BaseTransaction => ({\n\t...transactionObject,\n\tsignSignature: signTransaction(transactionObject, secondPassphrase),\n});\n\nconst validTransaction = (\n\tpartial: PartialTransaction,\n): partial is BaseTransaction => partial.type !== undefined;\n\nexport const prepareTransaction = (\n\tpartialTransaction: PartialTransaction,\n\tpassphrase?: string,\n\tsecondPassphrase?: string,\n\ttimeOffset?: number,\n): BaseTransaction => {\n\tconst senderPublicKey = passphrase\n\t\t? cryptography.getKeys(passphrase).publicKey\n\t\t: undefined;\n\tconst timestamp = getTimeWithOffset(timeOffset);\n\n\tconst transaction = {\n\t\tamount: '0',\n\t\trecipientId: '',\n\t\tsenderPublicKey,\n\t\ttimestamp,\n\t\t...partialTransaction,\n\t};\n\n\tif (!validTransaction(transaction)) {\n\t\tthrow new Error('Invalid transaction to process');\n\t}\n\n\tif (!passphrase) {\n\t\treturn transaction;\n\t}\n\n\tconst singleSignedTransaction = {\n\t\t...transaction,\n\t\tsignature: signTransaction(transaction, passphrase),\n\t};\n\n\tconst signedTransaction =\n\t\ttypeof secondPassphrase === 'string' && transaction.type !== 1\n\t\t\t? secondSignTransaction(singleSignedTransaction, secondPassphrase)\n\t\t\t: singleSignedTransaction;\n\n\tconst transactionWithId = {\n\t\t...signedTransaction,\n\t\tid: getTransactionId(signedTransaction),\n\t};\n\n\treturn transactionWithId;\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/sign_and_verify.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { BaseTransaction } from '../transaction_types';\nimport { getTransactionHash } from './get_transaction_hash';\n\nexport const signTransaction = (\n\ttransaction: BaseTransaction,\n\tpassphrase: string,\n): string => {\n\tconst transactionHash = getTransactionHash(transaction);\n\n\treturn cryptography.signData(transactionHash, passphrase);\n};\n\nexport const multiSignTransaction = (\n\ttransaction: BaseTransaction,\n\tpassphrase: string,\n): string => {\n\tconst { signature, signSignature, ...transactionToSign } = transaction;\n\n\tconst transactionHash = getTransactionHash(transactionToSign);\n\n\treturn cryptography.signData(transactionHash, passphrase);\n};\n\nexport const verifyTransaction = (\n\ttransaction: BaseTransaction,\n\tsecondPublicKey?: string,\n): boolean => {\n\tif (!transaction.signature) {\n\t\tthrow new Error('Cannot verify transaction without signature.');\n\t}\n\tif (!!transaction.signSignature && !secondPublicKey) {\n\t\tthrow new Error('Cannot verify signSignature without secondPublicKey.');\n\t}\n\n\tconst {\n\t\tsignature,\n\t\tsignSignature,\n\t\t...transactionWithoutSignatures\n\t} = transaction;\n\tconst transactionWithoutSignature = !!transaction.signSignature\n\t\t? {\n\t\t\t\t...transactionWithoutSignatures,\n\t\t\t\tsignature,\n\t\t  }\n\t\t: transactionWithoutSignatures;\n\n\tconst transactionHash = getTransactionHash(transactionWithoutSignature);\n\n\tconst publicKey =\n\t\t!!transaction.signSignature && secondPublicKey\n\t\t\t? secondPublicKey\n\t\t\t: transaction.senderPublicKey;\n\tconst lastSignature = transaction.signSignature\n\t\t? transaction.signSignature\n\t\t: transaction.signature;\n\n\tconst verified = cryptography.verifyData(\n\t\ttransactionHash,\n\t\tlastSignature,\n\t\tpublicKey,\n\t);\n\n\treturn !!transaction.signSignature\n\t\t? verified && verifyTransaction(transactionWithoutSignature)\n\t\t: verified;\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/sign_raw_transaction.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { BaseTransaction, PartialTransaction } from '../transaction_types';\nimport { prepareTransaction } from './prepare_transaction';\nimport { getTimeWithOffset } from './time';\n\ninterface SignRawTransactionInput {\n\treadonly passphrase: string;\n\treadonly secondPassphrase?: string;\n\treadonly timeOffset?: number;\n\treadonly transaction: PartialTransaction;\n}\n\nexport const signRawTransaction = ({\n\ttransaction,\n\tpassphrase,\n\tsecondPassphrase,\n\ttimeOffset,\n}: SignRawTransactionInput): BaseTransaction => {\n\tconst {\n\t\tpublicKey,\n\t\taddress,\n\t} = cryptography.getAddressAndPublicKeyFromPassphrase(passphrase);\n\tconst senderSecondPublicKey = secondPassphrase\n\t\t? cryptography.getPrivateAndPublicKeyFromPassphrase(secondPassphrase)\n\t\t\t\t.publicKey\n\t\t: undefined;\n\n\tconst propertiesToAdd = {\n\t\tsenderPublicKey: publicKey,\n\t\tsenderSecondPublicKey,\n\t\tsenderId: address,\n\t\ttimestamp: getTimeWithOffset(timeOffset),\n\t};\n\n\tconst transactionWithProperties = {\n\t\t...transaction,\n\t\t...propertiesToAdd,\n\t};\n\n\treturn prepareTransaction(\n\t\ttransactionWithProperties,\n\t\tpassphrase,\n\t\tsecondPassphrase,\n\t);\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/time.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\n\nimport { EPOCH_TIME_MILLISECONDS } from '../constants';\n\nconst MS_TIME = 1000;\n\nexport const getTimeFromBlockchainEpoch = (givenTimestamp?: number): number => {\n\tconst startingPoint = givenTimestamp || new Date().getTime();\n\tconst blockchainInitialTime = EPOCH_TIME_MILLISECONDS;\n\n\treturn Math.floor((startingPoint - blockchainInitialTime) / MS_TIME);\n};\n\nexport const getTimeWithOffset = (offset?: number): number => {\n\tconst now = new Date().getTime();\n\tconst timeWithOffset = offset ? now + offset * MS_TIME : now;\n\n\treturn getTimeFromBlockchainEpoch(timeWithOffset);\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/validation/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\n\nexport {\n\tcheckPublicKeysForDuplicates,\n\tvalidatePublicKey,\n\tvalidatePublicKeys,\n\tvalidateKeysgroup,\n\tvalidateAddress,\n\tvalidateAmount,\n\tvalidateTransferAmount,\n\tvalidateFee,\n\tisValidInteger,\n\tisGreaterThanMaxTransactionAmount,\n\tisGreaterThanZero,\n} from './validation';\n\nexport { validateTransaction } from './validate_transaction';\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/validation/schema.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\n\nexport const baseTransaction = {\n\t$id: 'lisk/base-transaction',\n\ttype: 'object',\n\trequired: [\n\t\t'id',\n\t\t'type',\n\t\t'amount',\n\t\t'fee',\n\t\t'senderPublicKey',\n\t\t'recipientId',\n\t\t'timestamp',\n\t\t'asset',\n\t\t'signature',\n\t],\n\tproperties: {\n\t\tid: {\n\t\t\ttype: 'string',\n\t\t\tformat: 'id',\n\t\t},\n\t\tamount: {\n\t\t\ttype: 'string',\n\t\t\tformat: 'amount',\n\t\t},\n\t\tfee: {\n\t\t\ttype: 'string',\n\t\t\tformat: 'fee',\n\t\t},\n\t\ttype: {\n\t\t\ttype: 'integer',\n\t\t\tminimum: 0,\n\t\t\tmaximum: 7,\n\t\t},\n\t\ttimestamp: {\n\t\t\ttype: 'integer',\n\t\t\tminimum: 0,\n\t\t\tmaximum: 2147483647,\n\t\t},\n\t\tsenderId: {\n\t\t\ttype: 'string',\n\t\t\tformat: 'address',\n\t\t},\n\t\tsenderPublicKey: {\n\t\t\ttype: 'string',\n\t\t\tformat: 'publicKey',\n\t\t},\n\t\tsenderSecondPublicKey: {\n\t\t\ttype: 'string',\n\t\t\tformat: 'publicKey',\n\t\t},\n\t\trecipientId: {\n\t\t\ttype: 'string',\n\t\t},\n\t\trecipientPublicKey: {\n\t\t\ttype: ['string', 'null'],\n\t\t\tformat: 'publicKey',\n\t\t},\n\t\tsignature: {\n\t\t\ttype: 'string',\n\t\t\tformat: 'signature',\n\t\t},\n\t\tsignSignature: {\n\t\t\ttype: 'string',\n\t\t\tformat: 'signature',\n\t\t},\n\t\tsignatures: {\n\t\t\ttype: 'array',\n\t\t\tuniqueItems: true,\n\t\t\titems: {\n\t\t\t\ttype: 'string',\n\t\t\t\tformat: 'signature',\n\t\t\t},\n\t\t},\n\t\tasset: {\n\t\t\ttype: 'object',\n\t\t},\n\t},\n};\n\nexport const transferTransaction = {\n\t$merge: {\n\t\tsource: { $ref: 'lisk/base-transaction' },\n\t\twith: {\n\t\t\tproperties: {\n\t\t\t\trecipientId: {\n\t\t\t\t\tformat: 'address',\n\t\t\t\t},\n\t\t\t\tamount: {\n\t\t\t\t\tformat: 'transferAmount',\n\t\t\t\t},\n\t\t\t\tasset: {\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tdata: {\n\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\tmaxLength: 64,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n};\n\nexport const signatureTransaction = {\n\t$merge: {\n\t\tsource: { $ref: 'lisk/base-transaction' },\n\t\twith: {\n\t\t\tproperties: {\n\t\t\t\tasset: {\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\trequired: ['signature'],\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tsignature: {\n\t\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\t\trequired: ['publicKey'],\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tpublicKey: {\n\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\tformat: 'publicKey',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n};\n\nexport const delegateTransaction = {\n\t$merge: {\n\t\tsource: { $ref: 'lisk/base-transaction' },\n\t\twith: {\n\t\t\tproperties: {\n\t\t\t\tasset: {\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\trequired: ['delegate'],\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tdelegate: {\n\t\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\t\trequired: ['username'],\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tusername: {\n\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\tmaxLength: 20,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n};\n\nexport const voteTransaction = {\n\t$merge: {\n\t\tsource: { $ref: 'lisk/base-transaction' },\n\t\twith: {\n\t\t\tproperties: {\n\t\t\t\tasset: {\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\trequired: ['votes'],\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tvotes: {\n\t\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\t\tuniqueSignedPublicKeys: true,\n\t\t\t\t\t\t\tminItems: 1,\n\t\t\t\t\t\t\tmaxItems: 33,\n\t\t\t\t\t\t\titems: {\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tformat: 'signedPublicKey',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n};\n\nexport const multiTransaction = {\n\t$merge: {\n\t\tsource: { $ref: 'lisk/base-transaction' },\n\t\twith: {\n\t\t\tproperties: {\n\t\t\t\tasset: {\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\trequired: ['multisignature'],\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tmultisignature: {\n\t\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\t\trequired: ['min', 'lifetime', 'keysgroup'],\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\tmin: {\n\t\t\t\t\t\t\t\t\ttype: 'integer',\n\t\t\t\t\t\t\t\t\tminimum: 1,\n\t\t\t\t\t\t\t\t\tmaximum: 15,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tlifetime: {\n\t\t\t\t\t\t\t\t\ttype: 'integer',\n\t\t\t\t\t\t\t\t\tminimum: 1,\n\t\t\t\t\t\t\t\t\tmaximum: 72,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tkeysgroup: {\n\t\t\t\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\t\t\t\tuniqueItems: true,\n\t\t\t\t\t\t\t\t\tminItems: 1,\n\t\t\t\t\t\t\t\t\tmaxItems: 15,\n\t\t\t\t\t\t\t\t\titems: {\n\t\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\t\tformat: 'additionPublicKey',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n};\n\nexport const dappTransaction = {\n\t$merge: {\n\t\tsource: { $ref: 'lisk/base-transaction' },\n\t\twith: {\n\t\t\tproperties: {\n\t\t\t\tasset: {\n\t\t\t\t\ttype: 'object',\n\t\t\t\t\trequired: ['dapp'],\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tdapp: {\n\t\t\t\t\t\t\ttype: 'object',\n\t\t\t\t\t\t\trequired: ['name', 'type', 'category', 'link'],\n\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\ticon: {\n\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tcategory: {\n\t\t\t\t\t\t\t\t\ttype: 'integer',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttype: {\n\t\t\t\t\t\t\t\t\ttype: 'integer',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tlink: {\n\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttags: {\n\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdescription: {\n\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tname: {\n\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t},\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/validation/validate_transaction.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { ErrorObject, ValidateFunction } from 'ajv';\nimport {\n\tMultiSignatureTransaction,\n\tPartialTransaction,\n} from '../../transaction_types';\nimport * as schemas from './schema';\nimport { validator } from './validator';\n\nconst TRANSACTION_TYPE_MULTI_SIGNATURE = 4;\n\nconst schemaMap: { readonly [key: number]: ValidateFunction } = {\n\t0: validator.compile(schemas.transferTransaction),\n\t1: validator.compile(schemas.signatureTransaction),\n\t2: validator.compile(schemas.delegateTransaction),\n\t3: validator.compile(schemas.voteTransaction),\n\t4: validator.compile(schemas.multiTransaction),\n\t5: validator.compile(schemas.dappTransaction),\n};\n\nconst getTransactionSchemaValidator = (type: number): ValidateFunction => {\n\tconst schema = schemaMap[type];\n\tif (!schema) {\n\t\tthrow new Error('Unsupported transaction type.');\n\t}\n\n\treturn schema;\n};\n\ninterface ValidationResult {\n\treadonly errors?: ReadonlyArray<ErrorObject>;\n\treadonly valid: boolean;\n}\n\nconst validateMultiTransaction = (\n\ttx: MultiSignatureTransaction,\n): ValidationResult => {\n\tif (tx.asset.multisignature.min > tx.asset.multisignature.keysgroup.length) {\n\t\treturn {\n\t\t\tvalid: false,\n\t\t\terrors: [\n\t\t\t\t{\n\t\t\t\t\tdataPath: '.asset.multisignature.min',\n\t\t\t\t\tkeyword: 'multisignatures.keysgroup.min',\n\t\t\t\t\tmessage:\n\t\t\t\t\t\t'.asset.multisignature.min cannot be greater than .asset.multisignature.keysgroup.length',\n\t\t\t\t\tparams: {},\n\t\t\t\t\tschemaPath: 'lisk/base-transaction',\n\t\t\t\t},\n\t\t\t] as ReadonlyArray<ErrorObject>,\n\t\t};\n\t}\n\n\treturn {\n\t\tvalid: true,\n\t};\n};\n\nconst isMultiSignatureTransaction = (\n\ttx: PartialTransaction,\n): tx is MultiSignatureTransaction =>\n\ttx.type === TRANSACTION_TYPE_MULTI_SIGNATURE;\n\nexport const validateTransaction = (\n\ttx: PartialTransaction,\n): ValidationResult => {\n\tif (tx.type === undefined || tx.type === null) {\n\t\tthrow new Error('Transaction type is required.');\n\t}\n\n\tconst validateSchema = getTransactionSchemaValidator(tx.type);\n\tconst valid = validateSchema(tx) as boolean;\n\t// Ajv produces merge error when error happens within $merge\n\tconst errors = validateSchema.errors\n\t\t? validateSchema.errors.filter(\n\t\t\t\t(e: { readonly keyword: string }) => e.keyword !== '$merge',\n\t\t  )\n\t\t: undefined;\n\tif (valid && isMultiSignatureTransaction(tx)) {\n\t\treturn validateMultiTransaction(tx);\n\t}\n\n\treturn {\n\t\tvalid,\n\t\terrors,\n\t};\n};\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/validation/validation.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\n// tslint:disable-next-line no-reference\n/// <reference path=\"../../../types/browserify-bignum/index.d.ts\" />\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport BigNum from 'browserify-bignum';\nimport {\n\tMAX_ADDRESS_NUMBER,\n\tMAX_TRANSACTION_AMOUNT,\n\tMAX_TRANSACTION_ID,\n\tMULTISIGNATURE_MAX_KEYSGROUP,\n\tMULTISIGNATURE_MIN_KEYSGROUP,\n} from '../../constants';\n\nconst MAX_PUBLIC_KEY_LENGTH = 32;\nexport const validatePublicKey = (publicKey: string) => {\n\tconst publicKeyBuffer = cryptography.hexToBuffer(publicKey);\n\tif (publicKeyBuffer.length !== MAX_PUBLIC_KEY_LENGTH) {\n\t\tthrow new Error(\n\t\t\t`Public key ${publicKey} length differs from the expected 32 bytes for a public key.`,\n\t\t);\n\t}\n\n\treturn true;\n};\n\nexport const checkPublicKeysForDuplicates = (\n\tpublicKeys: ReadonlyArray<string>,\n) =>\n\tpublicKeys.every((element, index) => {\n\t\tif (publicKeys.slice(index + 1).includes(element)) {\n\t\t\tthrow new Error(`Duplicated public key: ${publicKeys[index]}.`);\n\t\t}\n\n\t\treturn true;\n\t});\n\nexport const validatePublicKeys = (publicKeys: ReadonlyArray<string>) =>\n\tpublicKeys.every(validatePublicKey) &&\n\tcheckPublicKeysForDuplicates(publicKeys);\n\nexport const validateKeysgroup = (keysgroup: ReadonlyArray<string>) => {\n\tif (\n\t\tkeysgroup.length < MULTISIGNATURE_MIN_KEYSGROUP ||\n\t\tkeysgroup.length > MULTISIGNATURE_MAX_KEYSGROUP\n\t) {\n\t\tthrow new Error(\n\t\t\t`Expected between ${MULTISIGNATURE_MIN_KEYSGROUP} and ${MULTISIGNATURE_MAX_KEYSGROUP} public keys in the keysgroup.`,\n\t\t);\n\t}\n\n\treturn validatePublicKeys(keysgroup);\n};\n\nconst MIN_ADDRESS_LENGTH = 2;\nconst MAX_ADDRESS_LENGTH = 22;\nconst BASE_TEN = 10;\nexport const validateAddress = (address: string): boolean => {\n\tif (\n\t\taddress.length < MIN_ADDRESS_LENGTH ||\n\t\taddress.length > MAX_ADDRESS_LENGTH\n\t) {\n\t\tthrow new Error(\n\t\t\t'Address length does not match requirements. Expected between 2 and 22 characters.',\n\t\t);\n\t}\n\n\tif (address[address.length - 1] !== 'L') {\n\t\tthrow new Error(\n\t\t\t'Address format does not match requirements. Expected \"L\" at the end.',\n\t\t);\n\t}\n\n\tif (address.includes('.')) {\n\t\tthrow new Error(\n\t\t\t'Address format does not match requirements. Address includes invalid character: `.`.',\n\t\t);\n\t}\n\n\tconst addressString = address.slice(0, -1);\n\tconst addressNumber = new BigNum(addressString);\n\n\tif (addressNumber.cmp(new BigNum(MAX_ADDRESS_NUMBER)) > 0) {\n\t\tthrow new Error(\n\t\t\t'Address format does not match requirements. Address out of maximum range.',\n\t\t);\n\t}\n\n\tif (addressString !== addressNumber.toString(BASE_TEN)) {\n\t\tthrow new Error(\n\t\t\t\"Address string format does not match it's number representation.\",\n\t\t);\n\t}\n\n\treturn true;\n};\n\nexport const isGreaterThanZero = (amount: BigNum) => amount.cmp(0) > 0;\n\nexport const isGreaterThanMaxTransactionAmount = (amount: BigNum) =>\n\tamount.cmp(MAX_TRANSACTION_AMOUNT) > 0;\n\nexport const isGreaterThanMaxTransactionId = (id: BigNum) =>\n\tid.cmp(MAX_TRANSACTION_ID) > 0;\n\nexport const isNumberString = (str: string) => {\n\tif (typeof str !== 'string') {\n\t\treturn false;\n\t}\n\n\treturn /^[0-9]+$/g.test(str);\n};\n\nexport const validateAmount = (data: string) =>\n\tisNumberString(data) && !isGreaterThanZero(new BigNum(data));\n\nexport const validateTransferAmount = (data: string) =>\n\tisNumberString(data) &&\n\tisGreaterThanZero(new BigNum(data)) &&\n\t!isGreaterThanMaxTransactionAmount(new BigNum(data));\n\nexport const validateFee = (data: string) =>\n\tisNumberString(data) &&\n\tisGreaterThanZero(new BigNum(data)) &&\n\t!isGreaterThanMaxTransactionAmount(new BigNum(data));\n\nexport const isValidInteger = (num: unknown) =>\n\ttypeof num === 'number' ? Math.floor(num) === num : false;\n"
  },
  {
    "path": "packages/lisk-transactions/src/utils/validation/validator.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport Ajv from 'ajv';\nimport addKeywords from 'ajv-merge-patch';\nimport BigNum from 'browserify-bignum';\nimport * as schemas from './schema';\nimport {\n\tisGreaterThanMaxTransactionId,\n\tisNumberString,\n\tvalidateAddress,\n\tvalidateAmount,\n\tvalidateFee,\n\tvalidatePublicKey,\n\tvalidateTransferAmount,\n} from './validation';\n\nexport const validator = new Ajv({ allErrors: true });\naddKeywords(validator);\n\nvalidator.addFormat('signature', data => /^[a-f0-9]{128}$/i.test(data));\n\nvalidator.addFormat(\n\t'id',\n\tdata =>\n\t\tisNumberString(data) && !isGreaterThanMaxTransactionId(new BigNum(data)),\n);\n\nvalidator.addFormat('address', data => {\n\ttry {\n\t\tvalidateAddress(data);\n\n\t\treturn true;\n\t} catch (error) {\n\t\treturn false;\n\t}\n});\n\nvalidator.addFormat('amount', validateAmount);\n\nvalidator.addFormat('transferAmount', validateTransferAmount);\n\nvalidator.addFormat('fee', validateFee);\n\nvalidator.addFormat('publicKey', data => {\n\ttry {\n\t\tvalidatePublicKey(data);\n\n\t\treturn true;\n\t} catch (error) {\n\t\treturn false;\n\t}\n});\n\nvalidator.addFormat('signedPublicKey', data => {\n\ttry {\n\t\tconst action = data[0];\n\t\tif (action !== '+' && action !== '-') {\n\t\t\treturn false;\n\t\t}\n\t\tconst publicKey = data.slice(1);\n\t\tvalidatePublicKey(publicKey);\n\n\t\treturn true;\n\t} catch (error) {\n\t\treturn false;\n\t}\n});\n\nvalidator.addFormat('additionPublicKey', data => {\n\tconst action = data[0];\n\tif (action !== '+') {\n\t\treturn false;\n\t}\n\ttry {\n\t\tconst publicKey = data.slice(1);\n\t\tvalidatePublicKey(publicKey);\n\n\t\treturn true;\n\t} catch (error) {\n\t\treturn false;\n\t}\n});\n\nvalidator.addKeyword('uniqueSignedPublicKeys', {\n\ttype: 'array',\n\tcompile: () => (data: ReadonlyArray<string>) =>\n\t\tnew Set(data.map((key: string) => key.slice(1))).size === data.length,\n});\n\nvalidator.addSchema(schemas.baseTransaction);\n"
  },
  {
    "path": "packages/lisk-transactions/test/0_transfer.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { transfer } from '../src/0_transfer';\nimport { TransferTransaction } from '../src/transaction_types';\nimport * as time from '../src/utils/time';\n\ndescribe('#transfer transaction', () => {\n\tconst fixedPoint = 10 ** 8;\n\tconst testData = 'data';\n\tconst passphrase = 'secret';\n\tconst secondPassphrase = 'second secret';\n\tconst transactionType = 0;\n\tconst publicKey =\n\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst recipientId = '18160565574430594874L';\n\tconst recipientPublicKey =\n\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst recipientPublicKeyThatDoesNotMatchRecipientId =\n\t\t'12345a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst amount = '1000';\n\tconst fee = (0.1 * fixedPoint).toString();\n\tconst timeWithOffset = 38350076;\n\n\tlet getTimeWithOffsetStub: sinon.SinonStub;\n\tlet transferTransaction: TransferTransaction;\n\n\tbeforeEach(() => {\n\t\tgetTimeWithOffsetStub = sandbox\n\t\t\t.stub(time, 'getTimeWithOffset')\n\t\t\t.returns(timeWithOffset);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('with first passphrase', () => {\n\t\tdescribe('without data', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\ttransferTransaction = transfer({\n\t\t\t\t\trecipientId,\n\t\t\t\t\tamount,\n\t\t\t\t\tpassphrase,\n\t\t\t\t});\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should create a transfer transaction', () => {\n\t\t\t\treturn expect(transferTransaction).to.be.ok;\n\t\t\t});\n\n\t\t\tit('should use time.getTimeWithOffset to calculate the timestamp', () => {\n\t\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(undefined);\n\t\t\t});\n\n\t\t\tit('should use time.getTimeWithOffset with an offset of -10 seconds to calculate the timestamp', () => {\n\t\t\t\tconst offset = -10;\n\t\t\t\ttransfer({\n\t\t\t\t\trecipientId,\n\t\t\t\t\tamount,\n\t\t\t\t\tpassphrase,\n\t\t\t\t\ttimeOffset: offset,\n\t\t\t\t});\n\n\t\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(offset);\n\t\t\t});\n\n\t\t\tit('should be an object', () => {\n\t\t\t\treturn expect(transferTransaction).to.be.an('object');\n\t\t\t});\n\n\t\t\tit('should have id string', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('id')\n\t\t\t\t\t.and.be.a('string');\n\t\t\t});\n\n\t\t\tit('should have type number equal to 0', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t.and.be.a('number')\n\t\t\t\t\t.and.equal(transactionType);\n\t\t\t});\n\n\t\t\tit('should have amount string equal to provided amount', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('amount')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.and.equal(amount);\n\t\t\t});\n\n\t\t\tit('should have fee string equal to transfer fee', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.and.equal(fee);\n\t\t\t});\n\n\t\t\tit('should have recipientId string equal to provided recipient id', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.and.equal(recipientId);\n\t\t\t});\n\n\t\t\tit('should have senderPublicKey hex string equal to sender public key', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t.and.be.hexString.and.equal(publicKey);\n\t\t\t});\n\n\t\t\tit('should have timestamp number equal to result of time.getTimeWithOffset', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('timestamp')\n\t\t\t\t\t.and.be.a('number')\n\t\t\t\t\t.and.equal(timeWithOffset);\n\t\t\t});\n\n\t\t\tit('should have signature hex string', () => {\n\t\t\t\treturn expect(transferTransaction).to.have.property('signature').and.be\n\t\t\t\t\t.hexString;\n\t\t\t});\n\n\t\t\tit('should have an empty asset object', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('asset')\n\t\t\t\t\t.and.be.an('object').and.be.empty;\n\t\t\t});\n\n\t\t\tit('should not have the second signature property', () => {\n\t\t\t\treturn expect(transferTransaction).not.to.have.property(\n\t\t\t\t\t'signSignature',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('with data', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\ttransferTransaction = transfer({\n\t\t\t\t\trecipientId,\n\t\t\t\t\tamount,\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tdata: testData,\n\t\t\t\t});\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should handle invalid (non-utf8 string) data', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\ttransfer.bind(null, {\n\t\t\t\t\t\trecipientId,\n\t\t\t\t\t\tamount,\n\t\t\t\t\t\tpassphrase,\n\t\t\t\t\t\tdata: Buffer.from('hello'),\n\t\t\t\t\t}),\n\t\t\t\t).to.throw(\n\t\t\t\t\t'Invalid encoding in transaction data. Data must be utf-8 encoded string.',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should have fee string equal to transfer fee', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.and.equal(fee);\n\t\t\t});\n\n\t\t\tdescribe('data asset', () => {\n\t\t\t\tit('should be a string equal to provided data', () => {\n\t\t\t\t\treturn expect(transferTransaction.asset)\n\t\t\t\t\t\t.to.have.property('data')\n\t\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t\t.and.equal(testData);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('with first and second passphrase', () => {\n\t\tbeforeEach(() => {\n\t\t\ttransferTransaction = transfer({\n\t\t\t\trecipientId,\n\t\t\t\tamount,\n\t\t\t\tpassphrase,\n\t\t\t\tsecondPassphrase,\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should create a transfer transaction with data property', () => {\n\t\t\ttransferTransaction = transfer({\n\t\t\t\trecipientId,\n\t\t\t\tamount,\n\t\t\t\tpassphrase,\n\t\t\t\tsecondPassphrase,\n\t\t\t\tdata: testData,\n\t\t\t});\n\n\t\t\treturn expect(transferTransaction.asset).to.have.property('data');\n\t\t});\n\n\t\tit('should have the second signature property as hex string', () => {\n\t\t\treturn expect(transferTransaction).to.have.property('signSignature').and\n\t\t\t\t.be.hexString;\n\t\t});\n\t});\n\n\tdescribe('unsigned transfer transaction', () => {\n\t\tdescribe('when the transfer transaction is created without a passphrase', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\ttransferTransaction = transfer({\n\t\t\t\t\trecipientId,\n\t\t\t\t\tamount,\n\t\t\t\t});\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should throw error when amount is 0', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\ttransfer.bind(null, {\n\t\t\t\t\t\tamount: '0',\n\t\t\t\t\t}),\n\t\t\t\t).to.throw('Amount must be a valid number in string format.');\n\t\t\t});\n\n\t\t\tit('should throw error when amount is greater than max transaction amount', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\ttransfer.bind(null, {\n\t\t\t\t\t\tamount: '18446744073709551616',\n\t\t\t\t\t}),\n\t\t\t\t).to.throw('Amount must be a valid number in string format.');\n\t\t\t});\n\n\t\t\tit('should throw error when recipientId & non-matching recipientPublicKey provided', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\ttransfer.bind(null, {\n\t\t\t\t\t\tamount,\n\t\t\t\t\t\trecipientId,\n\t\t\t\t\t\trecipientPublicKey: recipientPublicKeyThatDoesNotMatchRecipientId,\n\t\t\t\t\t}),\n\t\t\t\t).to.throw('recipientId does not match recipientPublicKey.');\n\t\t\t});\n\n\t\t\tit('should non throw error when recipientId & matching recipientPublicKey provided', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\ttransfer.bind(null, {\n\t\t\t\t\t\tamount,\n\t\t\t\t\t\trecipientId,\n\t\t\t\t\t\trecipientPublicKey,\n\t\t\t\t\t}),\n\t\t\t\t).to.not.throw();\n\t\t\t});\n\n\t\t\tit('should throw error when both recipientId and recipientPublicKey were not provided', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\ttransfer.bind(null, {\n\t\t\t\t\t\tamount,\n\t\t\t\t\t\tpassphrase,\n\t\t\t\t\t\tdata: Buffer.from('hello'),\n\t\t\t\t\t}),\n\t\t\t\t).to.throw(\n\t\t\t\t\t'Either recipientId or recipientPublicKey must be provided.',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should set recipientId when recipientId was not provided but recipientPublicKey was provided', () => {\n\t\t\t\tconst tx = transfer({\n\t\t\t\t\tamount,\n\t\t\t\t\tpassphrase,\n\t\t\t\t\trecipientPublicKey: publicKey,\n\t\t\t\t});\n\t\t\t\treturn expect(tx)\n\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.to.equal(cryptography.getAddressFromPublicKey(publicKey));\n\t\t\t});\n\n\t\t\tit('should handle too much data', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\ttransfer.bind(null, {\n\t\t\t\t\t\trecipientId,\n\t\t\t\t\t\tamount,\n\t\t\t\t\t\tdata: new Array(65).fill('0').join(''),\n\t\t\t\t\t}),\n\t\t\t\t).to.throw('Transaction data field cannot exceed 64 bytes.');\n\t\t\t});\n\n\t\t\tit('should have the type', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t.equal(transactionType);\n\t\t\t});\n\n\t\t\tit('should have the amount', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('amount')\n\t\t\t\t\t.equal(amount);\n\t\t\t});\n\n\t\t\tit('should have the fee', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t.equal(fee);\n\t\t\t});\n\n\t\t\tit('should have the recipient', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t.equal(recipientId);\n\t\t\t});\n\n\t\t\tit('should have the sender public key', () => {\n\t\t\t\treturn expect(transferTransaction)\n\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t.equal(undefined);\n\t\t\t});\n\n\t\t\tit('should have the timestamp', () => {\n\t\t\t\treturn expect(transferTransaction).to.have.property('timestamp');\n\t\t\t});\n\n\t\t\tit('should have the asset', () => {\n\t\t\t\treturn expect(transferTransaction).to.have.property('asset');\n\t\t\t});\n\n\t\t\tit('should not have the signature', () => {\n\t\t\t\treturn expect(transferTransaction).not.to.have.property('signature');\n\t\t\t});\n\n\t\t\tit('should not have the id', () => {\n\t\t\t\treturn expect(transferTransaction).not.to.have.property('id');\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/1_register_second_passphrase.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { registerSecondPassphrase } from '../src/1_register_second_passphrase';\nimport {\n\tSecondSignatureAsset,\n\tSecondSignatureTransaction,\n} from '../src/transaction_types';\nimport * as time from '../src/utils/time';\n\ndescribe('#registerSecondPassphrase transaction', () => {\n\tconst fixedPoint = 10 ** 8;\n\tconst passphrase = 'secret';\n\tconst secondPassphrase = 'second secret';\n\tconst transactionType = 1;\n\tconst publicKey =\n\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst secondPublicKey =\n\t\t'0401c8ac9f29ded9e1e4d5b6b43051cb25b22f27c7b7b35092161e851946f82f';\n\tconst emptyStringPublicKey =\n\t\t'be907b4bac84fee5ce8811db2defc9bf0b2a2a2bbc3d54d8a2257ecd70441962';\n\tconst secondPassphraseFee = (5 * fixedPoint).toString();\n\tconst timeWithOffset = 38350076;\n\tconst fee = (5 * fixedPoint).toString();\n\tconst amount = '0';\n\n\tlet getTimeWithOffsetStub: sinon.SinonStub;\n\tlet registerSecondPassphraseTransaction: SecondSignatureTransaction;\n\n\tbeforeEach(() => {\n\t\tgetTimeWithOffsetStub = sandbox\n\t\t\t.stub(time, 'getTimeWithOffset')\n\t\t\t.returns(timeWithOffset);\n\t\tregisterSecondPassphraseTransaction = registerSecondPassphrase({\n\t\t\tpassphrase,\n\t\t\tsecondPassphrase,\n\t\t});\n\t\treturn Promise.resolve();\n\t});\n\n\tit('should create a register second passphrase transaction', () => {\n\t\treturn expect(registerSecondPassphraseTransaction).to.be.ok;\n\t});\n\n\tit('should use time.getTimeWithOffset to calculate the timestamp', () => {\n\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(undefined);\n\t});\n\n\tit('should use time.getTimeWithOffset with an offset of -10 seconds to calculate the timestamp', () => {\n\t\tconst offset = -10;\n\t\tregisterSecondPassphrase({\n\t\t\tpassphrase,\n\t\t\tsecondPassphrase,\n\t\t\ttimeOffset: offset,\n\t\t});\n\n\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(offset);\n\t});\n\n\tdescribe('returned register second passphrase transaction', () => {\n\t\tit('should be an object', () => {\n\t\t\treturn expect(registerSecondPassphraseTransaction).to.be.an('object');\n\t\t});\n\n\t\tit('should have an id string', () => {\n\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t.to.have.property('id')\n\t\t\t\t.and.be.a('string');\n\t\t});\n\n\t\tit('should have type number equal to 1', () => {\n\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t.to.have.property('type')\n\t\t\t\t.and.be.a('number')\n\t\t\t\t.and.equal(transactionType);\n\t\t});\n\n\t\tit('should have amount string equal to 0', () => {\n\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t.to.have.property('amount')\n\t\t\t\t.and.be.a('string')\n\t\t\t\t.and.equal(amount);\n\t\t});\n\n\t\tit('should have fee string equal to second passphrase fee', () => {\n\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t.to.have.property('fee')\n\t\t\t\t.and.be.a('string')\n\t\t\t\t.and.equal(secondPassphraseFee);\n\t\t});\n\n\t\tit('should have recipientId equal to empty string', () => {\n\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t.and.equal('');\n\t\t});\n\n\t\tit('should have senderPublicKey hex string equal to sender public key', () => {\n\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t.and.be.hexString.and.equal(publicKey);\n\t\t});\n\n\t\tit('should have timestamp number equal to result of time.getTimeWithOffset', () => {\n\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t.to.have.property('timestamp')\n\t\t\t\t.and.be.a('number')\n\t\t\t\t.and.equal(timeWithOffset);\n\t\t});\n\n\t\tit('should have signature hex string', () => {\n\t\t\treturn expect(registerSecondPassphraseTransaction).to.have.property(\n\t\t\t\t'signature',\n\t\t\t).and.be.hexString;\n\t\t});\n\n\t\tit('should have asset object', () => {\n\t\t\treturn expect(registerSecondPassphraseTransaction).to.have.property(\n\t\t\t\t'asset',\n\t\t\t).and.not.be.empty;\n\t\t});\n\n\t\tit('should not have a signSignature property', () => {\n\t\t\treturn expect(registerSecondPassphraseTransaction).not.to.have.property(\n\t\t\t\t'signSignature',\n\t\t\t);\n\t\t});\n\n\t\tdescribe('signature asset', () => {\n\t\t\tit('should be an object', () => {\n\t\t\t\treturn expect(registerSecondPassphraseTransaction.asset)\n\t\t\t\t\t.to.have.property('signature')\n\t\t\t\t\t.and.be.an('object').and.not.be.empty;\n\t\t\t});\n\n\t\t\tit('should have a 32-byte publicKey hex string', () => {\n\t\t\t\texpect(registerSecondPassphraseTransaction.asset)\n\t\t\t\t\t.to.have.property('signature')\n\t\t\t\t\t.with.property('publicKey').and.be.hexString;\n\t\t\t\tconst {\n\t\t\t\t\tsignature,\n\t\t\t\t} = registerSecondPassphraseTransaction.asset as SecondSignatureAsset;\n\t\t\t\treturn expect(Buffer.from(signature.publicKey, 'hex')).to.have.length(\n\t\t\t\t\t32,\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should have a publicKey equal to the public key for the provided second passphrase', () => {\n\t\t\t\treturn expect(registerSecondPassphraseTransaction.asset)\n\t\t\t\t\t.to.have.property('signature')\n\t\t\t\t\t.with.property('publicKey')\n\t\t\t\t\t.and.equal(secondPublicKey);\n\t\t\t});\n\n\t\t\tit('should have the correct publicKey if the provided second passphrase is an empty string', () => {\n\t\t\t\tregisterSecondPassphraseTransaction = registerSecondPassphrase({\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tsecondPassphrase: '',\n\t\t\t\t});\n\t\t\t\tconst {\n\t\t\t\t\tsignature,\n\t\t\t\t} = registerSecondPassphraseTransaction.asset as SecondSignatureAsset;\n\t\t\t\treturn expect(signature.publicKey).to.be.equal(emptyStringPublicKey);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('unsigned register second passphrase transaction', () => {\n\t\tdescribe('when the register second passphrase transaction is created without a passphrase', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tregisterSecondPassphraseTransaction = registerSecondPassphrase({\n\t\t\t\t\tsecondPassphrase,\n\t\t\t\t});\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should throw error when secondPassphrase was not provided', () => {\n\t\t\t\treturn expect(registerSecondPassphrase.bind(null, {})).to.throw(\n\t\t\t\t\t'Please provide a secondPassphrase. Expected string.',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should not throw error when secondPassphrase is empty string', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tregisterSecondPassphrase.bind(null, { secondPassphrase: '' }),\n\t\t\t\t).to.not.throw();\n\t\t\t});\n\n\t\t\tit('should have the type', () => {\n\t\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t.equal(transactionType);\n\t\t\t});\n\n\t\t\tit('should have the amount', () => {\n\t\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t\t.to.have.property('amount')\n\t\t\t\t\t.equal(amount);\n\t\t\t});\n\n\t\t\tit('should have the fee', () => {\n\t\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t.equal(fee);\n\t\t\t});\n\n\t\t\tit('should have the recipient', () => {\n\t\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t.equal('');\n\t\t\t});\n\n\t\t\tit('should have the sender public key', () => {\n\t\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t.equal(undefined);\n\t\t\t});\n\n\t\t\tit('should have the timestamp', () => {\n\t\t\t\treturn expect(registerSecondPassphraseTransaction).to.have.property(\n\t\t\t\t\t'timestamp',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should have the asset with the signature with the public key', () => {\n\t\t\t\treturn expect(registerSecondPassphraseTransaction)\n\t\t\t\t\t.to.have.property('asset')\n\t\t\t\t\t.with.property('signature')\n\t\t\t\t\t.with.property('publicKey')\n\t\t\t\t\t.of.a('string');\n\t\t\t});\n\n\t\t\tit('should not have the signature', () => {\n\t\t\t\treturn expect(registerSecondPassphraseTransaction).not.to.have.property(\n\t\t\t\t\t'signature',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should not have the id', () => {\n\t\t\t\treturn expect(registerSecondPassphraseTransaction).not.to.have.property(\n\t\t\t\t\t'id',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/2_register_delegate.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { registerDelegate } from '../src/2_register_delegate';\nimport { DelegateAsset, DelegateTransaction } from '../src/transaction_types';\n// Require is used for stubbing\nconst time = require('../src/utils/time');\n\ndescribe('#registerDelegate transaction', () => {\n\tconst fixedPoint = 10 ** 8;\n\tconst passphrase = 'secret';\n\tconst secondPassphrase = 'second secret';\n\tconst transactionType = 2;\n\tconst publicKey =\n\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst username = 'test_delegate_1@\\\\';\n\tconst fee = (25 * fixedPoint).toString();\n\tconst timeWithOffset = 38350076;\n\tconst amount = '0';\n\n\tlet getTimeWithOffsetStub: sinon.SinonStub;\n\tlet registerDelegateTransaction: DelegateTransaction;\n\n\tbeforeEach(() => {\n\t\tgetTimeWithOffsetStub = sandbox\n\t\t\t.stub(time, 'getTimeWithOffset')\n\t\t\t.returns(timeWithOffset);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('with first passphrase', () => {\n\t\tbeforeEach(() => {\n\t\t\tregisterDelegateTransaction = registerDelegate({\n\t\t\t\tpassphrase,\n\t\t\t\tusername,\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should create a register delegate transaction', () => {\n\t\t\treturn expect(registerDelegateTransaction).to.be.ok;\n\t\t});\n\n\t\tit('should use time.getTimeWithOffset to calculate the timestamp', () => {\n\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(undefined);\n\t\t});\n\n\t\tit('should use time.getTimeWithOffset with an offset of -10 seconds to calculate the timestamp', () => {\n\t\t\tconst offset = -10;\n\t\t\tregisterDelegate({ passphrase, username, timeOffset: offset });\n\n\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(offset);\n\t\t});\n\n\t\tit('should be an object', () => {\n\t\t\treturn expect(registerDelegateTransaction).to.be.an('object');\n\t\t});\n\n\t\tit('should have an id string', () => {\n\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t.to.have.property('id')\n\t\t\t\t.and.be.a('string');\n\t\t});\n\n\t\tit('should have type number equal to 2', () => {\n\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t.to.have.property('type')\n\t\t\t\t.and.be.a('number')\n\t\t\t\t.and.equal(transactionType);\n\t\t});\n\n\t\tit('should have amount string equal to 0', () => {\n\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t.to.have.property('amount')\n\t\t\t\t.and.be.a('string')\n\t\t\t\t.and.equal(amount);\n\t\t});\n\n\t\tit('should have fee string equal to 25 LSK', () => {\n\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t.to.have.property('fee')\n\t\t\t\t.and.be.a('string')\n\t\t\t\t.and.equal(fee);\n\t\t});\n\n\t\tit('should have recipientId equal to empty string', () => {\n\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t.and.equal('');\n\t\t});\n\n\t\tit('should have senderPublicKey hex string equal to sender public key', () => {\n\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t.and.be.hexString.and.equal(publicKey);\n\t\t});\n\n\t\tit('should have timestamp number equal to result of time.getTimeWithOffset', () => {\n\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t.to.have.property('timestamp')\n\t\t\t\t.and.be.a('number')\n\t\t\t\t.and.equal(timeWithOffset);\n\t\t});\n\n\t\tit('should have signature hex string', () => {\n\t\t\treturn expect(registerDelegateTransaction).to.have.property('signature')\n\t\t\t\t.and.be.hexString;\n\t\t});\n\n\t\tit('should not have the second signature property', () => {\n\t\t\treturn expect(registerDelegateTransaction).not.to.have.property(\n\t\t\t\t'signSignature',\n\t\t\t);\n\t\t});\n\n\t\tit('should have asset', () => {\n\t\t\treturn expect(registerDelegateTransaction).to.have.property('asset').and\n\t\t\t\t.not.be.empty;\n\t\t});\n\n\t\tdescribe('delegate asset', () => {\n\t\t\tit('should be an object', () => {\n\t\t\t\treturn expect(registerDelegateTransaction.asset)\n\t\t\t\t\t.to.have.property('delegate')\n\t\t\t\t\t.and.be.an('object');\n\t\t\t});\n\n\t\t\tit('should have the provided username as a string', () => {\n\t\t\t\tconst { delegate } = registerDelegateTransaction.asset as DelegateAsset;\n\t\t\t\treturn expect(delegate)\n\t\t\t\t\t.to.have.property('username')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.and.equal(username);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('with first and second passphrase', () => {\n\t\tbeforeEach(() => {\n\t\t\tregisterDelegateTransaction = registerDelegate({\n\t\t\t\tpassphrase,\n\t\t\t\tusername,\n\t\t\t\tsecondPassphrase,\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should have the second signature property as hex string', () => {\n\t\t\treturn expect(registerDelegateTransaction).to.have.property(\n\t\t\t\t'signSignature',\n\t\t\t).and.be.hexString;\n\t\t});\n\t});\n\n\tdescribe('unsigned register delegate transaction', () => {\n\t\tdescribe('when the register delegate transaction is created without a passphrase', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tregisterDelegateTransaction = registerDelegate({\n\t\t\t\t\tusername,\n\t\t\t\t});\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should throw error when username was not provided', () => {\n\t\t\t\treturn expect(registerDelegate.bind(null, {})).to.throw(\n\t\t\t\t\t'Please provide a username. Expected string.',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should throw error when username is empty string', () => {\n\t\t\t\treturn expect(registerDelegate.bind(null, { username: '' })).to.throw(\n\t\t\t\t\t'Please provide a username. Expected string.',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should throw error when invalid username was provided', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tregisterDelegate.bind(null, { username: '12345678901234567890a' }),\n\t\t\t\t).to.throw(\n\t\t\t\t\t'Username length does not match requirements. Expected to be no more than 20 characters.',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should have the type', () => {\n\t\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t.equal(transactionType);\n\t\t\t});\n\n\t\t\tit('should have the amount', () => {\n\t\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t\t.to.have.property('amount')\n\t\t\t\t\t.equal(amount);\n\t\t\t});\n\n\t\t\tit('should have the fee', () => {\n\t\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t.equal(fee);\n\t\t\t});\n\n\t\t\tit('should have the recipient id', () => {\n\t\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t.equal('');\n\t\t\t});\n\n\t\t\tit('should have the sender public key', () => {\n\t\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t.equal(undefined);\n\t\t\t});\n\n\t\t\tit('should have the timestamp', () => {\n\t\t\t\treturn expect(registerDelegateTransaction).to.have.property(\n\t\t\t\t\t'timestamp',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should have the asset with the delegate', () => {\n\t\t\t\treturn expect(registerDelegateTransaction)\n\t\t\t\t\t.to.have.property('asset')\n\t\t\t\t\t.with.property('delegate')\n\t\t\t\t\t.with.property('username');\n\t\t\t});\n\n\t\t\tit('should not have the signature', () => {\n\t\t\t\treturn expect(registerDelegateTransaction).not.to.have.property(\n\t\t\t\t\t'signature',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should not have the id', () => {\n\t\t\t\treturn expect(registerDelegateTransaction).not.to.have.property('id');\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/3_cast_votes.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { castVotes } from '../src/3_cast_votes';\nimport { VoteAsset, VoteTransaction } from '../src/transaction_types';\n// Require is used for stubbing\nconst time = require('../src/utils/time');\n\ndescribe('#castVotes transaction', () => {\n\tconst fixedPoint = 10 ** 8;\n\tconst passphrase = 'secret';\n\tconst secondPassphrase = 'second secret';\n\tconst transactionType = 3;\n\tconst firstPublicKey =\n\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst secondPublicKey =\n\t\t'922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa';\n\tconst thirdPublicKey =\n\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca';\n\tconst fourthPublicKey =\n\t\t'd019a4b6fa37e8ebeb64766c7b239d962fb3b3f265b8d3083206097b912cd914';\n\tconst tooShortPublicKey =\n\t\t'd019a4b6fa37e8ebeb64766c7b239d962fb3b3f265b8d3083206097b912cd9';\n\tconst plusPrependedPublicKey =\n\t\t'+5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst votePublicKeys = [firstPublicKey, secondPublicKey];\n\tconst unvotePublicKeys = [thirdPublicKey, fourthPublicKey];\n\tconst address = '18160565574430594874L';\n\tconst timeWithOffset = 38350076;\n\tconst amount = '0';\n\tconst fee = (1 * fixedPoint).toString();\n\n\tlet getTimeWithOffsetStub: sinon.SinonStub;\n\tlet castVotesTransaction: VoteTransaction;\n\n\tbeforeEach(() => {\n\t\tgetTimeWithOffsetStub = sandbox\n\t\t\t.stub(time, 'getTimeWithOffset')\n\t\t\t.returns(timeWithOffset);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('when the transaction is created with one passphrase and the votes', () => {\n\t\tbeforeEach(() => {\n\t\t\tcastVotesTransaction = castVotes({\n\t\t\t\tpassphrase,\n\t\t\t\tvotes: votePublicKeys,\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should create a cast votes transaction', () => {\n\t\t\treturn expect(castVotesTransaction).to.be.ok;\n\t\t});\n\n\t\tit('should use time.getTimeWithOffset to calculate the timestamp', () => {\n\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(undefined);\n\t\t});\n\n\t\tit('should use time.getTimeWithOffset with an offset of -10 seconds to calculate the timestamp', () => {\n\t\t\tconst offset = -10;\n\t\t\tcastVotes({ passphrase, votes: votePublicKeys, timeOffset: offset });\n\n\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(offset);\n\t\t});\n\n\t\tdescribe('the returned cast votes transaction', () => {\n\t\t\tit('should be an object', () => {\n\t\t\t\treturn expect(castVotesTransaction).to.be.an('object');\n\t\t\t});\n\n\t\t\tit('should have id string', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('id')\n\t\t\t\t\t.and.be.a('string');\n\t\t\t});\n\n\t\t\tit('should have type number equal to 3', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t.and.be.a('number')\n\t\t\t\t\t.and.equal(transactionType);\n\t\t\t});\n\n\t\t\tit('should have amount string equal to 0', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('amount')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.and.equal(amount);\n\t\t\t});\n\n\t\t\tit('should have fee string equal to 100000000', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.and.equal(fee);\n\t\t\t});\n\n\t\t\tit('should have recipientId string equal to address', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.and.equal(address);\n\t\t\t});\n\n\t\t\tit('should have senderPublicKey hex string equal to sender public key', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t.and.be.hexString.and.equal(firstPublicKey);\n\t\t\t});\n\n\t\t\tit('should have timestamp number equal to result of time.getTimeWithOffset', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('timestamp')\n\t\t\t\t\t.and.be.a('number')\n\t\t\t\t\t.and.equal(timeWithOffset);\n\t\t\t});\n\n\t\t\tit('should have signature hex string', () => {\n\t\t\t\treturn expect(castVotesTransaction).to.have.property('signature').and.be\n\t\t\t\t\t.hexString;\n\t\t\t});\n\n\t\t\tit('should not have the second signature property', () => {\n\t\t\t\treturn expect(castVotesTransaction).not.to.have.property(\n\t\t\t\t\t'signSignature',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should have asset', () => {\n\t\t\t\treturn expect(castVotesTransaction).to.have.property('asset').and.not.be\n\t\t\t\t\t.empty;\n\t\t\t});\n\n\t\t\tdescribe('votes asset', () => {\n\t\t\t\tit('should be array', () => {\n\t\t\t\t\treturn expect(castVotesTransaction.asset)\n\t\t\t\t\t\t.to.have.property('votes')\n\t\t\t\t\t\t.and.be.an('array');\n\t\t\t\t});\n\n\t\t\t\tit('should contain two elements', () => {\n\t\t\t\t\tconst { votes } = castVotesTransaction.asset as VoteAsset;\n\t\t\t\t\treturn expect(votes).to.have.length(2);\n\t\t\t\t});\n\n\t\t\t\tit('should have a vote for the delegate public key', () => {\n\t\t\t\t\tconst { votes } = castVotesTransaction.asset as VoteAsset;\n\t\t\t\t\tconst expectedArray = [`+${firstPublicKey}`, `+${secondPublicKey}`];\n\t\t\t\t\treturn expect(votes).to.be.eql(expectedArray);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('with first and second passphrase', () => {\n\t\tbeforeEach(() => {\n\t\t\tcastVotesTransaction = castVotes({\n\t\t\t\tpassphrase,\n\t\t\t\tvotes: [firstPublicKey],\n\t\t\t\tsecondPassphrase,\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should have the second signature property as hex string', () => {\n\t\t\treturn expect(castVotesTransaction).to.have.property('signSignature').and\n\t\t\t\t.be.hexString;\n\t\t});\n\t});\n\n\tdescribe('when the cast vote transaction is created with the votes and unvotes', () => {\n\t\tbeforeEach(() => {\n\t\t\tcastVotesTransaction = castVotes({\n\t\t\t\tpassphrase,\n\t\t\t\tvotes: votePublicKeys,\n\t\t\t\tunvotes: unvotePublicKeys,\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('the transaction should have the votes as an array', () => {\n\t\t\treturn expect(castVotesTransaction.asset)\n\t\t\t\t.to.have.property('votes')\n\t\t\t\t.and.be.an('array');\n\t\t});\n\n\t\tit('the transaction should have the votes and the unvotes', () => {\n\t\t\tconst expectedArray = [\n\t\t\t\t`+${firstPublicKey}`,\n\t\t\t\t`+${secondPublicKey}`,\n\t\t\t\t`-${thirdPublicKey}`,\n\t\t\t\t`-${fourthPublicKey}`,\n\t\t\t];\n\t\t\tconst { votes } = castVotesTransaction.asset as VoteAsset;\n\t\t\treturn expect(votes).to.be.eql(expectedArray);\n\t\t});\n\t});\n\n\tdescribe('when the cast vote transaction is created with the invalid votes and invalid unvotes', () => {\n\t\tit('should throw error when null was provided for votes', () => {\n\t\t\treturn expect(\n\t\t\t\tcastVotes.bind(null, {\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tvotes: null,\n\t\t\t\t}),\n\t\t\t).to.throw(\n\t\t\t\t'Please provide a valid votes value. Expected an array if present.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw error when string was provided for votes', () => {\n\t\t\treturn expect(\n\t\t\t\tcastVotes.bind(null, {\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tvotes: `+${firstPublicKey}`,\n\t\t\t\t}),\n\t\t\t).to.throw(\n\t\t\t\t'Please provide a valid votes value. Expected an array if present.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw error when null was provided for unvotes', () => {\n\t\t\treturn expect(\n\t\t\t\tcastVotes.bind(null, {\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tunvotes: null,\n\t\t\t\t}),\n\t\t\t).to.throw(\n\t\t\t\t'Please provide a valid unvotes value. Expected an array if present.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw error when string was provided for unvotes', () => {\n\t\t\treturn expect(\n\t\t\t\tcastVotes.bind(null, {\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tunvotes: `-${firstPublicKey}`,\n\t\t\t\t}),\n\t\t\t).to.throw(\n\t\t\t\t'Please provide a valid unvotes value. Expected an array if present.',\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('when the cast vote transaction is created with the unvotes', () => {\n\t\tbeforeEach(() => {\n\t\t\tcastVotesTransaction = castVotes({\n\t\t\t\tpassphrase,\n\t\t\t\tunvotes: unvotePublicKeys,\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('the transaction should have the votes array', () => {\n\t\t\treturn expect(castVotesTransaction.asset)\n\t\t\t\t.to.have.property('votes')\n\t\t\t\t.and.be.an('array');\n\t\t});\n\n\t\tit('the transaction asset should have the unvotes', () => {\n\t\t\tconst expectedArray = [`-${thirdPublicKey}`, `-${fourthPublicKey}`];\n\t\t\tconst { votes } = castVotesTransaction.asset as VoteAsset;\n\t\t\treturn expect(votes).to.be.eql(expectedArray);\n\t\t});\n\t});\n\n\tdescribe('when the cast vote transaction is created with one too short public key', () => {\n\t\tit('should throw an error', () => {\n\t\t\treturn expect(\n\t\t\t\tcastVotes.bind(null, {\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tunvotes: unvotePublicKeys,\n\t\t\t\t\tvotes: [tooShortPublicKey],\n\t\t\t\t}),\n\t\t\t).to.throw(\n\t\t\t\t'Public key d019a4b6fa37e8ebeb64766c7b239d962fb3b3f265b8d3083206097b912cd9 length differs from the expected 32 bytes for a public key.',\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('when the cast vote transaction is created with one plus prepended public key', () => {\n\t\tit('should throw an error', () => {\n\t\t\treturn expect(\n\t\t\t\tcastVotes.bind(null, {\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tunvotes: unvotePublicKeys,\n\t\t\t\t\tvotes: [plusPrependedPublicKey],\n\t\t\t\t}),\n\t\t\t).to.throw('Argument must be a valid hex string.');\n\t\t});\n\t});\n\n\tdescribe('when the cast vote transaction is created with duplicated public keys', () => {\n\t\tdescribe('Given votes and unvotes with duplication', () => {\n\t\t\tit('should throw a duplication error', () => {\n\t\t\t\tconst votes = [firstPublicKey, secondPublicKey];\n\t\t\t\tconst unvotes = [firstPublicKey, thirdPublicKey];\n\t\t\t\treturn expect(\n\t\t\t\t\tcastVotes.bind(null, {\n\t\t\t\t\t\tpassphrase,\n\t\t\t\t\t\tunvotes,\n\t\t\t\t\t\tvotes,\n\t\t\t\t\t}),\n\t\t\t\t).to.throw(\n\t\t\t\t\t'Duplicated public key: 5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given votes with duplication', () => {\n\t\t\tit('should throw a duplication error for votes', () => {\n\t\t\t\tconst votes = [firstPublicKey, secondPublicKey, firstPublicKey];\n\t\t\t\treturn expect(\n\t\t\t\t\tcastVotes.bind(null, {\n\t\t\t\t\t\tpassphrase,\n\t\t\t\t\t\tvotes,\n\t\t\t\t\t}),\n\t\t\t\t).to.throw(\n\t\t\t\t\t'Duplicated public key: 5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given unvotes with duplication', () => {\n\t\t\tit('should throw a duplication error for unvotes', () => {\n\t\t\t\tconst unvotes = [firstPublicKey, secondPublicKey, firstPublicKey];\n\t\t\t\treturn expect(\n\t\t\t\t\tcastVotes.bind(null, {\n\t\t\t\t\t\tpassphrase,\n\t\t\t\t\t\tunvotes,\n\t\t\t\t\t}),\n\t\t\t\t).to.throw(\n\t\t\t\t\t'Duplicated public key: 5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('unsigned cast votes transaction', () => {\n\t\tdescribe('when the cast votes transaction is created without a passphrase', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tcastVotesTransaction = castVotes({\n\t\t\t\t\tvotes: votePublicKeys,\n\t\t\t\t\tunvotes: unvotePublicKeys,\n\t\t\t\t});\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should have the type', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t.equal(transactionType);\n\t\t\t});\n\n\t\t\tit('should have the amount', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('amount')\n\t\t\t\t\t.equal(amount);\n\t\t\t});\n\n\t\t\tit('should have the fee', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t.equal(fee);\n\t\t\t});\n\n\t\t\tit('should have the recipient id', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t.equal('');\n\t\t\t});\n\n\t\t\tit('should have the sender public key', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t.equal(undefined);\n\t\t\t});\n\n\t\t\tit('should have the timestamp', () => {\n\t\t\t\treturn expect(castVotesTransaction).to.have.property('timestamp');\n\t\t\t});\n\n\t\t\tit('should have the asset with the votes', () => {\n\t\t\t\treturn expect(castVotesTransaction)\n\t\t\t\t\t.to.have.property('asset')\n\t\t\t\t\t.with.property('votes');\n\t\t\t});\n\n\t\t\tit('should not have the signature', () => {\n\t\t\t\treturn expect(castVotesTransaction).not.to.have.property('signature');\n\t\t\t});\n\n\t\t\tit('should not have the id', () => {\n\t\t\t\treturn expect(castVotesTransaction).not.to.have.property('id');\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/4_register_multisignature_account.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { registerMultisignature } from '../src/4_register_multisignature_account';\nimport {\n\tMultiSignatureAsset,\n\tMultiSignatureTransaction,\n} from '../src/transaction_types';\n// Require is used for stubbing\nconst time = require('../src/utils/time');\n\ndescribe('#registerMultisignature transaction', () => {\n\tconst fixedPoint = 10 ** 8;\n\tconst passphrase = 'secret';\n\tconst secondPassphrase = 'second secret';\n\tconst transactionType = 4;\n\tconst keys = {\n\t\tpublicKey:\n\t\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\tprivateKey:\n\t\t\t'2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t};\n\tconst timeWithOffset = 38350076;\n\tconst fee = (15 * fixedPoint).toString();\n\tconst amount = '0';\n\tconst lifetime = 5;\n\tconst minimum = 2;\n\n\tlet tooShortPublicKeyKeysgroup: Array<string>;\n\tlet plusPrependedPublicKeyKeysgroup: Array<string>;\n\tlet keysgroup: Array<string>;\n\tlet getTimeWithOffsetStub: sinon.SinonStub;\n\tlet registerMultisignatureTransaction: MultiSignatureTransaction;\n\n\tbeforeEach(() => {\n\t\tgetTimeWithOffsetStub = sandbox\n\t\t\t.stub(time, 'getTimeWithOffset')\n\t\t\t.returns(timeWithOffset);\n\t\tkeysgroup = [\n\t\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\t\t'922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa',\n\t\t];\n\t\tplusPrependedPublicKeyKeysgroup = [\n\t\t\t'+5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\t];\n\t\ttooShortPublicKeyKeysgroup = [\n\t\t\t'd019a4b6fa37e8ebeb64766c7b239d962fb3b3f265b8d3083206097b912cd9',\n\t\t];\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('with first passphrase', () => {\n\t\tbeforeEach(() => {\n\t\t\tregisterMultisignatureTransaction = registerMultisignature({\n\t\t\t\tpassphrase,\n\t\t\t\tkeysgroup,\n\t\t\t\tlifetime,\n\t\t\t\tminimum,\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should create a register multisignature transaction', () => {\n\t\t\treturn expect(registerMultisignatureTransaction).to.be.ok;\n\t\t});\n\n\t\tit('should use time.getTimeWithOffset to calculate the timestamp', () => {\n\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(undefined);\n\t\t});\n\n\t\tit('should use time.getTimeWithOffset with an offset of -10 seconds to calculate the timestamp', () => {\n\t\t\tconst offset = -10;\n\t\t\tregisterMultisignature({\n\t\t\t\tpassphrase,\n\t\t\t\tkeysgroup,\n\t\t\t\tlifetime,\n\t\t\t\tminimum,\n\t\t\t\ttimeOffset: offset,\n\t\t\t});\n\n\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(offset);\n\t\t});\n\n\t\tdescribe('returned register multisignature transaction', () => {\n\t\t\tit('should be an object', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction).to.be.an('object');\n\t\t\t});\n\n\t\t\tit('should have id string', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.property('id')\n\t\t\t\t\t.and.be.a('string');\n\t\t\t});\n\n\t\t\tit('should have type number equal to 4', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t.and.be.a('number')\n\t\t\t\t\t.and.equal(transactionType);\n\t\t\t});\n\n\t\t\tit('should have amount string equal to 0', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.property('amount')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.and.equal(amount);\n\t\t\t});\n\n\t\t\tit('should have fee string equal to 15 LSK', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.and.equal(fee);\n\t\t\t});\n\n\t\t\tit('should have recipientId string equal to empty string', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t.and.equal('');\n\t\t\t});\n\n\t\t\tit('should have senderPublicKey hex string equal to sender public key', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t.and.be.hexString.and.equal(keys.publicKey);\n\t\t\t});\n\n\t\t\tit('should have timestamp number equal to result of time.getTimeWithOffset', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.property('timestamp')\n\t\t\t\t\t.and.be.a('number')\n\t\t\t\t\t.and.equal(timeWithOffset);\n\t\t\t});\n\n\t\t\tit('should have signature hex string', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction).to.have.property(\n\t\t\t\t\t'signature',\n\t\t\t\t).and.be.hexString;\n\t\t\t});\n\n\t\t\tit('should have asset', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction).to.have.property(\n\t\t\t\t\t'asset',\n\t\t\t\t).and.not.be.empty;\n\t\t\t});\n\n\t\t\tit('should not have a second signature', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction).not.to.have.property(\n\t\t\t\t\t'signSignature',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tdescribe('multisignature asset', () => {\n\t\t\t\tit('should be object', () => {\n\t\t\t\t\treturn expect(registerMultisignatureTransaction.asset)\n\t\t\t\t\t\t.to.have.property('multisignature')\n\t\t\t\t\t\t.and.be.an('object');\n\t\t\t\t});\n\n\t\t\t\tit('should have a min number equal to provided minimum', () => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tmultisignature,\n\t\t\t\t\t} = registerMultisignatureTransaction.asset as MultiSignatureAsset;\n\t\t\t\t\treturn expect(multisignature)\n\t\t\t\t\t\t.to.have.property('min')\n\t\t\t\t\t\t.and.be.a('number')\n\t\t\t\t\t\t.and.be.equal(minimum);\n\t\t\t\t});\n\n\t\t\t\tit('should have a lifetime number equal to provided lifetime', () => {\n\t\t\t\t\tconst {\n\t\t\t\t\t\tmultisignature,\n\t\t\t\t\t} = registerMultisignatureTransaction.asset as MultiSignatureAsset;\n\t\t\t\t\treturn expect(multisignature)\n\t\t\t\t\t\t.to.have.property('lifetime')\n\t\t\t\t\t\t.and.be.a('number')\n\t\t\t\t\t\t.and.be.equal(lifetime);\n\t\t\t\t});\n\n\t\t\t\tit('should have a keysgroup array with plus prepended', () => {\n\t\t\t\t\tconst expectedArray = [\n\t\t\t\t\t\t'+5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\t\t\t\t\t'+922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa',\n\t\t\t\t\t];\n\t\t\t\t\tconst {\n\t\t\t\t\t\tmultisignature,\n\t\t\t\t\t} = registerMultisignatureTransaction.asset as MultiSignatureAsset;\n\t\t\t\t\treturn expect(multisignature)\n\t\t\t\t\t\t.to.have.property('keysgroup')\n\t\t\t\t\t\t.and.be.eql(expectedArray);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('with first and second passphrase', () => {\n\t\tbeforeEach(() => {\n\t\t\tregisterMultisignatureTransaction = registerMultisignature({\n\t\t\t\tpassphrase,\n\t\t\t\tsecondPassphrase,\n\t\t\t\tkeysgroup,\n\t\t\t\tlifetime,\n\t\t\t\tminimum,\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should have the second signature property as hex string', () => {\n\t\t\treturn expect(registerMultisignatureTransaction).to.have.property(\n\t\t\t\t'signSignature',\n\t\t\t).and.be.hexString;\n\t\t});\n\t});\n\n\tdescribe('when the register multisignature account transaction is created with one too short public key', () => {\n\t\tit('should throw an error', () => {\n\t\t\treturn expect(\n\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tsecondPassphrase,\n\t\t\t\t\tkeysgroup: tooShortPublicKeyKeysgroup,\n\t\t\t\t\tlifetime,\n\t\t\t\t\tminimum: 1,\n\t\t\t\t}),\n\t\t\t).to.throw(\n\t\t\t\t'Public key d019a4b6fa37e8ebeb64766c7b239d962fb3b3f265b8d3083206097b912cd9 length differs from the expected 32 bytes for a public key.',\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('when the register multisignature account transaction is created with one plus prepended public key', () => {\n\t\tit('should throw an error', () => {\n\t\t\treturn expect(\n\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tsecondPassphrase,\n\t\t\t\t\tkeysgroup: plusPrependedPublicKeyKeysgroup,\n\t\t\t\t\tlifetime,\n\t\t\t\t\tminimum: 1,\n\t\t\t\t}),\n\t\t\t).to.throw('Argument must be a valid hex string.');\n\t\t});\n\t});\n\n\tdescribe('when the register multisignature account transaction is created with one empty keysgroup', () => {\n\t\tit('should throw an error', () => {\n\t\t\treturn expect(\n\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tsecondPassphrase,\n\t\t\t\t\tkeysgroup: [],\n\t\t\t\t\tlifetime,\n\t\t\t\t\tminimum,\n\t\t\t\t}),\n\t\t\t).to.throw(\n\t\t\t\t'Minimum number of signatures is larger than the number of keys in the keysgroup.',\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('when the register multisignature account transaction is created with 17 public keys in keysgroup', () => {\n\t\tbeforeEach(() => {\n\t\t\tkeysgroup = Array(17)\n\t\t\t\t.fill(0)\n\t\t\t\t.map(\n\t\t\t\t\t(_: number, index: number) =>\n\t\t\t\t\t\tcryptography.getPrivateAndPublicKeyFromPassphrase(index.toString())\n\t\t\t\t\t\t\t.publicKey,\n\t\t\t\t);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should throw an error', () => {\n\t\t\treturn expect(\n\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tsecondPassphrase,\n\t\t\t\t\tkeysgroup,\n\t\t\t\t\tlifetime,\n\t\t\t\t\tminimum,\n\t\t\t\t}),\n\t\t\t).to.throw('Expected between 1 and 15 public keys in the keysgroup.');\n\t\t});\n\t});\n\n\tdescribe('when the register multisignature account transaction is created with duplicated public keys', () => {\n\t\tbeforeEach(() => {\n\t\t\tkeysgroup = [keys.publicKey, keys.publicKey];\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should throw an error', () => {\n\t\t\treturn expect(\n\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\tpassphrase,\n\t\t\t\t\tsecondPassphrase,\n\t\t\t\t\tkeysgroup,\n\t\t\t\t\tlifetime,\n\t\t\t\t\tminimum,\n\t\t\t\t}),\n\t\t\t).to.throw(\n\t\t\t\t'Duplicated public key: 5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09.',\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('unsigned register multisignature account transaction', () => {\n\t\tdescribe('when the register multisignature transaction is created without a passphrase', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tregisterMultisignatureTransaction = registerMultisignature({\n\t\t\t\t\tkeysgroup,\n\t\t\t\t\tlifetime,\n\t\t\t\t\tminimum,\n\t\t\t\t});\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tdescribe('validation errors', () => {\n\t\t\t\tdescribe('when lifetime', () => {\n\t\t\t\t\tconst lifetimeErrorMessage =\n\t\t\t\t\t\t'Please provide a valid lifetime value. Expected integer between 1 and 72.';\n\n\t\t\t\t\tit('was not provided', () => {\n\t\t\t\t\t\treturn expect(\n\t\t\t\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\t\t\t\tkeysgroup,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t).to.throw(lifetimeErrorMessage);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('is float', () => {\n\t\t\t\t\t\treturn expect(\n\t\t\t\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\t\t\t\tkeysgroup,\n\t\t\t\t\t\t\t\tlifetime: 23.45,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t).to.throw(lifetimeErrorMessage);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('is not number type', () => {\n\t\t\t\t\t\treturn expect(\n\t\t\t\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\t\t\t\tkeysgroup,\n\t\t\t\t\t\t\t\tlifetime: '123',\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t).to.throw(lifetimeErrorMessage);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('was more than expected', () => {\n\t\t\t\t\t\treturn expect(\n\t\t\t\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\t\t\t\tkeysgroup,\n\t\t\t\t\t\t\t\tlifetime: 73,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t).to.throw(lifetimeErrorMessage);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('was less than expected', () => {\n\t\t\t\t\t\treturn expect(\n\t\t\t\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\t\t\t\tkeysgroup,\n\t\t\t\t\t\t\t\tlifetime: -1,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t).to.throw(lifetimeErrorMessage);\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('when minimum', () => {\n\t\t\t\tconst minimumErrorMessage =\n\t\t\t\t\t'Please provide a valid minimum value. Expected integer between 1 and 15.';\n\n\t\t\t\tit('was not provided', () => {\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\t\t\tkeysgroup,\n\t\t\t\t\t\t\tlifetime,\n\t\t\t\t\t\t}),\n\t\t\t\t\t).to.throw(minimumErrorMessage);\n\t\t\t\t});\n\n\t\t\t\tit('is float', () => {\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\t\t\tkeysgroup,\n\t\t\t\t\t\t\tlifetime,\n\t\t\t\t\t\t\tminimum: 1.45,\n\t\t\t\t\t\t}),\n\t\t\t\t\t).to.throw(minimumErrorMessage);\n\t\t\t\t});\n\n\t\t\t\tit('is not number type', () => {\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\t\t\tkeysgroup,\n\t\t\t\t\t\t\tlifetime,\n\t\t\t\t\t\t\tminimum: '12',\n\t\t\t\t\t\t}),\n\t\t\t\t\t).to.throw(minimumErrorMessage);\n\t\t\t\t});\n\n\t\t\t\tit('was more than expected', () => {\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\t\t\tkeysgroup,\n\t\t\t\t\t\t\tlifetime,\n\t\t\t\t\t\t\tminimum: 16,\n\t\t\t\t\t\t}),\n\t\t\t\t\t).to.throw(minimumErrorMessage);\n\t\t\t\t});\n\n\t\t\t\tit('was less than expected', () => {\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tregisterMultisignature.bind(null, {\n\t\t\t\t\t\t\tkeysgroup,\n\t\t\t\t\t\t\tlifetime,\n\t\t\t\t\t\t\tminimum: -1,\n\t\t\t\t\t\t}),\n\t\t\t\t\t).to.throw(minimumErrorMessage);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('should have the type', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t.equal(transactionType);\n\t\t\t});\n\n\t\t\tit('should have the amount', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.property('amount')\n\t\t\t\t\t.equal(amount);\n\t\t\t});\n\n\t\t\tit('should have the fee', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t.equal(fee);\n\t\t\t});\n\n\t\t\tit('should have the recipient id', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t.equal('');\n\t\t\t});\n\n\t\t\tit('should have the sender public key', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t.equal(undefined);\n\t\t\t});\n\n\t\t\tit('should have the timestamp', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction).to.have.property(\n\t\t\t\t\t'timestamp',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should have the asset with the multisignature with the min, lifetime and keysgroup', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction)\n\t\t\t\t\t.to.have.nested.property('asset.multisignature')\n\t\t\t\t\t.with.all.keys('min', 'lifetime', 'keysgroup');\n\t\t\t});\n\n\t\t\tit('should not have the signature', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction).not.to.have.property(\n\t\t\t\t\t'signature',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should not have the id', () => {\n\t\t\t\treturn expect(registerMultisignatureTransaction).not.to.have.property(\n\t\t\t\t\t'id',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/5_create_dapp.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { createDapp, DappOptions } from '../src/5_create_dapp';\nimport { DappAsset, DappTransaction } from '../src/transaction_types';\n// Require is used for stubbing\nconst time = require('../src/utils/time');\n\ndescribe('#createDapp transaction', () => {\n\tconst fixedPoint = 10 ** 8;\n\tconst transactionType = 5;\n\tconst amount = '0';\n\tconst passphrase = 'secret';\n\tconst secondPassphrase = 'second secret';\n\tconst publicKey =\n\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst defaultOptions = {\n\t\tcategory: 0,\n\t\tname: 'Lisk Guestbook',\n\t\tdescription: 'The official Lisk guestbook',\n\t\ttags: 'guestbook message sidechain',\n\t\ttype: 0,\n\t\tlink: 'https://github.com/MaxKK/guestbookDapp/archive/master.zip',\n\t\ticon:\n\t\t\t'https://raw.githubusercontent.com/MaxKK/guestbookDapp/master/icon.png',\n\t};\n\tconst fee = (25 * fixedPoint).toString();\n\tconst timeWithOffset = 38350076;\n\tconst noOptionsError = 'Options must be an object.';\n\tconst categoryIntegerError = 'Dapp category must be an integer.';\n\tconst nameStringError = 'Dapp name must be a string.';\n\tconst typeIntegerError = 'Dapp type must be an integer.';\n\tconst linkStringError = 'Dapp link must be a string.';\n\tconst descriptionStringError =\n\t\t'Dapp description must be a string if provided.';\n\tconst tagsStringError = 'Dapp tags must be a string if provided.';\n\tconst iconStringError = 'Dapp icon must be a string if provided.';\n\n\tlet getTimeWithOffsetStub: sinon.SinonStub;\n\tlet options: DappOptions;\n\tlet createDappTransaction: DappTransaction;\n\n\tbeforeEach(() => {\n\t\tgetTimeWithOffsetStub = sandbox\n\t\t\t.stub(time, 'getTimeWithOffset')\n\t\t\t.returns(timeWithOffset);\n\t\toptions = {\n\t\t\t...defaultOptions,\n\t\t};\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('with first passphrase', () => {\n\t\tbeforeEach(() => {\n\t\t\tcreateDappTransaction = createDapp({ passphrase, options });\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should create a create dapp transaction', () => {\n\t\t\treturn expect(createDappTransaction).to.be.ok;\n\t\t});\n\n\t\tit('should throw an error if no options are provided', () => {\n\t\t\treturn expect(createDapp.bind(null, { passphrase })).to.throw(\n\t\t\t\tnoOptionsError,\n\t\t\t);\n\t\t});\n\n\t\tit('should throw an error if no category is provided', () => {\n\t\t\tconst { category, ...invalidOptions } = options;\n\t\t\treturn expect(\n\t\t\t\tcreateDapp.bind(null, { passphrase, options: invalidOptions }),\n\t\t\t).to.throw(categoryIntegerError);\n\t\t});\n\n\t\tit('should throw an error if provided category is not an integer', () => {\n\t\t\tconst invalidOptions = {\n\t\t\t\t...options,\n\t\t\t\tcategory: 'not an integer',\n\t\t\t};\n\t\t\treturn expect(\n\t\t\t\tcreateDapp.bind(null, { passphrase, options: invalidOptions }),\n\t\t\t).to.throw(categoryIntegerError);\n\t\t});\n\n\t\tit('should throw an error if no name is provided', () => {\n\t\t\tconst { name, ...invalidOptions } = options;\n\t\t\treturn expect(\n\t\t\t\tcreateDapp.bind(null, { passphrase, options: invalidOptions }),\n\t\t\t).to.throw(nameStringError);\n\t\t});\n\n\t\tit('should throw an error if provided name is not a string', () => {\n\t\t\tconst invalidOptions = {\n\t\t\t\t...options,\n\t\t\t\tname: 123,\n\t\t\t};\n\t\t\treturn expect(\n\t\t\t\tcreateDapp.bind(null, { passphrase, options: invalidOptions }),\n\t\t\t).to.throw(nameStringError);\n\t\t});\n\n\t\tit('should throw an error if no type is provided', () => {\n\t\t\tconst { type, ...invalidOptions } = options;\n\t\t\treturn expect(\n\t\t\t\tcreateDapp.bind(null, { passphrase, options: invalidOptions }),\n\t\t\t).to.throw(typeIntegerError);\n\t\t});\n\n\t\tit('should throw an error if provided type is not an integer', () => {\n\t\t\tconst invalidOptions = {\n\t\t\t\t...options,\n\t\t\t\ttype: 'not an integer',\n\t\t\t};\n\t\t\treturn expect(\n\t\t\t\tcreateDapp.bind(null, { passphrase, options: invalidOptions }),\n\t\t\t).to.throw(typeIntegerError);\n\t\t});\n\n\t\tit('should throw an error if no link is provided', () => {\n\t\t\tconst { link, ...invalidOptions } = options;\n\t\t\treturn expect(\n\t\t\t\tcreateDapp.bind(null, { passphrase, options: invalidOptions }),\n\t\t\t).to.throw(linkStringError);\n\t\t});\n\n\t\tit('should throw an error if provided link is not a string', () => {\n\t\t\tconst invalidOptions = {\n\t\t\t\t...options,\n\t\t\t\tlink: 123,\n\t\t\t};\n\t\t\treturn expect(\n\t\t\t\tcreateDapp.bind(null, { passphrase, options: invalidOptions }),\n\t\t\t).to.throw(linkStringError);\n\t\t});\n\n\t\tit('should throw an error if provided description is not a string', () => {\n\t\t\tconst invalidOptions = {\n\t\t\t\t...options,\n\t\t\t\tdescription: 123,\n\t\t\t};\n\t\t\treturn expect(\n\t\t\t\tcreateDapp.bind(null, { passphrase, options: invalidOptions }),\n\t\t\t).to.throw(descriptionStringError);\n\t\t});\n\n\t\tit('should throw an error if provided tags is not a string', () => {\n\t\t\tconst invalidOptions = {\n\t\t\t\t...options,\n\t\t\t\ttags: 123,\n\t\t\t};\n\t\t\treturn expect(\n\t\t\t\tcreateDapp.bind(null, { passphrase, options: invalidOptions }),\n\t\t\t).to.throw(tagsStringError);\n\t\t});\n\n\t\tit('should throw an error if provided icon is not a string', () => {\n\t\t\tconst invalidOptions = {\n\t\t\t\t...options,\n\t\t\t\ticon: 123,\n\t\t\t};\n\t\t\treturn expect(\n\t\t\t\tcreateDapp.bind(null, { passphrase, options: invalidOptions }),\n\t\t\t).to.throw(iconStringError);\n\t\t});\n\n\t\tit('should not require description, tags, or icon', () => {\n\t\t\tconst { description, tags, icon, ...validOptions } = options;\n\t\t\treturn expect(\n\t\t\t\tcreateDapp.bind(null, { passphrase, options: validOptions }),\n\t\t\t).not.to.throw();\n\t\t});\n\n\t\tit('should use time.getTimeWithOffset to calculate the timestamp', () => {\n\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(undefined);\n\t\t});\n\n\t\tit('should use time.getTimeWithOffset with an offset of -10 seconds to calculate the timestamp', () => {\n\t\t\tconst offset = -10;\n\t\t\tcreateDapp({ passphrase, options, timeOffset: offset });\n\n\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(offset);\n\t\t});\n\n\t\tdescribe('returned create dapp transaction', () => {\n\t\t\tit('should be an object', () => {\n\t\t\t\treturn expect(createDappTransaction).to.be.an('object');\n\t\t\t});\n\n\t\t\tit('should have an id string', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.property('id')\n\t\t\t\t\t.and.be.a('string');\n\t\t\t});\n\n\t\t\tit('should have type number equal to 5', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t.and.be.a('number')\n\t\t\t\t\t.and.equal(5);\n\t\t\t});\n\n\t\t\tit('should have amount string equal to 0', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.property('amount')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.and.equal('0');\n\t\t\t});\n\n\t\t\tit('should have fee string equal to 25 LSK', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t.and.equal(fee);\n\t\t\t});\n\n\t\t\tit('should have recipientId equal to empty string', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t.and.equal('');\n\t\t\t});\n\n\t\t\tit('should have senderPublicKey hex string equal to sender public key', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t.and.be.hexString.and.equal(publicKey);\n\t\t\t});\n\n\t\t\tit('should have timestamp number equal to result of time.getTimeWithOffset', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.property('timestamp')\n\t\t\t\t\t.and.be.a('number')\n\t\t\t\t\t.and.equal(timeWithOffset);\n\t\t\t});\n\n\t\t\tit('should have signature hex string', () => {\n\t\t\t\treturn expect(createDappTransaction).to.have.property('signature').and\n\t\t\t\t\t.be.hexString;\n\t\t\t});\n\n\t\t\tit('should not have the second signature property', () => {\n\t\t\t\treturn expect(createDappTransaction).not.to.have.property(\n\t\t\t\t\t'signSignature',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should have asset', () => {\n\t\t\t\treturn expect(createDappTransaction).to.have.property('asset').and.not\n\t\t\t\t\t.be.empty;\n\t\t\t});\n\n\t\t\tdescribe('dapps asset', () => {\n\t\t\t\tlet asset: DappAsset;\n\n\t\t\t\tbeforeEach(() => {\n\t\t\t\t\tasset = createDappTransaction.asset;\n\t\t\t\t});\n\n\t\t\t\tit('should be object', () => {\n\t\t\t\t\treturn expect(createDappTransaction.asset)\n\t\t\t\t\t\t.to.have.property('dapp')\n\t\t\t\t\t\t.and.be.an('object');\n\t\t\t\t});\n\n\t\t\t\tit('should have a category number equal to provided category', () => {\n\t\t\t\t\treturn expect(asset.dapp)\n\t\t\t\t\t\t.to.have.property('category')\n\t\t\t\t\t\t.and.be.a('number')\n\t\t\t\t\t\t.and.equal(options.category);\n\t\t\t\t});\n\n\t\t\t\tit('should have a name string equal to provided name', () => {\n\t\t\t\t\treturn expect(asset.dapp)\n\t\t\t\t\t\t.to.have.property('name')\n\t\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t\t.and.equal(options.name);\n\t\t\t\t});\n\n\t\t\t\tit('should have a description string equal to provided description', () => {\n\t\t\t\t\treturn expect(asset.dapp)\n\t\t\t\t\t\t.to.have.property('description')\n\t\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t\t.and.equal(options.description);\n\t\t\t\t});\n\n\t\t\t\tit('should have a tags string equal to provided tags', () => {\n\t\t\t\t\treturn expect(asset.dapp)\n\t\t\t\t\t\t.to.have.property('tags')\n\t\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t\t.and.equal(options.tags);\n\t\t\t\t});\n\n\t\t\t\tit('should have a type number equal to provided type', () => {\n\t\t\t\t\treturn expect(asset.dapp)\n\t\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t\t.and.be.a('number')\n\t\t\t\t\t\t.and.equal(options.type);\n\t\t\t\t});\n\n\t\t\t\tit('should have a link string equal to provided link', () => {\n\t\t\t\t\treturn expect(asset.dapp)\n\t\t\t\t\t\t.to.have.property('link')\n\t\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t\t.and.equal(options.link);\n\t\t\t\t});\n\n\t\t\t\tit('should have an icon string equal to provided icon', () => {\n\t\t\t\t\treturn expect(asset.dapp)\n\t\t\t\t\t\t.to.have.property('icon')\n\t\t\t\t\t\t.and.be.a('string')\n\t\t\t\t\t\t.and.equal(options.icon);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('with first and second passphrase', () => {\n\t\tbeforeEach(() => {\n\t\t\tcreateDappTransaction = createDapp({\n\t\t\t\tpassphrase,\n\t\t\t\tsecondPassphrase,\n\t\t\t\toptions,\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should have the second signature property as hex string', () => {\n\t\t\treturn expect(createDappTransaction).to.have.property('signSignature').and\n\t\t\t\t.be.hexString;\n\t\t});\n\t});\n\n\tdescribe('unsigned create dapp transaction', () => {\n\t\tdescribe('when the create dapp transaction is created without a passphrase', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tcreateDappTransaction = createDapp({\n\t\t\t\t\toptions,\n\t\t\t\t});\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should have the type', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t.equal(transactionType);\n\t\t\t});\n\n\t\t\tit('should have the amount', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.property('amount')\n\t\t\t\t\t.equal(amount);\n\t\t\t});\n\n\t\t\tit('should have the fee', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t.equal(fee);\n\t\t\t});\n\n\t\t\tit('should have the recipient id', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t.equal('');\n\t\t\t});\n\n\t\t\tit('should have the sender public key', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t.equal(undefined);\n\t\t\t});\n\n\t\t\tit('should have the timestamp', () => {\n\t\t\t\treturn expect(createDappTransaction).to.have.property('timestamp');\n\t\t\t});\n\n\t\t\tit('should have the asset with dapp with properties category, description, name, tags, type, link, icon', () => {\n\t\t\t\treturn expect(createDappTransaction)\n\t\t\t\t\t.to.have.nested.property('asset.dapp')\n\t\t\t\t\t.with.all.keys(\n\t\t\t\t\t\t'category',\n\t\t\t\t\t\t'description',\n\t\t\t\t\t\t'name',\n\t\t\t\t\t\t'tags',\n\t\t\t\t\t\t'type',\n\t\t\t\t\t\t'link',\n\t\t\t\t\t\t'icon',\n\t\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should not have the signature', () => {\n\t\t\t\treturn expect(createDappTransaction).not.to.have.property('signature');\n\t\t\t});\n\n\t\t\tit('should not have the id', () => {\n\t\t\t\treturn expect(createDappTransaction).not.to.have.property('id');\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/_global_hooks.ts",
    "content": "afterEach(() => {\n\treturn sandbox.restore();\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/_setup.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport sinon from 'sinon';\nimport chai, { Assertion } from 'chai';\nimport 'chai/register-expect';\nimport sinonChai from 'sinon-chai';\n\nprocess.env.NODE_ENV = 'test';\n\nAssertion.addProperty('hexString', function handleAssert(\n\tthis: Chai.ChaiStatic,\n) {\n\tconst actual = this._obj;\n\n\tnew Assertion(actual).to.be.a('string');\n\n\tconst expected = Buffer.from(actual, 'hex').toString('hex');\n\tthis.assert(\n\t\texpected === actual,\n\t\t'expected #{this} to be a hexString',\n\t\t'expected #{this} not to be a hexString',\n\t);\n});\n\nAssertion.addProperty('integer', function handleAssert(this: Chai.ChaiStatic) {\n\tconst actual = this._obj;\n\n\tnew Assertion(actual).to.be.a('number');\n\n\tconst expected = parseInt(actual, 10);\n\tthis.assert(\n\t\tactual === expected,\n\t\t'expected #{this} to be an integer',\n\t\t'expected #{this} not to be an integer',\n\t);\n});\n\n[sinonChai].forEach(plugin => chai.use(plugin));\n\nglobal.sandbox = sinon.createSandbox({\n\tuseFakeTimers: true,\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/constants.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport {\n\tFIXED_POINT,\n\tDAPP_FEE,\n\tDELEGATE_FEE,\n\tIN_TRANSFER_FEE,\n\tOUT_TRANSFER_FEE,\n\tMULTISIGNATURE_FEE,\n\tSIGNATURE_FEE,\n\tTRANSFER_FEE,\n\tVOTE_FEE,\n\tBYTESIZES,\n} from '../src/constants';\n\ndescribe('transactions constants module', () => {\n\tit('FIXED_POINT to be an integer', () => {\n\t\treturn expect(FIXED_POINT).to.be.an.integer;\n\t});\n\n\tit('DAPP_FEE to be an integer', () => {\n\t\treturn expect(DAPP_FEE).to.be.an.integer;\n\t});\n\n\tit('DELEGATE_FEE to be an integer', () => {\n\t\treturn expect(DELEGATE_FEE).to.be.an.integer;\n\t});\n\n\tit('IN_TRANSFER_FEE to be an integer', () => {\n\t\treturn expect(IN_TRANSFER_FEE).to.be.an.integer;\n\t});\n\n\tit('OUT_TRANSFER_FEE to be an integer', () => {\n\t\treturn expect(OUT_TRANSFER_FEE).to.be.an.integer;\n\t});\n\n\tit('MULTISIGNATURE_FEE to be an integer', () => {\n\t\treturn expect(MULTISIGNATURE_FEE).to.be.an.integer;\n\t});\n\n\tit('SIGNATURE_FEE to be an integer', () => {\n\t\treturn expect(SIGNATURE_FEE).to.be.an.integer;\n\t});\n\n\tit('TRANSFER_FEE to be an integer', () => {\n\t\treturn expect(TRANSFER_FEE).to.be.an.integer;\n\t});\n\n\tit('VOTE_FEE to be an integer', () => {\n\t\treturn expect(VOTE_FEE).to.be.an.integer;\n\t});\n\n\tit('BYTESIZES.TYPE to be an integer', () => {\n\t\treturn expect(BYTESIZES.TYPE).to.be.an.integer;\n\t});\n\n\tit('BYTESIZES.TIMESTAMP to be an integer', () => {\n\t\treturn expect(BYTESIZES.TIMESTAMP).to.be.an.integer;\n\t});\n\n\tit('BYTESIZES.MULTISIGNATURE_PUBLICKEY to be an integer', () => {\n\t\treturn expect(BYTESIZES.MULTISIGNATURE_PUBLICKEY).to.be.an.integer;\n\t});\n\n\tit('BYTESIZES.RECIPIENT_ID to be an integer', () => {\n\t\treturn expect(BYTESIZES.RECIPIENT_ID).to.be.an.integer;\n\t});\n\n\tit('BYTESIZES.AMOUNT to be an integer', () => {\n\t\treturn expect(BYTESIZES.AMOUNT).to.be.an.integer;\n\t});\n\n\tit('BYTESIZES.SIGNATURE_TRANSACTION to be an integer', () => {\n\t\treturn expect(BYTESIZES.SIGNATURE_TRANSACTION).to.be.an.integer;\n\t});\n\n\tit('BYTESIZES.SECOND_SIGNATURE_TRANSACTION to be an integer', () => {\n\t\treturn expect(BYTESIZES.SECOND_SIGNATURE_TRANSACTION).to.be.an.integer;\n\t});\n\n\tit('BYTESIZES.DATA to be an integer', () => {\n\t\treturn expect(BYTESIZES.DATA).to.be.an.integer;\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/create_signature_object.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport {\n\tcreateSignatureObject,\n\tSignatureObject,\n} from '../src/create_signature_object';\n\ndescribe('#createSignatureObject', () => {\n\tconst transaction = {\n\t\tamount: '10',\n\t\trecipientId: '8050281191221330746L',\n\t\tsenderId: '1050281191221330746L',\n\t\tsenderPublicKey:\n\t\t\t'3358a1562f9babd523a768e700bb12ad58f230f84031055802dc0ea58cef1e1b',\n\t\ttimestamp: 59353522,\n\t\ttype: 0,\n\t\tfee: '10000000',\n\t\trecipientPublicKey: null,\n\t\tasset: {},\n\t\tsignature:\n\t\t\t'b84b95087c381ad25b5701096e2d9366ffd04037dcc941cd0747bfb0cf93111834a6c662f149018be4587e6fc4c9f5ba47aa5bbbd3dd836988f153aa8258e604',\n\t\tid: '3694188453012384790',\n\t};\n\tconst account = {\n\t\tpassphrase:\n\t\t\t'love road panic horn cover grape nerve mechanic slice relax mobile salon',\n\t\tpublicKey:\n\t\t\t'87696cfc48f5f5bd4ec2473615ac1618ffedfdc20005ae71a3d0dba209471c04',\n\t};\n\tconst generatedSignature =\n\t\t'8222dc7c26cc0ed649af71ebef5d292deb6ad029dadec0cf061b40e2ea9572d1b691e92302ac8cb64e5ea5f8fd846410c8fa033236c8930203ae3b7f3c6bd30c';\n\n\tdescribe('when invalid transaction is used', () => {\n\t\tit(\"should throw an Error when id doesn't exist\", () => {\n\t\t\tconst { id, ...mutatedTransaction } = transaction;\n\t\t\treturn expect(\n\t\t\t\tcreateSignatureObject.bind(\n\t\t\t\t\tnull,\n\t\t\t\t\tmutatedTransaction,\n\t\t\t\t\taccount.passphrase,\n\t\t\t\t),\n\t\t\t).to.throw('Transaction ID is required to create a signature object.');\n\t\t});\n\t\tit('should throw an Error when sender public key is mutated', () => {\n\t\t\tconst mutatedTransaction = {\n\t\t\t\t...transaction,\n\t\t\t\tsenderPublicKey:\n\t\t\t\t\t'3358a1562f9babd523a768e700bb12ad58f230f84031055802dc0ea58cef1000',\n\t\t\t};\n\t\t\treturn expect(\n\t\t\t\tcreateSignatureObject.bind(\n\t\t\t\t\tnull,\n\t\t\t\t\tmutatedTransaction,\n\t\t\t\t\taccount.passphrase,\n\t\t\t\t),\n\t\t\t).to.throw('Invalid transaction.');\n\t\t});\n\n\t\tit('should throw an Error when signature is mutated', () => {\n\t\t\tconst mutatedTransaction = {\n\t\t\t\t...transaction,\n\t\t\t\tsignature:\n\t\t\t\t\t'b84b95087c381ad25b5701096e2d9366ffd04037dcc941cd0747bfb0cf93111834a6c662f149018be4587e6fc4c9f5ba47aa5bbbd3dd836988f153aa8258e600',\n\t\t\t};\n\t\t\treturn expect(\n\t\t\t\tcreateSignatureObject.bind(\n\t\t\t\t\tnull,\n\t\t\t\t\tmutatedTransaction,\n\t\t\t\t\taccount.passphrase,\n\t\t\t\t),\n\t\t\t).to.throw('Invalid transaction.');\n\t\t});\n\t});\n\n\tdescribe('when valid transaction and invalid passphrase is used', () => {\n\t\tit('should throw an Error if passphrase is number', () => {\n\t\t\tconst passphrase = 1;\n\t\t\treturn expect(\n\t\t\t\tcreateSignatureObject.bind(null, transaction, passphrase),\n\t\t\t).to.throw(\n\t\t\t\t'Unsupported data format. Currently only Buffers or `hex` and `utf8` strings are supported.',\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('when valid transaction and passphrase is used', () => {\n\t\tlet signatureObject: SignatureObject;\n\t\tbeforeEach(() => {\n\t\t\tsignatureObject = createSignatureObject(transaction, account.passphrase);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should have the same transaction id as the input', () => {\n\t\t\treturn expect(signatureObject.transactionId).to.equal(transaction.id);\n\t\t});\n\n\t\tit('should have the corresponding public key with the passphrase', () => {\n\t\t\treturn expect(signatureObject.publicKey).to.equal(account.publicKey);\n\t\t});\n\n\t\tit('should have non-empty hex string signature', () => {\n\t\t\treturn expect(signatureObject.signature).to.equal(generatedSignature);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport * as transaction from '../src';\n\ndescribe('transaction', () => {\n\tdescribe('exports', () => {\n\t\tit('should have #transfer', () => {\n\t\t\treturn expect(transaction)\n\t\t\t\t.to.have.property('transfer')\n\t\t\t\t.and.be.a('function');\n\t\t});\n\n\t\tit('should have #registerSecondPassphrase', () => {\n\t\t\treturn expect(transaction)\n\t\t\t\t.to.have.property('registerSecondPassphrase')\n\t\t\t\t.and.be.a('function');\n\t\t});\n\n\t\tit('should have #registerDelegate', () => {\n\t\t\treturn expect(transaction)\n\t\t\t\t.to.have.property('registerDelegate')\n\t\t\t\t.and.be.a('function');\n\t\t});\n\n\t\tit('should have #castVotes', () => {\n\t\t\treturn expect(transaction)\n\t\t\t\t.to.have.property('castVotes')\n\t\t\t\t.and.be.a('function');\n\t\t});\n\n\t\tit('should have #registerMultisignature', () => {\n\t\t\treturn expect(transaction)\n\t\t\t\t.to.have.property('registerMultisignature')\n\t\t\t\t.and.be.a('function');\n\t\t});\n\n\t\tit('should have #createDapp', () => {\n\t\t\treturn expect(transaction)\n\t\t\t\t.to.have.property('createDapp')\n\t\t\t\t.and.be.a('function');\n\t\t});\n\n\t\tit('should have #createSignatureObject', () => {\n\t\t\treturn expect(transaction)\n\t\t\t\t.to.have.property('createSignatureObject')\n\t\t\t\t.and.be.a('function');\n\t\t});\n\n\t\tit('should have #utils', () => {\n\t\t\treturn expect(transaction)\n\t\t\t\t.to.have.property('utils')\n\t\t\t\t.and.be.an('object');\n\t\t});\n\n\t\tit('should have #constants', () => {\n\t\t\treturn expect(transaction)\n\t\t\t\t.to.have.property('constants')\n\t\t\t\t.and.be.an('object');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/mocha.opts",
    "content": "--recursive\n--require ts-node/register\n--require tsconfig-paths/register\n--require source-map-support/register\n--require ./test/_setup.ts\n--file ./test/_global_hooks.ts\n--watch-extensions ts\n"
  },
  {
    "path": "packages/lisk-transactions/test/tsconfig.json",
    "content": "{\n\t\"extends\": \"../tsconfig\",\n\t\"compilerOptions\": {\n\t\t\"baseUrl\": \".\",\n\t\t\"declaration\": false,\n\t\t\"target\": \"es2017\",\n\t\t\"typeRoots\": [\"../types\", \"../../../types\", \"../node_modules/@types\"]\n\t},\n\t\"include\": [\"../../../types/**/*\", \"./**/*\"]\n}\n"
  },
  {
    "path": "packages/lisk-transactions/test/utils/format.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport {\n\tconvertBeddowsToLSK,\n\tconvertLSKToBeddows,\n\tprependPlusToPublicKeys,\n\tprependMinusToPublicKeys,\n} from '../../src/utils/format';\n\ndescribe('format', () => {\n\tdescribe('#convertBeddowsToLSK', () => {\n\t\tit('should error if not given a string', () => {\n\t\t\treturn expect(convertBeddowsToLSK.bind(null, 12345678)).to.throw(\n\t\t\t\t'Cannot convert non-string amount',\n\t\t\t);\n\t\t});\n\t\tit('should error on 0.1', () => {\n\t\t\treturn expect(convertBeddowsToLSK.bind(null, '0.1')).to.throw(\n\t\t\t\t'Beddows amount should not have decimal points',\n\t\t\t);\n\t\t});\n\t\tit('should error on 9223372036854775808', () => {\n\t\t\treturn expect(\n\t\t\t\tconvertBeddowsToLSK.bind(null, '9223372036854775808'),\n\t\t\t).to.throw('Beddows amount out of range');\n\t\t});\n\t\tit('should convert 100000000 to 1', () => {\n\t\t\treturn expect(convertBeddowsToLSK('100000000')).to.equal('1');\n\t\t});\n\t\tit('should convert 1 to 0.00000001', () => {\n\t\t\treturn expect(convertBeddowsToLSK('1')).to.equal('0.00000001');\n\t\t});\n\t\tit('should convert 10000000000000000 to 100000000', () => {\n\t\t\treturn expect(convertBeddowsToLSK('10000000000000000')).to.equal(\n\t\t\t\t'100000000',\n\t\t\t);\n\t\t});\n\t\tit('should convert 9223372036854775807 to 92233720368.54775807', () => {\n\t\t\treturn expect(convertBeddowsToLSK('9223372036854775807')).to.equal(\n\t\t\t\t'92233720368.54775807',\n\t\t\t);\n\t\t});\n\t});\n\tdescribe('#convertLSKToBeddows', () => {\n\t\tit('should error if not given a string', () => {\n\t\t\treturn expect(convertLSKToBeddows.bind(null, 12345678)).to.throw(\n\t\t\t\t'Cannot convert non-string amount',\n\t\t\t);\n\t\t});\n\t\tit('should error on 0.000000001', () => {\n\t\t\treturn expect(convertLSKToBeddows.bind(null, '0.000000001')).to.throw(\n\t\t\t\t'LSK amount has too many decimal points',\n\t\t\t);\n\t\t});\n\t\tit('should error on 92233720368.54775808', () => {\n\t\t\treturn expect(\n\t\t\t\tconvertLSKToBeddows.bind(null, '92233720368.54775808'),\n\t\t\t).to.throw('LSK amount out of range');\n\t\t});\n\t\tit('should convert 1 to 100000000', () => {\n\t\t\treturn expect(convertLSKToBeddows('1')).to.equal('100000000');\n\t\t});\n\t\tit('should convert 0.00000001 to 1', () => {\n\t\t\treturn expect(convertLSKToBeddows('0.00000001')).to.equal('1');\n\t\t});\n\t\tit('should convert 100000000 to 10000000000000000', () => {\n\t\t\treturn expect(convertLSKToBeddows('100000000')).to.equal(\n\t\t\t\t'10000000000000000',\n\t\t\t);\n\t\t});\n\t\tit('should convert 92233720368.54775807 to 9223372036854775807', () => {\n\t\t\treturn expect(convertLSKToBeddows('92233720368.54775807')).to.equal(\n\t\t\t\t'9223372036854775807',\n\t\t\t);\n\t\t});\n\t});\n\tdescribe('#prependPlusToPublicKeys', () => {\n\t\tdescribe('Given an array of public keys', () => {\n\t\t\tit('should append plus to each public key', () => {\n\t\t\t\tconst publicKeys = [\n\t\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca',\n\t\t\t\t\t'922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa',\n\t\t\t\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\t\t\t];\n\t\t\t\tconst expectedOutput = [\n\t\t\t\t\t'+215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca',\n\t\t\t\t\t'+922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa',\n\t\t\t\t\t'+5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\t\t\t];\n\t\t\t\treturn expect(prependPlusToPublicKeys(publicKeys)).to.be.eql(\n\t\t\t\t\texpectedOutput,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('#prependMinusToPublicKeys', () => {\n\t\tdescribe('Given an array of public keys', () => {\n\t\t\tit('should append minus to each public key', () => {\n\t\t\t\tconst publicKeys = [\n\t\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca',\n\t\t\t\t\t'922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa',\n\t\t\t\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\t\t\t];\n\t\t\t\tconst expectedOutput = [\n\t\t\t\t\t'-215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca',\n\t\t\t\t\t'-922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa',\n\t\t\t\t\t'-5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\t\t\t];\n\t\t\t\treturn expect(prependMinusToPublicKeys(publicKeys)).to.be.eql(\n\t\t\t\t\texpectedOutput,\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/utils/get_transaction_bytes.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport BigNum from 'browserify-bignum';\nimport {\n\tgetTransactionBytes,\n\tgetAssetDataForTransferTransaction,\n\tgetAssetDataForRegisterSecondSignatureTransaction,\n\tgetAssetDataForRegisterDelegateTransaction,\n\tgetAssetDataForCastVotesTransaction,\n\tgetAssetDataForRegisterMultisignatureAccountTransaction,\n\tgetAssetDataForCreateDappTransaction,\n\tgetAssetDataForTransferIntoDappTransaction,\n\tgetAssetDataForTransferOutOfDappTransaction,\n\tcheckTransaction,\n\tcheckRequiredFields,\n\tisValidValue,\n} from '../../src/utils/get_transaction_bytes';\nimport {\n\tTransferTransaction,\n\tBaseTransaction,\n\tMultiSignatureAsset,\n} from '../../src/transaction_types';\n\nconst fixedPoint = 10 ** 8;\nconst defaultRecipient = '58191285901858109L';\nconst defaultSenderPublicKey =\n\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\nconst defaultSenderId = '18160565574430594874L';\nconst defaultSenderSecondPublicKey =\n\t'0401c8ac9f29ded9e1e4d5b6b43051cb25b22f27c7b7b35092161e851946f82f';\n// Use (1<<62) + 3 to ensure the highest and the lowest bytes are set and contain different data.\n// This exceeds the safe integer range of JavaScript numbers and thus is expressed as a string.\nconst defaultAmount = '10000000000000000';\nconst defaultNoAmount = '0';\nconst defaultTimestamp = 141738;\nconst defaultTransactionId = '13987348420913138422';\nconst defaultSignature =\n\t'618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a';\nconst defaultSecondSignature =\n\t'b00c4ad1988bca245d74435660a278bfe6bf2f5efa8bda96d927fabf8b4f6fcfdcb2953f6abacaa119d6880987a55dea0e6354bc8366052b45fa23145522020f';\nconst defaultAppId = '1234213';\nconst defaultDelegateUsername = 'MyDelegateUsername';\n\ndescribe('getTransactionBytes module', () => {\n\tdescribe('#getTransactionBytes', () => {\n\t\tdescribe('transfer transaction, type 0', () => {\n\t\t\tlet defaultTransaction: BaseTransaction;\n\n\t\t\tbeforeEach(() => {\n\t\t\t\tdefaultTransaction = {\n\t\t\t\t\ttype: 0,\n\t\t\t\t\tfee: (0.1 * fixedPoint).toString(),\n\t\t\t\t\tamount: defaultAmount,\n\t\t\t\t\trecipientId: defaultRecipient,\n\t\t\t\t\ttimestamp: defaultTimestamp,\n\t\t\t\t\tasset: {},\n\t\t\t\t\tsenderPublicKey: defaultSenderPublicKey,\n\t\t\t\t\tsenderId: defaultSenderId,\n\t\t\t\t\tsignature: defaultSignature,\n\t\t\t\t\tid: defaultTransactionId,\n\t\t\t\t};\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should return Buffer of type 0 (transfer LSK) transaction', () => {\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t'00aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae0900cebcaa8d34153d0000c16ff2862300618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\t'hex',\n\t\t\t\t);\n\t\t\t\tconst transactionBytes = getTransactionBytes(defaultTransaction);\n\n\t\t\t\treturn expect(transactionBytes).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should return Buffer of type 0 (transfer LSK) with data', () => {\n\t\t\t\tconst transferTransaction: TransferTransaction = {\n\t\t\t\t\t...defaultTransaction,\n\t\t\t\t\tasset: {\n\t\t\t\t\t\tdata: 'Hello Lisk! Some data in here!...',\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t'00aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae0900cebcaa8d34153d0000c16ff286230048656c6c6f204c69736b2120536f6d65206461746120696e2068657265212e2e2e618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\t'hex',\n\t\t\t\t);\n\t\t\t\tconst transactionBytes = getTransactionBytes(transferTransaction);\n\n\t\t\t\treturn expect(transactionBytes).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should throw on type 0 with too much data', () => {\n\t\t\t\tconst maxDataLength = 64;\n\t\t\t\tconst transferTransaction: TransferTransaction = {\n\t\t\t\t\t...defaultTransaction,\n\t\t\t\t\tasset: {\n\t\t\t\t\t\tdata: new Array(maxDataLength + 1).fill('1').join(''),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn expect(\n\t\t\t\t\tgetTransactionBytes.bind(null, transferTransaction),\n\t\t\t\t).to.throw('Transaction asset data exceeds size of 64.');\n\t\t\t});\n\n\t\t\tit('should throw on type 0 with an amount that is too small', () => {\n\t\t\t\tconst amount = -1;\n\t\t\t\tconst transaction = {\n\t\t\t\t\t...defaultTransaction,\n\t\t\t\t\tamount,\n\t\t\t\t};\n\t\t\t\treturn expect(getTransactionBytes.bind(null, transaction)).to.throw(\n\t\t\t\t\t'Transaction amount must not be negative.',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should throw on type 0 with an amount that is too large', () => {\n\t\t\t\tconst amount = BigNum.fromBuffer(\n\t\t\t\t\tBuffer.from(new Array(8).fill(255)),\n\t\t\t\t).plus(1);\n\t\t\t\tconst transaction = {\n\t\t\t\t\t...defaultTransaction,\n\t\t\t\t\tamount,\n\t\t\t\t};\n\t\t\t\treturn expect(getTransactionBytes.bind(null, transaction)).to.throw(\n\t\t\t\t\t'Transaction amount is too large.',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should return Buffer of transaction with second signature', () => {\n\t\t\t\tconst transaction = {\n\t\t\t\t\t...defaultTransaction,\n\t\t\t\t\tsignSignature: defaultSecondSignature,\n\t\t\t\t};\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t'00aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae0900cebcaa8d34153d0000c16ff2862300618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0ab00c4ad1988bca245d74435660a278bfe6bf2f5efa8bda96d927fabf8b4f6fcfdcb2953f6abacaa119d6880987a55dea0e6354bc8366052b45fa23145522020f',\n\t\t\t\t\t'hex',\n\t\t\t\t);\n\t\t\t\tconst transactionBytes = getTransactionBytes(transaction);\n\t\t\t\treturn expect(transactionBytes).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should return Buffer from multisignature type 0 (transfer LSK) transaction', () => {\n\t\t\t\tconst multiSignatureTransaction = {\n\t\t\t\t\ttype: 0,\n\t\t\t\t\tamount: '1000',\n\t\t\t\t\tfee: (1 * fixedPoint).toString(),\n\t\t\t\t\trecipientId: defaultRecipient,\n\t\t\t\t\tsenderPublicKey: defaultSenderPublicKey,\n\t\t\t\t\trequesterPublicKey:\n\t\t\t\t\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\t\t\t\ttimestamp: defaultTimestamp,\n\t\t\t\t\tasset: {},\n\t\t\t\t\tsignatures: [],\n\t\t\t\t\tsignature: defaultSignature,\n\t\t\t\t\tid: defaultTransactionId,\n\t\t\t\t};\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t'00aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae095d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae0900cebcaa8d34153de803000000000000618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\t'hex',\n\t\t\t\t);\n\t\t\t\tconst transactionBytes = getTransactionBytes(multiSignatureTransaction);\n\n\t\t\t\treturn expect(transactionBytes).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should return Buffer of type 0 (transfer LSK) with additional properties', () => {\n\t\t\t\tconst transaction = {\n\t\t\t\t\t...defaultTransaction,\n\t\t\t\t\tskip: false,\n\t\t\t\t};\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t'00aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae0900cebcaa8d34153d0000c16ff2862300618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\t'hex',\n\t\t\t\t);\n\t\t\t\tconst transactionBytes = getTransactionBytes(transaction);\n\n\t\t\t\treturn expect(transactionBytes).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should throw on missing required parameter type', () => {\n\t\t\t\tconst { type, ...defaultTransactionClone } = defaultTransaction;\n\t\t\t\texpect(\n\t\t\t\t\tgetTransactionBytes.bind(null, defaultTransactionClone),\n\t\t\t\t).to.throw(`type is a required parameter.`);\n\t\t\t});\n\n\t\t\tit('should throw on missing required parameter timestamp', () => {\n\t\t\t\tconst { timestamp, ...defaultTransactionClone } = defaultTransaction;\n\t\t\t\texpect(\n\t\t\t\t\tgetTransactionBytes.bind(null, defaultTransactionClone),\n\t\t\t\t).to.throw(`timestamp is a required parameter.`);\n\t\t\t});\n\n\t\t\tit('should throw on missing required parameter senderPublicKey', () => {\n\t\t\t\tconst {\n\t\t\t\t\tsenderPublicKey,\n\t\t\t\t\t...defaultTransactionClone\n\t\t\t\t} = defaultTransaction;\n\t\t\t\texpect(\n\t\t\t\t\tgetTransactionBytes.bind(null, defaultTransactionClone),\n\t\t\t\t).to.throw(`senderPublicKey is a required parameter.`);\n\t\t\t});\n\n\t\t\tit('should throw on missing required parameter amount', () => {\n\t\t\t\tconst { amount, ...defaultTransactionClone } = defaultTransaction;\n\t\t\t\texpect(\n\t\t\t\t\tgetTransactionBytes.bind(null, defaultTransactionClone),\n\t\t\t\t).to.throw(`amount is a required parameter.`);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('signature transaction, type 1', () => {\n\t\t\tconst signatureTransaction = {\n\t\t\t\ttype: 1,\n\t\t\t\tamount: defaultNoAmount,\n\t\t\t\tfee: (5 * fixedPoint).toString(),\n\t\t\t\trecipientId: null,\n\t\t\t\tsenderPublicKey: defaultSenderPublicKey,\n\t\t\t\ttimestamp: defaultTimestamp,\n\t\t\t\tasset: { signature: { publicKey: defaultSenderSecondPublicKey } },\n\t\t\t\tsignature: defaultSignature,\n\t\t\t\tid: defaultTransactionId,\n\t\t\t};\n\n\t\t\tit('should return Buffer of type 1 (register second signature) transaction', () => {\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t'01aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09000000000000000000000000000000000401c8ac9f29ded9e1e4d5b6b43051cb25b22f27c7b7b35092161e851946f82f618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\t'hex',\n\t\t\t\t);\n\t\t\t\tconst transactionBytes = getTransactionBytes(signatureTransaction);\n\n\t\t\t\treturn expect(transactionBytes).to.be.eql(expectedBuffer);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('delegate registration transaction, type 2', () => {\n\t\t\tconst delegateRegistrationTransaction = {\n\t\t\t\ttype: 2,\n\t\t\t\tamount: defaultNoAmount,\n\t\t\t\tfee: (25 * fixedPoint).toString(),\n\t\t\t\trecipientId: null,\n\t\t\t\tsenderPublicKey: defaultSenderPublicKey,\n\t\t\t\ttimestamp: defaultTimestamp,\n\t\t\t\tasset: { delegate: { username: defaultDelegateUsername } },\n\t\t\t\tsignature: defaultSignature,\n\t\t\t\tid: defaultTransactionId,\n\t\t\t};\n\n\t\t\tit('should return Buffer of type 2 (register delegate) transaction', () => {\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t'02aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09000000000000000000000000000000004d7944656c6567617465557365726e616d65618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\t'hex',\n\t\t\t\t);\n\t\t\t\tconst transactionBytes = getTransactionBytes(\n\t\t\t\t\tdelegateRegistrationTransaction,\n\t\t\t\t);\n\n\t\t\t\treturn expect(transactionBytes).to.be.eql(expectedBuffer);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('vote transaction, type 3', () => {\n\t\t\tconst voteTransaction = {\n\t\t\t\ttype: 3,\n\t\t\t\tamount: '0',\n\t\t\t\tfee: (1 * fixedPoint).toString(),\n\t\t\t\trecipientId: defaultRecipient,\n\t\t\t\tsenderPublicKey: defaultSenderPublicKey,\n\t\t\t\ttimestamp: defaultTimestamp,\n\t\t\t\tasset: {\n\t\t\t\t\tvotes: [\n\t\t\t\t\t\t`+${defaultSenderPublicKey}`,\n\t\t\t\t\t\t`+${defaultSenderSecondPublicKey}`,\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\tsignature: defaultSignature,\n\t\t\t\tid: defaultTransactionId,\n\t\t\t};\n\n\t\t\tit('should return Buffer of type 3 (vote) transaction', () => {\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t'03aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae0900cebcaa8d34153d00000000000000002b356430333661383538636538396638343434393137363265623839653262666264353061346130613064613635386534623236323862323562313137616530392b30343031633861633966323964656439653165346435623662343330353163623235623232663237633762376233353039323136316538353139343666383266618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\t'hex',\n\t\t\t\t);\n\t\t\t\tconst transactionBytes = getTransactionBytes(voteTransaction);\n\n\t\t\t\treturn expect(transactionBytes).to.be.eql(expectedBuffer);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('multisignature transaction, type 4', () => {\n\t\t\tconst createMultiSignatureTransaction = {\n\t\t\t\ttype: 4,\n\t\t\t\tamount: '0',\n\t\t\t\tfee: (15 * fixedPoint).toString(),\n\t\t\t\trecipientId: null,\n\t\t\t\tsenderPublicKey: defaultSenderPublicKey,\n\t\t\t\ttimestamp: defaultTimestamp,\n\t\t\t\tasset: {\n\t\t\t\t\tmultisignature: {\n\t\t\t\t\t\tmin: 2,\n\t\t\t\t\t\tlifetime: 5,\n\t\t\t\t\t\tkeysgroup: [\n\t\t\t\t\t\t\t`+${defaultSenderPublicKey}`,\n\t\t\t\t\t\t\t`+${defaultSenderSecondPublicKey}`,\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tsignature: defaultSignature,\n\t\t\t\tid: defaultTransactionId,\n\t\t\t};\n\n\t\t\tit('should return Buffer from type 4 (register multisignature) transaction', () => {\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t'04aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae090000000000000000000000000000000002052b356430333661383538636538396638343434393137363265623839653262666264353061346130613064613635386534623236323862323562313137616530392b30343031633861633966323964656439653165346435623662343330353163623235623232663237633762376233353039323136316538353139343666383266618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\t'hex',\n\t\t\t\t);\n\t\t\t\tconst transactionBytes = getTransactionBytes(\n\t\t\t\t\tcreateMultiSignatureTransaction,\n\t\t\t\t);\n\n\t\t\t\treturn expect(transactionBytes).to.be.eql(expectedBuffer);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('dapp transaction, type 5', () => {\n\t\t\tconst dappTransaction = {\n\t\t\t\ttype: 5,\n\t\t\t\tamount: '0',\n\t\t\t\tfee: (25 * fixedPoint).toString(),\n\t\t\t\trecipientId: null,\n\t\t\t\tsenderPublicKey: defaultSenderPublicKey,\n\t\t\t\ttimestamp: defaultTimestamp,\n\t\t\t\tasset: {\n\t\t\t\t\tdapp: {\n\t\t\t\t\t\tcategory: 0,\n\t\t\t\t\t\tname: 'Lisk Guestbook',\n\t\t\t\t\t\tdescription: 'The official Lisk guestbook',\n\t\t\t\t\t\ttags: 'guestbook message sidechain',\n\t\t\t\t\t\ttype: 0,\n\t\t\t\t\t\tlink: 'https://github.com/MaxKK/guestbookDapp/archive/master.zip',\n\t\t\t\t\t\ticon:\n\t\t\t\t\t\t\t'https://raw.githubusercontent.com/MaxKK/guestbookDapp/master/icon.png',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tsignature: defaultSignature,\n\t\t\t\tid: defaultTransactionId,\n\t\t\t};\n\n\t\t\tit('should return Buffer of type 5 (register dapp) transaction', () => {\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t'05aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09000000000000000000000000000000004c69736b204775657374626f6f6b546865206f6666696369616c204c69736b206775657374626f6f6b6775657374626f6f6b206d6573736167652073696465636861696e68747470733a2f2f6769746875622e636f6d2f4d61784b4b2f6775657374626f6f6b446170702f617263686976652f6d61737465722e7a697068747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f4d61784b4b2f6775657374626f6f6b446170702f6d61737465722f69636f6e2e706e670000000000000000618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\t'hex',\n\t\t\t\t);\n\t\t\t\tconst transactionBytes = getTransactionBytes(dappTransaction);\n\n\t\t\t\treturn expect(transactionBytes).to.be.eql(expectedBuffer);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('inTransfer transaction, type 6', () => {\n\t\t\tconst inTransferTransction = {\n\t\t\t\ttype: 6,\n\t\t\t\tamount: defaultAmount,\n\t\t\t\tfee: (1 * fixedPoint).toString(),\n\t\t\t\trecipientId: null,\n\t\t\t\tsenderPublicKey: defaultSenderPublicKey,\n\t\t\t\ttimestamp: defaultTimestamp,\n\t\t\t\tasset: { inTransfer: { dappId: defaultAppId } },\n\t\t\t\tsignature: defaultSignature,\n\t\t\t\tid: defaultTransactionId,\n\t\t\t};\n\n\t\t\tit('should return Buffer of type 6 (dapp inTransfer) transaction', () => {\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t'06aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae0900000000000000000000c16ff286230031323334323133618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\t'hex',\n\t\t\t\t);\n\t\t\t\tconst transactionBytes = getTransactionBytes(inTransferTransction);\n\n\t\t\t\treturn expect(transactionBytes).to.be.eql(expectedBuffer);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('outTransfer transaction, type 7', () => {\n\t\t\tconst outTransferTransaction = {\n\t\t\t\ttype: 7,\n\t\t\t\tamount: defaultAmount,\n\t\t\t\tfee: (1 * fixedPoint).toString(),\n\t\t\t\trecipientId: defaultRecipient,\n\t\t\t\tsenderPublicKey: defaultSenderPublicKey,\n\t\t\t\ttimestamp: defaultTimestamp,\n\t\t\t\tasset: {\n\t\t\t\t\toutTransfer: {\n\t\t\t\t\t\tdappId: defaultAppId,\n\t\t\t\t\t\ttransactionId: defaultTransactionId,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tsignature: defaultSignature,\n\t\t\t\tid: defaultTransactionId,\n\t\t\t};\n\n\t\t\tit('should return Buffer of type 7 (dapp outTransfer) transaction', () => {\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t'07aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae0900cebcaa8d34153d0000c16ff2862300313233343231333133393837333438343230393133313338343232618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\t'hex',\n\t\t\t\t);\n\t\t\t\tconst transactionBytes = getTransactionBytes(outTransferTransaction);\n\n\t\t\t\treturn expect(transactionBytes).to.be.eql(expectedBuffer);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('getTransactionBytes functions', () => {\n\t\tdescribe('#checkRequiredFields', () => {\n\t\t\tconst arrayToCheck = ['OneValue', 'SecondValue', 'ThirdValue'];\n\t\t\tit('should accept array and object to check for required fields', () => {\n\t\t\t\tconst objectParameter = {\n\t\t\t\t\tOneValue: '1',\n\t\t\t\t\tSecondValue: '2',\n\t\t\t\t\tThirdValue: '3',\n\t\t\t\t};\n\n\t\t\t\treturn expect(checkRequiredFields(arrayToCheck, objectParameter)).to.be\n\t\t\t\t\t.true;\n\t\t\t});\n\n\t\t\tit('should throw on missing value', () => {\n\t\t\t\tconst objectParameter = {\n\t\t\t\t\tOneValue: '1',\n\t\t\t\t\tSecondValue: '2',\n\t\t\t\t};\n\n\t\t\t\treturn expect(\n\t\t\t\t\tcheckRequiredFields.bind(null, arrayToCheck, objectParameter),\n\t\t\t\t).to.throw('ThirdValue is a required parameter.');\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#getAssetDataForTransferTransaction', () => {\n\t\t\tconst defaultEmptyBuffer = Buffer.alloc(0);\n\t\t\tit('should return Buffer for data asset', () => {\n\t\t\t\tconst expectedBuffer = Buffer.from('my data input', 'utf8');\n\t\t\t\tconst assetDataBuffer = getAssetDataForTransferTransaction({\n\t\t\t\t\tdata: 'my data input',\n\t\t\t\t});\n\n\t\t\t\treturn expect(assetDataBuffer).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should return empty Buffer for no asset data', () => {\n\t\t\t\tconst assetDataBuffer = getAssetDataForTransferTransaction({});\n\t\t\t\treturn expect(assetDataBuffer).to.be.eql(defaultEmptyBuffer);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#getAssetDataForRegisterSecondSignatureTransaction', () => {\n\t\t\tit('should return Buffer for signature asset', () => {\n\t\t\t\tconst expectedBuffer = Buffer.from(defaultSenderPublicKey, 'hex');\n\t\t\t\tconst assetSignaturesPublicKeyBuffer = getAssetDataForRegisterSecondSignatureTransaction(\n\t\t\t\t\t{\n\t\t\t\t\t\tsignature: {\n\t\t\t\t\t\t\tpublicKey: defaultSenderPublicKey,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\treturn expect(assetSignaturesPublicKeyBuffer).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should throw on missing publicKey in the signature asset', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tgetAssetDataForRegisterSecondSignatureTransaction.bind(null, {\n\t\t\t\t\t\tsignature: {},\n\t\t\t\t\t}),\n\t\t\t\t).to.throw('publicKey is a required parameter.');\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#getAssetDataForRegisterDelegateTransaction', () => {\n\t\t\tit('should return Buffer for delegate asset', () => {\n\t\t\t\tconst expectedBuffer = Buffer.from(defaultDelegateUsername, 'utf8');\n\t\t\t\tconst assetDelegateUsernameBuffer = getAssetDataForRegisterDelegateTransaction(\n\t\t\t\t\t{\n\t\t\t\t\t\tdelegate: {\n\t\t\t\t\t\t\tusername: defaultDelegateUsername,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\treturn expect(assetDelegateUsernameBuffer).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should throw on missing username in the delegate asset', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tgetAssetDataForRegisterDelegateTransaction.bind(null, {\n\t\t\t\t\t\tdelegate: {},\n\t\t\t\t\t}),\n\t\t\t\t).to.throw('username is a required parameter.');\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#getAssetDataForCastVotesTransaction', () => {\n\t\t\tit('should return Buffer for votes asset', () => {\n\t\t\t\tconst votesAsset = {\n\t\t\t\t\tvotes: [\n\t\t\t\t\t\t`+${defaultSenderPublicKey}`,\n\t\t\t\t\t\t`+${defaultSenderSecondPublicKey}`,\n\t\t\t\t\t],\n\t\t\t\t};\n\t\t\t\tconst expectedBuffer = Buffer.from(\n\t\t\t\t\t`+${defaultSenderPublicKey}+${defaultSenderSecondPublicKey}`,\n\t\t\t\t\t'utf8',\n\t\t\t\t);\n\t\t\t\tconst assetVoteBuffer = getAssetDataForCastVotesTransaction(votesAsset);\n\n\t\t\t\treturn expect(assetVoteBuffer).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should throw on missing votes in the vote asset', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tgetAssetDataForCastVotesTransaction.bind(null, { votes: {} }),\n\t\t\t\t).to.throw('votes parameter must be an Array.');\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#getAssetDataForRegisterMultisignatureAccountTransaction', () => {\n\t\t\tconst min = 2;\n\t\t\tconst lifetime = 5;\n\t\t\tconst keysgroup = ['+123456789', '-987654321'];\n\t\t\tlet multisignatureAsset: MultiSignatureAsset;\n\n\t\t\tbeforeEach(() => {\n\t\t\t\tmultisignatureAsset = {\n\t\t\t\t\tmultisignature: {\n\t\t\t\t\t\tmin,\n\t\t\t\t\t\tlifetime,\n\t\t\t\t\t\tkeysgroup,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should return Buffer for multisignature asset', () => {\n\t\t\t\tconst minBuffer = Buffer.alloc(1, min);\n\t\t\t\tconst lifetimeBuffer = Buffer.alloc(1, lifetime);\n\t\t\t\tconst keysgroupBuffer = Buffer.from('+123456789-987654321', 'utf8');\n\n\t\t\t\tconst expectedBuffer = Buffer.concat([\n\t\t\t\t\tminBuffer,\n\t\t\t\t\tlifetimeBuffer,\n\t\t\t\t\tkeysgroupBuffer,\n\t\t\t\t]);\n\t\t\t\tconst multisignatureBuffer = getAssetDataForRegisterMultisignatureAccountTransaction(\n\t\t\t\t\tmultisignatureAsset,\n\t\t\t\t);\n\n\t\t\t\treturn expect(multisignatureBuffer).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should throw on missing required parameter min', () => {\n\t\t\t\tconst { min, ...multisigAsset } = multisignatureAsset.multisignature;\n\t\t\t\texpect(\n\t\t\t\t\tgetAssetDataForRegisterMultisignatureAccountTransaction.bind(null, {\n\t\t\t\t\t\tmultisignature: multisigAsset,\n\t\t\t\t\t}),\n\t\t\t\t).to.throw(`min is a required parameter.`);\n\t\t\t});\n\n\t\t\tit('should throw on missing required parameter lifetime', () => {\n\t\t\t\tconst {\n\t\t\t\t\tlifetime,\n\t\t\t\t\t...multisigAsset\n\t\t\t\t} = multisignatureAsset.multisignature;\n\t\t\t\texpect(\n\t\t\t\t\tgetAssetDataForRegisterMultisignatureAccountTransaction.bind(null, {\n\t\t\t\t\t\tmultisignature: multisigAsset,\n\t\t\t\t\t}),\n\t\t\t\t).to.throw(`lifetime is a required parameter.`);\n\t\t\t});\n\n\t\t\tit('should throw on missing required parameter keysgroup', () => {\n\t\t\t\tconst {\n\t\t\t\t\tkeysgroup,\n\t\t\t\t\t...multisigAsset\n\t\t\t\t} = multisignatureAsset.multisignature;\n\t\t\t\texpect(\n\t\t\t\t\tgetAssetDataForRegisterMultisignatureAccountTransaction.bind(null, {\n\t\t\t\t\t\tmultisignature: multisigAsset,\n\t\t\t\t\t}),\n\t\t\t\t).to.throw(`keysgroup is a required parameter.`);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#getAssetDataForCreateDappTransaction', () => {\n\t\t\tconst defaultCategory = 0;\n\t\t\tconst defaultDappName = 'Lisk Guestbook';\n\t\t\tconst defaultDescription = 'The official Lisk guestbook';\n\t\t\tconst defaultTags = 'guestbook message sidechain';\n\t\t\tconst defaultType = 0;\n\t\t\tconst defaultLink =\n\t\t\t\t'https://github.com/MaxKK/guestbookDapp/archive/master.zip';\n\t\t\tconst defaultIcon =\n\t\t\t\t'https://raw.githubusercontent.com/MaxKK/guestbookDapp/master/icon.png';\n\t\t\tconst dappNameBuffer = Buffer.from('4c69736b204775657374626f6f6b', 'hex');\n\t\t\tconst dappDescriptionBuffer = Buffer.from(\n\t\t\t\t'546865206f6666696369616c204c69736b206775657374626f6f6b',\n\t\t\t\t'hex',\n\t\t\t);\n\t\t\tconst dappTagsBuffer = Buffer.from(\n\t\t\t\t'6775657374626f6f6b206d6573736167652073696465636861696e',\n\t\t\t\t'hex',\n\t\t\t);\n\t\t\tconst dappLinkBuffer = Buffer.from(\n\t\t\t\t'68747470733a2f2f6769746875622e636f6d2f4d61784b4b2f6775657374626f6f6b446170702f617263686976652f6d61737465722e7a6970',\n\t\t\t\t'hex',\n\t\t\t);\n\t\t\tconst dappIconBuffer = Buffer.from(\n\t\t\t\t'68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f4d61784b4b2f6775657374626f6f6b446170702f6d61737465722f69636f6e2e706e67',\n\t\t\t\t'hex',\n\t\t\t);\n\t\t\tconst dappTypeBuffer = Buffer.alloc(4, defaultType);\n\t\t\tconst dappCategoryBuffer = Buffer.alloc(4, defaultCategory);\n\n\t\t\tit('should return Buffer for create dapp asset', () => {\n\t\t\t\tconst dappAsset = {\n\t\t\t\t\tdapp: {\n\t\t\t\t\t\tcategory: defaultCategory,\n\t\t\t\t\t\tname: defaultDappName,\n\t\t\t\t\t\tdescription: defaultDescription,\n\t\t\t\t\t\ttags: defaultTags,\n\t\t\t\t\t\ttype: defaultType,\n\t\t\t\t\t\tlink: defaultLink,\n\t\t\t\t\t\ticon: defaultIcon,\n\t\t\t\t\t},\n\t\t\t\t};\n\n\t\t\t\tconst expectedBuffer = Buffer.concat([\n\t\t\t\t\tdappNameBuffer,\n\t\t\t\t\tdappDescriptionBuffer,\n\t\t\t\t\tdappTagsBuffer,\n\t\t\t\t\tdappLinkBuffer,\n\t\t\t\t\tdappIconBuffer,\n\t\t\t\t\tdappTypeBuffer,\n\t\t\t\t\tdappCategoryBuffer,\n\t\t\t\t]);\n\t\t\t\tconst dappBuffer = getAssetDataForCreateDappTransaction(dappAsset);\n\n\t\t\t\treturn expect(dappBuffer).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should throw for create dapp asset without required fields', () => {\n\t\t\t\tconst dapp: { readonly [key: string]: string | number } = {\n\t\t\t\t\tcategory: defaultCategory,\n\t\t\t\t\tname: defaultDappName,\n\t\t\t\t\tdescription: defaultDescription,\n\t\t\t\t\ttags: defaultTags,\n\t\t\t\t\ttype: defaultType,\n\t\t\t\t\tlink: defaultLink,\n\t\t\t\t\ticon: defaultIcon,\n\t\t\t\t};\n\t\t\t\tconst requiredProperties = ['name', 'link', 'type', 'category'];\n\n\t\t\t\treturn requiredProperties.forEach(parameter => {\n\t\t\t\t\tconst { [parameter]: deletedValue, ...dappClone } = dapp;\n\t\t\t\t\texpect(\n\t\t\t\t\t\tgetAssetDataForCreateDappTransaction.bind(null, {\n\t\t\t\t\t\t\tdapp: dappClone,\n\t\t\t\t\t\t}),\n\t\t\t\t\t).to.throw(`${parameter} is a required parameter.`);\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#getAssetDataForTransferIntoDappTransaction', () => {\n\t\t\tit('should return Buffer for dappIn asset', () => {\n\t\t\t\tconst dappInAsset = {\n\t\t\t\t\tinTransfer: {\n\t\t\t\t\t\tdappId: defaultAppId,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tconst expectedBuffer = Buffer.from(defaultAppId, 'utf8');\n\t\t\t\tconst dappInTransferBuffer = getAssetDataForTransferIntoDappTransaction(\n\t\t\t\t\tdappInAsset,\n\t\t\t\t);\n\n\t\t\t\treturn expect(dappInTransferBuffer).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should throw on missing votes in the vote asset', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tgetAssetDataForTransferIntoDappTransaction.bind(null, {\n\t\t\t\t\t\tinTransfer: {},\n\t\t\t\t\t}),\n\t\t\t\t).to.throw('dappId is a required parameter.');\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#getAssetDataForTransferOutOfDappTransaction', () => {\n\t\t\tit('should return Buffer for dappOut asset', () => {\n\t\t\t\tconst dappOutAsset = {\n\t\t\t\t\toutTransfer: {\n\t\t\t\t\t\tdappId: defaultAppId,\n\t\t\t\t\t\ttransactionId: defaultTransactionId,\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\tconst dappIdBuffer = Buffer.from(defaultAppId, 'utf8');\n\t\t\t\tconst transactionIdBuffer = Buffer.from(defaultTransactionId);\n\t\t\t\tconst expectedBuffer = Buffer.concat([\n\t\t\t\t\tdappIdBuffer,\n\t\t\t\t\ttransactionIdBuffer,\n\t\t\t\t]);\n\t\t\t\tconst dappOutTransferBuffer = getAssetDataForTransferOutOfDappTransaction(\n\t\t\t\t\tdappOutAsset,\n\t\t\t\t);\n\n\t\t\t\treturn expect(dappOutTransferBuffer).to.be.eql(expectedBuffer);\n\t\t\t});\n\n\t\t\tit('should throw on missing votes in the vote asset', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tgetAssetDataForTransferOutOfDappTransaction.bind(null, {\n\t\t\t\t\t\toutTransfer: {},\n\t\t\t\t\t}),\n\t\t\t\t).to.throw('dappId is a required parameter.');\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#checkTransaction', () => {\n\t\t\tconst maxDataLength = 64;\n\t\t\tlet defaultTransaction: BaseTransaction;\n\t\t\tbeforeEach(() => {\n\t\t\t\tdefaultTransaction = {\n\t\t\t\t\ttype: 0,\n\t\t\t\t\tfee: (0.1 * fixedPoint).toString(),\n\t\t\t\t\tamount: defaultAmount,\n\t\t\t\t\trecipientId: defaultRecipient,\n\t\t\t\t\ttimestamp: defaultTimestamp,\n\t\t\t\t\tasset: {},\n\t\t\t\t\tsenderPublicKey: defaultSenderPublicKey,\n\t\t\t\t\tsenderId: defaultSenderId,\n\t\t\t\t\tsignature: defaultSignature,\n\t\t\t\t\tid: defaultTransactionId,\n\t\t\t\t};\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should throw on too many data in transfer asset', () => {\n\t\t\t\tconst transaction = {\n\t\t\t\t\t...defaultTransaction,\n\t\t\t\t\tasset: {\n\t\t\t\t\t\tdata: new Array(maxDataLength + 1).fill('1').join(''),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn expect(checkTransaction.bind(null, transaction)).to.throw(\n\t\t\t\t\t'Transaction asset data exceeds size of 64.',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should return true on asset data exactly at max data length', () => {\n\t\t\t\tconst transaction = {\n\t\t\t\t\t...defaultTransaction,\n\t\t\t\t\tasset: {\n\t\t\t\t\t\tdata: new Array(maxDataLength).fill('1').join(''),\n\t\t\t\t\t},\n\t\t\t\t};\n\t\t\t\treturn expect(checkTransaction(transaction)).to.be.true;\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#isInvalidValue', () => {\n\t\t\tit('should return false on invalid values', () => {\n\t\t\t\tconst allInvalidValues = [NaN, false, undefined];\n\t\t\t\treturn allInvalidValues.forEach(value => {\n\t\t\t\t\tconst invalid = isValidValue(value);\n\t\t\t\t\texpect(invalid).to.be.false;\n\t\t\t\t});\n\t\t\t});\n\t\t\tit('should return true on valid values', () => {\n\t\t\t\tconst exampleValidValues = ['123', 123, { 1: 2, 3: 4 }, [1, 2, 3]];\n\t\t\t\treturn exampleValidValues.forEach(value => {\n\t\t\t\t\tconst valid = isValidValue(value);\n\t\t\t\t\texpect(valid).to.be.true;\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/utils/get_transaction_hash.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { getTransactionHash } from '../../src/utils';\nimport { BaseTransaction } from '../../src/transaction_types';\nimport * as getTransactionBytesModule from '../../src/utils/get_transaction_bytes';\n\ndescribe('#getTransactionHash', () => {\n\tlet defaultTransactionBytes;\n\tlet transaction: BaseTransaction;\n\tlet result: Buffer;\n\n\tbeforeEach(() => {\n\t\tdefaultTransactionBytes = Buffer.from(\n\t\t\t'00aa2902005d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae0900cebcaa8d34153de803000000000000618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t'hex',\n\t\t);\n\t\tsandbox\n\t\t\t.stub(getTransactionBytesModule, 'getTransactionBytes')\n\t\t\t.returns(defaultTransactionBytes);\n\t\ttransaction = {\n\t\t\ttype: 0,\n\t\t\tamount: '1000',\n\t\t\tfee: '0',\n\t\t\trecipientId: '58191285901858109L',\n\t\t\ttimestamp: 141738,\n\t\t\tasset: {},\n\t\t\tsenderPublicKey:\n\t\t\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\t\tsignature:\n\t\t\t\t'618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\tid: '13987348420913138422',\n\t\t};\n\t\tresult = getTransactionHash(transaction);\n\t\treturn Promise.resolve();\n\t});\n\n\tit('should get transaction bytes', () => {\n\t\treturn expect(\n\t\t\tgetTransactionBytesModule.getTransactionBytes,\n\t\t).to.be.calledWithExactly(transaction);\n\t});\n\n\tit('should return a hash for a transaction object as a Buffer', () => {\n\t\tconst expected = Buffer.from(\n\t\t\t'f60a26da470b1dc233fd526ed7306c1d84836f9e2ecee82c9ec47319e0910474',\n\t\t\t'hex',\n\t\t);\n\t\treturn expect(result).to.be.eql(expected);\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/utils/get_transaction_id.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { getTransactionId } from '../../src/utils';\nimport { BaseTransaction } from '../../src/transaction_types';\n// Require is used for stubbing\nconst utils = require('../../src/utils');\n\ndescribe('#getTransactionId', () => {\n\tconst defaultPublicKey =\n\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09';\n\tconst defaultTransactionId = '13987348420913138422';\n\tconst defaultTransactionHash = Buffer.from(\n\t\t'f60a26da470b1dc233fd526ed7306c1d84836f9e2ecee82c9ec47319e0910474',\n\t\t'hex',\n\t);\n\tconst defaultAmount = '1000';\n\tconst defaultTimestamp = 141738;\n\tconst defaultRecipientId = '58191285901858109L';\n\tconst defaultSignature =\n\t\t'618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a';\n\n\tbeforeEach(() => {\n\t\tsandbox.stub(cryptography, 'hash').returns(defaultTransactionHash);\n\t\treturn sandbox.stub(utils, 'getTransactionBytes');\n\t});\n\n\tit('should return an id of 13987348420913138422 for a transaction', () => {\n\t\tconst transaction: BaseTransaction = {\n\t\t\ttype: 0,\n\t\t\tamount: defaultAmount,\n\t\t\tfee: '0',\n\t\t\trecipientId: defaultRecipientId,\n\t\t\ttimestamp: defaultTimestamp,\n\t\t\tasset: {},\n\t\t\tsenderPublicKey: defaultPublicKey,\n\t\t\tsignature: defaultSignature,\n\t\t};\n\t\tconst id = getTransactionId(transaction);\n\n\t\treturn expect(id).to.be.equal(defaultTransactionId);\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/utils/index.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport {\n\tcheckPublicKeysForDuplicates,\n\tconvertBeddowsToLSK,\n\tconvertLSKToBeddows,\n\tgetTimeFromBlockchainEpoch,\n\tgetTimeWithOffset,\n\tgetTransactionBytes,\n\tgetTransactionHash,\n\tgetTransactionId,\n\tprepareTransaction,\n\tprependMinusToPublicKeys,\n\tprependPlusToPublicKeys,\n\tsignRawTransaction,\n\tsignTransaction,\n\tmultiSignTransaction,\n\tverifyTransaction,\n\tvalidateAddress,\n\tvalidateAmount,\n\tisValidInteger,\n\tvalidateKeysgroup,\n\tvalidatePublicKey,\n\tvalidatePublicKeys,\n\tvalidateTransaction,\n} from '../../src/utils';\n\ndescribe('transaction utils', () => {\n\tdescribe('exports', () => {\n\t\tit('should have checkPublicKeysForDuplicates', () => {\n\t\t\treturn expect(checkPublicKeysForDuplicates).to.be.a('function');\n\t\t});\n\n\t\tit('should have convertBeddowsToLSK', () => {\n\t\t\treturn expect(convertBeddowsToLSK).to.be.a('function');\n\t\t});\n\n\t\tit('should have convertLSKToBeddows', () => {\n\t\t\treturn expect(convertLSKToBeddows).to.be.a('function');\n\t\t});\n\n\t\tit('should have getTimeFromBlockchainEpoch', () => {\n\t\t\treturn expect(getTimeFromBlockchainEpoch).to.be.a('function');\n\t\t});\n\n\t\tit('should have getTimeWithOffset', () => {\n\t\t\treturn expect(getTimeWithOffset).to.be.a('function');\n\t\t});\n\n\t\tit('should have getTransactionBytes', () => {\n\t\t\treturn expect(getTransactionBytes).to.be.a('function');\n\t\t});\n\n\t\tit('should have getTransactionHash', () => {\n\t\t\treturn expect(getTransactionHash).to.be.a('function');\n\t\t});\n\n\t\tit('should have getTransactionId', () => {\n\t\t\treturn expect(getTransactionId).to.be.a('function');\n\t\t});\n\n\t\tit('should have prepareTransaction', () => {\n\t\t\treturn expect(prepareTransaction).to.be.a('function');\n\t\t});\n\n\t\tit('should have prependMinusToPublicKeys', () => {\n\t\t\treturn expect(prependMinusToPublicKeys).to.be.a('function');\n\t\t});\n\n\t\tit('should have prependPlusToPublicKeys', () => {\n\t\t\treturn expect(prependPlusToPublicKeys).to.be.a('function');\n\t\t});\n\n\t\tit('should have signRawTransaction', () => {\n\t\t\treturn expect(signRawTransaction).to.be.a('function');\n\t\t});\n\n\t\tit('should have signTransaction', () => {\n\t\t\treturn expect(signTransaction).to.be.a('function');\n\t\t});\n\n\t\tit('should have multiSignTransaction', () => {\n\t\t\treturn expect(multiSignTransaction).to.be.a('function');\n\t\t});\n\n\t\tit('should have verifyTransaction', () => {\n\t\t\treturn expect(verifyTransaction).to.be.a('function');\n\t\t});\n\n\t\tit('should have validateAddress', () => {\n\t\t\treturn expect(validateAddress).to.be.a('function');\n\t\t});\n\n\t\tit('should have validateAmount', () => {\n\t\t\treturn expect(validateAmount).to.be.a('function');\n\t\t});\n\n\t\tit('should have isValidInteger', () => {\n\t\t\treturn expect(isValidInteger).to.be.a('function');\n\t\t});\n\n\t\tit('should have validateKeysgroup', () => {\n\t\t\treturn expect(validateKeysgroup).to.be.a('function');\n\t\t});\n\n\t\tit('should have validatePublicKey', () => {\n\t\t\treturn expect(validatePublicKey).to.be.a('function');\n\t\t});\n\n\t\tit('should have validatePublicKeys', () => {\n\t\t\treturn expect(validatePublicKeys).to.be.a('function');\n\t\t});\n\n\t\tit('should have validateTransaction', () => {\n\t\t\treturn expect(validateTransaction).to.be.a('function');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/utils/prepare_transaction.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { prepareTransaction } from '../../src/utils/prepare_transaction';\nimport { getTimeWithOffset } from '../../src/utils/time';\nimport {\n\tBaseTransaction,\n\tPartialTransaction,\n} from '../../src/transaction_types';\n\ndescribe('#prepareTransaction', () => {\n\tconst passphrase = 'secret';\n\tconst keys = {\n\t\tprivateKey:\n\t\t\t'2bb80d537b1da3e38bd30361aa855686bde0eacd7162fef6a25fe97bf527a25b5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\tpublicKey:\n\t\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t};\n\tconst signature =\n\t\t'a00835fe0ad89d8b8a26cc3ffa8238d89bd38999f39d712fe8745707c8e18ea70337a7dfde725fddaa858dd64843170de3e481f54438b8aad734b0e75bbad706';\n\tconst secondPassphrase = 'second secret';\n\tconst secondSignature =\n\t\t'08ce78b2382c396596cc38ea8b9dbc2df62f0d919ddc817070902eeaf1b93ca17ced0766bb4e10f565ae9e55f673691d966dea45e60922fd2685556b441ffb0e';\n\tconst id = '8330167589806376997';\n\tconst defaultTransaction = {\n\t\ttype: 0,\n\t\tamount: (10e8).toString(),\n\t\ttimestamp: 10,\n\t\tsenderPublicKey: keys.publicKey,\n\t\tasset: {},\n\t};\n\tlet inputTransaction: PartialTransaction;\n\tlet preparedTransaction: BaseTransaction;\n\n\tbeforeEach(() => {\n\t\tinputTransaction = { ...defaultTransaction };\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('without type', () => {\n\t\tit('should throw an error when it is not transaction', () => {\n\t\t\tconst { type, ...invalidTransaction } = inputTransaction;\n\t\t\treturn expect(\n\t\t\t\tprepareTransaction.bind(null, invalidTransaction, passphrase),\n\t\t\t).to.throw('Invalid transaction to process');\n\t\t});\n\t});\n\n\tdescribe('without signature', () => {\n\t\tbeforeEach(() => {\n\t\t\tpreparedTransaction = prepareTransaction(inputTransaction);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should not mutate the original transaction', () => {\n\t\t\treturn expect(inputTransaction).to.eql(defaultTransaction);\n\t\t});\n\n\t\tit('should not add a signature to a transaction', () => {\n\t\t\treturn expect(preparedTransaction.signature).to.be.undefined;\n\t\t});\n\n\t\tit('should not add an id to a transaction', () => {\n\t\t\treturn expect(preparedTransaction.id).to.be.undefined;\n\t\t});\n\n\t\tit('should add timestamp with the offset', () => {\n\t\t\tconst { timestamp, ...transactionWithoutTimestamp } = inputTransaction;\n\t\t\tconst currentTimestamp = getTimeWithOffset();\n\t\t\tpreparedTransaction = prepareTransaction(\n\t\t\t\ttransactionWithoutTimestamp,\n\t\t\t\tundefined,\n\t\t\t\tundefined,\n\t\t\t\t50,\n\t\t\t);\n\t\t\treturn expect(preparedTransaction.timestamp).to.be.gt(currentTimestamp);\n\t\t});\n\t});\n\n\tdescribe('without second signature', () => {\n\t\tbeforeEach(() => {\n\t\t\tpreparedTransaction = prepareTransaction(inputTransaction, passphrase);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should not mutate the original transaction', () => {\n\t\t\treturn expect(inputTransaction).to.eql(defaultTransaction);\n\t\t});\n\n\t\tit('should add a signature to a transaction', () => {\n\t\t\treturn expect(preparedTransaction)\n\t\t\t\t.to.have.property('signature')\n\t\t\t\t.and.be.hexString.and.equal(signature);\n\t\t});\n\n\t\tit('should add an id to a transaction', () => {\n\t\t\treturn expect(preparedTransaction)\n\t\t\t\t.to.have.property('id')\n\t\t\t\t.and.match(/^[0-9]+$/)\n\t\t\t\t.and.equal(id);\n\t\t});\n\t});\n\n\tdescribe('with second signature', () => {\n\t\tbeforeEach(() => {\n\t\t\tpreparedTransaction = prepareTransaction(\n\t\t\t\tinputTransaction,\n\t\t\t\tpassphrase,\n\t\t\t\tsecondPassphrase,\n\t\t\t);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should not mutate the original transaction', () => {\n\t\t\treturn expect(inputTransaction).to.eql(defaultTransaction);\n\t\t});\n\n\t\tit('should add a second signature to a transaction if a second passphrase is provided', () => {\n\t\t\treturn expect(preparedTransaction)\n\t\t\t\t.to.have.property('signSignature')\n\t\t\t\t.and.be.hexString.and.equal(secondSignature);\n\t\t});\n\n\t\tit('should not add a second signature to a type 1 transaction', () => {\n\t\t\tinputTransaction = Object.assign({}, defaultTransaction, {\n\t\t\t\ttype: 1,\n\t\t\t\tasset: {\n\t\t\t\t\tsignature: {\n\t\t\t\t\t\tpublicKey: keys.publicKey,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t\tpreparedTransaction = prepareTransaction(\n\t\t\t\tinputTransaction,\n\t\t\t\tpassphrase,\n\t\t\t\tsecondPassphrase,\n\t\t\t);\n\t\t\treturn expect(preparedTransaction).not.to.have.property('signSignature');\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/utils/sign_and_verify.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport {\n\tsignTransaction,\n\tmultiSignTransaction,\n\tverifyTransaction,\n} from '../../src/utils';\n// The list of valid transactions was created with lisk-js v0.5.1\n// using the below mentioned passphrases.\nimport fixtureTransactions from '../../fixtures/transactions.json';\nimport {\n\tPartialTransaction,\n\tBaseTransaction,\n} from '../../src/transaction_types';\nimport * as getTransactionHashModule from '../../src/utils/get_transaction_hash';\n// Require is used for stubbing\nconst validTransactions = fixtureTransactions as ReadonlyArray<BaseTransaction>;\n\ndescribe('signAndVerify module', () => {\n\tdescribe('signAndVerify transaction utils', () => {\n\t\tconst defaultPassphrase =\n\t\t\t'minute omit local rare sword knee banner pair rib museum shadow juice';\n\t\tconst defaultPublicKey =\n\t\t\t'7ef45cd525e95b7a86244bbd4eb4550914ad06301013958f4dd64d32ef7bc588';\n\t\tconst defaultSecondPublicKey =\n\t\t\t'0401c8ac9f29ded9e1e4d5b6b43051cb25b22f27c7b7b35092161e851946f82f';\n\t\tconst defaultSignature =\n\t\t\t'bb3f2d12d098c59a0af03bb1157eeb7bc7141b21cea57861c4eac72a7c55f122b5befb1391c3f8509b562fa748fdc7359f6e6051526d979915157c5bcba34e01';\n\t\tconst defaultSecondSignature =\n\t\t\t'897090248c0ecdad749d869ddeae59e5029bdbe4806da92d82d6eb7142b624011f4302941db184a2e70bd29a6adac5ce0b4cf780af893db2f504375bdef6850b';\n\t\tconst defaultHash = Buffer.from(\n\t\t\t'c62214460d66eeb1d9db3fb708e31040d2629fbdb6c93887c5eb0f3243912f91',\n\t\t\t'hex',\n\t\t);\n\n\t\tlet defaultTransaction: PartialTransaction;\n\t\tlet cryptoSignDataStub: sinon.SinonStub;\n\t\tlet cryptoVerifyDataStub: sinon.SinonStub;\n\t\tlet getTransactionHashStub: sinon.SinonStub;\n\n\t\tbeforeEach(() => {\n\t\t\tdefaultTransaction = {\n\t\t\t\ttype: 0,\n\t\t\t\tamount: '1000',\n\t\t\t\trecipientId: '58191285901858109L',\n\t\t\t\ttimestamp: 141738,\n\t\t\t\tasset: {},\n\t\t\t\tid: '13987348420913138422',\n\t\t\t\tsenderPublicKey: defaultPublicKey,\n\t\t\t};\n\n\t\t\tcryptoSignDataStub = sandbox\n\t\t\t\t.stub(cryptography, 'signData')\n\t\t\t\t.returns(defaultSignature);\n\t\t\tcryptoVerifyDataStub = sandbox\n\t\t\t\t.stub(cryptography, 'verifyData')\n\t\t\t\t.returns(true);\n\t\t\tgetTransactionHashStub = sandbox\n\t\t\t\t.stub(getTransactionHashModule, 'getTransactionHash')\n\t\t\t\t.returns(defaultHash);\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tdescribe('#signTransaction', () => {\n\t\t\tlet transaction: BaseTransaction;\n\t\t\tlet signature: string;\n\n\t\t\tbeforeEach(() => {\n\t\t\t\ttransaction = { ...defaultTransaction } as BaseTransaction;\n\t\t\t\tsignature = signTransaction(transaction, defaultPassphrase);\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should get the transaction hash', () => {\n\t\t\t\treturn expect(getTransactionHashStub).to.be.calledWithExactly(\n\t\t\t\t\ttransaction,\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should sign the transaction hash with the passphrase', () => {\n\t\t\t\treturn expect(cryptoSignDataStub).to.be.calledWithExactly(\n\t\t\t\t\tdefaultHash,\n\t\t\t\t\tdefaultPassphrase,\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should return the signature', () => {\n\t\t\t\treturn expect(signature).to.be.equal(defaultSignature);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#multiSignTransaction', () => {\n\t\t\tconst defaultMultisignatureHash = Buffer.from(\n\t\t\t\t'd43eed9049dd8f35106c720669a1148b2c6288d9ea517b936c33a1d84117a760',\n\t\t\t\t'hex',\n\t\t\t);\n\n\t\t\tlet multiSignatureTransaction: BaseTransaction;\n\t\t\tlet signature: string;\n\n\t\t\tbeforeEach(() => {\n\t\t\t\tmultiSignatureTransaction = {\n\t\t\t\t\ttype: 0,\n\t\t\t\t\tamount: '1000',\n\t\t\t\t\trecipientId: '58191285901858109L',\n\t\t\t\t\ttimestamp: 141738,\n\t\t\t\t\tasset: {},\n\t\t\t\t\tsenderPublicKey:\n\t\t\t\t\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\t\t\t\tsignature:\n\t\t\t\t\t\t'618a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\tsignSignature:\n\t\t\t\t\t\t'508a54975212ead93df8c881655c625544bce8ed7ccdfe6f08a42eecfb1adebd051307be5014bb051617baf7815d50f62129e70918190361e5d4dd4796541b0a',\n\t\t\t\t\tid: '13987348420913138422',\n\t\t\t\t} as BaseTransaction;\n\t\t\t\tgetTransactionHashStub.returns(defaultMultisignatureHash);\n\t\t\t\tsignature = multiSignTransaction(\n\t\t\t\t\tmultiSignatureTransaction,\n\t\t\t\t\tdefaultPassphrase,\n\t\t\t\t);\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should remove the signature and second signature before getting transaction hash', () => {\n\t\t\t\texpect(getTransactionHashStub.args[0]).not.to.have.property(\n\t\t\t\t\t'signature',\n\t\t\t\t);\n\t\t\t\treturn expect(getTransactionHashStub.args[0]).not.to.have.property(\n\t\t\t\t\t'signSignature',\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should sign the transaction hash with the passphrase', () => {\n\t\t\t\treturn expect(cryptoSignDataStub).to.be.calledWithExactly(\n\t\t\t\t\tdefaultMultisignatureHash,\n\t\t\t\t\tdefaultPassphrase,\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tit('should return the signature', () => {\n\t\t\t\treturn expect(signature).to.be.equal(defaultSignature);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('#verifyTransaction', () => {\n\t\t\tlet transaction: BaseTransaction;\n\n\t\t\tdescribe('with a single signed transaction', () => {\n\t\t\t\tbeforeEach(() => {\n\t\t\t\t\ttransaction = {\n\t\t\t\t\t\t...defaultTransaction,\n\t\t\t\t\t\tsignature: defaultSignature,\n\t\t\t\t\t} as BaseTransaction;\n\t\t\t\t\treturn Promise.resolve();\n\t\t\t\t});\n\n\t\t\t\tit('should throw if attempting to verify without a secondPublicKey', () => {\n\t\t\t\t\tconst { signature, ...invalidTransaction } = transaction;\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tverifyTransaction.bind(null, invalidTransaction),\n\t\t\t\t\t).to.throw('Cannot verify transaction without signature.');\n\t\t\t\t});\n\n\t\t\t\tit('should remove the signature before getting transaction hash', () => {\n\t\t\t\t\tverifyTransaction(transaction);\n\t\t\t\t\treturn expect(getTransactionHashStub.args[0]).not.to.have.property(\n\t\t\t\t\t\t'signature',\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tit('should verify the transaction using the hash, the signature and the public key', () => {\n\t\t\t\t\tverifyTransaction(transaction);\n\t\t\t\t\treturn expect(cryptoVerifyDataStub).to.be.calledWithExactly(\n\t\t\t\t\t\tdefaultHash,\n\t\t\t\t\t\tdefaultSignature,\n\t\t\t\t\t\tdefaultPublicKey,\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tit('should return false for an invalid signature', () => {\n\t\t\t\t\tcryptoVerifyDataStub.returns(false);\n\t\t\t\t\tconst verification = verifyTransaction(transaction);\n\t\t\t\t\treturn expect(verification).to.be.false;\n\t\t\t\t});\n\n\t\t\t\tit('should return true for a valid signature', () => {\n\t\t\t\t\tconst verification = verifyTransaction(transaction);\n\t\t\t\t\treturn expect(verification).to.be.true;\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('with a second signed transaction', () => {\n\t\t\t\tbeforeEach(() => {\n\t\t\t\t\ttransaction = {\n\t\t\t\t\t\t...defaultTransaction,\n\t\t\t\t\t\tsignature: defaultSignature,\n\t\t\t\t\t\tsignSignature: defaultSecondSignature,\n\t\t\t\t\t} as BaseTransaction;\n\t\t\t\t\treturn getTransactionHashStub\n\t\t\t\t\t\t.onFirstCall()\n\t\t\t\t\t\t.returns(\n\t\t\t\t\t\t\tBuffer.from(\n\t\t\t\t\t\t\t\t'951bb4580dcb6a412de28844e0e06439c5c51dfea2a16730fd94ff20e355f1bd',\n\t\t\t\t\t\t\t\t'hex',\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tit('should throw if attempting to verify without a secondPublicKey', () => {\n\t\t\t\t\tconst { signature, ...invalidTransaction } = transaction;\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tverifyTransaction.bind(null, invalidTransaction),\n\t\t\t\t\t).to.throw('Cannot verify transaction without signature.');\n\t\t\t\t});\n\n\t\t\t\tit('should throw if attempting to verify without a secondPublicKey', () => {\n\t\t\t\t\treturn expect(verifyTransaction.bind(null, transaction)).to.throw(\n\t\t\t\t\t\t'Cannot verify signSignature without secondPublicKey.',\n\t\t\t\t\t);\n\t\t\t\t});\n\n\t\t\t\tit('should remove the second signature before getting the first transaction hash', () => {\n\t\t\t\t\tverifyTransaction(transaction, defaultSecondPublicKey);\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tgetTransactionHashStub.firstCall.args[0],\n\t\t\t\t\t).not.to.have.property('signSignature');\n\t\t\t\t});\n\n\t\t\t\tit('should remove the first signature before getting the second transaction hash', () => {\n\t\t\t\t\tverifyTransaction(transaction, defaultSecondPublicKey);\n\t\t\t\t\treturn expect(\n\t\t\t\t\t\tgetTransactionHashStub.secondCall.args[0],\n\t\t\t\t\t).not.to.have.property('signature');\n\t\t\t\t});\n\n\t\t\t\tit('should return false for an invalid second signature', () => {\n\t\t\t\t\tcryptoVerifyDataStub.returns(false);\n\t\t\t\t\tconst verification = verifyTransaction(\n\t\t\t\t\t\ttransaction,\n\t\t\t\t\t\tdefaultSecondPublicKey,\n\t\t\t\t\t);\n\t\t\t\t\treturn expect(verification).to.be.false;\n\t\t\t\t});\n\n\t\t\t\tit('should return false for an invalid first signature', () => {\n\t\t\t\t\tcryptoVerifyDataStub.onSecondCall().returns(false);\n\t\t\t\t\tgetTransactionHashStub\n\t\t\t\t\t\t.onFirstCall()\n\t\t\t\t\t\t.returns(\n\t\t\t\t\t\t\tBuffer.from(\n\t\t\t\t\t\t\t\t'aef147521619556572f204585332aac247dc2b024cb975518d847e4587bab756',\n\t\t\t\t\t\t\t\t'hex',\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\tconst verification = verifyTransaction(\n\t\t\t\t\t\ttransaction,\n\t\t\t\t\t\tdefaultSecondPublicKey,\n\t\t\t\t\t);\n\t\t\t\t\treturn expect(verification).to.be.false;\n\t\t\t\t});\n\n\t\t\t\tit('should return true for a valid signature', () => {\n\t\t\t\t\tconst verification = verifyTransaction(\n\t\t\t\t\t\ttransaction,\n\t\t\t\t\t\tdefaultSecondPublicKey,\n\t\t\t\t\t);\n\t\t\t\t\treturn expect(verification).to.be.true;\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('integration sign and verify', () => {\n\t\tdescribe('given a set of transactions', () => {\n\t\t\tdescribe('#signTransaction', () => {\n\t\t\t\tdescribe('given a passphrase and a second passphrase', () => {\n\t\t\t\t\tconst passphrase =\n\t\t\t\t\t\t'wagon stock borrow episode laundry kitten salute link globe zero feed marble';\n\t\t\t\t\tconst secondPassphrase =\n\t\t\t\t\t\t'trouble float modify long valve group ozone possible remove dirt bicycle riot';\n\n\t\t\t\t\tdescribe('when tested on the first signature', () => {\n\t\t\t\t\t\tit('should create the correct signature', () => {\n\t\t\t\t\t\t\treturn validTransactions.forEach(transaction => {\n\t\t\t\t\t\t\t\tconst { signature, signSignature, ...rawTx } = transaction;\n\t\t\t\t\t\t\t\treturn expect(signTransaction(rawTx, passphrase)).to.be.equal(\n\t\t\t\t\t\t\t\t\tsignature,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\n\t\t\t\t\tdescribe('when tested on the second signature', () => {\n\t\t\t\t\t\tit('should create the correct signature', () => {\n\t\t\t\t\t\t\treturn validTransactions.forEach(transaction => {\n\t\t\t\t\t\t\t\tconst { signSignature } = transaction;\n\t\t\t\t\t\t\t\tif (signSignature) {\n\t\t\t\t\t\t\t\t\tconst { signSignature, ...rawTx } = transaction;\n\t\t\t\t\t\t\t\t\treturn expect(\n\t\t\t\t\t\t\t\t\t\tsignTransaction(rawTx, secondPassphrase),\n\t\t\t\t\t\t\t\t\t).to.be.equal(signSignature);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('#verifyTransaction', () => {\n\t\t\t\tdescribe('when executed', () => {\n\t\t\t\t\tconst secondPublicKey =\n\t\t\t\t\t\t'f9666bfed9ef2ff52a04408f22f2bfffaa81384c9433463697330224f10032a4';\n\t\t\t\t\tit('should verify all the transactions', () => {\n\t\t\t\t\t\treturn validTransactions.forEach(transaction => {\n\t\t\t\t\t\t\treturn expect(verifyTransaction(transaction, secondPublicKey)).to\n\t\t\t\t\t\t\t\t.be.true;\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/utils/sign_raw_transaction.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { signRawTransaction } from '../../src/utils/sign_raw_transaction';\nimport {\n\tBaseTransaction,\n\tPartialTransaction,\n} from '../../src/transaction_types';\nimport * as time from '../../src/utils/time';\n\ndescribe('#signRawTransaction', () => {\n\tconst timeWithOffset = 38350076;\n\tconst amount = '100';\n\tconst recipientId = '123456789L';\n\tconst timestamp = 12345;\n\tconst fee = '10000000';\n\tconst type = 0;\n\tconst asset = {};\n\tlet getTimeWithOffsetStub: sinon.SinonStub;\n\n\tbeforeEach(() => {\n\t\tgetTimeWithOffsetStub = sandbox\n\t\t\t.stub(time, 'getTimeWithOffset')\n\t\t\t.returns(timeWithOffset);\n\t\treturn Promise.resolve();\n\t});\n\n\tdescribe('given a raw transaction', () => {\n\t\tlet transaction: PartialTransaction;\n\n\t\tbeforeEach(() => {\n\t\t\ttransaction = {\n\t\t\t\tamount,\n\t\t\t\trecipientId,\n\t\t\t\ttimestamp,\n\t\t\t\ttype,\n\t\t\t\tfee,\n\t\t\t\trecipientPublicKey: null,\n\t\t\t\tasset,\n\t\t\t};\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tdescribe('given a passphrase', () => {\n\t\t\tconst passphrase =\n\t\t\t\t'wagon stock borrow episode laundry kitten salute link globe zero feed marble';\n\t\t\tconst senderPublicKey =\n\t\t\t\t'c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f';\n\t\t\tconst senderId = '16313739661670634666L';\n\t\t\tconst signature =\n\t\t\t\t'd09288d22a1ac860f625db950340cd26e435d0d98a00ffb92d55c16b76d83ed4fd1acf974c28c9dede8fb15a49ccaddb6325f4e750d968e515e1f0d90e0fb30d';\n\t\t\tconst transactionId = '9248517814265997446';\n\t\t\tdescribe('when executed', () => {\n\t\t\t\tlet signedTransaction: BaseTransaction;\n\t\t\t\tlet signingProperties;\n\n\t\t\t\tbeforeEach(() => {\n\t\t\t\t\tsigningProperties = {\n\t\t\t\t\t\tpassphrase,\n\t\t\t\t\t\ttransaction,\n\t\t\t\t\t};\n\t\t\t\t\tsignedTransaction = signRawTransaction(signingProperties);\n\t\t\t\t\treturn Promise.resolve();\n\t\t\t\t});\n\n\t\t\t\tit('should have the type', () => {\n\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t\t.equal(type);\n\t\t\t\t});\n\n\t\t\t\tit('should have the amount', () => {\n\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t.to.have.property('amount')\n\t\t\t\t\t\t.equal(amount);\n\t\t\t\t});\n\n\t\t\t\tit('should have the asset', () => {\n\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t.to.have.property('asset')\n\t\t\t\t\t\t.eql(asset);\n\t\t\t\t});\n\n\t\t\t\tit('should have the senderPublicKey', () => {\n\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t\t.equal(senderPublicKey);\n\t\t\t\t});\n\n\t\t\t\tit('should have the senderId', () => {\n\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t.to.have.property('senderId')\n\t\t\t\t\t\t.equal(senderId);\n\t\t\t\t});\n\n\t\t\t\tit('should have the recipientId', () => {\n\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t\t.equal(recipientId);\n\t\t\t\t});\n\n\t\t\t\tit('should have the fee', () => {\n\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t\t.equal(fee);\n\t\t\t\t});\n\n\t\t\t\tit('should have the updated timestamp', () => {\n\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t.to.have.property('timestamp')\n\t\t\t\t\t\t.be.equal(timeWithOffset);\n\t\t\t\t});\n\n\t\t\t\tit('should have the senderSecondPublicKey', () => {\n\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t.to.have.property('senderSecondPublicKey')\n\t\t\t\t\t\t.equal(undefined);\n\t\t\t\t});\n\n\t\t\t\tit('should have the signature', () => {\n\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t.to.have.property('signature')\n\t\t\t\t\t\t.be.equal(signature);\n\t\t\t\t});\n\n\t\t\t\tit('should have the id', () => {\n\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t.to.have.property('id')\n\t\t\t\t\t\t.be.equal(transactionId);\n\t\t\t\t});\n\n\t\t\t\tit('should use time.getTimeWithOffset to calculate the timestamp', () => {\n\t\t\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tdescribe('given a second passphrase', () => {\n\t\t\t\tconst secondPassphrase =\n\t\t\t\t\t'guitar couch salmon subject review urban heavy autumn crush tribe home plunge';\n\t\t\t\tconst senderSecondPublicKey =\n\t\t\t\t\t'c465d74511c2bfd136cf9764172acd3c1514fa7ad76475e03bc91cf679757a5c';\n\t\t\t\tconst signSignature =\n\t\t\t\t\t'31ef8fcf4e1815def245ad32d0d0e3e86993a4029c41e8ca1dc2674c9794d31cefc2226ac539dea8049c7085fdcb29768389b96104ac05a0ddabfb8b523af409';\n\t\t\t\tconst secondSignedTransactionId = '5702597341252953087';\n\t\t\t\tdescribe('when executed', () => {\n\t\t\t\t\tlet signedTransaction: BaseTransaction;\n\t\t\t\t\tlet signingProperties;\n\n\t\t\t\t\tbeforeEach(() => {\n\t\t\t\t\t\tsigningProperties = {\n\t\t\t\t\t\t\tpassphrase,\n\t\t\t\t\t\t\ttransaction,\n\t\t\t\t\t\t\tsecondPassphrase,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tsignedTransaction = signRawTransaction(signingProperties);\n\t\t\t\t\t\treturn Promise.resolve();\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should have the type', () => {\n\t\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t\t.to.have.property('type')\n\t\t\t\t\t\t\t.equal(type);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should have the amount', () => {\n\t\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t\t.to.have.property('amount')\n\t\t\t\t\t\t\t.equal(amount);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should have the asset', () => {\n\t\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t\t.to.have.property('asset')\n\t\t\t\t\t\t\t.eql(asset);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should have the senderPublicKey', () => {\n\t\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t\t\t.equal(senderPublicKey);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should have the senderId', () => {\n\t\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t\t.to.have.property('senderId')\n\t\t\t\t\t\t\t.equal(senderId);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should have the recipientId', () => {\n\t\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t\t.to.have.property('recipientId')\n\t\t\t\t\t\t\t.equal(recipientId);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should have the fee', () => {\n\t\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t\t.to.have.property('fee')\n\t\t\t\t\t\t\t.equal(fee);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should have the updated timestamp', () => {\n\t\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t\t.to.have.property('timestamp')\n\t\t\t\t\t\t\t.be.equal(timeWithOffset);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should have the senderSecondPublicKey', () => {\n\t\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t\t.to.have.property('senderSecondPublicKey')\n\t\t\t\t\t\t\t.equal(senderSecondPublicKey);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should have the signature', () => {\n\t\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t\t.to.have.property('signature')\n\t\t\t\t\t\t\t.be.eql(signature);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should have the second signature', () => {\n\t\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t\t.to.have.property('signSignature')\n\t\t\t\t\t\t\t.be.equal(signSignature);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should have the id', () => {\n\t\t\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t\t\t.to.have.property('id')\n\t\t\t\t\t\t\t.be.equal(secondSignedTransactionId);\n\t\t\t\t\t});\n\n\t\t\t\t\tit('should use time.getTimeWithOffset to calculate the timestamp', () => {\n\t\t\t\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t\t});\n\n\t\t\t\tdescribe('given an offset', () => {\n\t\t\t\t\tconst timeOffset = 1000;\n\t\t\t\t\tlet signingProperties;\n\n\t\t\t\t\tdescribe('when executed', () => {\n\t\t\t\t\t\tbeforeEach(() => {\n\t\t\t\t\t\t\tsigningProperties = {\n\t\t\t\t\t\t\t\tpassphrase,\n\t\t\t\t\t\t\t\ttransaction,\n\t\t\t\t\t\t\t\tsecondPassphrase,\n\t\t\t\t\t\t\t\ttimeOffset,\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\treturn signRawTransaction(signingProperties);\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tit('should calculate the time with the time offset', () => {\n\t\t\t\t\t\t\treturn expect(getTimeWithOffsetStub).to.be.calledWithExactly(\n\t\t\t\t\t\t\t\ttimeOffset,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('given a signed transaction', () => {\n\t\tconst senderPublicKey =\n\t\t\t'c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f';\n\t\tconst senderId = '16313739661670634666L';\n\t\tconst signature =\n\t\t\t'd09288d22a1ac860f625db950340cd26e435d0d98a00ffb92d55c16b76d83ed4fd1acf974c28c9dede8fb15a49ccaddb6325f4e750d968e515e1f0d90e0fb30d';\n\t\tconst transactionId = '9248517814265997446';\n\t\tconst updatedSignerPassphrase =\n\t\t\t'wagon stock borrow episode laundry kitten salute link globe zero feed';\n\t\tconst updatedSignerPublicKey =\n\t\t\t'798974780475d8d7d6c6c9bb3dabf10efb16b7b380469223ee3ecc711c8e1396';\n\t\tconst updatedSignerAddress = '5752844829611395697L';\n\t\tconst updatedSignerSignature =\n\t\t\t'647ca03394d0fefeeaa018e6943feb61c0ec64f3110ab96fe87564f1c915a40f25ac19324802684de87cdc5a0947f774d8b0ae78f9144635996d0450bcd5760c';\n\t\tconst updatedSignerId = '9495608349801955934';\n\t\tlet transaction: PartialTransaction;\n\n\t\tbeforeEach(() => {\n\t\t\ttransaction = {\n\t\t\t\tamount,\n\t\t\t\trecipientId,\n\t\t\t\tsenderPublicKey,\n\t\t\t\ttimestamp,\n\t\t\t\ttype,\n\t\t\t\tfee,\n\t\t\t\tsenderId,\n\t\t\t\tsignature,\n\t\t\t\tid: transactionId,\n\t\t\t\trecipientPublicKey: null,\n\t\t\t\tasset,\n\t\t\t};\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tdescribe('when executed', () => {\n\t\t\tlet signedTransaction: BaseTransaction;\n\t\t\tlet signingProperties;\n\n\t\t\tbeforeEach(() => {\n\t\t\t\tsigningProperties = {\n\t\t\t\t\tpassphrase: updatedSignerPassphrase,\n\t\t\t\t\ttransaction,\n\t\t\t\t};\n\t\t\t\tsignedTransaction = signRawTransaction(signingProperties);\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\n\t\t\tit('should sign the transaction', () => {\n\t\t\t\treturn expect(signedTransaction).to.be.ok;\n\t\t\t});\n\n\t\t\tit('should have the updated senderPublicKey', () => {\n\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t.to.have.property('senderPublicKey')\n\t\t\t\t\t.equal(updatedSignerPublicKey);\n\t\t\t});\n\n\t\t\tit('should have the updated senderId', () => {\n\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t.to.have.property('senderId')\n\t\t\t\t\t.equal(updatedSignerAddress);\n\t\t\t});\n\n\t\t\tit('should have the updated transactionId', () => {\n\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t.to.have.property('id')\n\t\t\t\t\t.equal(updatedSignerId);\n\t\t\t});\n\n\t\t\tit('should have the updated signature', () => {\n\t\t\t\treturn expect(signedTransaction)\n\t\t\t\t\t.to.have.property('signature')\n\t\t\t\t\t.equal(updatedSignerSignature);\n\t\t\t});\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/utils/time.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport {\n\tgetTimeFromBlockchainEpoch,\n\tgetTimeWithOffset,\n} from '../../src/utils/time';\n\ndescribe('time module', () => {\n\tconst nowRealTime = new Date(1464109220000);\n\tconst nowEpochTime = 20;\n\n\tbeforeEach(() => {\n\t\treturn sandbox.useFakeTimers(nowRealTime.getTime());\n\t});\n\n\tafterEach(() => {\n\t\treturn sandbox.clock.restore();\n\t});\n\n\tdescribe('#getTimeFromBlockchainEpoch', () => {\n\t\tit('should return current time as number', () => {\n\t\t\tconst time = getTimeFromBlockchainEpoch();\n\n\t\t\treturn expect(time).to.be.equal(nowEpochTime);\n\t\t});\n\n\t\tit('should return epoch time for provided time as number, equal to 10', () => {\n\t\t\tconst realTime = 1464109210001;\n\t\t\tconst time = getTimeFromBlockchainEpoch(realTime);\n\n\t\t\treturn expect(time).to.be.equal(10);\n\t\t});\n\t});\n\n\tdescribe('#getTimeWithOffset', () => {\n\t\tit('should get time with undefined offset', () => {\n\t\t\tconst time = getTimeWithOffset();\n\n\t\t\treturn expect(time).to.be.equal(nowEpochTime);\n\t\t});\n\n\t\tit('should get time with positive offset', () => {\n\t\t\tconst offset = 3;\n\t\t\tconst time = getTimeWithOffset(offset);\n\n\t\t\treturn expect(time).to.be.equal(23);\n\t\t});\n\n\t\tit('should get time with negative offset', () => {\n\t\t\tconst offset = -3;\n\t\t\tconst time = getTimeWithOffset(offset);\n\n\t\t\treturn expect(time).to.be.equal(17);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/utils/validation/validate_transaction.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport fixtures from '../../../fixtures/transactions.json';\nimport invalidFixtures from '../../../fixtures/invalid_transactions.json';\nimport { validateTransaction } from '../../../src/utils/validation/validate_transaction';\nimport { PartialTransaction } from '../../../src/transaction_types';\nimport { ErrorObject } from 'ajv';\n\ndescribe('validateTransaction', () => {\n\tdescribe('#validateTransaction', () => {\n\t\tdescribe('when fixtures provided', () => {\n\t\t\tit('should be all valid for the fixtures', () => {\n\t\t\t\treturn fixtures.forEach((tx: unknown) => {\n\t\t\t\t\tconst { valid, errors } = validateTransaction(\n\t\t\t\t\t\ttx as PartialTransaction,\n\t\t\t\t\t);\n\t\t\t\t\texpect(valid).to.be.true;\n\t\t\t\t\texpect(errors).to.be.undefined;\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tdescribe('when transaction does not contain type', () => {\n\t\t\tconst invalidTransaction = {\n\t\t\t\tamount: '0',\n\t\t\t\tfee: '10000000',\n\t\t\t\trecipientId: 'recipientID',\n\t\t\t\tsenderPublicKey:\n\t\t\t\t\t'c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f',\n\t\t\t\ttimestamp: 54196078,\n\t\t\t\tasset: {},\n\t\t\t\tsignature:\n\t\t\t\t\t'4c8a3bfaacfab18a7ef34ce8d7176ea2701dfd7221a1c95ecbc1cce778bbccdb7cbbe1a87b3e9e47330f1cae6665c4a44666e132aa324de9a5ab9b6a1e2b1d0c',\n\t\t\t\tid: '18066659039293493823',\n\t\t\t};\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tvalidateTransaction.bind(null, invalidTransaction),\n\t\t\t\t).to.throw(Error, 'Transaction type is required.');\n\t\t\t});\n\t\t});\n\n\t\tdescribe('when invalid fixtures provided', () => {\n\t\t\tit('should be all invalid for the invalid fixtures (except type 6 and 7)', () => {\n\t\t\t\treturn invalidFixtures\n\t\t\t\t\t.filter((tx: PartialTransaction) => tx.type !== 6 && tx.type !== 7)\n\t\t\t\t\t.forEach((tx: PartialTransaction) => {\n\t\t\t\t\t\tconst { valid, errors } = validateTransaction(tx);\n\t\t\t\t\t\texpect(valid).to.be.false;\n\t\t\t\t\t\texpect(errors).not.to.be.undefined;\n\t\t\t\t\t});\n\t\t\t});\n\n\t\t\tit('should throw an unsupported transaction type error for type 6 and 7', () => {\n\t\t\t\treturn invalidFixtures\n\t\t\t\t\t.filter((tx: PartialTransaction) => tx.type === 6 || tx.type === 7)\n\t\t\t\t\t.forEach((tx: PartialTransaction) => {\n\t\t\t\t\t\texpect(validateTransaction.bind(null, tx)).to.throw(\n\t\t\t\t\t\t\tError,\n\t\t\t\t\t\t\t'Unsupported transaction type.',\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tdescribe('when the transaction contains invalid data in merged schema', () => {\n\t\t\tconst invalidTransaction = {\n\t\t\t\ttype: 0,\n\t\t\t\tamount: '0',\n\t\t\t\tfee: '10000000',\n\t\t\t\trecipientId: 'recipientID',\n\t\t\t\tsenderPublicKey:\n\t\t\t\t\t'c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f',\n\t\t\t\ttimestamp: 54196078,\n\t\t\t\tasset: {},\n\t\t\t\tsignature:\n\t\t\t\t\t'4c8a3bfaacfab18a7ef34ce8d7176ea2701dfd7221a1c95ecbc1cce778bbccdb7cbbe1a87b3e9e47330f1cae6665c4a44666e132aa324de9a5ab9b6a1e2b1d0c',\n\t\t\t\tid: '18066659039293493823',\n\t\t\t};\n\n\t\t\tit('should not include $merge error when the merged schema has error', () => {\n\t\t\t\tconst { valid, errors } = validateTransaction(invalidTransaction);\n\t\t\t\texpect(valid).to.be.false;\n\t\t\t\texpect(errors).not.to.be.undefined;\n\t\t\t\tconst errorsArray = errors as ReadonlyArray<ErrorObject>;\n\t\t\t\texpect(errorsArray[0].dataPath).to.equal('.amount');\n\t\t\t\texpect(errorsArray[1].dataPath).to.equal('.recipientId');\n\t\t\t\treturn expect(errors).to.have.length(2);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('#getTransactionSchemaValidator', () => {\n\t\tconst type6Tx = {\n\t\t\ttype: 6,\n\t\t\tamount: '166413',\n\t\t\tfee: '10000000',\n\t\t\trecipientId: '',\n\t\t\tsenderPublicKey:\n\t\t\t\t'c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f',\n\t\t\ttimestamp: 54196078,\n\t\t\tasset: { inTransfer: { dappId: '1000000' } },\n\t\t\tsignature:\n\t\t\t\t'f2b1a66d9bd8ae0c1b3404fe397a11bd696e5aea274e6a8d9fea2f976503d006b8ca65484daf2498f854a0c0109b924b653a8d6ba31a568cb70727b7d3472902',\n\t\t\tid: '9501694969515165251',\n\t\t};\n\n\t\tconst type7Tx = {\n\t\t\ttype: 7,\n\t\t\tamount: '835151',\n\t\t\tfee: '10000000',\n\t\t\trecipientId: '1859190791819301L',\n\t\t\tsenderPublicKey:\n\t\t\t\t'c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f',\n\t\t\ttimestamp: 54196079,\n\t\t\tasset: {\n\t\t\t\toutTransfer: { dappId: '614143983', transactionId: '749591467' },\n\t\t\t},\n\t\t\tsignature:\n\t\t\t\t'646cd6be9f385bfa4f914b66a675a77080a3c1093278cfbca16d3d7fbf768350c9a7e270a8e5a72347e2792d3cfc770f3a3bb9ea542c300cba3976f34bd040e',\n\t\t};\n\n\t\tit('should throw an error when type 6 transaction is provided', () => {\n\t\t\treturn expect(validateTransaction.bind(null, type6Tx)).to.throw(\n\t\t\t\tError,\n\t\t\t\t'Unsupported transaction type.',\n\t\t\t);\n\t\t});\n\n\t\tit('should throw an error when type 7 transaction is provided', () => {\n\t\t\treturn expect(validateTransaction.bind(null, type7Tx)).to.throw(\n\t\t\t\tError,\n\t\t\t\t'Unsupported transaction type.',\n\t\t\t);\n\t\t});\n\t});\n\n\tdescribe('#validateMultiTransaction', () => {\n\t\tconst invalidMultiTransaction = {\n\t\t\ttype: 4,\n\t\t\tamount: '0',\n\t\t\tfee: '3000000000',\n\t\t\trecipientId: '',\n\t\t\tsenderPublicKey:\n\t\t\t\t'c094ebee7ec0c50ebee32918655e089f6e1a604b83bcaa760293c61e0f18ab6f',\n\t\t\ttimestamp: 54196078,\n\t\t\tasset: {\n\t\t\t\tmultisignature: {\n\t\t\t\t\tmin: 6,\n\t\t\t\t\tlifetime: 1,\n\t\t\t\t\tkeysgroup: [\n\t\t\t\t\t\t'+e64df51060a2ce43f91b24ae75cc83f1866f9fead2ca2420cf3df153e6368a97',\n\t\t\t\t\t\t'+4ef26ed51f4b82134b16f25a2556bed98a0b3963a17c0d2f0fa87f67cc6f29fe',\n\t\t\t\t\t\t'+818d34925549e0aea67f1b82190c3e288b1c66de95ce699c2f5c87f1e622012c',\n\t\t\t\t\t\t'+a2eece2bf0ee74e492939ac84723646270bfefab84914a5cf68baffd9bb84858',\n\t\t\t\t\t\t'+46f3ec44dbcffe28c6bcd4eb494ce24ceea51677eb67005bdd4dd3202db55251',\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t},\n\t\t\tsignature:\n\t\t\t\t'4c8a3bfaacfab18a7ef34ce8d7176ea2701dfd7221a1c95ecbc1cce778bbccdb7cbbe1a87b3e9e47330f1cae6665c4a44666e132aa324de9a5ab9b6a1e2b1d0c',\n\t\t\tid: '18066659039293493823',\n\t\t};\n\n\t\tit('should be invalid when min is greater than the keysgroup', () => {\n\t\t\tconst { valid, errors } = validateTransaction(invalidMultiTransaction);\n\t\t\texpect(valid).to.be.false;\n\t\t\texpect(errors).not.to.be.undefined;\n\t\t\tconst errorsArray = errors as ReadonlyArray<ErrorObject>;\n\t\t\texpect(errorsArray[0].dataPath).to.equal('.asset.multisignature.min');\n\t\t\treturn expect(errorsArray[0].message).to.equal(\n\t\t\t\t'.asset.multisignature.min cannot be greater than .asset.multisignature.keysgroup.length',\n\t\t\t);\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/utils/validation/validation.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport * as cryptography from '@liskhq/lisk-cryptography';\nimport { expect } from 'chai';\nimport BigNum from 'browserify-bignum';\nimport {\n\tcheckPublicKeysForDuplicates,\n\tvalidatePublicKey,\n\tvalidatePublicKeys,\n\tvalidateKeysgroup,\n\tvalidateAddress,\n\tvalidateAmount,\n\tvalidateTransferAmount,\n\tvalidateFee,\n\tisGreaterThanMaxTransactionAmount,\n\tisGreaterThanZero,\n\tisGreaterThanMaxTransactionId,\n\tisNumberString,\n\tisValidInteger,\n} from '../../../src/utils/validation/validation';\n\ndescribe('validation', () => {\n\tdescribe('#validatePublicKey', () => {\n\t\tdescribe('Given a hex string with odd length', () => {\n\t\t\tconst invalidHexPublicKey =\n\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bc';\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tvalidatePublicKey.bind(null, invalidHexPublicKey),\n\t\t\t\t).to.throw('Argument must have a valid length of hex string.');\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given a hex string with additional non-hex characters', () => {\n\t\t\tconst invalidHexPublicKey =\n\t\t\t\t'12345678123456781234567812345678123456781234567812345678123456gg';\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tvalidatePublicKey.bind(null, invalidHexPublicKey),\n\t\t\t\t).to.throw('Argument must be a valid hex string.');\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given a too long public key', () => {\n\t\t\tconst tooLongPublicKey =\n\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca12';\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(validatePublicKey.bind(null, tooLongPublicKey)).to.throw(\n\t\t\t\t\t'Public key 215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca12 length differs from the expected 32 bytes for a public key.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given a too short public key', () => {\n\t\t\tconst tooShortPublicKey =\n\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452b';\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(validatePublicKey.bind(null, tooShortPublicKey)).to.throw(\n\t\t\t\t\t'Public key 215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452b length differs from the expected 32 bytes for a public key.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given a valid public key', () => {\n\t\t\tconst publicKey =\n\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca';\n\t\t\tit('should return true', () => {\n\t\t\t\treturn expect(validatePublicKey(publicKey)).to.be.true;\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given a valid public key with only numeric characters', () => {\n\t\t\tconst publicKey =\n\t\t\t\t'1234567812345678123456781234567812345678123456781234567812345678';\n\t\t\tit('should return true', () => {\n\t\t\t\treturn expect(validatePublicKey(publicKey)).to.be.true;\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('#validatePublicKeys', () => {\n\t\tdescribe('Given an array of public keys with one invalid public key', () => {\n\t\t\tconst publicKeys = [\n\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca',\n\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca',\n\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca',\n\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bc',\n\t\t\t];\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(validatePublicKeys.bind(null, publicKeys)).to.throw(\n\t\t\t\t\t'Argument must have a valid length of hex string.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given an array of valid public keys', () => {\n\t\t\tconst publicKeys = [\n\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca',\n\t\t\t\t'922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa',\n\t\t\t\t'1234567812345678123456781234567812345678123456781234567812345678',\n\t\t\t];\n\t\t\tit('should return true', () => {\n\t\t\t\treturn expect(validatePublicKeys(publicKeys)).to.be.true;\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('#validateKeysgroup', () => {\n\t\tlet keysgroup: ReadonlyArray<string>;\n\t\tdescribe('Given a keysgroup with three public keys', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tkeysgroup = [\n\t\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca',\n\t\t\t\t\t'922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa',\n\t\t\t\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\t\t\t];\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\t\t\tit('the validated keysgroup should return true', () => {\n\t\t\t\treturn expect(validateKeysgroup(keysgroup)).to.be.true;\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given an empty keysgroup', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tkeysgroup = [];\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\t\t\tit('should throw the error', () => {\n\t\t\t\treturn expect(validateKeysgroup.bind(null, keysgroup)).to.throw(\n\t\t\t\t\t'Expected between 1 and 15 public keys in the keysgroup.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given a keysgroup with 17 public keys', () => {\n\t\t\tbeforeEach(() => {\n\t\t\t\tkeysgroup = new Array(17)\n\t\t\t\t\t.fill(0)\n\t\t\t\t\t.map(\n\t\t\t\t\t\t(_: number, index: number) =>\n\t\t\t\t\t\t\tcryptography.getPrivateAndPublicKeyFromPassphrase(\n\t\t\t\t\t\t\t\tindex.toString(),\n\t\t\t\t\t\t\t).publicKey,\n\t\t\t\t\t);\n\t\t\t\treturn Promise.resolve();\n\t\t\t});\n\t\t\tit('should throw the error', () => {\n\t\t\t\treturn expect(validateKeysgroup.bind(null, keysgroup)).to.throw(\n\t\t\t\t\t'Expected between 1 and 15 public keys in the keysgroup.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('#checkPublicKeysForDuplicates', () => {\n\t\tdescribe('Given an array of public keys without duplication', () => {\n\t\t\tconst publicKeys = [\n\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca',\n\t\t\t\t'922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa',\n\t\t\t\t'5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09',\n\t\t\t];\n\t\t\tit('should return true', () => {\n\t\t\t\treturn expect(checkPublicKeysForDuplicates(publicKeys)).to.be.true;\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given an array of public keys with duplication', () => {\n\t\t\tconst publicKeys = [\n\t\t\t\t'215b667a32a5cd51a94c9c2046c11fffb08c65748febec099451e3b164452bca',\n\t\t\t\t'922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa',\n\t\t\t\t'922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa',\n\t\t\t];\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(\n\t\t\t\t\tcheckPublicKeysForDuplicates.bind(null, publicKeys),\n\t\t\t\t).to.throw(\n\t\t\t\t\t'Duplicated public key: 922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('#validateAddress', () => {\n\t\tdescribe('Given valid addresses', () => {\n\t\t\tconst addresses = [\n\t\t\t\t'13133549779353512613L',\n\t\t\t\t'18446744073709551615L',\n\t\t\t\t'1L',\n\t\t\t];\n\n\t\t\tit('should return true', () => {\n\t\t\t\treturn addresses.forEach(address => {\n\t\t\t\t\treturn expect(validateAddress(address)).to.be.true;\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given an address that is too short', () => {\n\t\t\tconst address = 'L';\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(validateAddress.bind(null, address)).to.throw(\n\t\t\t\t\t'Address length does not match requirements. Expected between 2 and 22 characters.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given an address that is too long', () => {\n\t\t\tconst address = '12345678901234567890123L';\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(validateAddress.bind(null, address)).to.throw(\n\t\t\t\t\t'Address length does not match requirements. Expected between 2 and 22 characters.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given an address without L at the end', () => {\n\t\t\tconst address = '1234567890';\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(validateAddress.bind(null, address)).to.throw(\n\t\t\t\t\t'Address format does not match requirements. Expected \"L\" at the end.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given an address that includes `.`', () => {\n\t\t\tconst address = '14.15133512790761431L';\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(validateAddress.bind(null, address)).to.throw(\n\t\t\t\t\t'Address format does not match requirements. Address includes invalid character: `.`.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given an address that is out of range', () => {\n\t\t\tconst address = '18446744073709551616L';\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(validateAddress.bind(null, address)).to.throw(\n\t\t\t\t\t'Address format does not match requirements. Address out of maximum range.',\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\n\t\tdescribe('Given an address that has leading zeros', () => {\n\t\t\tconst address = '00015133512790761431L';\n\t\t\tit('should throw an error', () => {\n\t\t\t\treturn expect(validateAddress.bind(null, address)).to.throw(\n\t\t\t\t\t\"Address string format does not match it's number representation.\",\n\t\t\t\t);\n\t\t\t});\n\t\t});\n\t});\n\n\tdescribe('#validateAmount', () => {\n\t\tit('should return true when amount is 0', () => {\n\t\t\treturn expect(validateAmount('0')).to.be.true;\n\t\t});\n\t});\n\n\tdescribe('#validateTransferAmount', () => {\n\t\tit('should return false is amount is 0', () => {\n\t\t\treturn expect(validateTransferAmount('0')).to.be.false;\n\t\t});\n\n\t\tit('should return true when amount is a number greater than 0 and less than maximum transaction amount', () => {\n\t\t\treturn expect(validateTransferAmount('100')).to.be.true;\n\t\t});\n\t});\n\n\tdescribe('#validateFee', () => {\n\t\tit('should return false is amount is 0', () => {\n\t\t\treturn expect(validateFee('0')).to.be.false;\n\t\t});\n\n\t\tit('should return true when amount is a number greater than 0 and less than maximum transaction amount', () => {\n\t\t\treturn expect(validateFee('100')).to.be.true;\n\t\t});\n\t});\n\n\tdescribe('#isGreaterThanZero', () => {\n\t\tit('should return false when amount is 0', () => {\n\t\t\treturn expect(isGreaterThanZero(new BigNum('0'))).to.be.false;\n\t\t});\n\n\t\tit('should return true when amount is greater than 0', () => {\n\t\t\treturn expect(\n\t\t\t\tisGreaterThanZero(new BigNum('9223372036854775808987234289782357')),\n\t\t\t).to.be.true;\n\t\t});\n\t});\n\n\tdescribe('#isGreaterThanMaxTransactionAmount', () => {\n\t\tit('should return false when amount is less than maximum transaction amount', () => {\n\t\t\treturn expect(\n\t\t\t\tisGreaterThanMaxTransactionAmount(new BigNum('9223372036854775807')),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should return true when amount is more than maximum transaction amount', () => {\n\t\t\treturn expect(\n\t\t\t\tisGreaterThanMaxTransactionAmount(new BigNum('9223372036854775808')),\n\t\t\t).to.be.true;\n\t\t});\n\t});\n\n\tdescribe('#isGreaterThanMaxTransactionId', () => {\n\t\tit('should return false when id is less than 8 bytes integer maximum', () => {\n\t\t\treturn expect(\n\t\t\t\tisGreaterThanMaxTransactionId(new BigNum('18446744073709551615')),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should return true when id is more than 8 bytes integer maximum', () => {\n\t\t\treturn expect(\n\t\t\t\tisGreaterThanMaxTransactionId(new BigNum('18446744073709551616')),\n\t\t\t).to.be.true;\n\t\t});\n\t});\n\n\tdescribe('#isNumberString', () => {\n\t\tit('should return false when number is not string', () => {\n\t\t\tconst invalidFunction = isNumberString as (input: any) => boolean;\n\t\t\treturn expect(invalidFunction(1)).to.be.false;\n\t\t});\n\n\t\tit('should return false when string contains non number', () => {\n\t\t\treturn expect(isNumberString('12345abc68789')).to.be.false;\n\t\t});\n\n\t\tit('should return true when string contains only number', () => {\n\t\t\treturn expect(isNumberString('1234568789')).to.be.true;\n\t\t});\n\t});\n\n\tdescribe('#isValidInteger', () => {\n\t\tit('should return false when string was provided', () => {\n\t\t\treturn expect(isValidInteger('1234')).to.be.false;\n\t\t});\n\n\t\tit('should return false when float was provided', () => {\n\t\t\treturn expect(isValidInteger(123.4)).to.be.false;\n\t\t});\n\n\t\tit('should return true when integer was provided', () => {\n\t\t\treturn expect(isValidInteger(6)).to.be.true;\n\t\t});\n\n\t\tit('should return true when negative integer was provided', () => {\n\t\t\treturn expect(isValidInteger(-6)).to.be.true;\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/test/utils/validation/validator.ts",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nimport { expect } from 'chai';\nimport { validator } from '../../../src/utils/validation/validator';\nimport { ValidateFunction } from 'ajv';\n\ndescribe('validator', () => {\n\tconst baseSchemaId = 'test/schema';\n\n\tbefore(() => {\n\t\tconst baseSchema = {\n\t\t\t$id: baseSchemaId,\n\t\t\ttype: 'object',\n\t\t};\n\t\treturn validator.addSchema(baseSchema);\n\t});\n\n\tdescribe('signature', () => {\n\t\tlet validate: ValidateFunction;\n\t\tbeforeEach(() => {\n\t\t\tvalidate = validator.compile({\n\t\t\t\t$merge: {\n\t\t\t\t\tsource: { $ref: baseSchemaId },\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tformat: 'signature',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should validate to true when valid signature is provided', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'd5bdb0577f53fe5d79009c42facdf295a555e9542c851ec49feef1680f824a1ebae00733d935f078c3ef621bc20ee88d81390f9c97f75adb14731504861b7304',\n\t\t\t\t}),\n\t\t\t).to.be.true;\n\t\t});\n\n\t\tit('should validate to false when non-hex character is in the signature', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'zzzzzzzzzzzzzzzzzzzzzzzzzzzzf295a555e9542c851ec49feef1680f824a1ebae00733d935f078c3ef621bc20ee88d81390f9c97f75adb14731504861b7304',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when the signature is under 128 characters', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'd5bdb0577f53fe5d79009c42facdf295a555e9542c851ec49feef1680f824a1ebae00733d935f078c3ef621bc20ee88d81390f9c97f75adb14731504861b730',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when the signature is over 128 characters', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'd5bdb0577f53fe5d79009c42facdf295a555e9542c851ec49feef1680f824a1ebae00733d935f078c3ef621bc20ee88d81390f9c97f75adb14731504861b7304a',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\t});\n\n\tdescribe('id', () => {\n\t\tlet validate: ValidateFunction;\n\t\tbeforeEach(() => {\n\t\t\tvalidate = validator.compile({\n\t\t\t\t$merge: {\n\t\t\t\t\tsource: { $ref: baseSchemaId },\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tformat: 'id',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should validate to true when valid id is provided', () => {\n\t\t\treturn expect(validate({ target: '3543510233978718399' })).to.be.true;\n\t\t});\n\n\t\tit('should validate to true when valid id with leading zeros is provided', () => {\n\t\t\treturn expect(validate({ target: '00123' })).to.be.true;\n\t\t});\n\n\t\tit('should validate to false when number greater than maximum is provided', () => {\n\t\t\treturn expect(validate({ target: '18446744073709551616' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when number is provided', () => {\n\t\t\treturn expect(validate({ target: 3543510233978718399 })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when it is empty', () => {\n\t\t\treturn expect(validate({ target: '' })).to.be.false;\n\t\t});\n\t});\n\n\tdescribe('address', () => {\n\t\tlet validate: ValidateFunction;\n\t\tbeforeEach(() => {\n\t\t\tvalidate = validator.compile({\n\t\t\t\t$merge: {\n\t\t\t\t\tsource: { $ref: baseSchemaId },\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tformat: 'address',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should validate to true when valid address is provided', () => {\n\t\t\treturn expect(validate({ target: '14815133512790761431L' })).to.be.true;\n\t\t});\n\n\t\tit('should validate to false when address with leading zeros is provided', () => {\n\t\t\treturn expect(validate({ target: '00015133512790761431L' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when address including `.` is provided', () => {\n\t\t\treturn expect(validate({ target: '14.15133512790761431L' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when number greater than maximum is provided', () => {\n\t\t\treturn expect(validate({ target: '18446744073709551616L' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when the address does not end with \"L\"', () => {\n\t\t\treturn expect(validate({ target: '14815133512790761431X' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when the address only contains numbers', () => {\n\t\t\treturn expect(validate({ target: '18446744073709551616' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when the address is less than 2 characters', () => {\n\t\t\treturn expect(validate({ target: 'L' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when it is empty', () => {\n\t\t\treturn expect(validate({ target: '' })).to.be.false;\n\t\t});\n\t});\n\n\tdescribe('amount', () => {\n\t\tlet validate: ValidateFunction;\n\t\tbeforeEach(() => {\n\t\t\tvalidate = validator.compile({\n\t\t\t\t$merge: {\n\t\t\t\t\tsource: { $ref: baseSchemaId },\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tformat: 'amount',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should validate to true when valid amount is provided', () => {\n\t\t\treturn expect(validate({ target: '0' })).to.be.true;\n\t\t});\n\n\t\tit('should validate to false when invalid amount with leading zeros is provided', () => {\n\t\t\treturn expect(validate({ target: '000001' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when number greater than maximum is provided', () => {\n\t\t\treturn expect(validate({ target: '9223372036854775808' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when decimal number is provided', () => {\n\t\t\treturn expect(validate({ target: '190.105310' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when number is provided', () => {\n\t\t\treturn expect(validate({ target: 190105310 })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when it is empty', () => {\n\t\t\treturn expect(validate({ target: '' })).to.be.false;\n\t\t});\n\t});\n\n\tdescribe('transfer amount', () => {\n\t\tlet validate: ValidateFunction;\n\t\tbeforeEach(() => {\n\t\t\tvalidate = validator.compile({\n\t\t\t\t$merge: {\n\t\t\t\t\tsource: { $ref: baseSchemaId },\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tformat: 'transferAmount',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should validate to true when valid amount is provided', () => {\n\t\t\treturn expect(validate({ target: '100' })).to.be.true;\n\t\t});\n\n\t\tit('should validate to true when valid amount with leading zeros is provided', () => {\n\t\t\treturn expect(validate({ target: '000000100' })).to.be.true;\n\t\t});\n\n\t\tit('should validate to false when amount is 0', () => {\n\t\t\treturn expect(validate({ target: '0' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when number greater than maximum is provided', () => {\n\t\t\treturn expect(validate({ target: '9223372036854775808' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when decimal number is provided', () => {\n\t\t\treturn expect(validate({ target: '190.105310' })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when number is provided', () => {\n\t\t\treturn expect(validate({ target: 190105310 })).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when it is empty', () => {\n\t\t\treturn expect(validate({ target: '' })).to.be.false;\n\t\t});\n\t});\n\n\tdescribe('publicKey', () => {\n\t\tlet validate: ValidateFunction;\n\t\tbeforeEach(() => {\n\t\t\tvalidate = validator.compile({\n\t\t\t\t$merge: {\n\t\t\t\t\tsource: { $ref: baseSchemaId },\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tformat: 'publicKey',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should validate to true when valid publicKey is provided', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t}),\n\t\t\t).to.be.true;\n\t\t});\n\n\t\tit('should validate to false when non-hex character is in the publicKey', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'zzzzze75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when publicKey is shorter', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when publicKey is longer', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b1',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when signed publicKey is provided', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'+05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b1',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when it is empty', () => {\n\t\t\treturn expect(validate({ target: '' })).to.be.false;\n\t\t});\n\t});\n\n\tdescribe('signedPublicKey', () => {\n\t\tlet validate: ValidateFunction;\n\t\tbeforeEach(() => {\n\t\t\tvalidate = validator.compile({\n\t\t\t\t$merge: {\n\t\t\t\t\tsource: { $ref: baseSchemaId },\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tformat: 'signedPublicKey',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should validate to true when valid + and publicKey is provided', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'+05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t}),\n\t\t\t).to.be.true;\n\t\t});\n\n\t\tit('should validate to true when valid - and publicKey is provided', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'-05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t}),\n\t\t\t).to.be.true;\n\t\t});\n\n\t\tit('should validate to false when non-hex character is in the publicKey', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'+zzzzze75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when publicKey is shorter', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'-05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when publicKey is longer', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'+05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b1',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when non-signed publicKey is provided', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b1',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when it is empty', () => {\n\t\t\treturn expect(validate({ target: '' })).to.be.false;\n\t\t});\n\t});\n\n\tdescribe('additionPublicKey', () => {\n\t\tlet validate: ValidateFunction;\n\t\tbeforeEach(() => {\n\t\t\tvalidate = validator.compile({\n\t\t\t\t$merge: {\n\t\t\t\t\tsource: { $ref: baseSchemaId },\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tformat: 'additionPublicKey',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should validate to true when valid + and publicKey is provided', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'+05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t}),\n\t\t\t).to.be.true;\n\t\t});\n\n\t\tit('should validate to false when valid - and publicKey is provided', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'-05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when non-hex character is in the publicKey', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'+zzzzze75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when publicKey is shorter', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'+05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when publicKey is longer', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'+05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b1',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when non-signed publicKey is provided', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget:\n\t\t\t\t\t\t'05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b1',\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when it is empty', () => {\n\t\t\treturn expect(validate({ target: '' })).to.be.false;\n\t\t});\n\t});\n\n\tdescribe('uniqueSignedPublicKeys', () => {\n\t\tlet validate: ValidateFunction;\n\t\tbeforeEach(() => {\n\t\t\tvalidate = validator.compile({\n\t\t\t\t$merge: {\n\t\t\t\t\tsource: { $ref: baseSchemaId },\n\t\t\t\t\twith: {\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\ttarget: {\n\t\t\t\t\t\t\t\ttype: 'array',\n\t\t\t\t\t\t\t\tuniqueSignedPublicKeys: true,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn Promise.resolve();\n\t\t});\n\n\t\tit('should validate to true when unique signedPublicKey is provided', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget: [\n\t\t\t\t\t\t'-05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t\t\t'+278a9aecf13e324c42d73cae7e21e5efc1520afb1abcda084d086d24441ed2b4',\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t).to.be.true;\n\t\t});\n\n\t\tit('should validate to false when publicKeys are duplicated without the sign', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget: [\n\t\t\t\t\t\t'-05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t\t\t'+05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\n\t\tit('should validate to false when publicKeys are duplicated with the same sign', () => {\n\t\t\treturn expect(\n\t\t\t\tvalidate({\n\t\t\t\t\ttarget: [\n\t\t\t\t\t\t'+05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t\t\t'+05e1ce75b98d6051030e4e416483515cf8360be1a1bd6d2c14d925700dae021b',\n\t\t\t\t\t],\n\t\t\t\t}),\n\t\t\t).to.be.false;\n\t\t});\n\t});\n});\n"
  },
  {
    "path": "packages/lisk-transactions/types/ajv-merge-patch/index.d.ts",
    "content": "/* tslint:disable:only-arrow-functions */\ndeclare module 'ajv-merge-patch' {\n\texport default function addKeywords(ajv: object): void;\n}\n"
  },
  {
    "path": "packages/lisk-transactions/types/browserify-bignum/index.d.ts",
    "content": "/* tslint:disable:only-arrow-functions member-access readonly-keyword no-any */\n/// <reference types=\"node\" />\n\ndeclare module 'browserify-bignum' {\n\tclass BigNum {\n\t\t/**\n\t\t * Create a new BigNum from a Buffer.\n\t\t *\n\t\t * The default options are: {endian: 'big', size: 1}.\n\t\t */\n\t\tstatic fromBuffer(buffer: Buffer, options?: BigNum.BufferOptions): BigNum;\n\n\t\t/** Return true if num is identified as a BigNum instance. Otherwise, return false. */\n\t\tstatic isBigNum(num: any): boolean;\n\n\t\t/**\n\t\t * Generate a probable prime of length bits.\n\t\t *\n\t\t * If safe is true, it will be a \"safe\" prime of the form p=2p'+1 where p' is also prime.\n\t\t */\n\t\tstatic prime(bits: number, safe?: boolean): BigNum;\n\n\t\t/** Create a new BigNum from n. */\n\t\tconstructor(n: number | BigNum);\n\n\t\t/** Create a new BigNum from n and a base. */\n\t\tconstructor(n: string, base?: number);\n\n\t\t/** Return a new BigNum with the absolute value of the instance. */\n\t\tabs(): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value plus n. */\n\t\tadd(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return the number of bits used to represent the current BigNum. */\n\t\tbitLength(): number;\n\n\t\t/**\n\t\t * Compare the instance value to n.\n\t\t *\n\t\t * Return a positive integer if > n, a negative integer if < n, and 0 if == n.\n\t\t */\n\t\tcmp(n: BigNum.BigNumCompatible): number;\n\n\t\t/** Return a new BigNum containing the instance value integrally divided by n. */\n\t\tdiv(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return a boolean: whether the instance value is equal to n (== n). */\n\t\teq(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a boolean: whether the instance value is greater than or equal to n (>= n). */\n\t\tge(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a boolean: whether the instance value is greater than n (> n). */\n\t\tgt(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a boolean: whether the instance value is greater than n (>= n). */\n\t\tgte(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a boolean: whether the instance value is less than or equal to n (<= n). */\n\t\tle(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a boolean: whether the instance value is less than n (< n). */\n\t\tlt(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a boolean: whether the instance value is less than or equal to n (<= n). */\n\t\tlte(n: BigNum.BigNumCompatible): boolean;\n\n\t\t/** Return a new BigNum with the instance value modulo n. */\n\t\tmod(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value multiplied by n. */\n\t\tmul(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return a new BigNum with the negative of the instance value. */\n\t\tneg(): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value plus n. */\n\t\tplus(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return a new BigNum with the instance value raised to the nth power. */\n\t\tpow(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return a new BigNum with the instance value raised to the nth power modulo m. */\n\t\tpowm(n: BigNum.BigNumCompatible, m: BigNum.BigNumCompatible): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value minus n. */\n\t\tsub(n: BigNum.BigNumCompatible): BigNum;\n\n\t\t/**\n\t\t * Return a new Buffer with the data from the BigNum.\n\t\t *\n\t\t * The default options are: {endian: 'big', size: 1}.\n\t\t */\n\t\ttoBuffer(options?: BigNum.BufferOptions): Buffer;\n\n\t\t/**\n\t\t * Turn a BigNum into a Number.\n\t\t *\n\t\t * If the BigNum is too big you'll lose precision or you'll get ±Infinity.\n\t\t */\n\t\ttoNumber(): number;\n\n\t\t/** Print out the BigNum instance in the requested base as a string. Default: base 10 */\n\t\ttoString(base?: number): string;\n\n\t\t/** Print out the BigNum instance in the requested base as a string. Default: base 10 */\n\t\ttoString(base?: number): string;\n\t}\n\n\texport = BigNum;\n\n\tnamespace BigNum {\n\t\t/** Anything that can be converted to BigNum. */\n\t\ttype BigNumCompatible = BigNum | number | string;\n\n\t\texport interface BufferOptions {\n\t\t\t/** Can be either 'big' or 'little'. Also accepts 1 for big and -1 for little. Doesn't matter when size = 1. */\n\t\t\tendian: string | number;\n\n\t\t\t/** Number of bytes per word, or 'auto' to flip entire Buffer. */\n\t\t\tsize: number | string;\n\t\t}\n\n\t\t/**\n\t\t * Turn a BigNum into a Number.\n\t\t *\n\t\t * If the BigNum is too big you'll lose precision or you'll get ±Infinity.\n\t\t */\n\t\texport function toNumber(n: BigNumCompatible): number;\n\n\t\t/**\n\t\t * Return a new Buffer with the data from the BigNum.\n\t\t *\n\t\t * The default options are: {endian: 'big', size: 1}.\n\t\t */\n\t\texport function toBuffer(\n\t\t\tn: BigNumCompatible,\n\t\t\toptions?: BufferOptions,\n\t\t): Buffer;\n\n\t\t/** Return a new BigNum containing the instance value plus n. */\n\t\texport function add(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value plus n. */\n\t\texport function plus(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value minus n. */\n\t\texport function sub(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value multiplied by n. */\n\t\texport function mul(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum containing the instance value integrally divided by n. */\n\t\texport function div(\n\t\t\tdividend: BigNumCompatible,\n\t\t\tdivisor: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum with the absolute value of the instance. */\n\t\texport function abs(n: BigNumCompatible): BigNum;\n\n\t\t/** Return a new BigNum with the negative of the instance value. */\n\t\texport function neg(n: BigNumCompatible): BigNum;\n\n\t\t/**\n\t\t * Compare the instance value to n.\n\t\t *\n\t\t * Return a positive integer if > n, a negative integer if < n, and 0 if == n.\n\t\t */\n\t\texport function cmp(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): number;\n\n\t\t/** Return a boolean: whether the instance value is greater than n (> n). */\n\t\texport function gt(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a boolean: whether the instance value is greater than or equal to n (>= n). */\n\t\texport function gte(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a boolean: whether the instance value is greater than or equal to n (>= n). */\n\t\texport function ge(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a boolean: whether the instance value is equal to n (== n). */\n\t\texport function eq(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a boolean: whether the instance value is less than n (< n). */\n\t\texport function lt(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a boolean: whether the instance value is less than or equal to n (<= n). */\n\t\texport function lte(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a boolean: whether the instance value is less than or equal to n (<= n). */\n\t\texport function le(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): boolean;\n\n\t\t/** Return a new BigNum with the instance value modulo n. */\n\t\texport function mod(\n\t\t\tleft: BigNumCompatible,\n\t\t\tright: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum with the instance value raised to the nth power. */\n\t\texport function pow(\n\t\t\tbase: BigNumCompatible,\n\t\t\texponent: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return a new BigNum with the instance value raised to the nth power modulo m. */\n\t\texport function powm(\n\t\t\tbase: BigNumCompatible,\n\t\t\texponent: BigNumCompatible,\n\t\t\tm: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/**\n\t\t * If upperBound is supplied, return a random BigNum between the instance value and upperBound - 1, inclusive.\n\t\t * Otherwise, return a random BigNum between 0 and the instance value - 1, inclusive.\n\t\t */\n\t\texport function rand(\n\t\t\tn: BigNumCompatible,\n\t\t\tupperBound?: BigNumCompatible,\n\t\t): BigNum;\n\n\t\t/** Return the number of bits used to represent the current BigNum. */\n\t\texport function bitLength(n: BigNumCompatible): number;\n\t}\n}\n"
  },
  {
    "path": "scripts/init.sh",
    "content": "#!/bin/bash\n\n# Unofficial strict mode\nset -euo pipefail\nIFS=$'\\n\\t'\n\npackageName=${1:-}\n\nROOT_PACKAGE_NAME=$(jq --raw-output '.name' package.json)\nif [ \"$ROOT_PACKAGE_NAME\" != \"lisk-elements-monorepo\" ]; then\n\techo \"Please use the command in the project root directory.\"\n\texit 1\nfi\n\nif [ -z \"$packageName\" ] || [[ \"$packageName\" =~ [^a-zA-Z0-9-] ]]; then\n\techo \"Usage: npm run init -- PACKAGE_NAME\"\n\texit 1\nfi\n\npackageDir=\"./packages/$packageName\"\n# Just in case package folder doesn't exist yet.\nmkdir -p \"$packageDir\"\n\ntemplates=(\n\t\"browsertest\"\n\t\"cypress\"\n\t\"scripts\"\n\t\".babelrc\"\n\t\".eslintignore\"\n\t\".npmignore\"\n\t\".npmrc\"\n\t\".nycrc\"\n\t\".prettierignore\"\n\t\".prettierrc.json\"\n\t\"cypress.json\"\n)\n\nfor i in \"${templates[@]}\"\ndo\n\tif [ ! -e \"$packageDir/${i}\" ];\tthen\n\t\tln -vs \"../../templates/$i.tmpl\" \"$packageDir/$i\"\n\tfi\ndone\n"
  },
  {
    "path": "templates/.npmignore.tmpl",
    "content": ".babelrc\n.eslintignore\n.eslintrc.json\n.gitignore\n.lintstagedrc.json\n.nycrc\n.prettierrc.json\ncypress.json\nindex.html\nJenkinsfile*\n\n.nyc_output/\ncoverage/\ncypress/\nfixtures/\nsrc/\ntest/\nbrowsertest/\n"
  },
  {
    "path": "templates/.npmrc.tmpl",
    "content": "message = \":arrow_up: Version %s\"\nsave-exact = true\n"
  },
  {
    "path": "templates/.nycrc-ts.tmpl",
    "content": "{\n\t\"exclude\": [\"test/**\", \"**/*.d.ts\"],\n\t\"extension\": [\".ts\"]\n}\n"
  },
  {
    "path": "templates/.prettierignore.tmpl",
    "content": "package.json\n\n.nyc_output/\ncoverage/\ndist-node/\ndist-browser/\nbrowsertest.build/\nnode_modules/\n\n# BUG: See https://github.com/prettier/prettier/issues/3223\ndocs/CONTRIBUTING.md\n"
  },
  {
    "path": "templates/.prettierrc.json.tmpl",
    "content": "{\n\t\"singleQuote\": true,\n\t\"trailingComma\": \"all\",\n\t\"useTabs\": true\n}\n"
  },
  {
    "path": "templates/browsertest.tmpl/.eslintrc.json",
    "content": "{\n\t\"env\": {\n\t\t\"mocha\": true,\n\t\t\"browser\": true\n\t}\n}\n"
  },
  {
    "path": "templates/browsertest.tmpl/browsertest.html",
    "content": "<!DOCTYPE html>\n<html>\n\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>Browser tests</title>\n\t<link rel=\"stylesheet\" media=\"all\" href=\"https://cdnjs.cloudflare.com/ajax/libs/mocha/3.2.0/mocha.min.css\">\n</head>\n\n<body>\n\n\t<div id=\"mocha\"></div>\n\t<div id=\"messages\"></div>\n\t<div id=\"fixtures\"></div>\n\t<div id=\"done\" style=\"display: none\"></div>\n\t<div id=\"failures\" style=\"display: none\"></div>\n\n\t<script src=\"https://cdnjs.cloudflare.com/ajax/libs/mocha/3.2.0/mocha.min.js\"></script>\n\t<script src=\"./setup.js\"></script>\n\t<script src=\"../browsertest.build/browsertest.js\"></script>\n\t<script src=\"./run_tests.js\"></script>\n\n</body>\n\n</html>\n"
  },
  {
    "path": "templates/browsertest.tmpl/browsertest.min.html",
    "content": "<!DOCTYPE html>\n<html>\n\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>Browser tests</title>\n\t<link rel=\"stylesheet\" media=\"all\" href=\"https://cdnjs.cloudflare.com/ajax/libs/mocha/3.2.0/mocha.min.css\">\n</head>\n\n<body>\n\n\t<div id=\"mocha\"></div>\n\t<div id=\"messages\"></div>\n\t<div id=\"fixtures\"></div>\n\t<div id=\"done\" style=\"display: none\"></div>\n\t<div id=\"failures\" style=\"display: none\"></div>\n\n\t<script src=\"https://cdnjs.cloudflare.com/ajax/libs/mocha/3.2.0/mocha.min.js\"></script>\n\t<script src=\"./setup.js\"></script>\n\t<script src=\"../browsertest.build/browsertest.min.js\"></script>\n\t<script src=\"./run_tests.js\"></script>\n\n</body>\n\n</html>\n"
  },
  {
    "path": "templates/browsertest.tmpl/run_tests.js",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nmocha.checkLeaks();\nmocha.run(failures => {\n\tdocument.getElementById('failures').innerText = failures;\n\tdocument.getElementById('done').innerText = 'DONE';\n});\n"
  },
  {
    "path": "templates/browsertest.tmpl/setup.js",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nmocha.setup({\n\tui: 'bdd',\n\ttimeout: 5000,\n\tglobals: ['__$$GLOBAL_REWIRE_NEXT_MODULE_ID__'],\n\tfgrep: '@node-only',\n\tinvert: true,\n});\n"
  },
  {
    "path": "templates/cypress.json.tmpl",
    "content": "{\n\t\"video\": false,\n\t\"pluginsFile\": false,\n\t\"supportFile\": false\n}\n"
  },
  {
    "path": "templates/cypress.tmpl/integration/index.js",
    "content": "/*\n * Copyright © 2018 Lisk Foundation\n *\n * See the LICENSE file at the top-level directory of this distribution\n * for licensing information.\n *\n * Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation,\n * no part of this software, including this file, may be copied, modified,\n * propagated, or distributed except according to the terms contained in the\n * LICENSE file.\n *\n * Removal or modification of this copyright notice is prohibited.\n *\n */\nconst ROOT_DIR = Cypress.env('ROOT_DIR');\nconst FORCE_RELOAD = true;\n\nconst throwFailuresInWindow = win => {\n\tconst failures = win.parent.document\n\t\t.getElementById(`Your App: '${ROOT_DIR}'`)\n\t\t.contentDocument.getElementsByClassName('fail');\n\n\tif (failures.length) {\n\t\tconst failuresHTML = Array.from(failures).map(el => el.outerHTML);\n\t\tlet errorString;\n\t\ttry {\n\t\t\terrorString = failuresHTML.map(decodeURIComponent).join('\\n');\n\t\t} catch (error) {\n\t\t\terrorString = failuresHTML.join('\\n');\n\t\t}\n\t\tthrow new Error(errorString);\n\t}\n};\n\nconst testPage = page => () => {\n\tcy.visit(page);\n\tcy.reload(FORCE_RELOAD);\n\tcy.get('#done').should('contain', 'DONE');\n\tcy.window().then(throwFailuresInWindow);\n};\n\ndescribe('Browser tests', () => {\n\tit('should pass without minification', testPage('/browsertest.html'));\n\tit('should pass with minification', testPage('/browsertest.min.html'));\n});\n"
  },
  {
    "path": "templates/mocha.opts.ts.tmpl",
    "content": "--recursive\n--require ts-node/register\n--require tsconfig-paths/register\n--require source-map-support/register\n--require ./test/_setup.ts\n--watch-extensions ts\n"
  },
  {
    "path": "templates/scripts.tmpl/clean.sh",
    "content": "#!/bin/bash\n\n# Unofficial strict mode\nset -euo pipefail\nIFS=$'\\n\\t'\n\n# Usage\n# npm run clean\n\nrm -rf .nyc_output/\nrm -rf browsertest.build/\nrm -rf coverage/\nrm -rf dist-browser/\nrm -rf dist-node/\nrm -rf lerna-debug.log\nrm -rf npm-debug.log\n"
  },
  {
    "path": "templates/tsconfig-test.json.tmpl",
    "content": "{\n\t\"extends\": \"../tsconfig\",\n\t\"compilerOptions\": {\n\t\t\"baseUrl\": \".\",\n\t\t\"declaration\": false,\n\t\t\"target\": \"es2017\",\n\t\t\"typeRoots\": [\"../../../types\", \"../node_modules/@types\"]\n\t},\n\t\"include\": [\"../../../types/**/*\", \"./**/*\"]\n}\n"
  },
  {
    "path": "templates/tsconfig.browsertest.json.tmpl",
    "content": "{\n\t\"extends\": \"../../tsconfig\",\n\t\"compilerOptions\": {\n\t\t\"declaration\": false,\n\t\t\"outDir\": \"browsertest.build\",\n\t\t\"baseUrl\": \".\",\n\t\t\"rootDir\": \".\",\n\t\t\"typeRoots\": [\n\t\t\t\"types\",\n\t\t\t\"../../types\",\n\t\t\t\"./node_modules/@types\"\n\t\t]\n\t},\n\t\"include\": [\"../../types/**/*\", \"src/**/*\", \"test/**/*\"]\n}\n"
  },
  {
    "path": "templates/tsconfig.json.tmpl",
    "content": "{\n\t\"extends\": \"../../tsconfig\",\n\t\"compilerOptions\": {\n\t\t\"declaration\": true,\n\t\t\"outDir\": \"dist-node\",\n\t\t\"rootDir\": \"./src\"\n\t},\n\t\"include\": [\"src/**/*\", \"types/**/*\"]\n}\n"
  },
  {
    "path": "templates/tslint-test.json.tmpl",
    "content": "{\n\t\"extends\": [\"../../../tslint.test.json\"]\n}\n"
  },
  {
    "path": "templates/tslint.json.tmpl",
    "content": "{\n\t\"extends\": \"../../tslint.json\"\n}\n"
  },
  {
    "path": "tsconfig.json",
    "content": "{\n\t\"compilerOptions\": {\n\t\t\"esModuleInterop\": true,\n\t\t\"forceConsistentCasingInFileNames\": true,\n\t\t\"target\": \"es2017\",\n\t\t\"module\": \"commonjs\",\n\t\t\"moduleResolution\": \"node\",\n\t\t\"newLine\": \"lf\",\n\t\t\"noFallthroughCasesInSwitch\": true,\n\t\t\"noImplicitReturns\": true,\n\t\t\"noUnusedLocals\": true,\n\t\t\"noUnusedParameters\": true,\n\t\t\"pretty\": true,\n\t\t\"removeComments\": true,\n\t\t\"resolveJsonModule\": true,\n\t\t\"sourceMap\": true,\n\t\t\"strict\": true\n\t}\n}\n"
  },
  {
    "path": "tslint.json",
    "content": "{\n\t\"defaultSeverity\": \"error\",\n\t\"extends\": [\n\t\t\"tslint:all\",\n\t\t\"tslint-immutable/all\",\n\t\t\"tslint-config-prettier\"\n\t],\n\t\"rules\": {\n\t\t\"completed-docs\": false,\n\t\t\"file-name-casing\": false,\n\t\t\"interface-name\": [true, \"never-prefix\"],\n\t\t\"no-class\": false,\n\t\t\"no-delete\": true,\n\t\t\"no-expression-statement\": false,\n\t\t\"no-if-statement\": false,\n\t\t\"no-let\": true,\n\t\t\"no-loop-statement\": true,\n\t\t\"no-method-signature\": false,\n\t\t\"no-mixed-interface\": true,\n\t\t\"no-object-mutation\": false,\n\t\t\"no-parameter-reassignment\": true,\n\t\t\"no-this\": false,\n\t\t\"no-unsafe-any\": false,\n\t\t\"no-var-keyword\": true,\n\t\t\"object-literal-sort-keys\": false,\n\t\t\"prefer-method-signature\": false,\n\t\t\"readonly-array\": true,\n\t\t\"readonly-keyword\": [true, \"ignore-class\"],\n\t\t\"strict-boolean-expressions\": false,\n\t\t\"strict-type-predicates\": false\n\t}\n}\n"
  },
  {
    "path": "tslint.test.json",
    "content": "{\n\t\"rules\": {\n\t\t\"arrow-return-shorthand\": \"off\",\n\t\t\"no-expression-statement\": \"off\"\n\t}\n}\n"
  },
  {
    "path": "types/chai/index.d.ts",
    "content": "/* tslint:disable:callable-types no-any no-method-signature readonly-keyword */\ndeclare module 'chai' {\n\tglobal {\n\t\texport namespace Chai {\n\t\t\tinterface ChaiStatic {\n\t\t\t\t_obj: any;\n\t\t\t\tAssertion: {\n\t\t\t\t\tnew (value: any): Assertion;\n\t\t\t\t\taddProperty(name: string, handler: () => void): void;\n\t\t\t\t};\n\t\t\t}\n\t\t\tinterface Assert {\n\t\t\t\t(expression: any, message?: string, messageNegative?: string): void;\n\t\t\t}\n\t\t\texport interface TypeComparison {\n\t\t\t\thexString: Assertion;\n\t\t\t\tinteger: Assertion;\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "types/globals/index.d.ts",
    "content": "/* tslint:disable:readonly-keyword */\n/// <reference types=\"sinon\" />\n\ndeclare global {\n\texport namespace NodeJS {\n\t\texport interface Global {\n\t\t\tsandbox: sinon.SinonSandbox;\n\t\t}\n\t}\n\tvar sandbox: sinon.SinonSandbox;\n}\n\nexport {};\n"
  },
  {
    "path": "types/json/index.d.ts",
    "content": "/* tslint:disable:no-any */\ndeclare module '*.json' {\n\tconst value: any;\n\texport default value;\n}\n"
  }
]