diff --git a/Makefile b/Makefile index 062d377..b4c6590 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ PWD=${shell pwd} BOOST_LIBS=chrono,date_time,filesystem,program_options,regex,serialization,system,thread,locale THREADS?=6 + .PHONY: all all: binding.gyp deps node_modules/.bin/node-pre-gyp configure build @@ -42,10 +43,24 @@ safexcore: git clone --depth 1 --recurse-submodules -b ${SAFEX_BRANCH} https://github.com/safex/safexcore cp safexcore/src/wallet/api/wallet_api.h include +ifeq ($(OS),Windows_NT) +#windows +safexcore/build: boost safexcore + mkdir -p safexcore/build + mkdir -p deps + cp safexcore/src/wallet/api/win_wrapper/windows_wrapper.h include + cd safexcore/build && cmake -G "MSYS Makefiles" -DBUILD_TAG="win-x64" -DCMAKE_TOOLCHAIN_FILE=../cmake/64-bit-toolchain.cmake -DMSYS2_FOLDER=c:/msys64 -DARCH="x86-64" \ + -DBUILD_64=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_GUI_DEPS=ON -DBUILD_TESTS=OFF -DSTATIC=ON -DBOOST_ROOT=${PWD}/boost -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true \ + -DBUILD_WIN_WALLET_WRAPPER=ON -DCMAKE_ARCHIVE_OUTPUT_DIRECTORY=${PWD}/deps .. + cd safexcore/build && make -j${THREADS} + cp safexcore/build/src/wallet/api/win_wrapper/libwin_wallet_wrapper.* ${PWD}/deps + cd deps && '/c/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/lib.exe' /machine:x64 /def:libwin_wallet_wrapper.def +else +#linux, mac safexcore/build: boost safexcore mkdir -p safexcore/build mkdir -p deps - cd safexcore/build && cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_GUI_DEPS=ON -DEMBEDDED_WALLET=1 \ + cd safexcore/build && cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_GUI_DEPS=ON \ -DBUILD_TESTS=OFF -DSTATIC=ON -DBOOST_ROOT=${PWD}/boost \ -DCMAKE_BUILD_TYPE=${SAFEX_BUILD_TYPE} \ -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true \ @@ -54,3 +69,6 @@ safexcore/build: boost safexcore cd safexcore/build && make -j${THREADS} wallet_merged epee easylogging lmdb unbound VERBOSE=1 cp safexcore/build/lib/libwallet_merged.a ${PWD}/deps + +endif + diff --git a/binding.gyp b/binding.gyp index 93fb9df..1670abe 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,57 +1,139 @@ { "conditions": [ - ['OS=="linux"', { - "variables": { - 'additional_libraries': [ - "-lpcsclite", - ] - } - }], - ['OS=="mac"', { - "variables": { - 'additional_libraries': [ - "-framework PCSC", - ] - } - }] - ], - "targets": [ - { - "target_name": "build_safex", - "type": "none", - "actions": [ + [ + 'OS=="win"', + { + + "targets":[ { - "action_name": "retrieve_from_github", - "inputs": "", - "outputs": [ - "../deps/libwallet_merged.a", - "../deps/libepee.a", - "../deps/libeasylogging.a", - "../deps/liblmdb.a", - "../deps/libunbound.a", + "target_name": "build_safex", + "type": "none", + "actions": [ + { + "action_name": "retrieve_from_github", + "inputs": "", + "outputs": [ + "../deps/libwin_wallet_wrapper.dll", + ], + "action": [ + "make deps","--directory=.."], + "message": "Building windows safex libraries" + } + ] + }, + { + "target_name": "safex", + "dependencies": [ + "build_safex" ], - "action": ["make","deps"], - "message": "Building safex libraries", + "sources": [ + "src/addon.cc", + "src/wallet.cc", + "src/walletcallbacks.cc", + "src/walletargs.cc", + "src/deferredtask.cc", + "src/wallettasks.cc", + "src/pendingtransaction.cc", + "src/win/winwallet.cpp", + "src/win/winwalletlistener.cpp", + "src/win/winwalletmanager.cpp", + "src/win/winpendingtransaction.cpp", + "src/win/misc.cpp" + ], + "libraries": [ + '-l../deps/libwin_wallet_wrapper.lib' + ], + "include_dirs": [ + "include", + "src", + "src/win", + "<!(node -e \"require('nan')\")" + ] }, + { + "target_name": "action_after_build", + "type": "none", + "dependencies": [ + "<(module_name)" + ], + "copies": [ + { + "files": [ + "<(PRODUCT_DIR)/<(module_name).node", + "./deps/libwin_wallet_wrapper.dll" + ], + "destination": "<(module_path)" + } + ] + } + ] + }, + { #nonwin + "conditions":[ + [ + 'OS=="linux"', + { + "variables": { + 'additional_libraries': [ + "-lpcsclite" + ] + } + } + ], + [ + 'OS=="mac"', + { + "variables": { + 'additional_libraries': [ + "-framework PCSC" + ] + } + } + ] ], - }, - { - "target_name": "safex", - "dependencies": ["build_safex"], - "sources": [ - "src/addon.cc", - "src/wallet.cc", - "src/walletcallbacks.cc", - "src/walletargs.cc", - "src/deferredtask.cc", - "src/wallettasks.cc", - "src/pendingtransaction.cc"], - "libraries": [ - "../deps/libwallet_merged.a", - "../deps/libepee.a", - "../deps/libeasylogging.a", - "../deps/liblmdb.a", - "../deps/libunbound.a", + "targets":[ + { + "target_name": "build_safex", + "type": "none", + "actions": [ + { + "action_name": "retrieve_from_github", + "inputs": "", + "outputs": [ + "../deps/libwallet_merged.a", + "../deps/libepee.a", + "../deps/libeasylogging.a", + "../deps/liblmdb.a", + "../deps/libunbound.a" + ], + "action": [ + "make", + "deps" + ], + "message": "Building safex libraries" + } + ] + }, + { + "target_name": "safex", + "dependencies": [ + "build_safex" + ], + "sources": [ + "src/addon.cc", + "src/wallet.cc", + "src/walletcallbacks.cc", + "src/walletargs.cc", + "src/deferredtask.cc", + "src/wallettasks.cc", + "src/pendingtransaction.cc" + ], + "libraries": [ + "../deps/libwallet_merged.a", + "../deps/libepee.a", + "../deps/libeasylogging.a", + "../deps/liblmdb.a", + "../deps/libunbound.a", "../deps/libboost_serialization.a", "../deps/libboost_thread.a", "../deps/libboost_system.a", @@ -61,25 +143,33 @@ "../deps/libboost_program_options.a", "../deps/libboost_regex.a", "<@(additional_libraries)", - "-lssl", + "-lssl", "-lcrypto", "-lz", - ""], - "include_dirs": [ - "include", + "" + ], + "include_dirs": [ + "include", "<!(node -e \"require('nan')\")" - ] - }, - { - "target_name": "action_after_build", - "type": "none", - "dependencies": [ "<(module_name)" ], - "copies": [ + ] + }, { - "files": [ "<(PRODUCT_DIR)/<(module_name).node" ], - "destination": "<(module_path)" + "target_name": "action_after_build", + "type": "none", + "dependencies": [ + "<(module_name)" + ], + "copies": [ + { + "files": [ + "<(PRODUCT_DIR)/<(module_name).node" + ], + "destination": "<(module_path)" + } + ] } ] - } + } + ] ] } diff --git a/example/index.js b/example/index.js index ae5f415..706fa89 100644 --- a/example/index.js +++ b/example/index.js @@ -10,28 +10,30 @@ safex.setupLog(3, "index.log"); var wallet; var sent = false; const wallet_path = path.join(__dirname, 'test-wallet'); - -var args = { - 'path': wallet_path, - 'password': '123', - 'network': 'testnet', - 'daemonAddress': 'localhost:29393', - 'restoreHeight': 0, - 'mnemonic' : 'nifty inflamed against focus gasp ethics spying gulp tiger cogs evicted cohesive woken nylon erosion tell saved fatal alkaline acquire lemon maps hull imitate saved' -} - +// const wallet_path = "C:/Users/marko/balkaneum/temp/test-wallet"; +// const wallet_path = "test-wallet"; // var args = { -// 'path': wallet_path, -// 'password': '123', -// 'network': 'testnet', -// 'daemonAddress': 'localhost:29393', -// 'restoreHeight': 0, -// 'addressString': 'SFXtzRzqWR2J3ytgxg1AxBfM8ZFgZmywoXHtqeqwsk3Gi63B2c3mvLNct35m268Pg2eGqHLmJubC7GPdvb1KxhTvHeVd4WKD9RQ', -// 'viewKeyString': '', -// 'spendKeyString': '' +// 'path': wallet_path, +// 'password': '123', +// 'network': 'testnet', +// 'daemonAddress': '192.168.1.194:29393', +// 'restoreHeight': 0, +// 'mnemonic' : 'nifty inflamed against focus gasp ethics spying gulp tiger cogs evicted cohesive woken nylon erosion tell saved fatal alkaline acquire lemon maps hull imitate saved' // } + +var args = { + 'path': wallet_path, + 'password': '123', + 'network': 'testnet', + 'daemonAddress': '192.168.1.194:29393', + 'restoreHeight': 0, + 'addressString': 'SFXtzU6Azx3N61CBXBK2KZBGUw2U3XQXKEZkSvBrfeczNvn6yXeWk4wXkNajNNe7xv1eeuH4rrrFiJMC5Ed1uN3GXt5vuDJkV3B', + 'viewKeyString': 'c135405a2f0e0b6302e0c2d0a5f056fbf7f37eaad7bf67769d6fa35d2a55e200', + 'spendKeyString': '5270759c9602bef14a0f937f25cc84e4b599b5ab3e22ab874ceff7799ec69a03' +} + if (!safex.walletExists(wallet_path)) { console.log("wallet doesn't exist. creating new one: " + wallet_path); if(args.mnemonic) @@ -84,26 +86,40 @@ promise if (!sent) { sent = true; + // //cash // wallet.createTransaction({ // 'address': 'SFXtzT37s8jWtjUx8kfWD24PU2mMLqYkt7DQ3KzJKC7B3pp67XFpFJhiEvwTe1DX9gT7nWcYZQRt7UWnEoWDcjmLdegfWoLVZwY', // 'amount': '21300000000', //send 2.13 cash - // }) - wallet.createTransaction({ - 'address': 'SFXtzT37s8jWtjUx8kfWD24PU2mMLqYkt7DQ3KzJKC7B3pp67XFpFJhiEvwTe1DX9gT7nWcYZQRt7UWnEoWDcjmLdegfWoLVZwY', - 'amount': '30000000000', //send 3 tokens - 'tx_type': 1 //token transaction - }).then((tx) => { - console.log("token transaction created: " + tx.transactionsIds()); - - tx.commit().then(() => { - console.log("transaction commited successfully"); - }).catch((e) => { - console.log("error on commiting transaction: " + e); - }); - }).catch((e) => { - sent = false; - console.log("couldn't create transaction: " + e); - }); + // }).then((tx) => { + // console.log("cash transaction created: " + tx.transactionsIds()); + // + // tx.commit().then(() => { + // console.log("cash transaction commited successfully"); + // }).catch((e) => { + // console.log("error on commiting transaction: " + e); + // }); + // }).catch((e) => { + // sent = false; + // console.log("couldn't create transaction: " + e); + // }); + // + //token + // wallet.createTransaction({ + // 'address': 'SFXtzT37s8jWtjUx8kfWD24PU2mMLqYkt7DQ3KzJKC7B3pp67XFpFJhiEvwTe1DX9gT7nWcYZQRt7UWnEoWDcjmLdegfWoLVZwY', + // 'amount': '30000000000', //send 3 tokens + // 'tx_type': 1 //token transaction + // }).then((tx) => { + // console.log("token transaction created: " + tx.transactionsIds()); + // + // tx.commit().then(() => { + // console.log("transaction commited successfully"); + // }).catch((e) => { + // console.log("error on commiting transaction: " + e); + // }); + // }).catch((e) => { + // sent = false; + // console.log("couldn't create transaction: " + e); + // }); } }); diff --git a/example/package-lock.json b/example/package-lock.json index 06f817c..4c63f77 100644 --- a/example/package-lock.json +++ b/example/package-lock.json @@ -25,9 +25,9 @@ "integrity": "sha512-tHq6qdbT9U1IRSGf14CL0pUlULksvY9OZ+5eEgl1N7t+OA3tGvNpxJCzuKQlsNgCVwbAs670L1vcVQi8j9HjnA==" }, "@types/node": { - "version": "10.12.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.6.tgz", - "integrity": "sha512-+ZWB5Ec1iki99xQFzBlivlKxSZQ+fuUKBott8StBOnLN4dWbRHlgdg1XknpW6g0tweniN5DcOqA64CJyOUPSAw==" + "version": "10.12.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.12.10.tgz", + "integrity": "sha512-8xZEYckCbUVgK8Eg7lf5Iy4COKJ5uXlnIOnePN0WUwSQggy9tolM+tDJf7wMOnT/JT/W9xDYIaYggt3mRV2O5w==" }, "array-union": { "version": "1.0.2", @@ -102,7 +102,7 @@ }, "globby": { "version": "6.1.0", - "resolved": "https://registry.npmjs.org/globby/-/globby-6.1.0.tgz", + "resolved": "http://registry.npmjs.org/globby/-/globby-6.1.0.tgz", "integrity": "sha1-9abXDoOV4hyFj7BInWTfAkJNUGw=", "requires": { "array-union": "^1.0.1", @@ -237,24 +237,131 @@ "node-pre-gyp": "^0.9.1" }, "dependencies": { + "@babel/code-frame": { + "version": "7.0.0", + "bundled": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/generator": { + "version": "7.1.6", + "bundled": true, + "requires": { + "@babel/types": "^7.1.6", + "jsesc": "^2.5.1", + "lodash": "^4.17.10", + "source-map": "^0.5.0", + "trim-right": "^1.0.1" + } + }, + "@babel/helper-function-name": { + "version": "7.1.0", + "bundled": true, + "requires": { + "@babel/helper-get-function-arity": "^7.0.0", + "@babel/template": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0", + "bundled": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.0.0", + "bundled": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.0.0", + "bundled": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.1.6", + "bundled": true + }, + "@babel/template": { + "version": "7.1.2", + "bundled": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/parser": "^7.1.2", + "@babel/types": "^7.1.2" + } + }, + "@babel/traverse": { + "version": "7.1.6", + "bundled": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "@babel/generator": "^7.1.6", + "@babel/helper-function-name": "^7.1.0", + "@babel/helper-split-export-declaration": "^7.0.0", + "@babel/parser": "^7.1.6", + "@babel/types": "^7.1.6", + "debug": "^4.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.10" + }, + "dependencies": { + "debug": { + "version": "4.1.0", + "bundled": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.1", + "bundled": true + } + } + }, + "@babel/types": { + "version": "7.1.6", + "bundled": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.10", + "to-fast-properties": "^2.0.0" + } + }, "abbrev": { "version": "1.1.1", "bundled": true }, "ajv": { - "version": "5.5.2", + "version": "6.5.5", "bundled": true, "requires": { - "co": "^4.6.0", - "fast-deep-equal": "^1.0.0", + "fast-deep-equal": "^2.0.1", "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.3.0" + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" } }, "ansi-regex": { "version": "2.1.1", "bundled": true }, + "ansi-styles": { + "version": "3.2.1", + "bundled": true, + "requires": { + "color-convert": "^1.9.0" + } + }, "aproba": { "version": "1.2.0", "bundled": true @@ -290,7 +397,7 @@ "bundled": true }, "aws-sdk": { - "version": "2.351.0", + "version": "2.360.0", "bundled": true, "requires": { "buffer": "4.9.1", @@ -329,7 +436,6 @@ "bcrypt-pbkdf": { "version": "1.0.2", "bundled": true, - "optional": true, "requires": { "tweetnacl": "^0.14.3" } @@ -346,7 +452,7 @@ } }, "bluebird": { - "version": "3.5.2", + "version": "3.5.3", "bundled": true }, "brace-expansion": { @@ -357,6 +463,10 @@ "concat-map": "0.0.1" } }, + "browser-process-hrtime": { + "version": "1.0.0", + "bundled": true + }, "buffer": { "version": "4.9.1", "bundled": true, @@ -370,10 +480,23 @@ "version": "1.1.1", "bundled": true }, + "capture-stack-trace": { + "version": "1.0.1", + "bundled": true + }, "caseless": { "version": "0.12.0", "bundled": true }, + "chalk": { + "version": "2.4.1", + "bundled": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, "chownr": { "version": "1.1.1", "bundled": true @@ -382,14 +505,21 @@ "version": "0.1.0", "bundled": true }, - "co": { - "version": "4.6.0", - "bundled": true - }, "code-point-at": { "version": "1.1.0", "bundled": true }, + "color-convert": { + "version": "1.9.3", + "bundled": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "bundled": true + }, "color-support": { "version": "1.1.3", "bundled": true @@ -473,10 +603,13 @@ "version": "1.4.0", "bundled": true }, + "domain-browser": { + "version": "1.2.0", + "bundled": true + }, "ecc-jsbn": { "version": "0.1.2", "bundled": true, - "optional": true, "requires": { "jsbn": "~0.1.0", "safer-buffer": "^2.1.0" @@ -490,6 +623,10 @@ "version": "4.0.1", "bundled": true }, + "esutils": { + "version": "2.0.2", + "bundled": true + }, "events": { "version": "1.1.1", "bundled": true @@ -507,7 +644,7 @@ "bundled": true }, "fast-deep-equal": { - "version": "1.1.0", + "version": "2.0.1", "bundled": true }, "fast-json-stable-stringify": { @@ -527,21 +664,12 @@ "bundled": true }, "form-data": { - "version": "2.3.2", + "version": "2.3.3", "bundled": true, "requires": { "asynckit": "^0.4.0", - "combined-stream": "1.0.6", + "combined-stream": "^1.0.6", "mime-types": "^2.1.12" - }, - "dependencies": { - "combined-stream": { - "version": "1.0.6", - "bundled": true, - "requires": { - "delayed-stream": "~1.0.0" - } - } } }, "fs-exists-cached": { @@ -606,8 +734,12 @@ "path-is-absolute": "^1.0.0" } }, + "globals": { + "version": "11.9.0", + "bundled": true + }, "graceful-fs": { - "version": "4.1.11", + "version": "4.1.15", "bundled": true }, "growl": { @@ -619,13 +751,17 @@ "bundled": true }, "har-validator": { - "version": "5.1.0", + "version": "5.1.3", "bundled": true, "requires": { - "ajv": "^5.3.0", + "ajv": "^6.5.5", "har-schema": "^2.0.0" } }, + "has-flag": { + "version": "3.0.0", + "bundled": true + }, "has-unicode": { "version": "2.0.1", "bundled": true @@ -700,10 +836,31 @@ "version": "0.1.2", "bundled": true }, + "istanbul-lib-coverage": { + "version": "2.0.1", + "bundled": true + }, + "istanbul-lib-instrument": { + "version": "3.0.0", + "bundled": true, + "requires": { + "@babel/generator": "^7.0.0", + "@babel/parser": "^7.0.0", + "@babel/template": "^7.0.0", + "@babel/traverse": "^7.0.0", + "@babel/types": "^7.0.0", + "istanbul-lib-coverage": "^2.0.1", + "semver": "^5.5.0" + } + }, "jmespath": { "version": "0.15.0", "bundled": true }, + "js-tokens": { + "version": "4.0.0", + "bundled": true + }, "js-yaml": { "version": "3.12.0", "bundled": true, @@ -714,15 +871,18 @@ }, "jsbn": { "version": "0.1.1", - "bundled": true, - "optional": true + "bundled": true + }, + "jsesc": { + "version": "2.5.2", + "bundled": true }, "json-schema": { "version": "0.2.3", "bundled": true }, "json-schema-traverse": { - "version": "0.3.1", + "version": "0.4.1", "bundled": true }, "json-stringify-safe": { @@ -743,33 +903,31 @@ "version": "0.0.10", "bundled": true }, + "lodash": { + "version": "4.17.11", + "bundled": true + }, "log-driver": { "version": "1.2.7", "bundled": true }, "lru-cache": { - "version": "4.1.3", + "version": "4.1.4", "bundled": true, "requires": { "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - }, - "dependencies": { - "yallist": { - "version": "2.1.2", - "bundled": true - } + "yallist": "^3.0.2" } }, "mime-db": { - "version": "1.36.0", + "version": "1.37.0", "bundled": true }, "mime-types": { - "version": "2.1.20", + "version": "2.1.21", "bundled": true, "requires": { - "mime-db": "~1.36.0" + "mime-db": "~1.37.0" } }, "minimatch": { @@ -784,7 +942,7 @@ "bundled": true }, "minipass": { - "version": "2.3.4", + "version": "2.3.5", "bundled": true, "requires": { "safe-buffer": "^5.1.2", @@ -792,7 +950,7 @@ } }, "minizlib": { - "version": "1.1.0", + "version": "1.1.1", "bundled": true, "requires": { "minipass": "^2.2.1" @@ -891,7 +1049,7 @@ "bundled": true }, "npm-packlist": { - "version": "1.1.11", + "version": "1.1.12", "bundled": true, "requires": { "ignore-walk": "^3.0.1", @@ -913,36 +1071,34 @@ "bundled": true }, "nyc": { - "version": "11.9.0", + "version": "13.1.0", "bundled": true, "requires": { "archy": "^1.0.0", "arrify": "^1.0.1", - "caching-transform": "^1.0.0", - "convert-source-map": "^1.5.1", + "caching-transform": "^2.0.0", + "convert-source-map": "^1.6.0", "debug-log": "^1.0.1", - "default-require-extensions": "^1.0.0", - "find-cache-dir": "^0.1.1", - "find-up": "^2.1.0", - "foreground-child": "^1.5.3", - "glob": "^7.0.6", - "istanbul-lib-coverage": "^1.1.2", - "istanbul-lib-hook": "^1.1.0", - "istanbul-lib-instrument": "^1.10.0", - "istanbul-lib-report": "^1.1.3", - "istanbul-lib-source-maps": "^1.2.3", - "istanbul-reports": "^1.4.0", - "md5-hex": "^1.2.0", + "find-cache-dir": "^2.0.0", + "find-up": "^3.0.0", + "foreground-child": "^1.5.6", + "glob": "^7.1.3", + "istanbul-lib-coverage": "^2.0.1", + "istanbul-lib-hook": "^2.0.1", + "istanbul-lib-instrument": "^3.0.0", + "istanbul-lib-report": "^2.0.2", + "istanbul-lib-source-maps": "^2.0.1", + "istanbul-reports": "^2.0.1", + "make-dir": "^1.3.0", "merge-source-map": "^1.1.0", - "micromatch": "^3.1.10", - "mkdirp": "^0.5.0", - "resolve-from": "^2.0.0", + "resolve-from": "^4.0.0", "rimraf": "^2.6.2", - "signal-exit": "^3.0.1", + "signal-exit": "^3.0.2", "spawn-wrap": "^1.4.2", - "test-exclude": "^4.2.0", + "test-exclude": "^5.0.0", + "uuid": "^3.3.2", "yargs": "11.1.0", - "yargs-parser": "^8.0.0" + "yargs-parser": "^9.0.2" }, "dependencies": { "align-text": { @@ -959,191 +1115,32 @@ "bundled": true }, "ansi-regex": { - "version": "2.1.1", - "bundled": true - }, - "ansi-styles": { - "version": "2.2.1", + "version": "3.0.0", "bundled": true }, "append-transform": { - "version": "0.4.0", + "version": "1.0.0", "bundled": true, "requires": { - "default-require-extensions": "^1.0.0" + "default-require-extensions": "^2.0.0" } }, "archy": { "version": "1.0.0", "bundled": true }, - "arr-diff": { - "version": "4.0.0", - "bundled": true - }, - "arr-flatten": { - "version": "1.1.0", - "bundled": true - }, - "arr-union": { - "version": "3.1.0", - "bundled": true - }, - "array-unique": { - "version": "0.3.2", - "bundled": true - }, "arrify": { "version": "1.0.1", "bundled": true }, - "assign-symbols": { - "version": "1.0.0", - "bundled": true - }, "async": { "version": "1.5.2", "bundled": true }, - "atob": { - "version": "2.1.1", - "bundled": true - }, - "babel-code-frame": { - "version": "6.26.0", - "bundled": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - } - }, - "babel-generator": { - "version": "6.26.1", - "bundled": true, - "requires": { - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "detect-indent": "^4.0.0", - "jsesc": "^1.3.0", - "lodash": "^4.17.4", - "source-map": "^0.5.7", - "trim-right": "^1.0.1" - } - }, - "babel-messages": { - "version": "6.23.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, - "babel-runtime": { - "version": "6.26.0", - "bundled": true, - "requires": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" - } - }, - "babel-template": { - "version": "6.26.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "lodash": "^4.17.4" - } - }, - "babel-traverse": { - "version": "6.26.0", - "bundled": true, - "requires": { - "babel-code-frame": "^6.26.0", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "debug": "^2.6.8", - "globals": "^9.18.0", - "invariant": "^2.2.2", - "lodash": "^4.17.4" - } - }, - "babel-types": { - "version": "6.26.0", - "bundled": true, - "requires": { - "babel-runtime": "^6.26.0", - "esutils": "^2.0.2", - "lodash": "^4.17.4", - "to-fast-properties": "^1.0.3" - } - }, - "babylon": { - "version": "6.18.0", - "bundled": true - }, "balanced-match": { "version": "1.0.0", "bundled": true }, - "base": { - "version": "0.11.2", - "bundled": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, - "kind-of": { - "version": "6.0.2", - "bundled": true - } - } - }, "brace-expansion": { "version": "1.1.11", "bundled": true, @@ -1152,63 +1149,18 @@ "concat-map": "0.0.1" } }, - "braces": { - "version": "2.3.2", - "bundled": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, "builtin-modules": { "version": "1.1.1", "bundled": true }, - "cache-base": { - "version": "1.0.1", - "bundled": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, "caching-transform": { - "version": "1.0.1", + "version": "2.0.0", "bundled": true, "requires": { - "md5-hex": "^1.2.0", - "mkdirp": "^0.5.1", - "write-file-atomic": "^1.1.4" + "make-dir": "^1.0.0", + "md5-hex": "^2.0.0", + "package-hash": "^2.0.0", + "write-file-atomic": "^2.0.0" } }, "camelcase": { @@ -1225,40 +1177,6 @@ "lazy-cache": "^1.0.3" } }, - "chalk": { - "version": "1.1.3", - "bundled": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "class-utils": { - "version": "0.3.6", - "bundled": true, - "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "bundled": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, "cliui": { "version": "2.1.0", "bundled": true, @@ -1280,37 +1198,20 @@ "version": "1.1.0", "bundled": true }, - "collection-visit": { - "version": "1.0.0", - "bundled": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, "commondir": { "version": "1.0.1", "bundled": true }, - "component-emitter": { - "version": "1.2.1", - "bundled": true - }, "concat-map": { "version": "0.0.1", "bundled": true }, "convert-source-map": { - "version": "1.5.1", - "bundled": true - }, - "copy-descriptor": { - "version": "0.1.1", - "bundled": true - }, - "core-js": { - "version": "2.5.6", - "bundled": true + "version": "1.6.0", + "bundled": true, + "requires": { + "safe-buffer": "~5.1.1" + } }, "cross-spawn": { "version": "4.0.2", @@ -1321,7 +1222,7 @@ } }, "debug": { - "version": "2.6.9", + "version": "3.1.0", "bundled": true, "requires": { "ms": "2.0.0" @@ -1335,78 +1236,22 @@ "version": "1.2.0", "bundled": true }, - "decode-uri-component": { - "version": "0.2.0", - "bundled": true - }, "default-require-extensions": { - "version": "1.0.0", - "bundled": true, - "requires": { - "strip-bom": "^2.0.0" - } - }, - "define-property": { - "version": "2.0.2", - "bundled": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "dependencies": { - "is-accessor-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, - "kind-of": { - "version": "6.0.2", - "bundled": true - } - } - }, - "detect-indent": { - "version": "4.0.0", + "version": "2.0.0", "bundled": true, "requires": { - "repeating": "^2.0.0" + "strip-bom": "^3.0.0" } }, "error-ex": { - "version": "1.3.1", + "version": "1.3.2", "bundled": true, "requires": { "is-arrayish": "^0.2.1" } }, - "escape-string-regexp": { - "version": "1.0.5", - "bundled": true - }, - "esutils": { - "version": "2.0.2", + "es6-error": { + "version": "4.1.1", "bundled": true }, "execa": { @@ -1433,148 +1278,22 @@ } } }, - "expand-brackets": { - "version": "2.1.4", - "bundled": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "bundled": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "extend-shallow": { - "version": "3.0.2", - "bundled": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "bundled": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "extglob": { - "version": "2.0.4", - "bundled": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "kind-of": { - "version": "6.0.2", - "bundled": true - } - } - }, - "fill-range": { - "version": "4.0.0", - "bundled": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, "find-cache-dir": { - "version": "0.1.1", + "version": "2.0.0", "bundled": true, "requires": { "commondir": "^1.0.1", - "mkdirp": "^0.5.1", - "pkg-dir": "^1.0.0" + "make-dir": "^1.0.0", + "pkg-dir": "^3.0.0" } }, "find-up": { - "version": "2.1.0", + "version": "3.0.0", "bundled": true, "requires": { - "locate-path": "^2.0.0" + "locate-path": "^3.0.0" } }, - "for-in": { - "version": "1.0.2", - "bundled": true - }, "foreground-child": { "version": "1.5.6", "bundled": true, @@ -1583,31 +1302,20 @@ "signal-exit": "^3.0.0" } }, - "fragment-cache": { - "version": "0.2.1", - "bundled": true, - "requires": { - "map-cache": "^0.2.2" - } - }, "fs.realpath": { "version": "1.0.0", "bundled": true }, "get-caller-file": { - "version": "1.0.2", + "version": "1.0.3", "bundled": true }, "get-stream": { "version": "3.0.0", "bundled": true }, - "get-value": { - "version": "2.0.6", - "bundled": true - }, "glob": { - "version": "7.1.2", + "version": "7.1.3", "bundled": true, "requires": { "fs.realpath": "^1.0.0", @@ -1618,10 +1326,6 @@ "path-is-absolute": "^1.0.0" } }, - "globals": { - "version": "9.18.0", - "bundled": true - }, "graceful-fs": { "version": "4.1.11", "bundled": true @@ -1645,67 +1349,12 @@ } } }, - "has-ansi": { - "version": "2.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, "has-flag": { - "version": "1.0.0", + "version": "3.0.0", "bundled": true }, - "has-value": { - "version": "1.0.0", - "bundled": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, - "has-values": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "kind-of": { - "version": "4.0.0", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, "hosted-git-info": { - "version": "2.6.0", + "version": "2.7.1", "bundled": true }, "imurmurhash": { @@ -1724,24 +1373,10 @@ "version": "2.0.3", "bundled": true }, - "invariant": { - "version": "2.2.4", - "bundled": true, - "requires": { - "loose-envify": "^1.0.0" - } - }, "invert-kv": { "version": "1.0.0", "bundled": true }, - "is-accessor-descriptor": { - "version": "0.1.6", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - } - }, "is-arrayish": { "version": "0.2.1", "bundled": true @@ -1757,176 +1392,64 @@ "builtin-modules": "^1.0.0" } }, - "is-data-descriptor": { - "version": "0.1.4", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-descriptor": { - "version": "0.1.6", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "bundled": true - } - } - }, - "is-extendable": { - "version": "0.1.1", - "bundled": true - }, - "is-finite": { - "version": "1.0.2", - "bundled": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, "is-fullwidth-code-point": { "version": "2.0.0", "bundled": true }, - "is-number": { - "version": "3.0.0", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-odd": { - "version": "2.0.0", - "bundled": true, - "requires": { - "is-number": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "bundled": true - } - } - }, - "is-plain-object": { - "version": "2.0.4", - "bundled": true, - "requires": { - "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, "is-stream": { "version": "1.1.0", "bundled": true }, - "is-utf8": { - "version": "0.2.1", - "bundled": true - }, - "is-windows": { - "version": "1.0.2", - "bundled": true - }, - "isarray": { - "version": "1.0.0", - "bundled": true - }, "isexe": { "version": "2.0.0", "bundled": true }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, "istanbul-lib-coverage": { - "version": "1.2.0", + "version": "2.0.1", "bundled": true }, "istanbul-lib-hook": { - "version": "1.1.0", - "bundled": true, - "requires": { - "append-transform": "^0.4.0" - } - }, - "istanbul-lib-instrument": { - "version": "1.10.1", + "version": "2.0.1", "bundled": true, "requires": { - "babel-generator": "^6.18.0", - "babel-template": "^6.16.0", - "babel-traverse": "^6.18.0", - "babel-types": "^6.18.0", - "babylon": "^6.18.0", - "istanbul-lib-coverage": "^1.2.0", - "semver": "^5.3.0" + "append-transform": "^1.0.0" } }, "istanbul-lib-report": { - "version": "1.1.3", + "version": "2.0.2", "bundled": true, "requires": { - "istanbul-lib-coverage": "^1.1.2", - "mkdirp": "^0.5.1", - "path-parse": "^1.0.5", - "supports-color": "^3.1.2" - }, - "dependencies": { - "supports-color": { - "version": "3.2.3", - "bundled": true, - "requires": { - "has-flag": "^1.0.0" - } - } + "istanbul-lib-coverage": "^2.0.1", + "make-dir": "^1.3.0", + "supports-color": "^5.4.0" } }, "istanbul-lib-source-maps": { - "version": "1.2.3", + "version": "2.0.1", "bundled": true, "requires": { "debug": "^3.1.0", - "istanbul-lib-coverage": "^1.1.2", - "mkdirp": "^0.5.1", - "rimraf": "^2.6.1", - "source-map": "^0.5.3" + "istanbul-lib-coverage": "^2.0.1", + "make-dir": "^1.3.0", + "rimraf": "^2.6.2", + "source-map": "^0.6.1" }, "dependencies": { - "debug": { - "version": "3.1.0", - "bundled": true, - "requires": { - "ms": "2.0.0" - } + "source-map": { + "version": "0.6.1", + "bundled": true } } }, "istanbul-reports": { - "version": "1.4.0", + "version": "2.0.1", "bundled": true, "requires": { - "handlebars": "^4.0.3" + "handlebars": "^4.0.11" } }, - "js-tokens": { - "version": "3.0.2", - "bundled": true - }, - "jsesc": { - "version": "1.3.0", + "json-parse-better-errors": { + "version": "1.0.2", "bundled": true }, "kind-of": { @@ -1949,45 +1472,31 @@ } }, "load-json-file": { - "version": "1.1.0", + "version": "4.0.0", "bundled": true, "requires": { "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0", - "strip-bom": "^2.0.0" + "parse-json": "^4.0.0", + "pify": "^3.0.0", + "strip-bom": "^3.0.0" } }, "locate-path": { - "version": "2.0.0", + "version": "3.0.0", "bundled": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - }, - "dependencies": { - "path-exists": { - "version": "3.0.0", - "bundled": true - } + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" } }, - "lodash": { - "version": "4.17.10", + "lodash.flattendeep": { + "version": "4.4.0", "bundled": true }, "longest": { "version": "1.0.1", "bundled": true }, - "loose-envify": { - "version": "1.3.1", - "bundled": true, - "requires": { - "js-tokens": "^3.0.0" - } - }, "lru-cache": { "version": "4.1.3", "bundled": true, @@ -1996,19 +1505,15 @@ "yallist": "^2.1.2" } }, - "map-cache": { - "version": "0.2.2", - "bundled": true - }, - "map-visit": { - "version": "1.0.0", + "make-dir": { + "version": "1.3.0", "bundled": true, "requires": { - "object-visit": "^1.0.0" + "pify": "^3.0.0" } }, "md5-hex": { - "version": "1.3.0", + "version": "2.0.0", "bundled": true, "requires": { "md5-o-matic": "^0.1.1" @@ -2038,31 +1543,6 @@ } } }, - "micromatch": { - "version": "3.1.10", - "bundled": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "6.0.2", - "bundled": true - } - } - }, "mimic-fn": { "version": "1.2.0", "bundled": true @@ -2075,69 +1555,26 @@ } }, "minimist": { - "version": "0.0.8", + "version": "0.0.10", "bundled": true }, - "mixin-deep": { - "version": "1.3.1", - "bundled": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "bundled": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, "mkdirp": { "version": "0.5.1", "bundled": true, "requires": { "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.0.0", - "bundled": true - }, - "nanomatch": { - "version": "1.2.9", - "bundled": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-odd": "^2.0.0", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" }, "dependencies": { - "arr-diff": { - "version": "4.0.0", - "bundled": true - }, - "array-unique": { - "version": "0.3.2", - "bundled": true - }, - "kind-of": { - "version": "6.0.2", + "minimist": { + "version": "0.0.8", "bundled": true } } }, + "ms": { + "version": "2.0.0", + "bundled": true + }, "normalize-package-data": { "version": "2.4.0", "bundled": true, @@ -2159,54 +1596,6 @@ "version": "1.0.1", "bundled": true }, - "object-assign": { - "version": "4.1.1", - "bundled": true - }, - "object-copy": { - "version": "0.1.0", - "bundled": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "bundled": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "object-visit": { - "version": "1.0.1", - "bundled": true, - "requires": { - "isobject": "^3.0.0" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, - "object.pick": { - "version": "1.3.0", - "bundled": true, - "requires": { - "isobject": "^3.0.1" - }, - "dependencies": { - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, "once": { "version": "1.4.0", "bundled": true, @@ -2240,41 +1629,45 @@ "bundled": true }, "p-limit": { - "version": "1.2.0", + "version": "2.0.0", "bundled": true, "requires": { - "p-try": "^1.0.0" + "p-try": "^2.0.0" } }, "p-locate": { - "version": "2.0.0", + "version": "3.0.0", "bundled": true, "requires": { - "p-limit": "^1.1.0" + "p-limit": "^2.0.0" } }, "p-try": { - "version": "1.0.0", + "version": "2.0.0", "bundled": true }, - "parse-json": { - "version": "2.2.0", + "package-hash": { + "version": "2.0.0", "bundled": true, "requires": { - "error-ex": "^1.2.0" + "graceful-fs": "^4.1.11", + "lodash.flattendeep": "^4.4.0", + "md5-hex": "^2.0.0", + "release-zalgo": "^1.0.0" } }, - "pascalcase": { - "version": "0.1.1", - "bundled": true - }, - "path-exists": { - "version": "2.1.0", + "parse-json": { + "version": "4.0.0", "bundled": true, "requires": { - "pinkie-promise": "^2.0.0" + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" } }, + "path-exists": { + "version": "3.0.0", + "bundled": true + }, "path-is-absolute": { "version": "1.0.1", "bundled": true @@ -2283,113 +1676,56 @@ "version": "2.0.1", "bundled": true }, - "path-parse": { - "version": "1.0.5", - "bundled": true - }, "path-type": { - "version": "1.1.0", + "version": "3.0.0", "bundled": true, "requires": { - "graceful-fs": "^4.1.2", - "pify": "^2.0.0", - "pinkie-promise": "^2.0.0" + "pify": "^3.0.0" } }, "pify": { - "version": "2.3.0", - "bundled": true - }, - "pinkie": { - "version": "2.0.4", + "version": "3.0.0", "bundled": true }, - "pinkie-promise": { - "version": "2.0.1", - "bundled": true, - "requires": { - "pinkie": "^2.0.0" - } - }, "pkg-dir": { - "version": "1.0.0", + "version": "3.0.0", "bundled": true, "requires": { - "find-up": "^1.0.0" - }, - "dependencies": { - "find-up": { - "version": "1.1.2", - "bundled": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - } + "find-up": "^3.0.0" } }, - "posix-character-classes": { - "version": "0.1.1", - "bundled": true - }, "pseudomap": { "version": "1.0.2", "bundled": true }, "read-pkg": { - "version": "1.1.0", + "version": "3.0.0", "bundled": true, "requires": { - "load-json-file": "^1.0.0", + "load-json-file": "^4.0.0", "normalize-package-data": "^2.3.2", - "path-type": "^1.0.0" + "path-type": "^3.0.0" } }, "read-pkg-up": { - "version": "1.0.1", + "version": "4.0.0", "bundled": true, "requires": { - "find-up": "^1.0.0", - "read-pkg": "^1.0.0" - }, - "dependencies": { - "find-up": { - "version": "1.1.2", - "bundled": true, - "requires": { - "path-exists": "^2.0.0", - "pinkie-promise": "^2.0.0" - } - } + "find-up": "^3.0.0", + "read-pkg": "^3.0.0" } }, - "regenerator-runtime": { - "version": "0.11.1", - "bundled": true - }, - "regex-not": { - "version": "1.0.2", + "release-zalgo": { + "version": "1.0.0", "bundled": true, "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" + "es6-error": "^4.0.1" } }, - "repeat-element": { - "version": "1.1.2", - "bundled": true - }, "repeat-string": { "version": "1.6.1", "bundled": true }, - "repeating": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-finite": "^1.0.0" - } - }, "require-directory": { "version": "2.1.1", "bundled": true @@ -2399,190 +1735,56 @@ "bundled": true }, "resolve-from": { - "version": "2.0.0", - "bundled": true - }, - "resolve-url": { - "version": "0.2.1", - "bundled": true - }, - "ret": { - "version": "0.1.15", + "version": "4.0.0", "bundled": true }, "right-align": { "version": "0.1.3", - "bundled": true, - "optional": true, - "requires": { - "align-text": "^0.1.1" - } - }, - "rimraf": { - "version": "2.6.2", - "bundled": true, - "requires": { - "glob": "^7.0.5" - } - }, - "safe-regex": { - "version": "1.1.0", - "bundled": true, - "requires": { - "ret": "~0.1.10" - } - }, - "semver": { - "version": "5.5.0", - "bundled": true - }, - "set-blocking": { - "version": "2.0.0", - "bundled": true - }, - "set-value": { - "version": "2.0.0", - "bundled": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "shebang-command": { - "version": "1.2.0", - "bundled": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "bundled": true - }, - "signal-exit": { - "version": "3.0.2", - "bundled": true - }, - "slide": { - "version": "1.1.6", - "bundled": true - }, - "snapdragon": { - "version": "0.8.2", - "bundled": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "bundled": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "bundled": true, - "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, - "kind-of": { - "version": "6.0.2", - "bundled": true - } + "bundled": true, + "optional": true, + "requires": { + "align-text": "^0.1.1" } }, - "snapdragon-util": { - "version": "3.0.1", + "rimraf": { + "version": "2.6.2", "bundled": true, "requires": { - "kind-of": "^3.2.0" + "glob": "^7.0.5" } }, - "source-map": { - "version": "0.5.7", + "safe-buffer": { + "version": "5.1.2", "bundled": true }, - "source-map-resolve": { - "version": "0.5.1", + "semver": { + "version": "5.5.0", + "bundled": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true + }, + "shebang-command": { + "version": "1.2.0", "bundled": true, "requires": { - "atob": "^2.0.0", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" + "shebang-regex": "^1.0.0" } }, - "source-map-url": { - "version": "0.4.0", + "shebang-regex": { + "version": "1.0.0", + "bundled": true + }, + "signal-exit": { + "version": "3.0.2", "bundled": true }, + "source-map": { + "version": "0.5.7", + "bundled": true, + "optional": true + }, "spawn-wrap": { "version": "1.4.2", "bundled": true, @@ -2619,350 +1821,46 @@ "version": "3.0.0", "bundled": true }, - "split-string": { - "version": "3.1.0", - "bundled": true, - "requires": { - "extend-shallow": "^3.0.0" - } - }, - "static-extend": { - "version": "0.1.2", - "bundled": true, - "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "bundled": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, "string-width": { "version": "2.1.1", "bundled": true, "requires": { "is-fullwidth-code-point": "^2.0.0", "strip-ansi": "^4.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, - "strip-ansi": { - "version": "4.0.0", - "bundled": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } } }, "strip-ansi": { - "version": "3.0.1", + "version": "4.0.0", "bundled": true, "requires": { - "ansi-regex": "^2.0.0" + "ansi-regex": "^3.0.0" } }, "strip-bom": { - "version": "2.0.0", - "bundled": true, - "requires": { - "is-utf8": "^0.2.0" - } + "version": "3.0.0", + "bundled": true }, "strip-eof": { "version": "1.0.0", "bundled": true }, "supports-color": { - "version": "2.0.0", - "bundled": true - }, - "test-exclude": { - "version": "4.2.1", - "bundled": true, - "requires": { - "arrify": "^1.0.1", - "micromatch": "^3.1.8", - "object-assign": "^4.1.0", - "read-pkg-up": "^1.0.1", - "require-main-filename": "^1.0.1" - }, - "dependencies": { - "arr-diff": { - "version": "4.0.0", - "bundled": true - }, - "array-unique": { - "version": "0.3.2", - "bundled": true - }, - "braces": { - "version": "2.3.2", - "bundled": true, - "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "expand-brackets": { - "version": "2.1.4", - "bundled": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "bundled": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-data-descriptor": { - "version": "0.1.4", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "is-descriptor": { - "version": "0.1.6", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - } - }, - "kind-of": { - "version": "5.1.0", - "bundled": true - } - } - }, - "extglob": { - "version": "2.0.4", - "bundled": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "bundled": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "bundled": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "bundled": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-number": { - "version": "3.0.0", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "bundled": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "isobject": { - "version": "3.0.1", - "bundled": true - }, - "kind-of": { - "version": "6.0.2", - "bundled": true - }, - "micromatch": { - "version": "3.1.10", - "bundled": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - } - } - } - }, - "to-fast-properties": { - "version": "1.0.3", - "bundled": true - }, - "to-object-path": { - "version": "0.3.0", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "to-regex": { - "version": "3.0.2", + "version": "5.4.0", "bundled": true, "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" + "has-flag": "^3.0.0" } }, - "to-regex-range": { - "version": "2.1.1", + "test-exclude": { + "version": "5.0.0", "bundled": true, "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - }, - "dependencies": { - "is-number": { - "version": "3.0.0", - "bundled": true, - "requires": { - "kind-of": "^3.0.2" - } - } + "arrify": "^1.0.1", + "minimatch": "^3.0.4", + "read-pkg-up": "^4.0.0", + "require-main-filename": "^1.0.1" } }, - "trim-right": { - "version": "1.0.1", - "bundled": true - }, "uglify-js": { "version": "2.8.29", "bundled": true, @@ -2991,88 +1889,10 @@ "bundled": true, "optional": true }, - "union-value": { - "version": "1.0.0", - "bundled": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "bundled": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "set-value": { - "version": "0.4.3", - "bundled": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } - } - }, - "unset-value": { - "version": "1.0.0", - "bundled": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "bundled": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "bundled": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "bundled": true - }, - "isobject": { - "version": "3.0.1", - "bundled": true - } - } - }, - "urix": { - "version": "0.1.0", + "uuid": { + "version": "3.3.2", "bundled": true }, - "use": { - "version": "3.1.0", - "bundled": true, - "requires": { - "kind-of": "^6.0.2" - }, - "dependencies": { - "kind-of": { - "version": "6.0.2", - "bundled": true - } - } - }, "validate-npm-package-license": { "version": "3.0.3", "bundled": true, @@ -3082,7 +1902,7 @@ } }, "which": { - "version": "1.3.0", + "version": "1.3.1", "bundled": true, "requires": { "isexe": "^2.0.0" @@ -3109,6 +1929,10 @@ "strip-ansi": "^3.0.1" }, "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "bundled": true + }, "is-fullwidth-code-point": { "version": "1.0.0", "bundled": true, @@ -3124,6 +1948,13 @@ "is-fullwidth-code-point": "^1.0.0", "strip-ansi": "^3.0.0" } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "requires": { + "ansi-regex": "^2.0.0" + } } } }, @@ -3132,12 +1963,12 @@ "bundled": true }, "write-file-atomic": { - "version": "1.3.4", + "version": "2.3.0", "bundled": true, "requires": { "graceful-fs": "^4.1.11", "imurmurhash": "^0.1.4", - "slide": "^1.1.5" + "signal-exit": "^3.0.2" } }, "y18n": { @@ -3166,14 +1997,6 @@ "yargs-parser": "^9.0.2" }, "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "bundled": true - }, - "camelcase": { - "version": "4.1.0", - "bundled": true - }, "cliui": { "version": "4.1.0", "bundled": true, @@ -3183,24 +2006,43 @@ "wrap-ansi": "^2.0.0" } }, - "strip-ansi": { - "version": "4.0.0", + "find-up": { + "version": "2.1.0", + "bundled": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "bundled": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", "bundled": true, "requires": { - "ansi-regex": "^3.0.0" + "p-try": "^1.0.0" } }, - "yargs-parser": { - "version": "9.0.2", + "p-locate": { + "version": "2.0.0", "bundled": true, "requires": { - "camelcase": "^4.1.0" + "p-limit": "^1.1.0" } + }, + "p-try": { + "version": "1.0.0", + "bundled": true } } }, "yargs-parser": { - "version": "8.1.0", + "version": "9.0.2", "bundled": true, "requires": { "camelcase": "^4.1.0" @@ -3373,7 +2215,7 @@ "bundled": true }, "semver": { - "version": "5.5.1", + "version": "5.6.0", "bundled": true }, "set-blocking": { @@ -3385,7 +2227,7 @@ "bundled": true }, "source-map": { - "version": "0.6.1", + "version": "0.5.7", "bundled": true }, "source-map-support": { @@ -3394,6 +2236,12 @@ "requires": { "buffer-from": "^1.0.0", "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "bundled": true + } } }, "sprintf-js": { @@ -3401,7 +2249,7 @@ "bundled": true }, "sshpk": { - "version": "1.14.2", + "version": "1.15.2", "bundled": true, "requires": { "asn1": "~0.2.3", @@ -3416,7 +2264,7 @@ } }, "stack-utils": { - "version": "1.0.1", + "version": "1.0.2", "bundled": true }, "string-width": { @@ -3446,37 +2294,47 @@ "version": "2.0.1", "bundled": true }, + "supports-color": { + "version": "5.5.0", + "bundled": true, + "requires": { + "has-flag": "^3.0.0" + } + }, "tap": { - "version": "12.0.1", + "version": "12.1.0", "bundled": true, "requires": { "bind-obj-methods": "^2.0.0", - "bluebird": "^3.5.1", + "bluebird": "^3.5.3", + "browser-process-hrtime": "^1.0.0", + "capture-stack-trace": "^1.0.0", "clean-yaml-object": "^0.1.0", "color-support": "^1.1.0", - "coveralls": "^3.0.1", + "coveralls": "^3.0.2", + "domain-browser": "^1.2.0", "foreground-child": "^1.3.3", "fs-exists-cached": "^1.0.0", "function-loop": "^1.0.1", - "glob": "^7.0.0", + "glob": "^7.1.3", "isexe": "^2.0.0", - "js-yaml": "^3.11.0", - "minipass": "^2.3.0", + "js-yaml": "^3.12.0", + "minipass": "^2.3.5", "mkdirp": "^0.5.1", - "nyc": "^11.8.0", - "opener": "^1.4.1", + "nyc": "^13.1.0", + "opener": "^1.5.1", "os-homedir": "^1.0.2", "own-or": "^1.0.0", "own-or-env": "^1.0.1", "rimraf": "^2.6.2", "signal-exit": "^3.0.0", - "source-map-support": "^0.5.6", + "source-map-support": "^0.5.9", "stack-utils": "^1.0.0", "tap-mocha-reporter": "^3.0.7", "tap-parser": "^7.0.0", "tmatch": "^4.0.0", "trivial-deferred": "^1.0.1", - "tsame": "^2.0.0", + "tsame": "^2.0.1", "write-file-atomic": "^2.3.0", "yapool": "^1.0.0" } @@ -3517,13 +2375,13 @@ } }, "tar": { - "version": "4.4.6", + "version": "4.4.8", "bundled": true, "requires": { - "chownr": "^1.0.1", + "chownr": "^1.1.1", "fs-minipass": "^1.2.5", - "minipass": "^2.3.3", - "minizlib": "^1.1.0", + "minipass": "^2.3.4", + "minizlib": "^1.1.1", "mkdirp": "^0.5.0", "safe-buffer": "^5.1.2", "yallist": "^3.0.2" @@ -3533,6 +2391,10 @@ "version": "4.0.0", "bundled": true }, + "to-fast-properties": { + "version": "2.0.0", + "bundled": true + }, "tough-cookie": { "version": "2.4.3", "bundled": true, @@ -3547,12 +2409,16 @@ } } }, + "trim-right": { + "version": "1.0.1", + "bundled": true + }, "trivial-deferred": { "version": "1.0.1", "bundled": true }, "tsame": { - "version": "2.0.0", + "version": "2.0.1", "bundled": true }, "tunnel-agent": { @@ -3564,8 +2430,7 @@ }, "tweetnacl": { "version": "0.14.5", - "bundled": true, - "optional": true + "bundled": true }, "unicode-length": { "version": "1.0.3", @@ -3575,6 +2440,19 @@ "strip-ansi": "^3.0.1" } }, + "uri-js": { + "version": "4.2.2", + "bundled": true, + "requires": { + "punycode": "^2.1.0" + }, + "dependencies": { + "punycode": { + "version": "2.1.1", + "bundled": true + } + } + }, "url": { "version": "0.10.3", "bundled": true, diff --git a/include/windows_wrapper.h b/include/windows_wrapper.h new file mode 100644 index 0000000..d3085e9 --- /dev/null +++ b/include/windows_wrapper.h @@ -0,0 +1,151 @@ +// +// Created by stefan on 28.11.18.. +// + +/* + * In order to link wallet library on windows and get portability C API needs to be create + * to avoid name mangling during linkage. + */ + +#ifndef SAFEX_WINDOWS_WRAPPER_H +#define SAFEX_WINDOWS_WRAPPER_H + +#include <windows.h> + +#ifdef DLLIMPORT_SAFEX +#define DLL_MAGIC __declspec(dllimport) +#else +#define DLL_MAGIC __declspec(dllexport) +#endif + +/****************************** WALLET API ****************************************************************************/ +extern "C" DLL_MAGIC void* win_createWallet(uint8_t nettype); +extern "C" DLL_MAGIC void win_deleteWallet(void* self); +extern "C" DLL_MAGIC void win_checkDLL(const char* msg); + +extern "C" DLL_MAGIC uint8_t win_initB(void* self, const char* daemon_address); +extern "C" DLL_MAGIC void win_startRefresh(void* self); +extern "C" DLL_MAGIC uint8_t win_storeB(void* self, const char* path); + +// Returning Safex::PendingTransaction +// @warning subaddr_indices is here uint32_t. Argument will be ignored for time being because Safex doesnt support +// subaddresses. Please be advised to pass integer value instead of initializer_list!!!!! +// Both subaddr fields will be ignored, but are kept here to avoid any serious changes in existing API. +extern "C" DLL_MAGIC void* win_createTransaction( + void* self, + const char* dst_addr, + const char* payment_id, + uint64_t value_amount, + uint32_t mixin_count, + uint32_t priority, + uint32_t subaddr_account, + uint32_t subaddr_indices, + uint32_t tx_type + ); + +extern "C" DLL_MAGIC const char* win_address(void* self); +extern "C" DLL_MAGIC const char* win_seed(void* self); +extern "C" DLL_MAGIC const char* win_path(void* self); +extern "C" DLL_MAGIC uint8_t win_nettype(void* self); +extern "C" DLL_MAGIC const char* win_secretViewKey(void* self); +extern "C" DLL_MAGIC const char* win_publicViewKey(void* self); +extern "C" DLL_MAGIC const char* win_secretSpendKey(void* self); +extern "C" DLL_MAGIC const char* win_publicSpendKey(void* self); +extern "C" DLL_MAGIC uint8_t win_setPasswordB(void* self, const char*); // @todo See if bool is valid in CAPI +extern "C" DLL_MAGIC const char* win_errorString(void* self); +extern "C" DLL_MAGIC void win_setRefreshFromBlockHeight(void* self, uint32_t height); +extern "C" DLL_MAGIC uint32_t win_connected(void* self); // @todo Enum ConnectionStatus without default type should be uint32_t +extern "C" DLL_MAGIC void win_setTrustedDaemon(void* self, uint8_t argB); +extern "C" DLL_MAGIC uint8_t win_trustedDaemonB(void* self); +extern "C" DLL_MAGIC uint64_t win_balanceAll(void* self); +extern "C" DLL_MAGIC uint64_t win_unlockedBalanceAll(void* self); +extern "C" DLL_MAGIC uint64_t win_tokenBalanceAll(void* self); +extern "C" DLL_MAGIC uint64_t win_unlockedTokenBalanceAll(void* self); + +extern "C" DLL_MAGIC const char* win_GenPaymentId(); +extern "C" DLL_MAGIC uint8_t win_PaymentIdValid(const char* paymentId); +extern "C" DLL_MAGIC void win_SetListener(void* self, void* listener); +extern "C" DLL_MAGIC void win_segregatePreForkOutputs(void* self, uint8_t segregate); +extern "C" DLL_MAGIC void win_keyReuseMitigation2(void* self, uint8_t mitigation); +extern "C" DLL_MAGIC const char* win_IntegratedAddress(void* self, const char* paymentId); + +extern "C" DLL_MAGIC uint8_t win_static_addressValid(const char* address, uint32_t nettype); +/****************************** END WALLET API ************************************************************************/ + +/****************************** PENDING TRANSACTION API ***************************************************************/ +extern "C" DLL_MAGIC void* win_pt_create(void* wallet); +extern "C" DLL_MAGIC void win_pt_delete(void* self); +extern "C" DLL_MAGIC uint64_t win_pt_amount(void* self); +extern "C" DLL_MAGIC uint64_t win_pt_tokenAmount(void* self); +extern "C" DLL_MAGIC uint64_t win_pt_dust(void* self); +extern "C" DLL_MAGIC uint64_t win_pt_fee(void* self); +extern "C" DLL_MAGIC uint64_t win_pt_txCount(void* self); +// @warning Last element is nullptr!! Like +extern "C" DLL_MAGIC char* win_pt_txid(void* self); +extern "C" DLL_MAGIC int32_t win_pt_status(void* self); +extern "C" DLL_MAGIC const char* win_pt_errorString(void* self); +extern "C" DLL_MAGIC uint8_t win_pt_commit(void* self); +/****************************** END PENDING TRANSACTION API ***********************************************************/ + + +/****************************** WALLET MANAGER API ********************************************************************/ +extern "C" DLL_MAGIC void* win_mngf_getWalletManager(); +extern "C" DLL_MAGIC void win_mng_closeWallet(void* self, void* wallet, uint8_t storeB); +// @return Safex::WalletImpl +extern "C" DLL_MAGIC void* win_mng_createWallet(void* self, const char* path, const char* password, const char* lang, uint32_t nettype); +// @return Safex::WalletImpl +extern "C" DLL_MAGIC void* win_mng_openWallet(void* self, const char* path, const char* password, uint32_t nettype); +// @return Safex::WalletImpl +extern "C" DLL_MAGIC void* win_mng_recoveryWallet( + void* self, + const char* path, + const char* password, + const char* mnemonic, + uint32_t nettype, + uint64_t restoreHeight); +//@return Safex::WalletManager +extern "C" DLL_MAGIC uint8_t win_mng_walletExists(void* self, const char* path); +extern "C" DLL_MAGIC void* win_mng_createWalletFromKeys(void* self, const char* path, const char* password, const char* language, uint32_t nettype, + uint64_t restoreHeight,const char *addressString, const char* viewKeyString, const char* spendKeyString); +/****************************** END WALLET MANAGER API ****************************************************************/ + +/****************************** TRANSACTIONINFO API *******************************************************************/ +extern "C" DLL_MAGIC void* win_txinfo_createTransactionInfo(); +extern "C" DLL_MAGIC void win_txinfo_deleteTransactionInfo(void* self); +extern "C" DLL_MAGIC int32_t win_txinfo_direction(void* self); +extern "C" DLL_MAGIC uint8_t win_txinfo_isPendingB(void* self); +extern "C" DLL_MAGIC uint8_t win_txinfo_isFailedB(void* self); +extern "C" DLL_MAGIC uint64_t win_txinfo_amount(void* self); +extern "C" DLL_MAGIC uint64_t win_txinfo_fee(void* self); +extern "C" DLL_MAGIC uint64_t win_txinfo_blockHeight(void* self); +extern "C" DLL_MAGIC const char* win_txinfo_label(void* self); +extern "C" DLL_MAGIC const char* win_txinfo_hash(void* self); +extern "C" DLL_MAGIC uint64_t win_txinfo_timestamp(void* self); +extern "C" DLL_MAGIC const char* win_txinfo_paymentId(void* self); +// returns array of Safex::Transfers +extern "C" DLL_MAGIC void* win_txinfo_transfers(void* self, uint32_t* size); +extern "C" DLL_MAGIC uint64_t win_txinfo_confirmations(void* self); +extern "C" DLL_MAGIC uint64_t win_txinfo_unlockTime(void* self); +extern "C" DLL_MAGIC uint32_t win_txinfo_transactionType(void* self); +/****************************** END TRANSACTIONINFO API ***************************************************************/ + +/****************************** WALLET LISTENER API *******************************************************************/ +extern "C" DLL_MAGIC void* win_lstn_Create(void*); +extern "C" DLL_MAGIC void win_lstn_setMoneySpent(void* self, void(*moneySpent_)(void*,const char*, uint64_t)); +extern "C" DLL_MAGIC void win_lstn_setMoneyReceived(void* self, void(*moneyReceived_)(void*,const char*, uint64_t)); +extern "C" DLL_MAGIC void win_lstn_setUnconfirmedMoneyReceived(void* self, void(*unconfirmedMoneyReceived_)(void*,const char*, uint64_t)); +extern "C" DLL_MAGIC void win_lstn_setTokensSpent(void* self, void(*tokensSpent_)(void*,const char*, uint64_t)); +extern "C" DLL_MAGIC void win_lstn_setTokenReceived(void* self, void(*tokenReceived_)(void*,const char*, uint64_t)); +extern "C" DLL_MAGIC void win_lstn_setUnconfirmedTokenReceived(void* self, void(*unconfirmedTokenReceived_)(void*,const char*, uint64_t)); +extern "C" DLL_MAGIC void win_lstn_setNewBlock(void* self, void(*newBlock_)(void*,uint64_t)); +extern "C" DLL_MAGIC void win_lstn_setUpdated(void* self, void(*updated_)(void*)); +extern "C" DLL_MAGIC void win_lstn_setRefreshed(void* self, void(*refreshed_)(void*)); +/****************************** END WALLET LISTNER API ****************************************************************/ + +/****************************** OTHER FUNCTIONS ***********************************************************************/ +extern "C" DLL_MAGIC void win_mlog_set_log_levelI(int level); +extern "C" DLL_MAGIC void win_mlog_set_log_levelCPtr(const char* log); +/****************************** END OTHER FUNCTIONS *******************************************************************/ + +#endif //SAFEX_WINDOWS_WRAPPER_H + diff --git a/src/pendingtransaction.cc b/src/pendingtransaction.cc index 1f9d28b..bef8fd5 100644 --- a/src/pendingtransaction.cc +++ b/src/pendingtransaction.cc @@ -59,7 +59,7 @@ NAN_METHOD(PendingTransaction::New) { } } -Local<Object> PendingTransaction::NewInstance(Safex::PendingTransaction* tx) { +Local<Object> PendingTransaction::NewInstance(SafexNativePendingTransaction* tx) { const unsigned argc = 0; Local<Value> argv[1] = { Nan::Null() }; Local<Function> cons = Nan::New(constructor); diff --git a/src/pendingtransaction.h b/src/pendingtransaction.h index eff6a8b..ae8627f 100644 --- a/src/pendingtransaction.h +++ b/src/pendingtransaction.h @@ -2,20 +2,24 @@ #include <nan.h> + + namespace Safex { struct PendingTransaction; } +#include "safexnativewallet.h" + namespace exawallet { class PendingTransaction : public node::ObjectWrap { public: - explicit PendingTransaction(Safex::PendingTransaction* tx): transaction(tx) {} + explicit PendingTransaction(SafexNativePendingTransaction* tx): transaction(tx) {} virtual ~PendingTransaction(); static NAN_MODULE_INIT(Init); static NAN_METHOD(New); - static v8::Local<v8::Object> NewInstance(Safex::PendingTransaction* tx); + static v8::Local<v8::Object> NewInstance(SafexNativePendingTransaction* tx); static NAN_METHOD(Commit); static NAN_METHOD(Amount); @@ -31,7 +35,7 @@ class PendingTransaction : public node::ObjectWrap { private: static Nan::Persistent<v8::Function> constructor; - Safex::PendingTransaction* transaction; + SafexNativePendingTransaction* transaction; }; } diff --git a/src/safexnativewallet.h b/src/safexnativewallet.h new file mode 100644 index 0000000..e5f9925 --- /dev/null +++ b/src/safexnativewallet.h @@ -0,0 +1,46 @@ +// +// Created by amarko on 29.11.18.. +// + +#ifndef WIN_SAFEX_NODEJS_LIBWALLET_NATIVESAFEXWALLET_H +#define WIN_SAFEX_NODEJS_LIBWALLET_NATIVESAFEXWALLET_H + +#include <wallet_api.h> + +#if _MSC_VER //windows node-gyp build +namespace Safex { + struct WinWallet; + struct WinWalletListener; + struct WinWalletManager; + struct WinWalletManagerFactory; + struct WinPendingTransaction; + struct WinTransactionInfo; + struct WinTransactionHistory; +} + +#endif + + + +//SafexNativeWallet is a type that represents OS agnostic interface +#if _MSC_VER //windows node-gyp build + +using SafexNativeWallet=Safex::WinWallet; +using SafexNativeWalletListener=Safex::WinWalletListener; +using SafexNativeWalletManager=Safex::WinWalletManager; +using SafexNativeWalletManagerFactory=Safex::WinWalletManagerFactory; +using SafexNativePendingTransaction=Safex::WinPendingTransaction; +using SafexNativeTransactionInfo=Safex::WinTransactionInfo; +using SafexNativeTransactionHistory=Safex::WinTransactionHistory; +#else + +using SafexNativeWallet=Safex::Wallet; +using SafexNativeWalletListener=Safex::WalletListener; +using SafexNativeWalletManager=Safex::WalletManager; +using SafexNativeWalletManagerFactory=Safex::WalletManagerFactory; +using SafexNativePendingTransaction=Safex::PendingTransaction; +using SafexNativeTransactionInfo=Safex::TransactionInfo; +using SafexNativeTransactionHistory=Safex::TransactionHistory; +#endif + +#endif //WIN_SAFEX_NODEJS_LIBWALLET_NATIVESAFEXWALLET_H diff --git a/src/wallet.cc b/src/wallet.cc index a366639..8a6ae19 100644 --- a/src/wallet.cc +++ b/src/wallet.cc @@ -7,6 +7,7 @@ #include "walletargs.h" #include "wallettasks.h" + using namespace v8; namespace exawallet { @@ -65,7 +66,7 @@ Local<String> convertAmount(uint64_t amount) { return Nan::New(std::to_string(amount).c_str()).ToLocalChecked(); } -Local<Object> makeTransactionInfoObject(const Safex::TransactionInfo* transaction) { +Local<Object> makeTransactionInfoObject(const SafexNativeTransactionInfo* transaction) { auto transfersNative = transaction->transfers(); auto transfers = Nan::New<Array>(transfersNative.size()); @@ -176,7 +177,11 @@ NAN_METHOD(Wallet::WalletExists) { } std::string path = toStdString(info[0]); - auto manager = Safex::WalletManagerFactory::getWalletManager(); + auto manager = SafexNativeWalletManagerFactory::getWalletManager(); + if (!manager) { + Nan::ThrowTypeError("Wallet manager could not be instantiated!"); + return; + } bool exists = manager->walletExists(path); info.GetReturnValue().Set(Nan::New(exists)); } @@ -283,6 +288,8 @@ NAN_MODULE_INIT(Wallet::Init) { {"history", TransactionHistory} }; + std::cout << "Wallet::Init" << std::endl; + auto tpl = Nan::New<FunctionTemplate>(Wallet::New); tpl->SetClassName(Nan::New("Wallet").ToLocalChecked()); tpl->InstanceTemplate()->SetInternalFieldCount(walletFunctions.size()); @@ -293,7 +300,7 @@ NAN_MODULE_INIT(Wallet::Init) { constructor.Reset(tpl->GetFunction()); } -v8::Local<v8::Object> Wallet::NewInstance(Safex::Wallet* wallet) { +v8::Local<v8::Object> Wallet::NewInstance(SafexNativeWallet *wallet) { const unsigned argc = 0; Local<Value> argv[1] = { Nan::Null() }; Local<Function> cons = Nan::New(constructor); @@ -564,7 +571,7 @@ NAN_METHOD(Wallet::Synchronized) { } NAN_METHOD(Wallet::GenPaymentId) { - info.GetReturnValue().Set(Nan::New(Safex::Wallet::genPaymentId().c_str()).ToLocalChecked()); + info.GetReturnValue().Set(Nan::New(SafexNativeWallet::genPaymentId().c_str()).ToLocalChecked()); } NAN_METHOD(Wallet::PaymentIdValid) { @@ -573,7 +580,7 @@ NAN_METHOD(Wallet::PaymentIdValid) { return; } - info.GetReturnValue().Set(Nan::New(Safex::Wallet::paymentIdValid(toStdString(info[0])))); + info.GetReturnValue().Set(Nan::New(SafexNativeWallet::paymentIdValid(toStdString(info[0])))); } NAN_METHOD(Wallet::AddressValid) { @@ -587,7 +594,7 @@ NAN_METHOD(Wallet::AddressValid) { Nan::ThrowError("wrong network type argument"); return; } - bool valid = Safex::Wallet::addressValid(toStdString(info[0]), nettype); + bool valid = SafexNativeWallet::addressValid(toStdString(info[0]), nettype); info.GetReturnValue().Set(Nan::New(valid)); } diff --git a/src/wallet.h b/src/wallet.h index 08dd303..765b32b 100644 --- a/src/wallet.h +++ b/src/wallet.h @@ -7,15 +7,26 @@ #include <wallet_api.h> +#include "safexnativewallet.h" + +#if _MSC_VER //windows node-gyp build +#include <windows_wrapper.h> +#include <winwallet.h> +#include <winwalletlistener.h> +#include <winwalletmanager.h> +#include <winpendingtransaction.h> +#endif + namespace exawallet { + using CopyablePersistentFunction = Nan::CopyablePersistentTraits<v8::Function>::CopyablePersistent; -class Wallet : public node::ObjectWrap, public Safex::WalletListener { +class Wallet : public node::ObjectWrap, public SafexNativeWalletListener { public: static NAN_MODULE_INIT(Init); - static v8::Local<v8::Object> NewInstance(Safex::Wallet* wallet); + static v8::Local<v8::Object> NewInstance(SafexNativeWallet* wallet); static NAN_METHOD(WalletExists); static NAN_METHOD(CreateWallet); @@ -32,7 +43,8 @@ class Wallet : public node::ObjectWrap, public Safex::WalletListener { v8::MaybeLocal<v8::Function> FindCallback(const std::string& name); private: - explicit Wallet(Safex::Wallet* wallet): wallet_(wallet) {} + + explicit Wallet(SafexNativeWallet* wallet): wallet_(wallet) {} ~Wallet(); virtual void moneySpent(const std::string &txId, uint64_t amount) override; @@ -96,7 +108,7 @@ class Wallet : public node::ObjectWrap, public Safex::WalletListener { static Nan::Persistent<v8::Function> constructor; - Safex::Wallet* wallet_ = nullptr; + SafexNativeWallet* wallet_ = nullptr; std::map<std::string, CopyablePersistentFunction> callbacks_; }; diff --git a/src/walletargs.cc b/src/walletargs.cc index d2983ef..66d3153 100644 --- a/src/walletargs.cc +++ b/src/walletargs.cc @@ -3,6 +3,7 @@ #include <stdexcept> #include <nan.h> +#include <string> using namespace v8; @@ -231,7 +232,7 @@ std::string CreateTransactionArgs::Init(const Nan::FunctionCallbackInfo<Value>& if (!getRequiredProperty<std::string>(obj, "amount", amountStr)) { return std::string("Required property not found: amount"); } - amount = std::stoul(amountStr); + amount = std::stoull(amountStr); paymentId = getOptionalProperty<std::string>(obj, "paymentId", ""); mixin = getOptionalProperty<uint32_t>(obj, "mixin", MINIMAL_MIXIN); priority = static_cast<Safex::PendingTransaction::Priority>(getOptionalProperty<uint32_t>(obj, "priority", diff --git a/src/wallettasks.cc b/src/wallettasks.cc index f9470b5..23a198e 100644 --- a/src/wallettasks.cc +++ b/src/wallettasks.cc @@ -3,12 +3,16 @@ #include "wallet.h" #include "pendingtransaction.h" + +#include "safexnativewallet.h" + + namespace exawallet { using namespace v8; std::string CreateWalletTask::doWork() { - auto manager = Safex::WalletManagerFactory::getWalletManager(); + auto manager = SafexNativeWalletManagerFactory::getWalletManager(); if (manager->walletExists(args_.path)) { return "Wallet already exists: " + args_.path; } @@ -37,7 +41,7 @@ Local<Value> CreateWalletTask::afterWork(std::string& error) { } std::string CreateWalletFromKeysTask::doWork() { - auto manager = Safex::WalletManagerFactory::getWalletManager(); + auto manager = SafexNativeWalletManagerFactory::getWalletManager(); if (manager->walletExists(args_.path)) { return "Wallet already exists: " + args_.path; } @@ -67,7 +71,7 @@ Local<Value> CreateWalletFromKeysTask::afterWork(std::string& error) { } std::string OpenWalletTask::doWork() { - auto manager = Safex::WalletManagerFactory::getWalletManager(); + auto manager = SafexNativeWalletManagerFactory::getWalletManager(); if (!manager->walletExists(args_.path)) { return "wallet does not exist: " + args_.path; } @@ -96,7 +100,7 @@ Local<Value> OpenWalletTask::afterWork(std::string& error) { } std::string CloseWalletTask::doWork() { - auto manager = Safex::WalletManagerFactory::getWalletManager(); + auto manager = SafexNativeWalletManagerFactory::getWalletManager(); manager->closeWallet(wallet_, store_); return {}; } @@ -106,7 +110,7 @@ Local<Value> CloseWalletTask::afterWork(std::string& error) { } std::string RecoveryWalletTask::doWork() { - auto manager = Safex::WalletManagerFactory::getWalletManager(); + auto manager = SafexNativeWalletManagerFactory::getWalletManager(); wallet_ = manager->recoveryWallet(args_.path, args_.password, @@ -137,6 +141,7 @@ Local<Value> RecoveryWalletTask::afterWork(std::string& error) { std::string StoreWalletTask::doWork() { if (!wallet_->store(wallet_->path())) { + std::cout << "Error storing wallet path:" << wallet_->path() << std::endl; return "Couldn't store wallet"; } diff --git a/src/wallettasks.h b/src/wallettasks.h index 41e9e47..3313796 100644 --- a/src/wallettasks.h +++ b/src/wallettasks.h @@ -3,6 +3,16 @@ #include "deferredtask.h" #include "walletargs.h" +#include "safexnativewallet.h" + +#if _MSC_VER //windows node-gyp build +#include <windows_wrapper.h> +#include <winwallet.h> +#include <winwalletlistener.h> +#include <winwalletmanager.h> +#include <winpendingtransaction.h> +#endif + namespace exawallet { class CreateWalletTask: public DeferredTask { @@ -14,7 +24,7 @@ class CreateWalletTask: public DeferredTask { private: CreateWalletArgs args_; - Safex::Wallet* wallet_ = nullptr; + SafexNativeWallet* wallet_ = nullptr; }; class CreateWalletFromKeysTask: public DeferredTask { @@ -26,7 +36,7 @@ class CreateWalletFromKeysTask: public DeferredTask { private: CreateWalletFromKeysArgs args_; - Safex::Wallet* wallet_ = nullptr; + SafexNativeWallet* wallet_ = nullptr; }; class OpenWalletTask: public DeferredTask { @@ -38,18 +48,18 @@ class OpenWalletTask: public DeferredTask { private: OpenWalletArgs args_; - Safex::Wallet* wallet_ = nullptr; + SafexNativeWallet* wallet_ = nullptr; }; class CloseWalletTask: public DeferredTask { public: - CloseWalletTask(Safex::Wallet* wallet, bool store): wallet_(wallet), store_(store) {} + CloseWalletTask(SafexNativeWallet* wallet, bool store): wallet_(wallet), store_(store) {} virtual std::string doWork() override; virtual v8::Local<v8::Value> afterWork(std::string& error) override; private: - Safex::Wallet* wallet_ = nullptr; + SafexNativeWallet* wallet_ = nullptr; bool store_; }; @@ -62,47 +72,47 @@ class RecoveryWalletTask: public DeferredTask { private: RecoveryWalletArgs args_; - Safex::Wallet* wallet_ = nullptr; + SafexNativeWallet* wallet_ = nullptr; }; class StoreWalletTask: public DeferredTask { public: - StoreWalletTask(Safex::Wallet* wallet): wallet_(wallet) {} + StoreWalletTask(SafexNativeWallet* wallet): wallet_(wallet) {} virtual std::string doWork() override; virtual v8::Local<v8::Value> afterWork(std::string& error) override; private: - Safex::Wallet* wallet_; + SafexNativeWallet* wallet_; }; class CreateTransactionTask: public DeferredTask { public: - CreateTransactionTask(const CreateTransactionArgs& args, Safex::Wallet* wallet): args_(args), wallet_(wallet) {} + CreateTransactionTask(const CreateTransactionArgs& args, SafexNativeWallet* wallet): args_(args), wallet_(wallet) {} virtual std::string doWork() override; virtual v8::Local<v8::Value> afterWork(std::string& error) override; private: CreateTransactionArgs args_; - Safex::PendingTransaction* transaction_ = nullptr; - Safex::Wallet* wallet_; + SafexNativePendingTransaction* transaction_ = nullptr; + SafexNativeWallet* wallet_; }; class CommitTransactionTask: public DeferredTask { public: - CommitTransactionTask(Safex::PendingTransaction* transaction): transaction_(transaction) {} + CommitTransactionTask(SafexNativePendingTransaction* transaction): transaction_(transaction) {} virtual std::string doWork() override; virtual v8::Local<v8::Value> afterWork(std::string& error) override; private: - Safex::PendingTransaction* transaction_; + SafexNativePendingTransaction* transaction_; }; class RestoreMultisigTransactionTask: public DeferredTask { public: - RestoreMultisigTransactionTask(const std::string& transactionData, Safex::Wallet* wallet) + RestoreMultisigTransactionTask(const std::string& transactionData, SafexNativeWallet* wallet) : transactionData_(transactionData), wallet_(wallet) {} virtual std::string doWork() override; @@ -110,8 +120,8 @@ class RestoreMultisigTransactionTask: public DeferredTask { private: std::string transactionData_; - Safex::PendingTransaction* transaction_ = nullptr; - Safex::Wallet* wallet_; + SafexNativePendingTransaction* transaction_ = nullptr; + SafexNativeWallet * wallet_; }; } //namespace exawallet diff --git a/src/win/misc.cpp b/src/win/misc.cpp new file mode 100644 index 0000000..07a5759 --- /dev/null +++ b/src/win/misc.cpp @@ -0,0 +1,18 @@ +// +// Created by amarko on 29.11.18.. +// + +#include <string> + + +//todo IMPLEMENT +void mlog_configure(const std::string &filename_base, bool console, const std::size_t max_log_file_size = 104850000) +{ + +} + +void mlog_set_log(const char *log) +{ + +} + diff --git a/src/win/winpendingtransaction.cpp b/src/win/winpendingtransaction.cpp new file mode 100644 index 0000000..a39a3c7 --- /dev/null +++ b/src/win/winpendingtransaction.cpp @@ -0,0 +1,90 @@ +// +// Created by amarko on 29.11.18.. +// + +#include <wallet_api.h> +#include <windows_wrapper.h> +#include <cstring> + +#include "winpendingtransaction.h" + +namespace Safex +{ + + WinPendingTransaction::WinPendingTransaction(void* ptr) : m_innerPtr(ptr) { + + } + + WinPendingTransaction::~WinPendingTransaction() + { + ::win_pt_delete(m_innerPtr); + } + + int WinPendingTransaction::status() const + { + return ::win_pt_status(m_innerPtr); + } + + std::string WinPendingTransaction::errorString() const + { + return std::string(win_pt_errorString(m_innerPtr)); + } + + bool WinPendingTransaction::commit(const std::string &filename, bool overwrite) + { + return static_cast<bool>(::win_pt_commit(m_innerPtr)); + } + + uint64_t WinPendingTransaction::amount() const + { + return ::win_pt_amount(m_innerPtr); + } + + uint64_t WinPendingTransaction::tokenAmount() const + { + return ::win_pt_tokenAmount(m_innerPtr); + } + + uint64_t WinPendingTransaction::dust() const + { + return ::win_pt_dust(m_innerPtr); + } + + uint64_t WinPendingTransaction::fee() const + { + return ::win_pt_fee(m_innerPtr); + } + + std::vector<std::string> WinPendingTransaction::txid() const + { + char* results = ::win_pt_txid(m_innerPtr); + char* temp = results; + std::vector<std::string> ret; + while(temp[0] != 0) { + unsigned char txid[64]; + memmove((void *)txid, (void *)temp, 64); + ret.push_back(std::string((char*)txid)); + temp+=64; + } + + return ret; + } + + uint64_t WinPendingTransaction::txCount() const + { + return ::win_pt_txCount(m_innerPtr); + } + + std::vector<uint32_t> WinPendingTransaction::subaddrAccount() const + { + throw std::string("Not implemented yet!!"); + return {}; + } + + std::vector<std::set<uint32_t>> WinPendingTransaction::subaddrIndices() const + { + throw std::string("Not implemented yet!!"); + return {}; + } + +} diff --git a/src/win/winpendingtransaction.h b/src/win/winpendingtransaction.h new file mode 100644 index 0000000..1c50956 --- /dev/null +++ b/src/win/winpendingtransaction.h @@ -0,0 +1,56 @@ +// +// Created by amarko on 29.11.18.. +// + +#ifndef WIN_SAFEX_NODEJS_LIBWALLET_WINPENDINGTRANSACTION_H +#define WIN_SAFEX_NODEJS_LIBWALLET_WINPENDINGTRANSACTION_H + +#include <cstdint> +#include <string> + +#include <wallet_api.h> + +namespace Safex +{ + + +struct WinPendingTransaction + { + WinPendingTransaction(void* ptr); + + virtual ~WinPendingTransaction(); + + virtual int status() const; + + virtual std::string errorString() const; + + // commit transaction or save to file if filename is provided. + virtual bool commit(const std::string &filename = "", bool overwrite = false); + + virtual uint64_t amount() const; + + virtual uint64_t tokenAmount() const; + + virtual uint64_t dust() const; + + virtual uint64_t fee() const; + + virtual std::vector<std::string> txid() const; + + /*! + * \brief txCount - number of transactions current transaction will be splitted to + * \return + */ + virtual uint64_t txCount() const; + + virtual std::vector<uint32_t> subaddrAccount() const; + + virtual std::vector<std::set<uint32_t>> subaddrIndices() const; + + private: + void* m_innerPtr; + }; + +} + +#endif //WIN_SAFEX_NODEJS_LIBWALLET_WINPENDINGTRANSACTION_H diff --git a/src/win/wintransactioninfo.cpp b/src/win/wintransactioninfo.cpp new file mode 100644 index 0000000..7ca1580 --- /dev/null +++ b/src/win/wintransactioninfo.cpp @@ -0,0 +1,6 @@ +// +// Created by stefan on 3.12.18.. +// + +#include <wintransactioninfo.h> +#include <windows_wrapper.h> \ No newline at end of file diff --git a/src/win/wintransactioninfo.h b/src/win/wintransactioninfo.h new file mode 100644 index 0000000..5af5ded --- /dev/null +++ b/src/win/wintransactioninfo.h @@ -0,0 +1,51 @@ +// +// Created by stefan on 3.12.18.. +// + +#ifndef SAFEX_NODEJS_LIBWALLET_WINTRANSACTIONINFO_H +#define SAFEX_NODEJS_LIBWALLET_WINTRANSACTIONINFO_H + +#include <wallet_api.h> + +namespace Safex { + struct WinTransactionInfo { + + WinTransactionInfo(void*); + virtual ~WinTransactionInfo() = 0; + + virtual int direction(); + + virtual bool isPending(); + + virtual bool isFailed(); + + virtual uint64_t amount(); + + virtual uint64_t fee(); + + virtual uint64_t blockHeight(); + + virtual std::set <uint32_t> subaddrIndex(); + + virtual uint32_t subaddrAccount(); + + virtual std::string label(); + + virtual uint64_t confirmations(); + + virtual uint64_t unlockTime(); + + //! transaction_id + virtual std::string hash(); + + virtual std::time_t timestamp(); + + virtual std::string paymentId(); + + //! only applicable for output transactions + virtual const std::vector <Transfer> &transfers(); + + virtual TransactionType transactionType(); + }; +} +#endif //SAFEX_NODEJS_LIBWALLET_WINTRANSACTIONINFO_H diff --git a/src/win/winwallet.cpp b/src/win/winwallet.cpp new file mode 100644 index 0000000..6ddaeec --- /dev/null +++ b/src/win/winwallet.cpp @@ -0,0 +1,375 @@ +// +// Created by amarko on 28.11.18.. +// + + +#include <winwallet.h> + +#include <windows_wrapper.h> +#include "winwalletlistener.h" +#include "winpendingtransaction.h" + + + +namespace Safex { + + WinTransactionInfo::~WinTransactionInfo() + { + + } + + int WinTransactionInfo::direction() const + { + return static_cast<int>(win_txinfo_direction(m_innerPtr)); + } + + bool WinTransactionInfo::isPending() const + { + return static_cast<bool>(win_txinfo_isPendingB(m_innerPtr)); + } + + bool WinTransactionInfo::isFailed() const + { + return static_cast<bool>(win_txinfo_isFailedB(m_innerPtr)); + } + + uint64_t WinTransactionInfo::amount() const + { + return win_txinfo_amount(m_innerPtr); + } + + uint64_t WinTransactionInfo::fee() const + { + return win_txinfo_fee(m_innerPtr); + } + + uint64_t WinTransactionInfo::blockHeight() const + { + return win_txinfo_blockHeight(m_innerPtr); + } + + std::set<uint32_t> WinTransactionInfo::subaddrIndex() const + { + return std::set<uint32_t>(); + } + + uint32_t WinTransactionInfo::subaddrAccount() const + { + return 0; + } + + std::string WinTransactionInfo::label() const + { + return std::string(win_txinfo_label(m_innerPtr)); + } + + uint64_t WinTransactionInfo::confirmations() const + { + return win_txinfo_confirmations(m_innerPtr); + } + + uint64_t WinTransactionInfo::unlockTime() const + { + return win_txinfo_unlockTime(m_innerPtr); + } + + std::string WinTransactionInfo::hash() const + { + return std::string(win_txinfo_hash(m_innerPtr)); + } + + std::time_t WinTransactionInfo::timestamp() const + { + return static_cast<std::time_t>(win_txinfo_timestamp(m_innerPtr)); + } + + std::string WinTransactionInfo::paymentId() const + { + return std::string(win_txinfo_paymentId(m_innerPtr)); + } + + const std::vector<Safex::TransactionInfo::Transfer> &WinTransactionInfo::transfers() const + { + return {}; + } + + TransactionType WinTransactionInfo::transactionType() const + { + return static_cast<TransactionType>(win_txinfo_transactionType(m_innerPtr)); + } + + + WinTransactionHistory::~WinTransactionHistory() + { + + } + + int WinTransactionHistory::count() const + { + return 0; + } + + WinTransactionInfo *WinTransactionHistory::transaction(int index) const + { + return nullptr; + } + + WinTransactionInfo *WinTransactionHistory::transaction(const std::string &id) const + { + return nullptr; + } + + std::vector<WinTransactionInfo *> WinTransactionHistory::getAll() const + { + return std::vector<WinTransactionInfo *>(); + } + + void WinTransactionHistory::refresh() + { + + } + + + + + WinWallet::~WinWallet() + { + + } + + std::string WinWallet::seed() const + { + return std::string(win_seed(m_innerPtr)); + } + + Wallet *WinWallet::createWallet(const std::string &path, const std::string &password, const std::string &language, NetworkType nettype) + { + return nullptr; + } + + std::string WinWallet::address(uint32_t accountIndex, uint32_t addressIndex) const + { +// const char *value = ; +// std::string retValue{value}; +// return retValue; + return std::string(win_address(m_innerPtr)); + } + + std::string WinWallet::path() const + { + return std::string(win_path(m_innerPtr)); + } + + NetworkType WinWallet::nettype() const + { + return static_cast<NetworkType>(win_nettype(m_innerPtr)); + } + + std::string WinWallet::secretViewKey() const + { + return std::string(win_secretViewKey(m_innerPtr)); + } + + std::string WinWallet::publicViewKey() const + { + return std::string(win_publicViewKey(m_innerPtr)); + } + + std::string WinWallet::secretSpendKey() const + { + return std::string(win_secretSpendKey(m_innerPtr)); + } + + std::string WinWallet::publicSpendKey() const + { + return std::string(win_publicSpendKey(m_innerPtr)); + } + + bool WinWallet::setPassword(const std::string &password) + { + return false; + } + + std::string WinWallet::errorString() const + { + return std::string(win_errorString(m_innerPtr)); + } + + bool WinWallet::init(const std::string &daemon_address, uint64_t upper_transaction_size_limit, const std::string &daemon_username, const std::string &daemon_password, bool use_ssl, bool lightWallet) + { + return static_cast<bool>(win_initB(m_innerPtr, daemon_address.c_str())); + } + + bool WinWallet::store(const std::string &path) + { + return static_cast<bool>(win_storeB(m_innerPtr, path.c_str())); + } + + void WinWallet::segregatePreForkOutputs(bool segregate) + { + + } + + void WinWallet::keyReuseMitigation2(bool mitigation) + { + + } + + uint64_t WinWallet::getRefreshFromBlockHeight() const + { + return 0; + } + + bool WinWallet::trustedDaemon() const + { + return false; + } + + std::string WinWallet::genPaymentId() + { + return std::string(); + } + + uint64_t WinWallet::daemonBlockChainHeight() const + { + return 0; + } + + bool WinWallet::synchronized() const + { + return false; + } + + bool WinWallet::paymentIdValid(const std::string &paiment_id) + { + return false; + } + + bool WinWallet::addressValid(const std::string &str, NetworkType nettype) + { + return false; + } + + uint32_t WinWallet::defaultMixin() const + { + return 0; + } + + WinTransactionHistory *WinWallet::history() + { + return nullptr; + } + + + + + Safex::Wallet::ConnectionStatus WinWallet::connected() const + { + return Safex::Wallet::ConnectionStatus::ConnectionStatus_WrongVersion; + } + + void WinWallet::setTrustedDaemon(bool arg) + { + win_setTrustedDaemon(m_innerPtr, static_cast<uint8_t>(arg)); + } + + uint64_t WinWallet::balanceAll() const + { + return win_balanceAll(m_innerPtr); + } + + uint64_t WinWallet::unlockedBalanceAll() const + { + return win_unlockedBalanceAll(m_innerPtr); + } + + uint64_t WinWallet::tokenBalanceAll() const + { + return win_tokenBalanceAll(m_innerPtr); + } + + uint64_t WinWallet::unlockedTokenBalanceAll() const + { + return win_unlockedTokenBalanceAll(m_innerPtr); + + } + + + void WinWallet::setDefaultMixin(uint32_t arg) + { + + } + + std::string WinWallet::signMessage(const std::string &message) + { + return std::string(); + } + + int WinWallet::status() const + { + return 0; + } + + bool WinWallet::verifySignedMessage(const std::string &message, const std::string &addres, const std::string &signature) const + { + return false; + } + + uint64_t WinWallet::blockChainHeight() const + { + return 0; + } + + void WinWallet::setListener(WinWalletListener * wltListener) + { + m_nativeListenerPtr = win_lstn_Create(static_cast<void *>(wltListener)); + ::win_lstn_setMoneySpent(m_nativeListenerPtr, &WinWalletListenerProxy::moneySpent); + ::win_lstn_setMoneyReceived(m_nativeListenerPtr, &WinWalletListenerProxy::moneyReceived); + ::win_lstn_setUnconfirmedMoneyReceived(m_nativeListenerPtr, &WinWalletListenerProxy::unconfirmedMoneyReceived); + ::win_lstn_setTokensSpent(m_nativeListenerPtr, &WinWalletListenerProxy::tokensSpent); + ::win_lstn_setTokenReceived(m_nativeListenerPtr, &WinWalletListenerProxy::tokensReceived); + ::win_lstn_setUnconfirmedTokenReceived(m_nativeListenerPtr, &WinWalletListenerProxy::unconfirmedTokensReceived); + ::win_lstn_setNewBlock(m_nativeListenerPtr, &WinWalletListenerProxy::newBlock); + ::win_lstn_setUpdated(m_nativeListenerPtr, &WinWalletListenerProxy::updated); + ::win_lstn_setRefreshed(m_nativeListenerPtr, &WinWalletListenerProxy::refreshed); + ::win_SetListener(m_innerPtr, m_nativeListenerPtr); + } + + WinPendingTransaction *WinWallet::createTransaction(const std::string &dst_addr, const std::string &payment_id, optional<uint64_t> value_amount, uint32_t mixin_count, + PendingTransaction::Priority priority, uint32_t subaddr_account, std::set<uint32_t> subaddr_indices, const TransactionType tx_type) + { + + std::cout << "WinWallet::createTransaction checkpoint 1" << std::endl; + void* temp = win_createTransaction(m_innerPtr,dst_addr.c_str(), payment_id.c_str(), *value_amount, mixin_count, priority, + 0 /*subaddr_account*/, 0 /*subaddr_indices*/, static_cast<uint32_t>(tx_type)); + WinPendingTransaction *retValue = new WinPendingTransaction(temp); + return retValue; + } + + void WinWallet::startRefresh() + { + win_startRefresh(m_innerPtr); + } + + void WinWallet::pauseRefresh() + { + + } + + bool WinWallet::refresh() + { + return false; + } + + void WinWallet::refreshAsync() + { + + } + + void WinWallet::setRefreshFromBlockHeight(uint64_t refresh_from_block_height) + { + win_setRefreshFromBlockHeight(m_innerPtr, refresh_from_block_height); + } + + +} diff --git a/src/win/winwallet.h b/src/win/winwallet.h new file mode 100644 index 0000000..f1106f9 --- /dev/null +++ b/src/win/winwallet.h @@ -0,0 +1,179 @@ +// Copyright (c) 2018, The Safex Project +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, are +// permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, this list +// of conditions and the following disclaimer in the documentation and/or other +// materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers +// Parts of this file are originally copyright (c) 2014-2018 The Monero Project + +#ifndef SAFEX_NODEJS_LIBWALLET_WINWALLET_H +#define SAFEX_NODEJS_LIBWALLET_WINWALLET_H + + + +#pragma once + +#include <cstdint> +#include <string> +#include <vector> +#include <set> +#include <ctime> + + +#include <wallet_api.h> +#include "safexnativewallet.h" + + +// Public interface for libwallet library +namespace Safex +{ + + struct WinTransactionInfo + { + virtual ~WinTransactionInfo(); + + WinTransactionInfo(void *innerPtr) : m_innerPtr(innerPtr) + {} + + virtual int direction() const; + + virtual bool isPending() const; + + virtual bool isFailed() const; + + virtual uint64_t amount() const; + + virtual uint64_t fee() const; + + virtual uint64_t blockHeight() const; + + virtual std::set<uint32_t> subaddrIndex() const; + + virtual uint32_t subaddrAccount() const; + + virtual std::string label() const; + + virtual uint64_t confirmations() const; + + virtual uint64_t unlockTime() const; + + //! transaction_id + virtual std::string hash() const; + + virtual std::time_t timestamp() const; + + virtual std::string paymentId() const; + + //! only applicable for output transactions + virtual const std::vector<Safex::TransactionInfo::Transfer> &transfers() const; + + virtual TransactionType transactionType() const; + + private: + void *m_innerPtr; + }; + + + struct WinTransactionHistory + { + virtual ~WinTransactionHistory(); + virtual int count() const; + virtual WinTransactionInfo * transaction(int index) const; + virtual WinTransactionInfo * transaction(const std::string &id) const; + virtual std::vector<WinTransactionInfo*> getAll() const; + virtual void refresh(); + }; + + + struct WinWallet + { + + WinWallet(void *self_):m_innerPtr{self_} {} + + virtual ~WinWallet(); + virtual std::string seed() const; + virtual Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, NetworkType nettype); + virtual std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const; + virtual std::string path() const; + virtual NetworkType nettype() const; + virtual std::string secretViewKey() const; + virtual std::string publicViewKey() const; + virtual std::string secretSpendKey() const; + virtual std::string publicSpendKey() const; + virtual bool store(const std::string &path); + virtual bool setPassword(const std::string &password); + virtual std::string errorString() const; + virtual bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit = 0, const std::string &daemon_username = "", const std::string &daemon_password = "", bool use_ssl = false, bool lightWallet = false); + virtual void setRefreshFromBlockHeight(uint64_t refresh_from_block_height); + virtual uint64_t getRefreshFromBlockHeight() const; + virtual bool trustedDaemon() const; + virtual Safex::Wallet::ConnectionStatus connected() const; + virtual void startRefresh(); + virtual void pauseRefresh(); + virtual bool refresh(); + virtual void refreshAsync(); + virtual void setTrustedDaemon(bool arg); + virtual void setListener(WinWalletListener *); + virtual WinPendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id, + optional<uint64_t> value_amount, uint32_t mixin_count, + PendingTransaction::Priority = PendingTransaction::Priority_Low, + uint32_t subaddr_account = 0, + std::set<uint32_t> subaddr_indices = {}, + const TransactionType tx_type = TransactionType::CashTransaction); + uint64_t balanceAll() const; + uint64_t unlockedBalanceAll() const; + uint64_t tokenBalanceAll() const; + uint64_t unlockedTokenBalanceAll() const; + virtual void segregatePreForkOutputs(bool segregate); + virtual void keyReuseMitigation2(bool mitigation); + + static std::string genPaymentId(); + virtual uint64_t daemonBlockChainHeight() const; + virtual bool synchronized() const; + static bool paymentIdValid(const std::string &paiment_id); + static bool addressValid(const std::string &str, NetworkType nettype); + static bool addressValid(const std::string &str, bool testnet) // deprecated + { + return addressValid(str, testnet ? TESTNET : MAINNET); + } + virtual uint32_t defaultMixin() const; + virtual WinTransactionHistory *history(); + virtual uint64_t blockChainHeight() const; + + virtual void setDefaultMixin(uint32_t arg); + virtual std::string signMessage(const std::string &message); + virtual int status() const; + virtual bool verifySignedMessage(const std::string &message, const std::string &addres, const std::string &signature) const; + + + private: + void *m_innerPtr; + void *m_nativeListenerPtr; + }; + +} + +#endif //SAFEX_NODEJS_LIBWALLET_WINWALLET_H diff --git a/src/win/winwalletlistener.cpp b/src/win/winwalletlistener.cpp new file mode 100644 index 0000000..0896828 --- /dev/null +++ b/src/win/winwalletlistener.cpp @@ -0,0 +1,70 @@ +// +// Created by amarko on 29.11.18.. +// + + +#include <cstdint> +#include <winwalletlistener.h> + +#include <windows_wrapper.h> + +namespace Safex +{ + + + void WinWalletListenerProxy::moneySpent(void *target, const char *txId, uint64_t amount) + { + WinWalletListener *sink = static_cast<WinWalletListener *>(target); + sink->moneySpent((txId), amount); + } + + void WinWalletListenerProxy::moneyReceived(void *target, const char *txId, uint64_t amount) + { + WinWalletListener *sink = static_cast<WinWalletListener *>(target); + sink->moneyReceived((txId), amount); + } + + void WinWalletListenerProxy::unconfirmedMoneyReceived(void *target, const char *txId, uint64_t amount) + { + WinWalletListener *sink = static_cast<WinWalletListener *>(target); + sink->unconfirmedMoneyReceived(std::string(txId), amount); + } + + void WinWalletListenerProxy::tokensSpent(void *target, const char *txId, uint64_t token_amount) + { + WinWalletListener *sink = static_cast<WinWalletListener *>(target); + sink->tokensSpent(std::string(txId), token_amount); + } + + void WinWalletListenerProxy::tokensReceived(void *target, const char *txId, uint64_t token_amount) + { + WinWalletListener *sink = static_cast<WinWalletListener *>(target); + sink->tokensReceived(std::string(txId), token_amount); + } + + void WinWalletListenerProxy::unconfirmedTokensReceived(void *target, const char *txId, uint64_t token_amount) + { + WinWalletListener *sink = static_cast<WinWalletListener *>(target); + sink->unconfirmedTokensReceived(std::string(txId), token_amount); + } + + void WinWalletListenerProxy::newBlock(void *target, uint64_t height) + { + WinWalletListener *sink = static_cast<WinWalletListener *>(target); + sink->newBlock(height); + } + + void WinWalletListenerProxy::updated(void *target) + { + WinWalletListener *sink = static_cast<WinWalletListener *>(target); + sink->updated(); + } + + void WinWalletListenerProxy::refreshed(void *target) + { + WinWalletListener *sink = static_cast<WinWalletListener *>(target); + sink->refreshed(); + } + + +} diff --git a/src/win/winwalletlistener.h b/src/win/winwalletlistener.h new file mode 100644 index 0000000..0d6efbd --- /dev/null +++ b/src/win/winwalletlistener.h @@ -0,0 +1,98 @@ +// +// Created by amarko on 29.11.18.. +// + +#ifndef WIN_SAFEX_NODEJS_LIBWALLET_WINWALLETLISTENER_H +#define WIN_SAFEX_NODEJS_LIBWALLET_WINWALLETLISTENER_H + +#include <cstdint> +#include <string> + +#include <wallet_api.h> + +namespace Safex +{ + + struct WinWalletListener + { + + /** + * @brief moneySpent - called when money spent + * @param txId - transaction id + * @param amount - amount + */ + virtual void moneySpent(const std::string &txId, uint64_t amount) = 0; + + /** + * @brief moneyReceived - called when money received + * @param txId - transaction id + * @param amount - amount + */ + virtual void moneyReceived(const std::string &txId, uint64_t amount) = 0; + + /** + * @brief unconfirmedMoneyReceived - called when payment arrived in tx pool + * @param txId - transaction id + * @param amount - amount + */ + virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) = 0; + + + /** + * @brief tokensSpent - called when tokens are spent + * @param txId - transaction id + * @param token_amount - token amount + */ + virtual void tokensSpent(const std::string &txId, uint64_t token_amount) = 0; + + /** + * @brief tokensReceived - called when tokens are received + * @param txId - transaction id + * @param token_amount - amount of tokens + */ + virtual void tokensReceived(const std::string &txId, uint64_t token_amount) = 0; + + /** + * @brief unconfirmedTokensReceived - called when token payment arrived in tx pool + * @param txId - transaction id + * @param token_amount - amount of tokens + */ + virtual void unconfirmedTokensReceived(const std::string &txId, uint64_t token_amount) = 0; + + /** + * @brief newBlock - called when new block received + * @param height - block height + */ + virtual void newBlock(uint64_t height) = 0; + + /** + * @brief updated - generic callback, called when any event (sent/received/block reveived/etc) happened with the wallet; + */ + virtual void updated() = 0; + + + /** + * @brief refreshed - called when wallet refreshed by background thread or explicitly refreshed by calling "refresh" synchronously + */ + virtual void refreshed() = 0; + + private: + void* m_innerPtr; + }; + + struct WinWalletListenerProxy { + static void moneySpent(void* target, const char* txId, uint64_t amount); + static void moneyReceived(void* target, const char* txId, uint64_t amount); + static void unconfirmedMoneyReceived(void* target, const char* txId, uint64_t amount); + static void tokensSpent(void* target, const char* txId, uint64_t token_amount); + static void tokensReceived(void* target, const char* txId, uint64_t token_amount); + static void unconfirmedTokensReceived(void* target, const char* txId, uint64_t token_amount); + static void newBlock(void* target, uint64_t height); + static void updated(void* target); + static void refreshed(void* target); + +}; + +} + +#endif //WIN_SAFEX_NODEJS_LIBWALLET_WINWALLETLISTENER_H diff --git a/src/win/winwalletmanager.cpp b/src/win/winwalletmanager.cpp new file mode 100644 index 0000000..711ea63 --- /dev/null +++ b/src/win/winwalletmanager.cpp @@ -0,0 +1,159 @@ +// +// Created by amarko on 29.11.18.. +// + +#include <string> +#include <vector> +#include <tuple> + +#include <winwalletmanager.h> + +#include <windows_wrapper.h> + + + +namespace Safex +{ + + SafexNativeWallet *WinWalletManager::createWallet(const std::string &path, const std::string &password, const std::string &language, NetworkType nettype) + { + void *self = nullptr; + win_mng_createWallet(self, path.c_str(), password.c_str(), language.c_str(), nettype); + SafexNativeWallet *wlt = new WinWallet(self); + return wlt; + } + + SafexNativeWallet *WinWalletManager::openWallet(const std::string &path, const std::string &password, NetworkType nettype) + { + WinWallet *nativeWallet = new WinWallet(win_mng_openWallet(m_innerPtr, path.c_str(), password.c_str(), static_cast<uint32_t>(nettype))); + return nativeWallet; + } + + SafexNativeWallet *WinWalletManager::recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic, NetworkType nettype, uint64_t restoreHeight) + { + + WinWallet *nativeWallet = new WinWallet(win_mng_recoveryWallet(m_innerPtr, path.c_str(), password.c_str(), mnemonic.c_str(), static_cast<uint32_t>(nettype), restoreHeight)); + return nativeWallet; + } + + SafexNativeWallet *WinWalletManager::recoveryWallet(const std::string &path, const std::string &mnemonic, NetworkType nettype, uint64_t restoreHeight) + { + return nullptr; + } + + SafexNativeWallet *WinWalletManager::createWalletFromKeys(const std::string &path, const std::string &password, const std::string &language, NetworkType nettype, uint64_t restoreHeight, + const std::string &addressString, const std::string &viewKeyString, const std::string &spendKeyString) + { + WinWallet *nativeWallet = new WinWallet(win_mng_createWalletFromKeys(m_innerPtr, path.c_str(), password.c_str(), language.c_str(), static_cast<uint32_t>(nettype), restoreHeight, + addressString.c_str(), viewKeyString.c_str(), spendKeyString.c_str())); + + return nativeWallet; + } + + SafexNativeWallet *WinWalletManager::createWalletFromKeys(const std::string &path, const std::string &language, NetworkType nettype, uint64_t restoreHeight, const std::string &addressString, const std::string &viewKeyString, const std::string &spendKeyString) + { + return nullptr; + } + + bool WinWalletManager::closeWallet(SafexNativeWallet *wallet, bool store) + { + return false; + } + + bool WinWalletManager::walletExists(const std::string &path) + { + return win_mng_walletExists(m_innerPtr, path.c_str()); + } + + bool WinWalletManager::verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key) const + { + return false; + } + + std::vector<std::string> WinWalletManager::findWallets(const std::string &path) + { + return std::vector<std::string>(); + } + + std::string WinWalletManager::errorString() const + { + return std::string(); + } + + void WinWalletManager::setDaemonAddress(const std::string &address) + { + + } + + bool WinWalletManager::connected(uint32_t *version) + { + return false; + } + + uint64_t WinWalletManager::blockchainHeight() + { + return 0; + } + + uint64_t WinWalletManager::blockchainTargetHeight() + { + return 0; + } + + uint64_t WinWalletManager::networkDifficulty() + { + return 0; + } + + double WinWalletManager::miningHashRate() + { + return 0; + } + + uint64_t WinWalletManager::blockTarget() + { + return 0; + } + + bool WinWalletManager::isMining() + { + return false; + } + + bool WinWalletManager::startMining(const std::string &address, uint32_t threads, bool background_mining, bool ignore_battery) + { + return false; + } + + bool WinWalletManager::stopMining() + { + return false; + } + + std::string WinWalletManager::resolveOpenAlias(const std::string &address, bool &dnssec_valid) const + { + return std::string(); + } + + std::tuple<bool, std::string, std::string, std::string, std::string> WinWalletManager::checkUpdates(const std::string &software, std::string subdir) + { + return std::tuple<bool, std::string, std::string, std::string, std::string>(); + } + + WinWalletManager *WinWalletManagerFactory::getWalletManager() + { + WinWalletManager *winWalletManager = new WinWalletManager(::win_mngf_getWalletManager()); + WinWalletManagerFactory::setLogLevel(LogLevel::LogLevel_0); //by default mlog it prints on stdout on Windows + return winWalletManager; + } + + void WinWalletManagerFactory::setLogLevel(int level) + { + win_mlog_set_log_levelI(level); + } + + void WinWalletManagerFactory::setLogCategories(const std::string &categories) + { + win_mlog_set_log_levelCPtr(categories.c_str()); + } +} diff --git a/src/win/winwalletmanager.h b/src/win/winwalletmanager.h new file mode 100644 index 0000000..29f76d4 --- /dev/null +++ b/src/win/winwalletmanager.h @@ -0,0 +1,257 @@ +// +// Created by amarko on 29.11.18.. +// + +#ifndef WIN_SAFEX_NODEJS_LIBWALLET_WINWALLETMANAGER_H +#define WIN_SAFEX_NODEJS_LIBWALLET_WINWALLETMANAGER_H + +#include <cstdint> +#include <string> +#include <tuple> + +#include <wallet_api.h> +#include <winwallet.h> + +namespace Safex +{ + + +/** + * @brief WinWalletManager - wrapper on windows for WalletManager + */ + struct WinWalletManager + { + + WinWalletManager(void *nativeWalletPtr): m_innerPtr(nativeWalletPtr) {} + + /*! + * \brief Creates new wallet + * \param path Name of wallet file + * \param password Password of wallet file + * \param language Language to be used to generate electrum seed mnemonic + * \param nettype Network type + * \return SafexNativeWallet instance (SafexNativeWallet::status() needs to be called to check if created successfully) + */ + virtual SafexNativeWallet *createWallet(const std::string &path, const std::string &password, const std::string &language, NetworkType nettype); + + SafexNativeWallet *createWallet(const std::string &path, const std::string &password, const std::string &language, bool testnet = false) // deprecated + { + return createWallet(path, password, language, testnet ? TESTNET : MAINNET); + } + + /*! + * \brief Opens existing wallet + * \param path Name of wallet file + * \param password Password of wallet file + * \param nettype Network type + * \return SafexNativeWallet instance (SafexNativeWallet::status() needs to be called to check if opened successfully) + */ + virtual SafexNativeWallet *openWallet(const std::string &path, const std::string &password, NetworkType nettype); + + SafexNativeWallet *openWallet(const std::string &path, const std::string &password, bool testnet = false) // deprecated + { + return openWallet(path, password, testnet ? TESTNET : MAINNET); + } + + /*! + * \brief recovers existing wallet using mnemonic (electrum seed) + * \param path Name of wallet file to be created + * \param password Password of wallet file + * \param mnemonic mnemonic (25 words electrum seed) + * \param nettype Network type + * \param restoreHeight restore from start height + * \return SafexNativeWallet instance (SafexNativeWallet::status() needs to be called to check if recovered successfully) + */ + virtual SafexNativeWallet *recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic, + NetworkType nettype = MAINNET, uint64_t restoreHeight = 0); + + SafexNativeWallet *recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic, + bool testnet = false, uint64_t restoreHeight = 0) // deprecated + { + return recoveryWallet(path, password, mnemonic, testnet ? TESTNET : MAINNET, restoreHeight); + } + + /*! + * \deprecated this method creates a wallet WITHOUT a passphrase, use the alternate recoverWallet() method + * \brief recovers existing wallet using mnemonic (electrum seed) + * \param path Name of wallet file to be created + * \param mnemonic mnemonic (25 words electrum seed) + * \param nettype Network type + * \param restoreHeight restore from start height + * \return SafexNativeWallet instance (SafexNativeWallet::status() needs to be called to check if recovered successfully) + */ + virtual SafexNativeWallet *recoveryWallet(const std::string &path, const std::string &mnemonic, NetworkType nettype, uint64_t restoreHeight = 0); + + SafexNativeWallet *recoveryWallet(const std::string &path, const std::string &mnemonic, bool testnet = false, uint64_t restoreHeight = 0) // deprecated + { + return recoveryWallet(path, mnemonic, testnet ? TESTNET : MAINNET, restoreHeight); + } + + /*! + * \brief recovers existing wallet using keys. Creates a view only wallet if spend key is omitted + * \param path Name of wallet file to be created + * \param password Password of wallet file + * \param language language + * \param nettype Network type + * \param restoreHeight restore from start height + * \param addressString public address + * \param viewKeyString view key + * \param spendKeyString spend key (optional) + * \return SafexNativeWallet instance (SafexNativeWallet::status() needs to be called to check if recovered successfully) + */ + virtual SafexNativeWallet *createWalletFromKeys(const std::string &path, + const std::string &password, + const std::string &language, + NetworkType nettype, + uint64_t restoreHeight, + const std::string &addressString, + const std::string &viewKeyString, + const std::string &spendKeyString = ""); + + SafexNativeWallet *createWalletFromKeys(const std::string &path, + const std::string &password, + const std::string &language, + bool testnet, + uint64_t restoreHeight, + const std::string &addressString, + const std::string &viewKeyString, + const std::string &spendKeyString = "") // deprecated + { + return createWalletFromKeys(path, password, language, testnet ? TESTNET : MAINNET, restoreHeight, addressString, viewKeyString, spendKeyString); + } + + /*! + * \deprecated this method creates a wallet WITHOUT a passphrase, use createWalletFromKeys(..., password, ...) instead + * \brief recovers existing wallet using keys. Creates a view only wallet if spend key is omitted + * \param path Name of wallet file to be created + * \param language language + * \param nettype Network type + * \param restoreHeight restore from start height + * \param addressString public address + * \param viewKeyString view key + * \param spendKeyString spend key (optional) + * \return SafexNativeWallet instance (SafexNativeWallet::status() needs to be called to check if recovered successfully) + */ + virtual SafexNativeWallet *createWalletFromKeys(const std::string &path, + const std::string &language, + NetworkType nettype, + uint64_t restoreHeight, + const std::string &addressString, + const std::string &viewKeyString, + const std::string &spendKeyString = ""); + + SafexNativeWallet *createWalletFromKeys(const std::string &path, + const std::string &language, + bool testnet, + uint64_t restoreHeight, + const std::string &addressString, + const std::string &viewKeyString, + const std::string &spendKeyString = "") // deprecated + { + return createWalletFromKeys(path, language, testnet ? TESTNET : MAINNET, restoreHeight, addressString, viewKeyString, spendKeyString); + } + + /*! + * \brief Closes wallet. In case operation succeeded, wallet object deleted. in case operation failed, wallet object not deleted + * \param wallet previously opened / created wallet instance + * \return None + */ + virtual bool closeWallet(SafexNativeWallet *wallet, bool store = true); + + /* + * ! checks if wallet with the given name already exists + */ + + /*! + * @brief TODO: delme walletExists - check if the given filename is the wallet + * @param path - filename + * @return - true if wallet exists + */ + virtual bool walletExists(const std::string &path); + + /*! + * @brief verifyWalletPassword - check if the given filename is the wallet + * @param keys_file_name - location of keys file + * @param password - password to verify + * @param no_spend_key - verify only view keys? + * @return - true if password is correct + */ + virtual bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key) const; + + /*! + * \brief findWallets - searches for the wallet files by given path name recursively + * \param path - starting point to search + * \return - list of strings with found wallets (absolute paths); + */ + virtual std::vector<std::string> findWallets(const std::string &path); + + //! returns verbose error string regarding last error; + virtual std::string errorString() const; + + //! set the daemon address (hostname and port) + virtual void setDaemonAddress(const std::string &address); + + //! returns whether the daemon can be reached, and its version number + virtual bool connected(uint32_t *version = NULL); + + //! returns current blockchain height + virtual uint64_t blockchainHeight(); + + //! returns current blockchain target height + virtual uint64_t blockchainTargetHeight(); + + //! returns current network difficulty + virtual uint64_t networkDifficulty(); + + //! returns current mining hash rate (0 if not mining) + virtual double miningHashRate(); + + //! returns current block target + virtual uint64_t blockTarget(); + + //! returns true iff mining + virtual bool isMining(); + + //! starts mining with the set number of threads + virtual bool startMining(const std::string &address, uint32_t threads = 1, bool background_mining = false, bool ignore_battery = true); + + //! stops mining + virtual bool stopMining(); + + //! resolves an OpenAlias address to a monero address + virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const; + + //! checks for an update and returns version, hash and url + static std::tuple<bool, std::string, std::string, std::string, std::string> checkUpdates(const std::string &software, std::string subdir); + + private: + void* m_innerPtr; + + }; + + + struct WinWalletManagerFactory + { + // logging levels for underlying library + enum LogLevel + { + LogLevel_Silent = -1, + LogLevel_0 = 0, + LogLevel_1 = 1, + LogLevel_2 = 2, + LogLevel_3 = 3, + LogLevel_4 = 4, + LogLevel_Min = LogLevel_Silent, + LogLevel_Max = LogLevel_4 + }; + + static WinWalletManager *getWalletManager(); + + static void setLogLevel(int level); + + static void setLogCategories(const std::string &categories); + }; + + +} +#endif //WIN_SAFEX_NODEJS_LIBWALLET_WINWALLETMANAGER_H