diff --git a/.gitignore b/.gitignore index 00902b3..c81f5ff 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ site site/ lib/assets/tester.json lib/assets/development.json -lib/build/contracts \ No newline at end of file +lib/build/contracts +build \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index ba7484b..f465e86 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ install: npm install script: - npm i -g truffle - sh deploy.sh + - npm run build - npm test git: submodules: true diff --git a/deploy.js b/archive/deploy.js similarity index 97% rename from deploy.js rename to archive/deploy.js index 8505276..985de17 100644 --- a/deploy.js +++ b/archive/deploy.js @@ -10,7 +10,7 @@ const web3 = new Web3(provider) const TruffleContract = require('truffle-contract') const getArtifact = name => { - const contract = TruffleContract(require(`./lib/build/contracts/${name}.json`)) + const contract = TruffleContract(require(`./static/build/contracts/${name}.json`)) contract.setProvider(provider) contract.detectNetwork() return contract @@ -150,7 +150,7 @@ async function main() { timestampScheduler: timestampScheduler.address } const fs = require('fs') - fs.writeFileSync('./lib/assets/tester.json', JSON.stringify(contracts)) + fs.writeFileSync('./static/assets/tester.json', JSON.stringify(contracts)) resolve({ // Ganache attached web3 web3: web3, diff --git a/archive/deploy.sh b/archive/deploy.sh new file mode 100755 index 0000000..9f516f8 --- /dev/null +++ b/archive/deploy.sh @@ -0,0 +1,18 @@ +#!/bin/bash +echo "Deploying contracts..." +cd ethereum-alarm-clock +truffle network --clean +truffle migrate --reset +cd .. + +echo "Moving the generated contract files..." +rm -Rfv static/build/* +mkdir static/build +cp -Rfv ethereum-alarm-clock/build/* static/build/contracts +cp -fv ethereum-alarm-clock/package.json static/build/ethereum-alarm-clock.json +ls static/build + +node ./extractContractsInfo.js development +mv -fv contracts.json static/assets/development.json || true + +echo "Done." \ No newline at end of file diff --git a/docs/API/constants.md b/archive/docs/API/constants.md similarity index 100% rename from docs/API/constants.md rename to archive/docs/API/constants.md diff --git a/docs/API/index.md b/archive/docs/API/index.md similarity index 100% rename from docs/API/index.md rename to archive/docs/API/index.md diff --git a/docs/API/requestFactory.md b/archive/docs/API/requestFactory.md similarity index 100% rename from docs/API/requestFactory.md rename to archive/docs/API/requestFactory.md diff --git a/docs/API/requestTracker.md b/archive/docs/API/requestTracker.md similarity index 100% rename from docs/API/requestTracker.md rename to archive/docs/API/requestTracker.md diff --git a/docs/API/scheduler.md b/archive/docs/API/scheduler.md similarity index 100% rename from docs/API/scheduler.md rename to archive/docs/API/scheduler.md diff --git a/docs/API/txRequest.md b/archive/docs/API/txRequest.md similarity index 100% rename from docs/API/txRequest.md rename to archive/docs/API/txRequest.md diff --git a/docs/API/util.md b/archive/docs/API/util.md similarity index 100% rename from docs/API/util.md rename to archive/docs/API/util.md diff --git a/docs/Changelog.md b/archive/docs/Changelog.md similarity index 100% rename from docs/Changelog.md rename to archive/docs/Changelog.md diff --git a/docs/Executing_Tut.md b/archive/docs/Executing_Tut.md similarity index 100% rename from docs/Executing_Tut.md rename to archive/docs/Executing_Tut.md diff --git a/docs/GUI_Implementer_Guide.md b/archive/docs/GUI_Implementer_Guide.md similarity index 100% rename from docs/GUI_Implementer_Guide.md rename to archive/docs/GUI_Implementer_Guide.md diff --git a/docs/index.md b/archive/docs/index.md similarity index 100% rename from docs/index.md rename to archive/docs/index.md diff --git a/docs/old/Executing_Tut.md b/archive/docs/old/Executing_Tut.md similarity index 100% rename from docs/old/Executing_Tut.md rename to archive/docs/old/Executing_Tut.md diff --git a/docs/old/Tutorial_Geth.txt b/archive/docs/old/Tutorial_Geth.txt similarity index 100% rename from docs/old/Tutorial_Geth.txt rename to archive/docs/old/Tutorial_Geth.txt diff --git a/docs/old/spec.txt b/archive/docs/old/spec.txt similarity index 100% rename from docs/old/spec.txt rename to archive/docs/old/spec.txt diff --git a/example/webpack/.babelrc b/archive/example/webpack/.babelrc similarity index 100% rename from example/webpack/.babelrc rename to archive/example/webpack/.babelrc diff --git a/example/webpack/README.md b/archive/example/webpack/README.md similarity index 100% rename from example/webpack/README.md rename to archive/example/webpack/README.md diff --git a/example/webpack/index.html b/archive/example/webpack/index.html similarity index 100% rename from example/webpack/index.html rename to archive/example/webpack/index.html diff --git a/example/webpack/package-lock.json b/archive/example/webpack/package-lock.json similarity index 100% rename from example/webpack/package-lock.json rename to archive/example/webpack/package-lock.json diff --git a/example/webpack/package.json b/archive/example/webpack/package.json similarity index 100% rename from example/webpack/package.json rename to archive/example/webpack/package.json diff --git a/example/webpack/server.js b/archive/example/webpack/server.js similarity index 100% rename from example/webpack/server.js rename to archive/example/webpack/server.js diff --git a/example/webpack/src/components/app.js b/archive/example/webpack/src/components/app.js similarity index 100% rename from example/webpack/src/components/app.js rename to archive/example/webpack/src/components/app.js diff --git a/example/webpack/src/components/index.js b/archive/example/webpack/src/components/index.js similarity index 100% rename from example/webpack/src/components/index.js rename to archive/example/webpack/src/components/index.js diff --git a/example/webpack/webpack.config.js b/archive/example/webpack/webpack.config.js similarity index 100% rename from example/webpack/webpack.config.js rename to archive/example/webpack/webpack.config.js diff --git a/example/webpack/yarn.lock b/archive/example/webpack/yarn.lock similarity index 100% rename from example/webpack/yarn.lock rename to archive/example/webpack/yarn.lock diff --git a/extractContractsInfo.js b/archive/extractContractsInfo.js similarity index 94% rename from extractContractsInfo.js rename to archive/extractContractsInfo.js index c565995..ee5d3db 100644 --- a/extractContractsInfo.js +++ b/archive/extractContractsInfo.js @@ -8,8 +8,8 @@ * Available networks: * mainnet, ropsten, rinkeby, kovan, development */ -const artifactsDir = './lib/build/contracts'; -const dest = './lib/build/abi' +const artifactsDir = './static/build/contracts'; +const dest = './static/build/abi' const fs = require('fs'); const path = require('path'); diff --git a/mkdocs.yml b/archive/mkdocs.yml similarity index 100% rename from mkdocs.yml rename to archive/mkdocs.yml diff --git a/script.js b/archive/script.js similarity index 100% rename from script.js rename to archive/script.js diff --git a/archive/test/RequestFactory.js b/archive/test/RequestFactory.js new file mode 100644 index 0000000..4ea5179 --- /dev/null +++ b/archive/test/RequestFactory.js @@ -0,0 +1,26 @@ +// const Bignumber = require("bignumber.js"); +// const { expect } = require("chai"); + +// const initEacjs = require("../index"); + +// const mockWeb3 = { +// version: { +// getNetwork: (cb) => { +// return () +// } +// } +// }; + +// describe("RequestFactory", () => { +// let eacjs; + +// before(() => { +// eacjs = initEacjs(mockWeb3); +// }) + + +// it("Creates a new instance of RequestFactory", async () => { +// const rFactory = await eacjs.requestFactory(); +// expect(rFactory.addess).to.exist; +// }) +// }) \ No newline at end of file diff --git a/test/dependencies.js b/archive/test/dependencies.js similarity index 100% rename from test/dependencies.js rename to archive/test/dependencies.js diff --git a/test/helper/mine.js b/archive/test/helper/mine.js similarity index 100% rename from test/helper/mine.js rename to archive/test/helper/mine.js diff --git a/test/helper/mine2.js b/archive/test/helper/mine2.js similarity index 100% rename from test/helper/mine2.js rename to archive/test/helper/mine2.js diff --git a/test/requestFactory.js b/archive/test/requestFactory.js similarity index 99% rename from test/requestFactory.js rename to archive/test/requestFactory.js index caee64e..e7753e6 100644 --- a/test/requestFactory.js +++ b/archive/test/requestFactory.js @@ -7,7 +7,7 @@ describe("Request Factory", () => { let web3 before(async () => { - const deployed = await Deployer() + const deployed = await Deployer(); web3 = deployed.web3 eac = require('../index')(web3) }) diff --git a/test/scheduler.js b/archive/test/scheduler.js similarity index 100% rename from test/scheduler.js rename to archive/test/scheduler.js diff --git a/test/txRequest.js b/archive/test/txRequest.js similarity index 99% rename from test/txRequest.js rename to archive/test/txRequest.js index 6c6671d..e247bc7 100644 --- a/test/txRequest.js +++ b/archive/test/txRequest.js @@ -5,7 +5,7 @@ const { timetravel } = require('./helper/mine2') describe("TxRequest", () => { let eac - let delpoyed + let deployed let web3 before(async () => { diff --git a/test/util.js b/archive/test/util.js similarity index 100% rename from test/util.js rename to archive/test/util.js diff --git a/deploy.sh b/deploy.sh deleted file mode 100755 index b2cc1c1..0000000 --- a/deploy.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -echo "Deploying contracts..." -cd ethereum-alarm-clock -truffle network --clean -truffle migrate --reset -cd .. - -echo "Moving the generated contract files..." -rm -Rfv lib/build/* -cp -Rfv ethereum-alarm-clock/build/* lib/build/ -cp -fv ethereum-alarm-clock/package.json lib/build/ethereum-alarm-clock.json - -node ./extractContractsInfo.js development -mv -fv contracts.json lib/assets/development.json || true - -echo "Done." \ No newline at end of file diff --git a/ethereum-alarm-clock b/ethereum-alarm-clock deleted file mode 160000 index 50b116b..0000000 --- a/ethereum-alarm-clock +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 50b116be35ee1b7c3658920623af98658591c4c1 diff --git a/index.js b/index.js index 81391fa..f6762e6 100644 --- a/index.js +++ b/index.js @@ -1,49 +1 @@ -/* eslint global-require: "off", import/no-dynamic-require: "off" */ - -const Constants = require("./lib/constants") -const RequestFactory = require("./lib/requestFactory") -const Scheduler = require("./lib/scheduling") -const TxRequest = require("./lib/txRequest") -const Util = require("./lib/util") -const RequestData = require("./lib/txRequest/requestData") -const version = require('./package.json').version; -const contracts = require("./lib/build/ethereum-alarm-clock.json").version; - -module.exports = (web3) => { - if (!web3) { - return { - Constants, - RequestFactory, - Scheduler, - TxRequest, - Util: Util(), - RequestData, - version, - contracts - } - } - - const util = Util(web3) - return { - Constants, - requestFactory: async () => { - const chainName = await util.getChainName() - const contracts = require(`./lib/assets/${chainName}.json`) - return new RequestFactory(contracts.requestFactory, web3) - }, - scheduler: async () => { - const chainName = await util.getChainName() - const contracts = require(`./lib/assets/${chainName}.json`) - return new Scheduler( - contracts.blockScheduler, - contracts.timestampScheduler, - web3 - ) - }, - transactionRequest: address => new TxRequest(address, web3), - Util: util, - RequestData, - version, - contracts - } -} +module.exports = require("./build/index.js").default; diff --git a/lib/build/abi/BaseScheduler.json b/lib/build/abi/BaseScheduler.json deleted file mode 100644 index 83b3393..0000000 --- a/lib/build/abi/BaseScheduler.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"temporalUnit","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feeRecipient","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"factoryAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"request","type":"address"}],"name":"NewRequest","type":"event"},{"constant":false,"inputs":[{"name":"_toAddress","type":"address"},{"name":"_callData","type":"bytes"},{"name":"_uintArgs","type":"uint256[8]"}],"name":"schedule","outputs":[{"name":"newRequest","type":"address"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"_bounty","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_callGas","type":"uint256"},{"name":"_callValue","type":"uint256"},{"name":"_gasPrice","type":"uint256"}],"name":"computeEndowment","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/BlockScheduler.json b/lib/build/abi/BlockScheduler.json deleted file mode 100644 index 56850fc..0000000 --- a/lib/build/abi/BlockScheduler.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":false,"inputs":[{"name":"_toAddress","type":"address"},{"name":"_callData","type":"bytes"},{"name":"_uintArgs","type":"uint256[8]"}],"name":"schedule","outputs":[{"name":"newRequest","type":"address"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"temporalUnit","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feeRecipient","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_bounty","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_callGas","type":"uint256"},{"name":"_callValue","type":"uint256"},{"name":"_gasPrice","type":"uint256"}],"name":"computeEndowment","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"factoryAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_factoryAddress","type":"address"},{"name":"_feeRecipient","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"request","type":"address"}],"name":"NewRequest","type":"event"}] \ No newline at end of file diff --git a/lib/build/abi/ClaimLib.json b/lib/build/abi/ClaimLib.json deleted file mode 100644 index 0637a08..0000000 --- a/lib/build/abi/ClaimLib.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/lib/build/abi/CloneFactory.json b/lib/build/abi/CloneFactory.json deleted file mode 100644 index 57896f1..0000000 --- a/lib/build/abi/CloneFactory.json +++ /dev/null @@ -1 +0,0 @@ -[{"anonymous":false,"inputs":[{"indexed":true,"name":"target","type":"address"},{"indexed":false,"name":"clone","type":"address"}],"name":"CloneCreated","type":"event"}] \ No newline at end of file diff --git a/lib/build/abi/DelayedPayment.json b/lib/build/abi/DelayedPayment.json deleted file mode 100644 index 2ad3f10..0000000 --- a/lib/build/abi/DelayedPayment.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"scheduler","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"scheduledTransaction","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_scheduler","type":"address"},{"name":"_numBlocks","type":"uint256"},{"name":"_recipient","type":"address"}],"payable":true,"stateMutability":"payable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[],"name":"payout","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/ExecutionLib.json b/lib/build/abi/ExecutionLib.json deleted file mode 100644 index 0637a08..0000000 --- a/lib/build/abi/ExecutionLib.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/lib/build/abi/IterTools.json b/lib/build/abi/IterTools.json deleted file mode 100644 index 870ae95..0000000 --- a/lib/build/abi/IterTools.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[{"name":"_values","type":"bool[6]"}],"name":"all","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/MathLib.json b/lib/build/abi/MathLib.json deleted file mode 100644 index e826216..0000000 --- a/lib/build/abi/MathLib.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"max","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"},{"name":"b","type":"uint256"}],"name":"min","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"}],"name":"safeCastSigned","outputs":[{"name":"","type":"int256"}],"payable":false,"stateMutability":"pure","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/Migrations.json b/lib/build/abi/Migrations.json deleted file mode 100644 index e69e516..0000000 --- a/lib/build/abi/Migrations.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"last_completed_migration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"constant":false,"inputs":[{"name":"completed","type":"uint256"}],"name":"setCompleted","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"new_address","type":"address"}],"name":"upgrade","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/PaymentLib.json b/lib/build/abi/PaymentLib.json deleted file mode 100644 index 09035c9..0000000 --- a/lib/build/abi/PaymentLib.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[{"name":"_bounty","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_callGas","type":"uint256"},{"name":"_callValue","type":"uint256"},{"name":"_gasPrice","type":"uint256"},{"name":"_gasOverhead","type":"uint256"}],"name":"computeEndowment","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"_endowment","type":"uint256"},{"name":"_bounty","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_callGas","type":"uint256"},{"name":"_callValue","type":"uint256"},{"name":"_gasPrice","type":"uint256"},{"name":"_gasOverhead","type":"uint256"}],"name":"validateEndowment","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/Proxy.json b/lib/build/abi/Proxy.json deleted file mode 100644 index 30cfda8..0000000 --- a/lib/build/abi/Proxy.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"scheduler","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"scheduledTransaction","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"receipient","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_scheduler","type":"address"},{"name":"_receipient","type":"address"},{"name":"_payout","type":"uint256"},{"name":"_gasPrice","type":"uint256"},{"name":"_delay","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[{"name":"_receipient","type":"address"}],"name":"sendOwnerEther","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/RecurringPayment.json b/lib/build/abi/RecurringPayment.json deleted file mode 100644 index 80b4705..0000000 --- a/lib/build/abi/RecurringPayment.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"scheduler","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"currentScheduledTransaction","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_scheduler","type":"address"},{"name":"_paymentInterval","type":"uint256"},{"name":"_paymentValue","type":"uint256"},{"name":"_recipient","type":"address"}],"payable":true,"stateMutability":"payable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"scheduledTransaction","type":"address"},{"indexed":false,"name":"recipient","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"PaymentScheduled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"scheduledTransaction","type":"address"},{"indexed":false,"name":"recipient","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"PaymentExecuted","type":"event"},{"constant":false,"inputs":[],"name":"process","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/RequestFactory.json b/lib/build/abi/RequestFactory.json deleted file mode 100644 index ac9a5fe..0000000 --- a/lib/build/abi/RequestFactory.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"TIMESTAMP_BUCKET_SIZE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"transactionRequestCore","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"BLOCKS_BUCKET_SIZE","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_transactionRequestCore","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"error","type":"uint8"}],"name":"ValidationError","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"target","type":"address"},{"indexed":false,"name":"clone","type":"address"}],"name":"CloneCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"request","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"bucket","type":"int256"},{"indexed":false,"name":"params","type":"uint256[12]"}],"name":"RequestCreated","type":"event"},{"constant":false,"inputs":[{"name":"_addressArgs","type":"address[3]"},{"name":"_uintArgs","type":"uint256[12]"},{"name":"_callData","type":"bytes"}],"name":"createRequest","outputs":[{"name":"","type":"address"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_addressArgs","type":"address[3]"},{"name":"_uintArgs","type":"uint256[12]"},{"name":"_callData","type":"bytes"}],"name":"createValidatedRequest","outputs":[{"name":"","type":"address"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"_addressArgs","type":"address[3]"},{"name":"_uintArgs","type":"uint256[12]"},{"name":"_endowment","type":"uint256"}],"name":"validateRequestParams","outputs":[{"name":"","type":"bool[6]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_address","type":"address"}],"name":"isKnownRequest","outputs":[{"name":"isKnown","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"windowStart","type":"uint256"},{"name":"unit","type":"uint8"}],"name":"getBucket","outputs":[{"name":"","type":"int256"}],"payable":false,"stateMutability":"pure","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/RequestFactoryInterface.json b/lib/build/abi/RequestFactoryInterface.json deleted file mode 100644 index d0d1b9e..0000000 --- a/lib/build/abi/RequestFactoryInterface.json +++ /dev/null @@ -1 +0,0 @@ -[{"anonymous":false,"inputs":[{"indexed":false,"name":"request","type":"address"},{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"bucket","type":"int256"},{"indexed":false,"name":"params","type":"uint256[12]"}],"name":"RequestCreated","type":"event"},{"constant":false,"inputs":[{"name":"addressArgs","type":"address[3]"},{"name":"uintArgs","type":"uint256[12]"},{"name":"callData","type":"bytes"}],"name":"createRequest","outputs":[{"name":"","type":"address"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"addressArgs","type":"address[3]"},{"name":"uintArgs","type":"uint256[12]"},{"name":"callData","type":"bytes"}],"name":"createValidatedRequest","outputs":[{"name":"","type":"address"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"addressArgs","type":"address[3]"},{"name":"uintArgs","type":"uint256[12]"},{"name":"endowment","type":"uint256"}],"name":"validateRequestParams","outputs":[{"name":"","type":"bool[6]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_address","type":"address"}],"name":"isKnownRequest","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/RequestLib.json b/lib/build/abi/RequestLib.json deleted file mode 100644 index 2372dcd..0000000 --- a/lib/build/abi/RequestLib.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"EXECUTE_EXTRA_GAS","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"EXECUTION_GAS_OVERHEAD","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CANCEL_EXTRA_GAS","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PRE_EXECUTION_GAS","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"anonymous":false,"inputs":[{"indexed":false,"name":"reason","type":"uint8"}],"name":"Aborted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"rewardPayment","type":"uint256"},{"indexed":false,"name":"measuredGasConsumption","type":"uint256"}],"name":"Cancelled","type":"event"},{"anonymous":false,"inputs":[],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"bounty","type":"uint256"},{"indexed":false,"name":"fee","type":"uint256"},{"indexed":false,"name":"measuredGasConsumption","type":"uint256"}],"name":"Executed","type":"event"},{"constant":true,"inputs":[{"name":"_addressArgs","type":"address[4]"},{"name":"_uintArgs","type":"uint256[12]"},{"name":"_endowment","type":"uint256"}],"name":"validate","outputs":[{"name":"isValid","type":"bool[6]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"self","type":"RequestLib.Request storage"},{"name":"_addressArgs","type":"address[4]"},{"name":"_uintArgs","type":"uint256[12]"},{"name":"_callData","type":"bytes"}],"name":"initialize","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"getEXECUTION_GAS_OVERHEAD","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"self","type":"RequestLib.Request storage"}],"name":"requiredExecutionGas","outputs":[{"name":"requiredGas","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"self","type":"RequestLib.Request storage"}],"name":"isCancellable","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"self","type":"RequestLib.Request storage"}],"name":"cancel","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"self","type":"RequestLib.Request storage"}],"name":"refundClaimDeposit","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"self","type":"RequestLib.Request storage"}],"name":"sendFee","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"self","type":"RequestLib.Request storage"}],"name":"sendBounty","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"self","type":"RequestLib.Request storage"}],"name":"canSendOwnerEther","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"self","type":"RequestLib.Request storage"}],"name":"sendOwnerEther","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"self","type":"RequestLib.Request storage"},{"name":"recipient","type":"address"}],"name":"sendOwnerEther","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/RequestMetaLib.json b/lib/build/abi/RequestMetaLib.json deleted file mode 100644 index 0637a08..0000000 --- a/lib/build/abi/RequestMetaLib.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/lib/build/abi/RequestScheduleLib.json b/lib/build/abi/RequestScheduleLib.json deleted file mode 100644 index 0a6279c..0000000 --- a/lib/build/abi/RequestScheduleLib.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[{"name":"self","type":"RequestScheduleLib.ExecutionWindow storage"}],"name":"getNow","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_reservedWindowSize","type":"uint256"},{"name":"_windowSize","type":"uint256"}],"name":"validateReservedWindowSize","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"},{"constant":true,"inputs":[{"name":"_temporalUnit","type":"RequestScheduleLib.TemporalUnit"},{"name":"_freezePeriod","type":"uint256"},{"name":"_windowStart","type":"uint256"}],"name":"validateWindowStart","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_temporalUnitAsUInt","type":"uint256"}],"name":"validateTemporalUnit","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"pure","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/SafeMath.json b/lib/build/abi/SafeMath.json deleted file mode 100644 index 0637a08..0000000 --- a/lib/build/abi/SafeMath.json +++ /dev/null @@ -1 +0,0 @@ -[] \ No newline at end of file diff --git a/lib/build/abi/SchedulerInterface.json b/lib/build/abi/SchedulerInterface.json deleted file mode 100644 index 4c7b493..0000000 --- a/lib/build/abi/SchedulerInterface.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":false,"inputs":[{"name":"_toAddress","type":"address"},{"name":"_callData","type":"bytes"},{"name":"_uintArgs","type":"uint256[8]"}],"name":"schedule","outputs":[{"name":"","type":"address"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"_bounty","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_callGas","type":"uint256"},{"name":"_callValue","type":"uint256"},{"name":"_gasPrice","type":"uint256"}],"name":"computeEndowment","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/SimpleToken.json b/lib/build/abi/SimpleToken.json deleted file mode 100644 index ddacfe0..0000000 --- a/lib/build/abi/SimpleToken.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"rate","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_initialSupply","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"buyTokens","outputs":[{"name":"success","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[{"name":"_who","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/TimestampScheduler.json b/lib/build/abi/TimestampScheduler.json deleted file mode 100644 index 56850fc..0000000 --- a/lib/build/abi/TimestampScheduler.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":false,"inputs":[{"name":"_toAddress","type":"address"},{"name":"_callData","type":"bytes"},{"name":"_uintArgs","type":"uint256[8]"}],"name":"schedule","outputs":[{"name":"newRequest","type":"address"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"temporalUnit","outputs":[{"name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feeRecipient","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_bounty","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_callGas","type":"uint256"},{"name":"_callValue","type":"uint256"},{"name":"_gasPrice","type":"uint256"}],"name":"computeEndowment","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"factoryAddress","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_factoryAddress","type":"address"},{"name":"_feeRecipient","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"request","type":"address"}],"name":"NewRequest","type":"event"}] \ No newline at end of file diff --git a/lib/build/abi/TransactionRecorder.json b/lib/build/abi/TransactionRecorder.json deleted file mode 100644 index eaf0957..0000000 --- a/lib/build/abi/TransactionRecorder.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":true,"inputs":[],"name":"lastCaller","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastCallGas","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastCallData","outputs":[{"name":"","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"wasCalled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"lastCallValue","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[],"name":"__reset__","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/TransactionRequestCore.json b/lib/build/abi/TransactionRequestCore.json deleted file mode 100644 index 10f29da..0000000 --- a/lib/build/abi/TransactionRequestCore.json +++ /dev/null @@ -1 +0,0 @@ -[{"payable":true,"stateMutability":"payable","type":"fallback"},{"constant":false,"inputs":[{"name":"addressArgs","type":"address[4]"},{"name":"uintArgs","type":"uint256[12]"},{"name":"callData","type":"bytes"}],"name":"initialize","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"execute","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"cancel","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"requestData","outputs":[{"name":"","type":"address[6]"},{"name":"","type":"bool[3]"},{"name":"","type":"uint256[15]"},{"name":"","type":"uint8[1]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"callData","outputs":[{"name":"data","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_data","type":"bytes"}],"name":"proxy","outputs":[{"name":"success","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"refundClaimDeposit","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"sendFee","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"sendBounty","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"}],"name":"sendOwnerEther","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"sendOwnerEther","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/lib/build/abi/TransactionRequestInterface.json b/lib/build/abi/TransactionRequestInterface.json deleted file mode 100644 index 34fa55a..0000000 --- a/lib/build/abi/TransactionRequestInterface.json +++ /dev/null @@ -1 +0,0 @@ -[{"constant":false,"inputs":[],"name":"execute","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"cancel","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"claim","outputs":[{"name":"","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"},{"name":"callData","type":"bytes"}],"name":"proxy","outputs":[{"name":"","type":"bool"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"requestData","outputs":[{"name":"","type":"address[6]"},{"name":"","type":"bool[3]"},{"name":"","type":"uint256[15]"},{"name":"","type":"uint8[1]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"callData","outputs":[{"name":"","type":"bytes"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"refundClaimDeposit","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"sendFee","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"sendBounty","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"sendOwnerEther","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"recipient","type":"address"}],"name":"sendOwnerEther","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}] \ No newline at end of file diff --git a/lib/build/ethereum-alarm-clock.json b/lib/build/ethereum-alarm-clock.json deleted file mode 100644 index e583485..0000000 --- a/lib/build/ethereum-alarm-clock.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "ethereum-alarm-clock", - "version": "1.0.0-beta.3", - "description": "Service to schedule Ethereum transactions that will be executed in the future.", - "main": "index.js", - "directories": { - "doc": "docs", - "test": "tests" - }, - "scripts": { - "test": "truffle test", - "coverage": "./node_modules/.bin/solidity-coverage", - "lint": "./node_modules/eslint/bin/eslint.js .", - "solium": "./node_modules/solium/bin/solium.js -d contracts --fix", - "clean": "truffle networks --clean" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/chronologic/ethereum-alarm-clock.git" - }, - "author": "", - "license": "ISC", - "bugs": { - "url": "https://github.com/chronologic/ethereum-alarm-clock/issues" - }, - "homepage": "https://github.com/chronologic/ethereum-alarm-clock#readme", - "dependencies": { - "@optionality.io/clone-factory": "^0.1.2", - "ethereumjs-util": "^5.1.2", - "nconf": "^0.8.4", - "solc": "^0.4.21", - "solium": "^1.1.6", - "web3": "^1.0.0-beta.18" - }, - "devDependencies": { - "@digix/tempo": "^0.2.0", - "bignumber.js": "^4.1.0", - "chai": "^4.1.2", - "chai-as-promised": "^7.1.1", - "coveralls": "^3.0.0", - "eslint": "^4.16.0", - "eslint-config-airbnb-base": "^12.1.0", - "eslint-plugin-import": "^2.8.0", - "solidity-coverage": "^0.4.15" - }, - "pre-commit": [ - "clean", - "lint", - "solium" - ] -} diff --git a/lib/requestFactory/index.js b/lib/requestFactory/index.js deleted file mode 100644 index a517bc6..0000000 --- a/lib/requestFactory/index.js +++ /dev/null @@ -1,220 +0,0 @@ -/* eslint class-methods-use-this: "off" */ - -const Util = require("../util")() - -class RequestFactory { - constructor(address, web3) { - if (!Util.checkNotNullAddress(address)) { - throw new Error("Attempted to instantiate a RequestFactory class from a null address.") - } - this.web3 = web3 - this.instance = this.web3.eth - .contract(Util.getABI("RequestFactory")) - .at(address) - } - - get address() { - return this.instance.address - } - - /** - * Conveinence methods - */ - - isKnownRequest(requestAddress) { - return new Promise((resolve, reject) => { - this.instance.isKnownRequest.call(requestAddress, (err, isKnown) => { - if (!err) resolve(isKnown) - else reject(err) - }) - }) - } - - validateRequestParams(addressArgs, uintArgs, endowment) { - return new Promise((resolve, reject) => { - this.instance.validateRequestParams.call( - addressArgs, - uintArgs, - endowment, - (err, isValid) => { - if (!err) resolve(isValid) - else reject(err) - } - ) - }) - } - - /** - * Parses the boolean returned by validateRequestParams() and returns the - * reason validation failed. - * @param {Array} isValid The array returned by this.validateRequestParams() - * @return {Array} An array of the strings of validation errors or an - * array of length 0 if no errors. - */ - parseIsValid(isValid) { - if (isValid.length != 6) { - throw new Error("Must pass an array of booleans returned by validateRequestParams()") - } - const Errors = [ - "InsufficientEndowment", - "ReservedWindowBiggerThanExecutionWindow", - "InvalidTemporalUnit", - "ExecutionWindowTooSoon", - "CallGasTooHigh", - "EmptyToAddress", - ] - const errors = [] - isValid.forEach((boolIsTrue, index) => { - if (!boolIsTrue) { - errors.push(Errors[index]) - } - }) - return errors - } - - async getRequestCreatedLogs(filter, startBlock, endBlock) { - const f = filter || {} - const curBlock = await Util.getBlockNumber(this.web3) - const start = startBlock || 1 - const end = endBlock || "latest" - const event = this.instance.RequestCreated( - f, - { fromBlock: start, toBlock: end } - ) - return new Promise((resolve, reject) => { - event.get((err, logs) => { - if (!err) { - resolve(logs) - } else reject(err) - }) - }) - } - - async watchRequestCreatedLogs(filter, startBlock, callback) { - const f = filter || {} - const curBlock = await Util.getBlockNumber(this.web3) - const start = startBlock || 1 - const event = this.instance.RequestCreated( - f, - { fromBlock: start, toBlock: 'latest' } - ); - event.watch(function(e,r){ - callback(e,r); - }); - return event; - } - - async stopWatch(event) { - return new Promise((resolve, reject) => { - event.stopWatching( (err, res) => { - if (!err) { - resolve(res) - } else reject(err) - }) - }) - } - - async getRequestsByBucket(bucket) { - const logs = await this.getRequestCreatedLogs({ - bucket, - }, '', '') - const requests = [] - logs.forEach((log) => { - requests.push({ - address: log.args.request, - params: log.args.params, - }) - }) - return requests - } - - async watchRequestsByBucket(bucket, cb) { - return await this.watchRequestCreatedLogs({ - bucket, - }, '', - (error,log) => { - if (log) { - cb({ - address: log.args.request, - params: log.args.params, - }); - } - }); - } - - // Assume the temporalUnit is blocks if not timestamp. - calcBucket(windowStart, temporalUnit) { - let bucketSize = 240 // block bucketsize - let sign = -1 // block sign - - if (temporalUnit == 2) { - bucketSize = 3600 // timestamp bucketsize - sign = 1 // timestamp sign - } - - return sign * (windowStart - (windowStart % bucketSize)) - } - - async getRequests(startBlock, endBlock) { - const logs = await this.getRequestCreatedLogs({}, startBlock, endBlock) - const requests = [] - logs.forEach((log) => { - requests.push(log.args.request) - }) - return requests - } - - async watchRequests(startBlock, callback) { - return await this.watchRequestCreatedLogs({}, startBlock, - (error,log) => { - if (log) { - callback(log.args.request); - } - }); - } - - async getRequestsByOwner(owner, startBlock, endBlock) { - const logs = await this.getRequestCreatedLogs({ - owner, - }, startBlock, endBlock) - const requests = [] - logs.forEach((log) => { - requests.push(log.args.request) - }) - return requests - } - - async watchRequestsByOwner(owner, startBlock, callback) { - return await this.watchRequestCreatedLogs({ - owner, - }, startBlock, (error,log) => { - if (log) { - callback(log.args.request) - } - }); - } - - /** - * Chain inits - */ - - // static initMainnet() { - // throw new Error("Not implemented.") - // } - - // static initRopsten(web3) { - // const address = require("../assets/ropsten.json").requestFactory - // return new RequestFactory(address, web3) - // } - - // static initRinkeby() { - // throw new Error("Not implemented.") - // } - - // static initKovan(web3) { - // const address = require("../assets/kovan.json").requestFactory - // return new RequestFactory(address, web3) - // } -} - -module.exports = RequestFactory diff --git a/lib/scheduling/index.js b/lib/scheduling/index.js deleted file mode 100644 index a99d835..0000000 --- a/lib/scheduling/index.js +++ /dev/null @@ -1,226 +0,0 @@ -/* eslint class-methods-use-this: "off" */ - -const BigNumber = require("bignumber.js") -const Util = require("../util")() - -class Scheduler { - constructor(bSchedulerAddress, tSchedulerAddress, web3) { - this.web3 = web3 - try { - const BlockSchedulerABI = Util.getABI("BlockScheduler") - const TimestampSchedulerABI = Util.getABI("TimestampScheduler") - this.blockScheduler = web3.eth - .contract(BlockSchedulerABI) - .at(bSchedulerAddress) - this.timestampScheduler = web3.eth - .contract(TimestampSchedulerABI) - .at(tSchedulerAddress) - } catch (err) { - throw new Error(err) - } - } - - getFactoryAddress() { - return new Promise((resolve, reject) => { - this.blockScheduler.factoryAddress.call((err, address) => { - if (!err) resolve(address) - else reject(err) - }) - }) - } - - initSender(opts) { - this.sender = opts.from - this.gasLimit = opts.gas - this.sendValue = opts.value - } - - setGas(gasLimit) { - this.gasLimit = gasLimit - } - - setSender(address) { - // TODO verfiy with ethUtil - this.sender = address - } - - setSendValue(value) { - this.sendValue = value - } - - blockSchedule( - toAddress, - callData, - callGas, - callValue, - windowSize, - windowStart, - gasPrice, - fee, - bounty, - requiredDeposit, - waitForMined = true - ) { - return new Promise((resolve, reject) => { - this.blockScheduler.schedule.sendTransaction( - toAddress, - callData, - [ - callGas, - callValue, - windowSize, - windowStart, - gasPrice, - fee, - bounty, - requiredDeposit, - ], - { - from: this.sender, - gas: this.gasLimit, - value: this.sendValue, - }, - (err, txHash) => { - if (err) reject(err) - else { - const miningPromise = Util.waitForTransactionToBeMined(this.web3, txHash); - - if (waitForMined) { - miningPromise - .then(receipt => resolve(receipt)) - .catch(e => reject(e)) - } else { - resolve({ - transactionHash: txHash, - miningPromise - }); - } - } - } - ) - }) - } - - timestampSchedule( - toAddress, - callData, - callGas, - callValue, - windowSize, - windowStart, - gasPrice, - fee, - bounty, - requiredDeposit, - waitForMined = true - ) { - return new Promise((resolve, reject) => { - this.timestampScheduler.schedule( - toAddress, - callData, - [ - callGas, - callValue, - windowSize, - windowStart, - gasPrice, - fee, - bounty, - requiredDeposit, - ], - { - from: this.sender, - gas: this.gasLimit, - value: this.sendValue, - }, - (err, txHash) => { - if (err) reject(err) - else { - const miningPromise = Util.waitForTransactionToBeMined(this.web3, txHash); - - if (waitForMined) { - miningPromise - .then(receipt => resolve(receipt)) - .catch(e => reject(e)) - } else { - resolve({ - transactionHash: txHash, - miningPromise - }); - } - } - } - ) - }) - } - - /** - * Calculates the required endowment for scheduling a transactions - * with the following parameters - * @param {Number|String|BigNumber} callGas - * @param {Number|String|BigNumber} callValue - * @param {Number|String|BigNumber} gasPrice - * @param {Number|String|BigNumber} fee - * @param {Number|String|BigNumber} bounty - */ - calcEndowment(callGas, callValue, gasPrice, fee, bounty) { - // Convert the value to a bignumber works even if it's already one. - const callGasBN = new BigNumber(callGas) - const callValueBN = new BigNumber(callValue) - const gasPriceBN = new BigNumber(gasPrice) - const feeBN = new BigNumber(fee) - const bountyBN = new BigNumber(bounty) - - return bountyBN - .plus(feeBN.times(2)) - .plus(callGasBN.times(gasPrice)) - .plus(gasPriceBN.times(180000)) - .plus(callValueBN) - } - - /** - * Calculates the required endowment for scheduling a transactions - * with the following parameters - * @param {Number|String|BigNumber} callGas - * @param {Number|String|BigNumber} callValue - * @param {Number|String|BigNumber} gasPrice - * @param {Number|String|BigNumber} fee - * @param {Number|String|BigNumber} bount - */ - static calcEndowment(callGas, callValue, gasPrice, fee, bounty) { - // Convert the value to a bignumber works even if it's already one. - const callGasBN = new BigNumber(callGas) - const callValueBN = new BigNumber(callValue) - const gasPriceBN = new BigNumber(gasPrice) - const feeBN = new BigNumber(fee) - const bountyBN = new BigNumber(bounty) - - return bountyBN - .plus(feeBN.times(2)) - .plus(callGasBN.times(gasPrice)) - .plus(gasPriceBN.times(180000)) - .plus(callValueBN) - } - - /** - * Chain inits - */ - - // static initMainnet() { - // throw new Error("Not implemented.") - // } - - // static initRopsten(web3) { - // return new Scheduler(web3, "ropsten") - // } - - // static initRinkeby() { - // throw new Error("Not implemented.") - // } - - // static initKovan(web3) { - // return new Scheduler(web3, "kovan") - // } -} - -module.exports = Scheduler diff --git a/lib/scheduling/testTx.js b/lib/scheduling/testTx.js deleted file mode 100644 index e7362f3..0000000 --- a/lib/scheduling/testTx.js +++ /dev/null @@ -1,45 +0,0 @@ -const Scheduler = require("./index.js") -const BigNumber = require("bignumber.js") - -const main = async (chain, web3) => { - const eacScheduler = new Scheduler(web3, chain) - const me = web3.eth.accounts[0] - - const windowStart = web3.eth.blockNumber + 30 - const gasPrice = web3.toWei("100", "gwei") - const requiredDeposit = 1 - - const callGas = 1212121 - const callValue = 123454321 - const fee = 50 - const bounty = web3.toWei("500", "finney") - - const endowment = eacScheduler.calcEndowment( - new BigNumber(callGas), - new BigNumber(callValue), - new BigNumber(gasPrice), - new BigNumber(fee), - new BigNumber(bounty) - ) - - eacScheduler.initSender({ - from: me, - gas: 3000000, - value: endowment, - }) - - return eacScheduler.blockSchedule( - "0x009f7EfeD908c05df5101DA1557b7CaaB38EE4Ce", - web3.fromAscii("s0x".repeat(Math.floor(Math.random() * 10))), - callGas, - callValue, - 255, // windowSize - windowStart, - gasPrice, - fee, // fee - bounty, // bounty - requiredDeposit - ) -} - -module.exports = main diff --git a/lib/txRequest/index.js b/lib/txRequest/index.js deleted file mode 100644 index a4e6e29..0000000 --- a/lib/txRequest/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./txRequest") diff --git a/lib/txRequest/requestData.js b/lib/txRequest/requestData.js deleted file mode 100644 index 4aef651..0000000 --- a/lib/txRequest/requestData.js +++ /dev/null @@ -1,78 +0,0 @@ -const { BigNumber } = require("bignumber.js") - -class RequestData { - constructor(data, txRequest) { - if (typeof data === "undefined" || typeof txRequest === "undefined") { - throw new Error("Cannot call the constructor directly.") - } - this.txRequest = txRequest - this.fill(data) - } - - fill(data) { - this.claimData = { - claimedBy: data[0][0], - claimDeposit: new BigNumber(data[2][0]), - paymentModifier: parseInt(data[3][0], 10), - requiredDeposit: new BigNumber(data[2][14]), - } - - this.meta = { - createdBy: data[0][1], - owner: data[0][2], - isCancelled: data[1][0], - wasCalled: data[1][1], - wasSuccessful: data[1][2], - } - - this.paymentData = { - feeRecipient: data[0][3], - bountyBenefactor: data[0][4], - fee: new BigNumber(data[2][1]), - feeOwed: new BigNumber(data[2][2]), - bounty: new BigNumber(data[2][3]), - bountyOwed: new BigNumber(data[2][4]), - } - - this.schedule = { - claimWindowSize: new BigNumber(data[2][5]), - freezePeriod: new BigNumber(data[2][6]), - reservedWindowSize: new BigNumber(data[2][7]), - temporalUnit: parseInt(data[2][8], 10), - windowSize: new BigNumber(data[2][9]), - windowStart: new BigNumber(data[2][10]), - } - - this.txData = { - callGas: new BigNumber(data[2][11]), - callValue: new BigNumber(data[2][12]), - gasPrice: new BigNumber(data[2][13]), - toAddress: data[0][5], - } - } - - static from(txRequest) { - return new Promise((resolve, reject) => { - txRequest.requestData.call({ gas: 3000000 }, (err, data) => { - if (err) reject(err) - else { - resolve(new RequestData(data, txRequest)) - } - }) - }) - } - - refresh() { - return new Promise((resolve, reject) => { - this.txRequest.requestData.call((err, data) => { - if (err) reject(err) - else { - this.fill(data) - resolve(true) - } - }) - }) - } -} - -module.exports = RequestData diff --git a/lib/txRequest/txRequest.js b/lib/txRequest/txRequest.js deleted file mode 100644 index 720b44e..0000000 --- a/lib/txRequest/txRequest.js +++ /dev/null @@ -1,466 +0,0 @@ -const { BigNumber } = require("bignumber.js") -const RequestData = require("./requestData") -const Constants = require("../constants") -const Util = require("../util")() - -class TxRequest { - constructor(address, web3) { - if (!Util.checkNotNullAddress(address)) { - throw new Error("Attempted to instantiate a TxRequest class from a null address.") - } - this.web3 = web3 - this.instance = this.web3.eth - .contract(Util.getABI("TransactionRequestCore")) - .at(address) - } - - get address() { - return this.instance.address - } - - /** - * Window centric getters - */ - - get claimWindowSize() { - this.checkData() - return this.data.schedule.claimWindowSize - } - - get claimWindowStart() { - this.checkData() - return this.windowStart.minus(this.freezePeriod).minus(this.claimWindowSize) - } - - get claimWindowEnd() { - this.checkData() - return this.claimWindowStart.plus(this.claimWindowSize) - } - - get freezePeriod() { - this.checkData() - return this.data.schedule.freezePeriod - } - - get freezePeriodStart() { - this.checkData() - return this.windowStart.plus(this.claimWindowSize) - } - - get freezePeriodEnd() { - this.checkData() - return this.claimWindowEnd.plus(this.freezePeriod) - } - - get temporalUnit() { - this.checkData() - return this.data.schedule.temporalUnit - } - - get windowSize() { - this.checkData() - return this.data.schedule.windowSize - } - - get windowStart() { - this.checkData() - return this.data.schedule.windowStart - } - - get reservedWindowSize() { - this.checkData() - return this.data.schedule.reservedWindowSize - } - - get reservedWindowEnd() { - this.checkData() - return this.windowStart.plus(this.reservedWindowSize) - } - - get executionWindowEnd() { - this.checkData() - return this.windowStart.plus(this.windowSize) - } - - /** - * Dynamic getters - */ - - async now() { - if (this.temporalUnit == 1) { - return new BigNumber(await Util.getBlockNumber(this.web3)) - } else if (this.temporalUnit == 2) { - const timestamp = await Util.getTimestamp(this.web3) - return new BigNumber(timestamp) - } - throw new Error(`Unrecognized temporal unit: ${this.temporalUnit}`) - } - - async beforeClaimWindow() { - const now = await this.now() - return this.claimWindowStart.greaterThan(now) - } - - async inClaimWindow() { - const now = await this.now() - return ( - this.claimWindowStart.lessThanOrEqualTo(now) && - this.claimWindowEnd.greaterThan(now) - ) - } - - async inFreezePeriod() { - const now = await this.now() - return ( - this.claimWindowEnd.lessThanOrEqualTo(now) && - this.freezePeriodEnd.greaterThan(now) - ) - } - - async inExecutionWindow() { - const now = await this.now() - return ( - this.windowStart.lessThanOrEqualTo(now) && - this.executionWindowEnd.greaterThanOrEqualTo(now) - ) - } - - async inReservedWindow() { - const now = await this.now() - return ( - this.windowStart.lessThanOrEqualTo(now) && - this.reservedWindowEnd.greaterThan(now) - ) - } - - async afterExecutionWindow() { - const now = await this.now() - return this.executionWindowEnd.lessThan(now) - } - - /** - * - */ - createdAt() { - - } - - async executedAt() { - return (await this.getExecutedEvent()).blockNumber - } - - getExecutedEvent() { - if (!this.wasCalled) { - return {blockNumber: 0} - } - const events = this.instance.allEvents({fromBlock: 0, toBlock: 'latest'}) - return new Promise((resolve, reject) => { - events.get((err, logs) => { - if (!err) { - const Executed = logs.filter(log => log.topics[0] === '0x3e504bb8b225ad41f613b0c3c4205cdd752d1615b4d77cd1773417282fcfb5d9') - resolve({ - blockNumber: Executed[0].blockNumber, - bounty: this.web3.toDecimal('0x' + Executed[0].data.slice(2, 66)), - fee: this.web3.toDecimal('0x' + Executed[0].data.slice(67, 130)), - estimatedGas: this.web3.toDecimal('0x' + Executed[0].data.slice(131, 194)) - }) - } - else reject(err) - }) - }) - } - - getBucket() { - let sign = -1 - let bucketSize; - - if (this.temporalUnit == 1) { - bucketSize = 240 - } else if (this.temporalUnit == 2) { - bucketSize = 3600 - sign = 1 - } - return sign * this.windowStart - (this.windowStart % bucketSize) - } - - /** - * Claim props/methods - */ - - get claimedBy() { - this.checkData() - return this.data.claimData.claimedBy - } - - get isClaimed() { - this.checkData() - return this.data.claimData.claimedBy !== Constants.NULL_ADDRESS - } - - isClaimedBy(address) { - this.checkData() - return this.claimedBy === address - } - - get requiredDeposit() { - this.checkData() - return this.data.claimData.requiredDeposit - } - - async claimPaymentModifier() { - const now = await this.now() - const elapsed = now.minus(this.claimWindowStart) - return elapsed.times(100).dividedToIntegerBy(this.claimWindowSize) - } - - /** - * Meta - */ - - get isCancelled() { - this.checkData() - return this.data.meta.isCancelled - } - - get wasCalled() { - this.checkData() - return this.data.meta.wasCalled - } - - get wasSuccessful() { - this.checkData() - return this.data.meta.wasSuccessful - } - - get owner() { - this.checkData() - return this.data.meta.owner - } - - /** - * TxData - */ - - get toAddress() { - this.checkData() - return this.data.txData.toAddress - } - - get callGas() { - this.checkData() - return this.data.txData.callGas - } - - get callValue() { - this.checkData() - return this.data.txData.callValue - } - - get gasPrice() { - this.checkData() - return this.data.txData.gasPrice - } - - get fee() { - this.checkData() - return this.data.paymentData.fee - } - - get bounty() { - this.checkData() - return this.data.paymentData.bounty - } - - /** - * Call Data - */ - - callData() { - return new Promise((resolve, reject) => { - this.instance.callData.call((err, callData) => { - if (!err) resolve(callData) - else reject(err) - }) - }) - } - - /** - * Data management - */ - - async fillData() { - const requestData = await RequestData.from(this.instance) - this.data = requestData - return true - } - - async refreshData() { - if (!this.data) { - return this.fillData() - } - return this.data.refresh() - } - - /** - * ABI convenience functions - */ - - get claimData() { - return this.instance.claim.getData() - } - - get executeData() { - return this.instance.execute.getData() - } - - get cancelData() { - return this.instance.cancel.getData() - } - - /** - * Action Wrappers - */ - - /** - * @param {Object} params Transaction object including `from`, `gas`, `gasPrice` and `value`. - */ - claim(params) { - return new Promise((resolve, reject) => { - this.instance.claim(params, (err, txHash) => { - if (err) reject(err) - else { - Util.waitForTransactionToBeMined(this.web3, txHash) - .then(receipt => resolve(receipt)) - .catch(e => reject(e)) - } - }) - }) - } - - /** - * @param {Object} params Transaction object including `from`, `gas`, `gasPrice` and `value`. - */ - execute(params) { - return new Promise((resolve, reject) => { - this.instance.execute(params, (err, txHash) => { - if (err) reject(err) - else { - Util.waitForTransactionToBeMined(this.web3, txHash) - .then(receipt => resolve(receipt)) - .catch(e => reject(e)) - } - }) - }) - } - - /** - * @param {Object} params Transaction object including `from`, `gas`, `gasPrice` and `value`. - */ - cancel(params) { - return new Promise((resolve, reject) => { - this.instance.cancel(params, (err, txHash) => { - if (err) reject(err) - else { - Util.waitForTransactionToBeMined(this.web3, txHash) - .then(receipt => resolve(receipt)) - .catch(e => reject(e)) - } - }) - }) - } - - /** - * Proxy - * @param {string} toAddress Ethereum address - * @param {string} data Hex encoded data for the transaction to proxy - * @param {Object} params Transaction object including `from`, `gas`, `gasPrice` and `value`. - */ - proxy(toAddress, data, params) { - return new Promise((resolve, reject) => { - this.instance.proxy(toAddress, data, params, (err, txHash) => { - if (err) reject(err) - else { - Util.waitForTransactionToBeMined(this.web3, txHash) - .then(resolve) // resolves the receipt - .catch(reject) // rejects the error - } - }) - }) - } - - /** - * Pull Payments - */ - - refundClaimDeposit(params) { - return new Promise((resolve, reject) => { - this.instance.refundClaimDeposit(params, (err, txHash) => { - if (err) reject(err) - else { - Util.waitForTransactionToBeMined(this.web3, txHash) - .then(resolve) - .catch(reject) - } - }) - }) - } - - sendFee(params) { - return new Promise((resolve, reject) => { - this.instance.sendFee(params, (err, txHash) => { - if (err) reject(err) - else { - Util.waitForTransactionToBeMined(this.web3, txHash) - .then(resolve) - .catch(reject) - } - }) - }) - } - - sendBounty(params) { - return new Promise((resolve, reject) => { - this.instance.sendBounty(params, (err, txHash) => { - if (err) reject(err) - else { - Util.waitForTransactionToBeMined(this.web3, txHash) - .then(resolve) - .catch(reject) - } - }) - }) - } - - sendOwnerEther(params) { - return new Promise((resolve, reject) => { - this.instance.sendOwnerEther(params, (err, txHash) => { - if (err) reject(err) - else { - Util.waitForTransactionToBeMined(this.web3, txHash) - .then(resolve) - .catch(reject) - } - }) - }) - } - - /** - * Misc. - */ - - async getBalance() { - const bal = await Util.getBalance(this.web3, this.address) - return new BigNumber(bal) - } - - /** - * Error handling - */ - checkData() { - if (!this.data) { - throw new Error('Data has not been filled! Please call `txRequest.fillData()` before using this method.') - } - } -} - -module.exports = TxRequest diff --git a/lib/util.js b/lib/util.js deleted file mode 100644 index 2e8ba1f..0000000 --- a/lib/util.js +++ /dev/null @@ -1,217 +0,0 @@ -/* eslint global-require: "off", import/no-dynamic-require: "off", no-param-reassign: "off" */ - -const { BigNumber } = require("bignumber.js") -const Constants = require("./constants.js") -const ethUtil = require("ethereumjs-util") - -const calcEndowment = (callGas, callValue, gasPrice, fee, bounty) => { - const callGasBN = new BigNumber(callGas) - const callValueBN = new BigNumber(callValue) - const gasPriceBN = new BigNumber(gasPrice) - const feeBN = new BigNumber(fee) - const bountyBN = new BigNumber(bounty) - - return bountyBN - .plus(feeBN) - .plus(callGasBN.times(gasPrice)) - .plus(gasPriceBN.times(180000)) - .plus(callValueBN) -} - -const checkForUnlockedAccount = (web3) => { - return new Promise((resolve, reject) => { - if (web3.eth.defaultAccount == null) { - web3.eth.getAccounts((err, accounts) => { - if (accounts.length < 1) { - reject(new Error("\n error: must have an unlocked account in index -\n")) - } - [web3.eth.defaultAccount] = accounts - resolve(true) - }) - } - }) -} - -const checkNetworkID = (web3) => { - return new Promise((resolve) => { - web3.version.getNetwork((err, netID) => { - // mainnet - if (netID === '1') resolve(false) - // ropsten - else if (netID === '3') resolve(true) - // rinkeby - else if (netID === '4') resolve(false) - // kovan - else if (netID === '42') resolve(true) - // docker - else if (netID === '1001') resolve(true) - // development - else if (netID === '1002') resolve(true) - else resolve(false) - }) - }) -} - -const checkNotNullAddress = (address) => { - if (address === Constants.NULL_ADDRESS) return false - return true -} - -const checkValidAddress = (address) => { - if (!ethUtil.isValidAddress(address)) { - return false - } - return true -} - -/** - * Promise resolves to the amount of gas from web3.eth.estimateGas - * @param {Web3} web3 - * @param {Object} opts Ethereum object options, including `from`, `to`, `value`, and `data` - */ -const estimateGas = (web3, opts) => new Promise((resolve, reject) => { - web3.eth.estimateGas(opts, (err, gas) => { - if (!err) resolve(gas) - else reject(err) - }) -}) - -// / Requires a case sensitive name of the contract and will return the ABI if found. -const getABI = (name) => { - return require(`${__dirname}/build/abi/${name}.json`) -} - -const getBalance = (web3, address) => new Promise((resolve, reject) => { - web3.eth.getBalance(address, (err, bal) => { - if (!err) resolve(bal) - else reject(err) - }) -}) - -const getBlockNumber = web3 => new Promise((resolve, reject) => { - web3.eth.getBlockNumber((err, blockNum) => { - if (!err) resolve(blockNum) - else reject(err) - }) -}) - -const getGasPrice = web3 => new Promise((resolve, reject) => { - web3.eth.getGasPrice((err, gasPrice) => { - if (!err) resolve(gasPrice) - else reject(err) - }) -}) - -const getTimestamp = web3 => new Promise((resolve, reject) => { - web3.eth.getBlock("latest", (err, block) => { - if (!err) resolve(block.timestamp) - else reject(err) - }) -}) - -const getTimestampForBlock = async (web3, blockNum) => { - const curBlockNum = await getBlockNumber(web3) - if (blockNum > curBlockNum) { - throw new Error(`Must pass in a blocknumber at or lower than the current blocknumber. Now: ${curBlockNum} | Tried: ${blockNum}`) - } - return new Promise((resolve, reject) => { - web3.eth.getBlock(blockNum, (err, block) => { - if (!err) resolve(block.timestamp) - else reject(err) - }) - }) -} - -const getTxRequestFromReceipt = (receipt) => { - const log = receipt.logs.find(log => log.topics[0] === Constants.NEWREQUESTLOG) - return "0x".concat(log.data.slice(-40)) -} - -/** - * Returns the string argument of the detected network to be - * passed into eacScheduler. - * @param {Web3} web3 - */ -const getChainName = web3 => new Promise((resolve, reject) => { - web3.version.getNetwork((err, netID) => { - if (!err) { - if (netID === '1') { - // return 'mainnet' - reject(new Error("Not implemented for mainnet")) - } else if (netID === '3') { - resolve("ropsten") - } else if (netID === '4') { - resolve("rinkeby") - } else if (netID === '42') { - resolve("kovan") - } else if (netID === '1001') { - resolve("docker") - } else if (netID === '1002') { - resolve("development") - } else if (netID > 1517361627) { - resolve("tester") - } - } - }) -}) - -const waitForTransactionToBeMined = (web3, txHash, interval) => { - interval = interval || 500 - const txReceiptAsync = (txHash, resolve, reject) => { - web3.eth.getTransactionReceipt(txHash, (err, receipt) => { - if (err) { - reject(err) - } else if (receipt == null) { - setTimeout(() => { - txReceiptAsync(txHash, resolve, reject) - }, interval) - } else { - resolve(receipt) - } - }) - } - return new Promise((resolve, reject) => { - txReceiptAsync(txHash, resolve, reject) - }) -} - -module.exports = (web3) => { - if (!web3) { - return { - calcEndowment, - checkForUnlockedAccount, - checkNetworkID, - checkNotNullAddress, - checkValidAddress, - estimateGas, - getABI, - getBalance, - getBlockNumber, - getChainName, - getGasPrice, - getTimestamp, - getTimestampForBlock, - getTxRequestFromReceipt, - waitForTransactionToBeMined, - } - } - - return { - calcEndowment, - checkForUnlockedAccount: () => checkForUnlockedAccount(web3), - checkNetworkID: () => checkNetworkID(web3), - checkNotNullAddress, - checkValidAddress, - estimateGas: opts => estimateGas(web3, opts), - getABI, - getBalance: address => getBalance(web3, address), - getBlockNumber: () => getBlockNumber(web3), - getChainName: () => getChainName(web3), - getGasPrice: () => getGasPrice(web3), - getTimestamp: () => getTimestamp(web3), - getTimestampForBlock: blockNum => getTimestampForBlock(web3, blockNum), - getTxRequestFromReceipt, - waitForTransactionToBeMined: txHash => - waitForTransactionToBeMined(web3, txHash), - } -} diff --git a/package-lock.json b/package-lock.json index cbacc54..96389ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,12 @@ "integrity": "sha1-Xa+RrXiNa1lqGarSLi5mfk7ICKg=", "dev": true }, + "@types/node": { + "version": "10.5.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.3.tgz", + "integrity": "sha512-jQ1p+SyF/z8ygPxfSPKZKMWazlCgTBSyIaC1UCUvkLHDdxdmPQtQFk02X4WFM31Z1BKMAS3MSAK0cRP2c92n6Q==", + "dev": true + }, "abstract-leveldown": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-3.0.0.tgz", @@ -25,16 +31,10 @@ "integrity": "sha1-63d99gEXI6OxTopywIBcjoZ0a9I=", "dev": true, "requires": { - "mime-types": "2.1.18", + "mime-types": "2.1.19", "negotiator": "0.6.1" } }, - "aes-js": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-0.2.4.tgz", - "integrity": "sha1-lLiBq3FyhtAV+iGeCPtmcJ3aWj0=", - "dev": true - }, "ajv": { "version": "5.5.2", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", @@ -184,23 +184,6 @@ "private": "0.1.8", "slash": "1.0.0", "source-map": "0.5.7" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } } }, "babel-generator": { @@ -766,23 +749,6 @@ "globals": "9.18.0", "invariant": "2.2.4", "lodash": "4.17.10" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } } }, "babel-types": { @@ -813,18 +779,21 @@ "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", "dev": true }, + "backoff": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/backoff/-/backoff-2.5.0.tgz", + "integrity": "sha1-9hbtqdPktmuMp/ynn2lXIsX44m8=", + "dev": true, + "requires": { + "precond": "0.2.3" + } + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, - "base-x": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/base-x/-/base-x-1.1.0.tgz", - "integrity": "sha1-QtPXF0dPnqAiB/bRqh9CaRPut6w=", - "dev": true - }, "base64-js": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", @@ -832,9 +801,9 @@ "dev": true }, "bcrypt-pbkdf": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", + "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", "dev": true, "optional": true, "requires": { @@ -931,23 +900,6 @@ "qs": "6.5.2", "raw-body": "2.3.3", "type-is": "1.6.16" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - } } }, "brace-expansion": { @@ -965,12 +917,6 @@ "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", - "dev": true - }, "browserify-aes": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", @@ -991,19 +937,20 @@ "dev": true, "requires": { "browserify-aes": "1.2.0", - "browserify-des": "1.0.1", + "browserify-des": "1.0.2", "evp_bytestokey": "1.0.3" } }, "browserify-des": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.1.tgz", - "integrity": "sha512-zy0Cobe3hhgpiOM32Tj7KQ3Vl91m0njwsjzZQK1L+JDf11dzP9qIvjreVinsvXrgfjhStXwUWAEpB9D7Gwmayw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", "dev": true, "requires": { "cipher-base": "1.0.4", "des.js": "1.0.0", - "inherits": "2.0.3" + "inherits": "2.0.3", + "safe-buffer": "5.1.2" } }, "browserify-rsa": { @@ -1020,7 +967,6 @@ "version": "0.0.1", "resolved": "https://registry.npmjs.org/browserify-sha3/-/browserify-sha3-0.0.1.tgz", "integrity": "sha1-P/NKMAbvFcD7NWflQbkaI0ASPRE=", - "dev": true, "requires": { "js-sha3": "0.3.1" } @@ -1046,37 +992,18 @@ "integrity": "sha512-WHVocJYavUwVgVViC0ORikPHQquXwVh939TaelZ4WDqpWgTX/FsGhl/+P4qBUAGcRvtOgDgC+xftNWWp2RUTAQ==", "dev": true, "requires": { - "caniuse-lite": "1.0.30000847", - "electron-to-chromium": "1.3.48" - } - }, - "bs58": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/bs58/-/bs58-3.1.0.tgz", - "integrity": "sha1-1MJjiL9IBMrHFBQbGUWqR+XrJI4=", - "dev": true, - "requires": { - "base-x": "1.1.0" - } - }, - "bs58check": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-1.3.4.tgz", - "integrity": "sha1-xSVABzdJEXcU+gQsMEfrj5FRy/g=", - "dev": true, - "requires": { - "bs58": "3.1.0", - "create-hash": "1.2.0" + "caniuse-lite": "1.0.30000865", + "electron-to-chromium": "1.3.52" } }, "buffer": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.1.0.tgz", - "integrity": "sha512-YkIRgwsZwJWTnyQrsBTWefizHh+8GYj3kbL1BTiAQ/9pwpino0G7B2gp5tx/FUBqUlvtxV85KNR3mwfAtv15Yw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.0.tgz", + "integrity": "sha512-nUJyfChH7PMJy75eRDCCKtszSEFokUNXC1hNVSe+o+VdcgvDPLs20k3v8UXI8ruRYAJiYtyRea8mYyqPxoHWDw==", "dev": true, "requires": { "base64-js": "1.3.0", - "ieee754": "1.1.11" + "ieee754": "1.1.12" } }, "buffer-alloc": { @@ -1183,9 +1110,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30000847", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000847.tgz", - "integrity": "sha512-Weo+tRtVWcN2da782Ebx/27hFNEb+KP+uP6tdqAa+2S5bp1zOJhVH9tEpDygagrfvU4QjeuPwi/5VGsgT4SLaA==", + "version": "1.0.30000865", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000865.tgz", + "integrity": "sha512-vs79o1mOSKRGv/1pSkp4EXgl4ZviWeYReXw60XfacPU64uQWZwJT6vZNmxRF9O+6zu71sJwMxLK5JXxbzuVrLw==", "dev": true }, "caseless": { @@ -1219,14 +1146,6 @@ "has-ansi": "2.0.0", "strip-ansi": "3.0.1", "supports-color": "2.0.0" - }, - "dependencies": { - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } } }, "check-error": { @@ -1286,7 +1205,6 @@ "version": "2.3.0", "resolved": "https://registry.npmjs.org/coinstring/-/coinstring-2.3.0.tgz", "integrity": "sha1-zbYzY6lhUCQEolr7gsLibV/2J6Q=", - "dev": true, "requires": { "bs58": "2.0.1", "create-hash": "1.2.0" @@ -1295,8 +1213,7 @@ "bs58": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/bs58/-/bs58-2.0.1.tgz", - "integrity": "sha1-VZCNWPGYKrogCPob7Y+RmYopv40=", - "dev": true + "integrity": "sha1-VZCNWPGYKrogCPob7Y+RmYopv40=" } } }, @@ -1310,9 +1227,9 @@ } }, "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", + "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", "dev": true, "requires": { "graceful-readlink": "1.0.1" @@ -1324,6 +1241,26 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "1.1.0", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "typedarray": "0.0.6" + }, + "dependencies": { + "buffer-from": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", + "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", + "dev": true + } + } + }, "content-disposition": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.2.tgz", @@ -1354,6 +1291,12 @@ "integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw=", "dev": true }, + "cookiejar": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/cookiejar/-/cookiejar-2.1.2.tgz", + "integrity": "sha512-Mw+adcfzPxcPeI+0WlvRrr/3lGVO0bD75SxX6811cxSh1Wbxx7xZBGK1eVtDf6si8rg2lhnUjsVLMFMfbRIuwA==", + "dev": true + }, "core-js": { "version": "2.5.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", @@ -1411,6 +1354,16 @@ "sha.js": "2.4.11" } }, + "cross-fetch": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-2.2.2.tgz", + "integrity": "sha1-pH/09/xxLauo9qaVoRyUhEDUVyM=", + "dev": true, + "requires": { + "node-fetch": "2.1.2", + "whatwg-fetch": "2.0.4" + } + }, "crypto-browserify": { "version": "3.12.0", "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", @@ -1452,12 +1405,12 @@ } }, "debug": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.0.tgz", - "integrity": "sha1-vFlryr52F/Edn6FTYe3tVgi4SZs=", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true, "requires": { - "ms": "0.7.2" + "ms": "2.0.0" } }, "decamelize": { @@ -1502,7 +1455,7 @@ "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", "dev": true, "requires": { - "mimic-response": "1.0.0" + "mimic-response": "1.0.1" } }, "decompress-tar": { @@ -1557,7 +1510,7 @@ "file-type": "3.9.0", "get-stream": "2.3.1", "pify": "2.3.0", - "yauzl": "2.9.1" + "yauzl": "2.10.0" }, "dependencies": { "file-type": { @@ -1626,13 +1579,13 @@ "dev": true, "requires": { "foreach": "2.0.5", - "object-keys": "1.0.11" + "object-keys": "1.0.12" }, "dependencies": { "object-keys": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz", - "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=", + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", "dev": true } } @@ -1680,12 +1633,6 @@ "repeating": "2.0.1" } }, - "diff": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", - "dev": true - }, "diffie-hellman": { "version": "5.0.3", "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", @@ -1720,13 +1667,14 @@ "dev": true }, "ecc-jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", + "integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=", "dev": true, "optional": true, "requires": { - "jsbn": "0.1.1" + "jsbn": "0.1.1", + "safer-buffer": "2.1.2" } }, "ee-first": { @@ -1736,9 +1684,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.48", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.48.tgz", - "integrity": "sha1-07DYWTgUBE4JLs4hCPw6ya6kuQA=", + "version": "1.3.52", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.52.tgz", + "integrity": "sha1-0tnxJwuko7lnuDHEDvcftNmrXOA=", "dev": true }, "elliptic": { @@ -1789,9 +1737,9 @@ } }, "error-ex": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", - "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, "requires": { "is-arrayish": "0.2.1" @@ -1805,8 +1753,8 @@ "requires": { "es-to-primitive": "1.1.1", "function-bind": "1.1.1", - "has": "1.0.1", - "is-callable": "1.1.3", + "has": "1.0.3", + "is-callable": "1.1.4", "is-regex": "1.0.4" } }, @@ -1816,7 +1764,7 @@ "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", "dev": true, "requires": { - "is-callable": "1.1.3", + "is-callable": "1.1.4", "is-date-object": "1.0.1", "is-symbol": "1.0.1" } @@ -1846,28 +1794,20 @@ "dev": true }, "eth-block-tracker": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/eth-block-tracker/-/eth-block-tracker-2.3.1.tgz", - "integrity": "sha512-NamWuMBIl8kmkJFVj8WzGatySTzQPQag4Xr677yFxdVtIxACFbL/dQowk0MzEqIKk93U1TwY3MjVU6mOcwZnKA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/eth-block-tracker/-/eth-block-tracker-3.0.1.tgz", + "integrity": "sha512-WUVxWLuhMmsfenfZvFO5sbl1qFY2IqUlw/FPVmjjdElpqLsZtSG+wPe9Dz7W/sB6e80HgFKknOmKk2eNlznHug==", "dev": true, "requires": { - "async-eventemitter": "github:ahultgren/async-eventemitter#fa06e39e56786ba541c180061dbf2c0a5bbf951c", "eth-query": "2.1.2", - "ethereumjs-tx": "1.3.4", + "ethereumjs-tx": "1.3.7", "ethereumjs-util": "5.2.0", "ethjs-util": "0.1.4", "json-rpc-engine": "3.7.3", "pify": "2.3.0", - "tape": "4.9.0" + "tape": "4.9.1" }, "dependencies": { - "async-eventemitter": { - "version": "github:ahultgren/async-eventemitter#fa06e39e56786ba541c180061dbf2c0a5bbf951c", - "dev": true, - "requires": { - "async": "2.6.1" - } - }, "pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", @@ -1876,6 +1816,61 @@ } } }, + "eth-json-rpc-infura": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/eth-json-rpc-infura/-/eth-json-rpc-infura-3.1.2.tgz", + "integrity": "sha512-IuK5Iowfs6taluA/3Okmu6EfZcFMq6MQuyrUL1PrCoJstuuBr3TvVeSy3keDyxfbrjFB34nCo538I8G+qMtsbw==", + "dev": true, + "requires": { + "cross-fetch": "2.2.2", + "eth-json-rpc-middleware": "1.6.0", + "json-rpc-engine": "3.7.3", + "json-rpc-error": "2.0.0", + "tape": "4.9.1" + } + }, + "eth-json-rpc-middleware": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/eth-json-rpc-middleware/-/eth-json-rpc-middleware-1.6.0.tgz", + "integrity": "sha512-tDVCTlrUvdqHKqivYMjtFZsdD7TtpNLBCfKAcOpaVs7orBMS/A8HWro6dIzNtTZIR05FAbJ3bioFOnZpuCew9Q==", + "dev": true, + "requires": { + "async": "2.6.1", + "eth-query": "2.1.2", + "eth-tx-summary": "3.2.3", + "ethereumjs-block": "1.7.1", + "ethereumjs-tx": "1.3.7", + "ethereumjs-util": "5.2.0", + "ethereumjs-vm": "2.3.5", + "fetch-ponyfill": "4.1.0", + "json-rpc-engine": "3.7.3", + "json-rpc-error": "2.0.0", + "json-stable-stringify": "1.0.1", + "promise-to-callback": "1.0.0", + "tape": "4.9.1" + }, + "dependencies": { + "ethereum-common": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/ethereum-common/-/ethereum-common-0.2.0.tgz", + "integrity": "sha512-XOnAR/3rntJgbCdGhqdaLIxDLWKLmsZOGhHdBKadEr6gEnJLH52k93Ou+TUdFaPN3hJc3isBZBal3U/XZ15abA==", + "dev": true + }, + "ethereumjs-block": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/ethereumjs-block/-/ethereumjs-block-1.7.1.tgz", + "integrity": "sha512-B+sSdtqm78fmKkBq78/QLKJbu/4Ts4P2KFISdgcuZUPDm9x+N7qgBPIIFUGbaakQh8bzuquiRVbdmvPKqbILRg==", + "dev": true, + "requires": { + "async": "2.6.1", + "ethereum-common": "0.2.0", + "ethereumjs-tx": "1.3.7", + "ethereumjs-util": "5.2.0", + "merkle-patricia-tree": "2.3.1" + } + } + } + }, "eth-lib": { "version": "0.1.27", "resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.1.27.tgz", @@ -1907,10 +1902,129 @@ "integrity": "sha1-jZWCAsftuq6Dlwf7pvCf8ydgYhA=", "dev": true, "requires": { - "ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#4ea2fdfed09e8f99117d9362d17c6b01b64a2bcf", + "ethereumjs-abi": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7", "ethereumjs-util": "5.2.0" } }, + "eth-tx-summary": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/eth-tx-summary/-/eth-tx-summary-3.2.3.tgz", + "integrity": "sha512-1gZpA5fKarJOVSb5OUlPnhDQuIazqAkI61zlVvf5LdG47nEgw+/qhyZnuj3CUdE/TLTKuRzPLeyXLjaB4qWTRQ==", + "dev": true, + "requires": { + "async": "2.6.1", + "bn.js": "4.11.8", + "clone": "2.1.1", + "concat-stream": "1.6.2", + "end-of-stream": "1.4.1", + "eth-query": "2.1.2", + "ethereumjs-block": "1.7.1", + "ethereumjs-tx": "1.3.7", + "ethereumjs-util": "5.2.0", + "ethereumjs-vm": "2.3.4", + "through2": "2.0.3", + "treeify": "1.1.0", + "web3-provider-engine": "13.8.0" + }, + "dependencies": { + "eth-block-tracker": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/eth-block-tracker/-/eth-block-tracker-2.3.1.tgz", + "integrity": "sha512-NamWuMBIl8kmkJFVj8WzGatySTzQPQag4Xr677yFxdVtIxACFbL/dQowk0MzEqIKk93U1TwY3MjVU6mOcwZnKA==", + "dev": true, + "requires": { + "async-eventemitter": "github:ahultgren/async-eventemitter#fa06e39e56786ba541c180061dbf2c0a5bbf951c", + "eth-query": "2.1.2", + "ethereumjs-tx": "1.3.7", + "ethereumjs-util": "5.2.0", + "ethjs-util": "0.1.4", + "json-rpc-engine": "3.7.3", + "pify": "2.3.0", + "tape": "4.9.1" + }, + "dependencies": { + "async-eventemitter": { + "version": "github:ahultgren/async-eventemitter#fa06e39e56786ba541c180061dbf2c0a5bbf951c", + "dev": true, + "requires": { + "async": "2.6.1" + } + } + } + }, + "ethereum-common": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/ethereum-common/-/ethereum-common-0.2.0.tgz", + "integrity": "sha512-XOnAR/3rntJgbCdGhqdaLIxDLWKLmsZOGhHdBKadEr6gEnJLH52k93Ou+TUdFaPN3hJc3isBZBal3U/XZ15abA==", + "dev": true + }, + "ethereumjs-block": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/ethereumjs-block/-/ethereumjs-block-1.7.1.tgz", + "integrity": "sha512-B+sSdtqm78fmKkBq78/QLKJbu/4Ts4P2KFISdgcuZUPDm9x+N7qgBPIIFUGbaakQh8bzuquiRVbdmvPKqbILRg==", + "dev": true, + "requires": { + "async": "2.6.1", + "ethereum-common": "0.2.0", + "ethereumjs-tx": "1.3.7", + "ethereumjs-util": "5.2.0", + "merkle-patricia-tree": "2.3.1" + } + }, + "ethereumjs-vm": { + "version": "2.3.4", + "resolved": "https://registry.npmjs.org/ethereumjs-vm/-/ethereumjs-vm-2.3.4.tgz", + "integrity": "sha512-Y4SlzNDqxrCO58jhp98HdnZVdjOqB+HC0hoU+N/DEp1aU+hFkRX/nru5F7/HkQRPIlA6aJlQp/xIA6xZs1kspw==", + "dev": true, + "requires": { + "async": "2.6.1", + "async-eventemitter": "0.2.4", + "ethereum-common": "0.2.0", + "ethereumjs-account": "2.0.5", + "ethereumjs-block": "1.7.1", + "ethereumjs-util": "5.2.0", + "fake-merkle-patricia-tree": "1.0.1", + "functional-red-black-tree": "1.0.1", + "merkle-patricia-tree": "2.3.1", + "rustbn.js": "0.1.2", + "safe-buffer": "5.1.2" + } + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "web3-provider-engine": { + "version": "13.8.0", + "resolved": "https://registry.npmjs.org/web3-provider-engine/-/web3-provider-engine-13.8.0.tgz", + "integrity": "sha512-fZXhX5VWwWpoFfrfocslyg6P7cN3YWPG/ASaevNfeO80R+nzgoPUBXcWQekSGSsNDkeRTis4aMmpmofYf1TNtQ==", + "dev": true, + "requires": { + "async": "2.6.1", + "clone": "2.1.1", + "eth-block-tracker": "2.3.1", + "eth-sig-util": "1.4.2", + "ethereumjs-block": "1.7.1", + "ethereumjs-tx": "1.3.7", + "ethereumjs-util": "5.2.0", + "ethereumjs-vm": "2.3.4", + "fetch-ponyfill": "4.1.0", + "json-rpc-error": "2.0.0", + "json-stable-stringify": "1.0.1", + "promise-to-callback": "1.0.0", + "readable-stream": "2.3.6", + "request": "2.87.0", + "semaphore": "1.1.0", + "solc": "0.4.24", + "tape": "4.9.1", + "xhr": "2.5.0", + "xtend": "4.0.1" + } + } + } + }, "ethereum-common": { "version": "0.0.16", "resolved": "https://registry.npmjs.org/ethereum-common/-/ethereum-common-0.0.16.tgz", @@ -1918,7 +2032,7 @@ "dev": true }, "ethereumjs-abi": { - "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#4ea2fdfed09e8f99117d9362d17c6b01b64a2bcf", + "version": "git+https://github.com/ethereumjs/ethereumjs-abi.git#00ba8463a7f7a67fcad737ff9c2ebd95643427f7", "dev": true, "requires": { "bn.js": "4.11.8", @@ -1944,7 +2058,7 @@ "requires": { "async": "1.5.2", "ethereum-common": "0.0.16", - "ethereumjs-tx": "1.3.4", + "ethereumjs-tx": "1.3.7", "ethereumjs-util": "4.5.0", "merkle-patricia-tree": "2.3.1" }, @@ -1971,9 +2085,9 @@ } }, "ethereumjs-tx": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/ethereumjs-tx/-/ethereumjs-tx-1.3.4.tgz", - "integrity": "sha512-kOgUd5jC+0tgV7t52UDECMMz9Uf+Lro+6fSpCvzWemtXfMEcwI3EOxf5mVPMRbTFkMMhuERokNNVF3jItAjidg==", + "version": "1.3.7", + "resolved": "https://registry.npmjs.org/ethereumjs-tx/-/ethereumjs-tx-1.3.7.tgz", + "integrity": "sha512-wvLMxzt1RPhAQ9Yi3/HKZTn0FZYpnsmQdbKYfUUpi4j1SEIcbkd9tndVjcPrufY3V7j2IebOpC00Zp2P/Ay2kA==", "dev": true, "requires": { "ethereum-common": "0.0.18", @@ -2003,9 +2117,9 @@ } }, "ethereumjs-vm": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/ethereumjs-vm/-/ethereumjs-vm-2.3.3.tgz", - "integrity": "sha512-yIWJqTEcrF9vJTCvNMxacRkAx6zIZTOW0SmSA+hSFiU1x8JyVZDi9o5udwsRVECT5RkPgQzm62kpL6Pf4qemsw==", + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/ethereumjs-vm/-/ethereumjs-vm-2.3.5.tgz", + "integrity": "sha512-AJ7x44+xqyE5+UO3Nns19WkTdZfyqFZ+sEjIEpvme7Ipbe3iBU1uwCcHEdiu/yY9bdhr3IfSa/NfIKNeXPaRVQ==", "dev": true, "requires": { "async": "2.6.1", @@ -2035,7 +2149,7 @@ "requires": { "async": "2.6.1", "ethereum-common": "0.2.0", - "ethereumjs-tx": "1.3.4", + "ethereumjs-tx": "1.3.7", "ethereumjs-util": "5.2.0", "merkle-patricia-tree": "2.3.1" } @@ -2046,7 +2160,6 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/ethereumjs-wallet/-/ethereumjs-wallet-0.6.0.tgz", "integrity": "sha1-gnY7Fpfuenlr5xVdqd+0my+Yz9s=", - "dev": true, "requires": { "aes-js": "0.2.4", "bs58check": "1.3.4", @@ -2057,11 +2170,37 @@ "uuid": "2.0.3" }, "dependencies": { + "aes-js": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-0.2.4.tgz", + "integrity": "sha1-lLiBq3FyhtAV+iGeCPtmcJ3aWj0=" + }, + "base-x": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-1.1.0.tgz", + "integrity": "sha1-QtPXF0dPnqAiB/bRqh9CaRPut6w=" + }, + "bs58": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-3.1.0.tgz", + "integrity": "sha1-1MJjiL9IBMrHFBQbGUWqR+XrJI4=", + "requires": { + "base-x": "1.1.0" + } + }, + "bs58check": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-1.3.4.tgz", + "integrity": "sha1-xSVABzdJEXcU+gQsMEfrj5FRy/g=", + "requires": { + "bs58": "3.1.0", + "create-hash": "1.2.0" + } + }, "ethereumjs-util": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-4.5.0.tgz", "integrity": "sha1-PpQosxfuvaPXJg2FT93alUsfG8Y=", - "dev": true, "requires": { "bn.js": "4.11.8", "create-hash": "1.2.0", @@ -2069,6 +2208,20 @@ "rlp": "2.0.0", "secp256k1": "3.5.0" } + }, + "hdkey": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/hdkey/-/hdkey-0.7.1.tgz", + "integrity": "sha1-yu5L6BqneSHpCbjSKN0PKayu5jI=", + "requires": { + "coinstring": "2.3.0", + "secp256k1": "3.5.0" + } + }, + "uuid": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", + "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=" } } }, @@ -2164,7 +2317,7 @@ "on-finished": "2.3.0", "parseurl": "1.3.2", "path-to-regexp": "0.1.7", - "proxy-addr": "2.0.3", + "proxy-addr": "2.0.4", "qs": "6.5.1", "range-parser": "1.2.0", "safe-buffer": "5.1.1", @@ -2195,27 +2348,12 @@ "type-is": "1.6.16" } }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, "iconv-lite": { "version": "0.4.19", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz", "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ==", "dev": true }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "qs": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.1.tgz", @@ -2275,9 +2413,9 @@ } }, "extend": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", "dev": true }, "extsprintf": { @@ -2308,9 +2446,9 @@ "dev": true }, "fd-slicer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.0.1.tgz", - "integrity": "sha1-i1vL2ewyfFBBv5qwI/1nUPEXfmU=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", "dev": true, "requires": { "pend": "1.2.0" @@ -2323,6 +2461,18 @@ "dev": true, "requires": { "node-fetch": "1.7.3" + }, + "dependencies": { + "node-fetch": { + "version": "1.7.3", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", + "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", + "dev": true, + "requires": { + "encoding": "0.1.12", + "is-stream": "1.1.0" + } + } } }, "file-type": { @@ -2346,21 +2496,6 @@ "unpipe": "1.0.0" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "statuses": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", @@ -2380,12 +2515,12 @@ } }, "for-each": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.2.tgz", - "integrity": "sha1-LEBFC5NI6X8oEyJZO6lnBLmr1NQ=", + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", + "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", "dev": true, "requires": { - "is-function": "1.0.1" + "is-callable": "1.1.4" } }, "foreach": { @@ -2408,7 +2543,7 @@ "requires": { "asynckit": "0.4.0", "combined-stream": "1.0.6", - "mime-types": "2.1.18" + "mime-types": "2.1.19" } }, "forwarded": { @@ -2497,9 +2632,9 @@ "dev": true }, "ganache-core": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/ganache-core/-/ganache-core-2.1.0.tgz", - "integrity": "sha512-zUO61d23XHBCYOUjEQjIuENcfa6EQNBHKuG2oXWdTdGyu5Gbm4fXX9klZ2jjl9ZnBD2T4BaeBXycsLmL0S/d2w==", + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ganache-core/-/ganache-core-2.1.2.tgz", + "integrity": "sha512-em+s17KNr6VjPSc5uN+kDGjtScEqW6vKYWBVwjtuTbKLRMyKL90bs8qBm2VHLfZvErOymhNomILVKIis5Vn/mA==", "dev": true, "requires": { "abstract-leveldown": "3.0.0", @@ -2511,28 +2646,27 @@ "clone": "2.1.1", "ethereumjs-account": "2.0.5", "ethereumjs-block": "1.2.2", - "ethereumjs-tx": "1.3.4", + "ethereumjs-tx": "1.3.7", "ethereumjs-util": "5.2.0", - "ethereumjs-vm": "2.3.3", + "ethereumjs-vm": "2.3.5", "ethereumjs-wallet": "0.6.0", "fake-merkle-patricia-tree": "1.0.1", "heap": "0.2.6", "js-scrypt": "0.2.0", - "level-sublevel": "6.6.2", + "level-sublevel": "6.6.5", "levelup": "1.3.9", "localstorage-down": "0.6.7", "lodash": "4.17.10", "merkle-patricia-tree": "2.3.1", - "mocha": "3.3.0", "pify": "3.0.0", "prepend-file": "1.3.1", "seedrandom": "2.4.3", "shebang-loader": "0.0.1", - "solc": "0.4.18", + "solc": "0.4.24", "temp": "0.8.3", "tmp": "0.0.31", - "web3": "1.0.0-beta.34", - "web3-provider-engine": "13.8.0", + "web3": "1.0.0-beta.35", + "web3-provider-engine": "14.0.6", "websocket": "1.0.26", "yargs": "7.1.0" }, @@ -2571,25 +2705,6 @@ } } }, - "mocha": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.3.0.tgz", - "integrity": "sha1-0pt0KNP1LILi5l3x7LcGThqrv7U=", - "dev": true, - "requires": { - "browser-stdout": "1.3.0", - "commander": "2.9.0", - "debug": "2.6.0", - "diff": "3.2.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.1", - "growl": "1.9.2", - "json3": "3.3.2", - "lodash.create": "3.1.1", - "mkdirp": "0.5.1", - "supports-color": "3.1.2" - } - }, "type-detect": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-1.0.0.tgz", @@ -2597,18 +2712,18 @@ "dev": true }, "web3": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3/-/web3-1.0.0-beta.34.tgz", - "integrity": "sha1-NH5WG3hAmMtVYzFfSQR5odkfKrE=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3/-/web3-1.0.0-beta.35.tgz", + "integrity": "sha512-xwDmUhvTcHQvvNnOPcPZZgCxKUsI2e+GbHy7JkTK3/Rmnutazy8x7fsAXT9myw7V1qpi3GgLoZ3fkglSUbg1Mg==", "dev": true, "requires": { - "web3-bzz": "1.0.0-beta.34", - "web3-core": "1.0.0-beta.34", - "web3-eth": "1.0.0-beta.34", - "web3-eth-personal": "1.0.0-beta.34", - "web3-net": "1.0.0-beta.34", - "web3-shh": "1.0.0-beta.34", - "web3-utils": "1.0.0-beta.34" + "web3-bzz": "1.0.0-beta.35", + "web3-core": "1.0.0-beta.35", + "web3-eth": "1.0.0-beta.35", + "web3-eth-personal": "1.0.0-beta.35", + "web3-net": "1.0.0-beta.35", + "web3-shh": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35" } } } @@ -2620,9 +2735,9 @@ "dev": true }, "get-caller-file": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", + "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", "dev": true }, "get-func-name": { @@ -2647,9 +2762,9 @@ } }, "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true, "requires": { "fs.realpath": "1.0.0", @@ -2710,12 +2825,6 @@ "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", "dev": true }, - "growl": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", - "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", - "dev": true - }, "har-schema": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", @@ -2733,9 +2842,9 @@ } }, "has": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", - "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, "requires": { "function-bind": "1.1.1" @@ -2750,12 +2859,6 @@ "ansi-regex": "2.1.1" } }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, "has-localstorage": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-localstorage/-/has-localstorage-1.0.1.tgz", @@ -2795,16 +2898,6 @@ "minimalistic-assert": "1.0.1" } }, - "hdkey": { - "version": "0.7.1", - "resolved": "https://registry.npmjs.org/hdkey/-/hdkey-0.7.1.tgz", - "integrity": "sha1-yu5L6BqneSHpCbjSKN0PKayu5jI=", - "dev": true, - "requires": { - "coinstring": "2.3.0", - "secp256k1": "3.5.0" - } - }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -2838,9 +2931,9 @@ } }, "hosted-git-info": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.6.0.tgz", - "integrity": "sha512-lIbgIIQA3lz5XaB6vxakj6sDHADJiZadYEJB+FgA+C4nubM1NwcuvUr9EJPmnH1skZqpqUzWborWo8EIUi0Sdw==", + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", + "integrity": "sha512-7T/BxH19zbcCTa8XkMlbK5lTo1WtgkFi3GvdWEyNuc4Vex7/9Dqbnpsf4JMydcfj9HCg4zUWFTL3Za6lapg5/w==", "dev": true }, "http-errors": { @@ -2869,7 +2962,7 @@ "requires": { "assert-plus": "1.0.0", "jsprim": "1.4.1", - "sshpk": "1.14.1" + "sshpk": "1.14.2" } }, "humble-localstorage": { @@ -2892,9 +2985,9 @@ } }, "ieee754": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.11.tgz", - "integrity": "sha512-VhDzCKN7K8ufStx/CLj5/PDTMgph+qwN5Pkd5i0sGnVwk56zJ0lkT8Qzi1xqWLS0Wp29DgDtNeS7v8/wMoZeHg==", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", + "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==", "dev": true }, "immediate": { @@ -2924,7 +3017,7 @@ "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", "dev": true, "requires": { - "loose-envify": "1.3.1" + "loose-envify": "1.4.0" } }, "invert-kv": { @@ -2934,9 +3027,9 @@ "dev": true }, "ipaddr.js": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.6.0.tgz", - "integrity": "sha1-4/o1e3c9phnybpXwSdBVxyeW+Gs=", + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.8.0.tgz", + "integrity": "sha1-6qM9bd16zo9/b+DJygRA5wZzix4=", "dev": true }, "is-arrayish": { @@ -2955,9 +3048,9 @@ } }, "is-callable": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz", - "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", "dev": true }, "is-date-object": { @@ -3025,7 +3118,7 @@ "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", "dev": true, "requires": { - "has": "1.0.1" + "has": "1.0.3" } }, "is-retry-allowed": { @@ -3092,8 +3185,7 @@ "js-sha3": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.3.1.tgz", - "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=", - "dev": true + "integrity": "sha1-hhIoAhQvCChQKg0d7h2V4lO7AkM=" }, "js-tokens": { "version": "3.0.2", @@ -3170,12 +3262,6 @@ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, "json5": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", @@ -3224,7 +3310,6 @@ "version": "0.2.1", "resolved": "https://registry.npmjs.org/keccakjs/-/keccakjs-0.2.1.tgz", "integrity": "sha1-HWM6+QfvMFu/ny+mFtVsRFYd+k0=", - "dev": true, "requires": { "browserify-sha3": "0.0.1", "sha3": "1.2.2" @@ -3299,9 +3384,9 @@ } }, "level-sublevel": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/level-sublevel/-/level-sublevel-6.6.2.tgz", - "integrity": "sha512-+hptqmFYPKFju9QG4F6scvx3ZXkhrSmmhYui+hPzRn/jiC3DJ6VNZRKsIhGMpeajVBWfRV7XiysUThrJ/7PgXQ==", + "version": "6.6.5", + "resolved": "https://registry.npmjs.org/level-sublevel/-/level-sublevel-6.6.5.tgz", + "integrity": "sha512-SBSR60x+dghhwGUxPKS+BvV1xNqnwsEUBKmnFepPaHJ6VkBXyPK9SImGc3K2BkwBfpxlt7GKkBNlCnrdufsejA==", "dev": true, "requires": { "bytewise": "1.1.0", @@ -3508,80 +3593,12 @@ "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", "dev": true }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", - "dev": true, - "requires": { - "lodash._basecopy": "3.0.1", - "lodash.keys": "3.1.2" - } - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._basecreate": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, "lodash.assign": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=", "dev": true }, - "lodash.create": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", - "dev": true, - "requires": { - "lodash._baseassign": "3.2.0", - "lodash._basecreate": "3.0.3", - "lodash._isiterateecall": "3.0.9" - } - }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "dev": true, - "requires": { - "lodash._getnative": "3.9.1", - "lodash.isarguments": "3.1.0", - "lodash.isarray": "3.0.4" - } - }, "looper": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/looper/-/looper-2.0.0.tgz", @@ -3589,9 +3606,9 @@ "dev": true }, "loose-envify": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", - "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", "dev": true, "requires": { "js-tokens": "3.0.2" @@ -3726,24 +3743,24 @@ "dev": true }, "mime-db": { - "version": "1.33.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz", - "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ==", + "version": "1.35.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", + "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==", "dev": true }, "mime-types": { - "version": "2.1.18", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz", - "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==", + "version": "2.1.19", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", + "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", "dev": true, "requires": { - "mime-db": "1.33.0" + "mime-db": "1.35.0" } }, "mimic-response": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.0.tgz", - "integrity": "sha1-3z02Uqc/3ta5sLJBRub9BSNTRY4=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", + "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", "dev": true }, "min-document": { @@ -3900,9 +3917,9 @@ "dev": true }, "ms": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", - "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, "mz": { @@ -3934,14 +3951,10 @@ "dev": true }, "node-fetch": { - "version": "1.7.3", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.3.tgz", - "integrity": "sha512-NhZ4CsKx7cYm2vSrBAr2PvFOe6sWDf0UYLRqA6svUYg7+/TSfVAu49jYC4BvQ4Sms9SZgdqGBgroqfDhJdTyKQ==", - "dev": true, - "requires": { - "encoding": "0.1.12", - "is-stream": "1.1.0" - } + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.1.2.tgz", + "integrity": "sha1-q4hOjn5X44qUR1POxwb3iNF2i7U=", + "dev": true }, "normalize-package-data": { "version": "2.4.0", @@ -3949,7 +3962,7 @@ "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "dev": true, "requires": { - "hosted-git-info": "2.6.0", + "hosted-git-info": "2.7.1", "is-builtin-module": "1.0.0", "semver": "5.4.1", "validate-npm-package-license": "3.0.3" @@ -3992,9 +4005,9 @@ "dev": true }, "object-inspect": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.5.0.tgz", - "integrity": "sha512-UmOFbHbwvv+XHj7BerrhVq+knjceBdkvU5AriwLMvhv2qi+e7DJzxfBeFpILEjVzCp+xA+W/pIf06RGPWlZNfw==", + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.6.0.tgz", + "integrity": "sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ==", "dev": true }, "object-keys": { @@ -4091,7 +4104,7 @@ "integrity": "sha1-aug6eqJanZtwCswoaYzR8e1+lTY=", "dev": true, "requires": { - "for-each": "0.3.2", + "for-each": "0.3.3", "trim": "0.0.1" } }, @@ -4101,7 +4114,7 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true, "requires": { - "error-ex": "1.3.1" + "error-ex": "1.3.2" } }, "parseurl": { @@ -4166,7 +4179,6 @@ "version": "3.0.16", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", - "dev": true, "requires": { "create-hash": "1.2.0", "create-hmac": "1.1.7", @@ -4208,6 +4220,12 @@ "pinkie": "2.0.4" } }, + "precond": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/precond/-/precond-0.2.3.tgz", + "integrity": "sha1-qpWRvKokkj8eD0hJ0kD0fvwQdaw=", + "dev": true + }, "prepend-file": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/prepend-file/-/prepend-file-1.3.1.tgz", @@ -4252,13 +4270,13 @@ } }, "proxy-addr": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.3.tgz", - "integrity": "sha512-jQTChiCJteusULxjBp8+jftSQE5Obdl3k4cnmLA6WXtK6XFuWRnvVL7aCiBqaLPM8c4ph0S4tKna8XvmIwEnXQ==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.4.tgz", + "integrity": "sha512-5erio2h9jp5CHGwcybmxmVqHmnCBZeewlfJ0pex+UW7Qny7OOZXTtH56TGNyBizkgiOwhJtMKrVzDTeKcySZwA==", "dev": true, "requires": { "forwarded": "0.1.2", - "ipaddr.js": "1.6.0" + "ipaddr.js": "1.8.0" } }, "prr": { @@ -4531,7 +4549,7 @@ "aws4": "1.7.0", "caseless": "0.12.0", "combined-stream": "1.0.6", - "extend": "3.0.1", + "extend": "3.0.2", "forever-agent": "0.6.1", "form-data": "2.3.2", "har-validator": "5.0.3", @@ -4539,22 +4557,14 @@ "is-typedarray": "1.0.0", "isstream": "0.1.2", "json-stringify-safe": "5.0.1", - "mime-types": "2.1.18", + "mime-types": "2.1.19", "oauth-sign": "0.8.2", "performance-now": "2.1.0", "qs": "6.5.2", "safe-buffer": "5.1.2", "tough-cookie": "2.3.4", "tunnel-agent": "0.6.0", - "uuid": "3.2.1" - }, - "dependencies": { - "uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", - "dev": true - } + "uuid": "3.3.2" } }, "require-directory": { @@ -4576,9 +4586,9 @@ "dev": true }, "resolve": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.5.0.tgz", - "integrity": "sha512-hgoSGrc3pjzAPHNBg+KnFcK2HwlHTs/YrAGUr6qgTVUZmXv1UEXXl0bZNBKMA9fud6lRYFdPGz0xXxycPzmmiw==", + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", + "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", "dev": true, "requires": { "path-parse": "1.0.5" @@ -4599,7 +4609,7 @@ "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", "dev": true, "requires": { - "glob": "7.1.1" + "glob": "7.1.2" } }, "ripemd160": { @@ -4637,7 +4647,6 @@ "version": "6.0.3", "resolved": "https://registry.npmjs.org/scrypt/-/scrypt-6.0.3.tgz", "integrity": "sha1-BOAUpWgrU/pQwtXM4WfXGcBthw0=", - "dev": true, "requires": { "nan": "2.10.0" } @@ -4646,7 +4655,6 @@ "version": "0.2.0", "resolved": "https://registry.npmjs.org/scrypt.js/-/scrypt.js-0.2.0.tgz", "integrity": "sha1-r40UZbcemZARC+38WTuUeeA6ito=", - "dev": true, "requires": { "scrypt": "6.0.3", "scryptsy": "1.2.1" @@ -4656,7 +4664,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/scryptsy/-/scryptsy-1.2.1.tgz", "integrity": "sha1-oyJfpLJST4AnAHYeKFW987LZIWM=", - "dev": true, "requires": { "pbkdf2": "3.0.16" } @@ -4689,17 +4696,6 @@ "dev": true, "requires": { "commander": "2.8.1" - }, - "dependencies": { - "commander": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.8.1.tgz", - "integrity": "sha1-Br42f+v9oMMwqh4qBy09yXYkJdQ=", - "dev": true, - "requires": { - "graceful-readlink": "1.0.1" - } - } } }, "semaphore": { @@ -4735,21 +4731,6 @@ "statuses": "1.4.0" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "statuses": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.4.0.tgz", @@ -4820,7 +4801,6 @@ "version": "1.2.2", "resolved": "https://registry.npmjs.org/sha3/-/sha3-1.2.2.tgz", "integrity": "sha1-pmxQmN5MJbyIM27ItIF9AFvKe6k=", - "dev": true, "requires": { "nan": "2.10.0" } @@ -4855,9 +4835,9 @@ "dev": true }, "solc": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/solc/-/solc-0.4.18.tgz", - "integrity": "sha512-Kq+O3PNF9Pfq7fB+lDYAuoqRdghLmZyfngsg0h1Hj38NKAeVHeGPOGeZasn5KqdPeCzbMFvaGyTySxzGv6aXCg==", + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/solc/-/solc-0.4.24.tgz", + "integrity": "sha512-2xd7Cf1HeVwrIb6Bu1cwY2/TaLRodrppCq3l7rhLimFQgmxptXhTC3+/wesVLpB09F1A2kZgvbMOgH7wvhFnBQ==", "dev": true, "requires": { "fs-extra": "0.30.0", @@ -4875,7 +4855,7 @@ "requires": { "cliui": "3.2.0", "decamelize": "1.2.0", - "get-caller-file": "1.0.2", + "get-caller-file": "1.0.3", "lodash.assign": "4.2.0", "os-locale": "1.4.0", "read-pkg-up": "1.0.1", @@ -4939,18 +4919,19 @@ "dev": true }, "sshpk": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.1.tgz", - "integrity": "sha1-Ew9Zde3a2WPx1W+SuaxsUfqfg+s=", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", + "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=", "dev": true, "requires": { "asn1": "0.2.3", "assert-plus": "1.0.0", - "bcrypt-pbkdf": "1.0.1", + "bcrypt-pbkdf": "1.0.2", "dashdash": "1.14.1", - "ecc-jsbn": "0.1.1", + "ecc-jsbn": "0.1.2", "getpass": "0.1.7", "jsbn": "0.1.1", + "safer-buffer": "2.1.2", "tweetnacl": "0.14.5" } }, @@ -5048,13 +5029,10 @@ } }, "supports-color": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", - "dev": true, - "requires": { - "has-flag": "1.0.0" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true }, "swarm-js": { "version": "0.1.37", @@ -5063,13 +5041,13 @@ "dev": true, "requires": { "bluebird": "3.5.1", - "buffer": "5.1.0", + "buffer": "5.2.0", "decompress": "4.2.0", "eth-lib": "0.1.27", "fs-extra": "2.1.2", "fs-promise": "2.0.3", "got": "7.1.0", - "mime-types": "2.1.18", + "mime-types": "2.1.19", "mkdirp-promise": "5.0.1", "mock-fs": "4.5.0", "setimmediate": "1.0.5", @@ -5090,40 +5068,26 @@ } }, "tape": { - "version": "4.9.0", - "resolved": "https://registry.npmjs.org/tape/-/tape-4.9.0.tgz", - "integrity": "sha512-j0jO9BiScfqtPBb9QmPLL0qvxXMz98xjkMb7x8lKipFlJZwNJkqkWPou+NU4V6T9RnVh1kuSthLE8gLrN8bBfw==", + "version": "4.9.1", + "resolved": "https://registry.npmjs.org/tape/-/tape-4.9.1.tgz", + "integrity": "sha512-6fKIXknLpoe/Jp4rzHKFPpJUHDHDqn8jus99IfPnHIjyz78HYlefTGD3b5EkbQzuLfaEvmfPK3IolLgq2xT3kw==", "dev": true, "requires": { "deep-equal": "1.0.1", "defined": "1.0.0", - "for-each": "0.3.2", + "for-each": "0.3.3", "function-bind": "1.1.1", "glob": "7.1.2", - "has": "1.0.1", + "has": "1.0.3", "inherits": "2.0.3", "minimist": "1.2.0", - "object-inspect": "1.5.0", - "resolve": "1.5.0", + "object-inspect": "1.6.0", + "resolve": "1.7.1", "resumer": "0.0.0", "string.prototype.trim": "1.1.2", "through": "2.3.8" }, "dependencies": { - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true, - "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" - } - }, "minimist": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", @@ -5177,7 +5141,7 @@ "dev": true, "requires": { "bluebird": "2.11.0", - "commander": "2.9.0", + "commander": "2.8.1", "fstream": "1.0.11", "mout": "0.11.1", "tar": "2.2.1" @@ -5233,6 +5197,16 @@ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", "dev": true }, + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "2.3.6", + "xtend": "4.0.1" + } + }, "timed-out": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", @@ -5275,6 +5249,12 @@ "punycode": "1.4.1" } }, + "treeify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/treeify/-/treeify-1.1.0.tgz", + "integrity": "sha512-1m4RA7xVAJrSGrrXGs0L3YTwyvBs2S8PbRHaLZAkFw7JR8oIFwYtysxlBZhYIa7xSyiYJKZ3iGrrk55cGA3i9A==", + "dev": true + }, "trim": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz", @@ -5369,9 +5349,15 @@ "dev": true, "requires": { "media-typer": "0.3.0", - "mime-types": "2.1.18" + "mime-types": "2.1.19" } }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, "typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", @@ -5381,6 +5367,12 @@ "is-typedarray": "1.0.0" } }, + "typescript": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", + "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", + "dev": true + }, "typewise": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/typewise/-/typewise-1.0.3.tgz", @@ -5431,7 +5423,7 @@ "dev": true, "requires": { "base64-js": "0.0.8", - "ieee754": "1.1.11", + "ieee754": "1.1.12", "isarray": "1.0.0" } }, @@ -5485,8 +5477,7 @@ "utf8": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/utf8/-/utf8-2.1.2.tgz", - "integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=", - "dev": true + "integrity": "sha1-H6DZJw6b6FDZsFAn9jUZv0ZFfZY=" }, "util-deprecate": { "version": "1.0.2", @@ -5501,9 +5492,9 @@ "dev": true }, "uuid": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.3.tgz", - "integrity": "sha1-Z+LoY3lyFVMN/zGOW/nc6/1Hsho=", + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.2.tgz", + "integrity": "sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==", "dev": true }, "validate-npm-package-license": { @@ -5559,9 +5550,9 @@ } }, "web3-bzz": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.0.0-beta.34.tgz", - "integrity": "sha1-Bo03d3q2Xlxg+OyLmlDP5FJ3kpw=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-bzz/-/web3-bzz-1.0.0-beta.35.tgz", + "integrity": "sha512-BhAU0qhlr8zltm4gs/+P1gki2VkxHJaM2Rrh4DGesDW0lzwufRoNvWFlwx1bKHoFPWNbSmm9PRkHOYOINL/Tgw==", "dev": true, "requires": { "got": "7.1.0", @@ -5570,45 +5561,45 @@ } }, "web3-core": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.34.tgz", - "integrity": "sha1-EhvoVV6fsA0sXQXd0zgdDJ5GmH4=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-core/-/web3-core-1.0.0-beta.35.tgz", + "integrity": "sha512-ayGavbgVk4KL9Y88Uv411fBJ0SVgVfKhKEBweKYzmP0zOqneMzWt6YsyD1n6kRvjAbqA0AfUPEOKyMNjcx2tjw==", "dev": true, "requires": { - "web3-core-helpers": "1.0.0-beta.34", - "web3-core-method": "1.0.0-beta.34", - "web3-core-requestmanager": "1.0.0-beta.34", - "web3-utils": "1.0.0-beta.34" + "web3-core-helpers": "1.0.0-beta.35", + "web3-core-method": "1.0.0-beta.35", + "web3-core-requestmanager": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35" } }, "web3-core-helpers": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.34.tgz", - "integrity": "sha1-sWjaANPhnhVrwVriAyA91N/uLQM=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-core-helpers/-/web3-core-helpers-1.0.0-beta.35.tgz", + "integrity": "sha512-APOu3sEsamyqWt//8o4yq9KF25/uqGm+pQShson/sC4gKzmfJB07fLo2ond0X30E8fIqAPeVCotPXQxGciGUmA==", "dev": true, "requires": { "underscore": "1.8.3", - "web3-eth-iban": "1.0.0-beta.34", - "web3-utils": "1.0.0-beta.34" + "web3-eth-iban": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35" } }, "web3-core-method": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.34.tgz", - "integrity": "sha1-7BY8iixJD6AqfsFVWfpzB/x8xt0=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-core-method/-/web3-core-method-1.0.0-beta.35.tgz", + "integrity": "sha512-jidImCide8q0GpfsO4L73qoHrbkeWgwU3uOH5DKtJtv0ccmG086knNMRgryb/o9ZgetDWLmDEsJnHjBSoIwcbA==", "dev": true, "requires": { "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.34", - "web3-core-promievent": "1.0.0-beta.34", - "web3-core-subscriptions": "1.0.0-beta.34", - "web3-utils": "1.0.0-beta.34" + "web3-core-helpers": "1.0.0-beta.35", + "web3-core-promievent": "1.0.0-beta.35", + "web3-core-subscriptions": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35" } }, "web3-core-promievent": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.34.tgz", - "integrity": "sha1-pPT6Z4S7KT6CxglgrltWqUzQPtw=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-core-promievent/-/web3-core-promievent-1.0.0-beta.35.tgz", + "integrity": "sha512-GvqXqKq07OmHuVi5uNRg6k79a1/CI0ViCC+EtNv4CORHtDRmYEt5Bvdv6z6FJEiaaQkD0lKbFwNhLxutx7HItw==", "dev": true, "requires": { "any-promise": "1.3.0", @@ -5616,59 +5607,59 @@ } }, "web3-core-requestmanager": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.34.tgz", - "integrity": "sha1-Afj2zyrmtvC3DDi64e90G1urIVw=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-core-requestmanager/-/web3-core-requestmanager-1.0.0-beta.35.tgz", + "integrity": "sha512-S+zW2h17ZZQU9oe3yaCJE0E7aJS4C3Kf4kGPDv+nXjW0gKhQQhgVhw1Doq/aYQGqNSWJp7f1VHkz5gQWwg6RRg==", "dev": true, "requires": { "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.34", - "web3-providers-http": "1.0.0-beta.34", - "web3-providers-ipc": "1.0.0-beta.34", - "web3-providers-ws": "1.0.0-beta.34" + "web3-core-helpers": "1.0.0-beta.35", + "web3-providers-http": "1.0.0-beta.35", + "web3-providers-ipc": "1.0.0-beta.35", + "web3-providers-ws": "1.0.0-beta.35" } }, "web3-core-subscriptions": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.34.tgz", - "integrity": "sha1-n+0UQDPyIcPPIQYDAv/a9e8t4t4=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-core-subscriptions/-/web3-core-subscriptions-1.0.0-beta.35.tgz", + "integrity": "sha512-gXzLrWvcGkGiWq1y33Z4Y80XI8XMrwowiQJkrPSjQ81K5PBKquOGwcMffLaKcwdmEy/NpsOXDeFo3eLE1Ghvvw==", "dev": true, "requires": { "eventemitter3": "1.1.1", "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.34" + "web3-core-helpers": "1.0.0-beta.35" } }, "web3-eth": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.0.0-beta.34.tgz", - "integrity": "sha1-dAhgAIUMb+b1Ne9Jg31tS7YRMmg=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-eth/-/web3-eth-1.0.0-beta.35.tgz", + "integrity": "sha512-04mcb2nGPXThawuuYICPOxv0xOHofvQKsjZeIq+89nyOC8DQMGTAErDkGyMHQYtjpth5XDhic0wuEsA80AmFZA==", "dev": true, "requires": { "underscore": "1.8.3", - "web3-core": "1.0.0-beta.34", - "web3-core-helpers": "1.0.0-beta.34", - "web3-core-method": "1.0.0-beta.34", - "web3-core-subscriptions": "1.0.0-beta.34", - "web3-eth-abi": "1.0.0-beta.34", - "web3-eth-accounts": "1.0.0-beta.34", - "web3-eth-contract": "1.0.0-beta.34", - "web3-eth-iban": "1.0.0-beta.34", - "web3-eth-personal": "1.0.0-beta.34", - "web3-net": "1.0.0-beta.34", - "web3-utils": "1.0.0-beta.34" + "web3-core": "1.0.0-beta.35", + "web3-core-helpers": "1.0.0-beta.35", + "web3-core-method": "1.0.0-beta.35", + "web3-core-subscriptions": "1.0.0-beta.35", + "web3-eth-abi": "1.0.0-beta.35", + "web3-eth-accounts": "1.0.0-beta.35", + "web3-eth-contract": "1.0.0-beta.35", + "web3-eth-iban": "1.0.0-beta.35", + "web3-eth-personal": "1.0.0-beta.35", + "web3-net": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35" } }, "web3-eth-abi": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.34.tgz", - "integrity": "sha1-A0Uz46ovfln/MXk+rqaFwO1a9no=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-eth-abi/-/web3-eth-abi-1.0.0-beta.35.tgz", + "integrity": "sha512-KUDC+EtFFYG8z01ZleKrASdjj327/rtWHzEt6RWsEj7bBa0bGp9nEh+nqdZx/Sdgz1O8tnfFzJlrRcXpfr1vGg==", "dev": true, "requires": { "bn.js": "4.11.6", "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.34", - "web3-utils": "1.0.0-beta.34" + "web3-core-helpers": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35" }, "dependencies": { "bn.js": { @@ -5680,9 +5671,9 @@ } }, "web3-eth-accounts": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.0.0-beta.34.tgz", - "integrity": "sha1-4JFC7uzHl6w0WbdemyOUbTaV8zM=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-eth-accounts/-/web3-eth-accounts-1.0.0-beta.35.tgz", + "integrity": "sha512-duIgRsfht/0kAW/eQ0X9lKtVIykbETrnM2H7EnvplCzPHtQLodpib4o9JXfh9n6ZDgdDC7cuJoiVB9QJg089ew==", "dev": true, "requires": { "any-promise": "1.3.0", @@ -5691,10 +5682,10 @@ "scrypt.js": "0.2.0", "underscore": "1.8.3", "uuid": "2.0.1", - "web3-core": "1.0.0-beta.34", - "web3-core-helpers": "1.0.0-beta.34", - "web3-core-method": "1.0.0-beta.34", - "web3-utils": "1.0.0-beta.34" + "web3-core": "1.0.0-beta.35", + "web3-core-helpers": "1.0.0-beta.35", + "web3-core-method": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35" }, "dependencies": { "eth-lib": { @@ -5717,29 +5708,29 @@ } }, "web3-eth-contract": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.0.0-beta.34.tgz", - "integrity": "sha1-nbs4+udkOoCEJ6IBgEcOx0FckeY=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-eth-contract/-/web3-eth-contract-1.0.0-beta.35.tgz", + "integrity": "sha512-foPohOg5O1UCGKGZOIs+kQK5IZdV2QQ7pAWwNxH8WHplUA+fre1MurXNpoxknUmH6mYplFhXjqgYq2MsrBpHrA==", "dev": true, "requires": { "underscore": "1.8.3", - "web3-core": "1.0.0-beta.34", - "web3-core-helpers": "1.0.0-beta.34", - "web3-core-method": "1.0.0-beta.34", - "web3-core-promievent": "1.0.0-beta.34", - "web3-core-subscriptions": "1.0.0-beta.34", - "web3-eth-abi": "1.0.0-beta.34", - "web3-utils": "1.0.0-beta.34" + "web3-core": "1.0.0-beta.35", + "web3-core-helpers": "1.0.0-beta.35", + "web3-core-method": "1.0.0-beta.35", + "web3-core-promievent": "1.0.0-beta.35", + "web3-core-subscriptions": "1.0.0-beta.35", + "web3-eth-abi": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35" } }, "web3-eth-iban": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.34.tgz", - "integrity": "sha1-mvRYYFhnzPdOqXmq8yazi6alugw=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-eth-iban/-/web3-eth-iban-1.0.0-beta.35.tgz", + "integrity": "sha512-H5wkcNcAIc+h/WoDIKv7ZYmrM2Xqu3O7jBQl1IWo73EDVQji+AoB2i3J8tuwI1yZRInRwrfpI3Zuwuf54hXHmQ==", "dev": true, "requires": { "bn.js": "4.11.6", - "web3-utils": "1.0.0-beta.34" + "web3-utils": "1.0.0-beta.35" }, "dependencies": { "bn.js": { @@ -5751,85 +5742,98 @@ } }, "web3-eth-personal": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.0.0-beta.34.tgz", - "integrity": "sha1-mvuhZzQuveVCC81YlcP2w0OI8gU=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-eth-personal/-/web3-eth-personal-1.0.0-beta.35.tgz", + "integrity": "sha512-AcM9nnlxu7ZRRxPvkrFB9eLxMM4A2cPfj2aCg21Wb2EpMnhR+b/O1cT33k7ApRowoMpM+T9M8vx2oPNwXfaCOQ==", "dev": true, "requires": { - "web3-core": "1.0.0-beta.34", - "web3-core-helpers": "1.0.0-beta.34", - "web3-core-method": "1.0.0-beta.34", - "web3-net": "1.0.0-beta.34", - "web3-utils": "1.0.0-beta.34" + "web3-core": "1.0.0-beta.35", + "web3-core-helpers": "1.0.0-beta.35", + "web3-core-method": "1.0.0-beta.35", + "web3-net": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35" } }, "web3-net": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.0.0-beta.34.tgz", - "integrity": "sha1-QnzqL0MYgUScjjjVIykPFz+f9j0=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-net/-/web3-net-1.0.0-beta.35.tgz", + "integrity": "sha512-bbwaQ/KohGjIJ6HAKbZ6KrklCAaG6/B7hIbAbVLSFLxF+Yz9lmAgQYaDInpidpC/NLb3WOmcbRF+P77J4qMVIA==", "dev": true, "requires": { - "web3-core": "1.0.0-beta.34", - "web3-core-method": "1.0.0-beta.34", - "web3-utils": "1.0.0-beta.34" + "web3-core": "1.0.0-beta.35", + "web3-core-method": "1.0.0-beta.35", + "web3-utils": "1.0.0-beta.35" } }, "web3-provider-engine": { - "version": "13.8.0", - "resolved": "https://registry.npmjs.org/web3-provider-engine/-/web3-provider-engine-13.8.0.tgz", - "integrity": "sha512-fZXhX5VWwWpoFfrfocslyg6P7cN3YWPG/ASaevNfeO80R+nzgoPUBXcWQekSGSsNDkeRTis4aMmpmofYf1TNtQ==", + "version": "14.0.6", + "resolved": "https://registry.npmjs.org/web3-provider-engine/-/web3-provider-engine-14.0.6.tgz", + "integrity": "sha512-tr5cGSyxfSC/JqiUpBlJtfZpwQf1yAA8L/zy1C6fDFm0ntR974pobJ4v4676atpZne4Ze5VFy3kPPahHe9gQiQ==", "dev": true, "requires": { "async": "2.6.1", + "backoff": "2.5.0", "clone": "2.1.1", - "eth-block-tracker": "2.3.1", + "cross-fetch": "2.2.2", + "eth-block-tracker": "3.0.1", + "eth-json-rpc-infura": "3.1.2", "eth-sig-util": "1.4.2", "ethereumjs-block": "1.2.2", - "ethereumjs-tx": "1.3.4", + "ethereumjs-tx": "1.3.7", "ethereumjs-util": "5.2.0", - "ethereumjs-vm": "2.3.3", - "fetch-ponyfill": "4.1.0", + "ethereumjs-vm": "2.3.5", "json-rpc-error": "2.0.0", "json-stable-stringify": "1.0.1", "promise-to-callback": "1.0.0", "readable-stream": "2.3.6", "request": "2.87.0", "semaphore": "1.1.0", - "solc": "0.4.18", - "tape": "4.9.0", + "tape": "4.9.1", + "ws": "5.2.2", "xhr": "2.5.0", "xtend": "4.0.1" + }, + "dependencies": { + "ws": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-5.2.2.tgz", + "integrity": "sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA==", + "dev": true, + "requires": { + "async-limiter": "1.0.0" + } + } } }, "web3-providers-http": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.34.tgz", - "integrity": "sha1-5WG1K7tDdmKCAH1AKFv+NVDCfno=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-providers-http/-/web3-providers-http-1.0.0-beta.35.tgz", + "integrity": "sha512-DcIMFq52Fb08UpWyZ3ZlES6NsNqJnco4hBS/Ej6eOcASfuUayPI+GLkYVZsnF3cBYqlH+DOKuArcKSuIxK7jIA==", "dev": true, "requires": { - "web3-core-helpers": "1.0.0-beta.34", - "xhr2": "0.1.4" + "web3-core-helpers": "1.0.0-beta.35", + "xhr2-cookies": "1.1.0" } }, "web3-providers-ipc": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.34.tgz", - "integrity": "sha1-obd/GjBtc2SanAOQUuQMtxMo0Ao=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-providers-ipc/-/web3-providers-ipc-1.0.0-beta.35.tgz", + "integrity": "sha512-iB0FG0HcpUnayfa8pn4guqEQ4Y1nrroi/jffdtQgFkrNt0sD3fMSwwC0AbmECqj3tDLl0e1slBR0RENll+ZF0g==", "dev": true, "requires": { "oboe": "2.1.3", "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.34" + "web3-core-helpers": "1.0.0-beta.35" } }, "web3-providers-ws": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.34.tgz", - "integrity": "sha1-fecPG4Py3jZHZ3IVa+z+9uNRbrM=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-providers-ws/-/web3-providers-ws-1.0.0-beta.35.tgz", + "integrity": "sha512-Cx64NgDStynKaUGDIIOfaCd0fZusL8h5avKTkdTjUu2aHhFJhZoVBGVLhoDtUaqZGWIZGcBJOoVf2JkGUOjDRQ==", "dev": true, "requires": { "underscore": "1.8.3", - "web3-core-helpers": "1.0.0-beta.34", + "web3-core-helpers": "1.0.0-beta.35", "websocket": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2" }, "dependencies": { @@ -5837,7 +5841,7 @@ "version": "git://github.com/frozeman/WebSocket-Node.git#6c72925e3f8aaaea8dc8450f97627e85263999f2", "dev": true, "requires": { - "debug": "2.6.0", + "debug": "2.6.9", "nan": "2.10.0", "typedarray-to-buffer": "3.1.5", "yaeti": "0.0.6" @@ -5846,21 +5850,21 @@ } }, "web3-shh": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.0.0-beta.34.tgz", - "integrity": "sha1-l1Bh1x6uxCzO5Xb3vY9w8DhEr+A=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-shh/-/web3-shh-1.0.0-beta.35.tgz", + "integrity": "sha512-8qSonk/x0xabERS9Sr6AIADN/Ty+5KwARkkGIfSYHKqFpdMDz+76F7cUCxtoCZoS8K04xgZlDKYe0TJXLYA0Fw==", "dev": true, "requires": { - "web3-core": "1.0.0-beta.34", - "web3-core-method": "1.0.0-beta.34", - "web3-core-subscriptions": "1.0.0-beta.34", - "web3-net": "1.0.0-beta.34" + "web3-core": "1.0.0-beta.35", + "web3-core-method": "1.0.0-beta.35", + "web3-core-subscriptions": "1.0.0-beta.35", + "web3-net": "1.0.0-beta.35" } }, "web3-utils": { - "version": "1.0.0-beta.34", - "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.34.tgz", - "integrity": "sha1-lBH8OarvOcpOBhafdiKX2f8CCXA=", + "version": "1.0.0-beta.35", + "resolved": "https://registry.npmjs.org/web3-utils/-/web3-utils-1.0.0-beta.35.tgz", + "integrity": "sha512-Dq6f0SOKj3BDFRgOPnE6ALbzBDCKVIW8mKWVf7tGVhTDHf+wQaWwQSC3aArFSqdExB75BPBPyDpuMTNszhljpA==", "dev": true, "requires": { "bn.js": "4.11.6", @@ -5892,12 +5896,18 @@ "integrity": "sha512-fjcrYDPIQxpTnqFQ9JjxUQcdvR89MFAOjPBlF+vjOt49w/XW4fJknUoMz/mDIn2eK1AdslVojcaOxOqyZZV8rw==", "dev": true, "requires": { - "debug": "2.6.0", + "debug": "2.6.9", "nan": "2.10.0", "typedarray-to-buffer": "3.1.5", "yaeti": "0.0.6" } }, + "whatwg-fetch": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz", + "integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==", + "dev": true + }, "which-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-1.0.0.tgz", @@ -5979,6 +5989,15 @@ "integrity": "sha1-f4dliEdxbbUCYyOBL4GMras4el8=", "dev": true }, + "xhr2-cookies": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/xhr2-cookies/-/xhr2-cookies-1.1.0.tgz", + "integrity": "sha1-fXdEnQmZGX8VXLc7I99yUF7YnUg=", + "dev": true, + "requires": { + "cookiejar": "2.1.2" + } + }, "xmlhttprequest": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz", @@ -6012,7 +6031,7 @@ "camelcase": "3.0.0", "cliui": "3.2.0", "decamelize": "1.2.0", - "get-caller-file": "1.0.2", + "get-caller-file": "1.0.3", "os-locale": "1.4.0", "read-pkg-up": "1.0.1", "require-directory": "2.1.1", @@ -6046,13 +6065,13 @@ } }, "yauzl": { - "version": "2.9.1", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.9.1.tgz", - "integrity": "sha1-qBmB6nCleUYTOIPwKcWCGok1mn8=", + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", "dev": true, "requires": { "buffer-crc32": "0.2.13", - "fd-slicer": "1.0.1" + "fd-slicer": "1.1.0" } } } diff --git a/package.json b/package.json index 580eba7..87e45d9 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,12 @@ "description": "Javascript library for interacting with the Ethereum Alarm Clock contracts", "main": "index.js", "scripts": { + "build": "tsc", + "lint": "tslint src/**/*.ts", + "lint-fix": "tslint src/**/*.ts --fix", "test": "mocha", - "citest": "./scripts/citest.sh" + "deploy-eac": "sh scripts/deploy_eac.sh", + "ganache": "ganache-cli -m \"shove afford modify census bridge good random error fault floor fringe oblige\" -i 1002" }, "repository": { "type": "git", @@ -23,14 +27,17 @@ "homepage": "https://github.com/ethereum-alarm-clock/eac.js-lib#readme", "devDependencies": { "@digix/tempo": "0.2.0", + "@types/node": "10.5.3", "chai": "4.1.2", "ganache-core": "2.1.2", "mocha": "5.1.1", "truffle-contract": "3.0.5", + "typescript": "2.9.2", "web3": "0.20.6" }, "dependencies": { "bignumber.js": "5.0.0", - "ethereumjs-util": "5.2.0" + "ethereumjs-util": "5.2.0", + "ethereumjs-wallet": "0.6.0" } } diff --git a/scripts/deploy_eac.sh b/scripts/deploy_eac.sh new file mode 100755 index 0000000..b6d0585 --- /dev/null +++ b/scripts/deploy_eac.sh @@ -0,0 +1,4 @@ +#!/bin/sh +git submodule init ethereum-alarm-clock +git submodule update +./deploy.sh \ No newline at end of file diff --git a/src/Buckets/IBucketPair.ts b/src/Buckets/IBucketPair.ts new file mode 100644 index 0000000..1724966 --- /dev/null +++ b/src/Buckets/IBucketPair.ts @@ -0,0 +1,8 @@ +type Bucket = number; + +interface IBucketPair { + blockBucket: Bucket; + timestampBucket: Bucket; +} + +export { Bucket, IBucketPair }; diff --git a/src/Buckets/IBuckets.ts b/src/Buckets/IBuckets.ts new file mode 100644 index 0000000..f8faa04 --- /dev/null +++ b/src/Buckets/IBuckets.ts @@ -0,0 +1,6 @@ +import { IBucketPair } from "./IBucketPair"; + +export interface IBuckets { + currentBuckets: IBucketPair; + nextBuckets: IBucketPair; +} diff --git a/src/Buckets/consts.ts b/src/Buckets/consts.ts new file mode 100644 index 0000000..1ffd6a9 --- /dev/null +++ b/src/Buckets/consts.ts @@ -0,0 +1,4 @@ +export const BucketSize = { + block: 240, + timestamp: 3600, +}; diff --git a/src/Buckets/index.ts b/src/Buckets/index.ts new file mode 100644 index 0000000..1061e4a --- /dev/null +++ b/src/Buckets/index.ts @@ -0,0 +1,3 @@ +export { Bucket, IBucketPair } from "./IBucketPair"; +export { IBuckets } from "./IBuckets"; +export { BucketSize } from "./consts"; diff --git a/src/RequestFactory/index.ts b/src/RequestFactory/index.ts new file mode 100644 index 0000000..50553fa --- /dev/null +++ b/src/RequestFactory/index.ts @@ -0,0 +1,225 @@ +import { Bucket, BucketSize } from "../Buckets"; +import initUtil from "../util"; + +type Address = string; + +enum RequestFactoryError { + INIT_NULL_ADDR = "Cannot initialize a RequestFactory from null address.", +} + +enum TemporalUnit { + Block = 1, + TimeStamp = 2, +} + +export default class RequestFactory { + public instance: any; + public util: any; + public web3: any; + + constructor(address: Address, web3: any) { + if (!this.util.checkNotNullAddress(address)) { + throw new Error(RequestFactoryError.INIT_NULL_ADDR); + } + + this.web3 = web3; + this.util = new initUtil(web3); + this.instance = this.web3.eth + .contract(this.util.getABI("RequestFactory")) + .at(address); + } + + get address(): Address { + return this.instance.address; + } + + /** + * Conveinence methods + */ + + public isKnownRequest(requestAddress: Address) { + return new Promise((resolve, reject) => { + this.instance.isKnownRequest.call(requestAddress, (err: any, isKnown: any) => { + if (!err) { + resolve(isKnown); + } else { + reject(err); + } + }); + }); + } + + public validateRequestParams(addressArgs: string[], uintArgs: number[], endowment: number) { + return new Promise((resolve, reject) => { + this.instance.validateRequestParams.call( + addressArgs, + uintArgs, + endowment, + (err: any, isValid: any) => { + if (!err) { + resolve(isValid); + } else { + reject(err); + } + }, + ); + }); + } + + /** + * Parses the boolean returned by validateRequestParams() and returns the + * reason validation failed. + * @param {Array} isValid The array returned by this.validateRequestParams() + * @return {Array} An array of the strings of validation errors or an + * array of length 0 if no errors. + */ + public parseIsValid(isValid: boolean[]): string[] { + if (isValid.length !== 6) { + throw new Error("Must pass an array of booleans returned by validateRequestParams()"); + } + const Errors = [ + "InsufficientEndowment", + "ReservedWindowBiggerThanExecutionWindow", + "InvalidTemporalUnit", + "ExecutionWindowTooSoon", + "CallGasTooHigh", + "EmptyToAddress", + ]; + const errors = [] as string[]; + isValid.forEach((boolIsTrue, index) => { + if (!boolIsTrue) { + errors.push(Errors[index]); + } + }); + return errors; + } + + public async getRequestCreatedLogs(filter: any, startBlockNum: number, endBlockNum: number): Promise { + const f = filter || {}; + const curBlock = await this.util.getBlockNumber(this.web3); + const start = startBlockNum || 1; + const end = endBlockNum || "latest"; + const event = this.instance.RequestCreated( + f, + { fromBlock: start, toBlock: end }, + ); + return new Promise((resolve, reject) => { + event.get((err: any, logs: any[]) => { + if (!err) { + resolve(logs); + } else { + reject(err); + } + }); + }); + } + + public async watchRequestCreatedLogs(filter: any, startBlockNum: any, callback: any): Promise { + const f = filter || {}; + const curBlock = await this.util.getBlockNumber(this.web3); + const start = startBlockNum || 1; + const event = this.instance.RequestCreated( + f, + { fromBlock: start, toBlock: "latest" }, + ); + event.watch((err: any, res: any) => { + callback(err, res); + }); + return event; + } + + public async stopWatch(event: any): Promise<{}> { + return new Promise((resolve, reject) => { + event.stopWatching((err: any, res: any) => { + if (!err) { + resolve(res); + } else { + reject(err); + } + }); + }); + } + + public async getRequestsByBucket(bucket: Bucket): Promise { + const logs = await this.getRequestCreatedLogs({ + bucket, + }, 0, 0); + const requests = [] as any[]; + logs.forEach((log: any) => { + requests.push({ + address: log.args.request, + params: log.args.params, + }); + }); + return requests; + } + + public async watchRequestsByBucket(bucket: Bucket, cb: any): Promise { + return await this.watchRequestCreatedLogs({ + bucket, + }, "", + (error: any, log: any) => { + if (log) { + cb({ + address: log.args.request, + params: log.args.params, + }); + } + }); + } + + // Assume the temporalUnit is blocks if not timestamp. + public calcBucket(windowStart: number, temporalUnit: TemporalUnit) { + // Assume block as default unit. + let bucketSize = BucketSize.block; + // TODO make constant + let sign = -1; // block sign + + if (temporalUnit === 2) { + bucketSize = BucketSize.timestamp; + // TODO make constant + sign = 1; // timestamp sign + } + + return sign * (windowStart - (windowStart % bucketSize)); + } + + public async getRequests(startBlock: number, endBlock: number) { + const logs = await this.getRequestCreatedLogs({}, startBlock, endBlock); + const requests = [] as any[]; + logs.forEach((log: any) => { + requests.push(log.args.request); + }); + return requests; + } + + public async watchRequests(startBlock: number, callback: any) { + return await this.watchRequestCreatedLogs({}, startBlock, + (error: any, log: any) => { + if (log) { + callback(log.args.request); + } + }); + } + + public async getRequestsByOwner(owner: Address, startBlock: number, endBlock: number) { + const logs = await this.getRequestCreatedLogs({ + owner, + }, startBlock, endBlock); + const requests = [] as any[]; + logs.forEach((log: any) => { + requests.push(log.args.request); + }); + return requests; + } + + public async watchRequestsByOwner(owner: Address, startBlock: number, callback: any): Promise { + return await this.watchRequestCreatedLogs({ + owner, + }, startBlock, (error: any, log: any) => { + if (log) { + callback(log.args.request); + } + }); + } +} diff --git a/src/Scheduler/index.ts b/src/Scheduler/index.ts new file mode 100644 index 0000000..6047787 --- /dev/null +++ b/src/Scheduler/index.ts @@ -0,0 +1,210 @@ +import BigNumber from "bignumber.js"; + +import initUtil from "../util"; +const Util = new initUtil(null); + +type Address = string; + +export default class Scheduler { + public blockScheduler: any; + public timestampScheduler: any; + public web3: any; + + public sender: Address = ""; + public gasLimit: number = 0; + public sendValue: number = 0; + + constructor(bSchedulerAddress: Address, tSchedulerAddress: Address, web3: any) { + this.web3 = web3; + try { + const BlockSchedulerABI = Util.getABI("BlockScheduler"); + const TimestampSchedulerABI = Util.getABI("TimestampScheduler"); + this.blockScheduler = web3.eth + .contract(BlockSchedulerABI) + .at(bSchedulerAddress); + this.timestampScheduler = web3.eth + .contract(TimestampSchedulerABI) + .at(tSchedulerAddress); + } catch (err) { + throw new Error(err); + } + } + + public getFactoryAddress(): Promise
{ + return new Promise((resolve, reject) => { + this.blockScheduler.factoryAddress.call((err: any, address: Address) => { + if (!err) { + resolve(address); + } else { + reject(err); + } + }); + }); + } + + public initSender(opts: any): boolean { + this.sender = opts.from; + this.gasLimit = opts.gas; + this.sendValue = opts.value; + return true; + } + + public setGas(gasLimit: number): boolean { + this.gasLimit = gasLimit; + return true; + } + + public setSender(address: Address): boolean { + // TODO verfiy with ethUtil + this.sender = address; + return true; + } + + public setSendValue(value: number): boolean { + this.sendValue = value; + return true; + } + + public blockSchedule( + toAddress: any, + callData: any, + callGas: any, + callValue: any, + windowSize: any, + windowStart: any, + gasPrice: any, + fee: any, + bounty: any, + requiredDeposit: any, + waitForMined: boolean = true, + ): Promise { + return new Promise((resolve, reject) => { + this.blockScheduler.schedule.sendTransaction( + toAddress, + callData, + [ + callGas, + callValue, + windowSize, + windowStart, + gasPrice, + fee, + bounty, + requiredDeposit, + ], + { + from: this.sender, + gas: this.gasLimit, + value: this.sendValue, + }, + (err: any, txHash: any) => { + if (err) { + reject(err); + } else { + const miningPromise = Util.waitForTransactionToBeMined(txHash, null); + + if (waitForMined) { + miningPromise + .then((receipt) => resolve(receipt)) + .catch((e) => reject(e)); + } else { + resolve({ + miningPromise, + transactionHash: txHash, + }); + } + } + }, + ); + }); + } + + public timestampSchedule( + toAddress: any, + callData: any, + callGas: any, + callValue: any, + windowSize: any, + windowStart: any, + gasPrice: any, + fee: any, + bounty: any, + requiredDeposit: any, + waitForMined: boolean = true, + ) { + return new Promise((resolve, reject) => { + this.timestampScheduler.schedule( + toAddress, + callData, + [ + callGas, + callValue, + windowSize, + windowStart, + gasPrice, + fee, + bounty, + requiredDeposit, + ], + { + from: this.sender, + gas: this.gasLimit, + value: this.sendValue, + }, + (err: any, txHash: any) => { + if (err) { + reject(err); + } else { + const miningPromise = Util.waitForTransactionToBeMined(txHash, null); + + if (waitForMined) { + miningPromise + .then((receipt) => resolve(receipt)) + .catch((e) => reject(e)); + } else { + resolve({ + miningPromise, + transactionHash: txHash, + }); + } + } + }, + ); + }); + } + + public calcEndowment(callGas: number, callValue: number, gasPrice: number, fee: number, bounty: number): BigNumber { + // Convert the value to a bignumber works even if it's already one. + const callGasBN = new BigNumber(callGas); + const callValueBN = new BigNumber(callValue); + const gasPriceBN = new BigNumber(gasPrice); + const feeBN = new BigNumber(fee); + const bountyBN = new BigNumber(bounty); + + return bountyBN + .plus(feeBN.times(2)) + .plus(callGasBN.times(gasPrice)) + .plus(gasPriceBN.times(180000)) + .plus(callValueBN); + } + + /** + * Chain inits + */ + + // static initMainnet() { + // throw new Error("Not implemented.") + // } + + // static initRopsten(web3) { + // return new Scheduler(web3, "ropsten") + // } + + // static initRinkeby() { + // throw new Error("Not implemented.") + // } + + // static initKovan(web3) { + // return new Scheduler(web3, "kovan") + // } +} diff --git a/src/TransactionRequest/index.ts b/src/TransactionRequest/index.ts new file mode 100644 index 0000000..71ffa44 --- /dev/null +++ b/src/TransactionRequest/index.ts @@ -0,0 +1,4 @@ +import TxRequest, { RequestData } from "./txRequest"; + +export default TxRequest; +export { RequestData }; diff --git a/src/TransactionRequest/requestData.ts b/src/TransactionRequest/requestData.ts new file mode 100644 index 0000000..5993e3c --- /dev/null +++ b/src/TransactionRequest/requestData.ts @@ -0,0 +1,137 @@ +import BigNumber from "bignumber.js"; + +import { TemporalUnit } from "../Types"; + +interface IClaimData { + claimedBy: string; + claimDeposit: BigNumber; + paymentModifier: number; + requiredDeposit: BigNumber; +} + +interface IMeta { + createdBy: string; + owner: string; + isCancelled: boolean; + wasCalled: boolean; + wasSuccessful: boolean; +} + +interface IPaymentData { + feeRecipient: string; + bountyBenefactor: string; + fee: BigNumber; + feeOwed: BigNumber; + bounty: BigNumber; + bountyOwed: BigNumber; +} + +interface ISchedule { + claimWindowSize: BigNumber; + freezePeriod: BigNumber; + reservedWindowSize: BigNumber; + temporalUnit: TemporalUnit; + windowSize: BigNumber; + windowStart: BigNumber; +} + +interface ITxData { + callGas: BigNumber; + callValue: BigNumber; + gasPrice: BigNumber; + toAddress: string; +} + +interface IRequestData { + claimData: IClaimData; + meta: IMeta; + paymentData: IPaymentData; + schedule: ISchedule; + txData: ITxData; +} + +export default class RequestData implements IRequestData { + + public static from(txRequest: any): Promise { + return new Promise((resolve, reject) => { + txRequest.requestData.call({ gas: 3000000 }, (err: any, data: any) => { + if (err) { + reject(err); + } else { + resolve(new RequestData(data, txRequest)); + } + }); + }); + } + + public claimData: IClaimData = {} as IClaimData; + public meta: IMeta = {} as IMeta; + public paymentData: IPaymentData = {} as IPaymentData; + public schedule: ISchedule = {} as ISchedule; + public txData: ITxData = {} as ITxData; + + public txRequest: any; + + constructor(data: any, txRequest: any) { + if (typeof data === "undefined" || typeof txRequest === "undefined") { + throw new Error("Cannot call the constructor directly."); + } + this.txRequest = txRequest; + this.fill(data); + } + + public fill(data: any) { + this.claimData = { + claimDeposit: new BigNumber(data[2][0]), + claimedBy: data[0][0], + paymentModifier: parseInt(data[3][0], 10), + requiredDeposit: new BigNumber(data[2][14]), + }; + + this.meta = { + createdBy: data[0][1], + isCancelled: data[1][0], + owner: data[0][2], + wasCalled: data[1][1], + wasSuccessful: data[1][2], + }; + + this.paymentData = { + bounty: new BigNumber(data[2][3]), + bountyBenefactor: data[0][4], + bountyOwed: new BigNumber(data[2][4]), + fee: new BigNumber(data[2][1]), + feeOwed: new BigNumber(data[2][2]), + feeRecipient: data[0][3], + }; + + this.schedule = { + claimWindowSize: new BigNumber(data[2][5]), + freezePeriod: new BigNumber(data[2][6]), + reservedWindowSize: new BigNumber(data[2][7]), + temporalUnit: parseInt(data[2][8], 10), + windowSize: new BigNumber(data[2][9]), + windowStart: new BigNumber(data[2][10]), + }; + + this.txData = { + callGas: new BigNumber(data[2][11]), + callValue: new BigNumber(data[2][12]), + gasPrice: new BigNumber(data[2][13]), + toAddress: data[0][5], + }; + } + + public refresh(): Promise { + return new Promise((resolve, reject) => { + this.txRequest.requestData.call((err: any, data: any) => { + if (err) { + reject(err); + } else { + this.fill(data); + resolve(true); + } + }); + }); + } +} diff --git a/src/TransactionRequest/txRequest.ts b/src/TransactionRequest/txRequest.ts new file mode 100644 index 0000000..e05f6aa --- /dev/null +++ b/src/TransactionRequest/txRequest.ts @@ -0,0 +1,487 @@ +import BigNumber from "bignumber.js"; + +import Constants from "../constants"; +import { Address, TemporalUnit } from "../Types"; +import initUtil from "../util"; +import RequestData from "./requestData"; + +enum TXREQUEST_ERROR { + NULL_ADDRESS = "Attempted to instantiate a TxRequest class from a null address.", +} + +export default class TxRequest { + public data: RequestData = {} as RequestData; + public instance: any; + public util: any; + public web3: any; + + constructor(address: Address, web3: any) { + if (!this.util.checkNotNullAddress(address)) { + throw new Error(TXREQUEST_ERROR.NULL_ADDRESS); + } + + this.web3 = web3; + this.util = new initUtil(web3); + this.instance = this.web3.eth + .contract(this.util.getABI("TransactionRequestCore")) + .at(address); + } + + get address(): Address { + return this.instance.address; + } + + /** + * Window centric getters + */ + + get claimWindowSize(): BigNumber { + this.checkData(); + return this.data.schedule.claimWindowSize; + } + + get claimWindowStart(): BigNumber { + this.checkData(); + return this.windowStart.minus(this.freezePeriod).minus(this.claimWindowSize); + } + + get claimWindowEnd(): BigNumber { + this.checkData(); + return this.claimWindowStart.plus(this.claimWindowSize); + } + + get freezePeriod(): BigNumber { + this.checkData(); + return this.data.schedule.freezePeriod; + } + + get freezePeriodStart(): BigNumber { + this.checkData(); + return this.windowStart.plus(this.claimWindowSize); + } + + get freezePeriodEnd(): BigNumber { + this.checkData(); + return this.claimWindowEnd.plus(this.freezePeriod); + } + + get temporalUnit(): TemporalUnit { + this.checkData(); + return this.data.schedule.temporalUnit; + } + + get windowSize(): BigNumber { + this.checkData(); + return this.data.schedule.windowSize; + } + + get windowStart(): BigNumber { + this.checkData(); + return this.data.schedule.windowStart; + } + + get reservedWindowSize(): BigNumber { + this.checkData(); + return this.data.schedule.reservedWindowSize; + } + + get reservedWindowEnd(): BigNumber { + this.checkData(); + return this.windowStart.plus(this.reservedWindowSize); + } + + get executionWindowEnd(): BigNumber { + this.checkData(); + return this.windowStart.plus(this.windowSize); + } + + /** + * Dynamic getters + */ + + public async now(): Promise { + if (this.temporalUnit === 1) { + return new BigNumber(await this.util.getBlockNumber(this.web3)); + } else if (this.temporalUnit === 2) { + const timestamp = await this.util.getTimestamp(this.web3); + return new BigNumber(timestamp); + } + throw new Error(`Unrecognized temporal unit: ${this.temporalUnit}`); + } + + public async beforeClaimWindow(): Promise { + const now = await this.now(); + return this.claimWindowStart.greaterThan(now); + } + + public async inClaimWindow(): Promise { + const now = await this.now(); + return ( + this.claimWindowStart.lessThanOrEqualTo(now) && + this.claimWindowEnd.greaterThan(now) + ); + } + + public async inFreezePeriod(): Promise { + const now = await this.now(); + return ( + this.claimWindowEnd.lessThanOrEqualTo(now) && + this.freezePeriodEnd.greaterThan(now) + ); + } + + public async inExecutionWindow(): Promise { + const now = await this.now(); + return ( + this.windowStart.lessThanOrEqualTo(now) && + this.executionWindowEnd.greaterThanOrEqualTo(now) + ); + } + + public async inReservedWindow(): Promise { + const now = await this.now(); + return ( + this.windowStart.lessThanOrEqualTo(now) && + this.reservedWindowEnd.greaterThan(now) + ); + } + + public async afterExecutionWindow(): Promise { + const now = await this.now(); + return this.executionWindowEnd.lessThan(now); + } + + public async executedAt(): Promise { + return ((await this.getExecutedEvent()) as any).blockNumber; + } + + public getExecutedEvent(): any|Promise { + if (!this.wasCalled) { + return {blockNumber: 0}; + } + const events = this.instance.allEvents({fromBlock: 0, toBlock: "latest"}); + return new Promise((resolve, reject) => { + events.get((err: any, logs: any) => { + if (!err) { + const Executed = logs.filter((log: any) => { + return log.topics[0] === "0x3e504bb8b225ad41f613b0c3c4205cdd752d1615b4d77cd1773417282fcfb5d9"; + }); + resolve({ + blockNumber: Executed[0].blockNumber, + bounty: this.web3.toDecimal("0x" + Executed[0].data.slice(2, 66)), + estimatedGas: this.web3.toDecimal("0x" + Executed[0].data.slice(131, 194)), + fee: this.web3.toDecimal("0x" + Executed[0].data.slice(67, 130)), + }); + } else { + reject(err); + } + }); + }); + } + + public getBucket() { + let sign = -1; + let bucketSize = 0; + + if (this.temporalUnit === 1) { + bucketSize = 240; + } else if (this.temporalUnit === 2) { + bucketSize = 3600; + sign = 1; + } + return sign * this.windowStart.toNumber() - (this.windowStart.toNumber() % bucketSize); + } + + /** + * Claim props/methods + */ + + get claimedBy(): Address { + this.checkData(); + return this.data.claimData.claimedBy; + } + + get isClaimed(): boolean { + this.checkData(); + return this.data.claimData.claimedBy !== Constants.NULL_ADDRESS; + } + + public isClaimedBy(address: any): boolean { + this.checkData(); + return this.claimedBy === address; + } + + get requiredDeposit(): BigNumber { + this.checkData(); + return this.data.claimData.requiredDeposit; + } + + public async claimPaymentModifier(): Promise { + const now = await this.now(); + const elapsed = now.minus(this.claimWindowStart); + return elapsed.times(100).dividedToIntegerBy(this.claimWindowSize); + } + + /** + * Meta + */ + + get isCancelled(): boolean { + this.checkData(); + return this.data.meta.isCancelled; + } + + get wasCalled(): boolean { + this.checkData(); + return this.data.meta.wasCalled; + } + + get wasSuccessful(): boolean { + this.checkData(); + return this.data.meta.wasSuccessful; + } + + get owner(): Address { + this.checkData(); + return this.data.meta.owner; + } + + /** + * TxData + */ + + get toAddress(): Address { + this.checkData(); + return this.data.txData.toAddress; + } + + get callGas(): BigNumber { + this.checkData(); + return this.data.txData.callGas; + } + + get callValue(): BigNumber { + this.checkData(); + return this.data.txData.callValue; + } + + get gasPrice(): BigNumber { + this.checkData(); + return this.data.txData.gasPrice; + } + + get fee(): BigNumber { + this.checkData(); + return this.data.paymentData.fee; + } + + get bounty(): BigNumber { + this.checkData(); + return this.data.paymentData.bounty; + } + + /** + * Call Data + */ + + public callData(): Promise { + return new Promise((resolve, reject) => { + this.instance.callData.call((err: any, callData: any) => { + if (!err) { + resolve(callData); + } else { + reject(err); + } + }); + }); + } + + /** + * Data management + */ + + public async fillData(): Promise { + const requestData = await RequestData.from(this.instance); + this.data = requestData; + return true; + } + + public async refreshData(): Promise { + if (!this.data) { + return this.fillData(); + } + return this.data.refresh(); + } + + /** + * ABI convenience functions + */ + + get claimData() { + return this.instance.claim.getData(); + } + + get executeData() { + return this.instance.execute.getData(); + } + + get cancelData() { + return this.instance.cancel.getData(); + } + + /** + * Action Wrappers + */ + + /** + * @param {Object} params Transaction object including `from`, `gas`, `gasPrice` and `value`. + */ + public claim(params: any) { + return new Promise((resolve, reject) => { + this.instance.claim(params, (err: any, txHash: any) => { + if (err) { + reject(err); + } else { + this.util.waitForTransactionToBeMined(txHash, null) + .then((receipt: any) => resolve(receipt)) + .catch((e: any) => reject(e)); + } + }); + }); + } + + /** + * @param {Object} params Transaction object including `from`, `gas`, `gasPrice` and `value`. + */ + public execute(params: any) { + return new Promise((resolve, reject) => { + this.instance.execute(params, (err: any, txHash: any) => { + if (err) { + reject(err); + } else { + this.util.waitForTransactionToBeMined(txHash, null) + .then((receipt: any) => resolve(receipt)) + .catch((e: any) => reject(e)); + } + }); + }); + } + + /** + * @param {Object} params Transaction object including `from`, `gas`, `gasPrice` and `value`. + */ + public cancel(params: any) { + return new Promise((resolve, reject) => { + this.instance.cancel(params, (err: any, txHash: any) => { + if (err) { + reject(err); + } else { + this.util.waitForTransactionToBeMined(txHash, null) + .then((receipt: any) => resolve(receipt)) + .catch((e: any) => reject(e)); + } + }); + }); + } + + /** + * Proxy + * @param {string} toAddress Ethereum address + * @param {string} data Hex encoded data for the transaction to proxy + * @param {Object} params Transaction object including `from`, `gas`, `gasPrice` and `value`. + */ + public proxy(toAddress: any, data: any, params: any) { + return new Promise((resolve, reject) => { + this.instance.proxy(toAddress, data, params, (err: any, txHash: any) => { + if (err) { + reject(err); + } else { + this.util.waitForTransactionToBeMined(txHash, null) + .then(resolve) // resolves the receipt + .catch(reject); // rejects the error + } + }); + }); + } + + /** + * Pull Payments + */ + public refundClaimDeposit(params: any) { + return new Promise((resolve, reject) => { + this.instance.refundClaimDeposit(params, (err: any, txHash: any) => { + if (err) { + reject(err); + } else { + this.util.waitForTransactionToBeMined(txHash, null) + .then(resolve) + .catch(reject); + } + }); + }); + } + + public sendFee(params: any) { + return new Promise((resolve, reject) => { + this.instance.sendFee(params, (err: any, txHash: any) => { + if (err) { + reject(err); + } else { + this.util.waitForTransactionToBeMined(txHash, null) + .then(resolve) + .catch(reject); + } + }); + }); + } + + public sendBounty(params: any) { + return new Promise((resolve, reject) => { + this.instance.sendBounty(params, (err: any, txHash: any) => { + if (err) { + reject(err); + } else { + this.util.waitForTransactionToBeMined(txHash, null) + .then(resolve) + .catch(reject); + } + }); + }); + } + + public sendOwnerEther(params: any) { + return new Promise((resolve, reject) => { + this.instance.sendOwnerEther(params, (err: any, txHash: any) => { + if (err) { + reject(err); + } else { + this.util.waitForTransactionToBeMined(txHash, null) + .then(resolve) + .catch(reject); + } + }); + }); + } + + /** + * Misc. + */ + + public async getBalance() { + const bal = await this.util.getBalance(this.address); + return new BigNumber(bal); + } + + /** + * Error handling + */ + public checkData() { + if (!this.data) { + throw new Error("Data has not been filled! Please call `txRequest.fillData()` before using this method."); + } + } +} + +export { + RequestData, +}; diff --git a/src/Types/index.ts b/src/Types/index.ts new file mode 100644 index 0000000..0d9cd9f --- /dev/null +++ b/src/Types/index.ts @@ -0,0 +1,11 @@ +type Address = string; + +enum TemporalUnit { + Block = 1, + TimeStamp = 2, +} + +export { + Address, + TemporalUnit, +}; diff --git a/src/Version/index.ts b/src/Version/index.ts new file mode 100644 index 0000000..9311abd --- /dev/null +++ b/src/Version/index.ts @@ -0,0 +1,4 @@ +/* tslint:disable */ +const Version = require("../../package.json").version; + +export default Version; \ No newline at end of file diff --git a/lib/constants.js b/src/constants.ts similarity index 62% rename from lib/constants.js rename to src/constants.ts index c3a41a9..684b415 100644 --- a/lib/constants.js +++ b/src/constants.ts @@ -1,14 +1,14 @@ -module.exports = { - GT_HEX: "0x3e", - LT_HEX: "0x3c", - GTE_HEX: "0x3e3d", - LTE_HEX: "0x3c3d", +export default { + ABORTEDLOG: + "0xc008bc849b42227c61d5063a1313ce509a6e99211bfd59e827e417be6c65c81b", EQ_HEX: "0x3d3d", - NULL_ADDRESS: "0x0000000000000000000000000000000000000000", EXECUTEDLOG: "0x3e504bb8b225ad41f613b0c3c4205cdd752d1615b4d77cd1773417282fcfb5d9", - ABORTEDLOG: - "0xc008bc849b42227c61d5063a1313ce509a6e99211bfd59e827e417be6c65c81b", + GTE_HEX: "0x3e3d", + GT_HEX: "0x3e", + LTE_HEX: "0x3c3d", + LT_HEX: "0x3c", NEWREQUESTLOG: - "0x2749295aa7ffdbd4d16719dc03d592cd081eebd9bb790ceedce201a40675fc03", -} + "0x2749295aa7ffdbd4d16719dc03d592cd081eebd9bb790ceedce201a40675fc03", + NULL_ADDRESS: "0x0000000000000000000000000000000000000000", +}; diff --git a/src/global.d.ts b/src/global.d.ts new file mode 100644 index 0000000..febae77 --- /dev/null +++ b/src/global.d.ts @@ -0,0 +1,2 @@ +declare module "ethereumjs-util"; +declare module "web3"; \ No newline at end of file diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..5443f43 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,61 @@ +import { + Bucket, + BucketSize, + IBucketPair, + IBuckets, +} from "./Buckets"; + +import Constants from "./constants"; +import RequestFactory from "./RequestFactory"; +import Scheduler from "./Scheduler"; +import TxRequest, { RequestData } from "./TransactionRequest"; +import Util from "./util"; +import Version from "./Version"; + +const initPackage = (web3: any) => { + // if (!web3) { + // return { + // Constants, + // RequestData, + // RequestFactory, + // Scheduler, + // TxRequest, + // Util: new Util(null), + // Version, + // }; + // } + + // We have a web3 object to initialize contracts. + const util = new Util(web3); + return { + Constants, + RequestData, + Util: util, + Version, + requestFactory: async () => { + const chainName = await util.getChainName(); + const contracts = require(`../static/assets/${chainName}.json`); + return new RequestFactory(contracts.requestFactory, web3); + }, + scheduler: async () => { + const chainName = await util.getChainName(); + const contracts = require(`../static/assets/${chainName}.json`); + return new Scheduler( + contracts.blockScheduler, + contracts.timestampScheduler, + web3, + ); + }, + transactionRequest: (address: string) => { + return new TxRequest(address, web3); + }, + }; +}; + +export default initPackage; +export { + Bucket, + BucketSize, + IBucketPair, + IBuckets, +}; diff --git a/src/util.ts b/src/util.ts new file mode 100644 index 0000000..85db637 --- /dev/null +++ b/src/util.ts @@ -0,0 +1,280 @@ +import BigNumber from "bignumber.js"; +import * as ethUtil from "ethereumjs-util"; + +import Constants from "./constants"; + +type Address = string; + +enum UTIL_ERROR { + WEB3_ERROR = "[eac.js-lib] You must either pass a Web3 object to Util class or instatiate it with Web3 object.", + DEPRECATED = "[eac.js-lib] Deprecated.", +} + +export default class Util { + public web3: any; + + constructor(web3: any) { + this.web3 = web3; + } + + public calcEndowment( + gas: BigNumber, + value: BigNumber, + gasPrice: BigNumber, + fee: BigNumber, + bounty: BigNumber, + ): BigNumber { + return bounty.add(fee).add(gas.times(gasPrice)).add(gasPrice.times(180000)).add(value); + } + + public checkForUnlockedAccount() { + throw new Error(UTIL_ERROR.DEPRECATED); + } + + public checkNetworkID(): Promise { + const web3 = this.checkWeb3(); + + return new Promise((resolve: any, reject: any) => { + web3.version.getNetwork((err: any, netId: any) => { + switch (netId) { + case "1": + // mainnet + resolve(false); break; + case "3": + // ropsten + resolve(true); break; + case "4": + // rinkeby + resolve(false); break; + case "42": + // kovan + resolve(true); break; + case "1001": + // docker + resolve(true); break; + case "1002": + // development + resolve(true); break; + default: + resolve(false); + } + }); + }); + } + + public checkNotNullAddress(address: Address): boolean { + return address !== Constants.NULL_ADDRESS; + } + + public checkValidAddress(address: Address): boolean { + return ethUtil.isValidAddress(address); + } + + public estimateGas(opts: {}): Promise { + const web3 = this.checkWeb3(); + + return new Promise((resolve: any, reject: any) => { + web3.eth.estimateGas(opts, (err: any, gas: any) => { + if (!err) { + resolve(gas); + } else { + reject(err); + } + }); + }); + } + + public getABI(name: string): {} { + return require(`../static/build/abi/${name}.json`); + } + + public getBalance(address: Address): Promise { + const web3 = this.checkWeb3(); + + return new Promise((resolve: any, reject: any) => { + web3.eth.getBalance(address, (err: any, bal: any) => { + if (!err) { + resolve(bal); + } else { + reject(err); + } + }); + }); + } + + public getBlockNumber(): Promise { + const web3 = this.checkWeb3(); + + return new Promise((resolve: any, reject: any) => { + web3.eth.getBlockNumber((err: any, blockNum: any) => { + if (!err) { + resolve(blockNum); + } else { + reject(err); + } + }); + }); + } + + public getGasPrice(): Promise { + const web3 = this.checkWeb3(); + + return new Promise((resolve: any, reject: any) => { + web3.eth.getGasPrice((err: any, gasPrice: any) => { + if (!err) { + resolve(gasPrice); + } else { + reject(err); + } + }); + }); + } + + public getTimestamp(): Promise { + const web3 = this.checkWeb3(); + + return new Promise((resolve: any, reject: any) => { + web3.eth.getBlock("latest", (err: any, block: any) => { + if (!err) { + resolve(block.timestamp); + } else { + reject(err); + } + }); + }); + } + + public getTimestampForBlock(blockNum: any): any { + const web3 = this.checkWeb3(); + + this.getBlockNumber().then((curBlockNum) => { + if (blockNum > curBlockNum) { + throw new Error(`[eac.js-lib] Passed blockNum ${blockNum} is greater than current blockNum ${curBlockNum}`); + } + + return new Promise((resolve: any, reject: any) => { + web3.eth.getBlock(blockNum, (err: any, block: any) => { + if (!err) { + resolve(block.timestamp); + } else { + reject(err); + } + }); + }); + }); + } + + public getTxRequestFromReceipt(receipt: any): Address { + const newRequestLog = receipt.logs.find((log: any) => { + return log.topics[0] === Constants.NEWREQUESTLOG; + }); + + if (!newRequestLog) { + throw new Error("[eac.js-lib] Invalid receipt passed!"); + } + + return "0x" + newRequestLog.data.slice(-40); + } + + public getChainName(): Promise { + const web3 = this.checkWeb3(); + + return new Promise((resolve: any, reject: any) => { + web3.version.getNetwork((err: any, netId: any) => { + switch (netId) { + case "1": + reject("Not implemented on mainnet."); + break; + case "3": + resolve("ropsten"); + break; + case "4": + resolve("rinkeby"); + break; + case "42": + resolve("kovan"); + break; + case "1001": + resolve("docker"); + break; + case "1002": + resolve("development"); + break; + default: + resolve("tester"); + } + }); + }); + } + + public waitForTransactionToBeMined(txHash: any, interval: any): Promise { + interval = interval || 500; + const web3 = this.checkWeb3(); + + const txReceiptAsync = (txHash2: any, resolve: any, reject: any) => { + web3.eth.getTransactionReceipt(txHash2, (err: any, receipt: any) => { + if (err) { + reject(err); + } else if (receipt === null) { + setTimeout(() => { + txReceiptAsync(txHash2, resolve, reject); + }, interval); + } else { + resolve(receipt); + } + }); + }; + + return new Promise((resolve: any, reject: any) => { + txReceiptAsync(txHash, resolve, reject); + }); + } + + private checkWeb3(): any { + if (!this.web3) { + throw new Error(UTIL_ERROR.WEB3_ERROR); + } + return this.web3; + } +} + +// module.exports = (web3) => { +// if (!web3) { +// return { +// calcEndowment, +// checkForUnlockedAccount, +// checkNetworkID, +// checkNotNullAddress, +// checkValidAddress, +// estimateGas, +// getABI, +// getBalance, +// getBlockNumber, +// getChainName, +// getGasPrice, +// getTimestamp, +// getTimestampForBlock, +// getTxRequestFromReceipt, +// waitForTransactionToBeMined, +// } +// } + +// return { +// calcEndowment, +// checkForUnlockedAccount: () => checkForUnlockedAccount(web3), +// checkNetworkID: () => checkNetworkID(web3), +// checkNotNullAddress, +// checkValidAddress, +// estimateGas: opts => estimateGas(web3, opts), +// getABI, +// getBalance: address => getBalance(web3, address), +// getBlockNumber: () => getBlockNumber(web3), +// getChainName: () => getChainName(web3), +// getGasPrice: () => getGasPrice(web3), +// getTimestamp: () => getTimestamp(web3), +// getTimestampForBlock: blockNum => getTimestampForBlock(web3, blockNum), +// getTxRequestFromReceipt, +// waitForTransactionToBeMined: txHash => +// waitForTransactionToBeMined(web3, txHash), +// } +// } diff --git a/static/assets/development.json b/static/assets/development.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/static/assets/development.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/lib/assets/kovan.json b/static/assets/kovan.json similarity index 100% rename from lib/assets/kovan.json rename to static/assets/kovan.json diff --git a/static/assets/mock.json b/static/assets/mock.json new file mode 100644 index 0000000..d5e4475 --- /dev/null +++ b/static/assets/mock.json @@ -0,0 +1,17 @@ +{ + "baseScheduler": "0xa5b77caa4f414a9f1a350d1ae2c2c9f66c9b1e44", + "blockScheduler": "0x394ce9fe06c72f18e5a845842974f0c1224b1ff5", + "claimLib": "0x7a764bb00fe101c53450a97519ad191e3c4830c5", + "executionLib": "0x4069bd5286f1287173f683295683e97783913fc4", + "iterTools": "0x97a614f0dfd6e034e081b79fbaa1c6531e3956ee", + "mathLib": "0xea5c9406c8ee832fed3d82348a9992c20640eaee", + "paymentLib": "0x4c767bb10b5b0f4aafd68d6a26513082152444c4", + "requestFactory": "0x98c128b3d8a0ac240f7b7dd4969ea0ad54f9d330", + "requestLib": "0x3381d072c9672747c69342c78f1fc97b1db3db84", + "requestMetaLib": "0x3fef9e4c267b6d1d508ee547fca9e474787ef68e", + "requestScheduleLib": "0x4206938c8c3853898fc7bc227aaf420bfca32aa2", + "safeMath": "0x656aa18a8cd4e2e60470f1a01080ad0a8bed4781", + "timestampScheduler": "0x31bbbf5180f2bd9c213e2e1d91a439677243268a", + "transactionRequestCore": "0x54d4a85e85a54d21168ebf37fa22e32eb79b8d3f", + "transactionRecorder": "0xcf5aa253bb5bd2d38ebc659ded8a4c3846b5471e" +} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..dae6bff --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,59 @@ +{ + "compilerOptions": { + /* Basic Options */ + "target": "es2015", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */ + "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ + "lib": ["es2015"], /* Specify library files to be included in the compilation. */ + // "allowJs": true, /* Allow javascript files to be compiled. */ + // "checkJs": true, /* Report errors in .js files. */ + // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ + "declaration": true, /* Generates corresponding '.d.ts' file. */ + // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ + // "sourceMap": true, /* Generates corresponding '.map' file. */ + // "outFile": "./build", /* Concatenate and emit output to single file. */ + "outDir": "./build", /* Redirect output structure to the directory. */ + // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ + // "composite": true, /* Enable project compilation */ + // "removeComments": true, /* Do not emit comments to output. */ + // "noEmit": true, /* Do not emit outputs. */ + // "importHelpers": true, /* Import emit helpers from 'tslib'. */ + // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ + // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ + + /* Strict Type-Checking Options */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* Enable strict null checks. */ + // "strictFunctionTypes": true, /* Enable strict checking of function types. */ + // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ + // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ + // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + + /* Additional Checks */ + // "noUnusedLocals": true, /* Report errors on unused locals. */ + // "noUnusedParameters": true, /* Report errors on unused parameters. */ + // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ + // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ + + /* Module Resolution Options */ + // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ + // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ + // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ + // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ + // "typeRoots": [], /* List of folders to include type definitions from. */ + // "types": [], /* Type declaration files to be included in compilation. */ + // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ + // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ + + /* Source Map Options */ + // "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ + // "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ + // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ + + /* Experimental Options */ + // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ + // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + } +} \ No newline at end of file diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000..2ee7357 --- /dev/null +++ b/tslint.json @@ -0,0 +1,8 @@ +{ + "extends": [ + "tslint:recommended" + ], + "jsRules": {}, + "rules": {}, + "rulesDirectory": [] +} \ No newline at end of file