{"_id":"@bohendo/connext","_rev":"1-1542527496bb912d04afcf0f42fed99d","name":"@bohendo/connext","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@bohendo/connext","version":"0.1.0","author":{"name":"Connext & Friends"},"description":"Shared code between wallet and hub","license":"ISC","main":"dist/Connext.js","scripts":{"build":"node_modules/.bin/tsc -p tsconfig.json","clean":"rm -rf ./dist","compile":"tsc","generate":"typechain --target=web3-1.0.0 --outDir=./src/typechain/ './.yalc/contracts/build/contracts/*.json'","postinstall":"rm -f node_modules/web3/index.d.ts","prepare":"npm run rebuild","rebuild":"npm run clean && npm run compile","test":"node test/HappyCase.test.js","watch":"tsc --watch --preserveWatchOutput --project tsconfig.json"},"engines":{"node":">=9","npm":">=5"},"dependencies":{"@types/bluebird":"^3.5.25","axios":"^0.18.0","bignumber.js":"^7.2.1","ethereumjs-util":"^6.0.0","ethereumjs-wallet":"0.6.0","ethers":"^4.0.20","human-standard-token-abi":"^2.0.0","redux":"^4.0.1","semaphore":"^1.1.0","typescript-fsa":"^3.0.0-beta-2","typescript-fsa-reducers":"^1.1.0","web3":"^1.0.0-beta.36"},"devDependencies":{"@types/chai":"^4.1.6","@types/chai-as-promised":"^7.1.0","@types/chai-subset":"^1.3.1","@types/ethereumjs-util":"^5.2.0","@types/mocha":"^5.2.5","@types/node":"^10.12.0","@types/redux-mock-store":"^1.0.0","@types/semaphore":"^1.1.0","@types/sinon":"^5.0.7","@types/web3":"^1.0.11","bluebird":"^3.5.3","bn.js":"^4.11.8","chai":"^4.2.0","chai-as-promised":"^7.1.1","chai-subset":"^1.6.0","dotenv":"^6.1.0","ethjs-provider-http":"^0.1.6","fs":"^0.0.1-security","install":"^0.12.2","mocha":"^5.2.0","node-fetch-polyfill":"^2.0.6","redux-mock-store":"^1.5.3","sinon":"^7.1.0","ts-node":"^7.0.1","typechain":"^0.3.8","types-ethereumjs-util":"^0.0.8","typescript":"=3.2.2"},"_id":"@bohendo/connext@0.1.0","dist":{"shasum":"d722180ee3d00afbc62ca01346f3d8103c0b2ccb","integrity":"sha512-iw78NGZi9kOX9oP+wVISofVL5zmKZ+t6rAhxBOtcwdunKu0nj+ppuUbee6UWEOq8dBHJpUJKqp1vor9fmRh2pw==","tarball":"https://registry.npmjs.org/@bohendo/connext/-/connext-0.1.0.tgz","fileCount":104,"unpackedSize":5677407,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcM0xyCRA9TVsSAnZWagAAXzYQAIoZdwGoe3DYMyxfyEeQ\ndO6uxmAPN4GkH0gIy65ht4J8XGHkyeMS3ThiatuqKogPBcQz4xooWqRlIqa8\n14KpEtZvImMla/WmkxoBrGt9LmgPkqEqU4eO+xWRYzsX27e6abahKQFG+lyE\nRE9lcdWUEod6OoO6Ol4QrCwJbm++9ZdMUAL2QT3W0xkv+AqC+OwUlyQE5Rhj\n1T43Evr8ypHTSgYqJ36Bh/Nb0RI1IeD44WnDVs8njp/GUPGm8wLxTrpABcbu\n1cFCKpIQNjVKyKWFmGtiP+ISuNCUPloyuy6GkP5K5NhM6Sb5f6Lur4nEDo28\nEDrBv/FpEi2PuCjG3Cd5IowE8/PouB6xYnLRXUtrsTRw4fAI3MtfJRDqxp5H\nJ8fR1ZtX1DjrOU9KTi5iT7j+FkCe+sjv0UhWgNTAqNGqKko5SROE6zkdjsdC\nii0xGXGGIU9apiJmHjpk6pp2eTVoTUlPV+cNh2KRxWOjNBm00aUT+9c3rXkA\nKlln1YEsI+XeBA+yT0KFFctyV4q3sZkuu2cAakBxLvuhckQvP1gPdWxuuA+f\nkKIcWoLY95ilj3PxH5OKr52jlM68le50BLMxCmVNvMpbrUistiFLz/61FaOP\nOdjd0ET5hQQSlZRwm+8gqMiGpkNb0ottQLj85hRpOBM2bRr81pwWok700vir\nyho4\r\n=QO16\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD8zn4A1IAdYotM+mo2qLy+k7s8Ukxfkt24RGd5ho4ROgIgNPbl6WVJTFqYckFIEq6YMBk2+jjN2TDIUC7z/3SqMfw="}]},"maintainers":[{"name":"bohendo","email":"bohende@gmail.com"}],"_npmUser":{"name":"bohendo","email":"bohende@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/connext_0.1.0_1546865777774_0.6879904321772772"},"_hasShrinkwrap":false}},"time":{"created":"2019-01-07T12:56:17.596Z","0.1.0":"2019-01-07T12:56:18.045Z","modified":"2022-04-04T19:59:07.848Z"},"maintainers":[{"name":"bohendo","email":"bohende@gmail.com"}],"description":"Shared code between wallet and hub","author":{"name":"Connext & Friends"},"license":"ISC","readme":"Testing\n\nThere are a number of helper functions to make testing easier::\n\n   import { assert, getChannelState, updateState, assertStateEqual } from 'client/testing'\n\n   describe('confirm deposit', () => {\n      const preDepositState = getChannelState('empty', {\n         balanceWei: [0, 0],\n         pendingDepositWei: [6, 9],\n      })\n\n      it('should add the correct amount', () => {\n         let actual = confirmDeposit(preDepositState)\n         assertStateEqual(actual, {\n            balanceWei: [6, 9],\n            pendingDepositWei: [0, 0],\n         })\n      })\n   })\n\nNotice that:\n\n1. The testing library provides four \"default\" states: \"empty\" (where all fields\n   are zero, except for the ``txCount``, which is ``[1, 1]`` or ``1`` for channels and threads, respectively), and \"full\", where\n   each field has a unique value (this is useful for testing, ex, signature\n   functions).\n\n   ``empty`` channel state::\n\n      contractAddress: '0xCCC0000000000000000000000000000000000000'\n      user: '0xAAA0000000000000000000000000000000000000'\n      recipient: '0x2220000000000000000000000000000000000000'\n      balanceWei: [ '0', '0' ]\n      balanceToken: [ '0', '0' ]\n      pendingDepositWei: [ '0', '0' ]\n      pendingDepositToken: [ '0', '0' ]\n      pendingWithdrawalWei: [ '0', '0' ]\n      pendingWithdrawalToken: [ '0', '0' ]\n      txCount: [ 1, 1 ],\n      threadRoot: '0x0000000000000000000000000000000000000000000000000000000000000000'\n      threadCount: 0\n      timeout: 0\n      sig: [ '', '' ]\n\n\n   ``full`` channel state::\n\n      contractAddress: '0xCCC0000000000000000000000000000000000000'\n      user: '0xAAA0000000000000000000000000000000000000'\n      recipient: '0x2220000000000000000000000000000000000000'\n      balanceWei: [ '1', '2' ]\n      balanceToken: [ '3', '4' ]\n      pendingDepositWei: [ '4', '5' ]\n      pendingDepositToken: [ '6', '7' ]\n      pendingWithdrawalWei: [ '8', '9' ]\n      pendingWithdrawalToken: [ '10', '11' ]\n      txCount: [ 13, 12 ]\n      threadRoot: '0x1414140000000000000000000000000000000000000000000000000000000000'\n      threadCount: 14\n      timeout: 15\n      sig: [ 'sighub0000000000000000000000000000000000000000000000000000000000', 'siguser0000000000000000000000000000000000000000000000000000000000' ] \n\n\n   ``empty`` thread state::\n\n      contractAddress: '0xCCC0000000000000000000000000000000000000'\n      user: '0xAAA0000000000000000000000000000000000000'\n      sender: '0x2220000000000000000000000000000000000000'\n      receiver: '0x3330000000000000000000000000000000000000'\n      txCount: 1\n      balanceWei: [ '0', '0' ]\n      balanceToken: [ '0', '0' ]\n      sigA: ''\n\n\n   ``full`` thread state::\n\n      contractAddress: '0xCCC0000000000000000000000000000000000000'\n      user: '0xAAA0000000000000000000000000000000000000'\n      sender: '0x2220000000000000000000000000000000000000'\n      receiver: '0x3330000000000000000000000000000000000000'\n      balanceWei: [ '1', '2' ]\n      balanceToken: [ '3', '4' ]\n      txCount: 22\n      sigA: 'sigA0000000000000000000000000000000000000000000000000000000000'\n\n2. All operations support \"shorthands\" for values; internally, ``balanceWei:\n   [5, 10]`` is expanded to ``balanceWeiHub: 6, balanceWeiUser: 9``. This is done\n   through two functions: ``expandChannelSuccinct``, ``expandThreadSuccinct``, which expands the fields in a\n   \"succinct\" state to a verbose state, and ``makeSuccinctChannel`` and ``makeSuccinctThread``, which do the\n   opposite.\n\n   Note that these functions can accept partial states, and combinations of\n   succinct and verbose states.\n\n   Additionally, they will always normalize numeric values to strings.\n\n   For example::\n   \n\n      > verbose = expandSuccinctChannel({\n      .   balanceWei: [6, 9],\n      .   balanceTokenUser: 69,\n      .   timout: 5,\n      . })\n      > verbose\n      {\n        balanceWeiHub: '6',\n        balanceTokenUser: '9',\n        balanceTokenUser: '69',\n        timeout: 5,\n      }\n      > makeSuccinctChannel(verbose)\n      {\n        balanceWei: ['6', '9'],\n        balanceToken: ['0', '69'],\n        timeout: 5,\n     }\n      \nAdditionally, useful helper functions:\n\n* ``mkAddress(prefix)``: Generates an address by suffixing ``prefix`` with zeros::\n\n   > mkAddress('0x1234')\n   '0x1234000000000000000000000000000000000000'\n\n* ``mkHash(prefix)``: Generates a hash by suffixing ``prefix`` with zeros::\n\n   > mkHash('0xab')\n   '0xab00000000000000000000000000000000000000000000000000000000000000'\n","readmeFilename":"README.rst"}