From 6b568b2f6828951fac64009a4d542f5391e220ca Mon Sep 17 00:00:00 2001 From: martin <30367552+mroz22@users.noreply.github.com> Date: Tue, 21 Jan 2020 14:20:52 +0100 Subject: [PATCH 01/51] fix messages overwrite (#517) * fix messages overwrite * only JSON.strigify --- src/js/device/DeviceList.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/js/device/DeviceList.js b/src/js/device/DeviceList.js index d3b3500ff..c0b1a527d 100644 --- a/src/js/device/DeviceList.js +++ b/src/js/device/DeviceList.js @@ -76,7 +76,7 @@ export default class DeviceList extends EventEmitter { _log.debug('Initializing transports'); await transport.init(_log.enabled); _log.debug('Configuring transports'); - await transport.configure(this.defaultMessages); + await transport.configure(JSON.stringify(this.defaultMessages)); _log.debug('Configuring transports done'); const { activeName } = transport; @@ -98,7 +98,7 @@ export default class DeviceList extends EventEmitter { async reconfigure(json: JSON, custom?: boolean) { if (this.currentMessages === json) return; try { - await this.transport.configure(json); + await this.transport.configure(JSON.stringify(json)); this.currentMessages = json; this.hasCustomMessages = typeof custom === 'boolean' ? custom : false; } catch (error) { @@ -109,7 +109,7 @@ export default class DeviceList extends EventEmitter { async restoreMessages() { if (!this.hasCustomMessages) return; try { - await this.transport.configure(this.defaultMessages); + await this.transport.configure(JSON.stringify(this.defaultMessages)); this.hasCustomMessages = false; } catch (error) { throw ERROR.WRONG_TRANSPORT_CONFIG; From 18c7f2fab1aa06969415bf9f9bf903253dcefa84 Mon Sep 17 00:00:00 2001 From: martin <30367552+mroz22@users.noreply.github.com> Date: Mon, 10 Feb 2020 14:40:09 +0100 Subject: [PATCH 02/51] fix disableWebusb method (#526) --- src/js/core/Core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/core/Core.js b/src/js/core/Core.js index 957c5bb8e..506bae1f1 100644 --- a/src/js/core/Core.js +++ b/src/js/core/Core.js @@ -953,7 +953,7 @@ export const initTransport = async (settings: ConnectSettings) => { const disableWebUSBTransport = async () => { if (!_deviceList) return; - if (_deviceList.transportType() !== 'webusb') return; + if (_deviceList.transportType() !== 'WebUsbPlugin') return; // override settings const settings = DataManager.getSettings(); settings.webusb = false; From 50432fa72bb3c2068ad3abaac3de33a94be6febf Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 18 Feb 2020 12:40:02 +0100 Subject: [PATCH 03/51] Passphrase redesign (#525) * add new protobuf messages * new passphrase popup view (added "on device" button/desision) * device state refactoring * update flow-bin * flow fixes * update webpack related dependencies * add versionCompare util to replace 'semver-compare' * passphraseOnDevice decision from Features * protobuf reconfigure before Initialize * upgrade travis & gitlab node to latest TLS * Update .gitlab-ci.yml * add features.capabilities + Device.unavailableCapabilities * flow fix * call Initialize when externalState is not used * make externalState unique * cleanup * Update messages.json * Update messages.json --- .gitignore | 1 + .gitlab-ci.yml | 3 +- .travis.yml | 2 +- jest.config.js | 8 +- package.json | 22 +- src/data/config.json | 10 +- src/data/messages/messages-v8.json | 9883 +++++++++++++++++ src/data/messages/messages.json | 210 +- src/html/popup.html | 5 +- src/js/core/Core.js | 57 +- src/js/core/methods/AbstractMethod.js | 9 +- src/js/core/methods/GetDeviceState.js | 11 +- .../core/methods/helpers/paramsValidator.js | 14 +- src/js/data/CoinInfo.js | 74 +- src/js/data/DataManager.js | 14 +- src/js/data/__tests__/CoinInfo.test.js | 46 + src/js/device/Device.js | 200 +- src/js/device/DeviceCommands.js | 91 +- src/js/device/DeviceList.js | 13 +- src/js/popup/view/invalidPassphrase.js | 12 +- src/js/popup/view/passphrase.js | 34 +- src/js/types/coinInfo.js | 2 +- src/js/types/index.js | 8 +- src/js/types/uiResponse.js | 1 + .../__tests__/deviceFeaturesUtils.test.js | 185 + src/js/utils/arrayUtils.js | 9 - src/js/utils/deviceFeaturesUtils.js | 115 + yarn.lock | 230 +- 28 files changed, 10816 insertions(+), 453 deletions(-) create mode 100644 src/data/messages/messages-v8.json create mode 100644 src/js/utils/__tests__/deviceFeaturesUtils.test.js delete mode 100644 src/js/utils/arrayUtils.js create mode 100644 src/js/utils/deviceFeaturesUtils.js diff --git a/.gitignore b/.gitignore index 6fad42f32..c6341ec76 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ package-lock.json logs *.log .yarnclean +coverage diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ee52cf95b..76fd1473c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: node:8.10 +image: node:12.14.1 stages: - build @@ -7,7 +7,6 @@ stages: build: stage: build script: - - npm install -g yarn - yarn - yarn flow - yarn eslint diff --git a/.travis.yml b/.travis.yml index 70a515094..8eaaa0998 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,7 @@ language: node_js build: trusty node_js: - - "8.10" + - "12.14.1" script: - npm install -g yarn diff --git a/jest.config.js b/jest.config.js index 0ba1f5913..2c94f4b1b 100644 --- a/jest.config.js +++ b/jest.config.js @@ -6,10 +6,10 @@ module.exports = { rootDir: './', moduleFileExtensions: ['js'], testMatch: ['**/src/js/**/*.test.(js)'], - // coverageDirectory: './coverage/', - // collectCoverage: true, - // collectCoverageFrom: ['**/src/**/*.js'], - // modulePathIgnorePatterns: ['node_modules'], + testPathIgnorePatterns: ['/node_modules/', '/src/js/device/_old/'], + coverageDirectory: './coverage/', + collectCoverage: true, + modulePathIgnorePatterns: ['node_modules'], setupFiles: ['./tests/jest.setup.js'], transform: { '^.+\\.js$': 'babel-jest', diff --git a/package.json b/package.json index e83ee7353..dd1858480 100644 --- a/package.json +++ b/package.json @@ -65,8 +65,8 @@ "bchaddrjs": "0.4.4", "bignumber.js": "^9.0.0", "bowser": "^2.7.0", - "copy-webpack-plugin": "^5.0.5", - "css-loader": "^3.2.0", + "copy-webpack-plugin": "5.1.1", + "css-loader": "3.4.2", "es6-promise": "^4.2.2", "eslint": "^6.6.0", "eslint-plugin-flowtype": "^4.4.1", @@ -74,7 +74,7 @@ "eslint-plugin-promise": "^4.1.1", "eslint-plugin-standard": "^4.0.1", "file-loader": "^4.2.0", - "flow-bin": "0.112.0", + "flow-bin": "0.116.1", "fs-extra": "^8.1.0", "hd-wallet": "9.0.0", "html-webpack-plugin": "^3.2.0", @@ -94,21 +94,21 @@ "less-loader": "^5.0.0", "less-plugin-autoprefix": "^2.0.0", "less-plugin-clean-css": "^1.5.1", - "mini-css-extract-plugin": "^0.8.0", + "mini-css-extract-plugin": "0.9.0", "node-fetch": "^2.6.0", "parse-uri": "^1.0.0", "ripple-lib": "^1.4.0", "sharedworker-loader": "^2.1.1", - "style-loader": "^1.0.0", - "terser-webpack-plugin": "^2.2.1", + "style-loader": "1.1.3", + "terser-webpack-plugin": "2.3.2", "tiny-worker": "^2.3.0", "trezor-link": "1.6.7", "uglify-es": "3.3.9", - "version-bump-prompt": "^5.0.6", - "webpack": "^4.41.2", - "webpack-cli": "^3.3.10", - "webpack-dev-server": "^3.9.0", - "worker-loader": "^2.0.0" + "version-bump-prompt": "5.0.7", + "webpack": "4.41.5", + "webpack-cli": "3.3.10", + "webpack-dev-server": "3.10.1", + "worker-loader": "2.0.0" }, "dependencies": { "@babel/runtime": "^7.7.2", diff --git a/src/data/config.json b/src/data/config.json index fa755661d..e84a7706f 100644 --- a/src/data/config.json +++ b/src/data/config.json @@ -64,10 +64,18 @@ }, "json": "./data/messages/messages-v7.json" }, + { + "name": "v8", + "range": { + "min": ["1.8.2", "2.1.2"], + "max": ["1.8.9", "2.2.9"] + }, + "json": "./data/messages/messages-v8.json" + }, { "name": "default", "range": { - "min": ["1.8.2", "2.1.2"] + "min": ["1.9.0", "2.3.0"] }, "json": "./data/messages/messages.json" } diff --git a/src/data/messages/messages-v8.json b/src/data/messages/messages-v8.json new file mode 100644 index 000000000..08deb2575 --- /dev/null +++ b/src/data/messages/messages-v8.json @@ -0,0 +1,9883 @@ +{ + "package": null, + "messages": [ + { + "name": "BinanceGetAddress", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "BinanceAddress", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "BinanceGetPublicKey", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "BinancePublicKey", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "BinanceSignTx", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "msg_count", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "account_number", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "chain_id", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "memo", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "sequence", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "source", + "id": 7 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "BinanceTxRequest", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "BinanceTransferMsg", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "BinanceInputOutput", + "name": "inputs", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "BinanceInputOutput", + "name": "outputs", + "id": 2 + } + ], + "enums": [], + "messages": [ + { + "name": "BinanceInputOutput", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "BinanceCoin", + "name": "coins", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "BinanceCoin", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "amount", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "denom", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "BinanceOrderMsg", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "id", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "BinanceOrderType", + "name": "ordertype", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "price", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "quantity", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "sender", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "BinanceOrderSide", + "name": "side", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "symbol", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "BinanceTimeInForce", + "name": "timeinforce", + "id": 8 + } + ], + "enums": [ + { + "name": "BinanceOrderType", + "values": [ + { + "name": "OT_UNKNOWN", + "id": 0 + }, + { + "name": "MARKET", + "id": 1 + }, + { + "name": "LIMIT", + "id": 2 + }, + { + "name": "OT_RESERVED", + "id": 3 + } + ], + "options": {} + }, + { + "name": "BinanceOrderSide", + "values": [ + { + "name": "SIDE_UNKNOWN", + "id": 0 + }, + { + "name": "BUY", + "id": 1 + }, + { + "name": "SELL", + "id": 2 + } + ], + "options": {} + }, + { + "name": "BinanceTimeInForce", + "values": [ + { + "name": "TIF_UNKNOWN", + "id": 0 + }, + { + "name": "GTE", + "id": 1 + }, + { + "name": "TIF_RESERVED", + "id": 2 + }, + { + "name": "IOC", + "id": 3 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "BinanceCancelMsg", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "refid", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "sender", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "symbol", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "BinanceSignedTx", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MultisigRedeemScriptType", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "HDNodePathType", + "name": "pubkeys", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "bytes", + "name": "signatures", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "m", + "id": 3 + }, + { + "rule": "repeated", + "options": {}, + "type": "HDNodeType", + "name": "nodes", + "id": 4 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 5 + } + ], + "enums": [], + "messages": [ + { + "name": "HDNodePathType", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "HDNodeType", + "name": "node", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "GetPublicKey", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "ecdsa_curve_name", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 3 + }, + { + "rule": "optional", + "options": { + "default": "Bitcoin" + }, + "type": "string", + "name": "coin_name", + "id": 4 + }, + { + "rule": "optional", + "options": { + "default": "SPENDADDRESS" + }, + "type": "InputScriptType", + "name": "script_type", + "id": 5 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "PublicKey", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "HDNodeType", + "name": "node", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "xpub", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "GetAddress", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": { + "default": "Bitcoin" + }, + "type": "string", + "name": "coin_name", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "MultisigRedeemScriptType", + "name": "multisig", + "id": 4 + }, + { + "rule": "optional", + "options": { + "default": "SPENDADDRESS" + }, + "type": "InputScriptType", + "name": "script_type", + "id": 5 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "Address", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "SignMessage", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "required", + "options": {}, + "type": "bytes", + "name": "message", + "id": 2 + }, + { + "rule": "optional", + "options": { + "default": "Bitcoin" + }, + "type": "string", + "name": "coin_name", + "id": 3 + }, + { + "rule": "optional", + "options": { + "default": "SPENDADDRESS" + }, + "type": "InputScriptType", + "name": "script_type", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MessageSignature", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "VerifyMessage", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "message", + "id": 3 + }, + { + "rule": "optional", + "options": { + "default": "Bitcoin" + }, + "type": "string", + "name": "coin_name", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "SignTx", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "outputs_count", + "id": 1 + }, + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "inputs_count", + "id": 2 + }, + { + "rule": "optional", + "options": { + "default": "Bitcoin" + }, + "type": "string", + "name": "coin_name", + "id": 3 + }, + { + "rule": "optional", + "options": { + "default": 1 + }, + "type": "uint32", + "name": "version", + "id": 4 + }, + { + "rule": "optional", + "options": { + "default": 0 + }, + "type": "uint32", + "name": "lock_time", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "expiry", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "overwintered", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "version_group_id", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "timestamp", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "branch_id", + "id": 10 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TxRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "RequestType", + "name": "request_type", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "TxRequestDetailsType", + "name": "details", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "TxRequestSerializedType", + "name": "serialized", + "id": 3 + } + ], + "enums": [ + { + "name": "RequestType", + "values": [ + { + "name": "TXINPUT", + "id": 0 + }, + { + "name": "TXOUTPUT", + "id": 1 + }, + { + "name": "TXMETA", + "id": 2 + }, + { + "name": "TXFINISHED", + "id": 3 + }, + { + "name": "TXEXTRADATA", + "id": 4 + } + ], + "options": {} + } + ], + "messages": [ + { + "name": "TxRequestDetailsType", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "request_index", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_hash", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "extra_data_len", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "extra_data_offset", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TxRequestSerializedType", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "signature_index", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "serialized_tx", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "TxAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "TransactionType", + "name": "tx", + "id": 1 + } + ], + "enums": [], + "messages": [ + { + "name": "TransactionType", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "version", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "TxInputType", + "name": "inputs", + "id": 2 + }, + { + "rule": "repeated", + "options": {}, + "type": "TxOutputBinType", + "name": "bin_outputs", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "lock_time", + "id": 4 + }, + { + "rule": "repeated", + "options": {}, + "type": "TxOutputType", + "name": "outputs", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "inputs_cnt", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "outputs_cnt", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "extra_data", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "extra_data_len", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "expiry", + "id": 10 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "overwintered", + "id": 11 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "version_group_id", + "id": 12 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "timestamp", + "id": 13 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "branch_id", + "id": 14 + } + ], + "enums": [], + "messages": [ + { + "name": "TxInputType", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "required", + "options": {}, + "type": "bytes", + "name": "prev_hash", + "id": 2 + }, + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "prev_index", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "script_sig", + "id": 4 + }, + { + "rule": "optional", + "options": { + "default": 4294967295 + }, + "type": "uint32", + "name": "sequence", + "id": 5 + }, + { + "rule": "optional", + "options": { + "default": "SPENDADDRESS" + }, + "type": "InputScriptType", + "name": "script_type", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "MultisigRedeemScriptType", + "name": "multisig", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "amount", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "decred_tree", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "decred_script_version", + "id": 10 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "prev_block_hash_bip115", + "id": 11 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "prev_block_height_bip115", + "id": 12 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TxOutputBinType", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "uint64", + "name": "amount", + "id": 1 + }, + { + "rule": "required", + "options": {}, + "type": "bytes", + "name": "script_pubkey", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "decred_script_version", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TxOutputType", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 2 + }, + { + "rule": "required", + "options": {}, + "type": "uint64", + "name": "amount", + "id": 3 + }, + { + "rule": "required", + "options": {}, + "type": "OutputScriptType", + "name": "script_type", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "MultisigRedeemScriptType", + "name": "multisig", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "op_return_data", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "decred_script_version", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "block_hash_bip115", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "block_height_bip115", + "id": 9 + } + ], + "enums": [ + { + "name": "OutputScriptType", + "values": [ + { + "name": "PAYTOADDRESS", + "id": 0 + }, + { + "name": "PAYTOSCRIPTHASH", + "id": 1 + }, + { + "name": "PAYTOMULTISIG", + "id": 2 + }, + { + "name": "PAYTOOPRETURN", + "id": 3 + }, + { + "name": "PAYTOWITNESS", + "id": 4 + }, + { + "name": "PAYTOP2SHWITNESS", + "id": 5 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "FirmwareErase", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "length", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "FirmwareRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "offset", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "length", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "FirmwareUpload", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "bytes", + "name": "payload", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "hash", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "SelfTest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "payload", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CardanoGetAddress", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CardanoAddress", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CardanoGetPublicKey", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CardanoPublicKey", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "xpub", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "HDNodeType", + "name": "node", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CardanoSignTx", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "CardanoTxInputType", + "name": "inputs", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "CardanoTxOutputType", + "name": "outputs", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "transactions_count", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "protocol_magic", + "id": 5 + } + ], + "enums": [], + "messages": [ + { + "name": "CardanoTxInputType", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "prev_hash", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "prev_index", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "type", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CardanoTxOutputType", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "amount", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "CardanoTxRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "tx_index", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_hash", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_body", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CardanoTxAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "transaction", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CardanoSignedTx", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_hash", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_body", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "Success", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "message", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "Failure", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "FailureType", + "name": "code", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "message", + "id": 2 + } + ], + "enums": [ + { + "name": "FailureType", + "values": [ + { + "name": "Failure_UnexpectedMessage", + "id": 1 + }, + { + "name": "Failure_ButtonExpected", + "id": 2 + }, + { + "name": "Failure_DataError", + "id": 3 + }, + { + "name": "Failure_ActionCancelled", + "id": 4 + }, + { + "name": "Failure_PinExpected", + "id": 5 + }, + { + "name": "Failure_PinCancelled", + "id": 6 + }, + { + "name": "Failure_PinInvalid", + "id": 7 + }, + { + "name": "Failure_InvalidSignature", + "id": 8 + }, + { + "name": "Failure_ProcessError", + "id": 9 + }, + { + "name": "Failure_NotEnoughFunds", + "id": 10 + }, + { + "name": "Failure_NotInitialized", + "id": 11 + }, + { + "name": "Failure_PinMismatch", + "id": 12 + }, + { + "name": "Failure_WipeCodeMismatch", + "id": 13 + }, + { + "name": "Failure_FirmwareError", + "id": 99 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "ButtonRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "ButtonRequestType", + "name": "code", + "id": 1 + } + ], + "enums": [ + { + "name": "ButtonRequestType", + "values": [ + { + "name": "ButtonRequest_Other", + "id": 1 + }, + { + "name": "ButtonRequest_FeeOverThreshold", + "id": 2 + }, + { + "name": "ButtonRequest_ConfirmOutput", + "id": 3 + }, + { + "name": "ButtonRequest_ResetDevice", + "id": 4 + }, + { + "name": "ButtonRequest_ConfirmWord", + "id": 5 + }, + { + "name": "ButtonRequest_WipeDevice", + "id": 6 + }, + { + "name": "ButtonRequest_ProtectCall", + "id": 7 + }, + { + "name": "ButtonRequest_SignTx", + "id": 8 + }, + { + "name": "ButtonRequest_FirmwareCheck", + "id": 9 + }, + { + "name": "ButtonRequest_Address", + "id": 10 + }, + { + "name": "ButtonRequest_PublicKey", + "id": 11 + }, + { + "name": "ButtonRequest_MnemonicWordCount", + "id": 12 + }, + { + "name": "ButtonRequest_MnemonicInput", + "id": 13 + }, + { + "name": "ButtonRequest_PassphraseType", + "id": 14 + }, + { + "name": "ButtonRequest_UnknownDerivationPath", + "id": 15 + }, + { + "name": "ButtonRequest_RecoveryHomepage", + "id": 16 + }, + { + "name": "ButtonRequest_Success", + "id": 17 + }, + { + "name": "ButtonRequest_Warning", + "id": 18 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "ButtonAck", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "PinMatrixRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "PinMatrixRequestType", + "name": "type", + "id": 1 + } + ], + "enums": [ + { + "name": "PinMatrixRequestType", + "values": [ + { + "name": "PinMatrixRequestType_Current", + "id": 1 + }, + { + "name": "PinMatrixRequestType_NewFirst", + "id": 2 + }, + { + "name": "PinMatrixRequestType_NewSecond", + "id": 3 + }, + { + "name": "PinMatrixRequestType_WipeCodeFirst", + "id": 4 + }, + { + "name": "PinMatrixRequestType_WipeCodeSecond", + "id": 5 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "PinMatrixAck", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "string", + "name": "pin", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "PassphraseRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "on_device", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "PassphraseAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "passphrase", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "state", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "PassphraseStateRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "state", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "PassphraseStateAck", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "HDNodeType", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "depth", + "id": 1 + }, + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "fingerprint", + "id": 2 + }, + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "child_num", + "id": 3 + }, + { + "rule": "required", + "options": {}, + "type": "bytes", + "name": "chain_code", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "private_key", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 6 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CipherKeyValue", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "key", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "value", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "encrypt", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "ask_on_encrypt", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "ask_on_decrypt", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "iv", + "id": 7 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CipheredKeyValue", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "value", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "IdentityType", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "proto", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "user", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "host", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "port", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "path", + "id": 5 + }, + { + "rule": "optional", + "options": { + "default": 0 + }, + "type": "uint32", + "name": "index", + "id": 6 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "SignIdentity", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "IdentityType", + "name": "identity", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "challenge_hidden", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "challenge_visual", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "ecdsa_curve_name", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "SignedIdentity", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "GetECDHSessionKey", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "IdentityType", + "name": "identity", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "peer_public_key", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "ecdsa_curve_name", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "ECDHSessionKey", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "session_key", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CosiCommit", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "data", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CosiCommitment", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "commitment", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "pubkey", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CosiSign", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "data", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "global_commitment", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "global_pubkey", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "CosiSignature", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugLinkDecision", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "yes_no", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "DebugSwipeDirection", + "name": "swipe", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "input", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "x", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "y", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "wait", + "id": 6 + } + ], + "enums": [ + { + "name": "DebugSwipeDirection", + "values": [ + { + "name": "UP", + "id": 0 + }, + { + "name": "DOWN", + "id": 1 + }, + { + "name": "LEFT", + "id": 2 + }, + { + "name": "RIGHT", + "id": 3 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugLinkLayout", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "string", + "name": "lines", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugLinkGetState", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "wait_word_list", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "wait_word_pos", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "wait_layout", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugLinkState", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "layout", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "pin", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "matrix", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "mnemonic_secret", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "HDNodeType", + "name": "node", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "passphrase_protection", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "reset_word", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "reset_entropy", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "recovery_fake_word", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "recovery_word_pos", + "id": 10 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "reset_word_pos", + "id": 11 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "mnemonic_type", + "id": 12 + }, + { + "rule": "repeated", + "options": {}, + "type": "string", + "name": "layout_lines", + "id": 13 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugLinkStop", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugLinkLog", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "level", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "bucket", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "text", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugLinkMemoryRead", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "address", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "length", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugLinkMemory", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "memory", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugLinkMemoryWrite", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "address", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "memory", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "flash", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugLinkFlashErase", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "sector", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosGetPublicKey", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosPublicKey", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "wif_public_key", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "raw_public_key", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosSignTx", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "chain_id", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "EosTxHeader", + "name": "header", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "num_actions", + "id": 4 + } + ], + "enums": [], + "messages": [ + { + "name": "EosTxHeader", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "expiration", + "id": 1 + }, + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "ref_block_num", + "id": 2 + }, + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "ref_block_prefix", + "id": 3 + }, + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "max_net_usage_words", + "id": 4 + }, + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "max_cpu_usage_ms", + "id": 5 + }, + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "delay_sec", + "id": 6 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "EosTxActionRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "data_size", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosTxActionAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "EosActionCommon", + "name": "common", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionTransfer", + "name": "transfer", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionDelegate", + "name": "delegate", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionUndelegate", + "name": "undelegate", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionRefund", + "name": "refund", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionBuyRam", + "name": "buy_ram", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionBuyRamBytes", + "name": "buy_ram_bytes", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionSellRam", + "name": "sell_ram", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionVoteProducer", + "name": "vote_producer", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionUpdateAuth", + "name": "update_auth", + "id": 10 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionDeleteAuth", + "name": "delete_auth", + "id": 11 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionLinkAuth", + "name": "link_auth", + "id": 12 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionUnlinkAuth", + "name": "unlink_auth", + "id": 13 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionNewAccount", + "name": "new_account", + "id": 14 + }, + { + "rule": "optional", + "options": {}, + "type": "EosActionUnknown", + "name": "unknown", + "id": 15 + } + ], + "enums": [], + "messages": [ + { + "name": "EosAsset", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "amount", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "symbol", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosPermissionLevel", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "actor", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "permission", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosAuthorizationKey", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "type", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "key", + "id": 2 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "weight", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosAuthorizationAccount", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "EosPermissionLevel", + "name": "account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "weight", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosAuthorizationWait", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "wait_sec", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "weight", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosAuthorization", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "threshold", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "EosAuthorizationKey", + "name": "keys", + "id": 2 + }, + { + "rule": "repeated", + "options": {}, + "type": "EosAuthorizationAccount", + "name": "accounts", + "id": 3 + }, + { + "rule": "repeated", + "options": {}, + "type": "EosAuthorizationWait", + "name": "waits", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionCommon", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "name", + "id": 2 + }, + { + "rule": "repeated", + "options": {}, + "type": "EosPermissionLevel", + "name": "authorization", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionTransfer", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "sender", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "receiver", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "EosAsset", + "name": "quantity", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "memo", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionDelegate", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "sender", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "receiver", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "EosAsset", + "name": "net_quantity", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "EosAsset", + "name": "cpu_quantity", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "transfer", + "id": 5 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionUndelegate", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "sender", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "receiver", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "EosAsset", + "name": "net_quantity", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "EosAsset", + "name": "cpu_quantity", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionRefund", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "owner", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionBuyRam", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "payer", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "receiver", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "EosAsset", + "name": "quantity", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionBuyRamBytes", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "payer", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "receiver", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "bytes", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionSellRam", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "bytes", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionVoteProducer", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "voter", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "proxy", + "id": 2 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint64", + "name": "producers", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionUpdateAuth", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "permission", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "parent", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "EosAuthorization", + "name": "auth", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionDeleteAuth", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "permission", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionLinkAuth", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "code", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "type", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "requirement", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionUnlinkAuth", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "code", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "type", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionNewAccount", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "creator", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "name", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "EosAuthorization", + "name": "owner", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "EosAuthorization", + "name": "active", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EosActionUnknown", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "data_size", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "data_chunk", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "EosSignedTx", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "signature", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EthereumGetPublicKey", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EthereumPublicKey", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "HDNodeType", + "name": "node", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "xpub", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EthereumGetAddress", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EthereumAddress", + "fields": [ + { + "rule": "optional", + "options": { + "deprecated": true + }, + "type": "bytes", + "name": "old_address", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EthereumSignTx", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "nonce", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "gas_price", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "gas_limit", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "to", + "id": 11 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "value", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "data_initial_chunk", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "data_length", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "chain_id", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "tx_type", + "id": 10 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EthereumTxRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "data_length", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "signature_v", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature_r", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature_s", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EthereumTxAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "data_chunk", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EthereumSignMessage", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "message", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EthereumMessageSignature", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EthereumVerifyMessage", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "message", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "LiskGetAddress", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "LiskAddress", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "LiskGetPublicKey", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "LiskPublicKey", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "LiskSignTx", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "LiskTransactionCommon", + "name": "transaction", + "id": 2 + } + ], + "enums": [], + "messages": [ + { + "name": "LiskTransactionCommon", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "LiskTransactionType", + "name": "type", + "id": 1 + }, + { + "rule": "optional", + "options": { + "default": 0 + }, + "type": "uint64", + "name": "amount", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "fee", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "recipient_id", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "sender_public_key", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "requester_public_key", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "timestamp", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "LiskTransactionAsset", + "name": "asset", + "id": 9 + } + ], + "enums": [ + { + "name": "LiskTransactionType", + "values": [ + { + "name": "Transfer", + "id": 0 + }, + { + "name": "RegisterSecondPassphrase", + "id": 1 + }, + { + "name": "RegisterDelegate", + "id": 2 + }, + { + "name": "CastVotes", + "id": 3 + }, + { + "name": "RegisterMultisignatureAccount", + "id": 4 + }, + { + "name": "CreateDapp", + "id": 5 + }, + { + "name": "TransferIntoDapp", + "id": 6 + }, + { + "name": "TransferOutOfDapp", + "id": 7 + } + ], + "options": {} + } + ], + "messages": [ + { + "name": "LiskTransactionAsset", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "LiskSignatureType", + "name": "signature", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "LiskDelegateType", + "name": "delegate", + "id": 2 + }, + { + "rule": "repeated", + "options": {}, + "type": "string", + "name": "votes", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "LiskMultisignatureType", + "name": "multisignature", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "data", + "id": 5 + } + ], + "enums": [], + "messages": [ + { + "name": "LiskSignatureType", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "LiskDelegateType", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "username", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "LiskMultisignatureType", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "min", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "life_time", + "id": 2 + }, + { + "rule": "repeated", + "options": {}, + "type": "string", + "name": "keys_group", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "LiskSignedTx", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "LiskSignMessage", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "message", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "LiskMessageSignature", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "LiskVerifyMessage", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "message", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "Initialize", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "state", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "skip_passphrase", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "GetFeatures", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "Features", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "vendor", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "major_version", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "minor_version", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "patch_version", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "bootloader_mode", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "device_id", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "pin_protection", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "passphrase_protection", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "language", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "label", + "id": 10 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "initialized", + "id": 12 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "revision", + "id": 13 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "bootloader_hash", + "id": 14 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "imported", + "id": 15 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "pin_cached", + "id": 16 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "passphrase_cached", + "id": 17 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "firmware_present", + "id": 18 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "needs_backup", + "id": 19 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "flags", + "id": 20 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "model", + "id": 21 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "fw_major", + "id": 22 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "fw_minor", + "id": 23 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "fw_patch", + "id": 24 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "fw_vendor", + "id": 25 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "fw_vendor_keys", + "id": 26 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "unfinished_backup", + "id": 27 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "no_backup", + "id": 28 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "recovery_mode", + "id": 29 + }, + { + "rule": "repeated", + "options": {}, + "type": "Capability", + "name": "capabilities", + "id": 30 + }, + { + "rule": "optional", + "options": {}, + "type": "BackupType", + "name": "backup_type", + "id": 31 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "sd_card_present", + "id": 32 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "sd_protection", + "id": 33 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "wipe_code_protection", + "id": 34 + } + ], + "enums": [ + { + "name": "Capability", + "values": [ + { + "name": "Capability_Bitcoin", + "id": 1 + }, + { + "name": "Capability_Bitcoin_like", + "id": 2 + }, + { + "name": "Capability_Binance", + "id": 3 + }, + { + "name": "Capability_Cardano", + "id": 4 + }, + { + "name": "Capability_Crypto", + "id": 5 + }, + { + "name": "Capability_EOS", + "id": 6 + }, + { + "name": "Capability_Ethereum", + "id": 7 + }, + { + "name": "Capability_Lisk", + "id": 8 + }, + { + "name": "Capability_Monero", + "id": 9 + }, + { + "name": "Capability_NEM", + "id": 10 + }, + { + "name": "Capability_Ripple", + "id": 11 + }, + { + "name": "Capability_Stellar", + "id": 12 + }, + { + "name": "Capability_Tezos", + "id": 13 + }, + { + "name": "Capability_U2F", + "id": 14 + }, + { + "name": "Capability_Shamir", + "id": 15 + }, + { + "name": "Capability_ShamirGroups", + "id": 16 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "ClearSession", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "ApplySettings", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "language", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "label", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "use_passphrase", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "homescreen", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "PassphraseSourceType", + "name": "passphrase_source", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "auto_lock_delay_ms", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "display_rotation", + "id": 7 + } + ], + "enums": [ + { + "name": "PassphraseSourceType", + "values": [ + { + "name": "ASK", + "id": 0 + }, + { + "name": "DEVICE", + "id": 1 + }, + { + "name": "HOST", + "id": 2 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "ApplyFlags", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "flags", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "ChangePin", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "remove", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "ChangeWipeCode", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "remove", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "SdProtect", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "SdProtectOperationType", + "name": "operation", + "id": 1 + } + ], + "enums": [ + { + "name": "SdProtectOperationType", + "values": [ + { + "name": "DISABLE", + "id": 0 + }, + { + "name": "ENABLE", + "id": 1 + }, + { + "name": "REFRESH", + "id": 2 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "Ping", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "message", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "button_protection", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "pin_protection", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "passphrase_protection", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "Cancel", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "GetEntropy", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "uint32", + "name": "size", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "Entropy", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "bytes", + "name": "entropy", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "WipeDevice", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "LoadDevice", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "string", + "name": "mnemonics", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "pin", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "passphrase_protection", + "id": 4 + }, + { + "rule": "optional", + "options": { + "default": "english" + }, + "type": "string", + "name": "language", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "label", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "skip_checksum", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "u2f_counter", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "needs_backup", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "no_backup", + "id": 10 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "ResetDevice", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "display_random", + "id": 1 + }, + { + "rule": "optional", + "options": { + "default": 256 + }, + "type": "uint32", + "name": "strength", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "passphrase_protection", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "pin_protection", + "id": 4 + }, + { + "rule": "optional", + "options": { + "default": "english" + }, + "type": "string", + "name": "language", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "label", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "u2f_counter", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "skip_backup", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "no_backup", + "id": 9 + }, + { + "rule": "optional", + "options": { + "default": "Bip39" + }, + "type": "BackupType", + "name": "backup_type", + "id": 10 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "BackupDevice", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EntropyRequest", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "EntropyAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "entropy", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "RecoveryDevice", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "word_count", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "passphrase_protection", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "pin_protection", + "id": 3 + }, + { + "rule": "optional", + "options": { + "default": "english" + }, + "type": "string", + "name": "language", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "label", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "enforce_wordlist", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "RecoveryDeviceType", + "name": "type", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "u2f_counter", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "dry_run", + "id": 10 + } + ], + "enums": [ + { + "name": "RecoveryDeviceType", + "values": [ + { + "name": "RecoveryDeviceType_ScrambledWords", + "id": 0 + }, + { + "name": "RecoveryDeviceType_Matrix", + "id": 1 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "WordRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "WordRequestType", + "name": "type", + "id": 1 + } + ], + "enums": [ + { + "name": "WordRequestType", + "values": [ + { + "name": "WordRequestType_Plain", + "id": 0 + }, + { + "name": "WordRequestType_Matrix9", + "id": 1 + }, + { + "name": "WordRequestType_Matrix6", + "id": 2 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "WordAck", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "string", + "name": "word", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "SetU2FCounter", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "u2f_counter", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "GetNextU2FCounter", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "NextU2FCounter", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "u2f_counter", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionSourceEntry", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "MoneroOutputEntry", + "name": "outputs", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "real_output", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "real_out_tx_key", + "id": 3 + }, + { + "rule": "repeated", + "options": {}, + "type": "bytes", + "name": "real_out_additional_tx_keys", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "real_output_in_tx_index", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "amount", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "rct", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "mask", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "MoneroMultisigKLRki", + "name": "multisig_kLRki", + "id": 9 + } + ], + "enums": [], + "messages": [ + { + "name": "MoneroOutputEntry", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "idx", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "MoneroRctKeyPublic", + "name": "key", + "id": 2 + } + ], + "enums": [], + "messages": [ + { + "name": "MoneroRctKeyPublic", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "dest", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "commitment", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroMultisigKLRki", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "K", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "L", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "R", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "ki", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionDestinationEntry", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "amount", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "MoneroAccountPublicAddress", + "name": "addr", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "is_subaddress", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "original", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "is_integrated", + "id": 5 + } + ], + "enums": [], + "messages": [ + { + "name": "MoneroAccountPublicAddress", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "spend_public_key", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "view_public_key", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionRsigData", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "rsig_type", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "offload_type", + "id": 2 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint64", + "name": "grouping", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "mask", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "rsig", + "id": 5 + }, + { + "rule": "repeated", + "options": {}, + "type": "bytes", + "name": "rsig_parts", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "bp_version", + "id": 7 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroGetAddress", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "network_type", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "account", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "minor", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "payment_id", + "id": 6 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroAddress", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "address", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroGetWatchKey", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "network_type", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroWatchKey", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "watch_key", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "address", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionInitRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "version", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "network_type", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "MoneroTransactionData", + "name": "tsx_data", + "id": 4 + } + ], + "enums": [], + "messages": [ + { + "name": "MoneroTransactionData", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "version", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "payment_id", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "unlock_time", + "id": 3 + }, + { + "rule": "repeated", + "options": {}, + "type": "MoneroTransactionDestinationEntry", + "name": "outputs", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "MoneroTransactionDestinationEntry", + "name": "change_dts", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "num_inputs", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "mixin", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "fee", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "account", + "id": 9 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "minor_indices", + "id": 10 + }, + { + "rule": "optional", + "options": {}, + "type": "MoneroTransactionRsigData", + "name": "rsig_data", + "id": 11 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "integrated_indices", + "id": 12 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "client_version", + "id": 13 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "hard_fork", + "id": 14 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "monero_version", + "id": 15 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionInitAck", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "bytes", + "name": "hmacs", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "MoneroTransactionRsigData", + "name": "rsig_data", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionSetInputRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "MoneroTransactionSourceEntry", + "name": "src_entr", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionSetInputAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "vini", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "vini_hmac", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "pseudo_out", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "pseudo_out_hmac", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "pseudo_out_alpha", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "spend_key", + "id": 6 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionInputsPermutationRequest", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "perm", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionInputsPermutationAck", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionInputViniRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "MoneroTransactionSourceEntry", + "name": "src_entr", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "vini", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "vini_hmac", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "pseudo_out", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "pseudo_out_hmac", + "id": 5 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionInputViniAck", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionAllInputsSetRequest", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionAllInputsSetAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "MoneroTransactionRsigData", + "name": "rsig_data", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionSetOutputRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "MoneroTransactionDestinationEntry", + "name": "dst_entr", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "dst_entr_hmac", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "MoneroTransactionRsigData", + "name": "rsig_data", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "is_offloaded_bp", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionSetOutputAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_out", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "vouti_hmac", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "MoneroTransactionRsigData", + "name": "rsig_data", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "out_pk", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "ecdh_info", + "id": 5 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionAllOutSetRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "MoneroTransactionRsigData", + "name": "rsig_data", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionAllOutSetAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "extra", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_prefix_hash", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "MoneroRingCtSig", + "name": "rv", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "full_message_hash", + "id": 5 + } + ], + "enums": [], + "messages": [ + { + "name": "MoneroRingCtSig", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "txn_fee", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "message", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "rv_type", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionSignInputRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "MoneroTransactionSourceEntry", + "name": "src_entr", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "vini", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "vini_hmac", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "pseudo_out", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "pseudo_out_hmac", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "pseudo_out_alpha", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "spend_key", + "id": 7 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionSignInputAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "pseudo_out", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionFinalRequest", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroTransactionFinalAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "cout_key", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "salt", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "rand_mult", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_enc_keys", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroKeyImageExportInitRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "num", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "hash", + "id": 2 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "network_type", + "id": 4 + }, + { + "rule": "repeated", + "options": {}, + "type": "MoneroSubAddressIndicesList", + "name": "subs", + "id": 5 + } + ], + "enums": [], + "messages": [ + { + "name": "MoneroSubAddressIndicesList", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "account", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "minor_indices", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroKeyImageExportInitAck", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroKeyImageSyncStepRequest", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "MoneroTransferDetails", + "name": "tdis", + "id": 1 + } + ], + "enums": [], + "messages": [ + { + "name": "MoneroTransferDetails", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "out_key", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_pub_key", + "id": 2 + }, + { + "rule": "repeated", + "options": {}, + "type": "bytes", + "name": "additional_tx_pub_keys", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "internal_output_index", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroKeyImageSyncStepAck", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "MoneroExportedKeyImage", + "name": "kis", + "id": 1 + } + ], + "enums": [], + "messages": [ + { + "name": "MoneroExportedKeyImage", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "iv", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "blob", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroKeyImageSyncFinalRequest", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroKeyImageSyncFinalAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "enc_key", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroGetTxKeyRequest", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "network_type", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "salt1", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "salt2", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_enc_keys", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_prefix_hash", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "reason", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "view_public_key", + "id": 8 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroGetTxKeyAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "salt", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_keys", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "tx_derivations", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroLiveRefreshStartRequest", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "network_type", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroLiveRefreshStartAck", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroLiveRefreshStepRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "out_key", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "recv_deriv", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "real_out_idx", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "sub_addr_major", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "sub_addr_minor", + "id": 5 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroLiveRefreshStepAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "salt", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "key_image", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroLiveRefreshFinalRequest", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "MoneroLiveRefreshFinalAck", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugMoneroDiagRequest", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "ins", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "p1", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "p2", + "id": 3 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint64", + "name": "pd", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "data1", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "data2", + "id": 6 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugMoneroDiagAck", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "ins", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "p1", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "p2", + "id": 3 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint64", + "name": "pd", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "data1", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "data2", + "id": 6 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "NEMGetAddress", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "network", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "NEMAddress", + "fields": [ + { + "rule": "required", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "NEMSignTx", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "NEMTransactionCommon", + "name": "transaction", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "NEMTransactionCommon", + "name": "multisig", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "NEMTransfer", + "name": "transfer", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "cosigning", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "NEMProvisionNamespace", + "name": "provision_namespace", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "NEMMosaicCreation", + "name": "mosaic_creation", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "NEMMosaicSupplyChange", + "name": "supply_change", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "NEMAggregateModification", + "name": "aggregate_modification", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "NEMImportanceTransfer", + "name": "importance_transfer", + "id": 9 + } + ], + "enums": [], + "messages": [ + { + "name": "NEMTransactionCommon", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "network", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "timestamp", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "fee", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "deadline", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signer", + "id": 6 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "NEMTransfer", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "recipient", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "amount", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "payload", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 4 + }, + { + "rule": "repeated", + "options": {}, + "type": "NEMMosaic", + "name": "mosaics", + "id": 5 + } + ], + "enums": [], + "messages": [ + { + "name": "NEMMosaic", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "namespace", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "mosaic", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "quantity", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "NEMProvisionNamespace", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "namespace", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "parent", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "sink", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "fee", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "NEMMosaicCreation", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "NEMMosaicDefinition", + "name": "definition", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "sink", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "fee", + "id": 3 + } + ], + "enums": [], + "messages": [ + { + "name": "NEMMosaicDefinition", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "name", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "ticker", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "namespace", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "mosaic", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "divisibility", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "NEMMosaicLevy", + "name": "levy", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "fee", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "levy_address", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "levy_namespace", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "levy_mosaic", + "id": 10 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "supply", + "id": 11 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "mutable_supply", + "id": 12 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "transferable", + "id": 13 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "description", + "id": 14 + }, + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "networks", + "id": 15 + } + ], + "enums": [ + { + "name": "NEMMosaicLevy", + "values": [ + { + "name": "MosaicLevy_Absolute", + "id": 1 + }, + { + "name": "MosaicLevy_Percentile", + "id": 2 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "NEMMosaicSupplyChange", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "namespace", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "mosaic", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "NEMSupplyChangeType", + "name": "type", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "delta", + "id": 4 + } + ], + "enums": [ + { + "name": "NEMSupplyChangeType", + "values": [ + { + "name": "SupplyChange_Increase", + "id": 1 + }, + { + "name": "SupplyChange_Decrease", + "id": 2 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "NEMAggregateModification", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "NEMCosignatoryModification", + "name": "modifications", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "sint32", + "name": "relative_change", + "id": 2 + } + ], + "enums": [], + "messages": [ + { + "name": "NEMCosignatoryModification", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "NEMModificationType", + "name": "type", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 2 + } + ], + "enums": [ + { + "name": "NEMModificationType", + "values": [ + { + "name": "CosignatoryModification_Add", + "id": 1 + }, + { + "name": "CosignatoryModification_Delete", + "id": 2 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "NEMImportanceTransfer", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "NEMImportanceTransferMode", + "name": "mode", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 2 + } + ], + "enums": [ + { + "name": "NEMImportanceTransferMode", + "values": [ + { + "name": "ImportanceTransfer_Activate", + "id": 1 + }, + { + "name": "ImportanceTransfer_Deactivate", + "id": 2 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "NEMSignedTx", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "data", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "NEMDecryptMessage", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "network", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "payload", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "NEMDecryptedMessage", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "payload", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "RippleGetAddress", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "RippleAddress", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "RippleSignTx", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "fee", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "flags", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "sequence", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "last_ledger_sequence", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "RipplePayment", + "name": "payment", + "id": 6 + } + ], + "enums": [], + "messages": [ + { + "name": "RipplePayment", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "amount", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "destination", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "destination_tag", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "RippleSignedTx", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "serialized_tx", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarAssetType", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "type", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "code", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "issuer", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarGetAddress", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarAddress", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarSignTx", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "network_passphrase", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "source_account", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "fee", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "sequence_number", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "timebounds_start", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "timebounds_end", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "memo_type", + "id": 10 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "memo_text", + "id": 11 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "memo_id", + "id": 12 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "memo_hash", + "id": 13 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "num_operations", + "id": 14 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarTxOpRequest", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarPaymentOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "source_account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "destination_account", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "StellarAssetType", + "name": "asset", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "amount", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarCreateAccountOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "source_account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "new_account", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "starting_balance", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarPathPaymentOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "source_account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "StellarAssetType", + "name": "send_asset", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "send_max", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "destination_account", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "StellarAssetType", + "name": "destination_asset", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "destination_amount", + "id": 6 + }, + { + "rule": "repeated", + "options": {}, + "type": "StellarAssetType", + "name": "paths", + "id": 7 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarManageOfferOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "source_account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "StellarAssetType", + "name": "selling_asset", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "StellarAssetType", + "name": "buying_asset", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "amount", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "price_n", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "price_d", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "offer_id", + "id": 7 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarCreatePassiveOfferOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "source_account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "StellarAssetType", + "name": "selling_asset", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "StellarAssetType", + "name": "buying_asset", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "sint64", + "name": "amount", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "price_n", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "price_d", + "id": 6 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarSetOptionsOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "source_account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "inflation_destination_account", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "clear_flags", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "set_flags", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "master_weight", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "low_threshold", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "medium_threshold", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "high_threshold", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "home_domain", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "signer_type", + "id": 10 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signer_key", + "id": 11 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "signer_weight", + "id": 12 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarChangeTrustOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "source_account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "StellarAssetType", + "name": "asset", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "limit", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarAllowTrustOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "source_account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "trusted_account", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "asset_type", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "asset_code", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "is_authorized", + "id": 5 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarAccountMergeOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "source_account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "destination_account", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarManageDataOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "source_account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "key", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "value", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarBumpSequenceOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "source_account", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "bump_to", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "StellarSignedTx", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "signature", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TezosGetAddress", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TezosAddress", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "address", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TezosGetPublicKey", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "show_display", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TezosPublicKey", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "public_key", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TezosSignTx", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "uint32", + "name": "address_n", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "branch", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "TezosRevealOp", + "name": "reveal", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "TezosTransactionOp", + "name": "transaction", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "TezosOriginationOp", + "name": "origination", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "TezosDelegationOp", + "name": "delegation", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "TezosProposalOp", + "name": "proposal", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "TezosBallotOp", + "name": "ballot", + "id": 8 + } + ], + "enums": [], + "messages": [ + { + "name": "TezosContractID", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "TezosContractType", + "name": "tag", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "hash", + "id": 2 + } + ], + "enums": [ + { + "name": "TezosContractType", + "values": [ + { + "name": "Implicit", + "id": 0 + }, + { + "name": "Originated", + "id": 1 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TezosRevealOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "source", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "fee", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "counter", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "gas_limit", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "storage_limit", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "public_key", + "id": 6 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TezosTransactionOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "source", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "fee", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "counter", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "gas_limit", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "storage_limit", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "amount", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "TezosContractID", + "name": "destination", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "parameters", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "TezosParametersManager", + "name": "parameters_manager", + "id": 10 + } + ], + "enums": [], + "messages": [ + { + "name": "TezosParametersManager", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "set_delegate", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "cancel_delegate", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "TezosManagerTransfer", + "name": "transfer", + "id": 3 + } + ], + "enums": [], + "messages": [ + { + "name": "TezosManagerTransfer", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "TezosContractID", + "name": "destination", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "amount", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "TezosOriginationOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "source", + "id": 12 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "fee", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "counter", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "gas_limit", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "storage_limit", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "manager_pubkey", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "balance", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "spendable", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "delegatable", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "delegate", + "id": 10 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "script", + "id": 11 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TezosDelegationOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "source", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "fee", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "counter", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "gas_limit", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "storage_limit", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "delegate", + "id": 6 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TezosProposalOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "source", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "period", + "id": 2 + }, + { + "rule": "repeated", + "options": {}, + "type": "bytes", + "name": "proposals", + "id": 4 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "TezosBallotOp", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "source", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "uint64", + "name": "period", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "proposal", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "TezosBallotType", + "name": "ballot", + "id": 4 + } + ], + "enums": [ + { + "name": "TezosBallotType", + "values": [ + { + "name": "Yay", + "id": 0 + }, + { + "name": "Nay", + "id": 1 + }, + { + "name": "Pass", + "id": 2 + } + ], + "options": {} + } + ], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "name": "TezosSignedTx", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "signature", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "sig_op_contents", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "operation_hash", + "id": 3 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "WebAuthnListResidentCredentials", + "fields": [], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "WebAuthnAddResidentCredential", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "credential_id", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "WebAuthnRemoveResidentCredential", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "index", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "WebAuthnCredentials", + "fields": [ + { + "rule": "repeated", + "options": {}, + "type": "WebAuthnCredential", + "name": "credentials", + "id": 1 + } + ], + "enums": [], + "messages": [ + { + "name": "WebAuthnCredential", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "index", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "id", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "rp_id", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "rp_name", + "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "user_id", + "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "user_name", + "id": 6 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "user_display_name", + "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "creation_time", + "id": 8 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "hmac_secret", + "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "use_sign_count", + "id": 10 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, + { + "ref": "google.protobuf.EnumValueOptions", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "wire_in", + "id": 50002 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "wire_out", + "id": 50003 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "wire_debug_in", + "id": 50004 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "wire_debug_out", + "id": 50005 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "wire_tiny", + "id": 50006 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "wire_bootloader", + "id": 50007 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "wire_no_fsm", + "id": 50008 + } + ] + } + ], + "enums": [ + { + "name": "InputScriptType", + "values": [ + { + "name": "SPENDADDRESS", + "id": 0 + }, + { + "name": "SPENDMULTISIG", + "id": 1 + }, + { + "name": "EXTERNAL", + "id": 2 + }, + { + "name": "SPENDWITNESS", + "id": 3 + }, + { + "name": "SPENDP2SHWITNESS", + "id": 4 + } + ], + "options": {} + }, + { + "name": "BackupType", + "values": [ + { + "name": "Bip39", + "id": 0 + }, + { + "name": "Slip39_Basic", + "id": 1 + }, + { + "name": "Slip39_Advanced", + "id": 2 + } + ], + "options": {} + }, + { + "name": "MessageType", + "values": [ + { + "name": "MessageType_Initialize", + "id": 0 + }, + { + "name": "MessageType_Ping", + "id": 1 + }, + { + "name": "MessageType_Success", + "id": 2 + }, + { + "name": "MessageType_Failure", + "id": 3 + }, + { + "name": "MessageType_ChangePin", + "id": 4 + }, + { + "name": "MessageType_WipeDevice", + "id": 5 + }, + { + "name": "MessageType_GetEntropy", + "id": 9 + }, + { + "name": "MessageType_Entropy", + "id": 10 + }, + { + "name": "MessageType_LoadDevice", + "id": 13 + }, + { + "name": "MessageType_ResetDevice", + "id": 14 + }, + { + "name": "MessageType_Features", + "id": 17 + }, + { + "name": "MessageType_PinMatrixRequest", + "id": 18 + }, + { + "name": "MessageType_PinMatrixAck", + "id": 19 + }, + { + "name": "MessageType_Cancel", + "id": 20 + }, + { + "name": "MessageType_ClearSession", + "id": 24 + }, + { + "name": "MessageType_ApplySettings", + "id": 25 + }, + { + "name": "MessageType_ButtonRequest", + "id": 26 + }, + { + "name": "MessageType_ButtonAck", + "id": 27 + }, + { + "name": "MessageType_ApplyFlags", + "id": 28 + }, + { + "name": "MessageType_BackupDevice", + "id": 34 + }, + { + "name": "MessageType_EntropyRequest", + "id": 35 + }, + { + "name": "MessageType_EntropyAck", + "id": 36 + }, + { + "name": "MessageType_PassphraseRequest", + "id": 41 + }, + { + "name": "MessageType_PassphraseAck", + "id": 42 + }, + { + "name": "MessageType_PassphraseStateRequest", + "id": 77 + }, + { + "name": "MessageType_PassphraseStateAck", + "id": 78 + }, + { + "name": "MessageType_RecoveryDevice", + "id": 45 + }, + { + "name": "MessageType_WordRequest", + "id": 46 + }, + { + "name": "MessageType_WordAck", + "id": 47 + }, + { + "name": "MessageType_GetFeatures", + "id": 55 + }, + { + "name": "MessageType_SetU2FCounter", + "id": 63 + }, + { + "name": "MessageType_SdProtect", + "id": 79 + }, + { + "name": "MessageType_GetNextU2FCounter", + "id": 80 + }, + { + "name": "MessageType_NextU2FCounter", + "id": 81 + }, + { + "name": "MessageType_ChangeWipeCode", + "id": 82 + }, + { + "name": "MessageType_FirmwareErase", + "id": 6 + }, + { + "name": "MessageType_FirmwareUpload", + "id": 7 + }, + { + "name": "MessageType_FirmwareRequest", + "id": 8 + }, + { + "name": "MessageType_SelfTest", + "id": 32 + }, + { + "name": "MessageType_GetPublicKey", + "id": 11 + }, + { + "name": "MessageType_PublicKey", + "id": 12 + }, + { + "name": "MessageType_SignTx", + "id": 15 + }, + { + "name": "MessageType_TxRequest", + "id": 21 + }, + { + "name": "MessageType_TxAck", + "id": 22 + }, + { + "name": "MessageType_GetAddress", + "id": 29 + }, + { + "name": "MessageType_Address", + "id": 30 + }, + { + "name": "MessageType_SignMessage", + "id": 38 + }, + { + "name": "MessageType_VerifyMessage", + "id": 39 + }, + { + "name": "MessageType_MessageSignature", + "id": 40 + }, + { + "name": "MessageType_CipherKeyValue", + "id": 23 + }, + { + "name": "MessageType_CipheredKeyValue", + "id": 48 + }, + { + "name": "MessageType_SignIdentity", + "id": 53 + }, + { + "name": "MessageType_SignedIdentity", + "id": 54 + }, + { + "name": "MessageType_GetECDHSessionKey", + "id": 61 + }, + { + "name": "MessageType_ECDHSessionKey", + "id": 62 + }, + { + "name": "MessageType_CosiCommit", + "id": 71 + }, + { + "name": "MessageType_CosiCommitment", + "id": 72 + }, + { + "name": "MessageType_CosiSign", + "id": 73 + }, + { + "name": "MessageType_CosiSignature", + "id": 74 + }, + { + "name": "MessageType_DebugLinkDecision", + "id": 100 + }, + { + "name": "MessageType_DebugLinkGetState", + "id": 101 + }, + { + "name": "MessageType_DebugLinkState", + "id": 102 + }, + { + "name": "MessageType_DebugLinkStop", + "id": 103 + }, + { + "name": "MessageType_DebugLinkLog", + "id": 104 + }, + { + "name": "MessageType_DebugLinkMemoryRead", + "id": 110 + }, + { + "name": "MessageType_DebugLinkMemory", + "id": 111 + }, + { + "name": "MessageType_DebugLinkMemoryWrite", + "id": 112 + }, + { + "name": "MessageType_DebugLinkFlashErase", + "id": 113 + }, + { + "name": "MessageType_DebugLinkLayout", + "id": 9001 + }, + { + "name": "MessageType_EthereumGetPublicKey", + "id": 450 + }, + { + "name": "MessageType_EthereumPublicKey", + "id": 451 + }, + { + "name": "MessageType_EthereumGetAddress", + "id": 56 + }, + { + "name": "MessageType_EthereumAddress", + "id": 57 + }, + { + "name": "MessageType_EthereumSignTx", + "id": 58 + }, + { + "name": "MessageType_EthereumTxRequest", + "id": 59 + }, + { + "name": "MessageType_EthereumTxAck", + "id": 60 + }, + { + "name": "MessageType_EthereumSignMessage", + "id": 64 + }, + { + "name": "MessageType_EthereumVerifyMessage", + "id": 65 + }, + { + "name": "MessageType_EthereumMessageSignature", + "id": 66 + }, + { + "name": "MessageType_NEMGetAddress", + "id": 67 + }, + { + "name": "MessageType_NEMAddress", + "id": 68 + }, + { + "name": "MessageType_NEMSignTx", + "id": 69 + }, + { + "name": "MessageType_NEMSignedTx", + "id": 70 + }, + { + "name": "MessageType_NEMDecryptMessage", + "id": 75 + }, + { + "name": "MessageType_NEMDecryptedMessage", + "id": 76 + }, + { + "name": "MessageType_LiskGetAddress", + "id": 114 + }, + { + "name": "MessageType_LiskAddress", + "id": 115 + }, + { + "name": "MessageType_LiskSignTx", + "id": 116 + }, + { + "name": "MessageType_LiskSignedTx", + "id": 117 + }, + { + "name": "MessageType_LiskSignMessage", + "id": 118 + }, + { + "name": "MessageType_LiskMessageSignature", + "id": 119 + }, + { + "name": "MessageType_LiskVerifyMessage", + "id": 120 + }, + { + "name": "MessageType_LiskGetPublicKey", + "id": 121 + }, + { + "name": "MessageType_LiskPublicKey", + "id": 122 + }, + { + "name": "MessageType_TezosGetAddress", + "id": 150 + }, + { + "name": "MessageType_TezosAddress", + "id": 151 + }, + { + "name": "MessageType_TezosSignTx", + "id": 152 + }, + { + "name": "MessageType_TezosSignedTx", + "id": 153 + }, + { + "name": "MessageType_TezosGetPublicKey", + "id": 154 + }, + { + "name": "MessageType_TezosPublicKey", + "id": 155 + }, + { + "name": "MessageType_StellarSignTx", + "id": 202 + }, + { + "name": "MessageType_StellarTxOpRequest", + "id": 203 + }, + { + "name": "MessageType_StellarGetAddress", + "id": 207 + }, + { + "name": "MessageType_StellarAddress", + "id": 208 + }, + { + "name": "MessageType_StellarCreateAccountOp", + "id": 210 + }, + { + "name": "MessageType_StellarPaymentOp", + "id": 211 + }, + { + "name": "MessageType_StellarPathPaymentOp", + "id": 212 + }, + { + "name": "MessageType_StellarManageOfferOp", + "id": 213 + }, + { + "name": "MessageType_StellarCreatePassiveOfferOp", + "id": 214 + }, + { + "name": "MessageType_StellarSetOptionsOp", + "id": 215 + }, + { + "name": "MessageType_StellarChangeTrustOp", + "id": 216 + }, + { + "name": "MessageType_StellarAllowTrustOp", + "id": 217 + }, + { + "name": "MessageType_StellarAccountMergeOp", + "id": 218 + }, + { + "name": "MessageType_StellarManageDataOp", + "id": 220 + }, + { + "name": "MessageType_StellarBumpSequenceOp", + "id": 221 + }, + { + "name": "MessageType_StellarSignedTx", + "id": 230 + }, + { + "name": "MessageType_CardanoSignTx", + "id": 303 + }, + { + "name": "MessageType_CardanoTxRequest", + "id": 304 + }, + { + "name": "MessageType_CardanoGetPublicKey", + "id": 305 + }, + { + "name": "MessageType_CardanoPublicKey", + "id": 306 + }, + { + "name": "MessageType_CardanoGetAddress", + "id": 307 + }, + { + "name": "MessageType_CardanoAddress", + "id": 308 + }, + { + "name": "MessageType_CardanoTxAck", + "id": 309 + }, + { + "name": "MessageType_CardanoSignedTx", + "id": 310 + }, + { + "name": "MessageType_RippleGetAddress", + "id": 400 + }, + { + "name": "MessageType_RippleAddress", + "id": 401 + }, + { + "name": "MessageType_RippleSignTx", + "id": 402 + }, + { + "name": "MessageType_RippleSignedTx", + "id": 403 + }, + { + "name": "MessageType_MoneroTransactionInitRequest", + "id": 501 + }, + { + "name": "MessageType_MoneroTransactionInitAck", + "id": 502 + }, + { + "name": "MessageType_MoneroTransactionSetInputRequest", + "id": 503 + }, + { + "name": "MessageType_MoneroTransactionSetInputAck", + "id": 504 + }, + { + "name": "MessageType_MoneroTransactionInputsPermutationRequest", + "id": 505 + }, + { + "name": "MessageType_MoneroTransactionInputsPermutationAck", + "id": 506 + }, + { + "name": "MessageType_MoneroTransactionInputViniRequest", + "id": 507 + }, + { + "name": "MessageType_MoneroTransactionInputViniAck", + "id": 508 + }, + { + "name": "MessageType_MoneroTransactionAllInputsSetRequest", + "id": 509 + }, + { + "name": "MessageType_MoneroTransactionAllInputsSetAck", + "id": 510 + }, + { + "name": "MessageType_MoneroTransactionSetOutputRequest", + "id": 511 + }, + { + "name": "MessageType_MoneroTransactionSetOutputAck", + "id": 512 + }, + { + "name": "MessageType_MoneroTransactionAllOutSetRequest", + "id": 513 + }, + { + "name": "MessageType_MoneroTransactionAllOutSetAck", + "id": 514 + }, + { + "name": "MessageType_MoneroTransactionSignInputRequest", + "id": 515 + }, + { + "name": "MessageType_MoneroTransactionSignInputAck", + "id": 516 + }, + { + "name": "MessageType_MoneroTransactionFinalRequest", + "id": 517 + }, + { + "name": "MessageType_MoneroTransactionFinalAck", + "id": 518 + }, + { + "name": "MessageType_MoneroKeyImageExportInitRequest", + "id": 530 + }, + { + "name": "MessageType_MoneroKeyImageExportInitAck", + "id": 531 + }, + { + "name": "MessageType_MoneroKeyImageSyncStepRequest", + "id": 532 + }, + { + "name": "MessageType_MoneroKeyImageSyncStepAck", + "id": 533 + }, + { + "name": "MessageType_MoneroKeyImageSyncFinalRequest", + "id": 534 + }, + { + "name": "MessageType_MoneroKeyImageSyncFinalAck", + "id": 535 + }, + { + "name": "MessageType_MoneroGetAddress", + "id": 540 + }, + { + "name": "MessageType_MoneroAddress", + "id": 541 + }, + { + "name": "MessageType_MoneroGetWatchKey", + "id": 542 + }, + { + "name": "MessageType_MoneroWatchKey", + "id": 543 + }, + { + "name": "MessageType_DebugMoneroDiagRequest", + "id": 546 + }, + { + "name": "MessageType_DebugMoneroDiagAck", + "id": 547 + }, + { + "name": "MessageType_MoneroGetTxKeyRequest", + "id": 550 + }, + { + "name": "MessageType_MoneroGetTxKeyAck", + "id": 551 + }, + { + "name": "MessageType_MoneroLiveRefreshStartRequest", + "id": 552 + }, + { + "name": "MessageType_MoneroLiveRefreshStartAck", + "id": 553 + }, + { + "name": "MessageType_MoneroLiveRefreshStepRequest", + "id": 554 + }, + { + "name": "MessageType_MoneroLiveRefreshStepAck", + "id": 555 + }, + { + "name": "MessageType_MoneroLiveRefreshFinalRequest", + "id": 556 + }, + { + "name": "MessageType_MoneroLiveRefreshFinalAck", + "id": 557 + }, + { + "name": "MessageType_EosGetPublicKey", + "id": 600 + }, + { + "name": "MessageType_EosPublicKey", + "id": 601 + }, + { + "name": "MessageType_EosSignTx", + "id": 602 + }, + { + "name": "MessageType_EosTxActionRequest", + "id": 603 + }, + { + "name": "MessageType_EosTxActionAck", + "id": 604 + }, + { + "name": "MessageType_EosSignedTx", + "id": 605 + }, + { + "name": "MessageType_BinanceGetAddress", + "id": 700 + }, + { + "name": "MessageType_BinanceAddress", + "id": 701 + }, + { + "name": "MessageType_BinanceGetPublicKey", + "id": 702 + }, + { + "name": "MessageType_BinancePublicKey", + "id": 703 + }, + { + "name": "MessageType_BinanceSignTx", + "id": 704 + }, + { + "name": "MessageType_BinanceTxRequest", + "id": 705 + }, + { + "name": "MessageType_BinanceTransferMsg", + "id": 706 + }, + { + "name": "MessageType_BinanceOrderMsg", + "id": 707 + }, + { + "name": "MessageType_BinanceCancelMsg", + "id": 708 + }, + { + "name": "MessageType_BinanceSignedTx", + "id": 709 + }, + { + "name": "MessageType_WebAuthnListResidentCredentials", + "id": 800 + }, + { + "name": "MessageType_WebAuthnCredentials", + "id": 801 + }, + { + "name": "MessageType_WebAuthnAddResidentCredential", + "id": 802 + }, + { + "name": "MessageType_WebAuthnRemoveResidentCredential", + "id": 803 + } + ], + "options": {} + } + ], + "imports": [], + "options": {}, + "services": [] +} diff --git a/src/data/messages/messages.json b/src/data/messages/messages.json index 08deb2575..fcc4f5212 100644 --- a/src/data/messages/messages.json +++ b/src/data/messages/messages.json @@ -1773,10 +1773,6 @@ "name": "ButtonRequest_MnemonicInput", "id": 13 }, - { - "name": "ButtonRequest_PassphraseType", - "id": 14 - }, { "name": "ButtonRequest_UnknownDerivationPath", "id": 15 @@ -1792,6 +1788,10 @@ { "name": "ButtonRequest_Warning", "id": 18 + }, + { + "name": "ButtonRequest_PassphraseEntry", + "id": 19 } ], "options": {} @@ -1873,9 +1873,11 @@ "fields": [ { "rule": "optional", - "options": {}, + "options": { + "deprecated": true + }, "type": "bool", - "name": "on_device", + "name": "_on_device", "id": 1 } ], @@ -1896,10 +1898,19 @@ }, { "rule": "optional", - "options": {}, + "options": { + "deprecated": true + }, "type": "bytes", - "name": "state", + "name": "_state", "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "on_device", + "id": 3 } ], "enums": [], @@ -1908,7 +1919,7 @@ "oneofs": {} }, { - "name": "PassphraseStateRequest", + "name": "Deprecated_PassphraseStateRequest", "fields": [ { "rule": "optional", @@ -1920,15 +1931,19 @@ ], "enums": [], "messages": [], - "options": {}, + "options": { + "deprecated": true + }, "oneofs": {} }, { - "name": "PassphraseStateAck", + "name": "Deprecated_PassphraseStateAck", "fields": [], "enums": [], "messages": [], - "options": {}, + "options": { + "deprecated": true + }, "oneofs": {} }, { @@ -2411,6 +2426,38 @@ "options": {}, "oneofs": {} }, + { + "name": "DebugLinkReseedRandom", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "value", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, + { + "name": "DebugLinkRecordScreen", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "target_directory", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, { "name": "DebugLinkGetState", "fields": [ @@ -4300,15 +4347,8 @@ "rule": "optional", "options": {}, "type": "bytes", - "name": "state", + "name": "session_id", "id": 1 - }, - { - "rule": "optional", - "options": {}, - "type": "bool", - "name": "skip_passphrase", - "id": 2 } ], "enums": [], @@ -4432,13 +4472,6 @@ "name": "pin_cached", "id": 16 }, - { - "rule": "optional", - "options": {}, - "type": "bool", - "name": "passphrase_cached", - "id": 17 - }, { "rule": "optional", "options": {}, @@ -4557,6 +4590,20 @@ "type": "bool", "name": "wipe_code_protection", "id": 34 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "session_id", + "id": 35 + }, + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "passphrase_always_on_device", + "id": 36 } ], "enums": [ @@ -4626,6 +4673,10 @@ { "name": "Capability_ShamirGroups", "id": 16 + }, + { + "name": "Capability_PassphraseEntry", + "id": 17 } ], "options": {} @@ -4674,13 +4725,6 @@ "name": "homescreen", "id": 4 }, - { - "rule": "optional", - "options": {}, - "type": "PassphraseSourceType", - "name": "passphrase_source", - "id": 5 - }, { "rule": "optional", "options": {}, @@ -4694,28 +4738,16 @@ "type": "uint32", "name": "display_rotation", "id": 7 - } - ], - "enums": [ + }, { - "name": "PassphraseSourceType", - "values": [ - { - "name": "ASK", - "id": 0 - }, - { - "name": "DEVICE", - "id": 1 - }, - { - "name": "HOST", - "id": 2 - } - ], - "options": {} + "rule": "optional", + "options": {}, + "type": "bool", + "name": "passphrase_always_on_device", + "id": 8 } ], + "enums": [], "messages": [], "options": {}, "oneofs": {} @@ -4819,20 +4851,6 @@ "type": "bool", "name": "button_protection", "id": 2 - }, - { - "rule": "optional", - "options": {}, - "type": "bool", - "name": "pin_protection", - "id": 3 - }, - { - "rule": "optional", - "options": {}, - "type": "bool", - "name": "passphrase_protection", - "id": 4 } ], "enums": [], @@ -4915,7 +4933,7 @@ { "rule": "optional", "options": { - "default": "english" + "default": "en-US" }, "type": "string", "name": "language", @@ -4998,7 +5016,7 @@ { "rule": "optional", "options": { - "default": "english" + "default": "en-US" }, "type": "string", "name": "language", @@ -5106,7 +5124,7 @@ { "rule": "optional", "options": { - "default": "english" + "default": "en-US" }, "type": "string", "name": "language", @@ -5324,6 +5342,13 @@ "type": "MoneroMultisigKLRki", "name": "multisig_kLRki", "id": 9 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "subaddr_minor", + "id": 10 } ], "enums": [], @@ -5958,6 +5983,13 @@ "type": "bytes", "name": "pseudo_out_hmac", "id": 5 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "orig_idx", + "id": 6 } ], "enums": [], @@ -6213,6 +6245,13 @@ "type": "bytes", "name": "spend_key", "id": 7 + }, + { + "rule": "optional", + "options": {}, + "type": "uint32", + "name": "orig_idx", + "id": 8 } ], "enums": [], @@ -6281,6 +6320,13 @@ "type": "bytes", "name": "tx_enc_keys", "id": 4 + }, + { + "rule": "optional", + "options": {}, + "type": "bytes", + "name": "opening_key", + "id": 5 } ], "enums": [], @@ -9225,14 +9271,6 @@ "name": "MessageType_PassphraseAck", "id": 42 }, - { - "name": "MessageType_PassphraseStateRequest", - "id": 77 - }, - { - "name": "MessageType_PassphraseStateAck", - "id": 78 - }, { "name": "MessageType_RecoveryDevice", "id": 45 @@ -9269,6 +9307,14 @@ "name": "MessageType_ChangeWipeCode", "id": 82 }, + { + "name": "MessageType_Deprecated_PassphraseStateRequest", + "id": 77 + }, + { + "name": "MessageType_Deprecated_PassphraseStateAck", + "id": 78 + }, { "name": "MessageType_FirmwareErase", "id": 6 @@ -9405,6 +9451,14 @@ "name": "MessageType_DebugLinkLayout", "id": 9001 }, + { + "name": "MessageType_DebugLinkReseedRandom", + "id": 9002 + }, + { + "name": "MessageType_DebugLinkRecordScreen", + "id": 9003 + }, { "name": "MessageType_EthereumGetPublicKey", "id": 450 diff --git a/src/html/popup.html b/src/html/popup.html index 1038962dd..07b51913e 100644 --- a/src/html/popup.html +++ b/src/html/popup.html @@ -232,6 +232,7 @@

Enter passphrase

+

Passphrases do not match!

@@ -323,8 +324,8 @@

Passphrase doesn't match

- - + +
diff --git a/src/js/core/Core.js b/src/js/core/Core.js index 506bae1f1..1cbab2df4 100644 --- a/src/js/core/Core.js +++ b/src/js/core/Core.js @@ -179,11 +179,11 @@ const initDevice = async (method: AbstractMethod): Promise => { const isWebUsb = _deviceList.transportType() === 'WebUsbPlugin'; - let device: ?Device; + let device; if (method.devicePath) { device = _deviceList.getDevice(method.devicePath); } else { - let devicesCount: number = _deviceList.length(); + let devicesCount = _deviceList.length(); let selectedDevicePath: string; if (devicesCount === 1 && !isWebUsb) { // there is only one device available. use it @@ -243,7 +243,7 @@ const initDevice = async (method: AbstractMethod): Promise => { * @returns {Promise} * @memberof Core */ -export const onCall = async (message: CoreMessage): Promise => { +export const onCall = async (message: CoreMessage) => { if (!message.id || !message.payload) { throw ERROR.INVALID_PARAMETERS; } @@ -372,7 +372,7 @@ export const onCall = async (message: CoreMessage): Promise => { device.setInstance(method.deviceInstance); if (method.hasExpectedDeviceState) { - device.setExpectedState(method.deviceState); + device.setExternalState(method.deviceState); } // device is available @@ -389,6 +389,11 @@ export const onCall = async (message: CoreMessage): Promise => { }); /* eslint-enable no-use-before-define */ + // try to reconfigure messages before Initialize + if (_deviceList) { + await _deviceList.reconfigure(device.getVersion()); + } + try { let PIN_TRIES: number = 1; const MAX_PIN_TRIES: number = 3; @@ -477,16 +482,14 @@ export const onCall = async (message: CoreMessage): Promise => { } if (_deviceList) { - // restore default messages - const messages = DataManager.findMessages(device.isT1() ? 0 : 1, device.getVersion()); - await _deviceList.reconfigure(messages); + // reconfigure protobuf messages + await _deviceList.reconfigure(device.getVersion()); } // Make sure that device will display pin/passphrase try { - const deviceState: string = method.useDeviceState ? await device.getCommands().getDeviceState() : 'null'; - const validState: boolean = !method.useDeviceState || method.useEmptyPassphrase || device.validateExpectedState(deviceState); - if (!validState) { + const invalidDeviceState = method.useDeviceState ? await device.validateState() : undefined; + if (invalidDeviceState) { if (isUsingPopup) { // initialize user response promise const uiPromise = createUiPromise(UI.INVALID_PASSPHRASE_ACTION, device); @@ -496,12 +499,13 @@ export const onCall = async (message: CoreMessage): Promise => { const uiResp: UiPromiseResponse = await uiPromise.promise; const resp: boolean = uiResp.payload; if (resp) { - // initialize to reset device state - await device.getCommands().initialize(method.useEmptyPassphrase); + // reset internal device state and try again + device.setInternalState(undefined); + await device.initialize(method.useEmptyPassphrase); return inner(); } else { // set new state as requested - device.setState(deviceState); + device.setExternalState(invalidDeviceState); } } else { throw ERROR.INVALID_STATE; @@ -519,8 +523,7 @@ export const onCall = async (message: CoreMessage): Promise => { // eslint-disable-next-line no-use-before-define // closePopup(); // clear cached passphrase. it's not valid - device.clearPassphrase(); - device.setState(null); + device.setInternalState(undefined); // interrupt process and go to "final" block return Promise.reject(error.message); } @@ -671,13 +674,7 @@ const onDeviceWordHandler = async (device: Device, type: string, callback: (erro * @returns {Promise} * @memberof Core */ -const onDevicePassphraseHandler = async (device: Device, callback: (error: any, success: any) => void): Promise => { - const cachedPassphrase: ?string = device.getPassphrase(); - if (typeof cachedPassphrase === 'string') { - callback(null, cachedPassphrase); - return; - } - +const onDevicePassphraseHandler = async (device: Device, callback: (response: any) => void) => { // wait for popup handshake await getPopupPromise().promise; // request passphrase view @@ -685,10 +682,15 @@ const onDevicePassphraseHandler = async (device: Device, callback: (error: any, // wait for passphrase const uiResp: UiPromiseResponse = await createUiPromise(UI.RECEIVE_PASSPHRASE, device).promise; - const value: string = uiResp.payload.value; + const passphrase: string = uiResp.payload.value; + const passphraseOnDevice: boolean = uiResp.payload.passphraseOnDevice; const cache: boolean = uiResp.payload.save; - device.setPassphrase(cache ? value : null); - callback(null, value); + // send as PassphrasePromptResponse + callback({ + passphrase: passphrase.normalize('NFKD'), + passphraseOnDevice, + cache, + }); }; /** @@ -698,8 +700,9 @@ const onDevicePassphraseHandler = async (device: Device, callback: (error: any, * @returns {Promise} * @memberof Core */ -const onEmptyPassphraseHandler = async (device: Device, callback: (error: any, success: any) => void): Promise => { - callback(null, ''); +const onEmptyPassphraseHandler = async (device: Device, callback: (response: any) => void) => { + // send as PassphrasePromptResponse + callback({ passphrase: '' }); }; /** diff --git a/src/js/core/methods/AbstractMethod.js b/src/js/core/methods/AbstractMethod.js index cde6e2383..8dac30e9f 100644 --- a/src/js/core/methods/AbstractMethod.js +++ b/src/js/core/methods/AbstractMethod.js @@ -1,13 +1,13 @@ /* @flow */ import { crypto } from '@trezor/utxo-lib'; -import semvercmp from 'semver-compare'; import Device from '../../device/Device'; import DataManager from '../../data/DataManager'; import * as UI from '../../constants/ui'; import * as DEVICE from '../../constants/device'; import * as ERROR from '../../constants/errors'; import { load as loadStorage, save as saveStorage, PERMISSIONS_KEY } from '../../storage'; +import { versionCompare } from '../../utils/deviceFeaturesUtils'; import { UiMessage, DeviceMessage } from '../../message/builder'; import type { Deferred, CoreMessage, UiPromiseResponse, FirmwareRange } from '../../types'; @@ -183,7 +183,8 @@ export default class AbstractMethod implements MethodInterface { } const device = this.device; if (!device.features) return null; - const model = device.features.major_version; + const version = device.getVersion(); + const model = version[0]; const range = this.firmwareRange[model]; if (device.firmwareStatus === 'none') { @@ -193,11 +194,11 @@ export default class AbstractMethod implements MethodInterface { return UI.FIRMWARE_NOT_SUPPORTED; } - if (device.firmwareStatus === 'required' || semvercmp(device.getVersion(), range.min) < 0) { + if (device.firmwareStatus === 'required' || versionCompare(version, range.min) < 0) { return UI.FIRMWARE_OLD; } - if (range.max !== '0' && semvercmp(device.getVersion(), range.max) > 0) { + if (range.max !== '0' && versionCompare(version, range.max) > 0) { if (isUsingPopup) { // wait for popup handshake await this.getPopupPromise().promise; diff --git a/src/js/core/methods/GetDeviceState.js b/src/js/core/methods/GetDeviceState.js index c2db72e2f..90b02b6ab 100644 --- a/src/js/core/methods/GetDeviceState.js +++ b/src/js/core/methods/GetDeviceState.js @@ -10,17 +10,8 @@ export default class GetDeviceState extends AbstractMethod { } async run(): Promise { - if (this.device.getState()) { - return { - state: this.device.getState(), - }; - } - - const response: string = await this.device.getCommands().getDeviceState(); - const state: string = this.device.getState() || response; - return { - state, + state: this.device.getExternalState(), }; } } diff --git a/src/js/core/methods/helpers/paramsValidator.js b/src/js/core/methods/helpers/paramsValidator.js index abea8c308..47651b8fb 100644 --- a/src/js/core/methods/helpers/paramsValidator.js +++ b/src/js/core/methods/helpers/paramsValidator.js @@ -1,9 +1,9 @@ /* @flow */ import BigNumber from 'bignumber.js'; -import semvercmp from 'semver-compare'; import { invalidParameter } from '../../../constants/errors'; import { fromHardened } from '../../../utils/pathUtils'; +import { versionCompare } from '../../../utils/deviceFeaturesUtils'; import DataManager from '../../../data/DataManager'; import type { CoinInfo, FirmwareRange } from '../../../types'; @@ -67,13 +67,13 @@ export const getFirmwareRange = (method: string, coinInfo: ?CoinInfo, currentRan if (coinInfo) { if (!coinInfo.support || typeof coinInfo.support.trezor1 !== 'string') { current['1'].min = '0'; - } else if (semvercmp(coinInfo.support.trezor1, current['1'].min) > 0) { + } else if (versionCompare(coinInfo.support.trezor1, current['1'].min) > 0) { current['1'].min = coinInfo.support.trezor1; } if (!coinInfo.support || typeof coinInfo.support.trezor2 !== 'string') { current['2'].min = '0'; - } else if (semvercmp(coinInfo.support.trezor2, current['2'].min) > 0) { + } else if (versionCompare(coinInfo.support.trezor2, current['2'].min) > 0) { current['2'].min = coinInfo.support.trezor2; } } @@ -98,18 +98,18 @@ export const getFirmwareRange = (method: string, coinInfo: ?CoinInfo, currentRan const { min, max } = range; // override defaults if (min) { - if (current['1'].min === '0' || semvercmp(current['1'].min, min[0]) < 0) { + if (current['1'].min === '0' || versionCompare(current['1'].min, min[0]) < 0) { current['1'].min = min[0]; } - if (current['2'].min === '0' || semvercmp(current['2'].min, min[1]) < 0) { + if (current['2'].min === '0' || versionCompare(current['2'].min, min[1]) < 0) { current['2'].min = min[1]; } } if (max) { - if (current['1'].max === '0' || semvercmp(current['1'].max, max[0]) < 0) { + if (current['1'].max === '0' || versionCompare(current['1'].max, max[0]) < 0) { current['1'].max = max[0]; } - if (current['2'].max === '0' || semvercmp(current['2'].max, max[1]) < 0) { + if (current['2'].max === '0' || versionCompare(current['2'].max, max[1]) < 0) { current['2'].max = max[1]; } } diff --git a/src/js/data/CoinInfo.js b/src/js/data/CoinInfo.js index 655112814..24810777b 100644 --- a/src/js/data/CoinInfo.js +++ b/src/js/data/CoinInfo.js @@ -3,9 +3,9 @@ import { toHardened, fromHardened } from '../utils/pathUtils'; import type { CoinInfo, BitcoinNetworkInfo, EthereumNetworkInfo, MiscNetworkInfo } from '../types'; -const bitcoinNetworks: Array = []; -const ethereumNetworks: Array = []; -const miscNetworks: Array = []; +const bitcoinNetworks: BitcoinNetworkInfo[] = []; +const ethereumNetworks: EthereumNetworkInfo[] = []; +const miscNetworks: MiscNetworkInfo[] = []; export function cloneCoinInfo(info: T): T { const jsonString = JSON.stringify(info); @@ -17,35 +17,35 @@ export function cloneCoinInfo(info: T): T { return JSON.parse(jsonString); } -export const getBitcoinNetwork = (pathOrName: Array | string): ?BitcoinNetworkInfo => { - const networks: Array = cloneCoinInfo(bitcoinNetworks); +export const getBitcoinNetwork = (pathOrName: number[] | string): ?BitcoinNetworkInfo => { + const networks: BitcoinNetworkInfo[] = cloneCoinInfo(bitcoinNetworks); if (typeof pathOrName === 'string') { - const name: string = pathOrName.toLowerCase(); + const name = pathOrName.toLowerCase(); return networks.find(n => n.name.toLowerCase() === name || n.shortcut.toLowerCase() === name || n.label.toLowerCase() === name); } else { - const slip44: number = fromHardened(pathOrName[1]); + const slip44 = fromHardened(pathOrName[1]); return networks.find(n => n.slip44 === slip44); } }; -export const getEthereumNetwork = (pathOrName: Array | string): ?EthereumNetworkInfo => { - const networks: Array = cloneCoinInfo(ethereumNetworks); +export const getEthereumNetwork = (pathOrName: number[] | string): ?EthereumNetworkInfo => { + const networks: EthereumNetworkInfo[] = cloneCoinInfo(ethereumNetworks); if (typeof pathOrName === 'string') { - const name: string = pathOrName.toLowerCase(); + const name = pathOrName.toLowerCase(); return networks.find(n => n.name.toLowerCase() === name || n.shortcut.toLowerCase() === name); } else { - const slip44: number = fromHardened(pathOrName[1]); + const slip44 = fromHardened(pathOrName[1]); return networks.find(n => n.slip44 === slip44); } }; -export const getMiscNetwork = (pathOrName: Array | string): ?MiscNetworkInfo => { - const networks: Array = cloneCoinInfo(miscNetworks); +export const getMiscNetwork = (pathOrName: number[] | string): ?MiscNetworkInfo => { + const networks: MiscNetworkInfo[] = cloneCoinInfo(miscNetworks); if (typeof pathOrName === 'string') { - const name: string = pathOrName.toLowerCase(); + const name = pathOrName.toLowerCase(); return networks.find(n => n.name.toLowerCase() === name || n.shortcut.toLowerCase() === name); } else { - const slip44: number = fromHardened(pathOrName[1]); + const slip44 = fromHardened(pathOrName[1]); return networks.find(n => n.slip44 === slip44); } }; @@ -99,7 +99,7 @@ export const fixCoinInfoNetwork = (ci: BitcoinNetworkInfo, path: Array): return coinInfo; }; -const detectBtcVersion = (data): string => { +const detectBtcVersion = (data) => { if (data.subversion == null) { return 'btc'; } @@ -113,14 +113,14 @@ const detectBtcVersion = (data): string => { }; export const getCoinInfoByHash = (hash: string, networkInfo: any): BitcoinNetworkInfo => { - const networks: Array = cloneCoinInfo(bitcoinNetworks); + const networks: BitcoinNetworkInfo[] = cloneCoinInfo(bitcoinNetworks); const result: ?BitcoinNetworkInfo = networks.find(info => hash.toLowerCase() === info.hashGenesisBlock.toLowerCase()); if (!result) { throw new Error('Coin info not found for hash: ' + hash + ' ' + networkInfo.hashGenesisBlock); } if (result.isBitcoin) { - const btcVersion: string = detectBtcVersion(networkInfo); + const btcVersion = detectBtcVersion(networkInfo); let fork: ?BitcoinNetworkInfo; if (btcVersion === 'bch') { fork = networks.find(info => info.name === 'Bcash'); @@ -147,7 +147,7 @@ export const getCoinInfo = (currency: string): ?CoinInfo => { return coinInfo; }; -export const getCoinName = (path: Array): string => { +export const getCoinName = (path: Array) => { const slip44: number = fromHardened(path[1]); for (const network of ethereumNetworks) { if (network.slip44 === slip44) { @@ -157,7 +157,7 @@ export const getCoinName = (path: Array): string => { return 'Unknown coin'; }; -const parseBitcoinNetworksJson = (json: JSON): void => { +const parseBitcoinNetworksJson = (json: JSON) => { const coinsObject: Object = json; Object.keys(coinsObject).forEach(key => { const coin = coinsObject[key]; @@ -279,7 +279,7 @@ const parseEthereumNetworksJson = (json: JSON): void => { }); }; -const parseMiscNetworksJSON = (json: JSON): void => { +const parseMiscNetworksJSON = (json: JSON, type?: 'misc' | 'nem') => { const networksObject: Object = json; Object.keys(networksObject).forEach(key => { const network = networksObject[key]; @@ -291,7 +291,7 @@ const parseMiscNetworksJSON = (json: JSON): void => { maxFee = 10000; } miscNetworks.push({ - type: 'misc', + type: type || 'misc', blockchainLink: network.blockchain_link, blocktime: 0, curve: network.curve, @@ -309,7 +309,7 @@ const parseMiscNetworksJSON = (json: JSON): void => { }); }; -export const parseCoinsJson = (json: JSON): void => { +export const parseCoinsJson = (json: JSON) => { const coinsObject: Object = json; Object.keys(coinsObject).forEach(key => { switch (key) { @@ -318,8 +318,9 @@ export const parseCoinsJson = (json: JSON): void => { case 'eth' : return parseEthereumNetworksJson(coinsObject[key]); case 'misc' : - case 'nem' : return parseMiscNetworksJSON(coinsObject[key]); + case 'nem' : + return parseMiscNetworksJSON(coinsObject[key], 'nem'); } }); }; @@ -330,3 +331,28 @@ export const getUniqueNetworks = (networks: Array): CoinInfo[] => { return result.concat(info); }, []); }; + +export const getAllNetworks = (): CoinInfo[] => [].concat(bitcoinNetworks).concat(ethereumNetworks).concat(miscNetworks); + +export const getCoinInfoByCapability = (capabilities: string[]): CoinInfo[] => { + const networks: Array = capabilities.reduce((result: Array, c: string) => { + if (c === 'Capability_Bitcoin') { + return result.concat(getCoinInfo('Bitcoin')).concat(getCoinInfo('Testnet')); + } else if (c === 'Capability_Bitcoin_like') { + return result.concat(bitcoinNetworks); + } else if (c === 'Capability_Binance') { + return result.concat(getCoinInfo('BNB')); + } else if (c === 'Capability_Ethereum') { + return result.concat(ethereumNetworks); + } else if (c === 'Capability_Ripple') { + return result.concat(getCoinInfo('xrp')).concat(getCoinInfo('txrp')); + } else { + const [, networkName] = c.split('_'); + if (typeof networkName === 'string') { + return result.concat(getCoinInfo(networkName)); + } + } + return result; + }, []); + return getUniqueNetworks(networks); +}; diff --git a/src/js/data/DataManager.js b/src/js/data/DataManager.js index 11767c5cb..fb8a3b867 100644 --- a/src/js/data/DataManager.js +++ b/src/js/data/DataManager.js @@ -6,7 +6,7 @@ import { parseCoinsJson } from './CoinInfo'; import { parseFirmware } from './FirmwareInfo'; import { parseBridgeJSON } from './TransportInfo'; import parseUri from 'parse-uri'; -import semvercmp from 'semver-compare'; +import { versionCompare } from '../utils/deviceFeaturesUtils'; import type { ConnectSettings } from '../data/ConnectSettings'; @@ -132,19 +132,17 @@ export default class DataManager { parseFirmware(this.assets['firmware-t2']); } - static findMessages(model: number, fw: string): JSON { + static getProtobufMessages(version?: number[]): JSON { + if (!version) return this.messages['default']; + const model = version[0] - 1; const messages = this.config.messages.find(m => { const min = m.range.min[model]; - const max = m.range.max ? m.range.max[model] : fw; - return (semvercmp(fw, min) >= 0 && semvercmp(fw, max) <= 0); + const max = m.range.max ? m.range.max[model] : version; + return (versionCompare(version, min) >= 0 && versionCompare(version, max) <= 0); }); return this.messages[messages ? messages.name : 'default']; } - static getMessages(name?: string): JSON { - return this.messages[name || 'default']; - } - static isWhitelisted(origin: string): ?WhiteList { if (!this.config) return null; const uri = parseUri(origin); diff --git a/src/js/data/__tests__/CoinInfo.test.js b/src/js/data/__tests__/CoinInfo.test.js index 14cc89b3e..6956f713b 100644 --- a/src/js/data/__tests__/CoinInfo.test.js +++ b/src/js/data/__tests__/CoinInfo.test.js @@ -3,6 +3,7 @@ import { parseCoinsJson, getCoinInfo, getUniqueNetworks, + getCoinInfoByCapability, } from '../CoinInfo'; describe('data/CoinInfo', () => { @@ -25,4 +26,49 @@ describe('data/CoinInfo', () => { ]; expect(getUniqueNetworks(inputs)).toEqual(result); }); + + it('getCoinInfoByCapability', () => { + expect(getCoinInfoByCapability(['Capability_Bitcoin'])).toMatchObject([ + { name: 'Bitcoin' }, + { name: 'Testnet' }, + ]); + + expect( + getCoinInfoByCapability(['Capability_Bitcoin', 'Capability_Bitcoin_like']).length + ).toEqual(coinsJSON.bitcoin.length); + + expect( + getCoinInfoByCapability(['Capability_Ethereum']).length + ).toEqual(coinsJSON.eth.length); + + const other = [ + 'EOS', + 'Lisk', + 'NEM', + 'Stellar', + 'Tezos', + ]; + + other.forEach(c => { + expect(getCoinInfoByCapability([`Capability_${c}`])).toMatchObject([ + { name: c }, + ]); + }); + + expect(getCoinInfoByCapability(['Capability_Binance'])).toMatchObject([ + { name: 'Binance Chain', shortcut: 'BNB' }, + ]); + + expect(getCoinInfoByCapability(['Capability_Ripple'])).toMatchObject([ + { name: 'Ripple' }, + { name: 'Ripple Testnet' }, + ]); + + expect(getCoinInfoByCapability(['Capability_U2F'])).toEqual([]); + expect(getCoinInfoByCapability(['Capability_Monero'])).toEqual([]); + + const all = ['Capability_Bitcoin', 'Capability_Bitcoin_like', 'Capability_Binance', 'Capability_Ethereum', 'Capability_Ripple'].concat(other.map(c => `Capability_${c}`)); + + expect(getCoinInfoByCapability(all).length).toEqual(coinsJSON.bitcoin.length + coinsJSON.eth.length + coinsJSON.misc.length); + }); }); diff --git a/src/js/device/Device.js b/src/js/device/Device.js index 43603a645..e78d721ac 100644 --- a/src/js/device/Device.js +++ b/src/js/device/Device.js @@ -1,10 +1,9 @@ /* @flow */ import EventEmitter from 'events'; -import semvercmp from 'semver-compare'; import DeviceCommands from './DeviceCommands'; -import type { Device as DeviceTyped, DeviceFirmwareStatus, Features, Deferred, FirmwareRelease } from '../types'; +import type { Device as DeviceTyped, DeviceFirmwareStatus, Features, Deferred, FirmwareRelease, UnavailableCapability } from '../types'; import type { Transport, TrezorDeviceInfoWithSession as DeviceDescriptor } from 'trezor-link'; import * as UI from '../constants/ui'; @@ -12,7 +11,9 @@ import * as DEVICE from '../constants/device'; import * as ERROR from '../constants/errors'; import { create as createDeferred } from '../utils/deferred'; import DataManager from '../data/DataManager'; +import { getAllNetworks } from '../data/CoinInfo'; import { checkFirmware, getLatestRelease } from '../data/FirmwareInfo'; +import { versionCompare, parseCapabilities, getUnavailableCapabilities } from '../utils/deviceFeaturesUtils'; import Log, { init as initLog } from '../utils/debug'; // custom log @@ -43,28 +44,6 @@ const parseRunOptions = (options?: RunOptions): RunOptions => { return options; }; -const parseFeatures = (features: Features): Features => { - if (!features.features || features.features.length === 0) { - features.features = [ - 'Feature_Bitcoin', - 'Feature_Bitcoin_like', - 'Feature_Binance', - 'Feature_Cardano', - 'Feature_Crypto', - 'Feature_EOS', - 'Feature_Ethereum', - 'Feature_Lisk', - 'Feature_Monero', - 'Feature_NEM', - 'Feature_Ripple', - 'Feature_Stellar', - 'Feature_Tezos', - 'Feature_U2F', - ]; - } - return features; -}; - /** * * @@ -91,20 +70,14 @@ export default class Device extends EventEmitter { activitySessionID: ?string; - featuresTimestamp: number = 0; - commands: DeviceCommands; - // cachedPassphrase: ?string; - cachedPassphrase: Array = []; - keepSession: boolean = false; instance: number = 0; - - state: ?string; - expectedState: ?string; - temporaryState: ?string; + internalState: string[] = []; + externalState: string[] = []; + unavailableCapabilities: { [key: string]: UnavailableCapability } = {}; constructor(transport: Transport, descriptor: DeviceDescriptor) { super(); @@ -255,13 +228,18 @@ export default class Device extends EventEmitter { fn?: () => Promise, options: RunOptions ): Promise { - if (!this.isUsedHere() || this.commands.disposed) { + if (!this.isUsedHere() || this.commands.disposed || !this.getExternalState()) { // acquire session await this.acquire(); // update features try { - await this.initialize(!!options.useEmptyPassphrase); + if (fn) { + await this.initialize(!!options.useEmptyPassphrase); + } else { + // do not initialize while firstRunPromise otherwise `features.session_id` could be affected + await this.getFeatures(); + } } catch (error) { this.inconsistent = true; await this.deferredActions[ DEVICE.ACQUIRE ].promise; @@ -286,7 +264,7 @@ export default class Device extends EventEmitter { } // reload features - if (this.features && !options.skipFinalReload) { + if (this.loaded && this.features && !options.skipFinalReload) { await this.getFeatures(); } @@ -319,9 +297,9 @@ export default class Device extends EventEmitter { this.keepSession = false; } - // T1: forget cached passphrase - if (this.isT1()) { - this.clearPassphrase(); + // T1: forget passphrase cached in internal state + if (this.isT1() && !this.useLegacyPassphrase()) { + this.setInternalState(undefined); } } this.instance = instance; @@ -331,75 +309,89 @@ export default class Device extends EventEmitter { return this.instance; } - // set expected state from method parameter - setExpectedState(state: ?string): void { - if (!state) { - this.setState(null); // T2 reset state - this.setPassphrase(null); // T1 reset password - } - this.expectedState = state; - // T2: set "temporaryState" the same as "expectedState", it may change if device will request for passphrase [after PassphraseStateRequest message] - // this solves the issue with different instances but the same passphrases, - // where device state passed in "initialize" is correct from device point of view - // but "expectedState" and "temporaryState" are different strings - if (!this.isT1()) { - this.temporaryState = state; + setInternalState(state: ?string) { + if (typeof state !== 'string') { + delete this.internalState[this.instance]; + } else { + this.internalState[this.instance] = state; } } - getExpectedState(): ?string { - return this.expectedState; + getInternalState(): ?string { + return this.internalState[this.instance]; } - setPassphrase(pass: ?string): void { - if (this.isT1()) { - this.cachedPassphrase[ this.instance ] = pass; + setExternalState(state: ?string) { + if (typeof state !== 'string') { + delete this.internalState[this.instance]; + delete this.externalState[this.instance]; + } else { + this.externalState[this.instance] = state; } } - getPassphrase(): ?string { - return this.cachedPassphrase[ this.instance ]; - } - - clearPassphrase(): void { - this.cachedPassphrase[ this.instance ] = null; - this.keepSession = false; + getExternalState(): ?string { + return this.externalState[this.instance]; } - async initialize(useEmptyPassphrase: boolean): Promise { - const { message }: { message: Features } = await this.commands.initialize(useEmptyPassphrase); - this.features = parseFeatures(message); - this.featuresNeedsReload = false; - this.featuresTimestamp = new Date().getTime(); - - const currentFW = [ this.features.major_version, this.features.minor_version, this.features.patch_version ]; - this.firmwareStatus = checkFirmware(currentFW, this.features); - this.firmwareRelease = getLatestRelease(currentFW); + async validateState() { + if (!this.features) return; + const expectedState = this.getExternalState(); + const state = await this.commands.getDeviceState(); + const uniqueState = `${state}@${this.features.device_id}:${this.instance}`; + if (!this.useLegacyPassphrase() && this.features.session_id) { + this.setInternalState(this.features.session_id); + } + if (expectedState && expectedState !== uniqueState) { + return uniqueState; + } + if (!expectedState) { + this.setExternalState(uniqueState); + } } - async getFeatures(): Promise { - const { message }: { message: Features } = await this.commands.typedCall('GetFeatures', 'Features', {}); - this.features = parseFeatures(message); - this.firmwareStatus = checkFirmware( - [ this.features.major_version, this.features.minor_version, this.features.patch_version ], - this.features, - ); + useLegacyPassphrase() { + return !this.atLeast(['1.9.0', '2.3.0']); } - getState(): ?string { - return this.state ? this.state : null; - } + async initialize(useEmptyPassphrase: boolean) { + let payload; + if (this.features) { + const legacy = this.useLegacyPassphrase(); + const internalState = this.getInternalState(); + payload = {}; + if (!legacy && internalState) { + payload.session_id = internalState; + } + if (legacy && !this.isT1()) { + payload.state = internalState; + if (useEmptyPassphrase) { + payload.skip_passphrase = useEmptyPassphrase; + payload.state = null; + } + } + } - setState(state: ?string): void { - this.state = state; + const { message }: { message: Features } = await this.commands.typedCall('Initialize', 'Features', payload); + this._updateFeatures(message); } - setTemporaryState(state: ?string): void { - this.temporaryState = state; + async getFeatures() { + const { message }: { message: Features } = await this.commands.typedCall('GetFeatures', 'Features', {}); + this._updateFeatures(message); } - getTemporaryState(): ?string { - return this.temporaryState; + _updateFeatures(feat: Features) { + feat.capabilities = parseCapabilities(feat); + const version = [feat.major_version, feat.minor_version, feat.patch_version]; + // check if FW version did change + if (versionCompare(version, this.getVersion()) !== 0) { + this.unavailableCapabilities = getUnavailableCapabilities(feat, getAllNetworks(), DataManager.getConfig().supportedFirmware); + this.firmwareStatus = checkFirmware(version, feat); + this.firmwareRelease = getLatestRelease(version); + } + this.features = feat; + this.featuresNeedsReload = false; } isUnacquired(): boolean { @@ -494,17 +486,19 @@ export default class Device extends EventEmitter { return this.inconsistent; } - getVersion(): string { + getVersion(): number[] { + if (!this.features) return []; return [ this.features.major_version, this.features.minor_version, this.features.patch_version, - ].join('.'); + ]; } - atLeast(versions: Array): boolean { - const modelVersion = versions[ this.features.major_version - 1 ]; - return semvercmp(this.getVersion(), modelVersion) >= 0; + atLeast(versions: string[] | string) { + if (!this.features) return false; + const modelVersion = typeof versions === 'string' ? versions : versions[this.features.major_version - 1]; + return versionCompare(this.getVersion(), modelVersion) >= 0; } isUsed(): boolean { @@ -569,21 +563,6 @@ export default class Device extends EventEmitter { return null; } - validateExpectedState(state: string): boolean { - if (!this.isT1()) { - const currentState: ?string = this.getExpectedState() || this.getState(); - if (!currentState) { - this.setState(state); - return true; - } else if (currentState !== state) { - return false; - } - } else if (this.getExpectedState() && this.getExpectedState() !== state) { - return false; - } - return true; - } - onBeforeUnload() { if (this.isUsedHere() && this.activitySessionID) { try { @@ -622,12 +601,13 @@ export default class Device extends EventEmitter { type: 'acquired', path: this.originalDescriptor.path, label: label, - state: this.state, + state: this.getExternalState(), status: this.isUsedElsewhere() ? 'occupied' : this.featuresNeedsReload ? 'used' : 'available', mode: this.getMode(), firmware: this.firmwareStatus, firmwareRelease: this.firmwareRelease, features: this.features, + unavailableCapabilities: this.unavailableCapabilities, }; } } diff --git a/src/js/device/DeviceCommands.js b/src/js/device/DeviceCommands.js index c25dca83c..ec1e152bf 100644 --- a/src/js/device/DeviceCommands.js +++ b/src/js/device/DeviceCommands.js @@ -24,6 +24,12 @@ export type MessageResponse = { export type DefaultMessageResponse = MessageResponse; +export type PassphrasePromptResponse = { + passphrase?: string, + passphraseOnDevice?: boolean, + cache?: boolean, +}; + function assertType(res: DefaultMessageResponse, resType: string) { const splitResTypes = resType.split('|'); if (!(splitResTypes.includes(res.type))) { @@ -211,13 +217,6 @@ export default class DeviceCommands { return response; } - async getDeviceState(): Promise { - const response: trezor.PublicKey = await this.getPublicKey([(44 | 0x80000000) >>> 0, (1 | 0x80000000) >>> 0, (0 | 0x80000000) >>> 0], 'Testnet', 'SPENDADDRESS'); - const secret: string = `${response.xpub}#${this.device.features.device_id}#${this.device.instance}`; - const state: string = this.device.getTemporaryState() || bitcoin.crypto.hash256(Buffer.from(secret, 'binary')).toString('hex'); - return state; - } - async getAddress( address_n: Array, coinInfo: BitcoinNetworkInfo, @@ -239,7 +238,7 @@ export default class DeviceCommands { } }); } - const response: Object = await this.typedCall('GetAddress', 'Address', { + const response = await this.typedCall('GetAddress', 'Address', { address_n, coin_name: coinInfo.name, show_display: !!showOnTrezor, @@ -533,29 +532,19 @@ export default class DeviceCommands { return response.message; } - // async clearSession(): Promise> { async clearSession(settings: Object): Promise> { return await this.typedCall('ClearSession', 'Success', settings); } - async initialize(useEmptyPassphrase: boolean = false): Promise { - if (this.disposed) { - throw new Error('DeviceCommands already disposed'); - } - - const payload = {}; - if (!this.device.isT1()) { - // T2 features - payload.state = this.device.getExpectedState() || this.device.getState(); - if (useEmptyPassphrase) { - payload.skip_passphrase = useEmptyPassphrase; - payload.state = null; - } - } - - const response = await this.call('Initialize', payload); - assertType(response, 'Features'); - return response; + async getDeviceState() { + const response = await this.typedCall('GetAddress', 'Address', { + address_n: [(44 | 0x80000000) >>> 0, (1 | 0x80000000) >>> 0, (0 | 0x80000000) >>> 0, 0, 0], + coin_name: 'Testnet', + script_type: 'SPENDADDRESS', + }); + // bitcoin.crypto.hash256(Buffer.from(secret, 'binary')).toString('hex'); + const state: string = response.message.address; + return state; } async wipe(): Promise { @@ -663,8 +652,16 @@ export default class DeviceCommands { return Promise.reject(e); } + if (res.type === 'Features') { + return Promise.resolve(res); + } + if (res.type === 'ButtonRequest') { - this.device.emit('button', this.device, res.message.code); + if (res.message.code === 'ButtonRequest_PassphraseEntry') { + this.device.emit(DEVICE.PASSPHRASE_ON_DEVICE, this.device); + } else { + this.device.emit(DEVICE.BUTTON, this.device, res.message.code); + } return this._commonCall('ButtonAck', {}); } @@ -686,16 +683,32 @@ export default class DeviceCommands { } if (res.type === 'PassphraseRequest') { - const state: ?string = !this.device.isT1() ? (this.device.getExpectedState() || this.device.getState()) : null; + const state = this.device.getInternalState(); + const legacy = this.device.useLegacyPassphrase(); + const legacyT1 = legacy && this.device.isT1(); + + // T1 fw lower than x,x,x, passphrase is cached in internal state + if (legacyT1 && typeof state === 'string') { + return this._commonCall('PassphraseAck', { passphrase: state }); + } - if (res.message.on_device) { + // TT fw lower than 2.3.0, entering passphrase on device + if (legacy && res.message.on_device) { this.device.emit(DEVICE.PASSPHRASE_ON_DEVICE, this.device); return this._commonCall('PassphraseAck', { state }); } return this._promptPassphrase().then( - passphrase => { - return this._commonCall('PassphraseAck', { passphrase, state }); + response => { + const { passphrase, passphraseOnDevice, cache } = response; + if (legacyT1) { + this.device.setInternalState(cache ? passphrase : undefined); + return this._commonCall('PassphraseAck', { passphrase }); + } else if (legacy) { + return this._commonCall('PassphraseAck', { passphrase, state }); + } else { + return !passphraseOnDevice ? this._commonCall('PassphraseAck', { passphrase }) : this._commonCall('PassphraseAck', { on_device: true }); + } }, err => { return this._commonCall('Cancel', {}).catch(e => { @@ -705,9 +718,11 @@ export default class DeviceCommands { ); } + // TT fw lower than 2.3.0, device send his current state + // new passphrase design set this value from `features.session_id` if (res.type === 'PassphraseStateRequest') { const state: string = res.message.state; - this.device.setTemporaryState(state); + this.device.setInternalState(state); return this._commonCall('PassphraseStateAck', {}); } @@ -743,14 +758,14 @@ export default class DeviceCommands { }); } - _promptPassphrase(): Promise { + _promptPassphrase(): Promise { return new Promise((resolve, reject) => { if (this.device.listenerCount(DEVICE.PASSPHRASE) > 0) { - this.device.emit(DEVICE.PASSPHRASE, this.device, (err, passphrase) => { - if (err || passphrase == null) { - reject(err); + this.device.emit(DEVICE.PASSPHRASE, this.device, (response: PassphrasePromptResponse, error?: Error) => { + if (error) { + reject(error); } else { - resolve(passphrase.normalize('NFKD')); + resolve(response); } }); } else { diff --git a/src/js/device/DeviceList.js b/src/js/device/DeviceList.js index c0b1a527d..ccf5ecf6e 100644 --- a/src/js/device/DeviceList.js +++ b/src/js/device/DeviceList.js @@ -66,7 +66,7 @@ export default class DeviceList extends EventEmitter { } this.transport = new Fallback(transports); - this.defaultMessages = DataManager.getMessages(); + this.defaultMessages = DataManager.getProtobufMessages(); this.currentMessages = this.defaultMessages; } @@ -95,11 +95,14 @@ export default class DeviceList extends EventEmitter { } } - async reconfigure(json: JSON, custom?: boolean) { - if (this.currentMessages === json) return; + async reconfigure(messages: JSON | number[], custom?: boolean) { + if (Array.isArray(messages)) { + messages = DataManager.getProtobufMessages(messages); + } + if (this.currentMessages === messages) return; try { - await this.transport.configure(JSON.stringify(json)); - this.currentMessages = json; + await this.transport.configure(JSON.stringify(messages)); + this.currentMessages = messages; this.hasCustomMessages = typeof custom === 'boolean' ? custom : false; } catch (error) { throw ERROR.WRONG_TRANSPORT_CONFIG; diff --git a/src/js/popup/view/invalidPassphrase.js b/src/js/popup/view/invalidPassphrase.js index 79ddaf301..da5a73886 100644 --- a/src/js/popup/view/invalidPassphrase.js +++ b/src/js/popup/view/invalidPassphrase.js @@ -8,16 +8,16 @@ import type { DeviceMessage } from '../../types/uiRequest'; export const initInvalidPassphraseView = (payload: $PropertyType): void => { showView('invalid-passphrase'); - const confirmButton: HTMLElement = container.getElementsByClassName('confirm')[0]; - const cancelButton: HTMLElement = container.getElementsByClassName('cancel')[0]; + const retryButton: HTMLElement = container.getElementsByClassName('retry')[0]; + const useCurrentButton: HTMLElement = container.getElementsByClassName('useCurrent')[0]; - confirmButton.onclick = () => { - postMessage(UiMessage(UI.INVALID_PASSPHRASE_ACTION, false)); + retryButton.onclick = () => { + postMessage(UiMessage(UI.INVALID_PASSPHRASE_ACTION, true)); showView('loader'); }; - cancelButton.onclick = () => { - postMessage(UiMessage(UI.INVALID_PASSPHRASE_ACTION, true)); + useCurrentButton.onclick = () => { + postMessage(UiMessage(UI.INVALID_PASSPHRASE_ACTION, false)); showView('loader'); }; }; diff --git a/src/js/popup/view/passphrase.js b/src/js/popup/view/passphrase.js index ed7f96bfa..b61e905d4 100644 --- a/src/js/popup/view/passphrase.js +++ b/src/js/popup/view/passphrase.js @@ -17,7 +17,9 @@ export const initPassphraseView = (payload: $PropertyType { @@ -55,24 +57,24 @@ export const initPassphraseView = (payload: $PropertyType { + if (e.key === 'Enter') { + e.preventDefault(); + enter.click(); + } + }; const handleEnterClick = () => { input1.blur(); input2.blur(); - // eslint-disable-next-line no-use-before-define window.removeEventListener('keydown', handleWindowKeydown); showView('loader'); postMessage(UiMessage(UI.RECEIVE_PASSPHRASE, { - save: true, value: input1.value, + save: true, })); }; - const handleWindowKeydown = (e: KeyboardEvent) => { - if (e.key === 'Enter') { - e.preventDefault(); - enter.click(); - } - }; + /* Functions: END */ input1.addEventListener('input', () => { validation(); @@ -87,5 +89,19 @@ export const initPassphraseView = (payload: $PropertyType { + window.removeEventListener('keydown', handleWindowKeydown); + showView('loader'); + postMessage(UiMessage(UI.RECEIVE_PASSPHRASE, { + value: '', + passphraseOnDevice: true, + save: true, + })); + }); + } + input1.focus(); }; diff --git a/src/js/types/coinInfo.js b/src/js/types/coinInfo.js index a1d0c3789..a659cf139 100644 --- a/src/js/types/coinInfo.js +++ b/src/js/types/coinInfo.js @@ -109,7 +109,7 @@ export type EthereumNetworkInfo = { }; export type MiscNetworkInfo = { - +type: 'misc', + +type: 'misc' | 'nem', blockchainLink: ?BlockchainLink, blocktime: number, curve: string, diff --git a/src/js/types/index.js b/src/js/types/index.js index f27c59053..6c85f2d49 100644 --- a/src/js/types/index.js +++ b/src/js/types/index.js @@ -82,7 +82,9 @@ export type Features = { fw_vendor_keys: string, unfinished_backup: boolean, no_backup: boolean, - features: Array, + session_id?: string, + passphrase_always_on_device?: boolean, + capabilities?: string[], }; export type FirmwareRelease = { @@ -101,6 +103,7 @@ export type FirmwareRelease = { export type DeviceStatus = 'available' | 'occupied' | 'used'; export type DeviceMode = 'normal' | 'bootloader' | 'initialize' | 'seedless'; export type DeviceFirmwareStatus = 'valid' | 'outdated' | 'required' | 'unknown' | 'none'; +export type UnavailableCapability = 'no-capability' | 'no-support' | 'update-required' | 'trezor-connect-outdated' | string[]; export type Device = $Exact<{ +type: 'acquired', @@ -112,14 +115,17 @@ export type Device = $Exact<{ +mode: DeviceMode, state: ?string, features: Features, + unavailableCapabilities: { [key: string]: UnavailableCapability }, }> | $Exact<{ +type: 'unacquired', +path: string, +label: string, + features?: typeof undefined, }> | $Exact<{ +type: 'unreadable', +path: string, +label: string, + features?: typeof undefined, }> export type Settings = { diff --git a/src/js/types/uiResponse.js b/src/js/types/uiResponse.js index 59e848b19..e18a57638 100644 --- a/src/js/types/uiResponse.js +++ b/src/js/types/uiResponse.js @@ -42,6 +42,7 @@ declare type ReceivePassphrase = {| payload: { save: boolean, value: string, + passphraseOnDevice?: boolean, }, |} diff --git a/src/js/utils/__tests__/deviceFeaturesUtils.test.js b/src/js/utils/__tests__/deviceFeaturesUtils.test.js new file mode 100644 index 000000000..70855a3fb --- /dev/null +++ b/src/js/utils/__tests__/deviceFeaturesUtils.test.js @@ -0,0 +1,185 @@ +import coinsJSON from '../../../data/coins.json'; +import configJSON from '../../../data/config.json'; +import { parseCoinsJson, getAllNetworks } from '../../data/CoinInfo'; + +import { versionCompare, parseCapabilities, getUnavailableCapabilities } from '../deviceFeaturesUtils'; + +describe('utils/deviceFeaturesUtils', () => { + beforeAll(() => { + parseCoinsJson(coinsJSON); + }); + + it('versionCompare', () => { + expect(versionCompare(null, null)).toEqual(0); + expect(versionCompare('abcd', null)).toEqual(0); + expect(versionCompare(null, 'abcd')).toEqual(0); + expect(versionCompare({}, {})).toEqual(0); + expect(versionCompare('1.2.3', '1.2.3')).toEqual(0); + expect(versionCompare('1.2.3', '1.2.4')).toEqual(-1); + expect(versionCompare('1.2.3', '1.2.2')).toEqual(1); + expect(versionCompare('1.2.3', '1.2')).toEqual(1); + expect(versionCompare('1.2', '1.2.1')).toEqual(-1); + expect(versionCompare([], [])).toEqual(0); + expect(versionCompare([1], [2])).toEqual(-1); + expect(versionCompare(['a'], ['b'])).toEqual(0); + expect(versionCompare([null], [1])).toEqual(-1); + expect(versionCompare([1], [null])).toEqual(1); + expect(versionCompare([1, 2, 3], [1, 2, 4])).toEqual(-1); + expect(versionCompare([1, 2, 3], [1, 2, 2])).toEqual(1); + }); + + it('parseCapabilities', () => { + const feat1 = { + major_version: 1, + }; + const feat2 = { + major_version: 2, + }; + // default T1 + expect(parseCapabilities(feat1)).toEqual([ + 'Capability_Bitcoin', + 'Capability_Bitcoin_like', + 'Capability_Crypto', + 'Capability_Ethereum', + 'Capability_Lisk', + 'Capability_NEM', + 'Capability_Stellar', + 'Capability_U2F', + ]); + + // default T2 + expect(parseCapabilities(feat2)).toEqual([ + 'Capability_Bitcoin', + 'Capability_Bitcoin_like', + 'Capability_Binance', + 'Capability_Cardano', + 'Capability_Crypto', + 'Capability_EOS', + 'Capability_Ethereum', + 'Capability_Lisk', + 'Capability_Monero', + 'Capability_NEM', + 'Capability_Ripple', + 'Capability_Stellar', + 'Capability_Tezos', + 'Capability_U2F', + ]); + + // bitcoin only + expect(parseCapabilities({ + major_version: 1, + capabilities: [1], + })).toEqual([ + 'Capability_Bitcoin', + ]); + + // no features + expect(parseCapabilities(null)).toEqual([]); + + // unknown + expect(parseCapabilities({ + major_version: 1, + capabilities: [1000], + })).toEqual([ + 'Capability_Unknown_trezor-connect', + ]); + }); + + it('getUnavailableCapabilities', () => { + const support = configJSON.supportedFirmware; + const coins = getAllNetworks(); + + const feat1 = { + major_version: 1, + minor_version: 8, + patch_version: 3, + capabilities: undefined, + }; + feat1.capabilities = parseCapabilities(feat1); + + // default Capabilities T1 + expect(getUnavailableCapabilities(feat1, coins, support)).toEqual({ + ada: 'no-capability', + bnb: 'no-capability', + cpc: 'no-support', + eos: 'no-capability', + ppc: 'update-required', + tppc: 'update-required', + txrp: 'no-capability', + uno: 'update-required', + xrp: 'no-capability', + xtz: 'no-capability', + zcr: 'update-required', + zen: 'no-support', + }); + + const feat2 = { + major_version: 2, + minor_version: 2, + patch_version: 0, + capabilities: undefined, + }; + feat2.capabilities = parseCapabilities(feat2); + + // default Capabilities T2 + expect(getUnavailableCapabilities(feat2, coins, support)).toEqual({}); + + // excluded single method without specified coins + expect( + getUnavailableCapabilities( + feat2, + coins, + [ + { + min: ['0', '2.3.0'], + excludedMethods: ['getAccountInfo'], + }, + ] + ), + ).toEqual({ + getAccountInfo: 'update-required', + }); + + // excluded single method with specified coins + expect( + getUnavailableCapabilities( + feat2, + coins, + [ + { + min: ['0', '2.3.0'], + coin: ['xrp', 'txrp'], + excludedMethods: ['getAccountInfo'], + }, + ] + ), + ).toEqual({ + getAccountInfo: ['xrp', 'txrp'], + }); + + // disable multiple methods for outdated trezor-connect + expect( + getUnavailableCapabilities( + feat2, + coins, + [ + { + max: ['0', '2.1.0'], + coin: ['xrp', 'txrp'], + excludedMethods: ['rippleGetAddress'], + }, + { + max: ['0', '2.1.0'], + excludedMethods: ['tezosSignTransaction'], + }, + ] + ), + ).toEqual({ + rippleGetAddress: ['xrp', 'txrp'], + tezosSignTransaction: 'trezor-connect-outdated', + }); + + // without capabilities + expect(getUnavailableCapabilities({}, coins, support)).toEqual({}); + }); +}); diff --git a/src/js/utils/arrayUtils.js b/src/js/utils/arrayUtils.js deleted file mode 100644 index b287b4ee4..000000000 --- a/src/js/utils/arrayUtils.js +++ /dev/null @@ -1,9 +0,0 @@ -/* @flow */ - -// export default function () { -// if (!Array.isArray) { -// Array.isArray = function(arg) { -// return Object.prototype.toString.call(arg) === '[object Array]'; -// }; -// } -// } diff --git a/src/js/utils/deviceFeaturesUtils.js b/src/js/utils/deviceFeaturesUtils.js new file mode 100644 index 000000000..89fa4dbfa --- /dev/null +++ b/src/js/utils/deviceFeaturesUtils.js @@ -0,0 +1,115 @@ +/* @flow */ +import type { Features, CoinInfo } from '../types'; + +export const versionCompare = (a: string | number[], b: string | number[]) => { + const pa = typeof a === 'string' ? a.split('.') : a; + const pb = typeof b === 'string' ? b.split('.') : b; + if (!Array.isArray(pa) || !Array.isArray(pb)) return 0; + let i; + for (i = 0; i < 3; i++) { + const na = Number(pa[i]); + const nb = Number(pb[i]); + if (na > nb) return 1; + if (nb > na) return -1; + if (!isNaN(na) && isNaN(nb)) return 1; + if (isNaN(na) && !isNaN(nb)) return -1; + } + return 0; +}; + +// From protobuf +const CAPABILITIES = [ + undefined, + 'Capability_Bitcoin', + 'Capability_Bitcoin_like', + 'Capability_Binance', + 'Capability_Cardano', + 'Capability_Crypto', + 'Capability_EOS', + 'Capability_Ethereum', + 'Capability_Lisk', + 'Capability_Monero', + 'Capability_NEM', + 'Capability_Ripple', + 'Capability_Stellar', + 'Capability_Tezos', + 'Capability_U2F', + 'Capability_Shamir', + 'Capability_ShamirGroups', + 'Capability_PassphraseEntry', +]; + +const DEFAULT_CAPABILITIES_T1 = [1, 2, 5, 7, 8, 10, 12, 14]; +const DEFAULT_CAPABILITIES_TT = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; + +export const parseCapabilities = (features?: Features): string[] => { + if (!features) return []; // no features - no capabilities + // needs to be "any" since Features.capabilities are declared as string[] but in fact it's a number[] + const filter = (c: any) => CAPABILITIES[c] || 'Capability_Unknown_trezor-connect'; + // fallback for older firmware + if (!features.capabilities) return features.major_version === 1 ? DEFAULT_CAPABILITIES_T1.map(filter) : DEFAULT_CAPABILITIES_TT.map(filter); + // regular capabilities + return features.capabilities.map(filter); +}; + +// TODO: support type +export const getUnavailableCapabilities = (features: Features, coins: CoinInfo[], support: any[]) => { + const { capabilities } = features; + const list = {}; + if (!capabilities) return list; + const fw = [features.major_version, features.minor_version, features.patch_version]; + + // 1. check if Trezor has enabled capabilities + const unavailable = coins.filter(info => { + if (info.type === 'bitcoin') { + if (info.name === 'Bitcoin' || info.name === 'Testnet') { + return !capabilities.includes('Capability_Bitcoin'); + } + return !capabilities.includes('Capability_Bitcoin_like'); + } + if (info.type === 'ethereum') { + return !capabilities.includes('Capability_Ethereum'); + } + if (info.type === 'nem') { + return !capabilities.includes('Capability_NEM'); + } + // misc + if (info.shortcut === 'BNB') return !capabilities.includes('Capability_Binance'); + if (info.shortcut === 'XRP' || info.shortcut === 'tXRP') return !capabilities.includes('Capability_Ripple'); + return !capabilities.includes(`Capability_${info.name}`); + }); + + // add unavailable coins to list + unavailable.forEach(info => { + list[info.shortcut.toLowerCase()] = 'no-capability'; + }); + + // 2. check if firmware version is in range of CoinInfo.support + const available = coins.filter(info => !unavailable.includes(info)); + const key = `trezor${features.major_version}`; + available.forEach(info => { + if (!info.support || typeof info.support[key] !== 'string') { + list[info.shortcut.toLowerCase()] = 'no-support'; + unavailable.push(info); + } + if (versionCompare(info.support[key], fw) > 0) { + list[info.shortcut.toLowerCase()] = 'update-required'; + unavailable.push(info); + } + }); + + // 3. check if firmware version is in range of excluded methods in "config.supportedFirmware" + support.forEach(s => { + if (s.min && versionCompare(s.min[fw[0] - 1], fw) > 0) { + s.excludedMethods.forEach(m => { + list[m] = s.coin || 'update-required'; + }); + } + if (s.max && versionCompare(s.max[fw[0] - 1], fw) < 0) { + s.excludedMethods.forEach(m => { + list[m] = s.coin || 'trezor-connect-outdated'; + }); + } + }); + return list; +}; diff --git a/yarn.lock b/yarn.lock index 503ab0291..f9646cf59 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3028,10 +3028,10 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= -copy-webpack-plugin@^5.0.5: - version "5.0.5" - resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-5.0.5.tgz#731df6a837a2ef0f8f8e2345bdfe9b7c62a2da68" - integrity sha512-7N68eIoQTyudAuxkfPT7HzGoQ+TsmArN/I3HFwG+lVE3FNzqvZKIiaxtYh4o3BIznioxUvx9j26+Rtsc9htQUQ== +copy-webpack-plugin@5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/copy-webpack-plugin/-/copy-webpack-plugin-5.1.1.tgz#5481a03dea1123d88a988c6ff8b78247214f0b88" + integrity sha512-P15M5ZC8dyCjQHWwd4Ia/dm0SgVvZJMYeykVIVYXbGyqO4dWB5oyPHp9i7wjwo5LhtlhKbiBCdS2NvM07Wlybg== dependencies: cacache "^12.0.3" find-cache-dir "^2.1.0" @@ -3043,7 +3043,7 @@ copy-webpack-plugin@^5.0.5: normalize-path "^3.0.0" p-limit "^2.2.1" schema-utils "^1.0.0" - serialize-javascript "^2.1.0" + serialize-javascript "^2.1.2" webpack-log "^2.0.0" core-js-compat@^3.1.1: @@ -3148,23 +3148,23 @@ crypto-browserify@^3.11.0: randombytes "^2.0.0" randomfill "^1.0.3" -css-loader@^3.2.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.2.0.tgz#bb570d89c194f763627fcf1f80059c6832d009b2" - integrity sha512-QTF3Ud5H7DaZotgdcJjGMvyDj5F3Pn1j/sC6VBEOVp94cbwqyIBdcs/quzj4MC1BKQSrTpQznegH/5giYbhnCQ== +css-loader@3.4.2: + version "3.4.2" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.4.2.tgz#d3fdb3358b43f233b78501c5ed7b1c6da6133202" + integrity sha512-jYq4zdZT0oS0Iykt+fqnzVLRIeiPWhka+7BqPn+oSIpWJAHak5tmB/WZrJ2a21JhCeFyNnnlroSl8c+MtVndzA== dependencies: camelcase "^5.3.1" cssesc "^3.0.0" icss-utils "^4.1.1" loader-utils "^1.2.3" normalize-path "^3.0.0" - postcss "^7.0.17" + postcss "^7.0.23" postcss-modules-extract-imports "^2.0.0" postcss-modules-local-by-default "^3.0.2" - postcss-modules-scope "^2.1.0" + postcss-modules-scope "^2.1.1" postcss-modules-values "^3.0.0" - postcss-value-parser "^4.0.0" - schema-utils "^2.0.0" + postcss-value-parser "^4.0.2" + schema-utils "^2.6.0" css-select@^1.1.0: version "1.2.0" @@ -3397,10 +3397,10 @@ detect-newline@^2.1.0: resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= -detect-newline@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.0.0.tgz#8ae477c089e51872c264531cd6547719c0b86b2f" - integrity sha512-JAP22dVPAqvhdRFFxK1G5GViIokyUn0UWXRNW0ztK96fsqi9cuM8w8ESbSk+T2w5OVorcMcL6m7yUg1RrX+2CA== +detect-newline@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" + integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== detect-node@^2.0.4: version "2.0.4" @@ -4232,10 +4232,10 @@ find-cache-dir@^2.0.0, find-cache-dir@^2.1.0: make-dir "^2.0.0" pkg-dir "^3.0.0" -find-cache-dir@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.1.0.tgz#9935894999debef4cf9f677fdf646d002c4cdecb" - integrity sha512-zw+EFiNBNPgI2NTrKkDd1xd7q0cs6wr/iWnr/oUkI0yF9K9GqQ+riIt4aiyFaaqpaWbxPrJXHI+QvmNUQbX+0Q== +find-cache-dir@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/find-cache-dir/-/find-cache-dir-3.2.0.tgz#e7fe44c1abc1299f516146e563108fd1006c1874" + integrity sha512-1JKclkYYsf1q9WIJKLZa9S9muC+08RIjzAlLrK4QcYLJMS6mk9yombQ9qf+zJ7H9LS800k0s44L4sDq9VYzqyg== dependencies: commondir "^1.0.1" make-dir "^3.0.0" @@ -4287,10 +4287,10 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== -flow-bin@0.112.0: - version "0.112.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.112.0.tgz#6a21c31937c4a2f23a750056a364c598a95ea216" - integrity sha512-vdcuKv0UU55vjv0e2EVh1ZxlU+TSNT19SkE+6gT1vYzTKtzYE6dLuAmBIiS3Rg2N9D9HOI6TKSyl53zPtqZLrA== +flow-bin@0.116.1: + version "0.116.1" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.116.1.tgz#797964df40f2e32cad7e334583535105161434f4" + integrity sha512-ZSvjx+S4PtDNKcA4U0Afm8sHzzSlTdBBT//N2AltcaN6M/gyxAOGXjC6VkMMGqKWttw+5Psq6fU+RIvD1q/ocA== flush-write-stream@^1.0.0: version "1.1.1" @@ -5050,6 +5050,25 @@ inquirer@^7.0.0: strip-ansi "^5.1.0" through "^2.3.6" +inquirer@^7.0.1: + version "7.0.3" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.0.3.tgz#f9b4cd2dff58b9f73e8d43759436ace15bed4567" + integrity sha512-+OiOVeVydu4hnCGLCSX+wedovR/Yzskv9BFqUNNKq9uU2qg7LCcCo3R86S2E7WLo0y/x2pnEZfZe1CoYnORUAw== + dependencies: + ansi-escapes "^4.2.1" + chalk "^2.4.2" + cli-cursor "^3.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^3.0.0" + lodash "^4.17.15" + mute-stream "0.0.8" + run-async "^2.2.0" + rxjs "^6.5.3" + string-width "^4.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + internal-ip@^4.3.0: version "4.3.0" resolved "https://registry.yarnpkg.com/internal-ip/-/internal-ip-4.3.0.tgz#845452baad9d2ca3b69c635a137acb9a0dad0907" @@ -6233,7 +6252,7 @@ log4js@^4.0.0: rfdc "^1.1.4" streamroller "^1.0.6" -loglevel@^1.6.4: +loglevel@^1.6.6: version "1.6.6" resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.6.tgz#0ee6300cc058db6b3551fa1c4bf73b83bb771312" integrity sha512-Sgr5lbboAUBo3eXCSPL4/KoVz3ROKquOjcctxmHIt+vol2DrqTQe3SwkKKuYhEiWB5kYa13YyopJ69deJ1irzQ== @@ -6434,10 +6453,10 @@ mimic-fn@^2.0.0, mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -mini-css-extract-plugin@^0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.8.0.tgz#81d41ec4fe58c713a96ad7c723cdb2d0bd4d70e1" - integrity sha512-MNpRGbNA52q6U92i0qbVpQNsgk7LExy41MdAlG84FeytfDOtRIf/mCHdEgG8rpTKOaNKiqUnZdlptF469hxqOw== +mini-css-extract-plugin@0.9.0: + version "0.9.0" + resolved "https://registry.yarnpkg.com/mini-css-extract-plugin/-/mini-css-extract-plugin-0.9.0.tgz#47f2cf07aa165ab35733b1fc97d4c46c0564339e" + integrity sha512-lp3GeY7ygcgAmVIcRPBVhIkf8Us7FZjA+ILpal44qLdSu11wmjKQ3d9k15lfD7pO4esu9eUIAW7qiYIBppv40A== dependencies: loader-utils "^1.1.0" normalize-url "1.9.1" @@ -7369,10 +7388,10 @@ postcss-modules-local-by-default@^3.0.2: postcss-selector-parser "^6.0.2" postcss-value-parser "^4.0.0" -postcss-modules-scope@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-2.1.0.tgz#ad3f5bf7856114f6fcab901b0502e2a2bc39d4eb" - integrity sha512-91Rjps0JnmtUB0cujlc8KIKCsJXWjzuxGeT/+Q2i2HXKZ7nBUeF9YQTZZTNvHVoNYj1AthsjnGLtqDUE0Op79A== +postcss-modules-scope@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-2.1.1.tgz#33d4fc946602eb5e9355c4165d68a10727689dba" + integrity sha512-OXRUPecnHCg8b9xWvldG/jUpRIGPNRka0r4D4j0ESUU2/5IOnpsjfPPmDprM3Ih8CgZ8FXjWqaniK5v4rWt3oQ== dependencies: postcss "^7.0.6" postcss-selector-parser "^6.0.0" @@ -7404,6 +7423,11 @@ postcss-value-parser@^4.0.0: resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.0.tgz#99a983d365f7b2ad8d0f9b8c3094926eab4b936d" integrity sha512-ESPktioptiSUchCKgggAkzdmkgzKfmp0EU8jXH+5kbIUB+unr0Y4CY9SRMvibuvYUBjNh1ACLbxqYNpdTQOteQ== +postcss-value-parser@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.2.tgz#482282c09a42706d1fc9a069b73f44ec08391dc9" + integrity sha512-LmeoohTpp/K4UiyQCwuGWlONxXamGzCMtFxLq4W1nZVGIQLYvMCJx3yAF9qyyuFpflABI9yVdtJAqbihOsCsJQ== + postcss@^6.0.22, postcss@^6.0.23: version "6.0.23" resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.23.tgz#61c82cc328ac60e677645f979054eb98bc0e3324" @@ -7413,7 +7437,7 @@ postcss@^6.0.22, postcss@^6.0.23: source-map "^0.6.1" supports-color "^5.4.0" -postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.17, postcss@^7.0.5, postcss@^7.0.6: +postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.5, postcss@^7.0.6: version "7.0.17" resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.17.tgz#4da1bdff5322d4a0acaab4d87f3e782436bad31f" integrity sha512-546ZowA+KZ3OasvQZHsbuEpysvwTZNGJv9EfyCQdsIDltPSWHAeTQ5fQy/Npi2ZDtLI3zs7Ps/p6wThErhm9fQ== @@ -7422,6 +7446,15 @@ postcss@^7.0.14, postcss@^7.0.16, postcss@^7.0.17, postcss@^7.0.5, postcss@^7.0. source-map "^0.6.1" supports-color "^6.1.0" +postcss@^7.0.23: + version "7.0.26" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.26.tgz#5ed615cfcab35ba9bbb82414a4fa88ea10429587" + integrity sha512-IY4oRjpXWYshuTDFxMVkJDtWIk2LhsTlu8bZnbEJA4+bYT16Lvpo8Qv6EvDumhYRgzjZl489pmsY3qVgJQ08nA== + dependencies: + chalk "^2.4.2" + source-map "^0.6.1" + supports-color "^6.1.0" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -8125,6 +8158,13 @@ rxjs@^6.4.0: dependencies: tslib "^1.9.0" +rxjs@^6.5.3: + version "6.5.4" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.4.tgz#e0777fe0d184cec7872df147f303572d414e211c" + integrity sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q== + dependencies: + tslib "^1.9.0" + safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" @@ -8192,10 +8232,10 @@ schema-utils@^2.0.0: ajv "^6.1.0" ajv-keywords "^3.1.0" -schema-utils@^2.0.1, schema-utils@^2.5.0: - version "2.5.0" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.5.0.tgz#8f254f618d402cc80257486213c8970edfd7c22f" - integrity sha512-32ISrwW2scPXHUSusP8qMg5dLUawKkyV+/qIEV9JdXKx+rsM6mi8vZY8khg2M69Qom16rtroWXD3Ybtiws38gQ== +schema-utils@^2.6.0, schema-utils@^2.6.1, schema-utils@^2.6.4: + version "2.6.4" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.4.tgz#a27efbf6e4e78689d91872ee3ccfa57d7bdd0f53" + integrity sha512-VNjcaUxVnEeun6B2fiiUDjXXBtD4ZSH7pdbfIu1pOFwgptDPLMo/z9jr4sUfsjFVPqDCEin/F7IYlq7/E6yDbQ== dependencies: ajv "^6.10.2" ajv-keywords "^3.4.1" @@ -8246,6 +8286,11 @@ semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== +semver@^7.1.1: + version "7.1.1" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.1.1.tgz#29104598a197d6cbe4733eeecbe968f7b43a9667" + integrity sha512-WfuG+fl6eh3eZ2qAf6goB7nhiCd7NPXhmyFxigB/TOkQyeLP8w8GsVehvtGNtnNmyboz4TgeK40B1Kbql/8c5A== + send@0.17.1: version "0.17.1" resolved "https://registry.yarnpkg.com/send/-/send-0.17.1.tgz#c1d8b059f7900f7466dd4938bdc44e11ddb376c8" @@ -8265,15 +8310,10 @@ send@0.17.1: range-parser "~1.2.1" statuses "~1.5.0" -serialize-javascript@^1.7.0: - version "1.7.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.7.0.tgz#d6e0dfb2a3832a8c94468e6eb1db97e55a192a65" - integrity sha512-ke8UG8ulpFOxO8f8gRYabHQe/ZntKlcig2Mp+8+URDP1D8vJZ0KUt7LYo07q25Z/+JVSgpr/cui9PIp5H6/+nA== - -serialize-javascript@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.0.tgz#9310276819efd0eb128258bb341957f6eb2fc570" - integrity sha512-a/mxFfU00QT88umAJQsNWOnUKckhNCqOl028N48e7wFmo2/EHpTo9Wso+iJJCMrQnmFvcjto5RJdAHEvVhcyUQ== +serialize-javascript@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-2.1.2.tgz#ecec53b0e0317bdc95ef76ab7074b7384785fa61" + integrity sha512-rs9OggEUF0V4jUSecXazOYsLfu7OGK2qIn3c7IPBiffz32XniEp/TX9Xmc9LQfK2nQ2QKHvZ2oygKUGU0lG4jQ== serve-index@^1.9.1: version "1.9.1" @@ -8882,13 +8922,13 @@ strip-json-comments@~2.0.1: resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= -style-loader@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.0.0.tgz#1d5296f9165e8e2c85d24eee0b7caf9ec8ca1f82" - integrity sha512-B0dOCFwv7/eY31a5PCieNwMgMhVGFe9w+rh7s/Bx8kfFkrth9zfTZquoYvdw8URgiqxObQKcpW51Ugz1HjfdZw== +style-loader@1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-1.1.3.tgz#9e826e69c683c4d9bf9db924f85e9abb30d5e200" + integrity sha512-rlkH7X/22yuwFYK357fMN/BxYOorfnfq0eD7+vqlemSK4wEcejFF1dg4zxP0euBW8NrYx2WZzZ8PPFevr7D+Kw== dependencies: loader-utils "^1.2.3" - schema-utils "^2.0.1" + schema-utils "^2.6.4" supports-color@6.1.0, supports-color@^6.1.0: version "6.1.0" @@ -8942,35 +8982,35 @@ tar@^4: safe-buffer "^5.1.2" yallist "^3.0.3" -terser-webpack-plugin@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz#61b18e40eaee5be97e771cdbb10ed1280888c2b4" - integrity sha512-ZXmmfiwtCLfz8WKZyYUuuHf3dMYEjg8NrjHMb0JqHVHVOSkzp3cW2/XG1fP3tRhqEqSzMwzzRQGtAPbs4Cncxg== +terser-webpack-plugin@2.3.2: + version "2.3.2" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.3.2.tgz#6d3d1b0590c8f729bfbaeb7fb2528b8b62db4c74" + integrity sha512-SmvB/6gtEPv+CJ88MH5zDOsZdKXPS/Uzv2//e90+wM1IHFUhsguPKEILgzqrM1nQ4acRXN/SV4Obr55SXC+0oA== + dependencies: + cacache "^13.0.1" + find-cache-dir "^3.2.0" + jest-worker "^24.9.0" + schema-utils "^2.6.1" + serialize-javascript "^2.1.2" + source-map "^0.6.1" + terser "^4.4.3" + webpack-sources "^1.4.3" + +terser-webpack-plugin@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.3.tgz#5ecaf2dbdc5fb99745fd06791f46fc9ddb1c9a7c" + integrity sha512-QMxecFz/gHQwteWwSo5nTc6UaICqN1bMedC5sMtUc7y3Ha3Q8y6ZO0iCR8pq4RJC8Hjf0FEPEHZqcMB/+DFCrA== dependencies: cacache "^12.0.2" find-cache-dir "^2.1.0" is-wsl "^1.1.0" schema-utils "^1.0.0" - serialize-javascript "^1.7.0" + serialize-javascript "^2.1.2" source-map "^0.6.1" terser "^4.1.2" webpack-sources "^1.4.0" worker-farm "^1.7.0" -terser-webpack-plugin@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.2.1.tgz#5569e6c7d8be79e5e43d6da23acc3b6ba77d22bd" - integrity sha512-jwdauV5Al7zopR6OAYvIIRcxXCSvLjZjr7uZE8l2tIWb/ryrGN48sJftqGf5k9z09tWhajx53ldp0XPI080YnA== - dependencies: - cacache "^13.0.1" - find-cache-dir "^3.0.0" - jest-worker "^24.9.0" - schema-utils "^2.5.0" - serialize-javascript "^2.1.0" - source-map "^0.6.1" - terser "^4.3.9" - webpack-sources "^1.4.3" - terser@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/terser/-/terser-4.1.2.tgz#b2656c8a506f7ce805a3f300a2ff48db022fa391" @@ -8980,10 +9020,10 @@ terser@^4.1.2: source-map "~0.6.1" source-map-support "~0.5.12" -terser@^4.3.9: - version "4.4.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-4.4.0.tgz#22c46b4817cf4c9565434bfe6ad47336af259ac3" - integrity sha512-oDG16n2WKm27JO8h4y/w3iqBGAOSCtq7k8dRmrn4Wf9NouL0b2WpMHGChFGZq4nFAQy1FsNJrVQHfurXOSTmOA== +terser@^4.4.3: + version "4.6.3" + resolved "https://registry.yarnpkg.com/terser/-/terser-4.6.3.tgz#e33aa42461ced5238d352d2df2a67f21921f8d87" + integrity sha512-Lw+ieAXmY69d09IIc/yqeBqXpEQIpDGZqT34ui1QWXIUpR2RjbqEkT8X7Lgex19hslSqcWM5iMN2kM11eMsESQ== dependencies: commander "^2.20.0" source-map "~0.6.1" @@ -9471,19 +9511,19 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -version-bump-prompt@^5.0.6: - version "5.0.6" - resolved "https://registry.yarnpkg.com/version-bump-prompt/-/version-bump-prompt-5.0.6.tgz#71fb464316645253ba3f301fffd4804d8924ad75" - integrity sha512-pjMmyngPdof9jZ0Jye9JAz7BNiqszeqIAjYcUx/0DdUmfw6LOAsJsfU5yIj4+LOVIet6chFANIeQBc1CKEbZZQ== +version-bump-prompt@5.0.7: + version "5.0.7" + resolved "https://registry.yarnpkg.com/version-bump-prompt/-/version-bump-prompt-5.0.7.tgz#bdb7aea109f0b198a360cdb52a7c627307689fc1" + integrity sha512-+HWtzCySSFDuV5ljvzZNX4K+lYoR5L89lIt2dkrTCk3o6/eqNc8k/+mxMpugHeRGPn5MzygmgW0e9auJ/AOtgg== dependencies: command-line-args "^5.1.1" detect-indent "^6.0.0" - detect-newline "^3.0.0" + detect-newline "^3.1.0" ez-spawn "^2.1.6" globby "^10.0.1" - inquirer "^7.0.0" + inquirer "^7.0.1" log-symbols "^3.0.0" - semver "^6.3.0" + semver "^7.1.1" vm-browserify@^1.0.1: version "1.1.0" @@ -9530,7 +9570,7 @@ webidl-conversions@^4.0.2: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== -webpack-cli@^3.3.10: +webpack-cli@3.3.10: version "3.3.10" resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.3.10.tgz#17b279267e9b4fb549023fae170da8e6e766da13" integrity sha512-u1dgND9+MXaEt74sJR4PR7qkPxXUSQ0RXYq8x1L6Jg1MYVEmGPrH6Ah6C4arD4r0J1P5HKjRqpab36k0eIzPqg== @@ -9568,10 +9608,10 @@ webpack-dev-middleware@^3.7.2: range-parser "^1.2.1" webpack-log "^2.0.0" -webpack-dev-server@^3.9.0: - version "3.9.0" - resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.9.0.tgz#27c3b5d0f6b6677c4304465ac817623c8b27b89c" - integrity sha512-E6uQ4kRrTX9URN9s/lIbqTAztwEPdvzVrcmHE8EQ9YnuT9J8Es5Wrd8n9BKg1a0oZ5EgEke/EQFgUsp18dSTBw== +webpack-dev-server@3.10.1: + version "3.10.1" + resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.10.1.tgz#1ff3e5cccf8e0897aa3f5909c654e623f69b1c0e" + integrity sha512-AGG4+XrrXn4rbZUueyNrQgO4KGnol+0wm3MPdqGLmmA+NofZl3blZQKxZ9BND6RDNuvAK9OMYClhjOSnxpWRoA== dependencies: ansi-html "0.0.7" bonjour "^3.5.0" @@ -9588,7 +9628,7 @@ webpack-dev-server@^3.9.0: ip "^1.1.5" is-absolute-url "^3.0.3" killable "^1.0.1" - loglevel "^1.6.4" + loglevel "^1.6.6" opn "^5.5.0" p-retry "^3.0.1" portfinder "^1.0.25" @@ -9631,10 +9671,10 @@ webpack-sources@^1.4.1, webpack-sources@^1.4.3: source-list-map "^2.0.0" source-map "~0.6.1" -webpack@^4.41.2: - version "4.41.2" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.41.2.tgz#c34ec76daa3a8468c9b61a50336d8e3303dce74e" - integrity sha512-Zhw69edTGfbz9/8JJoyRQ/pq8FYUoY0diOXqW0T6yhgdhCv6wr0hra5DwwWexNRns2Z2+gsnrNcbe9hbGBgk/A== +webpack@4.41.5: + version "4.41.5" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.41.5.tgz#3210f1886bce5310e62bb97204d18c263341b77c" + integrity sha512-wp0Co4vpyumnp3KlkmpM5LWuzvZYayDwM2n17EHFr4qxBBbRokC7DJawPJC7TfSFZ9HZ6GsdH40EBj4UV0nmpw== dependencies: "@webassemblyjs/ast" "1.8.5" "@webassemblyjs/helper-module-context" "1.8.5" @@ -9656,7 +9696,7 @@ webpack@^4.41.2: node-libs-browser "^2.2.1" schema-utils "^1.0.0" tapable "^1.1.3" - terser-webpack-plugin "^1.4.1" + terser-webpack-plugin "^1.4.3" watchpack "^1.6.0" webpack-sources "^1.4.1" @@ -9764,7 +9804,7 @@ worker-farm@^1.7.0: dependencies: errno "~0.1.7" -worker-loader@^2.0.0: +worker-loader@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/worker-loader/-/worker-loader-2.0.0.tgz#45fda3ef76aca815771a89107399ee4119b430ac" integrity sha512-tnvNp4K3KQOpfRnD20m8xltE3eWh89Ye+5oj7wXEEHKac1P4oZ6p9oTj8/8ExqoSBnk9nu5Pr4nKfQ1hn2APJw== From fb5993729c3523fa8c829b5cc54875808cb701de Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 18 Feb 2020 14:58:35 +0100 Subject: [PATCH 04/51] Fix/types cleanup (#530) * new passphrase popup view (added "on device" button/desision) * device state refactoring * add versionCompare util to replace 'semver-compare' * passphraseOnDevice decision from Features * protobuf reconfigure before Initialize * add features.capabilities + Device.unavailableCapabilities * Update messages.json * Update messages.json * use semicolon in types declarations * export all constants from index * general cleanup in types * update indexes * clean flowtype in __tests__ * update types definitions * update new types imports * update ResetDevice params * more type fixes * add typescript types * add missing types to UI and Blockchain events * copy typesctipt files in npm-extended * Create generate-typescript.js * Update build-npm-extended.js --- .eslintignore | 3 +- .eslintrc | 2 +- scripts/build-npm-extended.js | 13 + scripts/generate-typescript.js | 19 + src/__tests__/core/CoreEventHandler.js | 20 +- src/__tests__/core/applyFlags.spec.js | 5 +- src/__tests__/core/applySettings.spec.js | 5 +- .../core/binanceSignTransaction.spec.js | 39 +- src/__tests__/core/cardanoGetAddress.spec.js | 18 +- .../core/cardanoGetPublicKey.spec.js | 20 +- .../core/cardanoSignTransaction.spec.js | 31 +- src/__tests__/core/common.js | 1 - src/__tests__/core/core.test.js | 16 +- src/__tests__/core/eosGetPublicKey.spec.js | 15 +- src/__tests__/core/eosSignTransaction.spec.js | 274 +++-- src/__tests__/core/ethereumGetAddress.spec.js | 15 +- .../core/ethereumGetPublicKey.spec.js | 15 +- .../core/ethereumSignMessage.spec.js | 15 +- .../core/ethereumSignTransaction.spec.js | 68 +- .../core/ethereumVerifyMessage.spec.js | 15 +- src/__tests__/core/getAccountInfo.spec.js | 97 +- src/__tests__/core/getAddress.spec.js | 50 +- src/__tests__/core/getAddressMultisig.spec.js | 14 +- src/__tests__/core/getAddressSegwit.spec.js | 17 +- src/__tests__/core/getPublicKey.spec.js | 15 +- src/__tests__/core/index.js | 8 +- src/__tests__/core/liskGetAddress.spec.js | 16 +- src/__tests__/core/liskSignMessage.spec.js | 15 +- .../core/liskSignTransaction.spec.js | 48 +- src/__tests__/core/liskVerifyMessage.spec.js | 16 +- src/__tests__/core/nemGetAddress.spec.js | 16 +- .../core/nemSignTransactionMosaic.spec.js | 65 +- .../core/nemSignTransactionMultisig.spec.js | 61 +- .../core/nemSignTransactionOthers.spec.js | 30 +- .../core/nemSignTransactionTransfers.spec.js | 62 +- src/__tests__/core/rippleGetAddress.spec.js | 15 +- .../core/rippleSignTransaction.spec.js | 15 +- src/__tests__/core/signMessage.spec.js | 35 +- src/__tests__/core/signMessageSegwit.spec.js | 19 +- src/__tests__/core/signTransaction.spec.js | 91 +- .../core/signTransactionBcash.spec.js | 29 +- .../core/signTransactionBech32.spec.js | 29 +- .../core/signTransactionBgold.spec.js | 41 +- .../core/signTransactionCapricoin.spec.js | 41 +- .../core/signTransactionDash.spec.js | 23 +- .../core/signTransactionDoge.spec.js | 17 +- .../core/signTransactionKomodo.spec.js | 23 +- .../core/signTransactionMultisig.spec.js | 32 +- .../signTransactionMultisigChange.spec.js | 35 +- .../core/signTransactionPeercoin.spec.js | 23 +- .../core/signTransactionSegwit.spec.js | 29 +- .../core/signTransactionZcash.spec.js | 39 +- src/__tests__/core/stellarGetAddress.spec.js | 47 + .../core/stellarGetPublicKey.spec.js | 50 - .../core/stellarSignTransaction.spec.js | 400 ++++--- src/__tests__/core/tezosGetAddress.spec.js | 23 +- src/__tests__/core/tezosGetPublicKey.spec.js | 19 +- .../core/tezosSignTransaction.spec.js | 82 +- src/__tests__/core/verifyMessage.spec.js | 63 +- .../core/verifyMessageSegwit.spec.js | 39 +- .../core/verifyMessageSegwitNative.spec.js | 39 +- src/flowtype/tests/cardano-get-address.js | 14 - src/flowtype/tests/cardano-get-public-key.js | 15 - .../tests/cardano-sign-transaction.js | 31 - src/flowtype/tests/eos-get-public-key.js | 16 - src/flowtype/tests/eos-sign-transaction.js | 18 - src/flowtype/tests/ethereum-get-address.js | 14 - src/flowtype/tests/ethereum-sign-message.js | 15 - .../tests/ethereum-sign-transaction.js | 18 - src/flowtype/tests/ethereum-verify-message.js | 14 - src/flowtype/tests/get-account-info.js | 13 - src/flowtype/tests/get-address.js | 21 - src/flowtype/tests/get-public-key.js | 14 - src/flowtype/tests/index.js | 298 ----- src/flowtype/tests/lisk-get-address.js | 14 - src/flowtype/tests/lisk-sign-message.js | 16 - src/flowtype/tests/lisk-sign-transaction.js | 15 - src/flowtype/tests/lisk-verify-message.js | 14 - src/flowtype/tests/nem-get-address.js | 14 - src/flowtype/tests/nem-sign-transaction.js | 16 - src/flowtype/tests/passphrase.js | 22 - src/flowtype/tests/ripple-get-address.js | 14 - src/flowtype/tests/ripple-sign-transaction.js | 18 - src/flowtype/tests/sign-message.js | 16 - src/flowtype/tests/sign-transaction.js | 28 - src/flowtype/tests/tezos-get-address.js | 15 - src/flowtype/tests/tezos-get-public-key.js | 15 - src/flowtype/tests/tezos-sign-transaction.js | 17 - src/flowtype/tests/verify-message.js | 15 - src/js/backend/BlockchainLink.js | 55 +- src/js/constants/index.js | 17 + src/js/constants/ui.js | 2 +- src/js/core/Core.js | 6 +- src/js/core/methods/AbstractMethod.js | 15 +- src/js/core/methods/ApplyFlags.js | 2 +- src/js/core/methods/ApplySettings.js | 12 +- src/js/core/methods/BinanceGetAddress.js | 8 +- src/js/core/methods/BinanceGetPublicKey.js | 8 +- src/js/core/methods/BinanceSignTransaction.js | 10 +- src/js/core/methods/CardanoGetAddress.js | 8 +- src/js/core/methods/CardanoGetPublicKey.js | 8 +- src/js/core/methods/CardanoSignTransaction.js | 12 +- src/js/core/methods/ChangePin.js | 2 +- src/js/core/methods/CipherKeyValue.js | 16 +- src/js/core/methods/ComposeTransaction.js | 20 +- src/js/core/methods/CustomMessage.js | 6 +- src/js/core/methods/EosGetPublicKey.js | 6 +- src/js/core/methods/EosSignTransaction.js | 10 +- src/js/core/methods/EthereumGetAddress.js | 10 +- src/js/core/methods/EthereumGetPublicKey.js | 8 +- src/js/core/methods/EthereumSignMessage.js | 8 +- .../core/methods/EthereumSignTransaction.js | 8 +- src/js/core/methods/EthereumVerifyMessage.js | 8 +- src/js/core/methods/FirmwareUpdate.js | 2 +- src/js/core/methods/GetAccountInfo.js | 14 +- src/js/core/methods/GetAddress.js | 14 +- src/js/core/methods/GetFeatures.js | 4 +- src/js/core/methods/GetPublicKey.js | 6 +- src/js/core/methods/GetSettings.js | 3 +- src/js/core/methods/LiskGetAddress.js | 8 +- src/js/core/methods/LiskGetPublicKey.js | 8 +- src/js/core/methods/LiskSignMessage.js | 8 +- src/js/core/methods/LiskSignTransaction.js | 12 +- src/js/core/methods/LiskVerifyMessage.js | 8 +- src/js/core/methods/LoadDevice.js | 2 +- src/js/core/methods/NEMGetAddress.js | 10 +- src/js/core/methods/NEMSignTransaction.js | 6 +- src/js/core/methods/PushTransaction.js | 4 +- src/js/core/methods/RecoveryDevice.js | 13 +- src/js/core/methods/RequestLogin.js | 17 +- src/js/core/methods/ResetDevice.js | 30 +- src/js/core/methods/RippleGetAddress.js | 8 +- src/js/core/methods/RippleSignTransaction.js | 12 +- src/js/core/methods/SignMessage.js | 14 +- src/js/core/methods/SignTransaction.js | 14 +- src/js/core/methods/StellarGetAddress.js | 8 +- src/js/core/methods/StellarSignTransaction.js | 12 +- src/js/core/methods/TezosGetAddress.js | 8 +- src/js/core/methods/TezosGetPublicKey.js | 8 +- src/js/core/methods/TezosSignTransaction.js | 6 +- src/js/core/methods/VerifyMessage.js | 10 +- src/js/core/methods/WipeDevice.js | 2 +- .../blockchain/BlockchainDisconnect.js | 2 +- .../blockchain/BlockchainEstimateFee.js | 20 +- .../blockchain/BlockchainGetTransactions.js | 4 +- .../methods/blockchain/BlockchainSubscribe.js | 7 +- .../blockchain/BlockchainUnsubscribe.js | 7 +- .../methods/debuglink/DebugLinkDecision.js | 2 +- .../methods/debuglink/DebugLinkGetState.js | 2 +- src/js/core/methods/helpers/Discovery.js | 14 +- src/js/core/methods/helpers/binanceSignTx.js | 18 +- src/js/core/methods/helpers/cardanoSignTx.js | 2 +- src/js/core/methods/helpers/eosSignTx.js | 18 +- src/js/core/methods/helpers/ethereumSignTx.js | 2 +- src/js/core/methods/helpers/liskSignTx.js | 4 +- src/js/core/methods/helpers/nemSignTx.js | 74 +- .../core/methods/helpers/paramsValidator.js | 8 +- src/js/core/methods/helpers/signtx.js | 2 +- src/js/core/methods/helpers/signtxVerify.js | 2 +- src/js/core/methods/helpers/stellarSignTx.js | 14 +- src/js/core/methods/helpers/tezosSignTx.js | 6 +- src/js/core/methods/helpers/uploadFirmware.js | 6 +- src/js/core/methods/tx/Fees.js | 8 +- src/js/core/methods/tx/TransactionComposer.js | 11 +- src/js/core/methods/tx/inputs.js | 2 +- src/js/core/methods/tx/outputs.js | 2 +- src/js/core/methods/tx/refTx.js | 2 +- src/js/data/ConnectSettings.js | 73 +- src/js/data/DataManager.js | 68 +- src/js/data/TransportInfo.js | 14 +- src/js/device/DescriptorStream.js | 14 +- src/js/device/Device.js | 20 +- src/js/device/DeviceCommands.js | 14 +- src/js/device/DeviceList.js | 14 +- src/js/env/browser/browserUtils.js | 16 +- src/js/env/browser/index.js | 50 +- src/js/env/node/index.js | 55 +- src/js/env/react-native/RNUsbPlugin.js | 14 +- src/js/env/react-native/index.js | 41 +- src/js/iframe/builder.js | 3 +- src/js/iframe/iframe.js | 2 +- src/js/index.js | 429 +++---- src/js/message/builder.js | 7 +- src/js/popup/PopupManager.js | 3 +- src/js/popup/popup.js | 3 +- src/js/popup/view/confirmation.js | 2 +- src/js/popup/view/firmwareNotCompatible.js | 2 +- src/js/popup/view/firmwareNotSupported.js | 2 +- src/js/popup/view/firmwareRequiredUpdate.js | 2 +- src/js/popup/view/invalidPassphrase.js | 2 +- src/js/popup/view/notification.js | 2 +- src/js/popup/view/passphrase.js | 2 +- src/js/popup/view/passphraseOnDevice.js | 2 +- src/js/popup/view/permissions.js | 2 +- src/js/popup/view/pin.js | 2 +- src/js/popup/view/requestButton.js | 2 +- src/js/popup/view/selectAccount.js | 2 +- src/js/popup/view/selectDevice.js | 2 +- src/js/popup/view/selectFee.js | 4 +- src/js/popup/view/word.js | 2 +- src/js/types/__tests__/binance.js | 142 +++ src/js/types/__tests__/bitcoin.js | 436 +++++++ src/js/types/__tests__/blockchain.js | 105 ++ src/js/types/__tests__/cardano.js | 119 ++ src/js/types/__tests__/eos.js | 247 ++++ src/js/types/__tests__/ethereum.js | 138 +++ src/js/types/__tests__/index.js | 151 +++ src/js/types/__tests__/lisk.js | 182 +++ src/js/types/__tests__/management.js | 47 + src/js/types/__tests__/misc.js | 97 ++ src/js/types/__tests__/nem.js | 246 ++++ src/js/types/__tests__/ripple.js | 82 ++ src/js/types/__tests__/stellar.js | 280 +++++ src/js/types/__tests__/tezos.js | 148 +++ src/js/types/account.js | 347 ++++-- src/js/types/api.js | 273 +++++ src/js/types/backend/blockchain.js | 121 ++ src/js/types/backend/transactions.js | 97 ++ src/js/types/binance.js | 92 -- src/js/types/blockchainEvent.js | 94 -- src/js/types/cardano.js | 87 -- src/js/types/coinInfo.js | 130 --- src/js/types/eos.js | 163 --- src/js/types/ethereum.js | 105 -- src/js/types/events.js | 349 ++++++ src/js/types/fee.js | 28 - src/js/types/index.js | 345 +----- src/js/types/lisk.js | 142 --- src/js/types/misc.js | 34 + src/js/types/nem.js | 119 -- src/js/types/networks/binance.js | 62 + src/js/types/networks/bitcoin.js | 72 ++ src/js/types/networks/cardano.js | 60 + src/js/types/networks/coinInfo.js | 131 +++ src/js/types/networks/eos.js | 146 +++ src/js/types/networks/ethereum.js | 59 + src/js/types/networks/lisk.js | 101 ++ src/js/types/networks/nem.js | 130 +++ src/js/types/networks/ripple.js | 41 + src/js/types/networks/stellar.js | 170 +++ src/js/types/networks/tezos.js | 95 ++ src/js/types/params.js | 308 ++--- src/js/types/response.js | 273 ----- src/js/types/ripple.js | 58 - src/js/types/stellar.js | 187 --- src/js/types/tezos.js | 128 -- src/js/types/transactions.js | 109 -- src/js/types/trezor.js | 995 ---------------- src/js/types/trezor/device.js | 105 ++ src/js/types/trezor/management.js | 46 + src/js/types/trezor/protobuf.js | 1000 ++++++++++++++++ src/js/types/uiRequest.js | 234 ---- src/js/types/uiResponse.js | 109 -- src/js/utils/accountUtils.js | 4 +- src/js/utils/debug.js | 8 +- src/js/utils/deferred.js | 8 +- src/js/utils/hdnode.js | 17 +- src/js/utils/installers.js | 44 +- src/js/utils/pathUtils.js | 2 +- src/ts/types/__tests__/binance.ts | 133 +++ src/ts/types/__tests__/bitcoin.ts | 416 +++++++ src/ts/types/__tests__/blockchain.ts | 104 ++ src/ts/types/__tests__/cardano.ts | 114 ++ src/ts/types/__tests__/eos.ts | 250 ++++ src/ts/types/__tests__/ethereum.ts | 142 +++ src/ts/types/__tests__/index.ts | 141 +++ src/ts/types/__tests__/lisk.ts | 178 +++ src/ts/types/__tests__/management.ts | 46 + src/ts/types/__tests__/misc.ts | 96 ++ src/ts/types/__tests__/nem.ts | 245 ++++ src/ts/types/__tests__/ripple.ts | 81 ++ src/ts/types/__tests__/stellar.ts | 279 +++++ src/ts/types/__tests__/tezos.ts | 145 +++ src/ts/types/account.d.ts | 256 ++++ src/ts/types/api.d.ts | 342 ++++++ src/ts/types/backend/blockchain.d.ts | 116 ++ src/ts/types/backend/transactions.d.ts | 94 ++ src/ts/types/constants.d.ts | 144 +++ src/ts/types/events.d.ts | 320 +++++ src/ts/types/index.d.ts | 34 + src/ts/types/misc.d.ts | 34 + src/ts/types/networks/binance.d.ts | 61 + src/ts/types/networks/bitcoin.d.ts | 71 ++ src/ts/types/networks/cardano.d.ts | 60 + src/ts/types/networks/coinInfo.d.ts | 130 +++ src/ts/types/networks/eos.d.ts | 158 +++ src/ts/types/networks/ethereum.d.ts | 58 + src/ts/types/networks/lisk.d.ts | 100 ++ src/ts/types/networks/nem.d.ts | 129 +++ src/ts/types/networks/ripple.d.ts | 39 + src/ts/types/networks/stellar.d.ts | 169 +++ src/ts/types/networks/tezos.d.ts | 93 ++ src/ts/types/params.d.ts | 64 + src/ts/types/trezor/device.d.ts | 101 ++ src/ts/types/trezor/management.d.ts | 44 + src/ts/types/trezor/protobuf.d.ts | 1026 +++++++++++++++++ src/ts/types/tsconfig.json | 36 + 297 files changed, 13731 insertions(+), 6800 deletions(-) create mode 100644 scripts/generate-typescript.js create mode 100644 src/__tests__/core/stellarGetAddress.spec.js delete mode 100644 src/__tests__/core/stellarGetPublicKey.spec.js delete mode 100644 src/flowtype/tests/cardano-get-address.js delete mode 100644 src/flowtype/tests/cardano-get-public-key.js delete mode 100644 src/flowtype/tests/cardano-sign-transaction.js delete mode 100644 src/flowtype/tests/eos-get-public-key.js delete mode 100644 src/flowtype/tests/eos-sign-transaction.js delete mode 100644 src/flowtype/tests/ethereum-get-address.js delete mode 100644 src/flowtype/tests/ethereum-sign-message.js delete mode 100644 src/flowtype/tests/ethereum-sign-transaction.js delete mode 100644 src/flowtype/tests/ethereum-verify-message.js delete mode 100644 src/flowtype/tests/get-account-info.js delete mode 100644 src/flowtype/tests/get-address.js delete mode 100644 src/flowtype/tests/get-public-key.js delete mode 100644 src/flowtype/tests/index.js delete mode 100644 src/flowtype/tests/lisk-get-address.js delete mode 100644 src/flowtype/tests/lisk-sign-message.js delete mode 100644 src/flowtype/tests/lisk-sign-transaction.js delete mode 100644 src/flowtype/tests/lisk-verify-message.js delete mode 100644 src/flowtype/tests/nem-get-address.js delete mode 100644 src/flowtype/tests/nem-sign-transaction.js delete mode 100644 src/flowtype/tests/passphrase.js delete mode 100644 src/flowtype/tests/ripple-get-address.js delete mode 100644 src/flowtype/tests/ripple-sign-transaction.js delete mode 100644 src/flowtype/tests/sign-message.js delete mode 100644 src/flowtype/tests/sign-transaction.js delete mode 100644 src/flowtype/tests/tezos-get-address.js delete mode 100644 src/flowtype/tests/tezos-get-public-key.js delete mode 100644 src/flowtype/tests/tezos-sign-transaction.js delete mode 100644 src/flowtype/tests/verify-message.js create mode 100644 src/js/types/__tests__/binance.js create mode 100644 src/js/types/__tests__/bitcoin.js create mode 100644 src/js/types/__tests__/blockchain.js create mode 100644 src/js/types/__tests__/cardano.js create mode 100644 src/js/types/__tests__/eos.js create mode 100644 src/js/types/__tests__/ethereum.js create mode 100644 src/js/types/__tests__/index.js create mode 100644 src/js/types/__tests__/lisk.js create mode 100644 src/js/types/__tests__/management.js create mode 100644 src/js/types/__tests__/misc.js create mode 100644 src/js/types/__tests__/nem.js create mode 100644 src/js/types/__tests__/ripple.js create mode 100644 src/js/types/__tests__/stellar.js create mode 100644 src/js/types/__tests__/tezos.js create mode 100644 src/js/types/api.js create mode 100644 src/js/types/backend/blockchain.js create mode 100644 src/js/types/backend/transactions.js delete mode 100644 src/js/types/binance.js delete mode 100644 src/js/types/blockchainEvent.js delete mode 100644 src/js/types/cardano.js delete mode 100644 src/js/types/coinInfo.js delete mode 100644 src/js/types/eos.js delete mode 100644 src/js/types/ethereum.js create mode 100644 src/js/types/events.js delete mode 100644 src/js/types/fee.js delete mode 100644 src/js/types/lisk.js create mode 100644 src/js/types/misc.js delete mode 100644 src/js/types/nem.js create mode 100644 src/js/types/networks/binance.js create mode 100644 src/js/types/networks/bitcoin.js create mode 100644 src/js/types/networks/cardano.js create mode 100644 src/js/types/networks/coinInfo.js create mode 100644 src/js/types/networks/eos.js create mode 100644 src/js/types/networks/ethereum.js create mode 100644 src/js/types/networks/lisk.js create mode 100644 src/js/types/networks/nem.js create mode 100644 src/js/types/networks/ripple.js create mode 100644 src/js/types/networks/stellar.js create mode 100644 src/js/types/networks/tezos.js delete mode 100644 src/js/types/response.js delete mode 100644 src/js/types/ripple.js delete mode 100644 src/js/types/stellar.js delete mode 100644 src/js/types/tezos.js delete mode 100644 src/js/types/transactions.js delete mode 100644 src/js/types/trezor.js create mode 100644 src/js/types/trezor/device.js create mode 100644 src/js/types/trezor/management.js create mode 100644 src/js/types/trezor/protobuf.js delete mode 100644 src/js/types/uiRequest.js delete mode 100644 src/js/types/uiResponse.js create mode 100644 src/ts/types/__tests__/binance.ts create mode 100644 src/ts/types/__tests__/bitcoin.ts create mode 100644 src/ts/types/__tests__/blockchain.ts create mode 100644 src/ts/types/__tests__/cardano.ts create mode 100644 src/ts/types/__tests__/eos.ts create mode 100644 src/ts/types/__tests__/ethereum.ts create mode 100644 src/ts/types/__tests__/index.ts create mode 100644 src/ts/types/__tests__/lisk.ts create mode 100644 src/ts/types/__tests__/management.ts create mode 100644 src/ts/types/__tests__/misc.ts create mode 100644 src/ts/types/__tests__/nem.ts create mode 100644 src/ts/types/__tests__/ripple.ts create mode 100644 src/ts/types/__tests__/stellar.ts create mode 100644 src/ts/types/__tests__/tezos.ts create mode 100644 src/ts/types/account.d.ts create mode 100644 src/ts/types/api.d.ts create mode 100644 src/ts/types/backend/blockchain.d.ts create mode 100644 src/ts/types/backend/transactions.d.ts create mode 100644 src/ts/types/constants.d.ts create mode 100644 src/ts/types/events.d.ts create mode 100644 src/ts/types/index.d.ts create mode 100644 src/ts/types/misc.d.ts create mode 100644 src/ts/types/networks/binance.d.ts create mode 100644 src/ts/types/networks/bitcoin.d.ts create mode 100644 src/ts/types/networks/cardano.d.ts create mode 100644 src/ts/types/networks/coinInfo.d.ts create mode 100644 src/ts/types/networks/eos.d.ts create mode 100644 src/ts/types/networks/ethereum.d.ts create mode 100644 src/ts/types/networks/lisk.d.ts create mode 100644 src/ts/types/networks/nem.d.ts create mode 100644 src/ts/types/networks/ripple.d.ts create mode 100644 src/ts/types/networks/stellar.d.ts create mode 100644 src/ts/types/networks/tezos.d.ts create mode 100644 src/ts/types/params.d.ts create mode 100644 src/ts/types/trezor/device.d.ts create mode 100644 src/ts/types/trezor/management.d.ts create mode 100644 src/ts/types/trezor/protobuf.d.ts create mode 100644 src/ts/types/tsconfig.json diff --git a/.eslintignore b/.eslintignore index 7ea052209..887d7af82 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ **/_old/* **/npm/* **/npm-extended/* -**/build/* \ No newline at end of file +**/build/* +**/src/ts/* \ No newline at end of file diff --git a/.eslintrc b/.eslintrc index 471aeed06..e95117caf 100644 --- a/.eslintrc +++ b/.eslintrc @@ -33,7 +33,7 @@ "flowtype/use-flow-type": 1, "flowtype/object-type-delimiter": [ 2, - "comma" + "semicolon" ], "flowtype/delimiter-dangle": [ 2, diff --git a/scripts/build-npm-extended.js b/scripts/build-npm-extended.js index 798d8068c..a9a0a9aae 100644 --- a/scripts/build-npm-extended.js +++ b/scripts/build-npm-extended.js @@ -3,6 +3,7 @@ import path from 'path'; import packageJSON from '../package.json'; const src = path.resolve(__dirname, '../src/js'); +const ts = path.resolve(__dirname, '../src/ts/types'); const npm = path.resolve(__dirname, '../npm-extended'); const lib = path.resolve(__dirname, '../npm-extended/lib'); const dataSrc = path.resolve(__dirname, '../src/data'); @@ -13,6 +14,8 @@ fse.copySync(src, lib, { filter: function (src, dest) { // do not copy "*/_old" directory if (src.indexOf('_old') >= 0) return false; + // do not copy "types/__test__" directory + if (src.indexOf('types/__tests__') >= 0) return false; const ext = src.split('.').pop(); if (ext === 'js') { fse.copySync(src, dest + '.flow'); @@ -21,6 +24,15 @@ fse.copySync(src, lib, { }, }); +// copy typescript +fse.copySync(ts, `${lib}/typescript`, { + filter: function (src, dest) { + if (src.indexOf('types/__tests__') >= 0) return false; + if (src.indexOf('.json') >= 0) return false; + return true; + }, +}); + // copy assets (only json) fse.copySync(dataSrc, data, { filter: function (src, dest) { @@ -42,6 +54,7 @@ delete packageJSON.bin; delete packageJSON.private; packageJSON.version = packageJSON.version + '-extended'; packageJSON.main = 'lib/index.js'; +packageJSON.types = 'lib/typescript/index.d.ts'; fse.writeFileSync(path.resolve(npm, 'package.json'), JSON.stringify(packageJSON, null, ' '), 'utf-8'); diff --git a/scripts/generate-typescript.js b/scripts/generate-typescript.js new file mode 100644 index 000000000..039392299 --- /dev/null +++ b/scripts/generate-typescript.js @@ -0,0 +1,19 @@ + +const convertFlowToTypescript = (srcFile, destFile) => { + fse.readFile(srcFile, 'utf8', function (err, data) { + if (err) return console.log(err); + const result = data + .replace('/* @flow */', '') + .replace(/import type/g, 'import') + .replace(/\$Shape | TestPayload; - _expectedResponse: Array | ExpectedResponse; + _payload: any | any[]; + _expectedResponse: any | any[]; _doneFn: any; _expectFn: any; @@ -38,8 +33,8 @@ export class CoreEventHandler { // Public Functions setPayloads( - testPayload: Array | TestPayload, - expectedResponse: Array | ExpectedResponse, + testPayload: any | any[], + expectedResponse: any | any[], shouldWaitForLastResponse: boolean) { if (shouldWaitForLastResponse) { if (!Array.isArray(testPayload) || !Array.isArray(expectedResponse)) { @@ -62,11 +57,11 @@ export class CoreEventHandler { } // Public Functions: END - _getCurrentPayload(): TestPayload { + _getCurrentPayload(): any { return this._shouldWaitForLastResponse ? this._payload[this._responseIndex] : this._payload; } - _getCurrentExpectedResponse(): TestPayload { + _getCurrentExpectedResponse() { return this._shouldWaitForLastResponse ? this._expectedResponse[this._responseIndex] : this._expectedResponse; } @@ -126,8 +121,6 @@ export class CoreEventHandler { } _handleResponseEvent(event: Object) { - console.warn(event); - // ignore debugLinkDecision response if (event.payload.debugLink) return; @@ -150,6 +143,7 @@ export class CoreEventHandler { this._callCoreMessage(nextTestPayload, state); } else { const expectedResponse = this._getCurrentExpectedResponse(); + console.log('Response:', expectedResponse, event); this._compareExpectedResponseToActual(expectedResponse, event); this._doneFn(); } diff --git a/src/__tests__/core/applyFlags.spec.js b/src/__tests__/core/applyFlags.spec.js index a6e21b19b..731971b30 100644 --- a/src/__tests__/core/applyFlags.spec.js +++ b/src/__tests__/core/applyFlags.spec.js @@ -1,5 +1,8 @@ +/* @flow */ +import type { ApplyFlags } from '../../js/types'; + export const applyFlags = () => { - const testPayloads = [ + const testPayloads: ApplyFlags[] = [ { method: 'applyFlags', flags: 1, diff --git a/src/__tests__/core/applySettings.spec.js b/src/__tests__/core/applySettings.spec.js index 8a782edc8..de932375e 100644 --- a/src/__tests__/core/applySettings.spec.js +++ b/src/__tests__/core/applySettings.spec.js @@ -1,5 +1,8 @@ +/* @flow */ +import type { ApplySettings } from '../../js/types'; + export const applySettings = () => { - const testPayloads = [ + const testPayloads: ApplySettings[] = [ { method: 'applySettings', label: 'hello', diff --git a/src/__tests__/core/binanceSignTransaction.spec.js b/src/__tests__/core/binanceSignTransaction.spec.js index de65fef1c..0c45f045d 100644 --- a/src/__tests__/core/binanceSignTransaction.spec.js +++ b/src/__tests__/core/binanceSignTransaction.spec.js @@ -1,28 +1,11 @@ /* @flow */ - -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; - -type TransactionPayload = { - method: string, - path: string, - transaction: any, -}; - -type ExpectedResponse = { - payload: { - public_key: string, - signature: string, - }, -}; +import type { BinanceSignTransaction } from '../../js/types'; // vectors from https://github.com/binance-chain/javascript-sdk/blob/master/__tests__/fixtures/placeOrder.json // https://github.com/trezor/trezor-firmware/blob/master/core/tests/test_apps.binance.sign_tx.py -const transfer = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const transfer = () => { + const testPayloads: BinanceSignTransaction[] = [ { method: 'binanceSignTransaction', path: "m/44'/714'/0'/0/0", @@ -54,7 +37,7 @@ const transfer = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { public_key: '029729a52e4e3c2b4a4e52aa74033eedaf8ba1df5ab6d1f518fd69e67bbd309b0e', @@ -70,8 +53,8 @@ const transfer = (): SubtestSignTransaction => { }; }; -const placeOrder = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const placeOrder = () => { + const testPayloads: BinanceSignTransaction[] = [ { method: 'binanceSignTransaction', path: "m/44'/714'/0'/0/0", @@ -95,7 +78,7 @@ const placeOrder = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { public_key: '029729a52e4e3c2b4a4e52aa74033eedaf8ba1df5ab6d1f518fd69e67bbd309b0e', @@ -111,8 +94,8 @@ const placeOrder = (): SubtestSignTransaction => { }; }; -const cancelOrder = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const cancelOrder = () => { + const testPayloads: BinanceSignTransaction[] = [ { method: 'binanceSignTransaction', path: "m/44'/714'/0'/0/0", @@ -131,7 +114,7 @@ const cancelOrder = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { public_key: '029729a52e4e3c2b4a4e52aa74033eedaf8ba1df5ab6d1f518fd69e67bbd309b0e', @@ -147,7 +130,7 @@ const cancelOrder = (): SubtestSignTransaction => { }; }; -export const binanceSignTransaction = (): TestFunction => { +export const binanceSignTransaction = () => { const subtests = { transfer, placeOrder, diff --git a/src/__tests__/core/cardanoGetAddress.spec.js b/src/__tests__/core/cardanoGetAddress.spec.js index 770058907..7e15e5c27 100644 --- a/src/__tests__/core/cardanoGetAddress.spec.js +++ b/src/__tests__/core/cardanoGetAddress.spec.js @@ -1,25 +1,17 @@ /* @flow */ - -import type { - TestFunction, -} from 'flowtype/tests'; - -import type { - TestCardanoGetAddressPayload, - ExpectedCardanoGetAddressResponse, -} from 'flowtype/tests/cardano-get-address'; +import type { CardanoGetAddress } from '../../js/types'; // vectors from https://github.com/trezor/trezor-firmware/tree/master/python/trezorlib/tests/device_tests/test_msg_cardano_get_address.py -export const cardanoGetAddress = (): TestFunction => { - const testPayloads: Array = [ +export const cardanoGetAddress = () => { + const testPayloads: CardanoGetAddress[] = [ { method: 'cardanoGetAddress', path: "m/44'/1815'/0'/0/0", }, { method: 'cardanoGetAddress', - path: "m/44'/1815'", + path: [2147483697], }, { method: 'cardanoGetAddress', @@ -31,7 +23,7 @@ export const cardanoGetAddress = (): TestFunction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: 'Ae2tdPwUPEZLCq3sFv4wVYxwqjMH2nUzBVt1HFr4v87snYrtYq3d3bq2PUQ', diff --git a/src/__tests__/core/cardanoGetPublicKey.spec.js b/src/__tests__/core/cardanoGetPublicKey.spec.js index cb32b08c3..0165203d6 100644 --- a/src/__tests__/core/cardanoGetPublicKey.spec.js +++ b/src/__tests__/core/cardanoGetPublicKey.spec.js @@ -1,24 +1,17 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; - -import type { - TestCardanoGetPublicKeyPayload, - ExpectedCardanoGetPublicKeyResponse, -} from 'flowtype/tests/cardano-get-public-key'; +import type { CardanoGetPublicKey } from '../../js/types'; // https://github.com/trezor/trezor-firmware/blob/master/core/tests/test_apps.cardano.get_public_key.py -export const cardanoGetPublicKey = (): TestFunction => { - const testPayloads: Array = [ +export const cardanoGetPublicKey = () => { + const testPayloads: CardanoGetPublicKey[] = [ { method: 'cardanoGetPublicKey', path: "m/44'/1815'/0'/0/0'", }, { method: 'cardanoGetPublicKey', - path: "m/44'/1815'", + path: [2147483697], }, { method: 'cardanoGetPublicKey', @@ -30,7 +23,7 @@ export const cardanoGetPublicKey = (): TestFunction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { publicKey: 'a938c8554ae04616cfaae7cd0eb557475082c4e910242ce774967e0bd7492408cbf6ab47c8eb1a0477fc40b25dbb6c4a99454edb97d6fe5acedd3e238ef46fe0', @@ -38,9 +31,6 @@ export const cardanoGetPublicKey = (): TestFunction => { }, { success: false, // invalid path - // payload: { - // publicKey: '8c47ebce34234d04fd3dfbac33feaba6133e4e3d77c4b5ab18120ec6878ad4ce02ac67c59a8b0264724a635774ca2c242afa10d7ab70e2bf0a8f7d4bb10f1f7a', - // }, }, { payload: { diff --git a/src/__tests__/core/cardanoSignTransaction.spec.js b/src/__tests__/core/cardanoSignTransaction.spec.js index 2b4626c0c..b3729b7ae 100644 --- a/src/__tests__/core/cardanoSignTransaction.spec.js +++ b/src/__tests__/core/cardanoSignTransaction.spec.js @@ -1,18 +1,9 @@ /* @flow */ - -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; - -import type { - TestCardanoSignTransactionPayload, - ExpectedCardanoSignTransactionResponse, -} from 'flowtype/tests/cardano-sign-transaction'; +import type { CardanoSignTransaction } from '../../js/types'; // vectors from https://github.com/trezor/trezor-firmware/tree/master/python/trezorlib/tests/device_tests/test_msg_cardano_sign_transaction.py -const signMainnetNoChange = (): SubtestSignTransaction => { +const signMainnetNoChange = () => { const inputs = [ { prev_hash: '1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc', @@ -31,7 +22,7 @@ const signMainnetNoChange = (): SubtestSignTransaction => { '839f8200d818582482582008abb575fac4c39d5bf80683f7f0c37e48f4e3d96e37d1f6611919a7241b456600ff9f8282d818582183581cda4da43db3fca93695e71dab839e72271204d28b9d964d306b8800a8a0001a7a6916a51a00305becffa0', ]; - const testPayloads: Array = [ + const testPayloads: CardanoSignTransaction[] = [ { method: 'cardanoSignTransaction', inputs, @@ -41,7 +32,7 @@ const signMainnetNoChange = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { hash: '799c65e8a2c0b1dc4232611728c09d3f3eb0d811c077f8e9798f84605ef1b23d', @@ -57,7 +48,7 @@ const signMainnetNoChange = (): SubtestSignTransaction => { }; }; -const signMainnetChange = (): SubtestSignTransaction => { +const signMainnetChange = () => { const inputs = [ { prev_hash: '1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc', @@ -80,7 +71,7 @@ const signMainnetChange = (): SubtestSignTransaction => { '839f8200d818582482582008abb575fac4c39d5bf80683f7f0c37e48f4e3d96e37d1f6611919a7241b456600ff9f8282d818582183581cda4da43db3fca93695e71dab839e72271204d28b9d964d306b8800a8a0001a7a6916a51a00305becffa0', ]; - const testPayloads: Array = [ + const testPayloads: CardanoSignTransaction[] = [ { method: 'cardanoSignTransaction', inputs, @@ -90,7 +81,7 @@ const signMainnetChange = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { hash: '40bf94518f31aba7779dd99aa71fe867887bcb3e0bac2c6dc33d3f20ec74a6b1', @@ -106,7 +97,7 @@ const signMainnetChange = (): SubtestSignTransaction => { }; }; -const signTestnet = (): SubtestSignTransaction => { +const signTestnet = () => { const inputs = [ { prev_hash: '1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc', @@ -125,7 +116,7 @@ const signTestnet = (): SubtestSignTransaction => { '839f8200d818582482582008abb575fac4c39d5bf80683f7f0c37e48f4e3d96e37d1f6611919a7241b456600ff9f8282d818582183581cda4da43db3fca93695e71dab839e72271204d28b9d964d306b8800a8a0001a7a6916a51a00305becffa0', ]; - const testPayloads: Array = [ + const testPayloads: CardanoSignTransaction[] = [ { method: 'cardanoSignTransaction', inputs, @@ -135,7 +126,7 @@ const signTestnet = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { hash: '799c65e8a2c0b1dc4232611728c09d3f3eb0d811c077f8e9798f84605ef1b23d', @@ -151,7 +142,7 @@ const signTestnet = (): SubtestSignTransaction => { }; }; -export const cardanoSignTransaction = (): TestFunction => { +export const cardanoSignTransaction = () => { const availableSubtests = { signMainnetNoChange, signMainnetChange, diff --git a/src/__tests__/core/common.js b/src/__tests__/core/common.js index b12803559..8fd86eb3e 100644 --- a/src/__tests__/core/common.js +++ b/src/__tests__/core/common.js @@ -19,7 +19,6 @@ export const settings = { webusb: true, pendingTransportEvent: true, supportedBrowser: true, - extension: null, manifest: { email: 'test@satoshilabs.com', appUrl: 'test@satoshilabs.com', diff --git a/src/__tests__/core/core.test.js b/src/__tests__/core/core.test.js index 3343601a3..c79a743ba 100644 --- a/src/__tests__/core/core.test.js +++ b/src/__tests__/core/core.test.js @@ -10,16 +10,10 @@ import { CORE_EVENT } from '../../js/constants'; import * as DEVICE from '../../js/constants/device'; import * as IFRAME from '../../js/constants/iframe'; -import type { - TestPayload, - ExpectedResponse, - TestFunction, -} from 'flowtype/tests'; - let core: Core; // Functions -const startTestingPayloads = (testPayloads: Array, expectedResponses: Array, specNames: Array, isTestingPassphrase: boolean) => { +const startTestingPayloads = (testPayloads: any[], expectedResponses: any[], specNames: string[], isTestingPassphrase: boolean) => { if (isTestingPassphrase) { it('passphrase', async (done) => { const handler = new CoreEventHandler(core, expect, done); @@ -59,7 +53,7 @@ const MNEMONICS_SECRET = { 'mnemonic_abandon': '6162616e646f6e206162616e646f6e206162616e646f6e206162616e646f6e206162616e646f6e206162616e646f6e206162616e646f6e206162616e646f6e206162616e646f6e206162616e646f6e206162616e646f6e2061626f7574', }; -const onBeforeEach = async (test: TestFunction, done: Function): Promise => { +const onBeforeEach = async (test: any, done: Function): Promise => { core = await initCore(settings); const mnemonics = Array.isArray(test.mnemonic) ? test.mnemonic : MNEMONICS[test.mnemonic]; @@ -114,7 +108,7 @@ const onBeforeEach = async (test: TestFunction, done: Function): Promise => await initTransport(settings); }; -const runTest = (test: TestFunction, subtestNames: Array) => { +const runTest = (test: any, subtestNames: Array) => { const { testName } = test; const hasSubtests = !!test.subtests; const isTestingPassphrase = testName === 'passphrase'; @@ -215,8 +209,8 @@ testsArr.forEach(testItem => { // Iterate through the config object and run each test for (const testName in config) { - const subtestNames: Array = config[testName]; + const subtestNames: string[] = config[testName]; - const test: TestFunction = testFunctions[testName](); + const test = testFunctions[testName](); runTest(test, subtestNames); } diff --git a/src/__tests__/core/eosGetPublicKey.spec.js b/src/__tests__/core/eosGetPublicKey.spec.js index 62e05ff8a..29b40f58b 100644 --- a/src/__tests__/core/eosGetPublicKey.spec.js +++ b/src/__tests__/core/eosGetPublicKey.spec.js @@ -1,18 +1,13 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; +import type { Bundle, EosGetPublicKey } from '../../js/types'; -import type { - TestEosGetPublicKeyPayload, - ExpectedEosGetPublicKeyResponse, -} from 'flowtype/tests/eos-get-public-key'; +type Payload = EosGetPublicKey | Bundle; // test vectors: // https://github.com/trezor/trezor-firmware/blob/master/core/tests/test_apps.eos.get_public_key.py -export const eosGetPublicKey = (): TestFunction => { - const testPayloads: Array = [ +export const eosGetPublicKey = () => { + const testPayloads: Payload[] = [ { method: 'eosGetPublicKey', path: "m/44'/194'/0'/0/0", @@ -42,7 +37,7 @@ export const eosGetPublicKey = (): TestFunction => { ], }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { wifPublicKey: 'EOS6zpSNY1YoLxNt2VsvJjoDfBueU6xC1M1ERJw1UoekL1NHn8KNA', diff --git a/src/__tests__/core/eosSignTransaction.spec.js b/src/__tests__/core/eosSignTransaction.spec.js index 67361315a..8d208aa48 100644 --- a/src/__tests__/core/eosSignTransaction.spec.js +++ b/src/__tests__/core/eosSignTransaction.spec.js @@ -1,20 +1,11 @@ -/* todo: flow */ -/* eslint-disable */ /* @flow */ -import type { - TestFunction, - SubtestEosSignTransaction, -} from 'flowtype/tests'; -import type { - TestEosSignTransactionPayload, - ExpectedEosSignTransactionResponse, -} from 'flowtype/tests/eos-sign-transaction'; +import type { EosSignTransaction } from '../../js/types'; // test vectors: // https://github.com/trezor/trezor-firmware/blob/master/python/trezorlib/tests/device_tests/test_msg_eos_signtx.py -const transfer = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const transfer = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -41,14 +32,14 @@ const transfer = (): SubtestEosSignTransaction => { quantity: '1.0000 EOS', memo: 'testtest', }, - }] + }], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { - signature: "SIG_K1_JveDuew7oyKjgLmApra3NmKArx3QH6HVmatgkLYeUYWv7aGaoQPFyjBwAdcxuo2Skq9wRgsizos92h9iq9i5JbeHh7zNuo", + signature: 'SIG_K1_JveDuew7oyKjgLmApra3NmKArx3QH6HVmatgkLYeUYWv7aGaoQPFyjBwAdcxuo2Skq9wRgsizos92h9iq9i5JbeHh7zNuo', }, }, ]; @@ -60,8 +51,8 @@ const transfer = (): SubtestEosSignTransaction => { }; }; -const delegate = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const delegate = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -89,14 +80,14 @@ const delegate = (): SubtestEosSignTransaction => { stake_cpu_quantity: '1.0000 EOS', transfer: true, }, - }] + }], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { - signature: "SIG_K1_Juju8Wjzyn38nuvgS1KT3koKQLHxMMfqVHrp5jMjv4QLU2pUG6EbiJD7D1EHE6xP8DRuwFLVUNR38nTyUKC1Eiz33WocUE", + signature: 'SIG_K1_Juju8Wjzyn38nuvgS1KT3koKQLHxMMfqVHrp5jMjv4QLU2pUG6EbiJD7D1EHE6xP8DRuwFLVUNR38nTyUKC1Eiz33WocUE', }, }, ]; @@ -108,8 +99,8 @@ const delegate = (): SubtestEosSignTransaction => { }; }; -const undelegate = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const undelegate = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -135,16 +126,15 @@ const undelegate = (): SubtestEosSignTransaction => { receiver: 'maximaximaxi', unstake_net_quantity: '1.0000 EOS', unstake_cpu_quantity: '1.0000 EOS', - transfer: true, }, - }] + }], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { - signature: "SIG_K1_K3XXUzCUkT2HEdrJTz1CdDDKZbLMShmyEjknQozGhy4F21yUetr1nEe2vUgmGebk2nyYe49R5nkA155J5yFBBaLsTcSdBL", + signature: 'SIG_K1_K3XXUzCUkT2HEdrJTz1CdDDKZbLMShmyEjknQozGhy4F21yUetr1nEe2vUgmGebk2nyYe49R5nkA155J5yFBBaLsTcSdBL', }, }, ]; @@ -156,8 +146,8 @@ const undelegate = (): SubtestEosSignTransaction => { }; }; -const buyRam = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const buyRam = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -179,18 +169,18 @@ const buyRam = (): SubtestEosSignTransaction => { }], name: 'buyram', data: { - payer: "miniminimini", - receiver: "miniminimini", + payer: 'miniminimini', + receiver: 'miniminimini', quant: '1000000000.0000 EOS', }, - }] + }], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { - signature: "SIG_K1_K4gU5S9g7rS6MojaPwWppEBCBbPrJm1pyJtVR9mts1sBq5xyN7nJv3FGnrBR7ByjanboCtK4ogY35sNPFX1F5qoZW7BkF9", + signature: 'SIG_K1_K4gU5S9g7rS6MojaPwWppEBCBbPrJm1pyJtVR9mts1sBq5xyN7nJv3FGnrBR7ByjanboCtK4ogY35sNPFX1F5qoZW7BkF9', }, }, ]; @@ -202,8 +192,8 @@ const buyRam = (): SubtestEosSignTransaction => { }; }; -const buyRamBytes = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const buyRamBytes = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -225,18 +215,18 @@ const buyRamBytes = (): SubtestEosSignTransaction => { }], name: 'buyrambytes', data: { - payer: "miniminimini", - receiver: "miniminimini", + payer: 'miniminimini', + receiver: 'miniminimini', bytes: 1023, }, - }] + }], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { - signature: "SIG_K1_K618wK9f27YxHoPG9hoUCsazZXzxumBj3V9MqcTUh9yCocvP1uFZQAmGmZLhsAtuC2TRR4gtqbeQj57FniYd5i4faQCb6t", + signature: 'SIG_K1_K618wK9f27YxHoPG9hoUCsazZXzxumBj3V9MqcTUh9yCocvP1uFZQAmGmZLhsAtuC2TRR4gtqbeQj57FniYd5i4faQCb6t', }, }, ]; @@ -248,8 +238,8 @@ const buyRamBytes = (): SubtestEosSignTransaction => { }; }; -const sellRam = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const sellRam = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -271,17 +261,17 @@ const sellRam = (): SubtestEosSignTransaction => { }], name: 'sellram', data: { - account: "miniminimini", + account: 'miniminimini', bytes: 1024, }, - }] + }], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { - signature: "SIG_K1_JusrCS7H5DR53qke7edoWvJuLiQS2VQ84CsN5NWmWYVa7wmJVjh3Hcg5hH42zF8KjAmmvHtaJZ3wkortTW9eds1eoiKsrj", + signature: 'SIG_K1_JusrCS7H5DR53qke7edoWvJuLiQS2VQ84CsN5NWmWYVa7wmJVjh3Hcg5hH42zF8KjAmmvHtaJZ3wkortTW9eds1eoiKsrj', }, }, ]; @@ -293,8 +283,8 @@ const sellRam = (): SubtestEosSignTransaction => { }; }; -const voteProducer = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const voteProducer = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -316,48 +306,48 @@ const voteProducer = (): SubtestEosSignTransaction => { }], name: 'voteproducer', data: { - voter: "miniminimini", + voter: 'miniminimini', proxy: '', producers: [ - "argentinaeos", - "bitfinexeos1", - "cryptolions1", - "eos42freedom", - "eosamsterdam", - "eosasia11111", - "eosauthority", - "eosbeijingbp", - "eosbixinboot", - "eoscafeblock", - "eoscanadacom", - "eoscannonchn", - "eoscleanerbp", - "eosdacserver", - "eosfishrocks", - "eosflytomars", - "eoshuobipool", - "eosisgravity", - "eoslaomaocom", - "eosliquideos", - "eosnewyorkio", - "eosriobrazil", - "eosswedenorg", - "eostribeprod", - "helloeoscnbp", - "jedaaaaaaaaa", - "libertyblock", - "starteosiobp", - "teamgreymass", + 'argentinaeos', + 'bitfinexeos1', + 'cryptolions1', + 'eos42freedom', + 'eosamsterdam', + 'eosasia11111', + 'eosauthority', + 'eosbeijingbp', + 'eosbixinboot', + 'eoscafeblock', + 'eoscanadacom', + 'eoscannonchn', + 'eoscleanerbp', + 'eosdacserver', + 'eosfishrocks', + 'eosflytomars', + 'eoshuobipool', + 'eosisgravity', + 'eoslaomaocom', + 'eosliquideos', + 'eosnewyorkio', + 'eosriobrazil', + 'eosswedenorg', + 'eostribeprod', + 'helloeoscnbp', + 'jedaaaaaaaaa', + 'libertyblock', + 'starteosiobp', + 'teamgreymass', ], }, - }] + }], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { - signature: "SIG_K1_JxgVhc6ExoTHee3Djrciwmmf2Xck7NLgvAtC2gfgV4Wj2AqMXEb6aKMhpUcTV59VTR1DdnPF1XbiCcJViJiU3zsk1kQz89", + signature: 'SIG_K1_JxgVhc6ExoTHee3Djrciwmmf2Xck7NLgvAtC2gfgV4Wj2AqMXEb6aKMhpUcTV59VTR1DdnPF1XbiCcJViJiU3zsk1kQz89', }, }, ]; @@ -369,8 +359,8 @@ const voteProducer = (): SubtestEosSignTransaction => { }; }; -const refund = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const refund = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -392,16 +382,16 @@ const refund = (): SubtestEosSignTransaction => { }], name: 'refund', data: { - owner: "miniminimini", + owner: 'miniminimini', }, - }] + }], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { - signature: "SIG_K1_JwWZSSKQZL1hCdMmwEAKjs3r15kau5gaBrQczKy65QANANzovV6U4XbVUZQkZzaQrNGYAtgxrU1WJ1smWgXZNqtKVQUZqc", + signature: 'SIG_K1_JwWZSSKQZL1hCdMmwEAKjs3r15kau5gaBrQczKy65QANANzovV6U4XbVUZQkZzaQrNGYAtgxrU1WJ1smWgXZNqtKVQUZqc', }, }, ]; @@ -413,8 +403,8 @@ const refund = (): SubtestEosSignTransaction => { }; }; -const updateAuth = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const updateAuth = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -449,7 +439,7 @@ const updateAuth = (): SubtestEosSignTransaction => { { weight: 2, key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', - } + }, ], accounts: [{ permission: { @@ -461,19 +451,19 @@ const updateAuth = (): SubtestEosSignTransaction => { waits: [ { wait_sec: 55, - weight: 4 - } - ] + weight: 4, + }, + ], }, }, - }] + }], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { - signature: "SIG_K1_JuNuwmJm7nLfpxbCqXZMxZoU56TzBh8F5PH7ZyPvQMti6QxJbErDGbKCAaHhoRxwWKzv5kj6kX3WyWys6jAzVe9pDhXB1k", + signature: 'SIG_K1_JuNuwmJm7nLfpxbCqXZMxZoU56TzBh8F5PH7ZyPvQMti6QxJbErDGbKCAaHhoRxwWKzv5kj6kX3WyWys6jAzVe9pDhXB1k', }, }, ]; @@ -485,8 +475,8 @@ const updateAuth = (): SubtestEosSignTransaction => { }; }; -const deleteAuth = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const deleteAuth = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -511,14 +501,14 @@ const deleteAuth = (): SubtestEosSignTransaction => { account: 'maximaximaxi', permission: 'active', }, - }] + }], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { - signature: "SIG_K1_KjPTp8jCtgBKQWqsndhrH4pdCGiks76Q1qBt9e8MtexW6FQg3FzfVFKDU4SvyVDyFs3worn6RyW6WYavw76ACNqcqkCYjf", + signature: 'SIG_K1_KjPTp8jCtgBKQWqsndhrH4pdCGiks76Q1qBt9e8MtexW6FQg3FzfVFKDU4SvyVDyFs3worn6RyW6WYavw76ACNqcqkCYjf', }, }, ]; @@ -530,8 +520,8 @@ const deleteAuth = (): SubtestEosSignTransaction => { }; }; -const linkAuth = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const linkAuth = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -558,14 +548,14 @@ const linkAuth = (): SubtestEosSignTransaction => { type: 'whatever', requirement: 'active', }, - }] + }], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { - signature: "SIG_K1_Kgs3JdLNqTyGz7uyNiuYLK8sy5qhVQWozrBY7bJWKsjrWAxNyDQUKqHsHmTom5rGY21vYdXmCpi4msU6XeMgWvi4bsBxTx", + signature: 'SIG_K1_Kgs3JdLNqTyGz7uyNiuYLK8sy5qhVQWozrBY7bJWKsjrWAxNyDQUKqHsHmTom5rGY21vYdXmCpi4msU6XeMgWvi4bsBxTx', }, }, ]; @@ -577,8 +567,8 @@ const linkAuth = (): SubtestEosSignTransaction => { }; }; -const unlinkAuth = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const unlinkAuth = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -604,11 +594,11 @@ const unlinkAuth = (): SubtestEosSignTransaction => { code: 'eosbet', type: 'whatever', }, - }] + }], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'SIG_K1_K1ioB5KMRC2mmTwYsGwsFU51ENp1XdSBUrb4bxUCLYhoq7Y733WaLZ4Soq9fdrkaJS8uJ3R7Z1ZjyEKRHU8HU4s4MA86zB', @@ -623,8 +613,8 @@ const unlinkAuth = (): SubtestEosSignTransaction => { }; }; -const newAccount = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const newAccount = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -655,7 +645,7 @@ const newAccount = (): SubtestEosSignTransaction => { { key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', weight: 1, - } + }, ], accounts: [], waits: [], @@ -666,7 +656,7 @@ const newAccount = (): SubtestEosSignTransaction => { { key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', weight: 1, - } + }, ], accounts: [], waits: [], @@ -677,7 +667,7 @@ const newAccount = (): SubtestEosSignTransaction => { account: 'eosio', name: 'buyrambytes', authorization: [ - {actor: 'miniminimini', permission: 'active'} + {actor: 'miniminimini', permission: 'active'}, ], data: { payer: 'miniminimini', @@ -686,10 +676,10 @@ const newAccount = (): SubtestEosSignTransaction => { }, }, { - account: "eosio", - name: "delegatebw", + account: 'eosio', + name: 'delegatebw', authorization: [ - {actor: "miniminimini", permission: "active"} + {actor: 'miniminimini', permission: 'active'}, ], data: { from: 'miniminimini', @@ -698,12 +688,12 @@ const newAccount = (): SubtestEosSignTransaction => { stake_cpu_quantity: '1.0000 EOS', transfer: true, }, - } - ] + }, + ], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'SIG_K1_KhjdS1gKUHR4jKbN3YSdNbPbEqnUVM1Nt6ybdzEAwsUtfbCRJDwpQwPRuEau48CyvhYC5fKo5BiWMPQJbQPrg5ErHThieU', @@ -718,8 +708,8 @@ const newAccount = (): SubtestEosSignTransaction => { }; }; -const setContract = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const setContract = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -735,26 +725,26 @@ const setContract = (): SubtestEosSignTransaction => { }, actions: [ { - account: "eosio1", - name: "setcode", + account: 'eosio1', + name: 'setcode', authorization: [ - {"actor": "ednazztokens", "permission": "active"} + {'actor': 'ednazztokens', 'permission': 'active'}, ], data: '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', }, { - account: "eosio1", - name: "setabi", + account: 'eosio1', + name: 'setabi', authorization: [ - {"actor": "ednazztokens", "permission": "active"} + {'actor': 'ednazztokens', 'permission': 'active'}, ], data: '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', }, - ] + ], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'SIG_K1_KiG8c8t2SQkSfrEbD9BwJoYT133BPFLx3gu8sAzJadXyFk1EXKYAsgx4tkjt79G6ofuaQzJPAfDqy1FSpgLRbhbeFH9omd', @@ -769,8 +759,8 @@ const setContract = (): SubtestEosSignTransaction => { }; }; -const unknown = (): SubtestEosSignTransaction => { - const testPayloads: Array = [ +const unknown = () => { + const testPayloads: EosSignTransaction[] = [ { method: 'eosSignTransaction', path: "m/44'/194'/0'/0/0", @@ -786,18 +776,18 @@ const unknown = (): SubtestEosSignTransaction => { }, actions: [ { - "account": "foocontract", - "name": "baraction", - "authorization": [ - {"actor": "miniminimini", "permission": "active"} + 'account': 'foocontract', + 'name': 'baraction', + 'authorization': [ + {'actor': 'miniminimini', 'permission': 'active'}, ], - "data": "deadbeef", + 'data': 'deadbeef', }, - ] + ], }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'SIG_K1_JvoJtrHpQJjHAZzEBhiQm75iimYabcAVNDvz8mkempLh6avSJgnXm5JzCCUEBjDtW3syByfXknmgr93Sw3P9RNLnwySmv6', @@ -812,7 +802,7 @@ const unknown = (): SubtestEosSignTransaction => { }; }; -export const eosSignTransaction = (): TestFunction => { +export const eosSignTransaction = () => { const testName = 'EosSignTransaction'; return { @@ -836,4 +826,4 @@ export const eosSignTransaction = (): TestFunction => { }, mnemonic: 'mnemonic_12', }; -}; \ No newline at end of file +}; diff --git a/src/__tests__/core/ethereumGetAddress.spec.js b/src/__tests__/core/ethereumGetAddress.spec.js index fb3aa3026..56c883bcb 100644 --- a/src/__tests__/core/ethereumGetAddress.spec.js +++ b/src/__tests__/core/ethereumGetAddress.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; +import type { EthereumGetAddress } from '../../js/types'; -import type { - TestEthereumGetAddressPayload, - ExpectedEthereumGetAddressResponse, -} from 'flowtype/tests/ethereum-get-address'; - -export const ethereumGetAddress = (): TestFunction => { - const testPayloads: Array = [ +export const ethereumGetAddress = () => { + const testPayloads: EthereumGetAddress[] = [ { method: 'ethereumGetAddress', path: "m/44'/60'/1", @@ -31,7 +24,7 @@ export const ethereumGetAddress = (): TestFunction => { path: "m/44'/199'/0'/0/9999", }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: '0xeD46C856D0c79661cF7d40FFE0C0C5077c00E898', diff --git a/src/__tests__/core/ethereumGetPublicKey.spec.js b/src/__tests__/core/ethereumGetPublicKey.spec.js index babe8cac1..847e20842 100644 --- a/src/__tests__/core/ethereumGetPublicKey.spec.js +++ b/src/__tests__/core/ethereumGetPublicKey.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; +import type { EthereumGetPublicKey } from '../../js/types'; -import type { - TestEthereumGetAddressPayload, - ExpectedEthereumGetAddressResponse, -} from 'flowtype/tests/ethereum-get-address'; - -export const ethereumGetPublicKey = (): TestFunction => { - const testPayloads: Array = [ +export const ethereumGetPublicKey = () => { + const testPayloads: EthereumGetPublicKey[] = [ { method: 'ethereumGetPublicKey', path: "m/44'/60'/0'", @@ -23,7 +16,7 @@ export const ethereumGetPublicKey = (): TestFunction => { path: "m/44'/60'/0'/0/0", }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { xpub: 'xpub6D54vV8eUYHMVBZCnz4SLjuiQngXURVCGKKGoJrWUDRegdMByLTJKfRs64q3UKiQCsSHJPtCQehTvERczdghS7gb8oedWSyNDtBU1zYDJtb', diff --git a/src/__tests__/core/ethereumSignMessage.spec.js b/src/__tests__/core/ethereumSignMessage.spec.js index e6f6088c5..d7ec075d6 100644 --- a/src/__tests__/core/ethereumSignMessage.spec.js +++ b/src/__tests__/core/ethereumSignMessage.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; +import type { EthereumSignMessage } from '../../js/types'; -import type { - TestEthereumSignMessagePayload, - ExpectedEthereumSignMessageResponse, -} from 'flowtype/tests/ethereum-sign-message'; - -export const ethereumSignMessage = (): TestFunction => { - const testPayloads: Array = [ +export const ethereumSignMessage = () => { + const testPayloads: EthereumSignMessage[] = [ { method: 'ethereumSignMessage', path: "m/44'/60'/0'", @@ -21,7 +14,7 @@ export const ethereumSignMessage = (): TestFunction => { message: 'VeryLongMessage!'.repeat(64), }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: '0xAE2B111b634f8FB3942B13b98c824B0F1060cacB', diff --git a/src/__tests__/core/ethereumSignTransaction.spec.js b/src/__tests__/core/ethereumSignTransaction.spec.js index 0987c45fa..2c87170dc 100644 --- a/src/__tests__/core/ethereumSignTransaction.spec.js +++ b/src/__tests__/core/ethereumSignTransaction.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestEthereumSignTransaction, -} from 'flowtype/tests'; -import type { - TestEthereumSignTransactionPayload, - ExpectedEthereumSignTransactionResponse, -} from 'flowtype/tests/ethereum-sign-transaction'; +import type { EthereumSignTransaction } from '../../js/types'; -const knownErc20Token = (): SubtestEthereumSignTransaction => { - const testPayloads: Array = [ +const knownErc20Token = () => { + const testPayloads: EthereumSignTransaction[] = [ { method: 'ethereumSignTransaction', path: "m/44'/60'/0'", @@ -24,7 +17,7 @@ const knownErc20Token = (): SubtestEthereumSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { r: '0xaa0c28d61c7c9382a256ead609d5b713cfe17c3aa3a6facb6b60342883db448e', @@ -40,8 +33,8 @@ const knownErc20Token = (): SubtestEthereumSignTransaction => { }; }; -const unknownErc20Token = (): SubtestEthereumSignTransaction => { - const testPayloads: Array = [ +const unknownErc20Token = () => { + const testPayloads: EthereumSignTransaction[] = [ { method: 'ethereumSignTransaction', path: "m/44'/60'/0'", @@ -56,7 +49,7 @@ const unknownErc20Token = (): SubtestEthereumSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { r: '0xafd33dc30cf829e3fde2575f189b9f80a6e7cfe3bbad8554f1015b29c33fb13d', @@ -72,8 +65,8 @@ const unknownErc20Token = (): SubtestEthereumSignTransaction => { }; }; -const noData = (): SubtestEthereumSignTransaction => { - const testPayloads: Array = [ +const noData = () => { + const testPayloads: EthereumSignTransaction[] = [ { method: 'ethereumSignTransaction', path: "m/44'/60'/0'", @@ -97,7 +90,7 @@ const noData = (): SubtestEthereumSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { r: '0xff2676c3d23f4ed59b41a284348b6e4cc56fa4b4c06ab2cd2cfa0fc85d3d5b72', @@ -121,8 +114,8 @@ const noData = (): SubtestEthereumSignTransaction => { }; }; -const data = (): SubtestEthereumSignTransaction => { - const testPayloads: Array = [ +const data = () => { + const testPayloads: EthereumSignTransaction[] = [ { method: 'ethereumSignTransaction', path: "m/44'/60'/0'", @@ -149,7 +142,7 @@ const data = (): SubtestEthereumSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { r: '0xc07ca9b87ebf87620396a16cd575ac68dbef0eb0b22481f8f62facfe40fc4c7a', @@ -173,8 +166,8 @@ const data = (): SubtestEthereumSignTransaction => { }; }; -const message = (): SubtestEthereumSignTransaction => { - const testPayloads: Array = [ +const message = () => { + const testPayloads: EthereumSignTransaction[] = [ { method: 'ethereumSignTransaction', path: "m/44'/60'/0'", @@ -188,7 +181,7 @@ const message = (): SubtestEthereumSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { r: '0xce5c299678f8ba333c219a3f70f01f7281bf4716cf4c2d47518f689cf3344dc4', @@ -205,8 +198,8 @@ const message = (): SubtestEthereumSignTransaction => { }; }; -const newContract = (): SubtestEthereumSignTransaction => { - const testPayloads: Array = [ +const newContract = () => { + const testPayloads: EthereumSignTransaction[] = [ { method: 'ethereumSignTransaction', path: "m/44'/60'/0'", @@ -231,7 +224,7 @@ const newContract = (): SubtestEthereumSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: false, payload: { @@ -254,8 +247,8 @@ const newContract = (): SubtestEthereumSignTransaction => { }; }; -const sanityChecks = (): SubtestEthereumSignTransaction => { - const testPayloads: Array = [ +const sanityChecks = () => { + const testPayloads: EthereumSignTransaction[] = [ { // Gas overflow method: 'ethereumSignTransaction', @@ -272,6 +265,7 @@ const sanityChecks = (): SubtestEthereumSignTransaction => { // No gas price method: 'ethereumSignTransaction', path: "m/44'/60'/0'", + // $FlowIssue: intentional transaction: { nonce: '0x1e240', gasLimit: '0x2710', @@ -283,6 +277,7 @@ const sanityChecks = (): SubtestEthereumSignTransaction => { // No gas limit method: 'ethereumSignTransaction', path: "m/44'/60'/0'", + // $FlowIssue: intentional transaction: { nonce: '0x1e240', gasPrice: '0x2710', @@ -294,6 +289,7 @@ const sanityChecks = (): SubtestEthereumSignTransaction => { // No nonce method: 'ethereumSignTransaction', path: "m/44'/60'/0'", + // $FlowIssue: intentional transaction: { gasLimit: '0x2710', to: '0x1d1c328764a41bda0492b66baa30c4a339ff85ef', @@ -301,7 +297,7 @@ const sanityChecks = (): SubtestEthereumSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: false, payload: { @@ -320,8 +316,8 @@ const sanityChecks = (): SubtestEthereumSignTransaction => { }; }; -const noDataEip155 = (): SubtestEthereumSignTransaction => { - const testPayloads: Array = [ +const noDataEip155 = () => { + const testPayloads: EthereumSignTransaction[] = [ { method: 'ethereumSignTransaction', path: "m/44'/1'/0'/0/0", @@ -347,7 +343,7 @@ const noDataEip155 = (): SubtestEthereumSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { r: '0x39aa7798b8debf2db32945d929d25bd9c514e7f7e6a1f1c72bcbf0600f9f2db3', @@ -371,8 +367,8 @@ const noDataEip155 = (): SubtestEthereumSignTransaction => { }; }; -const dataEip155 = (): SubtestEthereumSignTransaction => { - const testPayloads: Array = [ +const dataEip155 = () => { + const testPayloads: EthereumSignTransaction[] = [ { method: 'ethereumSignTransaction', path: "m/44'/1'/0'/0/0", @@ -426,7 +422,7 @@ const dataEip155 = (): SubtestEthereumSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { r: '0xdbae2f01331e274f24831afadaa86f1da08c9cf9e28b120acc17ec4a748c533a', @@ -464,7 +460,7 @@ const dataEip155 = (): SubtestEthereumSignTransaction => { }; }; -export const ethereumSignTransaction = (): TestFunction => { +export const ethereumSignTransaction = () => { const testName = 'EthereumSignTransaction'; const availableSubtests = { knownErc20Token, diff --git a/src/__tests__/core/ethereumVerifyMessage.spec.js b/src/__tests__/core/ethereumVerifyMessage.spec.js index 2fdc7a6f0..19a3b96a4 100644 --- a/src/__tests__/core/ethereumVerifyMessage.spec.js +++ b/src/__tests__/core/ethereumVerifyMessage.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; +import type { EthereumVerifyMessage } from '../../js/types'; -import type { - TestEthereumVerifyMessagePayload, - ExpectedEthereumVerifyMessageResponse, -} from 'flowtype/tests/ethereum-verify-message'; - -export const ethereumVerifyMessage = (): TestFunction => { - const testPayloads: Array = [ +export const ethereumVerifyMessage = () => { + const testPayloads: EthereumVerifyMessage[] = [ { method: 'ethereumVerifyMessage', address: 'cb3864960e8db1a751212c580af27ee8867d688f', @@ -23,7 +16,7 @@ export const ethereumVerifyMessage = (): TestFunction => { message: 'VeryLongMessage!'.repeat(64), }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, { success: true }, ]; diff --git a/src/__tests__/core/getAccountInfo.spec.js b/src/__tests__/core/getAccountInfo.spec.js index b6d1bd9fa..e714cb886 100644 --- a/src/__tests__/core/getAccountInfo.spec.js +++ b/src/__tests__/core/getAccountInfo.spec.js @@ -1,24 +1,17 @@ /* @flow */ -import type { - TestFunction, - SubtestGetAccountInfo, -} from 'flowtype/tests'; -import type { - TestGetAccountInfoPayload, - ExpectedGetAccountInfoResponse, -} from 'flowtype/tests/get-account-info'; +import type { GetAccountInfo } from '../../js/types'; // Path specifies a first account (no address index) // Should return a xpub for the first account -const firstSegwitAccount = (): SubtestGetAccountInfo => { - const testPayloads: Array = [ +const firstSegwitAccount = () => { + const testPayloads: GetAccountInfo[] = [ { method: 'getAccountInfo', coin: 'Bitcoin', path: "m/49'/0'/0'", }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { descriptor: 'ypub6Y5EDdQK9nQzpNeMtgXxhBB3SoLk2SyR2MFLQYsBkAusAHpaQNxTTwefgnL9G3oFGrRS9VkVvyY1SaApFAzQPZ99wto5etdReeE3XFkkMZt', @@ -33,15 +26,15 @@ const firstSegwitAccount = (): SubtestGetAccountInfo => { }; }; -const firstLegacyAccount = (): SubtestGetAccountInfo => { - const testPayloads: Array = [ +const firstLegacyAccount = () => { + const testPayloads: GetAccountInfo[] = [ { method: 'getAccountInfo', coin: 'Bitcoin', path: "m/44'/0'/0'", }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { descriptor: 'xpub6D1weXBcFAo8CqBbpP4TbH5sxQH8ZkqC5pDEvJ95rNNBZC9zrKmZP2fXMuve7ZRBe18pWQQsGg68jkq24mZchHwYENd8cCiSb71u3KD4AFH', @@ -58,15 +51,15 @@ const firstLegacyAccount = (): SubtestGetAccountInfo => { // Path specifies a zero balance address // Should return a fresh address -const emptyAccount = (): SubtestGetAccountInfo => { - const testPayloads: Array = [ +const emptyAccount = () => { + const testPayloads: GetAccountInfo[] = [ { method: 'getAccountInfo', coin: 'Testnet', path: "m/49'/1'/256'", }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { balance: '0', @@ -86,15 +79,15 @@ const emptyAccount = (): SubtestGetAccountInfo => { // Specifies an xpub instead of a path // Should get same response as with the path -const segwitAccountFromDescriptor = (): SubtestGetAccountInfo => { - const testPayloads: Array = [ +const segwitAccountFromDescriptor = () => { + const testPayloads: GetAccountInfo[] = [ { method: 'getAccountInfo', coin: 'Bitcoin', descriptor: 'ypub6Y5EDdQK9nQzpNeMtgXxhBB3SoLk2SyR2MFLQYsBkAusAHpaQNxTTwefgnL9G3oFGrRS9VkVvyY1SaApFAzQPZ99wto5etdReeE3XFkkMZt', }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { empty: false, @@ -110,15 +103,15 @@ const segwitAccountFromDescriptor = (): SubtestGetAccountInfo => { }; }; -const legacyAccountFromDescriptor = (): SubtestGetAccountInfo => { - const testPayloads: Array = [ +const legacyAccountFromDescriptor = () => { + const testPayloads: GetAccountInfo[] = [ { method: 'getAccountInfo', coin: 'Bitcoin', descriptor: 'xpub6DExuxjQ16sWy5TF4KkLV65YGqCJ5pyv7Ej7d9yJNAXz7C1M9intqszXfaNZG99KsDJdQ29wUKBTZHZFXUaPbKTZ5Z6f4yowNvAQ8fEJw2G', }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { descriptor: 'xpub6DExuxjQ16sWy5TF4KkLV65YGqCJ5pyv7Ej7d9yJNAXz7C1M9intqszXfaNZG99KsDJdQ29wUKBTZHZFXUaPbKTZ5Z6f4yowNvAQ8fEJw2G', @@ -133,15 +126,15 @@ const legacyAccountFromDescriptor = (): SubtestGetAccountInfo => { }; }; -const ethereumAccount = (): SubtestGetAccountInfo => { - const testPayloads: Array = [ +const ethereumAccount = () => { + const testPayloads: GetAccountInfo[] = [ { method: 'getAccountInfo', coin: 'eth', path: "m/44'/60'/0'/0/0", }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { descriptor: '0x3f2329C9ADFbcCd9A84f52c906E936A42dA18CB8', @@ -157,15 +150,15 @@ const ethereumAccount = (): SubtestGetAccountInfo => { }; }; -const ethereumAccountFromDescriptor = (): SubtestGetAccountInfo => { - const testPayloads: Array = [ +const ethereumAccountFromDescriptor = () => { + const testPayloads: GetAccountInfo[] = [ { method: 'getAccountInfo', coin: 'eth', descriptor: '0x3f2329C9ADFbcCd9A84f52c906E936A42dA18CB8', }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { descriptor: '0x3f2329C9ADFbcCd9A84f52c906E936A42dA18CB8', @@ -181,15 +174,15 @@ const ethereumAccountFromDescriptor = (): SubtestGetAccountInfo => { }; }; -const rippleAccount = (): SubtestGetAccountInfo => { - const testPayloads: Array = [ +const rippleAccount = () => { + const testPayloads: GetAccountInfo[] = [ { method: 'getAccountInfo', coin: 'xrp', path: "m/44'/144'/0'/0/0", }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { descriptor: 'rh5ZnEVySAy7oGd3nebT3wrohGDrsNS83E', @@ -205,15 +198,15 @@ const rippleAccount = (): SubtestGetAccountInfo => { }; }; -const rippleAccountFromDescriptor = (): SubtestGetAccountInfo => { - const testPayloads: Array = [ +const rippleAccountFromDescriptor = () => { + const testPayloads: GetAccountInfo[] = [ { method: 'getAccountInfo', coin: 'xrp', descriptor: 'rfkV3EoXimH6JrG1QAyofgbVhnyZZDjWSj', }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { descriptor: 'rfkV3EoXimH6JrG1QAyofgbVhnyZZDjWSj', @@ -231,15 +224,15 @@ const rippleAccountFromDescriptor = (): SubtestGetAccountInfo => { // Path is invalid // Should fail -const invalidPath = (): SubtestGetAccountInfo => { - const testPayloads: Array = [ +const invalidPath = () => { + const testPayloads: GetAccountInfo[] = [ { method: 'getAccountInfo', coin: 'Bitcoin', path: "m/49'/0'", }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: false }, ]; @@ -250,25 +243,21 @@ const invalidPath = (): SubtestGetAccountInfo => { }; }; -export const getAccountInfo = (): TestFunction => { - const availableSubtests = { - firstSegwitAccount, - firstLegacyAccount, - segwitAccountFromDescriptor, - legacyAccountFromDescriptor, - emptyAccount, - invalidPath, - ethereumAccount, - ethereumAccountFromDescriptor, - rippleAccount, - rippleAccountFromDescriptor, - }; - const testName = 'GetAccountInfo'; +export const getAccountInfo = () => { return { - testName, + testName: 'GetAccountInfo', mnemonic: 'mnemonic_12', subtests: { - ...availableSubtests, + firstSegwitAccount, + firstLegacyAccount, + segwitAccountFromDescriptor, + legacyAccountFromDescriptor, + emptyAccount, + invalidPath, + ethereumAccount, + ethereumAccountFromDescriptor, + rippleAccount, + rippleAccountFromDescriptor, }, }; }; diff --git a/src/__tests__/core/getAddress.spec.js b/src/__tests__/core/getAddress.spec.js index 13a930f04..c8ff9ba90 100644 --- a/src/__tests__/core/getAddress.spec.js +++ b/src/__tests__/core/getAddress.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestGetAddress, -} from 'flowtype/tests'; -import type { - TestGetAddressPayload, - ExpectedGetAddressResponse, -} from 'flowtype/tests/get-address'; +import type { GetAddress } from '../../js/types'; -const btc = (): SubtestGetAddress => { - const testPayloads: Array = [ +const btc = () => { + const testPayloads: GetAddress[] = [ { method: 'getAddress', coin: 'Bitcoin', @@ -42,7 +35,7 @@ const btc = (): SubtestGetAddress => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: '3AnYTd2FGxJLNKL1AzxfW3FJMntp9D2KKX', @@ -65,8 +58,8 @@ const btc = (): SubtestGetAddress => { }; }; -const ltc = (): SubtestGetAddress => { - const testPayloads: Array = [ +const ltc = () => { + const testPayloads: GetAddress[] = [ { method: 'getAddress', coin: 'Litecoin', @@ -87,7 +80,7 @@ const ltc = (): SubtestGetAddress => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: 'MFoQRU1KQq365Sy3cXhix3ygycEU4YWB1V', @@ -108,8 +101,8 @@ const ltc = (): SubtestGetAddress => { }; }; -const tbtc = (): SubtestGetAddress => { - const testPayloads: Array = [ +const tbtc = () => { + const testPayloads: GetAddress[] = [ { method: 'getAddress', coin: 'Testnet', @@ -130,7 +123,7 @@ const tbtc = (): SubtestGetAddress => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: '2N4dH9yn4eYnnjHTYpN9xDmuMRS2k1AHWd8', @@ -151,8 +144,8 @@ const tbtc = (): SubtestGetAddress => { }; }; -const bch = (): SubtestGetAddress => { - const testPayloads: Array = [ +const bch = () => { + const testPayloads: GetAddress[] = [ { method: 'getAddress', coin: 'Bcash', @@ -173,7 +166,7 @@ const bch = (): SubtestGetAddress => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: 'bitcoincash:qzqxk2q6rhy3j9fnnc00m08g4n5dm827xv2dmtjzzp', @@ -194,20 +187,15 @@ const bch = (): SubtestGetAddress => { }; }; -export const getAddress = (): TestFunction => { - const availableSubtests = { - btc, - ltc, - tbtc, - bch, - }; - const testName = 'GetAddress'; - +export const getAddress = () => { return { - testName, + testName: 'GetAddress', mnemonic: 'mnemonic_12', subtests: { - ...availableSubtests, + btc, + ltc, + tbtc, + bch, }, }; }; diff --git a/src/__tests__/core/getAddressMultisig.spec.js b/src/__tests__/core/getAddressMultisig.spec.js index d34231179..c2d39538c 100644 --- a/src/__tests__/core/getAddressMultisig.spec.js +++ b/src/__tests__/core/getAddressMultisig.spec.js @@ -1,11 +1,5 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; -import type { - TestGetAddressPayload, - ExpectedGetAddressResponse, -} from 'flowtype/tests/get-address'; +import type { GetAddress } from '../../js/types'; const multisig = { pubkeys: [ @@ -27,7 +21,7 @@ const multisig = { }; const showMultisigAddress = () => { - const testPayloads: Array = [ + const testPayloads: GetAddress[] = [ { method: 'getAddress', path: [1], @@ -50,7 +44,7 @@ const showMultisigAddress = () => { showOnTrezor: true, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: '3E7GDtuHqnqPmDgwH59pVC7AvySiSkbibz', @@ -75,7 +69,7 @@ const showMultisigAddress = () => { }; }; -export const getAddressMultisig = (): TestFunction => { +export const getAddressMultisig = () => { return { subtests: { showMultisigAddress, diff --git a/src/__tests__/core/getAddressSegwit.spec.js b/src/__tests__/core/getAddressSegwit.spec.js index 8bbe55d92..156ffab53 100644 --- a/src/__tests__/core/getAddressSegwit.spec.js +++ b/src/__tests__/core/getAddressSegwit.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestGetAddress, -} from 'flowtype/tests'; -import type { - TestGetAddressPayload, - ExpectedGetAddressResponse, -} from 'flowtype/tests/get-address'; +import type { GetAddress } from '../../js/types'; -const showSegwit = (): SubtestGetAddress => { - const testPayloads: Array = [ +const showSegwit = () => { + const testPayloads: GetAddress[] = [ { method: 'getAddress', coin: 'Bitcoin', @@ -35,7 +28,7 @@ const showSegwit = (): SubtestGetAddress => { showOnTrezor: true, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: '3AnYTd2FGxJLNKL1AzxfW3FJMntp9D2KKX', @@ -65,7 +58,7 @@ const showSegwit = (): SubtestGetAddress => { }; }; -export const getAddressSegwit = (): TestFunction => { +export const getAddressSegwit = () => { const availableSubtests = { showSegwit, }; diff --git a/src/__tests__/core/getPublicKey.spec.js b/src/__tests__/core/getPublicKey.spec.js index 0a044fb54..378bd33e4 100644 --- a/src/__tests__/core/getPublicKey.spec.js +++ b/src/__tests__/core/getPublicKey.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; +import type { GetPublicKey } from '../../js/types'; -import type { - TestGetPublicKeyPayload, - ExpectedGetPublicKeyResponse, -} from 'flowtype/tests/get-public-key'; - -export const getPublicKey = (): TestFunction => { - const testPayloads: Array = [ +export const getPublicKey = () => { + const testPayloads: GetPublicKey[] = [ { method: 'getPublicKey', coin: 'btc', @@ -31,7 +24,7 @@ export const getPublicKey = (): TestFunction => { path: [0, 1], }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { xpub: 'xpub6DExuxjQ16sWy5TF4KkLV65YGqCJ5pyv7Ej7d9yJNAXz7C1M9intqszXfaNZG99KsDJdQ29wUKBTZHZFXUaPbKTZ5Z6f4yowNvAQ8fEJw2G', diff --git a/src/__tests__/core/index.js b/src/__tests__/core/index.js index ad6023787..db523453f 100644 --- a/src/__tests__/core/index.js +++ b/src/__tests__/core/index.js @@ -1,9 +1,5 @@ /* @flow */ -import type { - AvailableTestFunctions, -} from 'flowtype/tests'; - import { cardanoGetAddress } from './cardanoGetAddress.spec.js'; import { cardanoGetPublicKey } from './cardanoGetPublicKey.spec.js'; import { cardanoSignTransaction } from './cardanoSignTransaction.spec.js'; @@ -55,8 +51,9 @@ import { binanceSignTransaction } from './binanceSignTransaction.spec'; import { applySettings } from './applySettings.spec'; import { applyFlags } from './applyFlags.spec'; import { stellarSignTransaction } from './stellarSignTransaction.spec'; +import { stellarGetAddress } from './stellarGetAddress.spec'; -export const testFunctions: AvailableTestFunctions = { +export const testFunctions = { cardanoGetAddress, cardanoGetPublicKey, cardanoSignTransaction, @@ -108,4 +105,5 @@ export const testFunctions: AvailableTestFunctions = { applySettings, applyFlags, stellarSignTransaction, + stellarGetAddress, }; diff --git a/src/__tests__/core/liskGetAddress.spec.js b/src/__tests__/core/liskGetAddress.spec.js index 4cb666ebc..ae8a9f129 100644 --- a/src/__tests__/core/liskGetAddress.spec.js +++ b/src/__tests__/core/liskGetAddress.spec.js @@ -1,16 +1,8 @@ /* @flow */ +import type { LiskGetAddress } from '../../js/types'; -import type { - TestFunction, -} from 'flowtype/tests'; - -import type { - TestLiskGetAddressPayload, - ExpectedLiskGetAddressResponse, -} from 'flowtype/tests/lisk-get-address'; - -export const liskGetAddress = (): TestFunction => { - const testPayloads: Array = [ +export const liskGetAddress = () => { + const testPayloads: LiskGetAddress[] = [ { method: 'liskGetAddress', path: "m/44'/134'/0'", @@ -25,7 +17,7 @@ export const liskGetAddress = (): TestFunction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: '17563781916205589679L', diff --git a/src/__tests__/core/liskSignMessage.spec.js b/src/__tests__/core/liskSignMessage.spec.js index 602c92283..d6b0aa832 100644 --- a/src/__tests__/core/liskSignMessage.spec.js +++ b/src/__tests__/core/liskSignMessage.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; +import type { LiskSignMessage } from '../../js/types'; -import type { - TestLiskSignMessagePayload, - ExpectedLiskSignMessageResponse, -} from 'flowtype/tests/lisk-sign-message'; - -export const liskSignMessage = (): TestFunction => { - const testPayloads: Array = [ +export const liskSignMessage = () => { + const testPayloads: LiskSignMessage[] = [ { method: 'liskSignMessage', path: "m/44'/134'/0'/1'", @@ -22,7 +15,7 @@ export const liskSignMessage = (): TestFunction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { publicKey: 'a129381c1c077f9d8cb70ac48dcbbf3535bd4d5767dc363438e95fb9f1211704', diff --git a/src/__tests__/core/liskSignTransaction.spec.js b/src/__tests__/core/liskSignTransaction.spec.js index 70b485ff2..9b9c52894 100644 --- a/src/__tests__/core/liskSignTransaction.spec.js +++ b/src/__tests__/core/liskSignTransaction.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestLiskSignTransaction, -} from 'flowtype/tests'; -import type { - TestLiskSignTransactionPayload, - ExpectedLiskSignTransactionResponse, -} from 'flowtype/tests/lisk-sign-transaction'; +import type { LiskSignTransaction } from '../../js/types'; -const liskSignTxTransfer = (): SubtestLiskSignTransaction => { - const testPayloads: Array = [ +const liskSignTxTransfer = () => { + const testPayloads: LiskSignTransaction[] = [ { method: 'liskSignTransaction', path: "m/44'/134'/0'/0'", @@ -19,11 +12,10 @@ const liskSignTxTransfer = (): SubtestLiskSignTransaction => { timestamp: 57525937, type: 0, fee: '10000000', - asset: {}, }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'b62717d581e5713bca60b758b661e6cfa091addc6caedd57534e06cda805943ee80797b9fb9a1e1b2bd584e292d2a7f832a4d1b3f15f00e1ee1b72de7e195a08', @@ -38,8 +30,8 @@ const liskSignTxTransfer = (): SubtestLiskSignTransaction => { }; }; -const liskSignTxTransferWithData = (): SubtestLiskSignTransaction => { - const testPayloads: Array = [ +const liskSignTxTransferWithData = () => { + const testPayloads: LiskSignTransaction[] = [ { method: 'liskSignTransaction', path: "m/44'/134'/0'/0'", @@ -55,7 +47,7 @@ const liskSignTxTransferWithData = (): SubtestLiskSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: '5dd0dbb87ee46f3e985b1ef2df85cb0bec481e8601d150388f73e198cdd57a698eab076c7cd5b281fbb6a83dd3dc64d91a6eccd1614dffd46f101194ffa3a004', @@ -70,8 +62,8 @@ const liskSignTxTransferWithData = (): SubtestLiskSignTransaction => { }; }; -const liskSignTxSecondSignature = (): SubtestLiskSignTransaction => { - const testPayloads: Array = [ +const liskSignTxSecondSignature = () => { + const testPayloads: LiskSignTransaction[] = [ { method: 'liskSignTransaction', path: "m/44'/134'/0'/0'", @@ -88,7 +80,7 @@ const liskSignTxSecondSignature = (): SubtestLiskSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'f02bdc40a7599c21d29db4080ff1ff8934f76eedf5b0c4fa695c8a64af2f0b40a5c4f92db203863eebbbfad8f0611a23f451ed8bb711490234cdfb034728fd01', @@ -103,8 +95,8 @@ const liskSignTxSecondSignature = (): SubtestLiskSignTransaction => { }; }; -const liskSignTxDelegateRegistration = (): SubtestLiskSignTransaction => { - const testPayloads: Array = [ +const liskSignTxDelegateRegistration = () => { + const testPayloads: LiskSignTransaction[] = [ { method: 'liskSignTransaction', path: "m/44'/134'/0'/0'", @@ -121,7 +113,7 @@ const liskSignTxDelegateRegistration = (): SubtestLiskSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: '5ac02b2882b9d7d0f944e48baadc27de1296cc08c3533f7c8e380fbbb9fb4a6ac81b5dc57060d7d8c68912eea24eb6e39024801bccc0d55020e2052b0c2bb701', @@ -136,8 +128,8 @@ const liskSignTxDelegateRegistration = (): SubtestLiskSignTransaction => { }; }; -const liskSignTxCastVotes = (): SubtestLiskSignTransaction => { - const testPayloads: Array = [ +const liskSignTxCastVotes = () => { + const testPayloads: LiskSignTransaction[] = [ { method: 'liskSignTransaction', path: "m/44'/134'/0'/0'", @@ -155,7 +147,7 @@ const liskSignTxCastVotes = (): SubtestLiskSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: '1d0599a8387edaa4a6d309b8a78accd1ceaff20ff9d87136b01cba0efbcb9781c13dc2b0bab5a1ea4f196d8dcc9dbdbd2d56dbffcc088fc77686b2e2c2fe560f', @@ -170,8 +162,8 @@ const liskSignTxCastVotes = (): SubtestLiskSignTransaction => { }; }; -const liskSignTxMultisignature = (): SubtestLiskSignTransaction => { - const testPayloads: Array = [ +const liskSignTxMultisignature = () => { + const testPayloads: LiskSignTransaction[] = [ { method: 'liskSignTransaction', path: "m/44'/134'/0'/0'", @@ -193,7 +185,7 @@ const liskSignTxMultisignature = (): SubtestLiskSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: '88923866c2d500a6927715699ab41a0f58ea4b52e552d90e923bc24ac9da240f2328c93f9ce043a1da4937d4b61c7f57c02fc931f9824d06b24731e7be23c506', @@ -208,7 +200,7 @@ const liskSignTxMultisignature = (): SubtestLiskSignTransaction => { }; }; -export const liskSignTransaction = (): TestFunction => { +export const liskSignTransaction = () => { const testName = 'LiskSignTransaction'; const availableSubtests = { liskSignTxTransfer, diff --git a/src/__tests__/core/liskVerifyMessage.spec.js b/src/__tests__/core/liskVerifyMessage.spec.js index e2ce3e62c..c12603d97 100644 --- a/src/__tests__/core/liskVerifyMessage.spec.js +++ b/src/__tests__/core/liskVerifyMessage.spec.js @@ -1,16 +1,8 @@ /* @flow */ +import type { LiskVerifyMessage } from '../../js/types'; -import type { - TestFunction, -} from 'flowtype/tests'; - -import type { - TestLiskVerifyMessagePayload, - ExpectedLiskVerifyMessageResponse, -} from 'flowtype/tests/lisk-verify-message'; - -export const liskVerifyMessage = (): TestFunction => { - const testPayloads: Array = [ +export const liskVerifyMessage = () => { + const testPayloads: LiskVerifyMessage[] = [ { method: 'liskVerifyMessage', publicKey: 'a129381c1c077f9d8cb70ac48dcbbf3535bd4d5767dc363438e95fb9f1211704', @@ -25,7 +17,7 @@ export const liskVerifyMessage = (): TestFunction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, { success: true }, ]; diff --git a/src/__tests__/core/nemGetAddress.spec.js b/src/__tests__/core/nemGetAddress.spec.js index 57c3664b4..e419aad77 100644 --- a/src/__tests__/core/nemGetAddress.spec.js +++ b/src/__tests__/core/nemGetAddress.spec.js @@ -1,17 +1,9 @@ /* @flow */ +import type { NEMGetAddress } from '../../js/types'; import { NEM_MAINNET, NEM_TESTNET } from '../../js/core/methods/helpers/nemSignTx.js'; -import type { - TestFunction, -} from 'flowtype/tests'; - -import type { - TestNemGetAddressPayload, - ExpectedNemGetAddressResponse, -} from 'flowtype/tests/nem-get-address'; - -export const nemGetAddress = (): TestFunction => { - const testPayloads: Array = [ +export const nemGetAddress = () => { + const testPayloads: NEMGetAddress[] = [ { method: 'nemGetAddress', path: "m/44'/1'/0'/0'/0'", @@ -23,7 +15,7 @@ export const nemGetAddress = (): TestFunction => { network: NEM_TESTNET, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: 'NB3JCHVARQNGDS3UVGAJPTFE22UQFGMCQGHUBWQN', diff --git a/src/__tests__/core/nemSignTransactionMosaic.spec.js b/src/__tests__/core/nemSignTransactionMosaic.spec.js index 56ea3650b..60041e43d 100644 --- a/src/__tests__/core/nemSignTransactionMosaic.spec.js +++ b/src/__tests__/core/nemSignTransactionMosaic.spec.js @@ -1,24 +1,16 @@ /* @flow */ -import { TX_TYPES } from '../../js/core/methods/helpers/nemSignTx.js'; +import type { NEMSignTransaction } from '../../js/types'; +import { NEM_SUPPLY_CHANGE, NEM_MOSAIC_CREATION } from '../../js/core/methods/helpers/nemSignTx.js'; -import type { - TestFunction, - SubtestNemSignTransaction, -} from 'flowtype/tests'; -import type { - TestNemSignTransactionPayload, - ExpectedNemSignTransactionResponse, -} from 'flowtype/tests/nem-sign-transaction'; - -const supplyChange = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const supplyChange = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", transaction: { timeStamp: 74649215, fee: 2000000, - type: TX_TYPES.supplyChange, + type: NEM_SUPPLY_CHANGE, deadline: 74735615, message: {}, mosaicId: { @@ -33,7 +25,7 @@ const supplyChange = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '02400000010000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f74041a0000000600000068656c6c6f6d0c00000048656c6c6f206d6f73616963010000000100000000000000', @@ -49,15 +41,15 @@ const supplyChange = (): SubtestNemSignTransaction => { }; }; -const creation = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const creation = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", transaction: { timeStamp: 74649215, fee: 2000000, - type: TX_TYPES.mosaicCreation, + type: NEM_MOSAIC_CREATION, deadline: 74735615, message: { }, mosaicDefinition: { @@ -65,8 +57,8 @@ const creation = (): SubtestNemSignTransaction => { namespaceId: 'hellom', name: 'Hello mosaic', }, - levy: { }, - properties: { }, + levy: {}, + properties: [], description: 'lorem', }, version: (0x98 << 24), // testnet // 2550136832 @@ -75,7 +67,7 @@ const creation = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '01400000010000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f7404c100000020000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b40620841a0000000600000068656c6c6f6d0c00000048656c6c6f206d6f73616963050000006c6f72656d04000000150000000c00000064697669736962696c6974790100000030160000000d000000696e697469616c537570706c7901000000301a0000000d000000737570706c794d757461626c650500000066616c7365190000000c0000007472616e7366657261626c650500000066616c7365000000002800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324adc05000000000000', @@ -91,15 +83,15 @@ const creation = (): SubtestNemSignTransaction => { }; }; -const creationProperties = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const creationProperties = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", transaction: { timeStamp: 74649215, fee: 2000000, - type: TX_TYPES.mosaicCreation, + type: NEM_MOSAIC_CREATION, deadline: 74735615, message: {}, mosaicDefinition: { @@ -134,7 +126,7 @@ const creationProperties = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '01400000010000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f7404c200000020000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b40620841a0000000600000068656c6c6f6d0c00000048656c6c6f206d6f73616963050000006c6f72656d04000000150000000c00000064697669736962696c6974790100000034180000000d000000696e697469616c537570706c79030000003230301a0000000d000000737570706c794d757461626c650500000066616c7365180000000c0000007472616e7366657261626c650400000074727565000000002800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324adc05000000000000', @@ -150,15 +142,15 @@ const creationProperties = (): SubtestNemSignTransaction => { }; }; -const creationLevy = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const creationLevy = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", transaction: { timeStamp: 74649215, fee: 2000000, - type: TX_TYPES.mosaicCreation, + type: NEM_MOSAIC_CREATION, deadline: 74735615, message: {}, mosaicDefinition: { @@ -201,7 +193,7 @@ const creationLevy = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '01400000010000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f74041801000020000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b40620841a0000000600000068656c6c6f6d0c00000048656c6c6f206d6f73616963050000006c6f72656d04000000150000000c00000064697669736962696c6974790100000034180000000d000000696e697469616c537570706c79030000003230301a0000000d000000737570706c794d757461626c650500000066616c7365180000000c0000007472616e7366657261626c65040000007472756556000000010000002800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324a1a0000000600000068656c6c6f6d0c00000048656c6c6f206d6f7361696302000000000000002800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324adc05000000000000', @@ -217,20 +209,15 @@ const creationLevy = (): SubtestNemSignTransaction => { }; }; -export const nemSignTransactionMosaic = (): TestFunction => { - const availableSubtests = { - supplyChange, - creation, - creationProperties, - creationLevy, - }; - const testName = 'nemSignTransactionMosaic'; - +export const nemSignTransactionMosaic = () => { return { - testName, + testName: 'nemSignTransactionMosaic', mnemonic: 'mnemonic_12', subtests: { - ...availableSubtests, + supplyChange, + creation, + creationProperties, + creationLevy, }, }; }; diff --git a/src/__tests__/core/nemSignTransactionMultisig.spec.js b/src/__tests__/core/nemSignTransactionMultisig.spec.js index c77984a5b..551852c7e 100644 --- a/src/__tests__/core/nemSignTransactionMultisig.spec.js +++ b/src/__tests__/core/nemSignTransactionMultisig.spec.js @@ -1,24 +1,25 @@ /* @flow */ -import { TX_TYPES } from '../../js/core/methods/helpers/nemSignTx.js'; +import type { NEMSignTransaction } from '../../js/types'; +import { + NEM_TRANSFER, + NEM_AGGREGATE_MODIFICATION, + NEM_MULTISIG, + NEM_PROVISION_NAMESPACE, + NEM_MULTISIG_SIGNATURE, + NEM_SUPPLY_CHANGE, +} from '../../js/core/methods/helpers/nemSignTx.js'; -import type { - TestFunction, - SubtestNemSignTransaction, -} from 'flowtype/tests'; -import type { - TestNemSignTransactionPayload, - ExpectedNemSignTransactionResponse, -} from 'flowtype/tests/nem-sign-transaction'; +// https://github.com/trezor/trezor-firmware/blob/master/tests/device_tests/test_msg_nem_signtx_multisig.py -const aggregateModification = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const aggregateModification = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", transaction: { timeStamp: 74649215, fee: 2000000, - type: TX_TYPES.aggregateModification, + type: NEM_AGGREGATE_MODIFICATION, deadline: 74735615, message: {}, modifications: [ @@ -35,7 +36,7 @@ const aggregateModification = (): SubtestNemSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '01100000020000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f740401000000280000000100000020000000c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f878440400000003000000', @@ -51,22 +52,22 @@ const aggregateModification = (): SubtestNemSignTransaction => { }; }; -const multisig = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const multisig = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", transaction: { timeStamp: 1, fee: 10000, - type: TX_TYPES.multisig, + type: NEM_MULTISIG, deadline: 74735615, otherTrans: { timeStamp: 2, amount: '2000000', fee: 15000, recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', - type: TX_TYPES.transfer, + type: NEM_TRANSFER, deadline: 67890, message: { payload: '746573745f6e656d5f7472616e73616374696f6e5f7472616e73666572', @@ -84,13 +85,13 @@ const multisig = (): SubtestNemSignTransaction => { transaction: { timeStamp: 74649215, fee: 150, - type: TX_TYPES.multisig, + type: NEM_MULTISIG, deadline: 789, otherTrans: { timeStamp: 123456, fee: 2000, recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', - type: TX_TYPES.provisionNamespace, + type: NEM_PROVISION_NAMESPACE, deadline: 100, message: { }, newPart: 'ABCDE', @@ -103,7 +104,7 @@ const multisig = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '04100000010000980100000020000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b40620841027000000000000ff5f74049900000001010000010000980200000020000000c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844983a000000000000320901002800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324a80841e000000000025000000010000001d000000746573745f6e656d5f7472616e73616374696f6e5f7472616e73666572', @@ -125,22 +126,22 @@ const multisig = (): SubtestNemSignTransaction => { }; }; -const multisigSigner = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const multisigSigner = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", transaction: { timeStamp: 333, fee: 200, - type: TX_TYPES.multisigSignature, + type: NEM_MULTISIG_SIGNATURE, deadline: 444, otherTrans: { timeStamp: 555, - amount: '2000000', + amount: 2000000, fee: 2000000, recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', - type: TX_TYPES.transfer, + type: NEM_TRANSFER, deadline: 666, message: { payload: '746573745f6e656d5f7472616e73616374696f6e5f7472616e73666572', @@ -158,15 +159,15 @@ const multisigSigner = (): SubtestNemSignTransaction => { transaction: { timeStamp: 900000, fee: 200000, - type: TX_TYPES.multisigSignature, + type: NEM_MULTISIG_SIGNATURE, deadline: 100, otherTrans: { timeStamp: 101111, fee: 1000, recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', - type: TX_TYPES.supplyChange, + type: NEM_SUPPLY_CHANGE, deadline: 13123, - message: { }, + // message: { }, mosaicId: { namespaceId: 'hellom', name: 'Hello mosaic', @@ -182,7 +183,7 @@ const multisigSigner = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '02100000010000984d01000020000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b4062084c800000000000000bc010000240000002000000087923cd4805f3babe6b5af9cbb2b08be4458e39531618aed73c911f160c8e38528000000544444324354364c514c49595135364b49584933454e544d36454b3344343450354b5a50464d4b32', @@ -204,7 +205,7 @@ const multisigSigner = (): SubtestNemSignTransaction => { }; }; -export const nemSignTransactionMultisig = (): TestFunction => { +export const nemSignTransactionMultisig = () => { const availableSubtests = { aggregateModification, multisig, diff --git a/src/__tests__/core/nemSignTransactionOthers.spec.js b/src/__tests__/core/nemSignTransactionOthers.spec.js index 84daccb29..19ddcc545 100644 --- a/src/__tests__/core/nemSignTransactionOthers.spec.js +++ b/src/__tests__/core/nemSignTransactionOthers.spec.js @@ -1,24 +1,16 @@ /* @flow */ -import { TX_TYPES } from '../../js/core/methods/helpers/nemSignTx.js'; +import type { NEMSignTransaction } from '../../js/types'; +import { NEM_IMPORTANCE_TRANSFER, NEM_PROVISION_NAMESPACE } from '../../js/core/methods/helpers/nemSignTx.js'; -import type { - TestFunction, - SubtestNemSignTransaction, -} from 'flowtype/tests'; -import type { - TestNemSignTransactionPayload, - ExpectedNemSignTransactionResponse, -} from 'flowtype/tests/nem-sign-transaction'; - -const importanceTransfer = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const importanceTransfer = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", transaction: { timeStamp: 12349215, fee: 9900, - type: TX_TYPES.importanceTransfer, + type: NEM_IMPORTANCE_TRANSFER, deadline: 99, message: {}, importanceTransfer: { @@ -29,7 +21,7 @@ const importanceTransfer = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '01080000010000981f6fbc0020000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b4062084ac26000000000000630000000100000020000000c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844', @@ -45,15 +37,15 @@ const importanceTransfer = (): SubtestNemSignTransaction => { }; }; -const provisionNamespace = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const provisionNamespace = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", transaction: { timeStamp: 74649215, fee: 2000000, - type: TX_TYPES.provisionNamespace, + type: NEM_PROVISION_NAMESPACE, deadline: 74735615, message: {}, newPart: 'ABCDE', @@ -63,7 +55,7 @@ const provisionNamespace = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '01200000010000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f74042800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324adc05000000000000050000004142434445ffffffff', @@ -79,7 +71,7 @@ const provisionNamespace = (): SubtestNemSignTransaction => { }; }; -export const nemSignTransactionOthers = (): TestFunction => { +export const nemSignTransactionOthers = () => { const availableSubtests = { importanceTransfer, provisionNamespace, diff --git a/src/__tests__/core/nemSignTransactionTransfers.spec.js b/src/__tests__/core/nemSignTransactionTransfers.spec.js index 7a7d1eeed..1ceceaf52 100644 --- a/src/__tests__/core/nemSignTransactionTransfers.spec.js +++ b/src/__tests__/core/nemSignTransactionTransfers.spec.js @@ -1,17 +1,9 @@ /* @flow */ -import { TX_TYPES } from '../../js/core/methods/helpers/nemSignTx.js'; +import type { NEMSignTransaction } from '../../js/types'; +import { NEM_TRANSFER } from '../../js/core/methods/helpers/nemSignTx.js'; -import type { - TestFunction, - SubtestNemSignTransaction, -} from 'flowtype/tests'; -import type { - TestNemSignTransactionPayload, - ExpectedNemSignTransactionResponse, -} from 'flowtype/tests/nem-sign-transaction'; - -const simple = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const simple = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", @@ -20,7 +12,7 @@ const simple = (): SubtestNemSignTransaction => { amount: '2000000', fee: 2000000, recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', - type: TX_TYPES.transfer, + type: NEM_TRANSFER, deadline: 74735615, message: { payload: '746573745f6e656d5f7472616e73616374696f6e5f7472616e73666572', @@ -30,7 +22,7 @@ const simple = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '01010000010000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f74042800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324a80841e000000000025000000010000001d000000746573745f6e656d5f7472616e73616374696f6e5f7472616e73666572', @@ -46,8 +38,8 @@ const simple = (): SubtestNemSignTransaction => { }; }; -const xemAsMosaic = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const xemAsMosaic = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", @@ -56,7 +48,7 @@ const xemAsMosaic = (): SubtestNemSignTransaction => { amount: '5000000', fee: 1000000, recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', - type: TX_TYPES.transfer, + type: NEM_TRANSFER, deadline: 76895615, message: { }, @@ -73,7 +65,7 @@ const xemAsMosaic = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '0101000002000098ff03940420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208440420f00000000007f5595042800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324a404b4c000000000000000000010000001a0000000e000000030000006e656d0300000078656d4054890000000000', @@ -89,8 +81,8 @@ const xemAsMosaic = (): SubtestNemSignTransaction => { }; }; -const unknownMosaic = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const unknownMosaic = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", @@ -99,7 +91,7 @@ const unknownMosaic = (): SubtestNemSignTransaction => { amount: '2000000', fee: 1000000, recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', - type: TX_TYPES.transfer, + type: NEM_TRANSFER, deadline: 76895615, message: { }, @@ -116,7 +108,7 @@ const unknownMosaic = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '0101000002000098ff03940420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208440420f00000000007f5595042800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324a80841e00000000000000000001000000190000000d00000003000000787878020000006161e067350000000000', @@ -132,8 +124,8 @@ const unknownMosaic = (): SubtestNemSignTransaction => { }; }; -const knownMosaic = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const knownMosaic = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", @@ -142,7 +134,7 @@ const knownMosaic = (): SubtestNemSignTransaction => { amount: '3000000', fee: 1000000, recipient: 'NDMYSLXI4L3FYUQWO4MJOVL6BSTJJXKDSZRMT4LT', - type: TX_TYPES.transfer, + type: NEM_TRANSFER, deadline: 76895615, message: { }, @@ -159,7 +151,7 @@ const knownMosaic = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '0101000002000068ff03940420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208440420f00000000007f559504280000004e444d59534c5849344c3346595551574f344d4a4f564c364253544a4a584b44535a524d54344c54c0c62d000000000000000000010000001c000000100000000300000064696d05000000746f6b656e98b1010000000000', @@ -175,8 +167,8 @@ const knownMosaic = (): SubtestNemSignTransaction => { }; }; -const knownMosaicWithLevy = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const knownMosaicWithLevy = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", @@ -185,7 +177,7 @@ const knownMosaicWithLevy = (): SubtestNemSignTransaction => { amount: '2000000', fee: 1000000, recipient: 'NDMYSLXI4L3FYUQWO4MJOVL6BSTJJXKDSZRMT4LT', - type: TX_TYPES.transfer, + type: NEM_TRANSFER, deadline: 76895615, message: { }, @@ -202,7 +194,7 @@ const knownMosaicWithLevy = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '0101000002000068ff03940420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208440420f00000000007f559504280000004e444d59534c5849344c3346595551574f344d4a4f564c364253544a4a584b44535a524d54344c5480841e000000000000000000010000001b0000000f0000000300000064696d04000000636f696e3063030000000000', @@ -218,8 +210,8 @@ const knownMosaicWithLevy = (): SubtestNemSignTransaction => { }; }; -const multipleMosaics = (): SubtestNemSignTransaction => { - const testPayloads: Array = [ +const multipleMosaics = () => { + const testPayloads: NEMSignTransaction[] = [ { method: 'nemSignTransaction', path: "m/44'/1'/0'/0'/0'", @@ -228,7 +220,7 @@ const multipleMosaics = (): SubtestNemSignTransaction => { amount: '2000000', fee: 1000000, recipient: 'NDMYSLXI4L3FYUQWO4MJOVL6BSTJJXKDSZRMT4LT', - type: TX_TYPES.transfer, + type: NEM_TRANSFER, deadline: 76895615, message: { }, @@ -273,7 +265,7 @@ const multipleMosaics = (): SubtestNemSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { data: '0101000002000068ff03940420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208440420f00000000007f559504280000004e444d59534c5849344c3346595551574f344d4a4f564c364253544a4a584b44535a524d54344c5480841e000000000000000000030000001d0000001100000003000000616263060000006d6f7361696348851e0000000000260000001a00000006000000627265657a650c000000627265657a652d746f6b656e98b10100000000001a0000000e000000030000006e656d0300000078656df03b2e0000000000', @@ -289,7 +281,7 @@ const multipleMosaics = (): SubtestNemSignTransaction => { }; }; -export const nemSignTransactionTransfers = (): TestFunction => { +export const nemSignTransactionTransfers = () => { const availableSubtests = { simple, xemAsMosaic, diff --git a/src/__tests__/core/rippleGetAddress.spec.js b/src/__tests__/core/rippleGetAddress.spec.js index 4c8698bdc..91036fd55 100644 --- a/src/__tests__/core/rippleGetAddress.spec.js +++ b/src/__tests__/core/rippleGetAddress.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; +import type { RippleGetAddress } from '../../js/types'; -import type { - TestRippleGetAddressPayload, - ExpectedRippleGetAddressResponse, -} from 'flowtype/tests/ripple-get-address'; - -export const rippleGetAddress = (): TestFunction => { - const testPayloads: Array = [ +export const rippleGetAddress = () => { + const testPayloads: RippleGetAddress[] = [ { method: 'rippleGetAddress', path: "m/44'/144'/0'/0/0", @@ -23,7 +16,7 @@ export const rippleGetAddress = (): TestFunction => { path: "m/44'/144'/1'/0/0", }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: 'rh5ZnEVySAy7oGd3nebT3wrohGDrsNS83E', diff --git a/src/__tests__/core/rippleSignTransaction.spec.js b/src/__tests__/core/rippleSignTransaction.spec.js index 2bc0149fc..5cdd9b6c9 100644 --- a/src/__tests__/core/rippleSignTransaction.spec.js +++ b/src/__tests__/core/rippleSignTransaction.spec.js @@ -1,17 +1,10 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; - -import type { - TestRippleSignTransactionPayload, - ExpectedRippleSignTransactionResponse, -} from 'flowtype/tests/ripple-sign-transaction'; +import type { RippleSignTransaction } from '../../js/types'; // https://github.com/trezor/trezor-firmware/blob/master/tests/device_tests/test_msg_ripple_sign_tx.py -export const rippleSignTransaction = (): TestFunction => { - const testPayloads: Array = [ +export const rippleSignTransaction = () => { + const testPayloads: RippleSignTransaction[] = [ { method: 'rippleSignTransaction', path: "m/44'/144'/0'/0/0", @@ -68,7 +61,7 @@ export const rippleSignTransaction = (): TestFunction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: '3045022100e243ef623675eeeb95965c35c3e06d63a9fc68bb37e17dc87af9c0af83ec057e02206ca8aa5eaab8396397aef6d38d25710441faf7c79d292ee1d627df15ad9346c0', diff --git a/src/__tests__/core/signMessage.spec.js b/src/__tests__/core/signMessage.spec.js index a548d5cea..ae2e32a2b 100644 --- a/src/__tests__/core/signMessage.spec.js +++ b/src/__tests__/core/signMessage.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestSignMessage, -} from 'flowtype/tests'; -import type { - TestSignMessagePayload, - ExpectedSignMessageResponse, -} from 'flowtype/tests/sign-message'; +import type { SignMessage } from '../../js/types'; -const sign = (): SubtestSignMessage => { - const testPayloads: Array = [ +const sign = () => { + const testPayloads: SignMessage[] = [ { method: 'signMessage', coin: 'Bitcoin', @@ -20,7 +13,7 @@ const sign = (): SubtestSignMessage => { const signature = '209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80'; const signatureBuffer = Buffer.from(signature, 'hex'); - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e', @@ -36,8 +29,8 @@ const sign = (): SubtestSignMessage => { }; }; -const signTestnet = (): SubtestSignMessage => { - const testPayloads: Array = [ +const signTestnet = () => { + const testPayloads: SignMessage[] = [ { method: 'signMessage', coin: 'Testnet', @@ -48,7 +41,7 @@ const signTestnet = (): SubtestSignMessage => { const signature = '23fbc8e26c957149bcb884edd531cab9182bf79b52235c2f7a3b69ffe751ee92be22219ff576ca00406e3717dc97f3917a2ad633bfd8f088dfc8b9abd0a3311556'; const signatureBuffer = Buffer.from(signature, 'hex'); - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: '2MtXohfW9QA4VhD1zxViEt7ETNc2NuTDPVA', @@ -64,8 +57,8 @@ const signTestnet = (): SubtestSignMessage => { }; }; -const signBch = (): SubtestSignMessage => { - const testPayloads: Array = [ +const signBch = () => { + const testPayloads: SignMessage[] = [ { method: 'signMessage', coin: 'Bcash', @@ -76,7 +69,7 @@ const signBch = (): SubtestSignMessage => { const signature = '206c6379b33a93d220c232bc8d5d0f9dab8e89e396ebd687a0c40657060b9d553e2397612ea1df6e8aa8ec04ec5e5496c408e282ffd05b42b21da37d819e3720da'; const signatureBuffer = Buffer.from(signature, 'hex'); - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: 'bitcoincash:qzhsxlrst79yl6cn9fxahfl6amjn95fufcvsuqscme', @@ -92,8 +85,8 @@ const signBch = (): SubtestSignMessage => { }; }; -const signLong = (): SubtestSignMessage => { - const testPayloads: Array = [ +const signLong = () => { + const testPayloads: SignMessage[] = [ { method: 'signMessage', coin: 'Bitcoin', @@ -104,7 +97,7 @@ const signLong = (): SubtestSignMessage => { const signature = '205ff795c29aef7538f8b3bdb2e8add0d0722ad630a140b6aefd504a5a895cbd867cbb00981afc50edd0398211e8d7c304bb8efa461181bc0afa67ea4a720a89ed'; const signatureBuffer = Buffer.from(signature, 'hex'); - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e', @@ -120,7 +113,7 @@ const signLong = (): SubtestSignMessage => { }; }; -export const signMessage = (): TestFunction => { +export const signMessage = () => { const availableSubtests = { sign, signTestnet, diff --git a/src/__tests__/core/signMessageSegwit.spec.js b/src/__tests__/core/signMessageSegwit.spec.js index 339fa253b..7dd81d3d8 100644 --- a/src/__tests__/core/signMessageSegwit.spec.js +++ b/src/__tests__/core/signMessageSegwit.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestSignMessage, -} from 'flowtype/tests'; -import type { - TestSignMessagePayload, - ExpectedSignMessageResponse, -} from 'flowtype/tests/sign-message'; +import type { SignMessage } from '../../js/types'; -const sign = (): SubtestSignMessage => { - const testPayloads: Array = [ +const sign = () => { + const testPayloads: SignMessage[] = [ { method: 'signMessage', coin: 'Bitcoin', @@ -20,7 +13,7 @@ const sign = (): SubtestSignMessage => { const signature = '23d2cc1b2946f403b9acc71a70d3ab8d3ed7575a4d8fe91310ff2a7bb68246a81b77331e4245b9163a398925c78497c2daa3bbb482fc1a0b7c0255068e79f40a67'; const signatureBuffer = Buffer.from(signature, 'hex'); - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: '3Pm1J6dXuugmkTgM5PdidR9UssSWwdy5Vh', @@ -36,7 +29,7 @@ const sign = (): SubtestSignMessage => { }; }; -const signLong = (): SubtestSignMessage => { +const signLong = () => { const testPayloads = [ { method: 'signMessage', @@ -64,7 +57,7 @@ const signLong = (): SubtestSignMessage => { }; }; -export const signMessageSegwit = (): TestFunction => { +export const signMessageSegwit = () => { const availableSubtests = { sign, signLong, diff --git a/src/__tests__/core/signTransaction.spec.js b/src/__tests__/core/signTransaction.spec.js index 73071e13e..ca063a5b9 100644 --- a/src/__tests__/core/signTransaction.spec.js +++ b/src/__tests__/core/signTransaction.spec.js @@ -1,16 +1,9 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; - -const oneOneFee = (): SubtestSignTransaction => { +import type { SignTransaction } from '../../js/types'; + +const oneOneFee = () => { // See tx d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bitcoin', @@ -31,7 +24,7 @@ const oneOneFee = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b4830450221009a0b7be0d4ed3146ee262b42202841834698bb3ee39c24e7437df208b8b7077102202b79ab1e7736219387dffe8d615bbdba87e11477104b867ef47afed1a5ede7810121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0160cc0500000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac00000000', @@ -46,9 +39,9 @@ const oneOneFee = (): SubtestSignTransaction => { }; }; -const oneTwoFee = (): SubtestSignTransaction => { +const oneTwoFee = () => { // See tx c275c333fd1b36bef4af316226c66a8b3693fbfcc081a5e16a2ae5fcb09e92bf - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bitcoin', @@ -74,7 +67,7 @@ const oneTwoFee = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: ['304402200aad33a2fa9994b1aedb062486808b7e85406c2745359a02d57d617cd48298b80220394320f7409359a56061d050eeba0ba27b1ac9e3e0aa4501427f58766381f34d'], @@ -90,9 +83,9 @@ const oneTwoFee = (): SubtestSignTransaction => { }; }; -const oneThreeFee = (): SubtestSignTransaction => { +const oneThreeFee = () => { // See tx d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bitcoin', @@ -123,7 +116,7 @@ const oneThreeFee = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b483045022100e695e2c530c7c0fc32e6b79b7cff56a7f70a8c9da787534f46b4204070f914fc02207b0879a81408a11e23b11d4c7965c62b5fc6d5c2d92340f5ee2da7b40e99314a0121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0300650400000000001976a914de9b2a8da088824e8fe51debea566617d851537888ace02e0000000000001976a9141fe1d337fb81afca42818051e12fd18245d1b17288ac80380100000000001976a9140223b1a09138753c9cb0baf95a0a62c82711567a88ac00000000', @@ -138,10 +131,10 @@ const oneThreeFee = (): SubtestSignTransaction => { }; }; -const twoTwo = (): SubtestSignTransaction => { +const twoTwo = () => { // See tx c6be22d34946593bcad1d2b013e12f74159e69574ffea21581dad115572e031c // See tx 58497a7757224d1ff1941488d23087071103e5bf855f4c1c44e5c8d9d82ca46e - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bitcoin', @@ -172,7 +165,7 @@ const twoTwo = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '01000000021c032e5715d1da8115a2fe4f57699e15742fe113b0d2d1ca3b594649d322bec6010000006b483045022100f773c403b2f85a5c1d6c9c4ad69c43de66930fff4b1bc818eb257af98305546a0220443bde4be439f276a6ce793664b463580e210ec6c9255d68354449ac0443c76501210338d78612e990f2eea0c426b5e48a8db70b9d7ed66282b3b26511e0b1c75515a6ffffffff6ea42cd8d9c8e5441c4c5f85bfe50311078730d2881494f11f4d2257777a4958010000006b48304502210090cff1c1911e771605358a8cddd5ae94c7b60cc96e50275908d9bf9d6367c79f02202bfa72e10260a146abd59d0526e1335bacfbb2b4401780e9e3a7441b0480c8da0121038caebd6f753bbbd2bb1f3346a43cd32140648583673a31d62f2dfb56ad0ab9e3ffffffff02a0860100000000001976a9142f4490d5263906e4887ca2996b9e207af3e7824088aca0860100000000001976a914812c13d97f9159e54e326b481b8f88a73df8507a88ac00000000', @@ -187,9 +180,9 @@ const twoTwo = (): SubtestSignTransaction => { }; }; -const testnetOneTwoFee = (): SubtestSignTransaction => { +const testnetOneTwoFee = () => { // See tx e5040e1bc1ae7667ffb9e5248e90b2fb93cd9150234151ce90e14ab2f5933bcd - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -215,7 +208,7 @@ const testnetOneTwoFee = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0100000001cd3b93f5b24ae190ce5141235091cd93fbb2908e24e5b9ff6776aec11b0e04e5000000006a47304402204a1915f47d170b3d17f2d13696279edf7ad7b250d9827b29fa5ca96211c3d58f02200476f03c7be26f874ef2ebfa049b11aaee1582b619a46f96482b731aec14e98c012103426f6986e620f883d2d44f671cf2f91e5e0ae4d9fab0c0cc54ac16a80e628631ffffffff021023cb01000000001976a91485eb47fe98f349065d6f044e27a4ac541af79ee288aca0bb0d00000000001976a9149a3677c632cab1860f1ee7bd52d7c095579b758888ac00000000', @@ -230,9 +223,9 @@ const testnetOneTwoFee = (): SubtestSignTransaction => { }; }; -const testnetFeeTooHigh = (): SubtestSignTransaction => { +const testnetFeeTooHigh = () => { // See tx 6f90f3c7cbec2258b0971056ef3fe34128dbde30daa9c0639a898f9977299d54 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -258,7 +251,7 @@ const testnetFeeTooHigh = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0100000001549d2977998f899a63c0a9da30dedb2841e33fef561097b05822eccbc7f3906f010000006b483045022100eadd720201416e059d663fbb05bb9e87e56d11a6ce53f8da1ca8278d5beb07f102202b3d0318812ec2ec40d12bf36bafa5ee24b81208f08690c7ed89e47740e018cb0121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff02801a0600000000001976a9140223b1a09138753c9cb0baf95a0a62c82711567a88ac0065cd1d000000001976a9142db345c36563122e2fd0f5485fb7ea9bbf7cb5a288ac00000000', @@ -273,7 +266,7 @@ const testnetFeeTooHigh = (): SubtestSignTransaction => { }; }; -const lotsOfOutputs = (): SubtestSignTransaction => { +const lotsOfOutputs = () => { // Tests if device implements serialization of len(outputs) correctly // See tx c63e24ed820c5851b60c54613fbc4bcb37df6cd49b4c96143e99580a472f79fb @@ -290,7 +283,7 @@ const lotsOfOutputs = (): SubtestSignTransaction => { outputs.push(output); } - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bitcoin', @@ -313,7 +306,7 @@ const lotsOfOutputs = (): SubtestSignTransaction => { let serializedTx = '0100000002fb792f470a58993e14964c9bd46cdf37cb4bbc3f61540cb651580c82ed243ec6010000006b483045022100969da46f94a81f34f3717b014e0c3e1826eda1b0022ec2f9ce39f3d750ab9235022026da269770993211a1503413566a339bbb4389a482fffcf8e1f76713fc3b94f5012103477b9f0f34ae85434ce795f0c5e1e90c9420e5b5fad084d7cce9a487b94a7902ffffffffe56582d2119100cb1d3da8232291e053f71e25fb669c87b32a667749959ea239010000006a473044022052e1419bb237b9db400ab5e3df16db6355619d545fde9030924a360763ae9ad40220704beab04d72ecaeb42eca7d98faca7a0941e65f2e1341f183be2b83e6b09e1c012103477b9f0f34ae85434ce795f0c5e1e90c9420e5b5fad084d7cce9a487b94a7902fffffffffdff00'; serializedTx = serializedTx + 'd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088ac'.repeat(total); serializedTx = serializedTx + '00000000'; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx, @@ -328,9 +321,9 @@ const lotsOfOutputs = (): SubtestSignTransaction => { }; }; -const feeTooHigh = (): SubtestSignTransaction => { +const feeTooHigh = () => { // See tx 1570416eb4302cf52979afd5e6909e37d8fdd874301f7cc87e547e509cb1caa6 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bitcoin', @@ -351,7 +344,7 @@ const feeTooHigh = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0100000001a6cab19c507e547ec87c1f3074d8fdd8379e90e6d5af7929f52c30b46e417015000000006b483045022100dc3531da7feb261575f03b5b9bbb35edc7f73bb081c92538827105de4102737002200161e34395f6a8ee93979200cb974fa75ccef6d7c14021511cf468eece90d6450121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff01d018ee05000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac00000000', @@ -366,9 +359,9 @@ const feeTooHigh = (): SubtestSignTransaction => { }; }; -const notEnoughFunds = (): SubtestSignTransaction => { +const notEnoughFunds = () => { // See tx d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bitcoin', @@ -389,7 +382,7 @@ const notEnoughFunds = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { code: 'Failure_NotEnoughFunds', @@ -404,10 +397,10 @@ const notEnoughFunds = (): SubtestSignTransaction => { }; }; -const spendCoinbase = (): SubtestSignTransaction => { +const spendCoinbase = () => { // 25 TEST generated to m/1 (mfiGQVPcRcaEvQPYDErR34DcCovtxYvUUV) // See tx d6da21677d7cca5f42fbc7631d062c9ae918a0254f7c6c22de8e8cb7fd5b8236 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -428,7 +421,7 @@ const spendCoinbase = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '010000000136825bfdb78c8ede226c7c4f25a018e99a2c061d63c7fb425fca7c7d6721dad6000000006a473044022047845c366eb24f40be315c7815a154513c444c7989eb80f7ce7ff6aeb703d26a022007c1f5efadf67c5889634fd7ac39a7ce78bffac291673e8772ecd8389c901d9f01210338d78612e990f2eea0c426b5e48a8db70b9d7ed66282b3b26511e0b1c75515a6ffffffff01c6100795000000001976a9143d2496e67f5f57a924353da42d4725b318e7a8ea88ac00000000', @@ -443,9 +436,9 @@ const spendCoinbase = (): SubtestSignTransaction => { }; }; -const twoChanges = (): SubtestSignTransaction => { +const twoChanges = () => { // tx e5040e1bc1ae7667ffb9e5248e90b2fb93cd9150234151ce90e14ab2f5933bcd - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -478,7 +471,7 @@ const twoChanges = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ '30440220246a5d5d21730d5de70ce9b9f46067b7bee2a448361a8a42274a8a9408b3211d022035c5fe94b8ee3c825d1c3ae86e31ec64671db27c6488cbc616b4c21b79902727' ], @@ -494,8 +487,8 @@ const twoChanges = (): SubtestSignTransaction => { }; }; -const p2sh = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const p2sh = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bitcoin', @@ -516,7 +509,7 @@ const p2sh = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0100000001a3fb2d38322c3b327e54005cebc0686d52fcdf536e53bb5ef481a7de8056aa54010000006b4830450221009e020b0390ccad533b73b552f8a99a9d827212c558e4f755503674d07c92ad4502202d606f7316990e0461c51d4add25054f19c697aa3e3c2ced4d568f0b2c57e62f0121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0170f305000000000017a9147f844bdb0b8fd54b64e3d16c85dc1170f1ff97c18700000000', @@ -531,8 +524,8 @@ const p2sh = (): SubtestSignTransaction => { }; }; -const changeOnMainChainAllowed = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const changeOnMainChainAllowed = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -559,7 +552,7 @@ const changeOnMainChainAllowed = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: ['304402202cf32c9a07a8bd86061df3554d9b0cfad516006a9b368e1c016dff3492ac2ac1022069927e583bdcdc48e254f2f1da6e8cd4b1338ca102e6200ac47a160b14b10b9b'], @@ -575,7 +568,7 @@ const changeOnMainChainAllowed = (): SubtestSignTransaction => { }; }; -export const signTransaction = (): TestFunction => { +export const signTransaction = () => { const availableSubtests = { oneOneFee, oneTwoFee, diff --git a/src/__tests__/core/signTransactionBcash.spec.js b/src/__tests__/core/signTransactionBcash.spec.js index cad319822..e84337833 100644 --- a/src/__tests__/core/signTransactionBcash.spec.js +++ b/src/__tests__/core/signTransactionBcash.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; +import type { SignTransaction } from '../../js/types'; -const change = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const change = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bcash', @@ -38,7 +31,7 @@ const change = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: ['3045022100ecaa81efe52d31cb0b9cf49a3a5ef4e4b3c6c6d4379deaa0be7c1d80fa65b44d022035ed7ca3a05d91ec554baab6f0bb2950ca8570887bb2a7252c1cb2e2e523aa10'], @@ -54,8 +47,8 @@ const change = (): SubtestSignTransaction => { }; }; -const noChange = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const noChange = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bcash', @@ -85,7 +78,7 @@ const noChange = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -104,8 +97,8 @@ const noChange = (): SubtestSignTransaction => { }; }; -const oldAddr = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const oldAddr = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bcash', @@ -136,7 +129,7 @@ const oldAddr = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: false }, ]; @@ -147,7 +140,7 @@ const oldAddr = (): SubtestSignTransaction => { }; }; -export const signTransactionBcash = (): TestFunction => { +export const signTransactionBcash = () => { const availableSubtests = { change, noChange, diff --git a/src/__tests__/core/signTransactionBech32.spec.js b/src/__tests__/core/signTransactionBech32.spec.js index 50db45aaf..4c87e4766 100644 --- a/src/__tests__/core/signTransactionBech32.spec.js +++ b/src/__tests__/core/signTransactionBech32.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; +import type { SignTransaction } from '../../js/types'; -const threeOutputs = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const threeOutputs = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -44,7 +37,7 @@ const threeOutputs = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -62,8 +55,8 @@ const threeOutputs = (): SubtestSignTransaction => { }; }; -const threeInputs = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const threeInputs = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -104,7 +97,7 @@ const threeInputs = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -122,8 +115,8 @@ const threeInputs = (): SubtestSignTransaction => { }; }; -const opReturn = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const opReturn = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -152,7 +145,7 @@ const opReturn = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -170,7 +163,7 @@ const opReturn = (): SubtestSignTransaction => { }; }; -export const signTransactionBech32 = (): TestFunction => { +export const signTransactionBech32 = () => { const availableSubtests = { threeOutputs, threeInputs, diff --git a/src/__tests__/core/signTransactionBgold.spec.js b/src/__tests__/core/signTransactionBgold.spec.js index 45a247c37..80e18aa59 100644 --- a/src/__tests__/core/signTransactionBgold.spec.js +++ b/src/__tests__/core/signTransactionBgold.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; +import type { SignTransaction } from '../../js/types'; -const change = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const change = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bgold', @@ -37,7 +30,7 @@ const change = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -55,8 +48,8 @@ const change = (): SubtestSignTransaction => { }; }; -const noChange = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const noChange = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bgold', @@ -87,7 +80,7 @@ const noChange = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -106,8 +99,8 @@ const noChange = (): SubtestSignTransaction => { }; }; -const p2sh = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const p2sh = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bgold', @@ -136,7 +129,7 @@ const p2sh = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -154,8 +147,8 @@ const p2sh = (): SubtestSignTransaction => { }; }; -const p2shWitnessChange = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const p2shWitnessChange = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bgold', @@ -184,7 +177,7 @@ const p2shWitnessChange = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -202,11 +195,11 @@ const p2shWitnessChange = (): SubtestSignTransaction => { }; }; -const sendMultisig1 = (): SubtestSignTransaction => { +const sendMultisig1 = () => { const address_n = [999 | 0x80000000, 1 | 0x80000000, 1 | 0x80000000, 2, 0]; address_n[2] = 0x80000003; - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bgold', @@ -246,7 +239,7 @@ const sendMultisig1 = (): SubtestSignTransaction => { ], }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -264,7 +257,7 @@ const sendMultisig1 = (): SubtestSignTransaction => { }; }; -export const signTransactionBgold = (): TestFunction => { +export const signTransactionBgold = () => { const availableSubtests = { change, noChange, diff --git a/src/__tests__/core/signTransactionCapricoin.spec.js b/src/__tests__/core/signTransactionCapricoin.spec.js index ec7a3fdce..498adba1d 100644 --- a/src/__tests__/core/signTransactionCapricoin.spec.js +++ b/src/__tests__/core/signTransactionCapricoin.spec.js @@ -1,16 +1,9 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; +import type { SignTransaction } from '../../js/types'; -const signCPC = (): SubtestSignTransaction => { +const signCPC = () => { // See tx 1bf227e6e24fe1f8ac98849fe06a2c5b77762e906fcf7e82787675f7f3a10bb8 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Capricoin', @@ -88,7 +81,7 @@ const signCPC = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '01000000665ccf5b025f23e76913e3e53bc20a6c5db1607cc162d197c7dd791689da4ee81cc806f53b000000006b483045022100fce7ccbeb9524f36d118ebcfebcb133a05c236c4478e2051cfd5c9632920aee602206921b7be1a81f30cce3d8e7dba4597fc16a2761c42321c49d65eeacdfe3781250121021fcf98aee04939ec7df5762f426dc2d1db8026e3a73c3bbe44749dacfbb61230ffffffff8c5e2c3ff2a6758e423f6d99f8ecf9f856e0e8ba29276dd7ff2d1b1f41e6a6f3010000006a473044022015d967166fe9f89fbed8747328b1c4658aa1d7163e731c5fd5908feafe08e9a6022028af30801098418bd298cc60b143c52c48466f5791256721304b6eba4fdf0b3c0121021fcf98aee04939ec7df5762f426dc2d1db8026e3a73c3bbe44749dacfbb61230ffffffff01a0782d00000000001976a914818437acfd15780debd31f3fd21d4ca678bb36d188ac00000000', @@ -103,9 +96,9 @@ const signCPC = (): SubtestSignTransaction => { }; }; -const oneTwoFee = (): SubtestSignTransaction => { +const oneTwoFee = () => { // See tx 8302cb4b32815ac47e0d1a63081a7bbef843efeb7e29c414975f33dfe8b50e35 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Capricoin', @@ -152,7 +145,7 @@ const oneTwoFee = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0100000034b1cd5b0124ee1ea31c6afd78f9dfe0ed765b8ca71f0cfab1f5f19675286d46c7ec405391000000006b483045022100d1ea4b08fa18b6c672d859939b4729f6c7aedb86ccf6dec8fd951cf49116415502206690a32ae8e0a02bbcae6102cedae0d14d2291f758eff786f85eb4642145a2f50121021fcf98aee04939ec7df5762f426dc2d1db8026e3a73c3bbe44749dacfbb61230ffffffff02184f0700000000001976a914b5fcce71b52fe2a05479610906e6aa81f4a6e76488ac40420f00000000001976a914544e87b53141b883b392d114168c5403899756c488ac00000000', @@ -167,9 +160,9 @@ const oneTwoFee = (): SubtestSignTransaction => { }; }; -const twoTwoFee = (): SubtestSignTransaction => { +const twoTwoFee = () => { // See tx f65956f14d960fce26dc03948306516c606dd33b7612d063008fea390d48b12b - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Capricoin', @@ -238,7 +231,7 @@ const twoTwoFee = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '01000000f6efcd5b02d810ce8b12fe515ecf29540eb5a440941b279606349612498f0d7a7a45cb003d000000006a47304402202a69b2ec8eba6f3b71b3064571f712093d41aa9058e4ac241c0afea3d6da77b0022026c07274b4a65059082373e515fc2fe0631ff12c35fdbe6b7007d17f41fa155c0121021fcf98aee04939ec7df5762f426dc2d1db8026e3a73c3bbe44749dacfbb61230ffffffffa158ffd52844c3372c900d95bf49ddda0fe3c8802ec85d60aaa2282da653458c000000006a473044022010ef754dd83044a2e5ccca4b25193cd2662461a0a02c00b7d88b2a73c6d388c602205a8f8844fe1eb1f1f5b1c199165a1487879b82fb012c831809e2a822ec32ca070121034e9fef46313529347cddd19994817f446a3667a0652e57dc8cfe24a8c903f0f1ffffffff02b0e20d00000000001976a914818437acfd15780debd31f3fd21d4ca678bb36d188ac88130000000000001976a914fe251c9c3f10efafe8ede9b2a6d58c326622cc7388ac00000000', @@ -253,9 +246,9 @@ const twoTwoFee = (): SubtestSignTransaction => { }; }; -const notEnoughFunds = (): SubtestSignTransaction => { +const notEnoughFunds = () => { // See tx 915340ecc7466d287596f1f5b1fa0c1fa78c5b76ede0dff978fd6a1ca31eee24 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Capricoin', @@ -297,7 +290,7 @@ const notEnoughFunds = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { code: 'Failure_NotEnoughFunds', @@ -312,9 +305,9 @@ const notEnoughFunds = (): SubtestSignTransaction => { }; }; -const feeTooHigh = (): SubtestSignTransaction => { +const feeTooHigh = () => { // See tx 1570416eb4302cf52979afd5e6909e37d8fdd874301f7cc87e547e509cb1caa6 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Capricoin', @@ -355,7 +348,7 @@ const feeTooHigh = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '01000000cabfcd5b01bbfd9ff673b26e20ec3f4bd02252eb124883699bd881d63cde9582de54bba9f8000000006b483045022100d4302192de219a5a2d3c0ff9a6e60669031243bf94eae5cdad0031c813f0baea02204656145c113c6d144af80e6d9d2cfd0caa394180afa90ffd2197ec08bcf807380121034e9fef46313529347cddd19994817f446a3667a0652e57dc8cfe24a8c903f0f1ffffffff01301b0f00000000001976a914369df3cc0eb7acd7f0e0491a225a2ddad5ce3d4a88ac00000000', @@ -370,7 +363,7 @@ const feeTooHigh = (): SubtestSignTransaction => { }; }; -export const signTransactionCapricoin = (): TestFunction => { +export const signTransactionCapricoin = () => { return { testName: 'SignTransactionCapricoin', mnemonic: 'mnemonic_all', diff --git a/src/__tests__/core/signTransactionDash.spec.js b/src/__tests__/core/signTransactionDash.spec.js index 3be9ec991..867ddb78c 100644 --- a/src/__tests__/core/signTransactionDash.spec.js +++ b/src/__tests__/core/signTransactionDash.spec.js @@ -1,16 +1,9 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; +import type { SignTransaction } from '../../js/types'; -const normalTx = (): SubtestSignTransaction => { +const normalTx = () => { // See https://dash1.trezor.io/tx/be1af4a0e1eaccf86767836b42ee0938cceba16d0dd6c283f476db692c961f41 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Dash', @@ -31,7 +24,7 @@ const normalTx = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '010000000165c66bfaa900e2e62891e18385d23ee28db9dda1a3ef432d5df842fb92295224010000006a473044022061db2e7970f5cc6a8bbd1547103f28558e36177862e8fc13ea5b69dd199b52560220277451bb5ce650a95e5f67019ca0ddaa1fef221310c52bd1919e54a5caae5b4b012102936f80cac2ba719ddb238646eb6b78a170a55a52a9b9f08c43523a4a6bd5c896ffffffff01ac3a0f00000000001976a9147e6191bd0404cb41ed67e041bd674e2a5c9d280188ac00000000', @@ -47,9 +40,9 @@ const normalTx = (): SubtestSignTransaction => { }; // NOTE: this is not a valid transaction -const specialInput = (): SubtestSignTransaction => { +const specialInput = () => { // Input from https://dash1.trezor.io/tx/adb43bcd8fc99d6ed353c30ca8e5bd5996cd7bcf719bd4253f103dfb7227f6ed - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Dash', @@ -70,7 +63,7 @@ const specialInput = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0100000001edf62772fb3d103f25d49b71cf7bcd9659bde5a80cc353d36e9dc98fcd3bb4ad000000006b483045022100f7f940f5e3ca4cbe5d787d2dfb121dc56cd224da647b17a170e5e03b29e68744022002cc9d9d6b203180d1f68e64ba8a73fd9e983cca193b7bcf94e0156ed245bdfa012102936f80cac2ba719ddb238646eb6b78a170a55a52a9b9f08c43523a4a6bd5c896ffffffff01c037f409000000001976a9146a341485a9444b35dc9cb90d24e7483de7d37e0088ac00000000', @@ -87,7 +80,7 @@ const specialInput = (): SubtestSignTransaction => { // NOTE: this is not a valid transaction -export const signTransactionDash = (): TestFunction => { +export const signTransactionDash = () => { const availableSubtests = { normalTx, specialInput, diff --git a/src/__tests__/core/signTransactionDoge.spec.js b/src/__tests__/core/signTransactionDoge.spec.js index da6fcbacf..2dd56863a 100644 --- a/src/__tests__/core/signTransactionDoge.spec.js +++ b/src/__tests__/core/signTransactionDoge.spec.js @@ -1,17 +1,10 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; +import type { SignTransaction } from '../../js/types'; // Note: this transaction is not valid // it uses some inputs from coin exchange to test big amounts calculation -const bigAmounts = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const bigAmounts = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Doge', @@ -38,7 +31,7 @@ const bigAmounts = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -56,7 +49,7 @@ const bigAmounts = (): SubtestSignTransaction => { }; }; -export const signTransactionDoge = (): TestFunction => { +export const signTransactionDoge = () => { const availableSubtests = { bigAmounts, }; diff --git a/src/__tests__/core/signTransactionKomodo.spec.js b/src/__tests__/core/signTransactionKomodo.spec.js index 988b39d1e..5974a4cb2 100644 --- a/src/__tests__/core/signTransactionKomodo.spec.js +++ b/src/__tests__/core/signTransactionKomodo.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; +import type { SignTransaction } from '../../js/types'; -const feeSapling = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const feeSapling = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'kmd', @@ -58,7 +51,7 @@ const feeSapling = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0400008085202f89011d0f8e0c6ba2dcf8be8e5f9024771dceb4c8e4120fab8c072b8eec26b1c50728000000006a4730440220158c970ca2fc6bcc33026eb5366f0342f63b35d178f7efb334b1df78fe90b67202207bc4ff69f67cf843b08564a5adc77bf5593e28ab4d5104911824ac13fe885d8f012102a87aef7b1a8f676e452d6240767699719cd58b0261c822472c25df146938bca5ffffffff01d0359041000000001976a91400178fa0b6fc253a3a402ee2cadd8a7bfec08f6388acb8302a5d000000000000000000000000000000', @@ -73,8 +66,8 @@ const feeSapling = (): SubtestSignTransaction => { }; }; -const rewardsClaim = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const rewardsClaim = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'kmd', @@ -128,7 +121,7 @@ const rewardsClaim = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0400008085202f8901b134cddb4951fe1acd7744bf9b828a816501570ed8ebd4f076979e1191bd287b000000006a4730440220483a58f5be3a147c773c663008c992a7fcea4d03bdf4c1d4bc0535c0d98ddf0602207b19d69140dd00c7a94f048c712aeaed55dfd27f581c7212d9cc5e476fe1dc9f012102a87aef7b1a8f676e452d6240767699719cd58b0261c822472c25df146938bca5ffffffff02c00e9041000000001976a91400178fa0b6fc253a3a402ee2cadd8a7bfec08f6388acf5360100000000001976a91400178fa0b6fc253a3a402ee2cadd8a7bfec08f6388acf2f12a5d000000000000000000000000000000', @@ -143,7 +136,7 @@ const rewardsClaim = (): SubtestSignTransaction => { }; }; -export const signTransactionKomodo = (): TestFunction => { +export const signTransactionKomodo = () => { return { testName: 'SignTransactionKomodo', mnemonic: 'mnemonic_all', diff --git a/src/__tests__/core/signTransactionMultisig.spec.js b/src/__tests__/core/signTransactionMultisig.spec.js index 78a81740c..2bbb737fb 100644 --- a/src/__tests__/core/signTransactionMultisig.spec.js +++ b/src/__tests__/core/signTransactionMultisig.spec.js @@ -1,14 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; -const twoOfThree = (): SubtestSignTransaction => { - const testPayloads: Array = [ +import type { SignTransaction } from '../../js/types'; + +const twoOfThree = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bitcoin', @@ -85,7 +79,7 @@ const twoOfThree = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -110,8 +104,8 @@ const twoOfThree = (): SubtestSignTransaction => { }; }; -const fifteenOfFifteen = (): SubtestSignTransaction => { - const pubkeys: Array<{ node: string, address_n: Array}> = []; +const fifteenOfFifteen = () => { + const pubkeys = []; const signatures: Array = [ '304502210098e23085ad7282de988bf98afa1e9add9c9830009132f8902a9fa4624d5dc98b0220733216e70ab67791aa64be5c83d2050cb4ed9ff7eda2a1acc35da024d2ab2a67', '304402201f8c11fb6e90fd616e484986e9451929797eba039882a9abcc203210948060b9022044da031530de7d9747d3c5a8e7cec04b04b7af495c9120b854ce7362af7fa05a', @@ -138,7 +132,7 @@ const fifteenOfFifteen = (): SubtestSignTransaction => { ); } - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bitcoin', @@ -164,7 +158,7 @@ const fifteenOfFifteen = (): SubtestSignTransaction => { ], }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '01000000011553ef34c683f4d6a8d346844409e6e7fc4ff01eaa25b7e8ce215abbfee3896101000000fd43060048304502210098e23085ad7282de988bf98afa1e9add9c9830009132f8902a9fa4624d5dc98b0220733216e70ab67791aa64be5c83d2050cb4ed9ff7eda2a1acc35da024d2ab2a670147304402201f8c11fb6e90fd616e484986e9451929797eba039882a9abcc203210948060b9022044da031530de7d9747d3c5a8e7cec04b04b7af495c9120b854ce7362af7fa05a01483045022100ea67c70186acef019bdf1551881bf38e6f88186501b64d3a756a2ce18e4ba18002201c35110325653e21e448b60053a4b5dda46b61096faf701a1faca61fcde91f00014730440220315598992f156d2f9d7b4275395fa067aa61ea95829fa17730885c86df4de70d02203eda9ade1656e2198c668603b17e197acb0969ed183ab0841303ea261205618901473044022060fdd6621edde9b8cf6776bc4eef26ace9b57514d725b7214ba11d333520a30e022044c30744f94484aec0f896233c5613a3256878ec0379f566226906b6d1b6061401483045022100b1d907e3574f60f7834c7e9f2e367998ce0461dad7d742d84ef8917d713f41f902203b3ac54f7bb2f7fb8685f582d2a94f7213a37cb508acffe29090cc06ae01588b01483045022100e3bf90ff3ad6395e42f46002f253f94ca0e8ffaa0620f2ceb4fa21493abdca4d02201d4c28b10b740bb2dc4b3695b4205c18f8c0dad2bb69540eb8a36576463cd5280147304402202cfaf9fab7dc1c9f0c3c23bd46bd6d5cea0664d914139fc9add80766ce998808022012db2802c07853e4cbe147afdf0b47e60bdcbcd31f9df19e04c177ed9aa66c6d0147304402207cbc2d83f351eee5ee91df26bb0c7e1cb07fe328cbbcdb0bb9656d37922c497302201b3435d4c71ffd1b34d45892f2a487bd79c8c7f57cc04373287642bb9610cb840147304402202dc3eab30ccb06553703e794212f43ee9a659f5e787a8374e9ea0bf6de0def7402201a70e970c21a807783313ed102bf4f0a3406ac7c84f94bc8194c5e209464d7230147304402206b04530c190c46a879d7771a6ad53acd33547e0d7fd320d5ad0b5b1fdeb5d4c202207b812be81c3419daadc942cca0c55aa32c7759fa7566c6dc35f030ca87a1c5be01483045022100ce523dddd6eef73d5ae7c44c870466e1ac5a7a77d43475e8def024af68977a1e022028be0276435bfa2ea887d6cf89fa829f96c1c7a55edc57bb3fd667d523fd3bf601473044022019410b20ebcd8eb3ee7ec1eff6bf0f9cbfaea82116811c61f3cf24af7e4434b1022009e5823f3349f695be09ae40754185300d8442a22715ddb5ffa17c4213140e7201483045022100964ef26a9074c3cdafffcfbe4bd445933f8c842ba11fd887922adcf7fabe0c82022023055d94c75ab223c767fbaa825c917e9beecbc7d5758cccf20d886c63d4b72a0147304402207aa3a98197697d258a8baae681f0b4c0ee682982f4205534e6c95a37dabaddd60220517a7ed5c03da2f242e17ccfdae0d81d6f454d7f9ea931fc62df6c0eab922186014d01025f21023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43d210338d78612e990f2eea0c426b5e48a8db70b9d7ed66282b3b26511e0b1c75515a621038caebd6f753bbbd2bb1f3346a43cd32140648583673a31d62f2dfb56ad0ab9e32103477b9f0f34ae85434ce795f0c5e1e90c9420e5b5fad084d7cce9a487b94a79022103fe91eca10602d7dad4c9dab2b2a0858f71e25a219a6940749ce7a48118480dae210234716c01c2dd03fa7ee302705e2b8fbd1311895d94b1dca15e62eedea9b0968f210341fb2ead334952cf60f4481ba435c4693d0be649be01d2cfe9b02018e483e7bd2102dad8b2bce360a705c16e74a50a36459b4f8f4b78f9cd67def29d54ef6f7c7cf9210222dbe3f5f197a34a1d50e2cbe2a1085cac2d605c9e176f9a240e0fd0c669330d2103fb41afab56c9cdb013fda63d777d4938ddc3cb2ad939712da688e3ed333f95982102435f177646bdc717cb3211bf46656ca7e8d642726144778c9ce816b8b8c36ccf2102158d8e20095364031d923c7e9f7f08a14b1be1ddee21fe1a5431168e31345e5521026259794892428ca0818c8fb61d2d459ddfe20e57f50803c7295e6f4e2f5586652102815f910a8689151db627e6e262e0a2075ad5ec2993a6bc1b876a9d420923d681210318f54647f645ff01bd49fedc0219343a6a22d3ea3180a3c3d3097e4b888a8db45faeffffffff0110270000000000001976a9144a087d89f8ad16ca029c675b037c02fd1c5f9aec88ac00000000', @@ -179,8 +173,8 @@ const fifteenOfFifteen = (): SubtestSignTransaction => { }; }; -const missingPubkey = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const missingPubkey = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Bitcoin', @@ -220,7 +214,7 @@ const missingPubkey = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: false }, ]; @@ -231,7 +225,7 @@ const missingPubkey = (): SubtestSignTransaction => { }; }; -export const signTransactionMultisig = (): TestFunction => { +export const signTransactionMultisig = () => { const availableSubtests = { twoOfThree, fifteenOfFifteen, diff --git a/src/__tests__/core/signTransactionMultisigChange.spec.js b/src/__tests__/core/signTransactionMultisigChange.spec.js index 22f67bff3..eb9cec529 100644 --- a/src/__tests__/core/signTransactionMultisigChange.spec.js +++ b/src/__tests__/core/signTransactionMultisigChange.spec.js @@ -1,12 +1,5 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; +import type { SignTransaction } from '../../js/types'; const xpubExt1 = 'tpubDADHV9u9Y6gkggintTdMjJE3be58zKNLhpxBQyuEM6Pwx3sN9JVLmMCMN4DNVwL9AKec27z5TaWcWuHzMXiGAtcra5DjwWbvppGX4gaEGVN'; const xpubExt2 = 'tpubDADHV9u9Y6gkhWXBmDJ6TUhZajLWjvKukRe2w9FfhdbQpUux8Z8jnPHNAZqFRgHPg9sR7YR93xThM32M7NfRu8S5WyDtext7S62sqxeJNkd'; @@ -90,8 +83,8 @@ const input2 = { multisig: multisig3, }; */ -const externalExternal = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const externalExternal = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -110,7 +103,7 @@ const externalExternal = (): SubtestSignTransaction => { ], }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0100000002e53cf4e3fcd37f8c439286ce636476e1faeebf86bbb2f228a6b78d1b47c8c61601000000b400473044022064f13801744a6c21b694f62cdb5d834e852f13ecf85ed4d0a56ba279571c24e3022010fab4cb05bdd7b24c8376dda4f62a418548eea6eb483e58675fa06e0d5c642c014c69522103dc07026aacb5918dac4e09f9da8290d0ae22161699636c22cace78082116a7792103e70db185fad69c2971f0107a42930e5d82a9ed3a11b922a96fdfc4124b63e54c2103f3fe007a1e34ac76c1a2528e9149f90f9f93739929797afab6a8e18d682fa71053aeffffffff185315ae8050e18efa70d6ca96378a1194f57e2b102511f68b3a1414ee340cd800000000b4004730440220727b2522268f913acd213c507d7801b146e5b6cef666ad44b769c26d6c762e4d022021c0c2e9e8298dee2a490d956f7ab1b2d3160c1e37a50cc6d19a5e62eb484fc9014c6952210297ad8a5df42f9e362ef37d9a4ddced89d8f7a143690649aa0d0ff049c7daca842103ed1fd93989595d7ad4b488efd05a22c0239482c9a20923f2f214a38e54f6c41a2103f91460d79e4e463d7d90cb75254bcd62b515a99a950574c721efdc5f711dff3553aeffffffff02005a6202000000001976a9149b139230e4fe91c05a37ec334dc8378f3dbe377088ac00639f02000000001976a914b0d05a10926a7925508febdbab9a5bd4cda8c8f688ac00000000', @@ -125,8 +118,8 @@ const externalExternal = (): SubtestSignTransaction => { }; }; -const externalInternal = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const externalInternal = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -145,7 +138,7 @@ const externalInternal = (): SubtestSignTransaction => { ], }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0100000002e53cf4e3fcd37f8c439286ce636476e1faeebf86bbb2f228a6b78d1b47c8c61601000000b400473044022064f13801744a6c21b694f62cdb5d834e852f13ecf85ed4d0a56ba279571c24e3022010fab4cb05bdd7b24c8376dda4f62a418548eea6eb483e58675fa06e0d5c642c014c69522103dc07026aacb5918dac4e09f9da8290d0ae22161699636c22cace78082116a7792103e70db185fad69c2971f0107a42930e5d82a9ed3a11b922a96fdfc4124b63e54c2103f3fe007a1e34ac76c1a2528e9149f90f9f93739929797afab6a8e18d682fa71053aeffffffff185315ae8050e18efa70d6ca96378a1194f57e2b102511f68b3a1414ee340cd800000000b4004730440220727b2522268f913acd213c507d7801b146e5b6cef666ad44b769c26d6c762e4d022021c0c2e9e8298dee2a490d956f7ab1b2d3160c1e37a50cc6d19a5e62eb484fc9014c6952210297ad8a5df42f9e362ef37d9a4ddced89d8f7a143690649aa0d0ff049c7daca842103ed1fd93989595d7ad4b488efd05a22c0239482c9a20923f2f214a38e54f6c41a2103f91460d79e4e463d7d90cb75254bcd62b515a99a950574c721efdc5f711dff3553aeffffffff02005a6202000000001976a9149b139230e4fe91c05a37ec334dc8378f3dbe377088ac00639f02000000001976a914b0d05a10926a7925508febdbab9a5bd4cda8c8f688ac00000000', @@ -160,8 +153,8 @@ const externalInternal = (): SubtestSignTransaction => { }; }; -const internalExternal = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const internalExternal = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -180,7 +173,7 @@ const internalExternal = (): SubtestSignTransaction => { ], }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0100000002e53cf4e3fcd37f8c439286ce636476e1faeebf86bbb2f228a6b78d1b47c8c61601000000b400473044022064f13801744a6c21b694f62cdb5d834e852f13ecf85ed4d0a56ba279571c24e3022010fab4cb05bdd7b24c8376dda4f62a418548eea6eb483e58675fa06e0d5c642c014c69522103dc07026aacb5918dac4e09f9da8290d0ae22161699636c22cace78082116a7792103e70db185fad69c2971f0107a42930e5d82a9ed3a11b922a96fdfc4124b63e54c2103f3fe007a1e34ac76c1a2528e9149f90f9f93739929797afab6a8e18d682fa71053aeffffffff185315ae8050e18efa70d6ca96378a1194f57e2b102511f68b3a1414ee340cd800000000b4004730440220727b2522268f913acd213c507d7801b146e5b6cef666ad44b769c26d6c762e4d022021c0c2e9e8298dee2a490d956f7ab1b2d3160c1e37a50cc6d19a5e62eb484fc9014c6952210297ad8a5df42f9e362ef37d9a4ddced89d8f7a143690649aa0d0ff049c7daca842103ed1fd93989595d7ad4b488efd05a22c0239482c9a20923f2f214a38e54f6c41a2103f91460d79e4e463d7d90cb75254bcd62b515a99a950574c721efdc5f711dff3553aeffffffff02005a6202000000001976a9149b139230e4fe91c05a37ec334dc8378f3dbe377088ac00639f02000000001976a914b0d05a10926a7925508febdbab9a5bd4cda8c8f688ac00000000', @@ -195,8 +188,8 @@ const internalExternal = (): SubtestSignTransaction => { }; }; -const multisigExternalExternal = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const multisigExternalExternal = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -215,7 +208,7 @@ const multisigExternalExternal = (): SubtestSignTransaction => { ], }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0100000002e53cf4e3fcd37f8c439286ce636476e1faeebf86bbb2f228a6b78d1b47c8c61601000000b400473044022059394e0dfcb2d2f4a6108703f801545ca5a820c0ac6a1859d0a3854813de55fa02207b6a57d70b82932ff58163336c461653a2dc82c78ed8157159e5178ac7325390014c69522103dc07026aacb5918dac4e09f9da8290d0ae22161699636c22cace78082116a7792103e70db185fad69c2971f0107a42930e5d82a9ed3a11b922a96fdfc4124b63e54c2103f3fe007a1e34ac76c1a2528e9149f90f9f93739929797afab6a8e18d682fa71053aeffffffff185315ae8050e18efa70d6ca96378a1194f57e2b102511f68b3a1414ee340cd800000000b40047304402205a911685f5b974b2fc4a19d5ce056218773a4d20b5eaae2c2f9594929308182002201e03449f5a8813ec19f408bf1b6f4f334886d6fcf9920e300fd7678ef0724f81014c6952210297ad8a5df42f9e362ef37d9a4ddced89d8f7a143690649aa0d0ff049c7daca842103ed1fd93989595d7ad4b488efd05a22c0239482c9a20923f2f214a38e54f6c41a2103f91460d79e4e463d7d90cb75254bcd62b515a99a950574c721efdc5f711dff3553aeffffffff02005a62020000000017a91466528dd543f94d162c8111d2ec248d25ba9b90948700639f020000000017a914f1fc92c0aed1712911c70a2e09ac15ff0922652f8700000000', @@ -230,7 +223,7 @@ const multisigExternalExternal = (): SubtestSignTransaction => { }; }; -export const signTransactionMultisigChange = (): TestFunction => { +export const signTransactionMultisigChange = () => { const availableSubtests = { externalExternal, externalInternal, diff --git a/src/__tests__/core/signTransactionPeercoin.spec.js b/src/__tests__/core/signTransactionPeercoin.spec.js index 8b82b970b..1ca9619ce 100644 --- a/src/__tests__/core/signTransactionPeercoin.spec.js +++ b/src/__tests__/core/signTransactionPeercoin.spec.js @@ -1,16 +1,9 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; +import type { SignTransaction } from '../../js/types'; -const signPPC = (): SubtestSignTransaction => { +const signPPC = () => { // See tx f7e3624c143b6a170cc44f9337d0fa8ea8564a211de9c077c6889d8c78f80909 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Peercoin', @@ -59,7 +52,7 @@ const signPPC = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '010000008a44c55d013d7d3531b0881f244d1f353c208fd00cb18bd152a054460aa4eed815d69ab241000000006a473044022025c0ea702390c702c7ae8b5ea469820bea8d942c8c16439f8f0ba2e91e699efc02200db9b0a48fa2861695fa91df4831a4c7306587e5d2dc85419647f462717bc8f001210274cb0ee652d9457fbb0f3872d43155a6bc16f77bd5749d8826b53db443b1b278ffffffff01905f0100000000001976a914ff9a05654150fdc92b1655f49d7f2a8aaf6a3a2a88ac00000000', @@ -74,9 +67,9 @@ const signPPC = (): SubtestSignTransaction => { }; }; -const notEnoughFunds = (): SubtestSignTransaction => { +const notEnoughFunds = () => { // See tx 915340ecc7466d287596f1f5b1fa0c1fa78c5b76ede0dff978fd6a1ca31eee24 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Peercoin', @@ -126,7 +119,7 @@ const notEnoughFunds = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { code: 'Failure_NotEnoughFunds', @@ -141,7 +134,7 @@ const notEnoughFunds = (): SubtestSignTransaction => { }; }; -export const signTransactionPeercoin = (): TestFunction => { +export const signTransactionPeercoin = () => { return { testName: 'SignTransactionPeercoin', mnemonic: 'mnemonic_all', diff --git a/src/__tests__/core/signTransactionSegwit.spec.js b/src/__tests__/core/signTransactionSegwit.spec.js index e75743ba0..c3bfe7125 100644 --- a/src/__tests__/core/signTransactionSegwit.spec.js +++ b/src/__tests__/core/signTransactionSegwit.spec.js @@ -1,15 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; +import type { SignTransaction } from '../../js/types'; -const sendP2sh = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const sendP2sh = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -37,7 +30,7 @@ const sendP2sh = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -55,8 +48,8 @@ const sendP2sh = (): SubtestSignTransaction => { }; }; -const sendP2shChange = (): SubtestSignTransaction => { - const testPayloads: Array = [ +const sendP2shChange = () => { + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -84,7 +77,7 @@ const sendP2shChange = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -102,10 +95,10 @@ const sendP2shChange = (): SubtestSignTransaction => { }; }; -const sendMultisig1 = (): SubtestSignTransaction => { +const sendMultisig1 = () => { const address = [999 | 0x80000000, 1 | 0x80000000, 1 | 0x80000000, 2, 0]; address[2] = 0x80000003; - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Testnet', @@ -146,7 +139,7 @@ const sendMultisig1 = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signatures: [ @@ -164,7 +157,7 @@ const sendMultisig1 = (): SubtestSignTransaction => { }; }; -export const signTransactionSegwit = (): TestFunction => { +export const signTransactionSegwit = () => { const availableSubtests = { sendP2sh, sendP2shChange, diff --git a/src/__tests__/core/signTransactionZcash.spec.js b/src/__tests__/core/signTransactionZcash.spec.js index 67a96769e..082d281a0 100644 --- a/src/__tests__/core/signTransactionZcash.spec.js +++ b/src/__tests__/core/signTransactionZcash.spec.js @@ -1,16 +1,9 @@ /* @flow */ -import type { - TestFunction, - SubtestSignTransaction, -} from 'flowtype/tests'; -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; +import type { SignTransaction } from '../../js/types'; -const signInputVersion2 = (): SubtestSignTransaction => { +const signInputVersion2 = () => { // See https://zec1.trezor.io/tx/0f762a2da5252d684fb3510a3104bcfb556fab34583b3b0e1994d0f7409cc075 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Zcash', @@ -31,7 +24,7 @@ const signInputVersion2 = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '01000000013adce2e9d7d0471817cd9dc74198f431b1958f5b74583ca3d12346db8955d229000000006b483045022100f36da2fba65831c24bae2264892d914abdf65ee747ba9e8deeaeb13d1c72b03102200b8ecb59698dbe90f8cfe529a6d05c8b7fa2f31a2f5a7a1b993700a20d04d63a0121022f5c53b6d2e1b64c37d85716dbef318bd398ad7d2a03d94960af060402380658ffffffff01081a0100000000001976a9142e383c56fe3df202792e6f4460c8056b6a4d5b3488ac00000000', @@ -46,9 +39,9 @@ const signInputVersion2 = (): SubtestSignTransaction => { }; }; -const signTwoInputsTxVersion1 = (): SubtestSignTransaction => { +const signTwoInputsTxVersion1 = () => { // See https://zec1.trezor.io/tx/e5229ae8c02f74af5e0c2100371710424fa85902c29752498c39921de2246824 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Zcash', @@ -74,7 +67,7 @@ const signTwoInputsTxVersion1 = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '01000000022adff4e740f4db482e8e83ced93fed3828504fdc51d84080e6ce4b24a63a5384000000006a473044022066a25c3b0fe18b17327f6080d9e5a26a880cf6ae6c47ff9b7bf9f8a59ab36814022065e4abcdff6f84311ac120b689e5a69db80312446731ab8fe1b3026e29c11ede0121032fd3a554fc321693de4b7cf66649da7726c4d0d3849a7b947774e04d54e38f91ffffffff2adff4e740f4db482e8e83ced93fed3828504fdc51d84080e6ce4b24a63a5384010000006a473044022009fb8f5c4a3ad7960f64a573084b7dec2b73bbe7044328ff05cb6106153014ef022035ab922f75a7c0ff07acd7e99b2469551ce7ff5b830c102d38d175bf3fa8ab74012102a1eb5e72ebdf2a6650593167a4c8391d9a37c2df19e1034fd0e4dc5b525696e9ffffffff01e4270000000000001976a91497e66840d01e615bdcea4a39a1b3afd0a27e6b0188ac00000000', @@ -90,9 +83,9 @@ const signTwoInputsTxVersion1 = (): SubtestSignTransaction => { }; // NOTE: this is not a valid transaction -const signTwoInputsWithChangeVersion3 = (): SubtestSignTransaction => { +const signTwoInputsWithChangeVersion3 = () => { // Inputs from https://zec1.trezor.io/tx/e2802f0118d9f41f68b65f2b9f4a7c2efc876aee4e8c4b48c4a4deef6b7c0c28 - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Zcash', @@ -128,7 +121,7 @@ const signTwoInputsWithChangeVersion3 = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '030000807082c4030279ac50582b99028697df6b73f2966f8d17867ec57e8f24cde117fac6cd3cf56d010000006b483045022100f960b9c81d873f3dfafa828f8dbbe7ea88eec4fee41e1e7ccd42113e4b185838022050558c9398572d1c5003aac0b796acf1f177474879fa57c259659be1f9f07de70121032fd3a554fc321693de4b7cf66649da7726c4d0d3849a7b947774e04d54e38f91ffffffffe32ef09055993e26e042e07e85cd9fdd787d91c2591e058eb8fce89219d1e1e7000000006a47304402203a1662a30ae7a54b9b44206f1ee70ce7c5545003e932edcc2a60f01e3ecc90cb0220076e2e963518cee173c0f39b783a48f0fd418e99bb8175defd12993b93a83af1012102a1eb5e72ebdf2a6650593167a4c8391d9a37c2df19e1034fd0e4dc5b525696e9ffffffff0240899500000000001976a9142875b160968fae11ca7fdd0174825c812f24f05688aca0860100000000001976a914d32faea5595826da401c0e486418afd51ce7815488ac000000000000000000', @@ -144,9 +137,9 @@ const signTwoInputsWithChangeVersion3 = (): SubtestSignTransaction => { }; // NOTE: this is not a valid transaction -const signOneInputVersion4 = (): SubtestSignTransaction => { +const signOneInputVersion4 = () => { // Inputs from https://zec1.trezor.io/tx/234b2cf6cb2a50be29f45efae27fe717e3bb31967a72927d122cac1f50988cab - const testPayloads: Array = [ + const testPayloads: SignTransaction[] = [ { method: 'signTransaction', coin: 'Zcash', @@ -171,7 +164,7 @@ const signOneInputVersion4 = (): SubtestSignTransaction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { serializedTx: '0400008085202f8901f8e85d52de81eef3a070170c5ad212e119887b6dbbda768949fdc939f3f56442000000006b483045022100a9119b34149aa1a14832a4b354d5f36b48f2f149cac78c0c4860cfb2dde1b1f0022013fcdbecc7244d474862e555af159e939b349d757735fd67f477ec13fb13e8d50121032fd3a554fc321693de4b7cf66649da7726c4d0d3849a7b947774e04d54e38f91ffffffff01662a0000000000001976a91497e66840d01e615bdcea4a39a1b3afd0a27e6b0188ac00000000000000000000000000000000000000', @@ -186,7 +179,7 @@ const signOneInputVersion4 = (): SubtestSignTransaction => { }; }; -const testnetVersion4 = (): SubtestSignTransaction => { +const testnetVersion4 = () => { // https://tzec1.trezor.io/tx/0cef132c1d6d67f11cfa48f7fca3209da29cf872ac782354bedb686e61a17a78 const testPayloads = [ { @@ -261,7 +254,7 @@ const testnetVersion4 = (): SubtestSignTransaction => { }; }; -const testnetBlossomFork = (): SubtestSignTransaction => { +const testnetBlossomFork = () => { // https://tzec1.trezor.io/tx/737eb78fc69f30ec9eff04359a1551969e026472ae5530e287a838047e237098 const testPayloads = [ { @@ -337,7 +330,7 @@ const testnetBlossomFork = (): SubtestSignTransaction => { }; }; -export const signTransactionZcash = (): TestFunction => { +export const signTransactionZcash = () => { const availableSubtests = { signTwoInputsTxVersion1, signInputVersion2, diff --git a/src/__tests__/core/stellarGetAddress.spec.js b/src/__tests__/core/stellarGetAddress.spec.js new file mode 100644 index 000000000..a73eb6116 --- /dev/null +++ b/src/__tests__/core/stellarGetAddress.spec.js @@ -0,0 +1,47 @@ +/* @flow */ +import type { StellarGetAddress } from '../../js/types'; + +// https://github.com/trezor/trezor-firmware/blob/master/tests/device_tests/test_msg_stellar_get_address.py + +export const stellarGetAddress = () => { + const testPayloads: StellarGetAddress[] = [ + { + method: 'stellarGetAddress', + path: "m/44'/148'/0'", + }, + { + method: 'stellarGetAddress', + path: "m/44'/148'/1'", + }, + { + method: 'stellarGetAddress', + path: "m/44'/148'", + }, + { + method: 'stellarGetAddress', + path: [0], + }, + ]; + const expectedResponses = [ + { + payload: { + address: 'GDRXE2BQUC3AZNPVFSCEZ76NJ3WWL25FYFK6RGZGIEKWE4SOOHSUJUJ6', + }, + }, + { + payload: { + address: 'GBAW5XGWORWVFE2XTJYDTLDHXTY2Q2MO73HYCGB3XMFMQ562Q2W2GJQX', + }, + }, + { success: false }, + { success: false }, + ]; + + return { + testName: 'stellarGetAddress', + mnemonic: ['illness spike retreat truth genius clock brain pass fit cave bargain toe'], + testPayloads, + expectedResponses, + }; +}; + diff --git a/src/__tests__/core/stellarGetPublicKey.spec.js b/src/__tests__/core/stellarGetPublicKey.spec.js deleted file mode 100644 index 397eea61c..000000000 --- a/src/__tests__/core/stellarGetPublicKey.spec.js +++ /dev/null @@ -1,50 +0,0 @@ -/* todo: flow */ -/* eslint-disable */ - -import { Core, init as initCore, initTransport } from '../../js/core/Core.js'; -import { settings, CoreEventHandler } from './common.js'; - -export const stellarGetPublicKeyTests = (): void => { - describe('StellarGetPublicKey', () => { - let core: Core; - - beforeEach(async (done) => { - core = await initCore(settings); - done(); - }); - afterEach(() => { - // Deinitialize existing core - core.onBeforeUnload(); - }); - - const testPayloads = [ - { - method: 'stellarGetPublicKey', - path: 'm/44h/148h/0h', - }, - ]; - const expectedResponses = [ - { - payload: { - todo: 'check python' - // assert stellar.address_from_public_key(response.public_key) == b'GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW' - }, - }, - ]; - - if (testPayloads.length !== expectedResponses.length) { - throw new Error('Different number of payloads and expected responses'); - } - - for (let i = 0; i < testPayloads.length; i++) { - const payload = testPayloads[i]; - const expectedResponse = expectedResponses[i]; - - it('', async (done) => { - const handler = new CoreEventHandler(core, payload, expectedResponse, expect, done); - handler.startListening(); - await initTransport(settings); - }); - } - }); -}; diff --git a/src/__tests__/core/stellarSignTransaction.spec.js b/src/__tests__/core/stellarSignTransaction.spec.js index c7cc861d8..e082c2667 100644 --- a/src/__tests__/core/stellarSignTransaction.spec.js +++ b/src/__tests__/core/stellarSignTransaction.spec.js @@ -1,31 +1,28 @@ -/* todo: flow */ -/* eslint-disable */ +/* @flow */ +import type { StellarSignTransaction } from '../../js/types'; // Test data from: // https://github.com/trezor/trezor-firmware/blob/master/tests/device_tests/test_msg_stellar_sign_transaction.py -import { Core, init as initCore, initTransport } from '../../js/core/Core.js'; -import { settings, CoreEventHandler } from './common.js'; - const header = { method: 'stellarSignTransaction', - path: `m/44'/148'/0'`, + path: "m/44'/148'/0'", networkPassphrase: 'Test SDF Network ; September 2015', -} +}; const transactionCommon = { source: 'GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW', fee: 100, - sequence: 4294967296, + sequence: '4294967296', memo: { type: 0, }, -} +}; const PUBLIC_KEY = '15d648bfe4d36f196cfb5735ffd8ca54cd4b8233f743f22449de7cf301cdb469'; const createAccount = () => { - const testPayloads = [ + const testPayloads: StellarSignTransaction[] = [ { ...header, transaction: { @@ -35,9 +32,9 @@ const createAccount = () => { type: 'createAccount', destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', startingBalance: '1000333000', - } - ] - } + }, + ], + }, }, ]; @@ -54,11 +51,11 @@ const createAccount = () => { specName: '/createAccount', testPayloads, expectedResponses, - } -} + }; +}; const accountMerge = () => { - const testPayloads = [ + const testPayloads: StellarSignTransaction[] = [ { ...header, transaction: { @@ -67,10 +64,10 @@ const accountMerge = () => { { type: 'accountMerge', destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', - } - ] - } - } + }, + ], + }, + }, ]; const expectedResponses = [ @@ -86,11 +83,11 @@ const accountMerge = () => { specName: '/accountMerge', testPayloads, expectedResponses, - } -} + }; +}; const payment = () => { - const testPayloads = [ + const testPayloads: StellarSignTransaction[] = [ // asset type native { ...header, @@ -105,9 +102,9 @@ const payment = () => { code: 'XLM', }, amount: '500111000', - } - ] - } + }, + ], + }, }, // asset type alphanum4 { @@ -123,10 +120,10 @@ const payment = () => { type: 1, code: 'X', issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', - } - } - ] - } + }, + }, + ], + }, }, // asset type alphanum12 { @@ -142,11 +139,11 @@ const payment = () => { type: 2, code: 'ABCDEFGHIJKL', issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', - } - } - ] - } - } + }, + }, + ], + }, + }, ]; const expectedResponses = [ @@ -174,11 +171,11 @@ const payment = () => { specName: '/payment', testPayloads, expectedResponses, - } -} + }; +}; const bumpSequence = () => { - const testPayloads = [ + const testPayloads: StellarSignTransaction[] = [ { ...header, transaction: { @@ -187,10 +184,10 @@ const bumpSequence = () => { { type: 'bumpSequence', bumpTo: '9223372036854775807', - } - ] - } - } + }, + ], + }, + }, ]; const expectedResponses = [ @@ -206,13 +203,11 @@ const bumpSequence = () => { specName: '/bumpSequence', testPayloads, expectedResponses, - } -} - - + }; +}; const setOptions = () => { - const testPayloads = [ + const testPayloads: StellarSignTransaction[] = [ // inflationDest { ...header, @@ -222,9 +217,9 @@ const setOptions = () => { { type: 'setOptions', inflationDest: 'GAFXTC5OV5XQD66T7WGOB2HUVUC3ZVJDJMBDPTVQYV3G3K7TUHC6CLBR', - } - ] - } + }, + ], + }, }, // signer with ed25519PublicKey { @@ -238,10 +233,10 @@ const setOptions = () => { type: 0, key: '72187adb879c414346d77c71af8cce7b6eaa57b528e999fd91feae6b6418628e', weight: 2, - } - } - ] - } + }, + }, + ], + }, }, // signer with sha256Hash { @@ -255,10 +250,10 @@ const setOptions = () => { type: 2, key: '72187adb879c414346d77c71af8cce7b6eaa57b528e999fd91feae6b6418628e', weight: 2, - } - } - ] - } + }, + }, + ], + }, }, // signer with preAuthTx { @@ -272,10 +267,10 @@ const setOptions = () => { type: 1, key: '72187adb879c414346d77c71af8cce7b6eaa57b528e999fd91feae6b6418628e', weight: 2, - } - } - ] - } + }, + }, + ], + }, }, // medThreshold { @@ -286,9 +281,9 @@ const setOptions = () => { { type: 'setOptions', medThreshold: 0, - } - ] - } + }, + ], + }, }, // Threshold + clearFlags { @@ -301,9 +296,9 @@ const setOptions = () => { clearFlags: 0, lowThreshold: 0, highThreshold: 3, - } - ] - } + }, + ], + }, }, // homedomain { @@ -316,9 +311,9 @@ const setOptions = () => { setFlags: 3, masterWeight: 4, homeDomain: 'hello', - } - ] - } + }, + ], + }, }, // noop { @@ -328,9 +323,9 @@ const setOptions = () => { operations: [ { type: 'setOptions', - } - ] - } + }, + ], + }, }, // remove signer { @@ -343,11 +338,11 @@ const setOptions = () => { signer: { type: 0, key: '72187adb879c414346d77c71af8cce7b6eaa57b528e999fd91feae6b6418628e', - weight: 0 - } - } - ] - } + weight: 0, + }, + }, + ], + }, }, // unset homeDomain { @@ -359,8 +354,8 @@ const setOptions = () => { type: 'setOptions', homeDomain: '', }, - ] - } + ], + }, }, ]; @@ -431,11 +426,11 @@ const setOptions = () => { specName: '/setOptions', testPayloads, expectedResponses, - } -} + }; +}; const manageData = () => { - const testPayloads = [ + const testPayloads: StellarSignTransaction[] = [ { ...header, transaction: { @@ -445,9 +440,9 @@ const manageData = () => { type: 'manageData', name: 'data', value: '616263', // Buffer.from('abc').toString('hex') - } - ] - } + }, + ], + }, }, // Buffer value { @@ -459,9 +454,9 @@ const manageData = () => { type: 'manageData', name: 'data', value: '001083', // Buffer.from("ABCD", "base64").toString('hex') - } - ] - } + }, + ], + }, }, // remove entry { @@ -473,9 +468,9 @@ const manageData = () => { type: 'manageData', name: 'data', value: null, - } - ] - } + }, + ], + }, }, ]; @@ -504,11 +499,11 @@ const manageData = () => { specName: '/manageData', testPayloads, expectedResponses, - } -} + }; +}; const pathPayment = () => { - const testPayloads = [ + const testPayloads: StellarSignTransaction[] = [ // asset native { ...header, @@ -528,9 +523,9 @@ const pathPayment = () => { code: 'XLM', }, destAmount: '500111000', - } - ] - } + }, + ], + }, }, // asset alphanum4 { @@ -553,9 +548,9 @@ const pathPayment = () => { issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', }, destAmount: '500111000', - } - ] - } + }, + ], + }, }, // asset alphanum12 { @@ -578,9 +573,9 @@ const pathPayment = () => { issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', }, destAmount: '500111000', - } - ] - } + }, + ], + }, }, // asset types combined { @@ -603,9 +598,9 @@ const pathPayment = () => { issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', }, destAmount: '500111000', - } - ] - } + }, + ], + }, }, // with path { @@ -638,9 +633,9 @@ const pathPayment = () => { issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', }, ], - } - ] - } + }, + ], + }, }, ]; @@ -681,11 +676,11 @@ const pathPayment = () => { specName: '/pathPayment', testPayloads, expectedResponses, - } -} + }; +}; const createPassiveOffer = () => { - const testPayloads = [ + const testPayloads: StellarSignTransaction[] = [ // asset native { ...header, @@ -707,9 +702,9 @@ const createPassiveOffer = () => { n: 500111, d: 10000, }, - } - ] - } + }, + ], + }, }, // asset alphanum4 { @@ -734,9 +729,9 @@ const createPassiveOffer = () => { n: 500111, d: 10000, }, - } - ] - } + }, + ], + }, }, // asset alphanum12 { @@ -761,9 +756,9 @@ const createPassiveOffer = () => { n: 500111, d: 10000, }, - } - ] - } + }, + ], + }, }, // asset combined { @@ -788,9 +783,9 @@ const createPassiveOffer = () => { n: 500111, d: 10000, }, - } - ] - } + }, + ], + }, }, // { n, d } price { @@ -813,9 +808,9 @@ const createPassiveOffer = () => { n: 1024, d: 100, }, - } - ] - } + }, + ], + }, }, ]; @@ -856,11 +851,11 @@ const createPassiveOffer = () => { specName: '/createPassiveOffer', testPayloads, expectedResponses, - } -} + }; +}; const manageOffer = () => { - const testPayloads = [ + const testPayloads: StellarSignTransaction[] = [ // asset native { ...header, @@ -883,9 +878,9 @@ const manageOffer = () => { d: 10000, }, offerId: '101', - } - ] - } + }, + ], + }, }, // asset alphanum4 { @@ -911,9 +906,9 @@ const manageOffer = () => { d: 10000, }, offerId: '101', - } - ] - } + }, + ], + }, }, // asset alphanum12 { @@ -939,9 +934,9 @@ const manageOffer = () => { d: 10000, }, offerId: '101', - } - ] - } + }, + ], + }, }, // asset combined { @@ -967,9 +962,9 @@ const manageOffer = () => { d: 10000, }, offerId: '101', - } - ] - } + }, + ], + }, }, // { n, d } price { @@ -993,9 +988,9 @@ const manageOffer = () => { d: 100, }, offerId: '0', - } - ] - } + }, + ], + }, }, // new offer { @@ -1019,9 +1014,9 @@ const manageOffer = () => { d: 10000, }, offerId: '0', - } - ] - } + }, + ], + }, }, // remove offer { @@ -1045,9 +1040,9 @@ const manageOffer = () => { d: 10000, }, offerId: '101', - } - ] - } + }, + ], + }, }, ]; @@ -1100,11 +1095,11 @@ const manageOffer = () => { specName: '/manageOffer', testPayloads, expectedResponses, - } -} + }; +}; const changeTrust = () => { - const testPayloads = [ + const testPayloads: StellarSignTransaction[] = [ // asset native { ...header, @@ -1118,9 +1113,9 @@ const changeTrust = () => { code: 'XLM', }, limit: '9223372036854775807', - } - ] - } + }, + ], + }, }, // asset alphanum4 { @@ -1136,9 +1131,9 @@ const changeTrust = () => { issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', }, limit: '9223372036854775807', - } - ] - } + }, + ], + }, }, // asset alphanum12 { @@ -1154,9 +1149,9 @@ const changeTrust = () => { issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', }, limit: '9223372036854775807', - } - ] - } + }, + ], + }, }, // with arbitrary limit { @@ -1172,9 +1167,9 @@ const changeTrust = () => { issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', }, limit: '10000000000', - } - ] - } + }, + ], + }, }, // remove trust { @@ -1190,9 +1185,9 @@ const changeTrust = () => { issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', }, limit: '0', - } - ] - } + }, + ], + }, }, ]; @@ -1233,11 +1228,11 @@ const changeTrust = () => { specName: '/changeTrust', testPayloads, expectedResponses, - } -} + }; +}; const allowTrust = () => { - const testPayloads = [ + const testPayloads: StellarSignTransaction[] = [ // asset native { ...header, @@ -1250,9 +1245,9 @@ const allowTrust = () => { assetType: 1, assetCode: 'XLM', authorize: true, - } - ] - } + }, + ], + }, }, { ...header, @@ -1265,9 +1260,9 @@ const allowTrust = () => { assetType: 1, assetCode: 'XLM', authorize: false, - } - ] - } + }, + ], + }, }, ]; @@ -1290,11 +1285,10 @@ const allowTrust = () => { specName: '/allowTrust', testPayloads, expectedResponses, - } -} + }; +}; const withMemo = () => { - const operations = [ { type: 'payment', @@ -1304,10 +1298,10 @@ const withMemo = () => { type: 0, code: 'XLM', }, - } + }, ]; - const testPayloads = [ + const testPayloads: StellarSignTransaction[] = [ // memo type text { ...header, @@ -1318,7 +1312,7 @@ const withMemo = () => { text: 'foobar', }, operations, - } + }, }, // memo type id { @@ -1330,7 +1324,7 @@ const withMemo = () => { id: '1234567890', }, operations, - } + }, }, // memo type hash { @@ -1342,7 +1336,7 @@ const withMemo = () => { hash: '72187adb879c414346d77c71af8cce7b6eaa57b528e999fd91feae6b6418628e', }, operations, - } + }, }, // memo type return { @@ -1354,7 +1348,7 @@ const withMemo = () => { hash: '72187adb879c414346d77c71af8cce7b6eaa57b528e999fd91feae6b6418628e', }, operations, - } + }, }, // payment with timeBounds and memo text { @@ -1370,7 +1364,7 @@ const withMemo = () => { text: 'foobar', }, operations, - } + }, }, // multiple operations with timeBounds and memo text { @@ -1391,22 +1385,22 @@ const withMemo = () => { type: 'payment', destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', asset: { - type: 0, - code: 'XLM', + type: 0, + code: 'XLM', }, - amount: '500111000' + amount: '500111000', }, { type: 'createAccount', destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', - startingBalance: '1000333000' + startingBalance: '1000333000', }, { type: 'bumpSequence', - bumpTo: '9223372036854775807' - } + bumpTo: '9223372036854775807', + }, ], - } + }, }, // timebounds - minTime only { @@ -1420,7 +1414,7 @@ const withMemo = () => { operations: [ { type: 'setOptions' }, ], - } + }, }, // timebounds - minTime only { @@ -1434,7 +1428,7 @@ const withMemo = () => { operations: [ { type: 'setOptions' }, ], - } + }, }, ]; @@ -1493,10 +1487,10 @@ const withMemo = () => { specName: '/withMemo', testPayloads, expectedResponses, - } -} + }; +}; -export const stellarSignTransaction = (): void => { +export const stellarSignTransaction = () => { const subtests = { createAccount, accountMerge, @@ -1517,4 +1511,4 @@ export const stellarSignTransaction = (): void => { mnemonic: 'mnemonic_12', subtests, }; -}; \ No newline at end of file +}; diff --git a/src/__tests__/core/tezosGetAddress.spec.js b/src/__tests__/core/tezosGetAddress.spec.js index 101156cc8..c582a8823 100644 --- a/src/__tests__/core/tezosGetAddress.spec.js +++ b/src/__tests__/core/tezosGetAddress.spec.js @@ -1,19 +1,8 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; +import type { TezosGetAddress } from '../../js/types'; -import type { - TestTezosGetAddressPayload, - ExpectedTezosGetAddressResponse, -} from 'flowtype/tests/tezos-get-address'; - -type ErrorResponse = { - success: false, -} - -export const tezosGetAddress = (): TestFunction => { - const testPayloads: Array = [ +export const tezosGetAddress = () => { + const testPayloads: TezosGetAddress[] = [ { method: 'tezosGetAddress', path: "m/44'/1729'/0'", @@ -36,7 +25,7 @@ export const tezosGetAddress = (): TestFunction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { address: 'tz1ckrgqGGGBt4jGDmwFhtXc1LNpZJUnA9F2', @@ -51,10 +40,8 @@ export const tezosGetAddress = (): TestFunction => { { success: false }, ]; - const testName = 'TezosGetAddress'; - return { - testName, + testName: 'TezosGetAddress', mnemonic: 'mnemonic_12', testPayloads, expectedResponses, diff --git a/src/__tests__/core/tezosGetPublicKey.spec.js b/src/__tests__/core/tezosGetPublicKey.spec.js index ec5ab5501..40d199214 100644 --- a/src/__tests__/core/tezosGetPublicKey.spec.js +++ b/src/__tests__/core/tezosGetPublicKey.spec.js @@ -1,19 +1,8 @@ /* @flow */ -import type { - TestFunction, -} from 'flowtype/tests'; +import type { TezosGetPublicKey } from '../../js/types'; -import type { - TestTezosGetPublicKeyPayload, - ExpectedTezosGetPublicKeyResponse, -} from 'flowtype/tests/tezos-get-public-key'; - -type ErrorResponse = { - success: false, -} - -export const tezosGetPublicKey = (): TestFunction => { - const testPayloads: Array = [ +export const tezosGetPublicKey = () => { + const testPayloads: TezosGetPublicKey[] = [ { method: 'tezosGetPublicKey', path: "m/44'/1729'/0'", @@ -36,7 +25,7 @@ export const tezosGetPublicKey = (): TestFunction => { }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { publicKey: 'edpkuxZ5W8c2jmcaGuCFZxRDSWxS7hp98zcwj2YpUZkJWs5F7UMuF6', diff --git a/src/__tests__/core/tezosSignTransaction.spec.js b/src/__tests__/core/tezosSignTransaction.spec.js index 7d3362667..e9f9422cb 100644 --- a/src/__tests__/core/tezosSignTransaction.spec.js +++ b/src/__tests__/core/tezosSignTransaction.spec.js @@ -1,16 +1,8 @@ /* @flow */ -import type { - TestFunction, - SubtestTezosSignTransaction, -} from 'flowtype/tests'; +import type { TezosSignTransaction } from '../../js/types'; -import type { - TestTezosSignTransactionPayload, - ExpectedTezosSignTransactionResponse, -} from 'flowtype/tests/tezos-sign-transaction'; - -const transaction = (): SubtestTezosSignTransaction => { - const testPayloads: Array = [ +const transaction = () => { + const testPayloads: TezosSignTransaction[] = [ { method: 'tezosSignTransaction', path: "m/44'/1729'/10'", @@ -28,7 +20,7 @@ const transaction = (): SubtestTezosSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'edsigu2eT5jqaio9U4CZfcnig5AZSLQDWHJsxt58atyL91gEfVZVQLpWjcVydRTHW4WggePXZXufyCe7N81Knre7AMUTnKHo4d6', @@ -45,8 +37,8 @@ const transaction = (): SubtestTezosSignTransaction => { }; }; -const revealAndTransaction = (): SubtestTezosSignTransaction => { - const testPayloads: Array = [ +const revealAndTransaction = () => { + const testPayloads: TezosSignTransaction[] = [ { method: 'tezosSignTransaction', path: "m/44'/1729'/1'", @@ -68,11 +60,11 @@ const revealAndTransaction = (): SubtestTezosSignTransaction => { fee: 10000, gas_limit: 20000, storage_limit: 0, - } + }, }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'edsigu1CLfKgV7v3bGcUkWuATevw41EuR9ijJpZzirntww64biqtyXEZsb4yuZsi2K6QSV8235HUpJ8LUwgJ5DdbXYdBicHFmpx', @@ -89,8 +81,8 @@ const revealAndTransaction = (): SubtestTezosSignTransaction => { }; }; -const origination = (): SubtestTezosSignTransaction => { - const testPayloads: Array = [ +const origination = () => { + const testPayloads: TezosSignTransaction[] = [ { method: 'tezosSignTransaction', path: "m/44'/1729'/10'", @@ -103,12 +95,12 @@ const origination = (): SubtestTezosSignTransaction => { counter: 298, gas_limit: 20000, storage_limit: 10000, - script: "0000001c02000000170500036805010368050202000000080316053d036d03420000000a010000000568656c6c6f", + script: '0000001c02000000170500036805010368050202000000080316053d036d03420000000a010000000568656c6c6f', }, }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'edsigtfSgPbV5EY1ejjxWvHsd8fNwBDqoBmnDQcuxPL21WLMAYtgKM1SmGTfWEPzPzn4eGM5LgXhawf4ittEDTEPbCeK2FdxZ4t', @@ -125,8 +117,8 @@ const origination = (): SubtestTezosSignTransaction => { }; }; -const delegation = (): SubtestTezosSignTransaction => { - const testPayloads: Array = [ +const delegation = () => { + const testPayloads: TezosSignTransaction[] = [ { method: 'tezosSignTransaction', path: "m/44'/1729'/0'", @@ -143,7 +135,7 @@ const delegation = (): SubtestTezosSignTransaction => { }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'edsigtvcVmjMrUbe6ZoCGNUP5qDazDpz5GSt8vSvPgmJSdUVJzWAMEPWdx6Q3XvJFwHcGX1hC34yxs2g6WvTVZjMhihg9tDBTUz', @@ -160,8 +152,8 @@ const delegation = (): SubtestTezosSignTransaction => { }; }; -const managerDelegation = (): SubtestTezosSignTransaction => { - const testPayloads: Array = [ +const managerDelegation = () => { + const testPayloads: TezosSignTransaction[] = [ { method: 'tezosSignTransaction', path: "m/44'/1729'/10'", @@ -176,13 +168,13 @@ const managerDelegation = (): SubtestTezosSignTransaction => { gas_limit: 36283, storage_limit: 0, parameters_manager: { - set_delegate: "tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo" - } + set_delegate: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo', + }, }, }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'edsigu6uVsynCkPqbCPzzMr1goiiRA8QwxXZzrkNoi2FV4qP8hzokUc8LMUF7UdQ5LLwn3kHbktFBM42TBKAGsp1EFLuFPdwZHx', @@ -199,8 +191,8 @@ const managerDelegation = (): SubtestTezosSignTransaction => { }; }; -const managerCancelDelegation = (): SubtestTezosSignTransaction => { - const testPayloads: Array = [ +const managerCancelDelegation = () => { + const testPayloads: TezosSignTransaction[] = [ { method: 'tezosSignTransaction', path: "m/44'/1729'/10'", @@ -216,12 +208,12 @@ const managerCancelDelegation = (): SubtestTezosSignTransaction => { storage_limit: 0, parameters_manager: { cancel_delegate: true, - } + }, }, }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'edsigtoPT2yADM2vttD7P17KRs7z23x5tuvZTnX8xmZG5yVb5PeeMQeN5mRxWy7Rzdu39CUZHnYcM75GDVg7gViYgab8YxooW5a', @@ -238,8 +230,8 @@ const managerCancelDelegation = (): SubtestTezosSignTransaction => { }; }; -const managerTransferToImplicit = (): SubtestTezosSignTransaction => { - const testPayloads: Array = [ +const managerTransferToImplicit = () => { + const testPayloads: TezosSignTransaction[] = [ { method: 'tezosSignTransaction', path: "m/44'/1729'/10'", @@ -256,14 +248,14 @@ const managerTransferToImplicit = (): SubtestTezosSignTransaction => { parameters_manager: { transfer: { amount: 200, - destination: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo' - } - } + destination: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo', + }, + }, }, }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'edsigtbNN5Upt3yLdKn1P1hTWmfzSDVbybfdPn36j9vGQuxDa925D8pXwN3fBCSiYiacfby71E2y1CQVs9A95twKzLC4ssQsjhB', @@ -280,8 +272,8 @@ const managerTransferToImplicit = (): SubtestTezosSignTransaction => { }; }; -const managerTransferToContract = (): SubtestTezosSignTransaction => { - const testPayloads: Array = [ +const managerTransferToContract = () => { + const testPayloads: TezosSignTransaction[] = [ { method: 'tezosSignTransaction', path: "m/44'/1729'/10'", @@ -298,14 +290,14 @@ const managerTransferToContract = (): SubtestTezosSignTransaction => { parameters_manager: { transfer: { amount: 200, - destination: 'KT1MJSg8YrnjSewrWGYL3e8XfqtLAG5WU4Hg' - } - } + destination: 'KT1MJSg8YrnjSewrWGYL3e8XfqtLAG5WU4Hg', + }, + }, }, }, }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { payload: { signature: 'edsigtchYBQ76wvbvyfdk4DPaiccaHAxrzQFQU8riMcnfu7bjJNKDVayc12N1TpcZ4hHL9SzuqHyurg8mQy7FYffQ6UvA2TcSs5', @@ -322,7 +314,7 @@ const managerTransferToContract = (): SubtestTezosSignTransaction => { }; }; -export const tezosSignTransaction = (): TestFunction => { +export const tezosSignTransaction = () => { const availableSubtests = { transaction, revealAndTransaction, diff --git a/src/__tests__/core/verifyMessage.spec.js b/src/__tests__/core/verifyMessage.spec.js index 0d19dae0f..ea5aa5eb2 100644 --- a/src/__tests__/core/verifyMessage.spec.js +++ b/src/__tests__/core/verifyMessage.spec.js @@ -1,21 +1,14 @@ /* @flow */ -import type { - TestFunction, - SubtestVerifyMessage, -} from 'flowtype/tests'; -import type { - TestVerifyMessagePayload, - ExpectedVerifyMessageResponse, -} from 'flowtype/tests/verify-message'; +import type { VerifyMessage } from '../../js/types'; -const verify = (): SubtestVerifyMessage => { - const testPayloads: Array = [ +const verify = () => { + const testPayloads: VerifyMessage[] = [ { // uncompressed pubkey - ok method: 'verifyMessage', coin: 'Bitcoin', address: '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T', - signature: /* btoa( */'1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'/* ) */, + signature: Buffer.from(/* btoa( */'1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'/* ) */, 'hex').toString('base64'), message: 'This is an example of a signed message.', }, { @@ -23,7 +16,7 @@ const verify = (): SubtestVerifyMessage => { method: 'verifyMessage', coin: 'Bitcoin', address: '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T', - signature: /* btoa( */'1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c800'/* ) */, + signature: Buffer.from(/* btoa( */'1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c800'/* ) */, 'hex').toString('base64'), message: 'This is an example of a signed message.', }, { @@ -31,7 +24,7 @@ const verify = (): SubtestVerifyMessage => { method: 'verifyMessage', coin: 'Bitcoin', address: '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T', - signature: /* btoa( */'1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'/* ) */, + signature: Buffer.from(/* btoa( */'1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'/* ) */, 'hex').toString('base64'), message: 'This is an example of a signed message!', }, { @@ -39,7 +32,7 @@ const verify = (): SubtestVerifyMessage => { method: 'verifyMessage', coin: 'Bitcoin', address: '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8', - signature: /* btoa( */'1f44e3e461f7ca9f57c472ce1a28214df1de1dadefb6551a32d1907b80c74d5a1fbfd6daaba12dd8cb06699ce3f6941fbe0f3957b5802d13076181046e741eaaaf'/* ) */, + signature: Buffer.from(/* btoa( */'1f44e3e461f7ca9f57c472ce1a28214df1de1dadefb6551a32d1907b80c74d5a1fbfd6daaba12dd8cb06699ce3f6941fbe0f3957b5802d13076181046e741eaaaf'/* ) */, 'hex').toString('base64'), message: 'This is an example of a signed message.', }, { @@ -47,7 +40,7 @@ const verify = (): SubtestVerifyMessage => { method: 'verifyMessage', coin: 'Bitcoin', address: '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8', - signature: /* btoa( */'1f44e3e461f7ca9f57c472ce1a28214df1de1dadefb6551a32d1907b80c74d5a1fbfd6daaba12dd8cb06699ce3f6941fbe0f3957b5802d13076181046e741eaa00'/* ) */, + signature: Buffer.from(/* btoa( */'1f44e3e461f7ca9f57c472ce1a28214df1de1dadefb6551a32d1907b80c74d5a1fbfd6daaba12dd8cb06699ce3f6941fbe0f3957b5802d13076181046e741eaa00'/* ) */, 'hex').toString('base64'), message: 'This is an example of a signed message.', }, { @@ -55,7 +48,7 @@ const verify = (): SubtestVerifyMessage => { method: 'verifyMessage', coin: 'Bitcoin', address: '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e', - signature: /* btoa( */'209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80'/* ) */, + signature: Buffer.from(/* btoa( */'209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80'/* ) */, 'hex').toString('base64'), message: 'This is an example of a signed message.', }, { @@ -63,11 +56,11 @@ const verify = (): SubtestVerifyMessage => { method: 'verifyMessage', coin: 'Bitcoin', address: '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e', - signature: /* btoa( */'209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80'/* ) */, + signature: Buffer.from(/* btoa( */'209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80'/* ) */, 'hex').toString('base64'), message: 'This is an example of a signed message!', }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, { success: false }, { success: false }, @@ -84,17 +77,17 @@ const verify = (): SubtestVerifyMessage => { }; }; -const verifyLong = (): SubtestVerifyMessage => { - const testPayloads: Array = [ +const verifyLong = () => { + const testPayloads: VerifyMessage[] = [ { method: 'verifyMessage', coin: 'Bitcoin', address: '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e', - signature: '205ff795c29aef7538f8b3bdb2e8add0d0722ad630a140b6aefd504a5a895cbd867cbb00981afc50edd0398211e8d7c304bb8efa461181bc0afa67ea4a720a89ed', + signature: Buffer.from('205ff795c29aef7538f8b3bdb2e8add0d0722ad630a140b6aefd504a5a895cbd867cbb00981afc50edd0398211e8d7c304bb8efa461181bc0afa67ea4a720a89ed', 'hex').toString('base64'), message: 'VeryLongMessage!'.repeat(64), }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, ]; @@ -105,17 +98,17 @@ const verifyLong = (): SubtestVerifyMessage => { }; }; -const verifyTestnet = (): SubtestVerifyMessage => { - const testPayloads: Array = [ +const verifyTestnet = () => { + const testPayloads: VerifyMessage[] = [ { method: 'verifyMessage', coin: 'Testnet', address: 'mirio8q3gtv7fhdnmb3TpZ4EuafdzSs7zL', - signature: '209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', + signature: Buffer.from('209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', 'hex').toString('base64'), message: 'This is an example of a signed message.', }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, ]; @@ -126,17 +119,17 @@ const verifyTestnet = (): SubtestVerifyMessage => { }; }; -const verifyBcash = (): SubtestVerifyMessage => { - const testPayloads: Array = [ +const verifyBcash = () => { + const testPayloads: VerifyMessage[] = [ { method: 'verifyMessage', coin: 'Bcash', address: 'bitcoincash:qqj22md58nm09vpwsw82fyletkxkq36zxyxh322pru', - signature: '209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', + signature: Buffer.from('209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', 'hex').toString('base64'), message: 'This is an example of a signed message.', }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, ]; @@ -147,17 +140,17 @@ const verifyBcash = (): SubtestVerifyMessage => { }; }; -const verifyBitcoind = (): SubtestVerifyMessage => { - const testPayloads: Array = [ +const verifyBitcoind = () => { + const testPayloads: VerifyMessage[] = [ { method: 'verifyMessage', coin: 'Bitcoin', address: '1KzXE97kV7DrpxCViCN3HbGbiKhzzPM7TQ', - signature: '1cc694f0f23901dfe3603789142f36a3fc582d0d5c0ec7215cf2ccd641e4e37228504f3d4dc3eea28bbdbf5da27c49d4635c097004d9f228750ccd836a8e1460c0', + signature: Buffer.from('1cc694f0f23901dfe3603789142f36a3fc582d0d5c0ec7215cf2ccd641e4e37228504f3d4dc3eea28bbdbf5da27c49d4635c097004d9f228750ccd836a8e1460c0', 'hex').toString('base64'), message: 'žluťoučký kůň úpěl ďábelské ódy', }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, ]; @@ -168,7 +161,7 @@ const verifyBitcoind = (): SubtestVerifyMessage => { }; }; -export const verifyMessage = (): TestFunction => { +export const verifyMessage = () => { const availableSubtests = { verify, verifyLong, diff --git a/src/__tests__/core/verifyMessageSegwit.spec.js b/src/__tests__/core/verifyMessageSegwit.spec.js index ba3e37a4c..14edca3bb 100644 --- a/src/__tests__/core/verifyMessageSegwit.spec.js +++ b/src/__tests__/core/verifyMessageSegwit.spec.js @@ -1,21 +1,14 @@ /* @flow */ -import type { - TestFunction, - SubtestVerifyMessage, -} from 'flowtype/tests'; -import type { - TestVerifyMessagePayload, - ExpectedVerifyMessageResponse, -} from 'flowtype/tests/verify-message'; +import type { VerifyMessage } from '../../js/types'; -const verify = (): SubtestVerifyMessage => { - const testPayloads: Array = [ +const verify = () => { + const testPayloads: VerifyMessage[] = [ { // trezor pubkey - OK method: 'verifyMessage', coin: 'Bitcoin', address: '3CwYaeWxhpXXiHue3ciQez1DLaTEAXcKa1', - signature: '249e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', + signature: Buffer.from('249e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', 'hex').toString('base64'), message: 'This is an example of a signed message.', }, { @@ -23,7 +16,7 @@ const verify = (): SubtestVerifyMessage => { method: 'verifyMessage', coin: 'Bitcoin', address: '3CwYaeWxhpXXiHue3ciQez1DLaTEAXcKa1', - signature: '249e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be00', + signature: Buffer.from('249e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be00', 'hex').toString('base64'), message: 'This is an example of a signed message.', }, { @@ -31,12 +24,12 @@ const verify = (): SubtestVerifyMessage => { method: 'verifyMessage', coin: 'Bitcoin', address: '3CwYaeWxhpXXiHue3ciQez1DLaTEAXcKa1', - signature: '249e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', + signature: Buffer.from('249e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', 'hex').toString('base64'), message: 'This is an example of a signed message!', }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, { success: false }, { success: false }, @@ -49,18 +42,18 @@ const verify = (): SubtestVerifyMessage => { }; }; -const verifyLong = (): SubtestVerifyMessage => { - const testPayloads: Array = [ +const verifyLong = () => { + const testPayloads: VerifyMessage[] = [ { method: 'verifyMessage', coin: 'Bitcoin', address: '3CwYaeWxhpXXiHue3ciQez1DLaTEAXcKa1', - signature: '245ff795c29aef7538f8b3bdb2e8add0d0722ad630a140b6aefd504a5a895cbd867cbb00981afc50edd0398211e8d7c304bb8efa461181bc0afa67ea4a720a89ed', + signature: Buffer.from('245ff795c29aef7538f8b3bdb2e8add0d0722ad630a140b6aefd504a5a895cbd867cbb00981afc50edd0398211e8d7c304bb8efa461181bc0afa67ea4a720a89ed', 'hex').toString('base64'), message: 'VeryLongMessage!'.repeat(64), }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, ]; @@ -71,18 +64,18 @@ const verifyLong = (): SubtestVerifyMessage => { }; }; -const verifyTestnet = (): SubtestVerifyMessage => { - const testPayloads: Array = [ +const verifyTestnet = () => { + const testPayloads: VerifyMessage[] = [ { method: 'verifyMessage', coin: 'Testnet', address: '2N4VkePSzKH2sv5YBikLHGvzUYvfPxV6zS9', - signature: '249e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', + signature: Buffer.from('249e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', 'hex').toString('base64'), message: 'This is an example of a signed message.', }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, ]; @@ -93,7 +86,7 @@ const verifyTestnet = (): SubtestVerifyMessage => { }; }; -export const verifyMessageSegwit = (): TestFunction => { +export const verifyMessageSegwit = () => { const availableSubtests = { verify, verifyLong, diff --git a/src/__tests__/core/verifyMessageSegwitNative.spec.js b/src/__tests__/core/verifyMessageSegwitNative.spec.js index 54ecde439..91fdae185 100644 --- a/src/__tests__/core/verifyMessageSegwitNative.spec.js +++ b/src/__tests__/core/verifyMessageSegwitNative.spec.js @@ -1,21 +1,14 @@ /* @flow */ -import type { - TestFunction, - SubtestVerifyMessage, -} from 'flowtype/tests'; -import type { - TestVerifyMessagePayload, - ExpectedVerifyMessageResponse, -} from 'flowtype/tests/verify-message'; +import type { VerifyMessage } from '../../js/types'; -const verify = (): SubtestVerifyMessage => { - const testPayloads: Array = [ +const verify = () => { + const testPayloads: VerifyMessage[] = [ { // trezor pubkey - OK method: 'verifyMessage', coin: 'Bitcoin', address: 'bc1qyjjkmdpu7metqt5r36jf872a34syws33s82q2j', - signature: '289e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', + signature: Buffer.from('289e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', 'hex').toString('base64'), message: 'This is an example of a signed message.', }, { @@ -23,7 +16,7 @@ const verify = (): SubtestVerifyMessage => { method: 'verifyMessage', coin: 'Bitcoin', address: 'bc1qyjjkmdpu7metqt5r36jf872a34syws33s82q2j', - signature: '289e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be00', + signature: Buffer.from('289e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be00', 'hex').toString('base64'), message: 'This is an example of a signed message.', }, { @@ -31,12 +24,12 @@ const verify = (): SubtestVerifyMessage => { method: 'verifyMessage', coin: 'Bitcoin', address: 'bc1qyjjkmdpu7metqt5r36jf872a34syws33s82q2j', - signature: '289e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', + signature: Buffer.from('289e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', 'hex').toString('base64'), message: 'This is an example of a signed message!', }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, { success: false }, { success: false }, @@ -49,18 +42,18 @@ const verify = (): SubtestVerifyMessage => { }; }; -const verifyLong = (): SubtestVerifyMessage => { - const testPayloads: Array = [ +const verifyLong = () => { + const testPayloads: VerifyMessage[] = [ { method: 'verifyMessage', coin: 'Bitcoin', address: 'bc1qyjjkmdpu7metqt5r36jf872a34syws33s82q2j', - signature: '285ff795c29aef7538f8b3bdb2e8add0d0722ad630a140b6aefd504a5a895cbd867cbb00981afc50edd0398211e8d7c304bb8efa461181bc0afa67ea4a720a89ed', + signature: Buffer.from('285ff795c29aef7538f8b3bdb2e8add0d0722ad630a140b6aefd504a5a895cbd867cbb00981afc50edd0398211e8d7c304bb8efa461181bc0afa67ea4a720a89ed', 'hex').toString('base64'), message: 'VeryLongMessage!'.repeat(64), }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, ]; @@ -71,18 +64,18 @@ const verifyLong = (): SubtestVerifyMessage => { }; }; -const verifyTestnet = (): SubtestVerifyMessage => { - const testPayloads: Array = [ +const verifyTestnet = () => { + const testPayloads: VerifyMessage[] = [ { method: 'verifyMessage', coin: 'Testnet', address: 'tb1qyjjkmdpu7metqt5r36jf872a34syws336p3n3p', - signature: '289e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', + signature: Buffer.from('289e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', 'hex').toString('base64'), message: 'This is an example of a signed message.', }, ]; - const expectedResponses: Array = [ + const expectedResponses = [ { success: true }, ]; @@ -93,7 +86,7 @@ const verifyTestnet = (): SubtestVerifyMessage => { }; }; -export const verifyMessageSegwitNative = (): TestFunction => { +export const verifyMessageSegwitNative = () => { const availableSubtests = { verify, verifyLong, diff --git a/src/flowtype/tests/cardano-get-address.js b/src/flowtype/tests/cardano-get-address.js deleted file mode 100644 index e41ad2bc4..000000000 --- a/src/flowtype/tests/cardano-get-address.js +++ /dev/null @@ -1,14 +0,0 @@ -/* @flow */ -declare module 'flowtype/tests/cardano-get-address' { - declare export type TestCardanoGetAddressPayload = { - method: string, - path: string | Array, - }; - - declare export type ExpectedCardanoGetAddressResponse = { - success?: boolean, - payload?: { - address: string, - }, - }; -} diff --git a/src/flowtype/tests/cardano-get-public-key.js b/src/flowtype/tests/cardano-get-public-key.js deleted file mode 100644 index 9038f2ef2..000000000 --- a/src/flowtype/tests/cardano-get-public-key.js +++ /dev/null @@ -1,15 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/cardano-get-public-key' { - declare export type TestCardanoGetPublicKeyPayload = { - method: string, - path: string | Array, - }; - - declare export type ExpectedCardanoGetPublicKeyResponse = { - success?: boolean, - payload?: { - publicKey: string, - }, - }; -} diff --git a/src/flowtype/tests/cardano-sign-transaction.js b/src/flowtype/tests/cardano-sign-transaction.js deleted file mode 100644 index 48ecfb0c3..000000000 --- a/src/flowtype/tests/cardano-sign-transaction.js +++ /dev/null @@ -1,31 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/cardano-sign-transaction' { - declare type CardanoInput = { - address_n: string | Array, - tx_hash: string, - output_index: number, - type?: number, - }; - declare type CardanoOutput = { - address_n: string | Array, - amount: string, - } | { - address: string, - amount: string, - }; - - declare export type TestCardanoSignTransactionPayload = { - inputs: Array, - outputs: Array, - transactions: Array, - protocol_magic: number, - }; - - declare export type ExpectedCardanoSignTransactionResponse = { - payload: { - hash: string, - body: string, - }, - }; -} diff --git a/src/flowtype/tests/eos-get-public-key.js b/src/flowtype/tests/eos-get-public-key.js deleted file mode 100644 index 546b0a21e..000000000 --- a/src/flowtype/tests/eos-get-public-key.js +++ /dev/null @@ -1,16 +0,0 @@ - -/* @flow */ - -declare module 'flowtype/tests/eos-get-public-key' { - declare export type TestEosGetPublicKeyPayload = { - method: string, - path: string | Array, - }; - - declare export type ExpectedEosGetPublicKeyResponse = { - payload: { - wifPublicKey: string, - rawPublicKey: string, - }, - }; -} diff --git a/src/flowtype/tests/eos-sign-transaction.js b/src/flowtype/tests/eos-sign-transaction.js deleted file mode 100644 index c0b2a9485..000000000 --- a/src/flowtype/tests/eos-sign-transaction.js +++ /dev/null @@ -1,18 +0,0 @@ -/* @flow */ - -import type { Transaction as EosTransaction } from '../../js/types/eos.js'; -declare module 'flowtype/tests/eos-sign-transaction' { - declare export type TestEosSignTransactionPayload = { - method: string, - path: string | Array, - transaction: EosTransaction, - }; - declare export type ExpectedEosSignTransactionResponse = { - success?: boolean, - payload?: { - signatureR: string, - signatureS: string, - signatureV?: number, - }, - }; -} diff --git a/src/flowtype/tests/ethereum-get-address.js b/src/flowtype/tests/ethereum-get-address.js deleted file mode 100644 index cf67ad09e..000000000 --- a/src/flowtype/tests/ethereum-get-address.js +++ /dev/null @@ -1,14 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/ethereum-get-address' { - declare export type TestEthereumGetAddressPayload = { - method: string, - path: string | Array, - }; - - declare export type ExpectedEthereumGetAddressResponse = { - payload: { - address: string, - }, - }; -} diff --git a/src/flowtype/tests/ethereum-sign-message.js b/src/flowtype/tests/ethereum-sign-message.js deleted file mode 100644 index 9c2acb6a9..000000000 --- a/src/flowtype/tests/ethereum-sign-message.js +++ /dev/null @@ -1,15 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/ethereum-sign-message' { - declare export type TestEthereumSignMessagePayload = { - method: string, - path: string | Array, - message: string, - }; - declare export type ExpectedEthereumSignMessageResponse = { - payload: { - address: string, - signature: string, - }, - }; -} diff --git a/src/flowtype/tests/ethereum-sign-transaction.js b/src/flowtype/tests/ethereum-sign-transaction.js deleted file mode 100644 index a46548aa2..000000000 --- a/src/flowtype/tests/ethereum-sign-transaction.js +++ /dev/null @@ -1,18 +0,0 @@ -/* @flow */ - -import type { Transaction as EthereumTransaction } from '../../js/types/ethereum.js'; -declare module 'flowtype/tests/ethereum-sign-transaction' { - declare export type TestEthereumSignTransactionPayload = { - method: string, - path: string | Array, - transaction: EthereumTransaction, - }; - declare export type ExpectedEthereumSignTransactionResponse = { - success?: boolean, - payload?: { - r: string, - s: string, - v?: number - }, - }; -} diff --git a/src/flowtype/tests/ethereum-verify-message.js b/src/flowtype/tests/ethereum-verify-message.js deleted file mode 100644 index 0e77de39c..000000000 --- a/src/flowtype/tests/ethereum-verify-message.js +++ /dev/null @@ -1,14 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/ethereum-verify-message' { - declare export type TestEthereumVerifyMessagePayload = { - method: string, - address: string | Array, - signature: string, - message: string, - }; - - declare export type ExpectedEthereumVerifyMessageResponse = { - success: boolean, - }; -} \ No newline at end of file diff --git a/src/flowtype/tests/get-account-info.js b/src/flowtype/tests/get-account-info.js deleted file mode 100644 index 8f9e4d057..000000000 --- a/src/flowtype/tests/get-account-info.js +++ /dev/null @@ -1,13 +0,0 @@ -/* @flowtype */ - -import type { AccountInfo } from "flowtype/trezor"; - -declare module 'flowtype/tests/get-account-info' { - declare export type TestGetAccountInfoPayload = { - path: ?Array, - xpub: ?string, - coin: string, - }; - - declare export type ExpectedGetAccountInfoResponse = AccountInfo | { error: string }; -} diff --git a/src/flowtype/tests/get-address.js b/src/flowtype/tests/get-address.js deleted file mode 100644 index 60e11b769..000000000 --- a/src/flowtype/tests/get-address.js +++ /dev/null @@ -1,21 +0,0 @@ -/* @flow */ -import type { - MultisigRedeemScriptType, - InputScriptType, -} from '../../js/types/trezor.js'; - -declare module 'flowtype/tests/get-address' { - declare export type TestGetAddressPayload = { - method: string, - path: string | Array, - coin: string, - showOnTrezor: boolean, - multisig?: MultisigRedeemScriptType, - scriptType?: InputScriptType, - }; - declare export type ExpectedGetAddressResponse = { - payload: { - address: string, - }, - }; -} diff --git a/src/flowtype/tests/get-public-key.js b/src/flowtype/tests/get-public-key.js deleted file mode 100644 index 7e60b32f1..000000000 --- a/src/flowtype/tests/get-public-key.js +++ /dev/null @@ -1,14 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/get-public-key' { - declare export type TestGetPublicKeyPayload = { - method: string, - path: string | Array, - coin: string, - }; - declare export type ExpectedGetPublicKeyResponse = { - payload: { - xpub: string, - }, - }; -} diff --git a/src/flowtype/tests/index.js b/src/flowtype/tests/index.js deleted file mode 100644 index c892bcb83..000000000 --- a/src/flowtype/tests/index.js +++ /dev/null @@ -1,298 +0,0 @@ -/* @flow */ - -import type { - TestCardanoGetAddressPayload, - ExpectedCardanoGetAddressResponse, -} from 'flowtype/tests/cardano-get-address'; - -import type { - TestCardanoSignTransactionPayload, - ExpectedCardanoSignTransactionResponse, -} from 'flowtype/tests/cardano-sign-transaction'; - -import type { - TestEthereumGetAddressPayload, - ExpectedEthereumGetAddressResponse, -} from 'flowtype/tests/ethereum-get-address'; - -import type { - TestCardanoGetPublicKeyPayload, - ExpectedCardanoGetPublicKeyResponse, -} from 'flowtype/tests/cardano-get-public-key'; - -import type { - TestEthereumSignMessagePayload, - ExpectedEthereumSignMessageResponse, -} from 'flowtype/tests/ethereum-sign-message'; - -import type { - TestEthereumSignTransactionPayload, - ExpectedEthereumSignTransactionResponse, -} from 'flowtype/tests/ethereum-sign-transaction'; - -import type { - TestGetAddressPayload, - ExpectedGetAddressResponse, -} from 'flowtype/tests/get-address'; - -import type { - TestGetPublicKeyPayload, - ExpectedGetPublicKeyResponse, -} from 'flowtype/tests/get-public-key'; - -import type { - TestNemGetAddressPayload, - ExpectedNemGetAddressResponse, -} from 'flowtype/tests/nem-get-address'; - -import type { - TestSignMessagePayload, - ExpectedSignMessageResponse, -} from 'flowtype/tests/sign-message'; - -import type { - TestSignTransactionPayload, - ExpectedSignTransactionResponse, -} from 'flowtype/tests/sign-transaction'; - -import type { - TestVerifyMessagePayload, - ExpectedVerifyMessageResponse, -} from 'flowtype/tests/verify-message'; - -import type { - TestGetAccountInfoPayload, - ExpectedGetAccountInfoResponse, -} from 'flowtype/tests/get-account-info'; - -import type { - TestNemSignTransactionPayload, - ExpectedNemSignTransactionResponse, -} from 'flowtype/tests/nem-sign-transaction'; - -import type { - TestPassphrasePayload, - ExpectedPassphraseResponse, -} from 'flowtype/tests/passphrase'; - -import type { - TestLiskGetAddressPayload, - ExpectedLiskGetAddressResponse, -} from 'flowtype/tests/lisk-get-address'; - -import type { - TestLiskSignMessagePayload, - ExpectedLiskSignMessageResponse, -} from 'flowtype/tests/lisk-sign-message'; - -import type { - TestLiskVerifyMessagePayload, - ExpectedLiskVerifyMessageResponse, -} from 'flowtype/tests/lisk-verify-message'; - -import type { - TestLiskSignTransactionPayload, - ExpectedLiskSignTransactionResponse, -} from 'flowtype/tests/lisk-sign-transaction'; - -import type { - TestRippleGetAddressPayload, - ExpectedRippleGetAddressResponse, -} from 'flowtype/tests/ripple-get-address'; - -import type { - TestRippleSignTransactionPayload, - ExpectedRippleSignTransactionResponse, -} from 'flowtype/tests/ripple-sign-transaction'; - -import type { - TestTezosGetAddressPayload, - ExpectedTezosGetAddressResponse, -} from 'flowtype/tests/tezos-get-address'; - -import type { - TestTezosGetPublicKeyPayload, - ExpectedTezosGetPublicKeyResponse, -} from 'flowtype/tests/tezos-get-public-key'; - -import type { - TestTezosSignTransactionPayload, - ExpectedTezosSignTransactionResponse, -} from 'flowtype/tests/tezos-sign-transaction'; - -import type { - TestEosSignTransactionPayload, - ExpectedEosSignTransactionResponse, -} from 'flowtype/tests/eos-sign-transaction'; - -import type { - TestEosGetPublicKeyPayload, - ExpectedEosGetPublicKeyResponse, -} from 'flowtype/tests/eos-get-public-key'; - -declare module 'flowtype/tests' { - // declare export type GetAddressAvailableSubtests = 'btc' | 'ltc' | 'tbtc' | 'bch'; - // declare export type GetAddressSegwitAvailableSubtests = 'showSegwit'; - // declare export type SignMessageAvailableSubtests = 'sign' | 'signTestnet' | 'signBch' | 'signLong'; - // declare export type SignMessageSegwitAvailableSubtests = 'sign' | 'signLong'; - // declare export type SignTransactionAvailableSubtests = - // 'oneOneFee' - // | 'oneTwoFee' - // | 'oneThreeFee' - // | 'twoTwo' - // | 'testnetOneTwoFee' - // | 'testnetFeeTooHigh' - // | 'lotsOfOutputs' - // | 'feeTooHigh' - // | 'notEnoughFunds' - // | 'spendCoinbase' - // | 'twoChanges' - // | 'p2sh' - // | 'changeOnMainChainAllowed'; - // declare export type SignTransactionSegwitAvailableSubtests = 'sendP2sh' | 'sendP2shChange' | 'sendMultisig1'; - // declare export type SignTransactionBgoldAvailableSubtests = 'change' | 'noChange' | 'p2sh' | 'p2shWitnessChange' | 'sendMultisig1'; - // declare export type SignTransactionBcashAvailableSubtests = 'change' | 'noChange' | 'oldAddr'; - // declare export type SignTransactionMultisigAvailableSubtests = 'twoOfThree' | 'fifteenOfFifteen' | 'missingPubkey'; - // declare export type SignTransactionMultisigChangeAvailableSubtests = 'externalExternal' | 'externalInternal' | 'internalExternal' | 'multisigExternalExternal'; - // declare export type VerifyMessageAvailableSubtests = 'verify' | 'verifyLong' | 'verifyTestnet' | 'verifyBcash' | 'verifyBitcoind'; - // declare export type VerifyMessageSegwitAvailableSubtests = 'verify' | 'verifyLong' | 'verifyTestnet'; - // declare export type VerifyMessageSegwitNativeAvailableSubtests = 'verify' | 'verifyLong' | 'verifyTestnet'; - // declare export type EthereumSignTransactionAvailableSubtests = 'knownErc20Token' | 'unknownErc20Token' | 'noData' | 'data' | 'message' | 'newContract' | 'sanityChecks' | 'noDataEip155' | 'dataEip155'; - // declare export type NemSignTransactionMosaicAvailableSubtests = 'supplyChange' | 'creation' | 'creationProperties' | 'creationLevy'; - // declare export type NemSignTransactionMultisigAvailableSubtests = 'aggregateModification' | 'multisig' | 'multisigSigner'; - // declare export type NemSignTransactionOthersAvailableSubtests = 'importanceTransfer' | 'provisionNamespace'; - // declare export type NemSignTransactionTransfersAvailableSubtests = 'simple' | 'xemAsMosaic' | 'unknownMosaic' | 'knownMosaic' | 'knownMosaicWithLevy' | 'multipleMosaics'; - // declare export type GetAccountInfoAvailableSubtests = 'firstAccount' | 'zeroBalance' | 'pathInvalid' | 'zeroBalance' | 'xpubInsteadOfPath'; - // declare export type PassphraseAvailableSubtests = 'correctPassphrase' | 'wrongPassphrase'; - - declare type Subtest = { - testPayloads: Array, - expectedResponses: Array, - specName: string, - }; - declare export type SubtestGetAddress = Subtest; - declare export type SubtestSignMessage = Subtest; - declare export type SubtestEthereumSignTransaction = Subtest; - declare export type SubtestSignTransaction = Subtest; - declare export type SubtestVerifyMessage = Subtest; - declare export type SubtestGetAccountInfo = Subtest; - declare export type SubtestNemSignTransaction = Subtest; - declare export type SubtestPassphrase = Subtest; - declare export type SubtestLiskSignTransaction = Subtest; - declare export type SubtestTezosSignTransaction = Subtest; - declare export type SubtestEosSignTransaction = Subtest; - - declare export type TestPayload = - TestCardanoGetAddressPayload - | TestCardanoGetPublicKeyPayload - | TestCardanoSignTransactionPayload - | TestEthereumGetAddressPayload - | TestEthereumSignMessagePayload - | TestEthereumSignTransactionPayload - | TestGetAddressPayload - | TestGetPublicKeyPayload - | TestNemGetAddressPayload - | TestSignMessagePayload - | TestSignTransactionPayload - | TestVerifyMessagePayload - | TestGetAccountInfoPayload - | TestNemSignTransactionPayload - | TestPassphrasePayload - | TestLiskGetAddressPayload - | TestLiskSignMessagePayload - | TestLiskVerifyMessagePayload - | TestLiskSignTransactionPayload - | TestTezosGetAddressPayload - | TestTezosGetPublicKeyPayload - | TestTezosSignTransactionPayload - | TestRippleGetAddressPayload - | TestRippleSignTransactionPayload - | TestEosSignTransactionPayload - | TestEosGetPublicKeyPayload; - - declare export type ExpectedResponse = - ExpectedCardanoGetAddressResponse - | ExpectedCardanoGetPublicKeyResponse - | ExpectedCardanoSignTransactionResponse - | ExpectedEthereumGetAddressResponse - | ExpectedEthereumSignMessageResponse - | ExpectedEthereumSignTransactionResponse - | ExpectedGetAddressResponse - | ExpectedGetPublicKeyResponse - | ExpectedNemGetAddressResponse - | ExpectedSignMessageResponse - | ExpectedSignTransactionResponse - | ExpectedVerifyMessageResponse - | ExpectedGetAccountInfoResponse - | ExpectedNemSignTransactionResponse - | ExpectedLiskGetAddressResponse - | ExpectedLiskSignMessageResponse - | ExpectedLiskVerifyMessageResponse - | ExpectedLiskSignTransactionResponse - | ExpectedTezosGetAddressResponse - | ExpectedTezosGetPublicKeyResponse - | ExpectedTezosSignTransactionResponse - | ExpectedRippleGetAddressResponse - | ExpectedRippleSignTransactionResponse - | ExpectedEosSignTransactionResponse - | ExpectedEosGetPublicKeyResponse; - - declare export type SubtestFunction = SubtestGetAddress - | SubtestSignMessage - | SubtestEthereumSignTransaction - | SubtestSignTransaction - | SubtestVerifyMessage - | SubtestGetAccountInfo - | SubtestNemSignTransaction - | SubtestTezosSignTransaction - | SubtestLiskSignTransaction - | SubtestLiskSignTransaction - | SubtestEosSignTransaction; - - declare export type TestFunction = { - testName: string, - mnemonic: string | Array, - mnemonic_secret?: string, - testPayloads?: Array, - expectedResponses?: Array, - subtests?: { [k: string]: () => SubtestFunction }, - }; - - declare export type AvailableTestFunctions = { - getPublicKey(): TestFunction, - getAddress(): TestFunction, - getAddressSegwit(): TestFunction, - signMessage(): TestFunction, - signMessageSegwit(): TestFunction, - signTransaction(): TestFunction, - signTransactionSegwit(): TestFunction, - signTransactionBgold(): TestFunction, - signTransactionBcash(): TestFunction, - signTransactionMultisig(): TestFunction, - signTransactionMultisigChange(): TestFunction, - verifyMessage(): TestFunction, - verifyMessageSegwit(): TestFunction, - verifyMessageSegwitNative(): TestFunction, - ethereumGetAddress(): TestFunction, - ethereumSignMessage(): TestFunction, - ethereumSignTransaction(): TestFunction, - ethereumVerifyMessage(): TestFunction, - getAccountInfo(): TestFunction, - nemGetAddress(): TestFunction, - nemSignTransactionMosaic(): TestFunction, - nemSignTransactionMultisig(): TestFunction, - nemSignTransactionOthers(): TestFunction, - nemSignTransactionTransfers(): TestFunction, - liskGetAddress(): TestFunction, - liskSignMessage(): TestFunction, - liskVerifyMessage(): TestFunction, - liskSignTransaction(): TestFunction, - rippleGetAddress(): TestFunction, - rippleSignTransaction(): TestFunction, - tezosGetAddress(): TestFunction, - tezosGetPublicKey(): TestFunction, - tezosSignTransaction(): TestFunction, - eosSignTransaction(): TestFunction, - eosGetPublicKey(): TestFunction, - }; -} diff --git a/src/flowtype/tests/lisk-get-address.js b/src/flowtype/tests/lisk-get-address.js deleted file mode 100644 index 20d566bdb..000000000 --- a/src/flowtype/tests/lisk-get-address.js +++ /dev/null @@ -1,14 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/lisk-get-address' { - declare export type TestLiskGetAddressPayload = { - method: string, - method: string, - path: string | Array, - }; - declare export type ExpectedLiskGetAddressResponse = { - payload: { - address: string, - }, - }; -} diff --git a/src/flowtype/tests/lisk-sign-message.js b/src/flowtype/tests/lisk-sign-message.js deleted file mode 100644 index 368243374..000000000 --- a/src/flowtype/tests/lisk-sign-message.js +++ /dev/null @@ -1,16 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/lisk-sign-message' { - declare export type TestLiskSignMessagePayload = { - method: string, - path: string, - message: string, - }; - - declare export type ExpectedLiskSignMessageResponse = { - payload: { - publicKey: string, - signature: string, - }, - }; -} diff --git a/src/flowtype/tests/lisk-sign-transaction.js b/src/flowtype/tests/lisk-sign-transaction.js deleted file mode 100644 index 1b90d2a94..000000000 --- a/src/flowtype/tests/lisk-sign-transaction.js +++ /dev/null @@ -1,15 +0,0 @@ -/* @flow */ - -import type { PreparedTransaction as LiskTransaction } from '../../js/types/lisk.js'; -declare module 'flowtype/tests/lisk-sign-transaction' { - declare export type TestLiskSignTransactionPayload = { - method: string, - path: string, - transaction: LiskTransaction, - }; - declare export type ExpectedLiskSignTransactionResponse = { - payload: { - signature: string, - }, - }; -} diff --git a/src/flowtype/tests/lisk-verify-message.js b/src/flowtype/tests/lisk-verify-message.js deleted file mode 100644 index 95fca2cfb..000000000 --- a/src/flowtype/tests/lisk-verify-message.js +++ /dev/null @@ -1,14 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/lisk-verify-message' { - declare export type TestLiskVerifyMessagePayload = { - method: string, - publicKey: string, - signature: string, - message: string, - }; - - declare export type ExpectedLiskVerifyMessageResponse = { - success: boolean, - }; -} diff --git a/src/flowtype/tests/nem-get-address.js b/src/flowtype/tests/nem-get-address.js deleted file mode 100644 index 9795cfeeb..000000000 --- a/src/flowtype/tests/nem-get-address.js +++ /dev/null @@ -1,14 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/nem-get-address' { - declare export type TestNemGetAddressPayload = { - method: string, - path: string | Array, - network: number, - }; - declare export type ExpectedNemGetAddressResponse = { - payload: { - address: string, - }, - }; -} diff --git a/src/flowtype/tests/nem-sign-transaction.js b/src/flowtype/tests/nem-sign-transaction.js deleted file mode 100644 index 7e392c9b9..000000000 --- a/src/flowtype/tests/nem-sign-transaction.js +++ /dev/null @@ -1,16 +0,0 @@ -/* @flow */ - -import type { Transaction as NEMTransaction } from '../../js/types/nem'; -declare module 'flowtype/tests/nem-sign-transaction' { - declare export type TestNemSignTransactionPayload = { - method: string, - path: string | Array, - transaction: NEMTransaction, - }; - declare export type ExpectedNemSignTransactionResponse = { - payload: { - data: string, - signature: string, - }, - }; -} diff --git a/src/flowtype/tests/passphrase.js b/src/flowtype/tests/passphrase.js deleted file mode 100644 index be84d3ea0..000000000 --- a/src/flowtype/tests/passphrase.js +++ /dev/null @@ -1,22 +0,0 @@ -/* @flow */ - -import type { - TestGetPublicKeyPayload -} from 'flowtype/tests/get-public-key'; - -declare module 'flowtype/tests/passphrase' { - declare export type TestPassphrasePayload = { - method: 'getPublicKey', - coin: 'btc', - path: "m/49'/0'/0'", - passphrase: string, - state: string, - }; - - declare export type ExpectedPassphraseResponse = { - success?: boolean, - payload?: { - xpub: string, - }, - }; -} \ No newline at end of file diff --git a/src/flowtype/tests/ripple-get-address.js b/src/flowtype/tests/ripple-get-address.js deleted file mode 100644 index f690629e8..000000000 --- a/src/flowtype/tests/ripple-get-address.js +++ /dev/null @@ -1,14 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/ripple-get-address' { - declare export type TestRippleGetAddressPayload = { - method: string, - path: string | Array, - }; - - declare export type ExpectedRippleGetAddressResponse = { - payload: { - address: string, - }, - }; -} diff --git a/src/flowtype/tests/ripple-sign-transaction.js b/src/flowtype/tests/ripple-sign-transaction.js deleted file mode 100644 index b1dad9f3c..000000000 --- a/src/flowtype/tests/ripple-sign-transaction.js +++ /dev/null @@ -1,18 +0,0 @@ -/* @flow */ -import type { Transaction as RippleTransaction } from '../../js/types/ripple'; - -declare module 'flowtype/tests/ripple-sign-transaction' { - declare export type TestRippleSignTransactionPayload = { - method: string, - path: string | Array, - transaction: RippleTransaction, - }; - - declare export type ExpectedRippleSignTransactionResponse = { - success?: boolean, - payload?: { - signature: string, - serializedTx: string, - }, - }; -} diff --git a/src/flowtype/tests/sign-message.js b/src/flowtype/tests/sign-message.js deleted file mode 100644 index a140919b2..000000000 --- a/src/flowtype/tests/sign-message.js +++ /dev/null @@ -1,16 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/sign-message' { - declare export type TestSignMessagePayload = { - method: string, - path: string | Array, - message: string, - coin: string, - }; - declare export type ExpectedSignMessageResponse = { - payload: { - address: string, - signature: string, - }, - }; -} diff --git a/src/flowtype/tests/sign-transaction.js b/src/flowtype/tests/sign-transaction.js deleted file mode 100644 index 7020edd48..000000000 --- a/src/flowtype/tests/sign-transaction.js +++ /dev/null @@ -1,28 +0,0 @@ -/* @flow */ - -import type { - TransactionInput, - TransactionOutput, -} from '../../js/types/trezor.js'; - -declare module 'flowtype/tests/sign-transaction' { - declare export type TestSignTransactionPayload = { - method: string, - coin: string, - inputs: Array, - outputs: Array, - timestamp?: number, - version?: number, - overwintered?: boolean, - versionGroupId?: number, - }; - - declare export type ExpectedSignTransactionResponse = { - success?: boolean, - payload?: { - code?: string, - serialized?: string, - signatures?: Array, - }, - }; -} diff --git a/src/flowtype/tests/tezos-get-address.js b/src/flowtype/tests/tezos-get-address.js deleted file mode 100644 index d4b44a52d..000000000 --- a/src/flowtype/tests/tezos-get-address.js +++ /dev/null @@ -1,15 +0,0 @@ -/* @flow */ -declare module 'flowtype/tests/tezos-get-address' { - declare export type TestTezosGetAddressPayload = { - method: string, - path: string | Array, - showOnTrezor: boolean, - }; - - declare export type ExpectedTezosGetAddressResponse = { - success?: boolean, - payload?: { - address: string, - }, - }; -} diff --git a/src/flowtype/tests/tezos-get-public-key.js b/src/flowtype/tests/tezos-get-public-key.js deleted file mode 100644 index 048dabfef..000000000 --- a/src/flowtype/tests/tezos-get-public-key.js +++ /dev/null @@ -1,15 +0,0 @@ -/* @flow */ -declare module 'flowtype/tests/tezos-get-public-key' { - declare export type TestTezosGetPublicKeyPayload = { - method: string, - path: string | Array, - showOnTrezor: boolean, - }; - - declare export type ExpectedTezosGetPublicKeyResponse = { - success?: boolean, - payload?: { - publicKey: string, - }, - }; -} diff --git a/src/flowtype/tests/tezos-sign-transaction.js b/src/flowtype/tests/tezos-sign-transaction.js deleted file mode 100644 index e1e9817b4..000000000 --- a/src/flowtype/tests/tezos-sign-transaction.js +++ /dev/null @@ -1,17 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/tezos-sign-transaction' { - - declare export type TestTezosSignTransactionPayload = { - method: string, - path: string | Array, - }; - - declare export type ExpectedTezosSignTransactionResponse = { - payload: { - signature: string, - sig_op_contents: string, - operation_hash: string, - }, - }; -} diff --git a/src/flowtype/tests/verify-message.js b/src/flowtype/tests/verify-message.js deleted file mode 100644 index 397d5cecf..000000000 --- a/src/flowtype/tests/verify-message.js +++ /dev/null @@ -1,15 +0,0 @@ -/* @flow */ - -declare module 'flowtype/tests/verify-message' { - declare export type TestVerifyMessagePayload = { - method: string, - coin: string, - address: string, - signature: string, - message: string, - }; - - declare export type ExpectedVerifyMessageResponse = { - success: boolean, - }; -} diff --git a/src/js/backend/BlockchainLink.js b/src/js/backend/BlockchainLink.js index 63b0865c0..bcbdcd746 100644 --- a/src/js/backend/BlockchainLink.js +++ b/src/js/backend/BlockchainLink.js @@ -3,47 +3,32 @@ import { Transaction as BitcoinJsTransaction } from '@trezor/utxo-lib'; import BlockchainLink from '@trezor/blockchain-link'; import { BlockchainMessage } from '../message/builder'; import * as BLOCKCHAIN from '../constants/blockchain'; -import type { CoreMessage, CoinInfo } from '../types'; -import type { SubscriptionAccountInfo } from '../types/params'; -import type { BlockchainBlock, BlockchainLinkTransaction } from '../types/blockchainEvent'; -import type { GetTransactionResponse } from '../types/transactions'; +import type { + CoreMessage, + CoinInfo, + GetAccountInfo, + BlockchainBlock, + BlockchainSubscribeAccount, + BlockchainTransactions, +} from '../types'; import { BlockbookWorker, RippleWorker, } from '../env/node/workers'; -import type { AccountInfoRequest } from '../types/account'; - BitcoinJsTransaction.USE_STRING_VALUES = true; type Options = { - coinInfo: CoinInfo, - postMessage: (message: CoreMessage) => void, -}; - -// duplicate from blockchain-link -type GetAccountInfo = { - descriptor: string, - details?: $ElementType, - tokens?: $ElementType, - page?: number, // blockbook only, page index - pageSize?: number, // how many transactions on page - from?: number, - to?: number, - contractFilter?: string, // blockbook only, ethereum token filter - gap?: number, // blockbook only, derived addresses gap - marker?: { - ledger: number, - seq: number, - }, + coinInfo: CoinInfo; + postMessage: (message: CoreMessage) => void; }; // duplicate from blockchain-link type Fee = { - feePerUnit: string, - feePerTx?: string, - feeLimit?: string, + feePerUnit: string; + feePerTx?: string; + feeLimit?: string; } const getWorker = (type: string): ?(string | () => Worker) => { @@ -124,7 +109,7 @@ export default class Blockchain { return BitcoinJsTransaction.fromHex(transaction.tx.hex, this.coinInfo.network); } - async getTransactions(txs: string[]): Promise { + async getTransactions(txs: string[]): Promise { return Promise.all( txs.map(id => this.link.getTransaction(id)) ); @@ -140,7 +125,7 @@ export default class Blockchain { return this.link.getInfo(); } - async getAccountInfo(request: GetAccountInfo) { + async getAccountInfo(request: $Shape) { return this.link.getAccountInfo(request); } @@ -169,10 +154,10 @@ export default class Blockchain { return this.link.estimateFee(request); } - async subscribe(accounts: SubscriptionAccountInfo[]): Promise<{ subscribed: boolean }> { + async subscribe(accounts: BlockchainSubscribeAccount[]): Promise<{ subscribed: boolean }> { // set block listener if it wasn't set before if (this.link.listenerCount('block') === 0) { - this.link.on('block', (block: $ElementType) => { + this.link.on('block', (block: BlockchainBlock) => { this.postMessage(BlockchainMessage(BLOCKCHAIN.BLOCK, { coin: this.coinInfo, ...block, @@ -182,7 +167,7 @@ export default class Blockchain { // set notification listener if it wasn't set before if (this.link.listenerCount('notification') === 0) { - this.link.on('notification', (notification: BlockchainLinkTransaction) => { + this.link.on('notification', notification => { this.postMessage(BlockchainMessage(BLOCKCHAIN.NOTIFICATION, { coin: this.coinInfo, notification, @@ -198,7 +183,7 @@ export default class Blockchain { }); } - async unsubscribe(accounts?: SubscriptionAccountInfo[]): Promise { + async unsubscribe(accounts?: BlockchainSubscribeAccount[]): Promise { if (!accounts) { this.link.removeAllListeners('block'); this.link.removeAllListeners('notification'); @@ -240,7 +225,7 @@ export const find = (name: string): ?Blockchain => { return null; }; -export const initBlockchain = async (coinInfo: $ElementType, postMessage: $ElementType): Promise => { +export const initBlockchain = async (coinInfo: $ElementType, postMessage: $ElementType) => { let backend: ?Blockchain = find(coinInfo.name); if (!backend) { backend = new Blockchain({ diff --git a/src/js/constants/index.js b/src/js/constants/index.js index 4f954b3be..84f9d4d36 100644 --- a/src/js/constants/index.js +++ b/src/js/constants/index.js @@ -1,4 +1,11 @@ /* @flow */ +import * as BLOCKCHAIN from './blockchain'; +import * as DEVICE from './device'; +import * as ERRORS from './errors'; +import * as IFRAME from './iframe'; +import * as POPUP from './popup'; +import * as TRANSPORT from './transport'; +import * as UI from './ui'; export const CORE_EVENT: 'CORE_EVENT' = 'CORE_EVENT'; export const UI_EVENT: 'UI_EVENT' = 'UI_EVENT'; @@ -6,3 +13,13 @@ export const DEVICE_EVENT: 'DEVICE_EVENT' = 'DEVICE_EVENT'; export const TRANSPORT_EVENT: 'TRANSPORT_EVENT' = 'TRANSPORT_EVENT'; export const RESPONSE_EVENT: 'RESPONSE_EVENT' = 'RESPONSE_EVENT'; export const BLOCKCHAIN_EVENT: 'BLOCKCHAIN_EVENT' = 'BLOCKCHAIN_EVENT'; + +export { + BLOCKCHAIN, + DEVICE, + ERRORS, + IFRAME, + POPUP, + TRANSPORT, + UI, +}; diff --git a/src/js/constants/ui.js b/src/js/constants/ui.js index cbf74e989..4337a31d7 100644 --- a/src/js/constants/ui.js +++ b/src/js/constants/ui.js @@ -11,6 +11,7 @@ export const FIRMWARE_OUTDATED: 'ui-device_firmware_outdated' = 'ui-device_firmw export const FIRMWARE_NOT_SUPPORTED: 'ui-device_firmware_unsupported' = 'ui-device_firmware_unsupported'; export const FIRMWARE_NOT_COMPATIBLE: 'ui-device_firmware_not_compatible' = 'ui-device_firmware_not_compatible'; export const FIRMWARE_NOT_INSTALLED: 'ui-device_firmware_not_installed' = 'ui-device_firmware_not_installed'; +export const FIRMWARE_PROGRESS: 'ui-firmware-progress' = 'ui-firmware-progress'; export const DEVICE_NEEDS_BACKUP: 'ui-device_needs_backup' = 'ui-device_needs_backup'; export const REQUEST_UI_WINDOW: 'ui-request_window' = 'ui-request_window'; @@ -34,7 +35,6 @@ export const UPDATE_CUSTOM_FEE: 'ui-update_custom_fee' = 'ui-update_custom_fee'; export const INSUFFICIENT_FUNDS: 'ui-insufficient_funds' = 'ui-insufficient_funds'; export const REQUEST_BUTTON: 'ui-button' = 'ui-button'; export const REQUEST_WORD: 'ui-request_word' = 'ui-request_word'; -export const FIRMWARE_PROGRESS: 'ui-firmware-progress' = 'ui-firmware-progress'; export const RECEIVE_PERMISSION: 'ui-receive_permission' = 'ui-receive_permission'; export const RECEIVE_CONFIRMATION: 'ui-receive_confirmation' = 'ui-receive_confirmation'; diff --git a/src/js/core/Core.js b/src/js/core/Core.js index 1cbab2df4..8896a7289 100644 --- a/src/js/core/Core.js +++ b/src/js/core/Core.js @@ -21,9 +21,7 @@ import { find as findMethod } from './methods'; import { create as createDeferred } from '../utils/deferred'; import { resolveAfter } from '../utils/promiseUtils'; import Log, { init as initLog } from '../utils/debug'; - -import type { ConnectSettings } from '../data/ConnectSettings'; -import type { Device as DeviceTyped, Deferred, CoreMessage, UiPromiseResponse } from '../types'; +import type { ConnectSettings, Device as DeviceTyped, Deferred, CoreMessage, UiPromiseResponse } from '../types'; // Public variables // eslint-disable-next-line no-use-before-define @@ -928,7 +926,7 @@ export const initData = async (settings: ConnectSettings) => { export const init = async (settings: ConnectSettings) => { try { - _log.enabled = settings.debug; + _log.enabled = !!settings.debug; await DataManager.load(settings); await initCore(); return _core; diff --git a/src/js/core/methods/AbstractMethod.js b/src/js/core/methods/AbstractMethod.js index 8dac30e9f..6ffcba243 100644 --- a/src/js/core/methods/AbstractMethod.js +++ b/src/js/core/methods/AbstractMethod.js @@ -1,6 +1,5 @@ /* @flow */ -import { crypto } from '@trezor/utxo-lib'; import Device from '../../device/Device'; import DataManager from '../../data/DataManager'; import * as UI from '../../constants/ui'; @@ -10,12 +9,11 @@ import { load as loadStorage, save as saveStorage, PERMISSIONS_KEY } from '../.. import { versionCompare } from '../../utils/deviceFeaturesUtils'; import { UiMessage, DeviceMessage } from '../../message/builder'; -import type { Deferred, CoreMessage, UiPromiseResponse, FirmwareRange } from '../../types'; -import type { FirmwareException, ButtonRequestData } from '../../types/uiRequest'; +import type { Deferred, CoreMessage, UiPromiseResponse, FirmwareRange, FirmwareException, ButtonRequestData } from '../../types'; export interface MethodInterface { - +responseID: number, - +device: Device, + +responseID: number; + +device: Device; } export default class AbstractMethod implements MethodInterface { @@ -222,13 +220,6 @@ export default class AbstractMethod implements MethodInterface { return null; } - __hash(permission: string): string { - const host: string = DataManager.getSettings('origin'); - const secret: string = `${permission}#${this.device.features.device_id}#${host}`; - const hash: Buffer = crypto.hash256(Buffer.from(secret, 'binary')); - return hash.toString('hex'); - } - dispose() { // to override } diff --git a/src/js/core/methods/ApplyFlags.js b/src/js/core/methods/ApplyFlags.js index 6826ab2a8..a2d2de9bb 100644 --- a/src/js/core/methods/ApplyFlags.js +++ b/src/js/core/methods/ApplyFlags.js @@ -8,7 +8,7 @@ import { UiMessage } from '../../message/builder'; import type { CoreMessage } from '../../types'; type Params = { - flags: number, + flags: number; } export default class ApplyFlags extends AbstractMethod { diff --git a/src/js/core/methods/ApplySettings.js b/src/js/core/methods/ApplySettings.js index af7701bd4..22cf58db6 100644 --- a/src/js/core/methods/ApplySettings.js +++ b/src/js/core/methods/ApplySettings.js @@ -8,12 +8,12 @@ import { UiMessage } from '../../message/builder'; import type { CoreMessage } from '../../types'; type Params = { - language?: string, - label?: string, - use_passphrase?: boolean, - homescreen?: string, - passhprase_source?: number, - auto_lock_delay_ms?: number, + language?: string; + label?: string; + use_passphrase?: boolean; + homescreen?: string; + passhprase_source?: number; + auto_lock_delay_ms?: number; } export default class ApplySettings extends AbstractMethod { diff --git a/src/js/core/methods/BinanceGetAddress.js b/src/js/core/methods/BinanceGetAddress.js index e8a3d8529..7f2a67d00 100644 --- a/src/js/core/methods/BinanceGetAddress.js +++ b/src/js/core/methods/BinanceGetAddress.js @@ -9,12 +9,12 @@ import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; import type { CoreMessage, UiPromiseResponse } from '../../types'; -import type { BinanceAddress } from '../../types/binance'; +import type { BinanceAddress } from '../../types/networks/binance'; type Batch = { - path: Array, - address: ?string, - showOnTrezor: boolean, + path: Array; + address: ?string; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/BinanceGetPublicKey.js b/src/js/core/methods/BinanceGetPublicKey.js index 9a010bf6c..9800659ef 100644 --- a/src/js/core/methods/BinanceGetPublicKey.js +++ b/src/js/core/methods/BinanceGetPublicKey.js @@ -8,13 +8,13 @@ import { validatePath, fromHardened, getSerializedPath } from '../../utils/pathU import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; -import type { BinancePublicKey } from '../../types/trezor'; -import type { BinancePublicKey as BinancePublicKeyResponse } from '../../types/binance'; +import type { BinancePublicKey } from '../../types/trezor/protobuf'; +import type { BinancePublicKey as BinancePublicKeyResponse } from '../../types/networks/binance'; import type { CoreMessage, UiPromiseResponse } from '../../types'; type Batch = { - path: Array, - showOnTrezor: boolean, + path: Array; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/BinanceSignTransaction.js b/src/js/core/methods/BinanceSignTransaction.js index b5f7c38bf..7f4e118c5 100644 --- a/src/js/core/methods/BinanceSignTransaction.js +++ b/src/js/core/methods/BinanceSignTransaction.js @@ -9,14 +9,14 @@ import * as helper from './helpers/binanceSignTx'; import type { CoreMessage } from '../../types'; import type { BinanceSignedTx, -} from '../../types/trezor'; +} from '../../types/trezor/protobuf'; import type { - PreparedBinanceTransaction, -} from '../../types/binance'; + BinancePreparedTransaction, +} from '../../types/networks/binance'; type Params = { - path: number[], - transaction: PreparedBinanceTransaction, + path: number[]; + transaction: BinancePreparedTransaction; } export default class BinanceSignTransaction extends AbstractMethod { diff --git a/src/js/core/methods/CardanoGetAddress.js b/src/js/core/methods/CardanoGetAddress.js index aedca3b96..95a07fe14 100644 --- a/src/js/core/methods/CardanoGetAddress.js +++ b/src/js/core/methods/CardanoGetAddress.js @@ -9,12 +9,12 @@ import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; import type { CoreMessage, UiPromiseResponse } from '../../types'; -import type { CardanoAddress } from '../../types/cardano'; +import type { CardanoAddress } from '../../types/networks/cardano'; type Batch = { - path: Array, - address: ?string, - showOnTrezor: boolean, + path: Array; + address: ?string; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/CardanoGetPublicKey.js b/src/js/core/methods/CardanoGetPublicKey.js index 58b81f63b..dd8d5397c 100644 --- a/src/js/core/methods/CardanoGetPublicKey.js +++ b/src/js/core/methods/CardanoGetPublicKey.js @@ -8,13 +8,13 @@ import { validatePath, fromHardened, getSerializedPath } from '../../utils/pathU import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; -import type { CardanoPublicKey } from '../../types/trezor'; +import type { CardanoPublicKey } from '../../types/trezor/protobuf'; import type { CoreMessage, UiPromiseResponse } from '../../types'; -import type { CardanoPublicKey as CardanoPublicKeyResponse } from '../../types/cardano'; +import type { CardanoPublicKey as CardanoPublicKeyResponse } from '../../types/networks/cardano'; type Batch = { - path: Array, - showOnTrezor: boolean, + path: Array; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/CardanoSignTransaction.js b/src/js/core/methods/CardanoSignTransaction.js index 201bd8ee4..498316525 100644 --- a/src/js/core/methods/CardanoSignTransaction.js +++ b/src/js/core/methods/CardanoSignTransaction.js @@ -6,15 +6,15 @@ import { getMiscNetwork } from '../../data/CoinInfo'; import { validatePath } from '../../utils/pathUtils'; import * as helper from './helpers/cardanoSignTx'; -import type { CardanoTxInput, CardanoTxOutput, CardanoSignedTx } from '../../types/trezor'; -import type { CardanoSignedTx as CardanoSignedTxResponse } from '../../types/cardano'; +import type { CardanoTxInput, CardanoTxOutput, CardanoSignedTx } from '../../types/trezor/protobuf'; +import type { CardanoSignedTx as CardanoSignedTxResponse } from '../../types/networks/cardano'; import type { CoreMessage } from '../../types'; type Params = { - inputs: Array, - outputs: Array, - transactions: Array, - protocol_magic: number, + inputs: Array; + outputs: Array; + transactions: Array; + protocol_magic: number; } export default class CardanoSignTransaction extends AbstractMethod { diff --git a/src/js/core/methods/ChangePin.js b/src/js/core/methods/ChangePin.js index 32df77a65..45f326ca6 100644 --- a/src/js/core/methods/ChangePin.js +++ b/src/js/core/methods/ChangePin.js @@ -5,7 +5,7 @@ import type { CoreMessage } from '../../types'; import { validateParams } from './helpers/paramsValidator'; type Params = { - remove?: boolean, + remove?: boolean; } export default class ChangePin extends AbstractMethod { diff --git a/src/js/core/methods/CipherKeyValue.js b/src/js/core/methods/CipherKeyValue.js index b691e2582..5497c567b 100644 --- a/src/js/core/methods/CipherKeyValue.js +++ b/src/js/core/methods/CipherKeyValue.js @@ -7,16 +7,16 @@ import { validateParams, getFirmwareRange } from './helpers/paramsValidator'; import { validatePath } from '../../utils/pathUtils'; import type { CoreMessage } from '../../types'; -import type { CipheredKeyValue } from '../../types/trezor'; +import type { CipheredKeyValue } from '../../types/trezor/protobuf'; type Batch = { - path: Array, - key: string, - value: string, - encrypt: boolean, - askOnEncrypt: boolean, - askOnDecrypt: boolean, - iv: string, + path: Array; + key: string; + value: string; + encrypt: boolean; + askOnEncrypt: boolean; + askOnDecrypt: boolean; + iv: string; } type Params = Array; diff --git a/src/js/core/methods/ComposeTransaction.js b/src/js/core/methods/ComposeTransaction.js index 45cac2ed5..81b72696c 100644 --- a/src/js/core/methods/ComposeTransaction.js +++ b/src/js/core/methods/ComposeTransaction.js @@ -33,17 +33,15 @@ import type { BuildTxResult, } from 'hd-wallet'; import type { CoreMessage, BitcoinNetworkInfo } from '../../types'; -import type { SignedTx } from '../../types/trezor'; -import type { $$ComposeTransaction as Payload } from '../../types/params'; -import type { PrecomposedTransaction } from '../../types/response'; -import type { DiscoveryAccount, AccountUtxo } from '../../types/account'; +import type { SignedTx } from '../../types/trezor/protobuf'; +import type { DiscoveryAccount, AccountUtxo, PrecomposeParams, PrecomposedTransaction } from '../../types/account'; type Params = { - outputs: BuildTxOutputRequest[], - coinInfo: BitcoinNetworkInfo, - push: boolean, - account?: $ElementType, - feeLevels?: $ElementType, + outputs: BuildTxOutputRequest[]; + coinInfo: BitcoinNetworkInfo; + push: boolean; + account?: $ElementType; + feeLevels?: $ElementType; } export default class ComposeTransaction extends AbstractMethod { @@ -116,7 +114,7 @@ export default class ComposeTransaction extends AbstractMethod { }; } - async precompose(account: $ElementType, feeLevels: $ElementType): Promise { + async precompose(account: $ElementType, feeLevels: $ElementType): Promise { const { coinInfo, outputs } = this.params; const composer = new TransactionComposer({ account: { @@ -181,7 +179,7 @@ export default class ComposeTransaction extends AbstractMethod { } } - async selectAccount(): Promise<{ account: DiscoveryAccount, utxo: AccountUtxo[] }> { + async selectAccount(): Promise<{ account: DiscoveryAccount; utxo: AccountUtxo[] }> { const { coinInfo } = this.params; const blockchain = await initBlockchain(coinInfo, this.postMessage); const dfd = this.createUiPromise(UI.RECEIVE_ACCOUNT, this.device); diff --git a/src/js/core/methods/CustomMessage.js b/src/js/core/methods/CustomMessage.js index 6e36f6fdc..96620089c 100644 --- a/src/js/core/methods/CustomMessage.js +++ b/src/js/core/methods/CustomMessage.js @@ -8,9 +8,9 @@ import { UiMessage } from '../../message/builder'; import type { CoreMessage, UiPromiseResponse } from '../../types'; type Params = { - customMessages: JSON, - message: string, - params: any, + customMessages: JSON; + message: string; + params: any; } export default class CustomMessage extends AbstractMethod { diff --git a/src/js/core/methods/EosGetPublicKey.js b/src/js/core/methods/EosGetPublicKey.js index 00c8c05cd..f226af1a4 100644 --- a/src/js/core/methods/EosGetPublicKey.js +++ b/src/js/core/methods/EosGetPublicKey.js @@ -7,12 +7,12 @@ import { validatePath, fromHardened, getSerializedPath } from '../../utils/pathU import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; -import type { EosPublicKey } from '../../types/eos'; +import type { EosPublicKey } from '../../types/networks/eos'; import type { CoreMessage, UiPromiseResponse } from '../../types'; type Batch = { - path: Array, - showOnTrezor: boolean, + path: Array; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/EosSignTransaction.js b/src/js/core/methods/EosSignTransaction.js index 521b50173..be1cd061b 100644 --- a/src/js/core/methods/EosSignTransaction.js +++ b/src/js/core/methods/EosSignTransaction.js @@ -6,14 +6,14 @@ import { getMiscNetwork } from '../../data/CoinInfo'; import { validatePath } from '../../utils/pathUtils'; import * as helper from './helpers/eosSignTx'; -import type { EosTxHeader, EosTxActionAck, EosSignedTx } from '../../types/trezor'; +import type { EosTxHeader, EosTxActionAck, EosSignedTx } from '../../types/trezor/protobuf'; import type { CoreMessage } from '../../types'; type Params = { - path: Array, - chain_id: string, - header: ?EosTxHeader, - ack: Array, + path: Array; + chain_id: string; + header: ?EosTxHeader; + ack: Array; } export default class EosSignTransaction extends AbstractMethod { diff --git a/src/js/core/methods/EthereumGetAddress.js b/src/js/core/methods/EthereumGetAddress.js index e82b70a20..8b38bb207 100644 --- a/src/js/core/methods/EthereumGetAddress.js +++ b/src/js/core/methods/EthereumGetAddress.js @@ -9,14 +9,14 @@ import { getEthereumNetwork, getUniqueNetworks } from '../../data/CoinInfo'; import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; -import type { EthereumAddress } from '../../types/ethereum'; +import type { EthereumAddress } from '../../types/networks/ethereum'; import type { CoreMessage, UiPromiseResponse, EthereumNetworkInfo } from '../../types'; type Batch = { - path: Array, - address: ?string, - network: ?EthereumNetworkInfo, - showOnTrezor: boolean, + path: Array; + address: ?string; + network: ?EthereumNetworkInfo; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/EthereumGetPublicKey.js b/src/js/core/methods/EthereumGetPublicKey.js index e46675b1d..e92001e01 100644 --- a/src/js/core/methods/EthereumGetPublicKey.js +++ b/src/js/core/methods/EthereumGetPublicKey.js @@ -10,12 +10,12 @@ import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; import type { CoreMessage, UiPromiseResponse, EthereumNetworkInfo } from '../../types'; -import type { HDNodeResponse } from '../../types/trezor'; +import type { HDNodeResponse } from '../../types/trezor/protobuf'; type Batch = { - path: Array, - network: ?EthereumNetworkInfo, - showOnTrezor: boolean, + path: Array; + network: ?EthereumNetworkInfo; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/EthereumSignMessage.js b/src/js/core/methods/EthereumSignMessage.js index a51188799..e623acea8 100644 --- a/src/js/core/methods/EthereumSignMessage.js +++ b/src/js/core/methods/EthereumSignMessage.js @@ -6,13 +6,13 @@ import { validatePath } from '../../utils/pathUtils'; import { getEthereumNetwork } from '../../data/CoinInfo'; import { toChecksumAddress, getNetworkLabel, messageToHex } from '../../utils/ethereumUtils'; -import type { MessageSignature } from '../../types/trezor'; +import type { MessageSignature } from '../../types/trezor/protobuf'; import type { CoreMessage, EthereumNetworkInfo } from '../../types'; type Params = { - path: Array, - network: ?EthereumNetworkInfo, - message: string, + path: Array; + network: ?EthereumNetworkInfo; + message: string; } export default class EthereumSignMessage extends AbstractMethod { diff --git a/src/js/core/methods/EthereumSignTransaction.js b/src/js/core/methods/EthereumSignTransaction.js index f0c401932..10df2275e 100644 --- a/src/js/core/methods/EthereumSignTransaction.js +++ b/src/js/core/methods/EthereumSignTransaction.js @@ -8,12 +8,12 @@ import { stripHexPrefix, getNetworkLabel } from '../../utils/ethereumUtils'; import * as helper from './helpers/ethereumSignTx'; import type { CoreMessage } from '../../types'; -import type { EthereumSignedTx } from '../../types/trezor'; -import type { Transaction as EthereumTransaction } from '../../types/ethereum'; +import type { EthereumSignedTx } from '../../types/trezor/protobuf'; +import type { EthereumTransaction } from '../../types/networks/ethereum'; type Params = { - path: Array, - transaction: EthereumTransaction, + path: Array; + transaction: EthereumTransaction; } export default class EthereumSignTx extends AbstractMethod { diff --git a/src/js/core/methods/EthereumVerifyMessage.js b/src/js/core/methods/EthereumVerifyMessage.js index 0cabe334b..ce8c678d9 100644 --- a/src/js/core/methods/EthereumVerifyMessage.js +++ b/src/js/core/methods/EthereumVerifyMessage.js @@ -2,15 +2,15 @@ import AbstractMethod from './AbstractMethod'; import { validateParams, getFirmwareRange } from './helpers/paramsValidator'; -import type { Success } from '../../types/trezor'; +import type { Success } from '../../types/trezor/protobuf'; import type { CoreMessage } from '../../types'; import { stripHexPrefix, messageToHex } from '../../utils/ethereumUtils'; type Params = { - address: string, - signature: string, - message: string, + address: string; + signature: string; + message: string; } export default class EthereumVerifyMessage extends AbstractMethod { diff --git a/src/js/core/methods/FirmwareUpdate.js b/src/js/core/methods/FirmwareUpdate.js index ad1c90c83..a6a15ee28 100644 --- a/src/js/core/methods/FirmwareUpdate.js +++ b/src/js/core/methods/FirmwareUpdate.js @@ -5,7 +5,7 @@ import * as UI from '../../constants/ui'; import { validateParams } from './helpers/paramsValidator'; import { uploadFirmware } from './helpers/uploadFirmware'; import { UiMessage } from '../../message/builder'; -import type { FirmwareUpload } from '../../types/trezor'; // flowtype only +import type { FirmwareUpload } from '../../types/trezor/protobuf'; // flowtype only import type { CoreMessage } from '../../types'; diff --git a/src/js/core/methods/GetAccountInfo.js b/src/js/core/methods/GetAccountInfo.js index 725cce843..ef497eaf2 100644 --- a/src/js/core/methods/GetAccountInfo.js +++ b/src/js/core/methods/GetAccountInfo.js @@ -14,11 +14,10 @@ import { UiMessage } from '../../message/builder'; import { initBlockchain } from '../../backend/BlockchainLink'; import type { CoreMessage, CoinInfo } from '../../types'; -import type { $GetAccountInfo } from '../../types/params'; -import type { AccountInfo } from '../../types/account'; -import type { FirmwareException } from '../../types/uiRequest'; +import type { GetAccountInfo as GetAccountInfoParams, AccountInfo, AccountUtxo } from '../../types/account'; +import type { FirmwareException } from '../../types/events'; -type Request = $GetAccountInfo & { address_n: number[], coinInfo: CoinInfo }; +type Request = GetAccountInfoParams & { address_n: number[]; coinInfo: CoinInfo }; type Params = Request[]; export default class GetAccountInfo extends AbstractMethod { @@ -114,7 +113,7 @@ export default class GetAccountInfo extends AbstractMethod { }, })); } else { - const keys: { [coin: string]: { coinInfo: CoinInfo, values: Array} } = {}; + const keys: { [coin: string]: { coinInfo: CoinInfo; values: Array} } = {}; this.params.forEach(b => { if (!keys[b.coinInfo.label]) { keys[b.coinInfo.label] = { @@ -240,6 +239,7 @@ export default class GetAccountInfo extends AbstractMethod { if (accountDescriptor) { descriptor = accountDescriptor.descriptor; } + if (request.coinInfo.shortcut === 'LTC') { throw Error('Some fail...'); } } catch (error) { if (this.hasBundle) { responses.push(null); @@ -279,7 +279,7 @@ export default class GetAccountInfo extends AbstractMethod { if (this.disposed) break; - let utxo: $ElementType; + let utxo: AccountUtxo; if (request.coinInfo.type === 'bitcoin' && typeof request.details === 'string' && request.details !== 'basic') { utxo = await blockchain.getAccountUtxo(descriptor); } @@ -370,7 +370,7 @@ export default class GetAccountInfo extends AbstractMethod { marker: request.marker, }); - let utxo: $ElementType; + let utxo: AccountUtxo; if (request.coinInfo.type === 'bitcoin' && typeof request.details === 'string' && request.details !== 'basic') { utxo = await blockchain.getAccountUtxo(account.descriptor); } diff --git a/src/js/core/methods/GetAddress.js b/src/js/core/methods/GetAddress.js index 098793a16..789fd84bd 100644 --- a/src/js/core/methods/GetAddress.js +++ b/src/js/core/methods/GetAddress.js @@ -9,16 +9,16 @@ import { NO_COIN_INFO } from '../../constants/errors'; import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; -import type { Address, MultisigRedeemScriptType, InputScriptType } from '../../types/trezor'; +import type { Address, MultisigRedeemScriptType, InputScriptType } from '../../types/trezor/protobuf'; import type { CoreMessage, UiPromiseResponse, BitcoinNetworkInfo } from '../../types'; type Batch = { - path: Array, - address: ?string, - coinInfo: BitcoinNetworkInfo, - showOnTrezor: boolean, - multisig?: MultisigRedeemScriptType, - scriptType?: InputScriptType, + path: Array; + address: ?string; + coinInfo: BitcoinNetworkInfo; + showOnTrezor: boolean; + multisig?: MultisigRedeemScriptType; + scriptType?: InputScriptType; } type Params = Array; diff --git a/src/js/core/methods/GetFeatures.js b/src/js/core/methods/GetFeatures.js index ccd0f3b68..991c56e5a 100644 --- a/src/js/core/methods/GetFeatures.js +++ b/src/js/core/methods/GetFeatures.js @@ -15,7 +15,7 @@ export default class GetFeatures extends AbstractMethod { this.skipFirmwareCheck = true; } - async run(): Promise { - return { ...this.device.features }; + async run() { + return this.device.features; } } diff --git a/src/js/core/methods/GetPublicKey.js b/src/js/core/methods/GetPublicKey.js index 38735ab56..6ec08fbee 100644 --- a/src/js/core/methods/GetPublicKey.js +++ b/src/js/core/methods/GetPublicKey.js @@ -9,12 +9,12 @@ import { UiMessage } from '../../message/builder'; import { getBitcoinNetwork } from '../../data/CoinInfo'; import { getPublicKeyLabel } from '../../utils/pathUtils'; -import type { HDNodeResponse } from '../../types/trezor'; +import type { HDNodeResponse } from '../../types/trezor/protobuf'; import type { CoreMessage, UiPromiseResponse, BitcoinNetworkInfo } from '../../types'; type Batch = { - path: Array, - coinInfo: ?BitcoinNetworkInfo, + path: Array; + coinInfo: ?BitcoinNetworkInfo; } type Params = Array; diff --git a/src/js/core/methods/GetSettings.js b/src/js/core/methods/GetSettings.js index aeda42359..eceab0b40 100644 --- a/src/js/core/methods/GetSettings.js +++ b/src/js/core/methods/GetSettings.js @@ -2,8 +2,7 @@ import AbstractMethod from './AbstractMethod'; import DataManager from '../../data/DataManager'; -import type { CoreMessage } from '../../types'; -import type { ConnectSettings } from '../../data/ConnectSettings'; +import type { ConnectSettings, CoreMessage } from '../../types'; export default class GetSettings extends AbstractMethod { constructor(message: CoreMessage) { diff --git a/src/js/core/methods/LiskGetAddress.js b/src/js/core/methods/LiskGetAddress.js index 2a2051275..feefac362 100644 --- a/src/js/core/methods/LiskGetAddress.js +++ b/src/js/core/methods/LiskGetAddress.js @@ -9,12 +9,12 @@ import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; import type { CoreMessage, UiPromiseResponse } from '../../types'; -import type { LiskAddress } from '../../types/lisk'; +import type { LiskAddress } from '../../types/networks/lisk'; type Batch = { - path: Array, - address: ?string, - showOnTrezor: boolean, + path: Array; + address: ?string; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/LiskGetPublicKey.js b/src/js/core/methods/LiskGetPublicKey.js index 2499bf5b4..21f96459e 100644 --- a/src/js/core/methods/LiskGetPublicKey.js +++ b/src/js/core/methods/LiskGetPublicKey.js @@ -8,13 +8,13 @@ import { validatePath, fromHardened, getSerializedPath } from '../../utils/pathU import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; -import type { LiskPublicKey } from '../../types/trezor'; +import type { LiskPublicKey } from '../../types/trezor/protobuf'; import type { CoreMessage, UiPromiseResponse } from '../../types'; -import type { LiskPublicKey as LiskPublicKeyResponse } from '../../types/lisk'; +import type { LiskPublicKey as LiskPublicKeyResponse } from '../../types/networks/lisk'; type Batch = { - path: Array, - showOnTrezor: boolean, + path: Array; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/LiskSignMessage.js b/src/js/core/methods/LiskSignMessage.js index 7ca43091b..cbd35d19c 100644 --- a/src/js/core/methods/LiskSignMessage.js +++ b/src/js/core/methods/LiskSignMessage.js @@ -5,13 +5,13 @@ import { validateParams, getFirmwareRange } from './helpers/paramsValidator'; import { getMiscNetwork } from '../../data/CoinInfo'; import { validatePath } from '../../utils/pathUtils'; -import type { LiskMessageSignature } from '../../types/trezor'; +import type { LiskMessageSignature } from '../../types/trezor/protobuf'; import type { CoreMessage } from '../../types'; -import type { LiskMessageSignature as LiskMessageSignatureResponse } from '../../types/lisk'; +import type { LiskMessageSignature as LiskMessageSignatureResponse } from '../../types/networks/lisk'; type Params = { - path: Array, - message: string, + path: Array; + message: string; } export default class LiskSignMessage extends AbstractMethod { diff --git a/src/js/core/methods/LiskSignTransaction.js b/src/js/core/methods/LiskSignTransaction.js index 52c289c06..63e7b05bf 100644 --- a/src/js/core/methods/LiskSignTransaction.js +++ b/src/js/core/methods/LiskSignTransaction.js @@ -7,12 +7,12 @@ import { validatePath } from '../../utils/pathUtils'; import { prepareTx } from './helpers/liskSignTx'; import type { CoreMessage } from '../../types'; -import type { LiskTransaction, LiskSignedTx } from '../../types/trezor'; -import type { Transaction as $LiskTransaction } from '../../types/lisk'; +import type { LiskTransaction, LiskSignedTx } from '../../types/trezor/protobuf'; +import type { LiskTransaction as LiskParsedTransaction } from '../../types/networks/lisk'; type Params = { - path: Array, - transaction: LiskTransaction, + path: Array; + transaction: LiskTransaction; } export default class LiskSignTransaction extends AbstractMethod { @@ -36,7 +36,7 @@ export default class LiskSignTransaction extends AbstractMethod { this.info = 'Sign Lisk transaction'; - const tx: $LiskTransaction = payload.transaction; + const tx: LiskParsedTransaction = payload.transaction; validateParams(tx, [ { name: 'type', type: 'number', obligatory: true }, { name: 'fee', type: 'string', obligatory: true }, @@ -48,7 +48,7 @@ export default class LiskSignTransaction extends AbstractMethod { ]); const transaction: LiskTransaction = prepareTx(tx); - + if (!transaction.asset) transaction.asset = {}; this.params = { path, transaction, diff --git a/src/js/core/methods/LiskVerifyMessage.js b/src/js/core/methods/LiskVerifyMessage.js index 7152ae794..823a553dd 100644 --- a/src/js/core/methods/LiskVerifyMessage.js +++ b/src/js/core/methods/LiskVerifyMessage.js @@ -3,13 +3,13 @@ import AbstractMethod from './AbstractMethod'; import { validateParams, getFirmwareRange } from './helpers/paramsValidator'; import { getMiscNetwork } from '../../data/CoinInfo'; -import type { Success } from '../../types/trezor'; +import type { Success } from '../../types/trezor/protobuf'; import type { CoreMessage } from '../../types'; type Params = { - publicKey: string, - signature: string, - message: string, + publicKey: string; + signature: string; + message: string; } export default class LiskVerifyMessage extends AbstractMethod { diff --git a/src/js/core/methods/LoadDevice.js b/src/js/core/methods/LoadDevice.js index ad6f63fa9..48cad4bbb 100644 --- a/src/js/core/methods/LoadDevice.js +++ b/src/js/core/methods/LoadDevice.js @@ -6,7 +6,7 @@ import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; import { validateParams } from './helpers/paramsValidator'; -import type { LoadDeviceFlags, Success } from '../../types/trezor'; +import type { LoadDeviceFlags, Success } from '../../types/trezor/protobuf'; import type { CoreMessage, UiPromiseResponse } from '../../types'; export default class LoadDevice extends AbstractMethod { diff --git a/src/js/core/methods/NEMGetAddress.js b/src/js/core/methods/NEMGetAddress.js index 7383dc6ce..2e66198f0 100644 --- a/src/js/core/methods/NEMGetAddress.js +++ b/src/js/core/methods/NEMGetAddress.js @@ -8,14 +8,14 @@ import { validatePath, fromHardened, getSerializedPath } from '../../utils/pathU import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; -import type { NEMAddress } from '../../types/nem'; +import type { NEMAddress } from '../../types/networks/nem'; import type { CoreMessage, UiPromiseResponse } from '../../types'; type Batch = { - path: Array, - address: ?string, - network: number, - showOnTrezor: boolean, + path: Array; + address: ?string; + network: number; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/NEMSignTransaction.js b/src/js/core/methods/NEMSignTransaction.js index 496783086..69de5047d 100644 --- a/src/js/core/methods/NEMSignTransaction.js +++ b/src/js/core/methods/NEMSignTransaction.js @@ -6,8 +6,8 @@ import { getMiscNetwork } from '../../data/CoinInfo'; import { validatePath } from '../../utils/pathUtils'; import * as helper from './helpers/nemSignTx'; -import type { NEMSignTxMessage, NEMSignedTx } from '../../types/trezor'; -import type { Transaction as $NEMTransaction } from '../../types/nem'; +import type { NEMSignTxMessage, NEMSignedTx } from '../../types/trezor/protobuf'; +import type { NEMTransaction } from '../../types/networks/nem'; import type { CoreMessage } from '../../types'; export default class NEMSignTransaction extends AbstractMethod { @@ -29,7 +29,7 @@ export default class NEMSignTransaction extends AbstractMethod { const path = validatePath(payload.path, 3); // incoming data should be in nem-sdk format - const transaction: $NEMTransaction = payload.transaction; + const transaction: NEMTransaction = payload.transaction; this.message = helper.createTx(transaction, path); } diff --git a/src/js/core/methods/PushTransaction.js b/src/js/core/methods/PushTransaction.js index 7112d1501..83e4cc3e3 100644 --- a/src/js/core/methods/PushTransaction.js +++ b/src/js/core/methods/PushTransaction.js @@ -9,8 +9,8 @@ import { initBlockchain } from '../../backend/BlockchainLink'; import type { CoreMessage, CoinInfo } from '../../types'; type Params = { - tx: string, - coinInfo: CoinInfo, + tx: string; + coinInfo: CoinInfo; } export default class PushTransaction extends AbstractMethod { diff --git a/src/js/core/methods/RecoveryDevice.js b/src/js/core/methods/RecoveryDevice.js index db0486e31..a4b8fee3f 100644 --- a/src/js/core/methods/RecoveryDevice.js +++ b/src/js/core/methods/RecoveryDevice.js @@ -6,18 +6,7 @@ import { validateParams } from './helpers/paramsValidator'; import { UiMessage } from '../../message/builder'; import type { CoreMessage } from '../../types'; - -type Params = { - word_count?: number, - passphrase_protection?: boolean, - pin_protection?: boolean, - language?: string, - label?: string, - enforce_wordlist?: boolean, - type?: number, - u2f_counter?: number, - dry_run?: boolean, -} +import type { RecoverDeviceSettings as Params } from '../../types/trezor/protobuf'; export default class RecoveryDevice extends AbstractMethod { params: Params; diff --git a/src/js/core/methods/RequestLogin.js b/src/js/core/methods/RequestLogin.js index ca35c9072..5688ea3bb 100644 --- a/src/js/core/methods/RequestLogin.js +++ b/src/js/core/methods/RequestLogin.js @@ -7,16 +7,15 @@ import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; import DataManager from '../../data/DataManager'; -import type { ConnectSettings } from '../../data/ConnectSettings'; -import type { CoreMessage, UiPromiseResponse } from '../../types'; -import type { Identity, SignedIdentity } from '../../types/trezor'; -import type { RequestLogin$ } from '../../types/response'; +import type { ConnectSettings, CoreMessage, UiPromiseResponse } from '../../types'; +import type { Identity, SignedIdentity } from '../../types/trezor/protobuf'; +import type { Login } from '../../types/misc'; type Params = { - asyncChallenge: boolean, - identity: Identity, - challengeHidden: string, - challengeVisual: string, + asyncChallenge: boolean; + identity: Identity; + challengeHidden: string; + challengeVisual: string; } export default class RequestLogin extends AbstractMethod { @@ -58,7 +57,7 @@ export default class RequestLogin extends AbstractMethod { }; } - async run(): Promise<$PropertyType> { + async run(): Promise { if (this.params.asyncChallenge) { // send request to developer this.postMessage(UiMessage(UI.LOGIN_CHALLENGE_REQUEST)); diff --git a/src/js/core/methods/ResetDevice.js b/src/js/core/methods/ResetDevice.js index 6c64ac444..83b2bab85 100644 --- a/src/js/core/methods/ResetDevice.js +++ b/src/js/core/methods/ResetDevice.js @@ -6,7 +6,7 @@ import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; import { validateParams, getFirmwareRange } from './helpers/paramsValidator'; -import type { ResetDeviceFlags, Success } from '../../types/trezor'; +import type { ResetDeviceFlags, Success } from '../../types/trezor/protobuf'; import type { CoreMessage, UiPromiseResponse } from '../../types'; export default class ResetDevice extends AbstractMethod { @@ -25,29 +25,29 @@ export default class ResetDevice extends AbstractMethod { const payload: Object = message.payload; // validate bundle type validateParams(payload, [ - { name: 'displayRandom', type: 'boolean' }, + { name: 'display_random', type: 'boolean' }, { name: 'strength', type: 'number' }, - { name: 'passphraseProtection', type: 'boolean' }, - { name: 'pinProtection', type: 'boolean' }, + { name: 'passphrase_protection', type: 'boolean' }, + { name: 'pin_protection', type: 'boolean' }, { name: 'language', type: 'string' }, { name: 'label', type: 'string' }, - { name: 'u2fCounter', type: 'number' }, - { name: 'skipBackup', type: 'boolean' }, - { name: 'noBackup', type: 'boolean' }, - { name: 'backupType', type: 'number' }, + { name: 'u2f_counter', type: 'number' }, + { name: 'skip_backup', type: 'boolean' }, + { name: 'no_backup', type: 'boolean' }, + { name: 'backup_type', type: 'number' }, ]); this.params = { - display_random: payload.displayRandom, + display_random: payload.display_random, strength: payload.strength || 256, - passphrase_protection: payload.passphraseProtection, - pin_protection: payload.pinProtection, + passphrase_protection: payload.passphrase_protection, + pin_protection: payload.pin_protection, language: payload.language, label: payload.label, - u2f_counter: payload.u2fCounter || Math.floor(Date.now() / 1000), - skip_backup: payload.skipBackup, - no_backup: payload.noBackup, - backup_type: payload.backupType, + u2f_counter: payload.u2f_counter || Math.floor(Date.now() / 1000), + skip_backup: payload.skip_backup, + no_backup: payload.no_backup, + backup_type: payload.backup_type, }; } diff --git a/src/js/core/methods/RippleGetAddress.js b/src/js/core/methods/RippleGetAddress.js index e7adc3d79..7d1e5fb48 100644 --- a/src/js/core/methods/RippleGetAddress.js +++ b/src/js/core/methods/RippleGetAddress.js @@ -8,13 +8,13 @@ import { validatePath, fromHardened, getSerializedPath } from '../../utils/pathU import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; -import type { RippleAddress } from '../../types/ripple'; +import type { RippleAddress } from '../../types/networks/ripple'; import type { CoreMessage, UiPromiseResponse } from '../../types'; type Batch = { - path: Array, - address: ?string, - showOnTrezor: boolean, + path: Array; + address: ?string; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/RippleSignTransaction.js b/src/js/core/methods/RippleSignTransaction.js index 756511cc7..583a01a02 100644 --- a/src/js/core/methods/RippleSignTransaction.js +++ b/src/js/core/methods/RippleSignTransaction.js @@ -5,13 +5,13 @@ import { validateParams, getFirmwareRange } from './helpers/paramsValidator'; import { getMiscNetwork } from '../../data/CoinInfo'; import { validatePath } from '../../utils/pathUtils'; -import type { RippleSignedTx } from '../../types/trezor'; -import type { Transaction as $RippleTransaction, RippleSignedTx as RippleSignedTxResponse } from '../../types/ripple'; +import type { RippleSignedTx } from '../../types/trezor/protobuf'; +import type { RippleTransaction, RippleSignedTx as RippleSignedTxResponse } from '../../types/networks/ripple'; import type { CoreMessage } from '../../types'; type Params = { - path: Array, - transaction: $RippleTransaction, + path: Array; + transaction: RippleTransaction; } export default class RippleSignTransaction extends AbstractMethod { @@ -32,7 +32,7 @@ export default class RippleSignTransaction extends AbstractMethod { const path = validatePath(payload.path, 5); // incoming data should be in ripple-sdk format - const transaction: $RippleTransaction = payload.transaction; + const transaction: RippleTransaction = payload.transaction; validateParams(transaction, [ { name: 'fee', type: 'string' }, @@ -55,7 +55,7 @@ export default class RippleSignTransaction extends AbstractMethod { } async run(): Promise { - const tx: $RippleTransaction = this.params.transaction; + const tx = this.params.transaction; const response: RippleSignedTx = await this.device.getCommands().rippleSignTx({ address_n: this.params.path, fee: parseInt(tx.fee), diff --git a/src/js/core/methods/SignMessage.js b/src/js/core/methods/SignMessage.js index a72955f85..654381e4b 100644 --- a/src/js/core/methods/SignMessage.js +++ b/src/js/core/methods/SignMessage.js @@ -4,13 +4,13 @@ import AbstractMethod from './AbstractMethod'; import { validateParams, validateCoinPath, getFirmwareRange } from './helpers/paramsValidator'; import { validatePath, getLabel } from '../../utils/pathUtils'; import { getBitcoinNetwork } from '../../data/CoinInfo'; -import type { MessageSignature } from '../../types/trezor'; +import type { MessageSignature } from '../../types/trezor/protobuf'; import type { CoreMessage, BitcoinNetworkInfo } from '../../types'; type Params = { - path: Array, - message: string, - coinInfo: ?BitcoinNetworkInfo, + path: Array; + message: string; + coinInfo: ?BitcoinNetworkInfo; } export default class SignMessage extends AbstractMethod { @@ -63,9 +63,7 @@ export default class SignMessage extends AbstractMethod { // convert signature to base64 const signatureBuffer = Buffer.from(response.signature, 'hex'); - return { - ...response, - signature: signatureBuffer.toString('base64'), - }; + response.signature = signatureBuffer.toString('base64'); + return response; } } diff --git a/src/js/core/methods/SignTransaction.js b/src/js/core/methods/SignTransaction.js index 69e0029e9..a15842e3e 100644 --- a/src/js/core/methods/SignTransaction.js +++ b/src/js/core/methods/SignTransaction.js @@ -25,7 +25,7 @@ import type { TransactionOptions, RefTransaction, SignedTx, -} from '../../types/trezor'; +} from '../../types/trezor/protobuf'; import type { BuildTxInput, @@ -34,12 +34,12 @@ import type { import type { CoreMessage, BitcoinNetworkInfo } from '../../types'; type Params = { - inputs: Array, - outputs: Array, - refTxs: ?Array, - options: TransactionOptions, - coinInfo: BitcoinNetworkInfo, - push: boolean, + inputs: Array; + outputs: Array; + refTxs: ?Array; + options: TransactionOptions; + coinInfo: BitcoinNetworkInfo; + push: boolean; } export default class SignTransaction extends AbstractMethod { diff --git a/src/js/core/methods/StellarGetAddress.js b/src/js/core/methods/StellarGetAddress.js index feef67aef..4cbce3449 100644 --- a/src/js/core/methods/StellarGetAddress.js +++ b/src/js/core/methods/StellarGetAddress.js @@ -8,13 +8,13 @@ import { validatePath, fromHardened, getSerializedPath } from '../../utils/pathU import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; -import type { StellarAddress } from '../../types/stellar'; +import type { StellarAddress } from '../../types/networks/stellar'; import type { CoreMessage, UiPromiseResponse } from '../../types'; type Batch = { - path: Array, - address: ?string, - showOnTrezor: boolean, + path: Array; + address: ?string; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/StellarSignTransaction.js b/src/js/core/methods/StellarSignTransaction.js index d5b15d6b2..f343d7b9f 100644 --- a/src/js/core/methods/StellarSignTransaction.js +++ b/src/js/core/methods/StellarSignTransaction.js @@ -6,14 +6,14 @@ import { getMiscNetwork } from '../../data/CoinInfo'; import { validatePath } from '../../utils/pathUtils'; import * as helper from './helpers/stellarSignTx'; -import type { StellarSignedTx } from '../../types/trezor'; -import type { Transaction as $StellarTransaction, StellarSignedTx as StellarSignedTxResponse } from '../../types/stellar'; +import type { StellarSignedTx } from '../../types/trezor/protobuf'; +import type { StellarTransaction, StellarSignedTx as StellarSignedTxResponse } from '../../types/networks/stellar'; import type { CoreMessage } from '../../types'; type Params = { - path: Array, - networkPassphrase: string, - transaction: any, + path: Array; + networkPassphrase: string; + transaction: any; } export default class StellarSignTransaction extends AbstractMethod { @@ -35,7 +35,7 @@ export default class StellarSignTransaction extends AbstractMethod { const path = validatePath(payload.path, 3); // incoming data should be in stellar-sdk format - const transaction: $StellarTransaction = payload.transaction; + const transaction: StellarTransaction = payload.transaction; this.params = { path, networkPassphrase: payload.networkPassphrase, diff --git a/src/js/core/methods/TezosGetAddress.js b/src/js/core/methods/TezosGetAddress.js index f5f889bc2..0a8b3be42 100644 --- a/src/js/core/methods/TezosGetAddress.js +++ b/src/js/core/methods/TezosGetAddress.js @@ -8,13 +8,13 @@ import { validatePath, fromHardened, getSerializedPath } from '../../utils/pathU import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; -import type { TezosAddress } from '../../types/tezos'; +import type { TezosAddress } from '../../types/networks/tezos'; import type { CoreMessage, UiPromiseResponse } from '../../types'; type Batch = { - path: Array, - address: ?string, - showOnTrezor: boolean, + path: Array; + address: ?string; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/TezosGetPublicKey.js b/src/js/core/methods/TezosGetPublicKey.js index 4b0b32048..863a6648e 100644 --- a/src/js/core/methods/TezosGetPublicKey.js +++ b/src/js/core/methods/TezosGetPublicKey.js @@ -8,13 +8,13 @@ import { validatePath, fromHardened, getSerializedPath } from '../../utils/pathU import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; -import type { TezosPublicKey } from '../../types/trezor'; -import type { TezosPublicKey as TezosPublicKeyResponse } from '../../types/tezos'; +import type { TezosPublicKey } from '../../types/trezor/protobuf'; +import type { TezosPublicKey as TezosPublicKeyResponse } from '../../types/networks/tezos'; import type { CoreMessage, UiPromiseResponse } from '../../types'; type Batch = { - path: Array, - showOnTrezor: boolean, + path: Array; + showOnTrezor: boolean; } type Params = Array; diff --git a/src/js/core/methods/TezosSignTransaction.js b/src/js/core/methods/TezosSignTransaction.js index 55c584776..ec3f848b5 100644 --- a/src/js/core/methods/TezosSignTransaction.js +++ b/src/js/core/methods/TezosSignTransaction.js @@ -6,12 +6,12 @@ import { getMiscNetwork } from '../../data/CoinInfo'; import { validatePath } from '../../utils/pathUtils'; import * as helper from './helpers/tezosSignTx'; -import type { TezosOperation } from '../../types/tezos'; -import type { TezosTransaction, TezosSignedTx } from '../../types/trezor'; +import type { TezosOperation } from '../../types/networks/tezos'; +import type { TezosTransaction, TezosSignedTx } from '../../types/trezor/protobuf'; import type { CoreMessage } from '../../types'; type Params = { - transaction: TezosTransaction, + transaction: TezosTransaction; } export default class TezosSignTransaction extends AbstractMethod { diff --git a/src/js/core/methods/VerifyMessage.js b/src/js/core/methods/VerifyMessage.js index ef7322004..53519f4a5 100644 --- a/src/js/core/methods/VerifyMessage.js +++ b/src/js/core/methods/VerifyMessage.js @@ -6,14 +6,14 @@ import { getBitcoinNetwork } from '../../data/CoinInfo'; import { getLabel } from '../../utils/pathUtils'; import { NO_COIN_INFO } from '../../constants/errors'; -import type { Success } from '../../types/trezor'; +import type { Success } from '../../types/trezor/protobuf'; import type { CoreMessage, BitcoinNetworkInfo } from '../../types'; type Params = { - address: string, - signature: string, - message: string, - coinInfo: BitcoinNetworkInfo, + address: string; + signature: string; + message: string; + coinInfo: BitcoinNetworkInfo; } export default class VerifyMessage extends AbstractMethod { diff --git a/src/js/core/methods/WipeDevice.js b/src/js/core/methods/WipeDevice.js index 7301e3568..f17e98e1e 100644 --- a/src/js/core/methods/WipeDevice.js +++ b/src/js/core/methods/WipeDevice.js @@ -5,7 +5,7 @@ import AbstractMethod from './AbstractMethod'; import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; import { getFirmwareRange } from './helpers/paramsValidator'; -import type { Success } from '../../types/trezor'; +import type { Success } from '../../types/trezor/protobuf'; import type { CoreMessage, UiPromiseResponse } from '../../types'; export default class WipeDevice extends AbstractMethod { diff --git a/src/js/core/methods/blockchain/BlockchainDisconnect.js b/src/js/core/methods/blockchain/BlockchainDisconnect.js index f143e7e22..877b60fa3 100644 --- a/src/js/core/methods/blockchain/BlockchainDisconnect.js +++ b/src/js/core/methods/blockchain/BlockchainDisconnect.js @@ -9,7 +9,7 @@ import { getCoinInfo } from '../../../data/CoinInfo'; import type { CoreMessage, CoinInfo } from '../../../types'; type Params = { - coinInfo: CoinInfo, + coinInfo: CoinInfo; } export default class BlockchainDisconnect extends AbstractMethod { diff --git a/src/js/core/methods/blockchain/BlockchainEstimateFee.js b/src/js/core/methods/blockchain/BlockchainEstimateFee.js index d71bcd97e..63109d01f 100644 --- a/src/js/core/methods/blockchain/BlockchainEstimateFee.js +++ b/src/js/core/methods/blockchain/BlockchainEstimateFee.js @@ -6,16 +6,18 @@ import { NO_COIN_INFO, backendNotSupported } from '../../../constants/errors'; import Fees from '../tx/Fees'; import { initBlockchain } from '../../../backend/BlockchainLink'; import { getCoinInfo } from '../../../data/CoinInfo'; -import type { CoreMessage, CoinInfo } from '../../../types'; -import type { $BlockchainEstimateFee } from '../../../types/params'; -import type { BlockchainEstimateFee$ } from '../../../types/response'; +import type { + CoreMessage, + CoinInfo, + BlockchainEstimateFee as BlockchainEstimateFeeParams, + BlockchainEstimatedFee, +} from '../../../types'; -type Request = $ElementType<$BlockchainEstimateFee, 'request'>; -type Response = $ElementType +type Request = $ElementType; type Params = { - coinInfo: CoinInfo, - request: Request, + coinInfo: CoinInfo; + request: Request; }; export default class BlockchainEstimateFee extends AbstractMethod { @@ -26,7 +28,7 @@ export default class BlockchainEstimateFee extends AbstractMethod { this.useDevice = false; this.useUi = false; - const payload: $BlockchainEstimateFee = message.payload; + const payload: BlockchainEstimateFeeParams = message.payload; // validate incoming parameters validateParams(payload, [ @@ -67,7 +69,7 @@ export default class BlockchainEstimateFee extends AbstractMethod { }; } - async run(): Promise { + async run(): Promise { const { coinInfo, request } = this.params; const feeInfo = { blockTime: coinInfo.blocktime, diff --git a/src/js/core/methods/blockchain/BlockchainGetTransactions.js b/src/js/core/methods/blockchain/BlockchainGetTransactions.js index 76f52e39c..7abc2f682 100644 --- a/src/js/core/methods/blockchain/BlockchainGetTransactions.js +++ b/src/js/core/methods/blockchain/BlockchainGetTransactions.js @@ -9,8 +9,8 @@ import { getCoinInfo } from '../../../data/CoinInfo'; import type { CoreMessage, CoinInfo } from '../../../types'; type Params = { - txs: string[], - coinInfo: CoinInfo, + txs: string[]; + coinInfo: CoinInfo; } export default class BlockchainGetTransactions extends AbstractMethod { diff --git a/src/js/core/methods/blockchain/BlockchainSubscribe.js b/src/js/core/methods/blockchain/BlockchainSubscribe.js index 7dfb3f6d6..f97531c57 100644 --- a/src/js/core/methods/blockchain/BlockchainSubscribe.js +++ b/src/js/core/methods/blockchain/BlockchainSubscribe.js @@ -6,12 +6,11 @@ import { NO_COIN_INFO, backendNotSupported } from '../../../constants/errors'; import { initBlockchain } from '../../../backend/BlockchainLink'; import { getCoinInfo } from '../../../data/CoinInfo'; -import type { CoreMessage, CoinInfo } from '../../../types'; -import type { SubscriptionAccountInfo } from '../../../types/params'; +import type { CoreMessage, CoinInfo, BlockchainSubscribeAccount } from '../../../types'; type Params = { - accounts: SubscriptionAccountInfo[], - coinInfo: CoinInfo, + accounts: BlockchainSubscribeAccount[]; + coinInfo: CoinInfo; } export default class BlockchainSubscribe extends AbstractMethod { diff --git a/src/js/core/methods/blockchain/BlockchainUnsubscribe.js b/src/js/core/methods/blockchain/BlockchainUnsubscribe.js index 6e23af9dd..7c2918eb4 100644 --- a/src/js/core/methods/blockchain/BlockchainUnsubscribe.js +++ b/src/js/core/methods/blockchain/BlockchainUnsubscribe.js @@ -6,12 +6,11 @@ import { NO_COIN_INFO, backendNotSupported } from '../../../constants/errors'; import { initBlockchain } from '../../../backend/BlockchainLink'; import { getCoinInfo } from '../../../data/CoinInfo'; -import type { CoreMessage, CoinInfo } from '../../../types'; -import type { SubscriptionAccountInfo } from '../../../types/params'; +import type { CoreMessage, CoinInfo, BlockchainSubscribeAccount } from '../../../types'; type Params = { - accounts?: SubscriptionAccountInfo[], - coinInfo: CoinInfo, + accounts?: BlockchainSubscribeAccount[]; + coinInfo: CoinInfo; } export default class BlockchainUnsubscribe extends AbstractMethod { diff --git a/src/js/core/methods/debuglink/DebugLinkDecision.js b/src/js/core/methods/debuglink/DebugLinkDecision.js index e5f06e123..e1df3af11 100644 --- a/src/js/core/methods/debuglink/DebugLinkDecision.js +++ b/src/js/core/methods/debuglink/DebugLinkDecision.js @@ -3,7 +3,7 @@ import AbstractMethod from '../AbstractMethod'; import { validateParams } from '../helpers/paramsValidator'; import type { CoreMessage } from '../../../types'; -import type { DebugLinkDecision as $DebugLinkDecision } from '../../../types/trezor'; +import type { DebugLinkDecision as $DebugLinkDecision } from '../../../types/trezor/protobuf'; export default class DebugLinkDecision extends AbstractMethod { params: $DebugLinkDecision; diff --git a/src/js/core/methods/debuglink/DebugLinkGetState.js b/src/js/core/methods/debuglink/DebugLinkGetState.js index ae540db89..b9718b747 100644 --- a/src/js/core/methods/debuglink/DebugLinkGetState.js +++ b/src/js/core/methods/debuglink/DebugLinkGetState.js @@ -2,7 +2,7 @@ import AbstractMethod from '../AbstractMethod'; import type { CoreMessage } from '../../../types'; -import type { DebugLinkState } from '../../../types/trezor'; +import type { DebugLinkState } from '../../../types/trezor/protobuf'; export default class DebugLinkGetState extends AbstractMethod { constructor(message: CoreMessage) { diff --git a/src/js/core/methods/helpers/Discovery.js b/src/js/core/methods/helpers/Discovery.js index 39a5f4ded..41e5588a4 100644 --- a/src/js/core/methods/helpers/Discovery.js +++ b/src/js/core/methods/helpers/Discovery.js @@ -6,17 +6,17 @@ import { getAccountAddressN } from '../../../utils/accountUtils'; import { formatAmount } from '../../../utils/formatUtils'; import type { CoinInfo } from '../../../types'; -import type { DiscoveryAccountType, DiscoveryAccount, AccountInfoRequest } from '../../../types/account'; +import type { DiscoveryAccountType, DiscoveryAccount, GetAccountInfo } from '../../../types/account'; type DiscoveryType = { - type: DiscoveryAccountType, - getPath: (index: number) => number[], + type: DiscoveryAccountType; + getPath: (index: number) => number[]; } type DiscoveryOptions = { - blockchain: Blockchain, - commands: DeviceCommands, - limit?: number, + blockchain: Blockchain; + commands: DeviceCommands; + limit?: number; } export default class Discovery extends EventEmitter { @@ -78,7 +78,7 @@ export default class Discovery extends EventEmitter { } } - async start(details?: $ElementType): Promise { + async start(details?: $ElementType): Promise { const limit = 10; // TODO: move to options this.interrupted = false; while (!this.completed && !this.interrupted) { diff --git a/src/js/core/methods/helpers/binanceSignTx.js b/src/js/core/methods/helpers/binanceSignTx.js index 53c8fa37e..9fc27a249 100644 --- a/src/js/core/methods/helpers/binanceSignTx.js +++ b/src/js/core/methods/helpers/binanceSignTx.js @@ -6,16 +6,16 @@ import type { MessageResponse, DefaultMessageResponse } from '../../../device/De import type { BinanceTxRequest, BinanceSignedTx, -} from '../../../types/trezor'; +} from '../../../types/trezor/protobuf'; import type { - BinanceTransaction, - PreparedMessage, - PreparedBinanceTransaction, -} from '../../../types/binance'; + BinanceSDKTransaction, + BinancePreparedMessage, + BinancePreparedTransaction, +} from '../../../types/networks/binance'; const processTxRequest = async (typedCall: (type: string, resType: string, msg: Object) => Promise, response: MessageResponse, - messages: PreparedMessage[], + messages: BinancePreparedMessage[], index: number, ): Promise => { const msg = messages[index]; @@ -44,7 +44,7 @@ const processTxRequest = async (typedCall: (type: string, resType: string, msg: }; // validate and translate params to protobuf -export const validate = (tx: BinanceTransaction): PreparedBinanceTransaction => { +export const validate = (tx: BinanceSDKTransaction): BinancePreparedTransaction => { validateParams(tx, [ { name: 'chain_id', type: 'string', obligatory: true }, { name: 'account_number', type: 'number' }, @@ -54,7 +54,7 @@ export const validate = (tx: BinanceTransaction): PreparedBinanceTransaction => { name: 'message', type: 'object' }, ]); - const preparedTx: PreparedBinanceTransaction = { + const preparedTx: BinancePreparedTransaction = { chain_id: tx.chain_id, account_number: tx.account_number || 0, memo: tx.memo, @@ -112,7 +112,7 @@ export const validate = (tx: BinanceTransaction): PreparedBinanceTransaction => export const signTx = async (typedCall: (type: string, resType: string, msg: Object) => Promise, address_n: number[], - tx: PreparedBinanceTransaction, + tx: BinancePreparedTransaction, ): Promise => { const { account_number, diff --git a/src/js/core/methods/helpers/cardanoSignTx.js b/src/js/core/methods/helpers/cardanoSignTx.js index 0b84768d6..35e5874cb 100644 --- a/src/js/core/methods/helpers/cardanoSignTx.js +++ b/src/js/core/methods/helpers/cardanoSignTx.js @@ -6,7 +6,7 @@ import type { CardanoSignedTx, CardanoTxInput, CardanoTxOutput, -} from '../../../types/trezor'; +} from '../../../types/trezor/protobuf'; const processTxRequest = async (typedCall: (type: string, resType: string, msg: Object) => Promise, request: CardanoTxRequest, diff --git a/src/js/core/methods/helpers/eosSignTx.js b/src/js/core/methods/helpers/eosSignTx.js index 4e9c12eca..a8a67cfaa 100644 --- a/src/js/core/methods/helpers/eosSignTx.js +++ b/src/js/core/methods/helpers/eosSignTx.js @@ -3,10 +3,10 @@ import * as bs58 from 'bs58'; import type { MessageResponse, DefaultMessageResponse } from '../../../device/DeviceCommands'; import type { - Transaction as $EosTransaction, + EosSDKTransaction, EosTxAction as $EosTxAction, EosAuthorization as $EosAuthorization, -} from '../../../types/eos'; +} from '../../../types/networks/eos'; import type { EosAsset, @@ -17,7 +17,9 @@ import type { EosTxHeader, EosActionCommon, EosAuthorization, -} from '../../../types/trezor'; +} from '../../../types/trezor/protobuf'; + +type Action = $EosTxAction; // | $EosActionCommon & { name: string; data: string }; // copied from: https://github.com/EOSIO/eosjs/blob/master/src/eosjs-numeric.ts const binaryToDecimal = (bignum: Uint8Array | Array, minDigits = 1) => { @@ -164,7 +166,7 @@ const parseDate = (d: string): number => { return Date.parse(d) / 1000; }; -const parseAck = (action: $EosTxAction): EosTxActionAck | null => { +const parseAck = (action: Action): EosTxActionAck | null => { switch (action.name) { case 'transfer': return { @@ -278,7 +280,7 @@ const parseAck = (action: $EosTxAction): EosTxActionAck | null => { } }; -const parseUnknown = (action: $EosTxAction): EosTxActionAck | null => { +const parseUnknown = (action: Action): EosTxActionAck | null => { if (typeof action.data !== 'string') return null; return { unknown: { @@ -288,7 +290,7 @@ const parseUnknown = (action: $EosTxAction): EosTxActionAck | null => { }; }; -const parseCommon = (action: $EosTxAction): EosActionCommon => { +const parseCommon = (action: Action): EosActionCommon => { return { account: serialize(action.account), name: serialize(action.name), @@ -299,7 +301,7 @@ const parseCommon = (action: $EosTxAction): EosActionCommon => { }; }; -const parseAction = (action: $EosTxAction): EosTxActionAck => { +const parseAction = (action: any): EosTxActionAck => { const ack = parseAck(action) || parseUnknown(action); return { common: parseCommon(action), @@ -307,7 +309,7 @@ const parseAction = (action: $EosTxAction): EosTxActionAck => { }; }; -export const validate = (address_n: Array, tx: $EosTransaction) => { +export const validate = (address_n: Array, tx: EosSDKTransaction) => { const header: ?EosTxHeader = tx.header ? { expiration: typeof tx.header.expiration === 'number' ? tx.header.expiration : parseDate(tx.header.expiration), ref_block_num: tx.header.refBlockNum, diff --git a/src/js/core/methods/helpers/ethereumSignTx.js b/src/js/core/methods/helpers/ethereumSignTx.js index 3a80d2760..56891cadd 100644 --- a/src/js/core/methods/helpers/ethereumSignTx.js +++ b/src/js/core/methods/helpers/ethereumSignTx.js @@ -1,6 +1,6 @@ /* @flow */ -import type { EthereumTxRequest, EthereumSignedTx } from '../../../types/trezor'; +import type { EthereumTxRequest, EthereumSignedTx } from '../../../types/trezor/protobuf'; import type { DefaultMessageResponse } from '../../../device/DeviceCommands'; const splitString = (str: ?string, len: number): [string, string] => { diff --git a/src/js/core/methods/helpers/liskSignTx.js b/src/js/core/methods/helpers/liskSignTx.js index 967fc16ba..6ffa21cd4 100644 --- a/src/js/core/methods/helpers/liskSignTx.js +++ b/src/js/core/methods/helpers/liskSignTx.js @@ -1,6 +1,6 @@ /* @flow */ -import type { Transaction as RawTransaction } from '../../../types/lisk'; +import type { LiskTransaction } from '../../../types/networks/lisk'; const FIELDS_TO_RENAME = ['lifetime', 'keysgroup']; @@ -17,7 +17,7 @@ const prepareField = (name: string, value: number | string, obj: any) => { obj[newName] = value; }; -export const prepareTx = (tx: RawTransaction, newTx: any = {}) => { +export const prepareTx = (tx: LiskTransaction, newTx: any = {}) => { for (const field in tx) { const value = tx[field]; if (typeof value === 'object' && !Array.isArray(value)) { diff --git a/src/js/core/methods/helpers/nemSignTx.js b/src/js/core/methods/helpers/nemSignTx.js index 1a3be3b72..b3dc6d0f6 100644 --- a/src/js/core/methods/helpers/nemSignTx.js +++ b/src/js/core/methods/helpers/nemSignTx.js @@ -4,7 +4,6 @@ import type { NEMSignTxMessage, NEMTransactionCommon, NEMTransfer, - NEMMosaic, NEMImportanceTransfer, NEMAggregateModification, NEMCosignatoryModification, @@ -12,16 +11,13 @@ import type { NEMMosaicCreation, NEMMosaicDefinition, NEMMosaicSupplyChange, -} from '../../../types/trezor'; +} from '../../../types/trezor/protobuf'; -import type { - Transaction as $NEMTransaction, - Mosaic as $NEMMosaic, -} from '../../../types/nem'; +import * as $T from '../../../types/networks/nem'; -export const NEM_MAINNET: number = 0x68; -export const NEM_TESTNET: number = 0x98; -export const NEM_MIJIN: number = 0x60; +export const NEM_MAINNET = 0x68; +export const NEM_TESTNET = 0x98; +export const NEM_MIJIN = 0x60; export const NETWORKS = { 'mainnet': NEM_MAINNET, @@ -39,18 +35,6 @@ export const NEM_PROVISION_NAMESPACE: 0x2001 = 0x2001; export const NEM_MOSAIC_CREATION: 0x4001 = 0x4001; export const NEM_SUPPLY_CHANGE: 0x4002 = 0x4002; -export const TX_TYPES = { - 'transfer': NEM_TRANSFER, - 'cosigning': NEM_COSIGNING, - 'importanceTransfer': NEM_IMPORTANCE_TRANSFER, - 'aggregateModification': NEM_AGGREGATE_MODIFICATION, - 'multisigSignature': NEM_MULTISIG_SIGNATURE, - 'multisig': NEM_MULTISIG, - 'provisionNamespace': NEM_PROVISION_NAMESPACE, - 'mosaicCreation': NEM_MOSAIC_CREATION, - 'supplyChange': NEM_SUPPLY_CHANGE, -}; - const NEM_MOSAIC_LEVY_TYPES = { '1': 'MosaicLevy_Absolute', '2': 'MosaicLevy_Percentile', @@ -71,7 +55,7 @@ const NEM_IMPORTANCE_TRANSFER_MODES = { '2': 'ImportanceTransfer_Deactivate', }; -const getCommon = (tx: $NEMTransaction, address_n?: Array): NEMTransactionCommon => { +const getCommon = (tx: $T.NEMTransaction, address_n?: number[]): NEMTransactionCommon => { return { address_n, network: (tx.version >> 24) & 0xFF, @@ -82,8 +66,8 @@ const getCommon = (tx: $NEMTransaction, address_n?: Array): NEMTransacti }; }; -const transferMessage = (tx: $NEMTransaction): NEMTransfer => { - const mosaics: ?Array = tx.mosaics ? tx.mosaics.map((mosaic: $NEMMosaic) => ({ +const transferMessage = (tx: $T.NEMTransferTransaction): NEMTransfer => { + const mosaics = tx.mosaics ? tx.mosaics.map((mosaic: $T.NEMMosaic) => ({ namespace: mosaic.mosaicId.namespaceId, mosaic: mosaic.mosaicId.name, quantity: mosaic.quantity, @@ -92,18 +76,18 @@ const transferMessage = (tx: $NEMTransaction): NEMTransfer => { return { recipient: tx.recipient, amount: tx.amount, - payload: tx.message.payload || undefined, - public_key: tx.message.type === 0x02 ? tx.message.publicKey : undefined, + payload: tx.message ? tx.message.payload : undefined, + public_key: tx.message && tx.message.type === 0x02 ? tx.message.publicKey : undefined, mosaics, }; }; -const importanceTransferMessage = (tx: $NEMTransaction): NEMImportanceTransfer => ({ +const importanceTransferMessage = (tx: $T.NEMImportanceTransaction): NEMImportanceTransfer => ({ mode: NEM_IMPORTANCE_TRANSFER_MODES[tx.importanceTransfer.mode], public_key: tx.importanceTransfer.publicKey, }); -const aggregateModificationMessage = (tx: $NEMTransaction): NEMAggregateModification => { +const aggregateModificationMessage = (tx: $T.NEMAggregateModificationTransaction): NEMAggregateModification => { const modifications: ?Array = tx.modifications ? tx.modifications.map(modification => ({ type: NEM_AGGREGATE_MODIFICATION_TYPES[modification.modificationType], public_key: modification.cosignatoryAccount, @@ -115,24 +99,24 @@ const aggregateModificationMessage = (tx: $NEMTransaction): NEMAggregateModifica }; }; -const provisionNamespaceMessage = (tx: $NEMTransaction): NEMProvisionNamespace => ({ +const provisionNamespaceMessage = (tx: $T.NEMProvisionNamespaceTransaction): NEMProvisionNamespace => ({ namespace: tx.newPart, parent: tx.parent || undefined, sink: tx.rentalFeeSink, fee: tx.rentalFee, }); -const mosaicCreationMessage = (tx: $NEMTransaction): NEMMosaicCreation => { - const levy = (tx.mosaicDefinition.levy && tx.mosaicDefinition.levy.type) ? tx.mosaicDefinition.levy : undefined; +const mosaicCreationMessage = (tx: $T.NEMMosaicCreationTransaction): NEMMosaicCreation => { + const { levy } = tx.mosaicDefinition; const definition: NEMMosaicDefinition = { namespace: tx.mosaicDefinition.id.namespaceId, mosaic: tx.mosaicDefinition.id.name, - levy: levy && NEM_MOSAIC_LEVY_TYPES[levy.type], + levy: levy && levy.type ? NEM_MOSAIC_LEVY_TYPES[levy.type] : undefined, fee: levy && levy.fee, levy_address: levy && levy.recipient, - levy_namespace: levy && levy.mosaicId.namespaceId, - levy_mosaic: levy && levy.mosaicId.name, + levy_namespace: levy && levy.mosaicId && levy.mosaicId.namespaceId, + levy_mosaic: levy && levy.mosaicId && levy.mosaicId.name, description: tx.mosaicDefinition.description, }; @@ -167,47 +151,47 @@ const mosaicCreationMessage = (tx: $NEMTransaction): NEMMosaicCreation => { }; }; -const supplyChangeMessage = (tx: $NEMTransaction): NEMMosaicSupplyChange => ({ +const supplyChangeMessage = (tx: $T.NEMSupplyChangeTransaction): NEMMosaicSupplyChange => ({ namespace: tx.mosaicId.namespaceId, mosaic: tx.mosaicId.name, type: NEM_SUPPLY_CHANGE_TYPES[tx.supplyType], delta: tx.delta, }); -export const createTx = (tx: $NEMTransaction, address_n: Array): NEMSignTxMessage => { - let transaction: $NEMTransaction = tx; +export const createTx = (tx: $T.NEMTransaction, address_n: number[]): NEMSignTxMessage => { + let transaction: $T.NEMTransaction = tx; const message: NEMSignTxMessage = { transaction: getCommon(tx, address_n), }; - message.cosigning = (tx.type === 0x1002); - if (message.cosigning || tx.type === 0x1004) { + if (tx.type === NEM_COSIGNING || tx.type === NEM_MULTISIG || tx.type === NEM_MULTISIG_SIGNATURE) { + message.cosigning = (tx.type === NEM_COSIGNING || tx.type === NEM_MULTISIG_SIGNATURE); transaction = tx.otherTrans; message.multisig = getCommon(transaction); } switch (transaction.type) { - case 0x0101: + case NEM_TRANSFER: message.transfer = transferMessage(transaction); break; - case 0x0801: + case NEM_IMPORTANCE_TRANSFER: message.importance_transfer = importanceTransferMessage(transaction); break; - case 0x1001: + case NEM_AGGREGATE_MODIFICATION: message.aggregate_modification = aggregateModificationMessage(transaction); break; - case 0x2001: + case NEM_PROVISION_NAMESPACE: message.provision_namespace = provisionNamespaceMessage(transaction); break; - case 0x4001: + case NEM_MOSAIC_CREATION: message.mosaic_creation = mosaicCreationMessage(transaction); break; - case 0x4002: + case NEM_SUPPLY_CHANGE: message.supply_change = supplyChangeMessage(transaction); break; diff --git a/src/js/core/methods/helpers/paramsValidator.js b/src/js/core/methods/helpers/paramsValidator.js index 47651b8fb..72cc85ba1 100644 --- a/src/js/core/methods/helpers/paramsValidator.js +++ b/src/js/core/methods/helpers/paramsValidator.js @@ -9,10 +9,10 @@ import DataManager from '../../../data/DataManager'; import type { CoinInfo, FirmwareRange } from '../../../types'; type Param = { - name: string, - type?: 'string' | 'number' | 'array' | 'buffer' | 'boolean' | 'amount' | 'object', - obligatory?: boolean, - allowEmpty?: boolean, + name: string; + type?: 'string' | 'number' | 'array' | 'buffer' | 'boolean' | 'amount' | 'object'; + obligatory?: boolean; + allowEmpty?: boolean; } export const validateParams = (values: Object, fields: Array): void => { diff --git a/src/js/core/methods/helpers/signtx.js b/src/js/core/methods/helpers/signtx.js index 3d0b5c5f4..3aa515f11 100644 --- a/src/js/core/methods/helpers/signtx.js +++ b/src/js/core/methods/helpers/signtx.js @@ -11,7 +11,7 @@ import type { SignTxInfoToTrezor, TxRequestSerialized, SignedTx, -} from '../../../types/trezor'; +} from '../../../types/trezor/protobuf'; const requestPrevTxInfo = (reqTx: RefTransaction, requestType: string, diff --git a/src/js/core/methods/helpers/signtxVerify.js b/src/js/core/methods/helpers/signtxVerify.js index 7537d1529..d5c36c3f3 100644 --- a/src/js/core/methods/helpers/signtxVerify.js +++ b/src/js/core/methods/helpers/signtxVerify.js @@ -15,7 +15,7 @@ import type { TransactionInput, TransactionOutput, HDNodeResponse, -} from '../../../types/trezor'; +} from '../../../types/trezor/protobuf'; type GetHDNode = (path: Array, coinInfo: ?BitcoinNetworkInfo, validation?: boolean) => Promise; diff --git a/src/js/core/methods/helpers/stellarSignTx.js b/src/js/core/methods/helpers/stellarSignTx.js index 4fa73e7d5..180a8e314 100644 --- a/src/js/core/methods/helpers/stellarSignTx.js +++ b/src/js/core/methods/helpers/stellarSignTx.js @@ -4,15 +4,15 @@ import { validateParams } from './paramsValidator'; import type { MessageResponse, DefaultMessageResponse } from '../../../device/DeviceCommands'; import type { - Transaction as $StellarTransaction, - Operation as $StellarOperation, -} from '../../../types/stellar'; + StellarTransaction, + StellarOperation, +} from '../../../types/networks/stellar'; import type { StellarSignedTx, StellarSignTxMessage, StellarOperationMessage, -} from '../../../types/trezor'; +} from '../../../types/trezor/protobuf'; const processTxRequest = async (typedCall: (type: string, resType: string, msg: Object) => Promise, operations: Array, @@ -45,7 +45,7 @@ const processTxRequest = async (typedCall: (type: string, resType: string, msg: export const stellarSignTx = async (typedCall: (type: string, resType: string, msg: Object) => Promise, address_n: Array, networkPassphrase: string, - tx: $StellarTransaction, + tx: StellarTransaction, ): Promise => { // eslint-disable-next-line no-use-before-define const message: StellarSignTxMessage = transformSignMessage(tx); @@ -65,7 +65,7 @@ export const stellarSignTx = async (typedCall: (type: string, resType: string, m }; // transform incoming parameters to protobuf messages format -const transformSignMessage = (tx: $StellarTransaction): StellarSignTxMessage => { +const transformSignMessage = (tx: StellarTransaction): StellarSignTxMessage => { // timebounds_start and timebounds_end are the only fields which needs to be converted to number const timebounds: ?$Shape = tx.timebounds ? { timebounds_start: tx.timebounds.minTime, @@ -92,7 +92,7 @@ const transformSignMessage = (tx: $StellarTransaction): StellarSignTxMessage => }; // transform incoming parameters to protobuf messages format -const transformOperation = (op: $StellarOperation): ?StellarOperationMessage => { +const transformOperation = (op: StellarOperation): ?StellarOperationMessage => { switch (op.type) { case 'createAccount' : validateParams(op, [ diff --git a/src/js/core/methods/helpers/tezosSignTx.js b/src/js/core/methods/helpers/tezosSignTx.js index acb6cafda..466ea5d2a 100644 --- a/src/js/core/methods/helpers/tezosSignTx.js +++ b/src/js/core/methods/helpers/tezosSignTx.js @@ -1,8 +1,8 @@ /* @flow */ import * as bs58check from 'bs58check'; -import type { TezosOperation } from '../../../types/tezos'; -import type { TezosTransaction } from '../../../types/trezor'; +import type { TezosOperation } from '../../../types/networks/tezos'; +import type { TezosTransaction } from '../../../types/trezor/protobuf'; import { validateParams } from './../helpers/paramsValidator'; const prefix = { @@ -28,7 +28,7 @@ const concatArray = (first: Uint8Array, second: Uint8Array): Uint8Array => { }; // convert publicKeyHash to buffer -const publicKeyHash2buffer = (publicKeyHash: string): { originated: number, hash: Uint8Array } => { +const publicKeyHash2buffer = (publicKeyHash: string): { originated: number; hash: Uint8Array } => { switch (publicKeyHash.substr(0, 3)) { case 'tz1': return { diff --git a/src/js/core/methods/helpers/uploadFirmware.js b/src/js/core/methods/helpers/uploadFirmware.js index dc27d23d7..c8469a9e2 100644 --- a/src/js/core/methods/helpers/uploadFirmware.js +++ b/src/js/core/methods/helpers/uploadFirmware.js @@ -1,13 +1,13 @@ /* @flow */ import type { DefaultMessageResponse, MessageResponse } from '../../../device/DeviceCommands'; -import type { FirmwareRequest$ } from '../../../types/response'; +import type { FirmwareRequest } from '../../../types/trezor/management'; import { UiMessage } from '../../../message/builder'; import Device from '../../../device/Device'; import * as UI from '../../../constants/ui'; import * as DEVICE from '../../../constants/device'; -import type { FirmwareUpload, Success } from '../../../types/trezor'; // flowtype only +import type { FirmwareUpload, Success } from '../../../types/trezor/protobuf'; // flowtype only import type { CoreMessage } from '../../../types'; // firmware does not send button message but user still must press button to continue @@ -33,7 +33,7 @@ export const uploadFirmware = async ( params: FirmwareUpload, ): Success => { const { payload, length } = params; - let response: MessageResponse = {}; + let response: MessageResponse = {}; if (device.features.major_version === 1) { postConfirmationMessage(device); diff --git a/src/js/core/methods/tx/Fees.js b/src/js/core/methods/tx/Fees.js index bd5b514fa..3f182b5d9 100644 --- a/src/js/core/methods/tx/Fees.js +++ b/src/js/core/methods/tx/Fees.js @@ -2,7 +2,7 @@ import BigNumber from 'bignumber.js'; import BlockchainLink from '../../../backend/BlockchainLink'; import type { CoinInfo } from '../../../types'; -import type { FeeLevel } from '../../../types/fee'; +import type { FeeLevel } from '../../../types/account'; type Blocks = Array; const BLOCKS = { @@ -121,10 +121,10 @@ export default class FeeLevels { // sort fee levels from coinInfo // and transform in to FeeLevel object - this.levels = Object.keys(coinInfo.defaultFees) - .sort((levelA, levelB) => coinInfo.defaultFees[levelB] - coinInfo.defaultFees[levelA]) + const keys = Object.keys(coinInfo.defaultFees); + this.levels = keys.sort((levelA, levelB) => coinInfo.defaultFees[levelB] - coinInfo.defaultFees[levelA]) .map(level => { - const label = level.toLowerCase(); + const label: any = level.toLowerCase(); const blocks = getDefaultBlocks(shortcut, label); // TODO: get this value from trezor-common return { label, diff --git a/src/js/core/methods/tx/TransactionComposer.js b/src/js/core/methods/tx/TransactionComposer.js index 4e34c349a..6343bfa02 100644 --- a/src/js/core/methods/tx/TransactionComposer.js +++ b/src/js/core/methods/tx/TransactionComposer.js @@ -13,14 +13,13 @@ import type { } from 'hd-wallet'; import type { BitcoinNetworkInfo } from '../../../types'; -import type { DiscoveryAccount, AccountUtxo } from '../../../types/account'; -import type { SelectFeeLevel } from '../../../types/fee'; +import type { DiscoveryAccount, AccountUtxo, SelectFeeLevel } from '../../../types/account'; type Options = { - account: DiscoveryAccount, - utxo: AccountUtxo[], - outputs: BuildTxOutputRequest[], - coinInfo: BitcoinNetworkInfo, + account: DiscoveryAccount; + utxo: AccountUtxo[]; + outputs: BuildTxOutputRequest[]; + coinInfo: BitcoinNetworkInfo; } export default class TransactionComposer { diff --git a/src/js/core/methods/tx/inputs.js b/src/js/core/methods/tx/inputs.js index e6f9cf2f8..5790fbfb5 100644 --- a/src/js/core/methods/tx/inputs.js +++ b/src/js/core/methods/tx/inputs.js @@ -11,7 +11,7 @@ import type { BuildTxInput } from 'hd-wallet'; // local types import type { BitcoinNetworkInfo } from '../../../types'; -import type { TransactionInput } from '../../../types/trezor'; +import type { TransactionInput } from '../../../types/trezor/protobuf'; /** ***** * SignTx: validation diff --git a/src/js/core/methods/tx/outputs.js b/src/js/core/methods/tx/outputs.js index f83e5610d..ef61e6ed5 100644 --- a/src/js/core/methods/tx/outputs.js +++ b/src/js/core/methods/tx/outputs.js @@ -14,7 +14,7 @@ import type { BuildTxOutput, BuildTxOutputRequest } from 'hd-wallet'; // local types import type { BitcoinNetworkInfo } from '../../../types'; -import type { TransactionOutput } from '../../../types/trezor'; +import type { TransactionOutput } from '../../../types/trezor/protobuf'; /** ***** * SignTransaction: validation diff --git a/src/js/core/methods/tx/refTx.js b/src/js/core/methods/tx/refTx.js index 8a0169bd9..d347a9c13 100644 --- a/src/js/core/methods/tx/refTx.js +++ b/src/js/core/methods/tx/refTx.js @@ -12,7 +12,7 @@ import type { import type { BuildTxInput } from 'hd-wallet'; // local types -import type { RefTransaction } from '../../../types/trezor'; +import type { RefTransaction } from '../../../types/trezor/protobuf'; // Get array of unique referenced transactions ids export const getReferencedTransactions = (inputs: Array): Array => { diff --git a/src/js/data/ConnectSettings.js b/src/js/data/ConnectSettings.js index eabf29437..cc74c4eed 100644 --- a/src/js/data/ConnectSettings.js +++ b/src/js/data/ConnectSettings.js @@ -1,52 +1,25 @@ /* @flow */ -export type ConnectManifest = { - +email: string, - +appUrl: string, -} - -export type ConnectSettings = { - // debug: boolean | {[k: string]: boolean}; - +configSrc: string, // constant - +version: string, // constant - debug: boolean, - origin: ?string, - hostLabel?: string, - hostIcon?: string, - priority: number, - trustedHost: boolean, - connectSrc: string, - iframeSrc: string, - popup: boolean, - popupSrc: string, - webusbSrc: string, - transportReconnect: boolean, - webusb: boolean, - pendingTransportEvent: boolean, - supportedBrowser?: boolean, - extension: ?string, - manifest: ?ConnectManifest, - env: string, - timestamp: number, - lazyLoad: boolean, -} +import type { + Manifest, + ConnectSettings, +} from '../types'; /* * Initial settings for connect. * It could be changed by passing values into TrezorConnect.init(...) method */ -const VERSION: string = '8.0.13'; -const versionN: Array = VERSION.split('.').map(s => parseInt(s)); -const DIRECTORY: string = `${ versionN[0] }${ (versionN[1] > 0 ? `.${versionN[1]}` : '') }/`; -const DEFAULT_DOMAIN: string = `https://connect.trezor.io/${ DIRECTORY }`; -export const DEFAULT_PRIORITY: number = 2; +const VERSION = '8.0.13'; +const versionN = VERSION.split('.').map(s => parseInt(s)); +const DIRECTORY = `${ versionN[0] }${ (versionN[1] > 0 ? `.${versionN[1]}` : '') }/`; +const DEFAULT_DOMAIN = `https://connect.trezor.io/${ DIRECTORY }`; +export const DEFAULT_PRIORITY = 2; const initialSettings: ConnectSettings = { configSrc: './data/config.json', // constant version: VERSION, // constant debug: false, - origin: null, priority: DEFAULT_PRIORITY, trustedHost: false, connectSrc: DEFAULT_DOMAIN, @@ -58,7 +31,6 @@ const initialSettings: ConnectSettings = { webusb: true, pendingTransportEvent: true, supportedBrowser: typeof navigator !== 'undefined' ? !(/Trident|MSIE|Edge/.test(navigator.userAgent)) : true, - extension: null, manifest: null, env: 'web', lazyLoad: false, @@ -67,20 +39,18 @@ const initialSettings: ConnectSettings = { let currentSettings: ConnectSettings = initialSettings; -const parseManifest = (manifest: Object): ?ConnectManifest => { - if (typeof manifest.email !== 'string') { - return null; - } - if (typeof manifest.appUrl !== 'string') { - return null; - } +const parseManifest = (manifest: ?Manifest): ?Manifest => { + if (!manifest) return; + if (typeof manifest.email !== 'string') return; + if (typeof manifest.appUrl !== 'string') return; + return { email: manifest.email, appUrl: manifest.appUrl, }; }; -export const getEnv = (): string => { +export const getEnv = () => { // $FlowIssue: chrome is not declared outside the project if (typeof chrome !== 'undefined' && chrome.runtime && typeof chrome.runtime.onConnect !== 'undefined') { return 'webextension'; @@ -103,9 +73,7 @@ export const getEnv = (): string => { return 'web'; }; -export const parse = (input: ?Object): ConnectSettings => { - if (!input) return currentSettings; - +export const parse = (input: $Shape = {}) => { const settings: ConnectSettings = { ...currentSettings }; if (Object.prototype.hasOwnProperty.call(input, 'debug')) { if (Array.isArray(input)) { @@ -118,14 +86,14 @@ export const parse = (input: ?Object): ConnectSettings => { } if (typeof input.connectSrc === 'string') { - // TODO: escape string, validate url settings.connectSrc = input.connectSrc; } else if (typeof window !== 'undefined' && typeof window.__TREZOR_CONNECT_SRC === 'string') { settings.connectSrc = window.__TREZOR_CONNECT_SRC; } - settings.iframeSrc = `${ settings.connectSrc }iframe.html`; - settings.popupSrc = `${ settings.connectSrc }popup.html`; - settings.webusbSrc = `${ settings.connectSrc }webusb.html`; + const src = settings.connectSrc || DEFAULT_DOMAIN; + settings.iframeSrc = `${src}iframe.html`; + settings.popupSrc = `${src}popup.html`; + settings.webusbSrc = `${src}webusb.html`; if (typeof input.transportReconnect === 'boolean') { settings.transportReconnect = input.transportReconnect; @@ -157,7 +125,6 @@ export const parse = (input: ?Object): ConnectSettings => { settings.extension = input.extension; } - // $FlowIssue chrome is not declared outside if (typeof input.env === 'string') { settings.env = input.env; } else { diff --git a/src/js/data/DataManager.js b/src/js/data/DataManager.js index fb8a3b867..a3518b3b4 100644 --- a/src/js/data/DataManager.js +++ b/src/js/data/DataManager.js @@ -8,60 +8,60 @@ import { parseBridgeJSON } from './TransportInfo'; import parseUri from 'parse-uri'; import { versionCompare } from '../utils/deviceFeaturesUtils'; -import type { ConnectSettings } from '../data/ConnectSettings'; +import type { ConnectSettings } from '../types'; type WhiteList = { - priority: number, - origin: string, + priority: number; + origin: string; } type KnownHost = { - origin: string, - label?: string, - icon?: string, + origin: string; + label?: string; + icon?: string; } type SupportedBrowser = { - version: number, - download: string, - update: string, + version: number; + download: string; + update: string; } type WebUSB = { - vendorId: string, - productId: string, + vendorId: string; + productId: string; } type Resources = { - bridge: string, + bridge: string; } type Asset = { - name: string, - type?: string, - url: string, + name: string; + type?: string; + url: string; } type ProtobufMessages = { - name: string, + name: string; range: { - min: string[], - max?: string[], - }, - json: string, + min: string[]; + max?: string[]; + }; + json: string; } export type Config = { - whitelist: WhiteList[], - management: WhiteList[], - knownHosts: KnownHost[], - webusb: WebUSB[], - resources: Resources, - assets: Asset[], - messages: ProtobufMessages[], - supportedBrowsers: { [key: string]: SupportedBrowser }, + whitelist: WhiteList[]; + management: WhiteList[]; + knownHosts: KnownHost[]; + webusb: WebUSB[]; + resources: Resources; + assets: Asset[]; + messages: ProtobufMessages[]; + supportedBrowsers: { [key: string]: SupportedBrowser }; supportedFirmware: Array<{| - coinType?: string, - coin?: string | string[], - excludedMethods?: string[], - min?: string[], - max?: string[], - |}>, + coinType?: string; + coin?: string | string[]; + excludedMethods?: string[]; + min?: string[]; + max?: string[]; + |}>; } type AssetCollection = { [key: string]: JSON }; diff --git a/src/js/data/TransportInfo.js b/src/js/data/TransportInfo.js index df771adae..ce87dbbc0 100644 --- a/src/js/data/TransportInfo.js +++ b/src/js/data/TransportInfo.js @@ -1,21 +1,11 @@ /* @flow */ - -export type BridgeInfo = { - version: number[], - directory: string, - packages: { - name: string, - platform: string[], - url: string, - signature?: string, - preferred?: boolean, - }[], -} +import type { BridgeInfo } from '../types'; const info: BridgeInfo = { version: [], directory: '', packages: [], + changelog: '', }; // Parse JSON loaded from config.assets.bridge diff --git a/src/js/device/DescriptorStream.js b/src/js/device/DescriptorStream.js index 9295f7f97..790ae185d 100644 --- a/src/js/device/DescriptorStream.js +++ b/src/js/device/DescriptorStream.js @@ -12,13 +12,13 @@ import { resolveAfter } from '../utils/promiseUtils'; import type { Transport, TrezorDeviceInfoWithSession as DeviceDescriptor } from 'trezor-link'; export type DeviceDescriptorDiff = { - didUpdate: boolean, - connected: Array, - disconnected: Array, - changedSessions: Array, - acquired: Array, - released: Array, - descriptors: Array, + didUpdate: boolean; + connected: Array; + disconnected: Array; + changedSessions: Array; + acquired: Array; + released: Array; + descriptors: Array; }; // custom log diff --git a/src/js/device/Device.js b/src/js/device/Device.js index e78d721ac..e71f1ced0 100644 --- a/src/js/device/Device.js +++ b/src/js/device/Device.js @@ -24,19 +24,19 @@ export type RunOptions = { // skipFinalReload - normally, after action, features are reloaded again // because some actions modify the features // but sometimes, you don't need that and can skip that - skipFinalReload?: boolean, + skipFinalReload?: boolean; // waiting - if waiting and someone else holds the session, it waits until it's free // and if it fails on acquire (because of more tabs acquiring simultaneously), // it tries repeatedly - waiting?: boolean, - onlyOneActivity?: boolean, + waiting?: boolean; + onlyOneActivity?: boolean; // cancel popup request when we are sure that there is no need to authenticate // Method gets called after run() fetch new Features but before trezor-link dispatch "acquire" event - cancelPopupRequest?: Function, + cancelPopupRequest?: Function; - keepSession?: boolean, - useEmptyPassphrase?: boolean, + keepSession?: boolean; + useEmptyPassphrase?: boolean; } const parseRunOptions = (options?: RunOptions): RunOptions => { @@ -338,7 +338,7 @@ export default class Device extends EventEmitter { if (!this.features) return; const expectedState = this.getExternalState(); const state = await this.commands.getDeviceState(); - const uniqueState = `${state}@${this.features.device_id}:${this.instance}`; + const uniqueState = `${state}@${this.features.device_id || 'device_id'}:${this.instance}`; if (!this.useLegacyPassphrase() && this.features.session_id) { this.setInternalState(this.features.session_id); } @@ -471,15 +471,15 @@ export default class Device extends EventEmitter { } isBootloader(): boolean { - return this.features.bootloader_mode; + return this.features && !!this.features.bootloader_mode; } isInitialized(): boolean { - return this.features.initialized; + return this.features && this.features.initialized; } isSeedless(): boolean { - return this.features.no_backup; + return this.features && this.features.no_backup; } isInconsistent(): boolean { diff --git a/src/js/device/DeviceCommands.js b/src/js/device/DeviceCommands.js index ec1e152bf..ac8c24dbd 100644 --- a/src/js/device/DeviceCommands.js +++ b/src/js/device/DeviceCommands.js @@ -15,19 +15,19 @@ import { getSegwitNetwork, getBech32Network } from '../data/CoinInfo'; import type { CoinInfo, BitcoinNetworkInfo, EthereumNetworkInfo } from '../types'; import type { Transport } from 'trezor-link'; -import * as trezor from '../types/trezor'; // flowtype only +import * as trezor from '../types/trezor/protobuf'; // flowtype only export type MessageResponse = { - type: string, - message: T, // in general, can be anything + type: string; + message: T; // in general, can be anything }; export type DefaultMessageResponse = MessageResponse; export type PassphrasePromptResponse = { - passphrase?: string, - passphraseOnDevice?: boolean, - cache?: boolean, + passphrase?: string; + passphraseOnDevice?: boolean; + cache?: boolean; }; function assertType(res: DefaultMessageResponse, resType: string) { @@ -816,7 +816,7 @@ export default class DeviceCommands { return response.message; } - async getAccountDescriptor(coinInfo: CoinInfo, indexOrPath: number | Array): Promise { + async getAccountDescriptor(coinInfo: CoinInfo, indexOrPath: number | Array): Promise { const address_n = Array.isArray(indexOrPath) ? indexOrPath : getAccountAddressN(coinInfo, indexOrPath); if (coinInfo.type === 'bitcoin') { const resp = await this.getHDNode(address_n, coinInfo, false); diff --git a/src/js/device/DeviceList.js b/src/js/device/DeviceList.js index ccf5ecf6e..d8f4c25a3 100644 --- a/src/js/device/DeviceList.js +++ b/src/js/device/DeviceList.js @@ -23,11 +23,11 @@ const _log: Log = initLog('DeviceList'); // TODO: plugins are not typed in 'trezor-link' type LowLevelPlugin = { - name: 'WebUsbPlugin' | 'ReactNativePlugin', + name: 'WebUsbPlugin' | 'ReactNativePlugin'; unreadableHidDeviceChange: { - on: (event: string, fn: any) => void, - }, - unreadableHidDevice: boolean, // not sure + on: (event: string, fn: any) => void; + }; + unreadableHidDevice: boolean; // not sure } export default class DeviceList extends EventEmitter { @@ -46,7 +46,7 @@ export default class DeviceList extends EventEmitter { super(); const { debug, env, webusb } = DataManager.settings; - _log.enabled = debug; + _log.enabled = !!debug; const transports: Transport[] = []; @@ -374,7 +374,7 @@ class DiffHandler { } _emitEvents() { - const events: Array<{d: Array, e: string}> = [ + const events: Array<{d: Array; e: string}> = [ { d: this.diff.changedSessions, e: DEVICE.CHANGED, @@ -387,7 +387,7 @@ class DiffHandler { }, ]; - events.forEach(({d, e}: {d: Array, e: string}) => { + events.forEach(({d, e}: {d: Array; e: string}) => { d.forEach((descriptor: DeviceDescriptor) => { const path: string = descriptor.path.toString(); const device: Device = this.list.devices[path]; diff --git a/src/js/env/browser/browserUtils.js b/src/js/env/browser/browserUtils.js index 3860576a2..c3b1b1051 100644 --- a/src/js/env/browser/browserUtils.js +++ b/src/js/env/browser/browserUtils.js @@ -3,11 +3,11 @@ import Bowser from 'bowser'; import { getBridgeInfo } from '../../data/TransportInfo'; export type BrowserState = { - name: string, - osname: string, - supported: boolean, - outdated: boolean, - mobile: boolean, + name: string; + osname: string; + supported: boolean; + outdated: boolean; + mobile: boolean; } export const state: BrowserState = { @@ -19,9 +19,9 @@ export const state: BrowserState = { }; type SupportedBrowser = { - version: number, - download: string, - update: string, + version: number; + download: string; + update: string; }; export const getBrowserState = (supportedBrowsers: { [key: string]: SupportedBrowser }): BrowserState => { diff --git a/src/js/env/browser/index.js b/src/js/env/browser/index.js index fbe7bb9ac..f67f495da 100644 --- a/src/js/env/browser/index.js +++ b/src/js/env/browser/index.js @@ -10,20 +10,25 @@ import { parseMessage } from '../../message'; import { parse as parseSettings } from '../../data/ConnectSettings'; import Log, { init as initLog } from '../../utils/debug'; -import { UI_EVENT, DEVICE_EVENT, RESPONSE_EVENT, TRANSPORT_EVENT, BLOCKCHAIN_EVENT } from '../../constants'; -import * as POPUP from '../../constants/popup'; -import * as IFRAME from '../../constants/iframe'; -import * as UI from '../../constants/ui'; -import * as ERROR from '../../constants/errors'; -import * as TRANSPORT from '../../constants/transport'; - -import type { ConnectSettings } from '../../data/ConnectSettings'; +import { + UI_EVENT, + DEVICE_EVENT, + RESPONSE_EVENT, + TRANSPORT_EVENT, + BLOCKCHAIN_EVENT, + POPUP, + IFRAME, + UI, + ERRORS, + TRANSPORT, +} from '../../constants'; + import * as $T from '../../types'; export const eventEmitter = new EventEmitter(); const _log: Log = initLog('[trezor-connect.js]'); -let _settings: ConnectSettings; +let _settings: $T.ConnectSettings; let _popupManager: ?PopupManager; const initPopupManager = (): PopupManager => { @@ -120,15 +125,15 @@ const handleMessage = (messageEvent: $T.PostMessageEvent): void => { } }; -export const init = async (settings: Object = {}): Promise => { - if (iframe.instance) { throw ERROR.IFRAME_INITIALIZED; } +export const init = async (settings: $Shape<$T.ConnectSettings> = {}): Promise => { + if (iframe.instance) { throw ERRORS.IFRAME_INITIALIZED; } if (!_settings) { _settings = parseSettings(settings); } if (!_settings.manifest) { - throw ERROR.MANIFEST_NOT_SET; + throw ERRORS.MANIFEST_NOT_SET; } if (_settings.lazyLoad) { @@ -141,7 +146,7 @@ export const init = async (settings: Object = {}): Promise => { _popupManager = initPopupManager(); } - _log.enabled = _settings.debug; + _log.enabled = !!_settings.debug; window.addEventListener('message', handleMessage); window.addEventListener('beforeunload', dispose); @@ -149,13 +154,13 @@ export const init = async (settings: Object = {}): Promise => { await iframe.init(_settings); }; -export const call = async (params: Object): Promise => { +export const call = async (params: any): Promise => { if (!iframe.instance && !iframe.timeout) { // init popup with lazy loading before iframe initialization _settings = parseSettings(_settings); if (!_settings.manifest) { - return { success: false, payload: { error: ERROR.MANIFEST_NOT_SET.message } }; + return { success: false, payload: { error: ERRORS.MANIFEST_NOT_SET.message } }; } if (!_popupManager) { @@ -176,7 +181,7 @@ export const call = async (params: Object): Promise => { if (iframe.timeout) { // this.init was called, but iframe doesn't return handshake yet - return { success: false, payload: { error: ERROR.NO_IFRAME.message } }; + return { success: false, payload: { error: ERRORS.NO_IFRAME.message } }; } else if (iframe.error) { // iframe was initialized with error return { success: false, payload: { error: iframe.error } }; @@ -190,7 +195,7 @@ export const call = async (params: Object): Promise => { const response: ?Object = await iframe.postMessage({ type: IFRAME.CALL, payload: params }); if (response) { // TODO: unlock popupManager request only if there wasn't error "in progress" - if (response.payload.error !== ERROR.DEVICE_CALL_IN_PROGRESS.message && _popupManager) { _popupManager.unlock(); } + if (response.payload.error !== ERRORS.DEVICE_CALL_IN_PROGRESS.message && _popupManager) { _popupManager.unlock(); } return response; } else { if (_popupManager) { @@ -204,7 +209,7 @@ export const call = async (params: Object): Promise => { } }; -const customMessageResponse = (payload: ?{ message: string, params?: Object }): void => { +const customMessageResponse = (payload: ?{ message: string; params?: Object }): void => { iframe.postMessage({ event: UI_EVENT, type: UI.CUSTOM_MESSAGE_RESPONSE, @@ -213,21 +218,22 @@ const customMessageResponse = (payload: ?{ message: string, params?: Object }): }; export const uiResponse = (response: $T.UiResponse): void => { - iframe.postMessage({ event: UI_EVENT, ...response }); + const { type, payload } = response; + iframe.postMessage({ event: UI_EVENT, type, payload }); }; export const renderWebUSBButton = (className: ?string): void => { webUSBButton(className, _settings.webusbSrc, iframe.origin); }; -export const getSettings: $T.GetSettings = async () => { +export const getSettings = async (): $T.Response<$T.ConnectSettings> => { if (!iframe.instance) { return { success: false, payload: { error: 'Iframe not initialized yet, you need to call TrezorConnect.init or any other method first.' } }; } return await call({ method: 'getSettings' }); }; -export const customMessage: $T.CustomMessage = async (params) => { +export const customMessage: $PropertyType<$T.API, 'customMessage'> = async (params) => { if (typeof params.callback !== 'function') { return { success: false, @@ -257,7 +263,7 @@ export const customMessage: $T.CustomMessage = async (params) => { return response; }; -export const requestLogin: $T.RequestLogin = async (params) => { +export const requestLogin: $PropertyType<$T.API, 'requestLogin'> = async (params) => { // $FlowIssue: property callback not found if (typeof params.callback === 'function') { const callback = params.callback; diff --git a/src/js/env/node/index.js b/src/js/env/node/index.js index d61086dd9..6cdfafd5a 100644 --- a/src/js/env/node/index.js +++ b/src/js/env/node/index.js @@ -7,28 +7,32 @@ import Log, { init as initLog } from '../../utils/debug'; import { Core, init as initCore, initTransport } from '../../core/Core'; import { create as createDeferred } from '../../utils/deferred'; -import { CORE_EVENT, UI_EVENT, DEVICE_EVENT, RESPONSE_EVENT, TRANSPORT_EVENT, BLOCKCHAIN_EVENT } from '../../constants'; -import * as POPUP from '../../constants/popup'; -import * as IFRAME from '../../constants/iframe'; -import * as UI from '../../constants/ui'; -import * as ERROR from '../../constants/errors'; +import { + CORE_EVENT, + UI_EVENT, + DEVICE_EVENT, + RESPONSE_EVENT, + TRANSPORT_EVENT, + BLOCKCHAIN_EVENT, + POPUP, + IFRAME, + UI, + ERRORS, +} from '../../constants'; -import type { ConnectSettings } from '../../data/ConnectSettings'; import * as $T from '../../types'; export const eventEmitter = new EventEmitter(); const _log: Log = initLog('[trezor-connect.js]'); -let _settings: ConnectSettings; +let _settings: $T.ConnectSettings; let _core: Core; let _messageID: number = 0; export const messagePromises: { [key: number]: $T.Deferred } = {}; -export const manifest = (data: any) => { - _settings = parseSettings({ - manifest: data, - }); +export const manifest = (manifest: $T.Manifest) => { + _settings = parseSettings({ manifest }); }; export const dispose = () => { @@ -92,7 +96,7 @@ const handleMessage = (message: $T.CoreMessage): void => { } }; -const postMessage = (message: any, usePromise: boolean = true): ?Promise => { +const postMessage = (message: any, usePromise: boolean = true) => { if (!_core) { throw new Error('postMessage: _core not found'); } @@ -105,10 +109,9 @@ const postMessage = (message: any, usePromise: boolean = true): ?Promise = } _core.handleMessage(message, true); - return null; }; -export const init = async (settings: Object = {}): Promise => { +export const init = async (settings: $Shape<$T.ConnectSettings> = {}): Promise => { if (!_settings) { _settings = parseSettings(settings); } @@ -118,7 +121,7 @@ export const init = async (settings: Object = {}): Promise => { _settings.env = 'node'; if (!_settings.manifest) { - throw ERROR.MANIFEST_NOT_SET; + throw ERRORS.MANIFEST_NOT_SET; } if (_settings.lazyLoad) { @@ -127,7 +130,7 @@ export const init = async (settings: Object = {}): Promise => { return; } - _log.enabled = _settings.debug; + _log.enabled = !!_settings.debug; _core = await initCore(_settings); _core.on(CORE_EVENT, handleMessage); @@ -135,7 +138,7 @@ export const init = async (settings: Object = {}): Promise => { await initTransport(_settings); }; -export const call = async (params: Object): Promise => { +export const call = async (params: any): Promise => { if (!_core) { _settings = parseSettings({ debug: false, popup: false }); @@ -148,7 +151,7 @@ export const call = async (params: Object): Promise => { } try { - const response: ?Object = await postMessage({ type: IFRAME.CALL, payload: params }); + const response = await postMessage({ type: IFRAME.CALL, payload: params }); if (response) { return response; } else { @@ -160,7 +163,7 @@ export const call = async (params: Object): Promise => { } }; -const customMessageResponse = (payload: ?{ message: string, params?: Object }): void => { +const customMessageResponse = (payload: ?{ message: string; params?: Object }): void => { _core.handleMessage({ event: UI_EVENT, type: UI.CUSTOM_MESSAGE_RESPONSE, @@ -169,21 +172,22 @@ const customMessageResponse = (payload: ?{ message: string, params?: Object }): }; export const uiResponse = (response: $T.UiResponse): void => { - _core.handleMessage({ event: UI_EVENT, ...response }, true); + const { type, payload } = response; + _core.handleMessage({ event: UI_EVENT, type, payload }, true); }; export const renderWebUSBButton = (className: ?string): void => { // webUSBButton(className, _settings.webusbSrc, iframe.origin); }; -export const getSettings: $T.GetSettings = async () => { +export const getSettings = async (): $T.Response<$T.ConnectSettings> => { if (!_core) { return { success: false, payload: { error: 'Core not initialized yet, you need to call TrezorConnect.init or any other method first.' } }; } - return await call({ method: 'getSettings' }); + return call({ method: 'getSettings' }); }; -export const customMessage: $T.CustomMessage = async (params) => { +export const customMessage: $PropertyType<$T.API, 'customMessage'> = async (params) => { if (typeof params.callback !== 'function') { return { success: false, @@ -213,8 +217,7 @@ export const customMessage: $T.CustomMessage = async (params) => { return response; }; -export const requestLogin: $T.RequestLogin = async (params) => { - // $FlowIssue: property callback not found +export const requestLogin: $PropertyType<$T.API, 'requestLogin'> = async (params) => { if (typeof params.callback === 'function') { const callback = params.callback; @@ -245,7 +248,7 @@ export const requestLogin: $T.RequestLogin = async (params) => { _core.removeListener(CORE_EVENT, loginChallengeListener); return response; } else { - return await call({ method: 'requestLogin', ...params }); + return call({ method: 'requestLogin', ...params }); } }; diff --git a/src/js/env/react-native/RNUsbPlugin.js b/src/js/env/react-native/RNUsbPlugin.js index c87e4b56d..3ffe05b98 100644 --- a/src/js/env/react-native/RNUsbPlugin.js +++ b/src/js/env/react-native/RNUsbPlugin.js @@ -4,16 +4,16 @@ import { NativeModules } from 'react-native'; type TrezorDeviceInfoDebug = { - path: string, - debug: boolean, + path: string; + debug: boolean; }; interface RNBridge { - enumerate(): Promise, - acquire(path: string, debugLink: boolean): Promise, - release(path: string, debugLink: boolean, closePort: boolean): Promise, - write(path: string, debugLink: boolean, data: string): Promise, - read(path: string, debugLink: boolean): Promise<{ data: string }>, + enumerate(): Promise; + acquire(path: string, debugLink: boolean): Promise; + release(path: string, debugLink: boolean, closePort: boolean): Promise; + write(path: string, debugLink: boolean, data: string): Promise; + read(path: string, debugLink: boolean): Promise<{ data: string }>; } const bufferToHex = (buffer: ArrayBuffer): string => { diff --git a/src/js/env/react-native/index.js b/src/js/env/react-native/index.js index 0ff8c62c5..3bbbb1a22 100644 --- a/src/js/env/react-native/index.js +++ b/src/js/env/react-native/index.js @@ -7,25 +7,31 @@ import Log, { init as initLog } from '../../utils/debug'; import { Core, init as initCore, initTransport } from '../../core/Core'; import { create as createDeferred } from '../../utils/deferred'; -import { CORE_EVENT, UI_EVENT, DEVICE_EVENT, RESPONSE_EVENT, TRANSPORT_EVENT, BLOCKCHAIN_EVENT } from '../../constants'; -import * as POPUP from '../../constants/popup'; -import * as IFRAME from '../../constants/iframe'; -import * as UI from '../../constants/ui'; -import * as ERROR from '../../constants/errors'; +import { + CORE_EVENT, + UI_EVENT, + DEVICE_EVENT, + RESPONSE_EVENT, + TRANSPORT_EVENT, + BLOCKCHAIN_EVENT, + POPUP, + IFRAME, + UI, + ERRORS, +} from '../../constants'; -import type { ConnectSettings } from '../../data/ConnectSettings'; import * as $T from '../../types'; export const eventEmitter = new EventEmitter(); const _log: Log = initLog('[trezor-connect.js]'); -let _settings: ConnectSettings; +let _settings: $T.ConnectSettings; let _core: Core; let _messageID: number = 0; export const messagePromises: { [key: number]: $T.Deferred } = {}; -export const manifest = (data: any) => { +export const manifest = (data: $T.Manifest) => { _settings = parseSettings({ manifest: data, }); @@ -92,7 +98,7 @@ const handleMessage = (message: $T.CoreMessage): void => { } }; -const postMessage = (message: any, usePromise: boolean = true): ?Promise => { +const postMessage = (message: any, usePromise: boolean = true) => { if (!_core) { throw new Error('postMessage: _core not found'); } @@ -108,7 +114,7 @@ const postMessage = (message: any, usePromise: boolean = true): ?Promise = return null; }; -export const init = async (settings: Object = {}): Promise => { +export const init = async (settings: $Shape<$T.ConnectSettings> = {}): Promise => { if (!_settings) { _settings = parseSettings(settings); } @@ -118,7 +124,7 @@ export const init = async (settings: Object = {}): Promise => { _settings.env = 'react-native'; if (!_settings.manifest) { - throw ERROR.MANIFEST_NOT_SET; + throw ERRORS.MANIFEST_NOT_SET; } if (_settings.lazyLoad) { @@ -127,7 +133,7 @@ export const init = async (settings: Object = {}): Promise => { return; } - _log.enabled = _settings.debug; + _log.enabled = !!_settings.debug; _core = await initCore(_settings); _core.on(CORE_EVENT, handleMessage); @@ -160,7 +166,7 @@ export const call = async (params: Object): Promise => { } }; -const customMessageResponse = (payload: ?{ message: string, params?: Object }): void => { +const customMessageResponse = (payload: ?{ message: string; params?: Object }): void => { _core.handleMessage({ event: UI_EVENT, type: UI.CUSTOM_MESSAGE_RESPONSE, @@ -169,21 +175,22 @@ const customMessageResponse = (payload: ?{ message: string, params?: Object }): }; export const uiResponse = (response: $T.UiResponse): void => { - _core.handleMessage({ event: UI_EVENT, ...response }, true); + const { type, payload } = response; + _core.handleMessage({ event: UI_EVENT, type, payload }, true); }; export const renderWebUSBButton = (className: ?string): void => { // webUSBButton(className, _settings.webusbSrc, iframe.origin); }; -export const getSettings: $T.GetSettings = async () => { +export const getSettings = async (): $T.Response<$T.ConnectSettings> => { if (!_core) { return { success: false, payload: { error: 'Core not initialized yet, you need to call TrezorConnect.init or any other method first.' } }; } return await call({ method: 'getSettings' }); }; -export const customMessage: $T.CustomMessage = async (params) => { +export const customMessage: $PropertyType<$T.API, 'customMessage'> = async (params) => { if (typeof params.callback !== 'function') { return { success: false, @@ -213,7 +220,7 @@ export const customMessage: $T.CustomMessage = async (params) => { return response; }; -export const requestLogin: $T.RequestLogin = async (params) => { +export const requestLogin: $PropertyType<$T.API, 'requestLogin'> = async (params) => { // $FlowIssue: property callback not found if (typeof params.callback === 'function') { const callback = params.callback; diff --git a/src/js/iframe/builder.js b/src/js/iframe/builder.js index bc3e6eca3..0d1cc7536 100644 --- a/src/js/iframe/builder.js +++ b/src/js/iframe/builder.js @@ -5,8 +5,7 @@ import * as IFRAME from '../constants/iframe'; import { IFRAME_TIMEOUT, IFRAME_BLOCKED } from '../constants/errors'; import { getOrigin } from '../env/browser/networkUtils'; import css from './inline-styles'; -import type { Deferred } from '../types'; -import type { ConnectSettings } from '../data/ConnectSettings'; +import type { ConnectSettings, Deferred } from '../types'; export let instance: ?HTMLIFrameElement; export let origin: string; diff --git a/src/js/iframe/iframe.js b/src/js/iframe/iframe.js index 1a2a1816c..a8fb4f0e5 100644 --- a/src/js/iframe/iframe.js +++ b/src/js/iframe/iframe.js @@ -191,7 +191,7 @@ const init = async (payload: any, origin: string) => { _popupMessagePort.onmessage = message => handleMessage(message); } - _log.enabled = parsedSettings.debug; + _log.enabled = !!parsedSettings.debug; try { // initialize core diff --git a/src/js/index.js b/src/js/index.js index 7651f9c66..f72f20662 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -1,13 +1,5 @@ /* @flow */ - -import { UI_EVENT, DEVICE_EVENT, RESPONSE_EVENT, TRANSPORT_EVENT, BLOCKCHAIN_EVENT } from './constants'; -import * as TRANSPORT from './constants/transport'; -import * as IFRAME from './constants/iframe'; -import * as UI from './constants/ui'; -import * as DEVICE from './constants/device'; -import * as BLOCKCHAIN from './constants/blockchain'; - -import * as $T from './types'; +import { UI } from './constants'; import { eventEmitter, manifest, @@ -22,317 +14,270 @@ import { cancel, dispose, } from './env/node'; +import type { API } from './types'; -class TrezorConnect { - static manifest = (data: Object): void => { - manifest(data); - } - - static getSettings: $T.GetSettings = async () => { - return await getSettings(); - } - - static init = async (settings: $T.Settings): Promise => { - return await init(settings); - } +const TrezorConnect: API = { + manifest, + init: settings => init(settings), + getSettings, - static on: $T.EventListener = (type, fn): void => { + on: (type, fn) => { eventEmitter.on(type, fn); - } + }, - static off: $T.EventListener = (type, fn): void => { + off: (type, fn) => { eventEmitter.removeListener(type, fn); - } + }, - static uiResponse = (response: $T.UiResponse): void => { - uiResponse(response); - } + uiResponse, // methods - static blockchainDisconnect: $T.BlockchainDisconnect = async (params) => { - return await call({ method: 'blockchainDisconnect', ...params }); - } + blockchainDisconnect: params => { + return call({ method: 'blockchainDisconnect', ...params }); + }, - static blockchainEstimateFee: $T.BlockchainEstimateFee = async (params) => { - return await call({ method: 'blockchainEstimateFee', ...params }); - } + blockchainEstimateFee: params => { + return call({ method: 'blockchainEstimateFee', ...params }); + }, - static blockchainGetTransactions: $T.BlockchainGetTransactions = async (params) => { - return await call({ method: 'blockchainGetTransactions', ...params }); - } + blockchainGetTransactions: params => { + return call({ method: 'blockchainGetTransactions', ...params }); + }, - static blockchainSubscribe: $T.BlockchainSubscribe = async (params) => { - return await call({ method: 'blockchainSubscribe', ...params }); - } + blockchainSubscribe: params => { + return call({ method: 'blockchainSubscribe', ...params }); + }, - static blockchainUnsubscribe: $T.BlockchainSubscribe = async (params) => { - return await call({ method: 'blockchainUnsubscribe', ...params }); - } + blockchainUnsubscribe: params => { + return call({ method: 'blockchainUnsubscribe', ...params }); + }, - static customMessage: $T.CustomMessage = async (params) => { - return await customMessage(params); - } + customMessage: params => { + return customMessage(params); + }, - static requestLogin: $T.RequestLogin = async (params) => { - return await requestLogin(params); - } + requestLogin: params => { + return requestLogin(params); + }, - static resetDevice: $T.ResetDevice = async (params) => { - return await call({ method: 'resetDevice', ...params }); - } - - static cardanoGetAddress: $T.CardanoGetAddress = async (params) => { + cardanoGetAddress: params => { const useEventListener = eventEmitter.listenerCount(UI.ADDRESS_VALIDATION) > 0; - return await call({ method: 'cardanoGetAddress', ...params, useEventListener }); - } + return call({ method: 'cardanoGetAddress', ...params, useEventListener }); + }, - static cardanoGetPublicKey: $T.CardanoGetPublicKey = async (params) => { - return await call({ method: 'cardanoGetPublicKey', ...params }); - } + cardanoGetPublicKey: params => { + return call({ method: 'cardanoGetPublicKey', ...params }); + }, - static cardanoSignTransaction: $T.CardanoSignTransaction = async (params) => { - return await call({ method: 'cardanoSignTransaction', ...params }); - } + cardanoSignTransaction: params => { + return call({ method: 'cardanoSignTransaction', ...params }); + }, - static cipherKeyValue: $T.CipherKeyValue = async (params) => { - return await call({ method: 'cipherKeyValue', ...params }); - } + cipherKeyValue: params => { + return call({ method: 'cipherKeyValue', ...params }); + }, - static composeTransaction: $T.ComposeTransaction = async (params) => { - return await call({ method: 'composeTransaction', ...params }); - } + composeTransaction: params => { + return call({ method: 'composeTransaction', ...params }); + }, - static debugLinkDecision: $T.DebugLinkDecision = async (params) => { - return await call({ method: 'debugLinkDecision', ...params }); - } + debugLinkDecision: params => { + return call({ method: 'debugLinkDecision', ...params }); + }, - static debugLinkGetState: $T.DebugLinkGetState = async (params) => { - return await call({ method: 'debugLinkGetState', ...params }); - } + debugLinkGetState: params => { + return call({ method: 'debugLinkGetState', ...params }); + }, - static ethereumGetAddress: $T.EthereumGetAddress = async (params) => { + ethereumGetAddress: params => { const useEventListener = eventEmitter.listenerCount(UI.ADDRESS_VALIDATION) > 0; - return await call({ method: 'ethereumGetAddress', ...params, useEventListener }); - } + return call({ method: 'ethereumGetAddress', ...params, useEventListener }); + }, - static ethereumGetPublicKey: $T.EthereumGetPublicKey = async (params) => { - return await call({ method: 'ethereumGetPublicKey', ...params }); - } + ethereumGetPublicKey: params => { + return call({ method: 'ethereumGetPublicKey', ...params }); + }, - static ethereumSignMessage: $T.EthereumSignMessage = async (params) => { - return await call({ method: 'ethereumSignMessage', ...params }); - } + ethereumSignMessage: params => { + return call({ method: 'ethereumSignMessage', ...params }); + }, - static ethereumSignTransaction: $T.EthereumSignTransaction = async (params) => { - return await call({ method: 'ethereumSignTransaction', ...params }); - } + ethereumSignTransaction: params => { + return call({ method: 'ethereumSignTransaction', ...params }); + }, - static ethereumVerifyMessage: $T.EthereumVerifyMessage = async (params) => { - return await call({ method: 'ethereumVerifyMessage', ...params }); - } + ethereumVerifyMessage: params => { + return call({ method: 'ethereumVerifyMessage', ...params }); + }, - static getAccountInfo: $T.GetAccountInfo = async (params) => { - return await call({ method: 'getAccountInfo', ...params }); - } + getAccountInfo: params => { + return call({ method: 'getAccountInfo', ...params }); + }, - static getAddress: $T.GetAddress = async (params) => { + getAddress: params => { const useEventListener = eventEmitter.listenerCount(UI.ADDRESS_VALIDATION) > 0; - return await call({ method: 'getAddress', ...params, useEventListener }); - } + return call({ method: 'getAddress', ...params, useEventListener }); + }, - static getDeviceState: $T.GetDeviceState = async (params) => { - return await call({ method: 'getDeviceState', ...params }); - } + getDeviceState: params => { + return call({ method: 'getDeviceState', ...params }); + }, - static getFeatures: $T.GetFeatures = async (params) => { - return await call({ method: 'getFeatures', ...params }); - } + getFeatures: params => { + return call({ method: 'getFeatures', ...params }); + }, - static getPublicKey: $T.GetPublicKey = async (params) => { - return await call({ method: 'getPublicKey', ...params }); - } + getPublicKey: params => { + return call({ method: 'getPublicKey', ...params }); + }, - static liskGetAddress: $T.LiskGetAddress = async (params) => { + liskGetAddress: params => { const useEventListener = eventEmitter.listenerCount(UI.ADDRESS_VALIDATION) > 0; - return await call({ method: 'liskGetAddress', ...params, useEventListener }); - } + return call({ method: 'liskGetAddress', ...params, useEventListener }); + }, - static liskGetPublicKey: $T.LiskGetPublicKey = async (params) => { - return await call({ method: 'liskGetPublicKey', ...params }); - } + liskGetPublicKey: params => { + return call({ method: 'liskGetPublicKey', ...params }); + }, - static liskSignMessage: $T.LiskSignMessage = async (params) => { - return await call({ method: 'liskSignMessage', ...params }); - } + liskSignMessage: params => { + return call({ method: 'liskSignMessage', ...params }); + }, - static liskSignTransaction: $T.LiskSignTransaction = async (params) => { - return await call({ method: 'liskSignTransaction', ...params }); - } + liskSignTransaction: params => { + return call({ method: 'liskSignTransaction', ...params }); + }, - static liskVerifyMessage: $T.LiskVerifyMessage = async (params) => { - return await call({ method: 'liskVerifyMessage', ...params }); - } + liskVerifyMessage: params => { + return call({ method: 'liskVerifyMessage', ...params }); + }, - static nemGetAddress: $T.NEMGetAddress = async (params) => { + nemGetAddress: params => { const useEventListener = eventEmitter.listenerCount(UI.ADDRESS_VALIDATION) > 0; - return await call({ method: 'nemGetAddress', ...params, useEventListener }); - } + return call({ method: 'nemGetAddress', ...params, useEventListener }); + }, - static nemSignTransaction: $T.NEMSignTransaction = async (params) => { - return await call({ method: 'nemSignTransaction', ...params }); - } + nemSignTransaction: params => { + return call({ method: 'nemSignTransaction', ...params }); + }, - static pushTransaction: $T.PushTransaction = async (params) => { - return await call({ method: 'pushTransaction', ...params }); - } + pushTransaction: params => { + return call({ method: 'pushTransaction', ...params }); + }, - static rippleGetAddress: $T.RippleGetAddress = async (params) => { + rippleGetAddress: params => { const useEventListener = eventEmitter.listenerCount(UI.ADDRESS_VALIDATION) > 0; - return await call({ method: 'rippleGetAddress', ...params, useEventListener }); - } + return call({ method: 'rippleGetAddress', ...params, useEventListener }); + }, - static rippleSignTransaction: $T.RippleSignTransaction = async (params) => { - return await call({ method: 'rippleSignTransaction', ...params }); - } + rippleSignTransaction: params => { + return call({ method: 'rippleSignTransaction', ...params }); + }, - static signMessage: $T.SignMessage = async (params) => { - return await call({ method: 'signMessage', ...params }); - } + signMessage: params => { + return call({ method: 'signMessage', ...params }); + }, - static signTransaction: $T.SignTransaction = async (params) => { - return await call({ method: 'signTransaction', ...params }); - } + signTransaction: params => { + return call({ method: 'signTransaction', ...params }); + }, - static stellarGetAddress: $T.StellarGetAddress = async (params) => { + stellarGetAddress: params => { const useEventListener = eventEmitter.listenerCount(UI.ADDRESS_VALIDATION) > 0; - return await call({ method: 'stellarGetAddress', ...params, useEventListener }); - } + return call({ method: 'stellarGetAddress', ...params, useEventListener }); + }, - static stellarSignTransaction: $T.StellarSignTransaction = async (params) => { - return await call({ method: 'stellarSignTransaction', ...params }); - } + stellarSignTransaction: params => { + return call({ method: 'stellarSignTransaction', ...params }); + }, - static tezosGetAddress: $T.TezosGetAddress = async (params) => { + tezosGetAddress: params => { const useEventListener = eventEmitter.listenerCount(UI.ADDRESS_VALIDATION) > 0; - return await call({ method: 'tezosGetAddress', ...params, useEventListener }); - } + return call({ method: 'tezosGetAddress', ...params, useEventListener }); + }, - static tezosGetPublicKey: $T.TezosGetPublicKey = async (params) => { - return await call({ method: 'tezosGetPublicKey', ...params }); - } + tezosGetPublicKey: params => { + return call({ method: 'tezosGetPublicKey', ...params }); + }, - static tezosSignTransaction: $T.TezosSignTransaction = async (params) => { - return await call({ method: 'tezosSignTransaction', ...params }); - } + tezosSignTransaction: params => { + return call({ method: 'tezosSignTransaction', ...params }); + }, - static eosGetPublicKey: $T.EosGetPublicKey = async (params) => { - return await call({ method: 'eosGetPublicKey', ...params }); - } + eosGetPublicKey: params => { + return call({ method: 'eosGetPublicKey', ...params }); + }, - static eosSignTransaction: $T.EosSignTx = async (params) => { - return await call({ method: 'eosSignTransaction', ...params }); - } + eosSignTransaction: params => { + return call({ method: 'eosSignTransaction', ...params }); + }, - static binanceGetAddress: $T.BinanceGetAddress = async (params) => { + binanceGetAddress: params => { const useEventListener = eventEmitter.listenerCount(UI.ADDRESS_VALIDATION) > 0; - return await call({ method: 'binanceGetAddress', ...params, useEventListener }); - } + return call({ method: 'binanceGetAddress', ...params, useEventListener }); + }, + + binanceGetPublicKey: params => { + return call({ method: 'binanceGetPublicKey', ...params }); + }, - static binanceGetPublicKey: $T.BinanceGetPublicKey = async (params) => { - return await call({ method: 'binanceGetPublicKey', ...params }); - } + binanceSignTransaction: params => { + return call({ method: 'binanceSignTransaction', ...params }); + }, - static binanceSignTransaction: $T.BinanceSignTransaction = async (params) => { - return await call({ method: 'binanceSignTransaction', ...params }); - } + verifyMessage: params => { + return call({ method: 'verifyMessage', ...params }); + }, - static verifyMessage: $T.VerifyMessage = async (params) => { - return await call({ method: 'verifyMessage', ...params }); - } + resetDevice: params => { + return call({ method: 'resetDevice', ...params }); + }, - static wipeDevice: $T.WipeDevice = async (params) => { - return await call({ method: 'wipeDevice', ...params }); - } + wipeDevice: params => { + return call({ method: 'wipeDevice', ...params }); + }, - static applyFlags: $T.ApplyFlags = async (params) => { - return await call({ method: 'applyFlags', ...params }); - } + applyFlags: params => { + return call({ method: 'applyFlags', ...params }); + }, - static applySettings: $T.ApplySettings = async (params) => { - return await call({ method: 'applySettings', ...params }); - } + applySettings: params => { + return call({ method: 'applySettings', ...params }); + }, - static backupDevice: $T.BackupDevice = async () => { - return await call({ method: 'backupDevice' }); - } + backupDevice: params => { + return call({ method: 'backupDevice' }); + }, - static changePin: $T.ChangePin = async (params) => { - return await call({ method: 'changePin', ...params }); - } + changePin: params => { + return call({ method: 'changePin', ...params }); + }, - static firmwareUpdate: $T.FirmwareUpload = async (params) => { - return await call({ method: 'firmwareUpdate', ...params }); - } + firmwareUpdate: params => { + return call({ method: 'firmwareUpdate', ...params }); + }, - static recoveryDevice: $T.RecoveryDevice = async (params) => { - return await call({ method: 'recoveryDevice', ...params }); - } + recoveryDevice: params => { + return call({ method: 'recoveryDevice', ...params }); + }, - static dispose = (): void => { + dispose: () => { dispose(); - } + }, - static cancel = (error?: string): void => { - cancel(error); - } + cancel, - static renderWebUSBButton = (className: ?string): void => { + renderWebUSBButton: (className: ?string) => { renderWebUSBButton(className); - } + }, - static disableWebUSB = async () => { + disableWebUSB: () => { disableWebUSB(); - } -} + }, +}; export default TrezorConnect; -export { - IFRAME, - TRANSPORT, - UI, - DEVICE, - BLOCKCHAIN, - UI_EVENT, - DEVICE_EVENT, - TRANSPORT_EVENT, - BLOCKCHAIN_EVENT, - RESPONSE_EVENT, -}; - -export type { - Device, - DeviceStatus, - FirmwareRelease, - DeviceFirmwareStatus, - DeviceMode, - Features, - DeviceMessageType, - DeviceMessage, - UiMessageType, - UiMessage, - TransportMessageType, - TransportMessage, -} from './types'; - -export * from './types/blockchainEvent'; -export * from './types/account'; - -export type { - Transaction as EthereumTransaction, -} from './types/ethereum'; - -export type { - Transaction as RippleTransaction, -} from './types/ripple'; +export * from './constants'; +export * from './types'; diff --git a/src/js/message/builder.js b/src/js/message/builder.js index c94b0313d..ae2be0dd8 100644 --- a/src/js/message/builder.js +++ b/src/js/message/builder.js @@ -2,10 +2,9 @@ import { UI_EVENT, DEVICE_EVENT, TRANSPORT_EVENT, RESPONSE_EVENT, BLOCKCHAIN_EVENT } from '../constants'; import type { CoreMessage } from '../types'; -import type { UiMessageFactory } from '../types/uiRequest'; -import type { BlockchainMessageFactory } from '../types/blockchainEvent'; +import type { UiMessageBuilder, BlockchainMessageBuilder } from '../types'; -export const UiMessage: UiMessageFactory = (type, payload) => ( +export const UiMessage: UiMessageBuilder = (type, payload) => ( { event: UI_EVENT, type, @@ -39,7 +38,7 @@ export const ResponseMessage = (id: number, success: boolean, payload: any = nul } ); -export const BlockchainMessage: BlockchainMessageFactory = (type, payload): CoreMessage => ( +export const BlockchainMessage: BlockchainMessageBuilder = (type, payload) => ( { event: BLOCKCHAIN_EVENT, type, diff --git a/src/js/popup/PopupManager.js b/src/js/popup/PopupManager.js index 6b456624f..eea2a092b 100644 --- a/src/js/popup/PopupManager.js +++ b/src/js/popup/PopupManager.js @@ -5,8 +5,7 @@ import * as POPUP from '../constants/popup'; import * as IFRAME from '../constants/iframe'; import * as UI from '../constants/ui'; import { showPopupRequest } from './showPopupRequest'; -import type { ConnectSettings } from '../data/ConnectSettings'; -import type { CoreMessage, Deferred } from '../types'; +import type { ConnectSettings, CoreMessage, Deferred } from '../types'; import { getOrigin } from '../env/browser/networkUtils'; import { create as createDeferred } from '../utils/deferred'; diff --git a/src/js/popup/popup.js b/src/js/popup/popup.js index 682746b9a..243ae8a14 100644 --- a/src/js/popup/popup.js +++ b/src/js/popup/popup.js @@ -16,8 +16,7 @@ import { showBackupNotification, } from './view/notification'; -import type { CoreMessage, PostMessageEvent } from '../types'; -import type { PopupInit, PopupHandshake } from '../types/uiRequest'; +import type { CoreMessage, PostMessageEvent, PopupInit, PopupHandshake } from '../types'; // eslint-disable-next-line no-unused-vars import styles from '../../styles/popup.less'; diff --git a/src/js/popup/view/confirmation.js b/src/js/popup/view/confirmation.js index ed5241169..6aafbce1b 100644 --- a/src/js/popup/view/confirmation.js +++ b/src/js/popup/view/confirmation.js @@ -3,7 +3,7 @@ import { UiMessage } from '../../message/builder'; import * as UI from '../../constants/ui'; import { container, showView, postMessage } from './common'; -import type { RequestConfirmation } from '../../types/uiRequest'; +import type { RequestConfirmation } from '../../types/events'; export const initConfirmationView = (data: $PropertyType): void => { // Confirmation views: diff --git a/src/js/popup/view/firmwareNotCompatible.js b/src/js/popup/view/firmwareNotCompatible.js index 98331a9d5..e0f6a08d5 100644 --- a/src/js/popup/view/firmwareNotCompatible.js +++ b/src/js/popup/view/firmwareNotCompatible.js @@ -4,7 +4,7 @@ import { UiMessage } from '../../message/builder'; import DataManager from '../../data/DataManager'; import * as UI from '../../constants/ui'; import { showView, postMessage } from './common'; -import type { UnexpectedDeviceMode } from '../../types/uiRequest'; +import type { UnexpectedDeviceMode } from '../../types/events'; export const firmwareNotCompatible = (device: $PropertyType): void => { const view = showView('firmware-not-compatible'); diff --git a/src/js/popup/view/firmwareNotSupported.js b/src/js/popup/view/firmwareNotSupported.js index f30c6b2d0..ad0e66524 100644 --- a/src/js/popup/view/firmwareNotSupported.js +++ b/src/js/popup/view/firmwareNotSupported.js @@ -1,7 +1,7 @@ /* @flow */ import { showView } from './common'; -import type { UnexpectedDeviceMode } from '../../types/uiRequest'; +import type { UnexpectedDeviceMode } from '../../types/events'; export const firmwareNotSupported = (device: $PropertyType): void => { const view = showView('firmware-not-supported'); diff --git a/src/js/popup/view/firmwareRequiredUpdate.js b/src/js/popup/view/firmwareRequiredUpdate.js index 3b0eae669..841cfa8f9 100644 --- a/src/js/popup/view/firmwareRequiredUpdate.js +++ b/src/js/popup/view/firmwareRequiredUpdate.js @@ -1,7 +1,7 @@ /* @flow */ import { showView } from './common'; -import type { UnexpectedDeviceMode } from '../../types/uiRequest'; +import type { UnexpectedDeviceMode } from '../../types/events'; export const firmwareRequiredUpdate = (device: $PropertyType): void => { const view = showView('firmware-update'); diff --git a/src/js/popup/view/invalidPassphrase.js b/src/js/popup/view/invalidPassphrase.js index da5a73886..35fd72b20 100644 --- a/src/js/popup/view/invalidPassphrase.js +++ b/src/js/popup/view/invalidPassphrase.js @@ -3,7 +3,7 @@ import { UiMessage } from '../../message/builder'; import * as UI from '../../constants/ui'; import { container, showView, postMessage } from './common'; -import type { DeviceMessage } from '../../types/uiRequest'; +import type { DeviceMessage } from '../../types/events'; export const initInvalidPassphraseView = (payload: $PropertyType): void => { showView('invalid-passphrase'); diff --git a/src/js/popup/view/notification.js b/src/js/popup/view/notification.js index 854476f1f..235d4ad67 100644 --- a/src/js/popup/view/notification.js +++ b/src/js/popup/view/notification.js @@ -1,7 +1,7 @@ /* @flow */ import { views } from './common'; -import type { UnexpectedDeviceMode } from '../../types/uiRequest'; +import type { UnexpectedDeviceMode } from '../../types/events'; export const showFirmwareUpdateNotification = (device: $PropertyType): void => { const container: HTMLElement = document.getElementsByClassName('notification')[0]; diff --git a/src/js/popup/view/passphrase.js b/src/js/popup/view/passphrase.js index b61e905d4..cabc7972e 100644 --- a/src/js/popup/view/passphrase.js +++ b/src/js/popup/view/passphrase.js @@ -3,7 +3,7 @@ import { UiMessage } from '../../message/builder'; import * as UI from '../../constants/ui'; import { container, showView, postMessage } from './common'; -import type { DeviceMessage } from '../../types/uiRequest'; +import type { DeviceMessage } from '../../types/events'; export const initPassphraseView = (payload: $PropertyType): void => { showView('passphrase'); diff --git a/src/js/popup/view/passphraseOnDevice.js b/src/js/popup/view/passphraseOnDevice.js index 8fa29892e..4e3719f3b 100644 --- a/src/js/popup/view/passphraseOnDevice.js +++ b/src/js/popup/view/passphraseOnDevice.js @@ -1,6 +1,6 @@ /* @flow */ import { container, showView } from './common'; -import type { DeviceMessage } from '../../types/uiRequest'; +import type { DeviceMessage } from '../../types/events'; export const passphraseOnDeviceView = (payload: $PropertyType): void => { showView('passphrase-on-device'); diff --git a/src/js/popup/view/permissions.js b/src/js/popup/view/permissions.js index b6f6f9868..613ed4b9f 100644 --- a/src/js/popup/view/permissions.js +++ b/src/js/popup/view/permissions.js @@ -4,7 +4,7 @@ import { UiMessage } from '../../message/builder'; import * as UI from '../../constants/ui'; import DataManager from '../../data/DataManager'; import { container, showView, postMessage, createTooltip } from './common'; -import type { RequestPermission } from '../../types/uiRequest'; +import type { RequestPermission } from '../../types/events'; const getPermissionText = (permissionType: string, deviceName: string): string => { let text: string = ''; diff --git a/src/js/popup/view/pin.js b/src/js/popup/view/pin.js index 3036601d1..3d93e1023 100644 --- a/src/js/popup/view/pin.js +++ b/src/js/popup/view/pin.js @@ -3,7 +3,7 @@ import { UiMessage } from '../../message/builder'; import * as UI from '../../constants/ui'; import { container, showView, postMessage } from './common'; -import type { DeviceMessage } from '../../types/uiRequest'; +import type { DeviceMessage } from '../../types/events'; const isSubmitButtonDisabled = (isDisabled: boolean) => { const submitButton: HTMLElement = container.getElementsByClassName('submit')[0]; diff --git a/src/js/popup/view/requestButton.js b/src/js/popup/view/requestButton.js index 58803fab7..5f72b91b6 100644 --- a/src/js/popup/view/requestButton.js +++ b/src/js/popup/view/requestButton.js @@ -1,7 +1,7 @@ /* @flow */ import { container, showView } from './common'; -import type { ButtonRequestMessage } from '../../types/uiRequest'; +import type { ButtonRequestMessage } from '../../types/events'; let toastTimeout; diff --git a/src/js/popup/view/selectAccount.js b/src/js/popup/view/selectAccount.js index eaacf3eb0..99e278de2 100644 --- a/src/js/popup/view/selectAccount.js +++ b/src/js/popup/view/selectAccount.js @@ -6,7 +6,7 @@ import * as UI from '../../constants/ui'; import { container, showView, postMessage } from './common'; import type { DiscoveryAccount } from '../../types/account'; -import type { SelectAccount } from '../../types/uiRequest'; +import type { SelectAccount } from '../../types/events'; const setHeader = (payload: $PropertyType) => { const h3: HTMLElement = container.getElementsByTagName('h3')[0]; diff --git a/src/js/popup/view/selectDevice.js b/src/js/popup/view/selectDevice.js index 0c545704c..af2fcc32b 100644 --- a/src/js/popup/view/selectDevice.js +++ b/src/js/popup/view/selectDevice.js @@ -5,7 +5,7 @@ import * as UI from '../../constants/ui'; import * as POPUP from '../../constants/popup'; import { container, iframe, showView, postMessage } from './common'; import DataManager from '../../data/DataManager'; -import type { SelectDevice } from '../../types/uiRequest'; +import type { SelectDevice } from '../../types/events'; const initWebUsbButton = (webusb: boolean, showLoader: boolean): void => { if (!webusb) return; diff --git a/src/js/popup/view/selectFee.js b/src/js/popup/view/selectFee.js index baab9130e..b73b9c9c4 100644 --- a/src/js/popup/view/selectFee.js +++ b/src/js/popup/view/selectFee.js @@ -5,9 +5,9 @@ import * as UI from '../../constants/ui'; import { container, showView, postMessage } from './common'; import { formatAmount, formatTime } from '../../utils/formatUtils'; -import type { SelectFee, UpdateCustomFee } from '../../types/uiRequest'; +import type { SelectFee, UpdateCustomFee } from '../../types/events'; import type { BitcoinNetworkInfo } from '../../types'; -import type { SelectFeeLevel } from '../../types/fee'; +import type { SelectFeeLevel } from '../../types/account'; const fees: Array = []; // reference to currently selected button diff --git a/src/js/popup/view/word.js b/src/js/popup/view/word.js index fe53b05b3..c598b5465 100644 --- a/src/js/popup/view/word.js +++ b/src/js/popup/view/word.js @@ -3,7 +3,7 @@ import { UiMessage } from '../../message/builder'; import * as UI from '../../constants/ui'; import { container, showView, postMessage } from './common'; -import type { DeviceMessage } from '../../types/uiRequest'; +import type { DeviceMessage } from '../../types/events'; import bipWords from '../../utils/bip39'; const initWordPlainView = (payload: $PropertyType): void => { diff --git a/src/js/types/__tests__/binance.js b/src/js/types/__tests__/binance.js new file mode 100644 index 000000000..1cc876948 --- /dev/null +++ b/src/js/types/__tests__/binance.js @@ -0,0 +1,142 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const binanceGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.binanceGetAddress({ path: 'm/44' }); + (singleAddress.success: boolean); + if (singleAddress.success) { + const { payload } = singleAddress; + (payload.address: string); + (payload.path: number[]); + (payload.serializedPath: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.address: string); + }); + } + + // bundle + const bundleAddress = await TrezorConnect.binanceGetAddress({ bundle: [{ path: 'm/44' }] }); + (bundleAddress.success: boolean); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + (item.address: string); + (item.path: number[]); + (item.serializedPath: string); + }); + // $FlowIssue: payload is Address[] + (bundleAddress.payload.address: string); + } else { + (bundleAddress.payload.error: string); + } + + // with all possible params + TrezorConnect.binanceGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // $FlowIssue + TrezorConnect.binanceGetAddress(); + // $FlowIssue + TrezorConnect.binanceGetAddress({ useEmptyPassphrase: true }); + // $FlowIssue + TrezorConnect.binanceGetAddress({ path: 1 }); + // $FlowIssue + TrezorConnect.binanceGetAddress({ bundle: 1 }); +}; + +export const binanceGetPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.binanceGetPublicKey({ path: 'm/44' }); + (singlePK.success: boolean); + if (singlePK.success) { + const { payload } = singlePK; + (payload.path: number[]); + (payload.serializedPath: string); + (payload.publicKey: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.path: string); + }); + } + + // bundle + const bundlePK = await TrezorConnect.binanceGetPublicKey({ bundle: [{ path: 'm/44' }] }); + (bundlePK.success: boolean); + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + (item.path: number[]); + (item.serializedPath: string); + (item.publicKey: string); + }); + // $FlowIssue: payload is Address[] + (bundlePK.payload.publicKey: string); + } else { + (bundlePK.payload.error: string); + } +}; + +export const binanceSignTransaction = async () => { + const sign = await TrezorConnect.binanceSignTransaction({ + path: 'm/44', + transaction: { + chain_id: 'Binance-Chain-Nile', + account_number: 34, + memo: 'test', + sequence: 31, + source: 1, + transfer: { + inputs: [ + { + address: 'tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd', + coins: [ + { amount: 1000000000, denom: 'BNB' }, + ], + }, + ], + outputs: [ + { + address: 'tbnb1ss57e8sa7xnwq030k2ctr775uac9gjzglqhvpy', + coins: [ + { amount: 1000000000, denom: 'BNB' }, + ], + }, + ], + }, + placeOrder: { + id: 'BA36F0FAD74D8F41045463E4774F328F4AF779E5-33', + ordertype: 2, + price: 100000000, + quantity: 100000000, + sender: 'tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd', + side: 1, + symbol: 'ADA.B-B63_BNB', + timeinforce: 1, + }, + cancelOrder: { + refid: 'BA36F0FAD74D8F41045463E4774F328F4AF779E5-29', + sender: 'tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd', + symbol: 'BCHSV.B-10F_BNB', + }, + }, + }); + + if (sign.success) { + const { payload } = sign; + (payload.public_key: string); + (payload.signature: string); + } +}; diff --git a/src/js/types/__tests__/bitcoin.js b/src/js/types/__tests__/bitcoin.js new file mode 100644 index 000000000..b6485b2ff --- /dev/null +++ b/src/js/types/__tests__/bitcoin.js @@ -0,0 +1,436 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const getAddress = async () => { + // regular + const singleAddress = await TrezorConnect.getAddress({ path: 'm/44' }); + (singleAddress.success: boolean); + if (singleAddress.success) { + const { payload } = singleAddress; + (payload.address: string); + (payload.path: number[]); + (payload.serializedPath: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.address: string); + }); + } + + // bundle + const bundleAddress = await TrezorConnect.getAddress({ bundle: [{ path: 'm/44' }] }); + (bundleAddress.success: boolean); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + (item.address: string); + (item.path: number[]); + (item.serializedPath: string); + }); + // $FlowIssue: payload is Address[] + (bundleAddress.payload.address: string); + } else { + (bundleAddress.payload.error: string); + } + + // with all possible params + TrezorConnect.getAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + coin: 'btc', + crossChain: true, + }); + + // with invalid params + // $FlowIssue + TrezorConnect.getAddress(); + // $FlowIssue + TrezorConnect.getAddress({ coin: 'btc' }); + // $FlowIssue + TrezorConnect.getAddress({ path: 1 }); + // $FlowIssue + TrezorConnect.getAddress({ bundle: 1 }); +}; + +export const getPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.getPublicKey({ path: 'm/44' }); + (singlePK.success: boolean); + if (singlePK.success) { + const { payload } = singlePK; + (payload.path: number[]); + (payload.serializedPath: string); + (payload.xpub: string); + (payload.xpubSegwit: string | void); + (payload.chainCode: string); + (payload.childNum: number); + (payload.publicKey: string); + (payload.fingerprint: number); + (payload.depth: number); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.path: string); + }); + } + + // bundle + const bundlePK = await TrezorConnect.getPublicKey({ bundle: [{ path: 'm/44' }] }); + (bundlePK.success: boolean); + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + (item.path: number[]); + (item.serializedPath: string); + (item.xpub: string); + (item.xpubSegwit: string | void); + (item.chainCode: string); + (item.childNum: number); + (item.publicKey: string); + (item.fingerprint: number); + (item.depth: number); + }); + // $FlowIssue: payload is Address[] + (bundlePK.payload.xpub: string); + } else { + (bundlePK.payload.error: string); + } +}; + +export const signTransaction = async () => { + // minimum required params + TrezorConnect.signTransaction({ + inputs: [], + outputs: [], + coin: 'btc', + }); + + // with all possible params + const sign = await TrezorConnect.signTransaction({ + inputs: [ + { + address_n: [0], + prev_index: 0, + prev_hash: 'txhash', + script_type: 'SPENDADDRESS', + }, + { + address_n: [0], + prev_index: 0, + prev_hash: 'txhash', + amount: '1', + script_type: 'SPENDWITNESS', + }, + { + address_n: [0], + prev_index: 0, + prev_hash: 'abcd', + amount: '1', + script_type: 'SPENDP2SHWITNESS', + }, + { + address_n: [0], + prev_index: 0, + prev_hash: 'txhash', + script_type: 'SPENDMULTISIG', + sequence: 1, + multisig: { + pubkeys: [ + { node: 'HDNodeAsString', address_n: [0] }, + { + node: { + depth: 0, + fingerprint: 1, + child_num: 1, + chain_code: 'chain_code', + public_key: 'xpubABCD', + }, + address_n: [0], + }, + ], + signatures: ['signature'], + m: 0, + }, + }, + ], + outputs: [ + // external outputs + { + address: 'ExternalAddress', + amount: '100', + script_type: 'PAYTOADDRESS', + }, + { + address: 'ExternalAddress', + amount: '100', + script_type: 'PAYTOADDRESS', + multisig: { + pubkeys: [ + { node: 'HDNodeAsString', address_n: [0] }, + ], + signatures: ['signature'], + m: 0, + }, + }, + // change outputs + { + address_n: [0], + amount: '100', + script_type: 'PAYTOADDRESS', + }, + { + address_n: [0], + amount: '100', + script_type: 'PAYTOWITNESS', + }, + { + address_n: [0], + amount: '100', + script_type: 'PAYTOP2SHWITNESS', + }, + { + address_n: [0], + amount: '100', + script_type: 'PAYTOMULTISIG', + multisig: { + pubkeys: [ + { node: 'HDNodeAsString', address_n: [0] }, + ], + signatures: ['signature'], + m: 0, + }, + }, + { + amount: '0', + op_return_data: 'deadbeef', + script_type: 'PAYTOOPRETURN', + }, + ], + refTxs: [ + { + hash: 'txhash', + version: 1, + inputs: [ + { + prev_hash: 'txhash', + prev_index: 0, + script_sig: 'tx-signature', + sequence: 1, + }, + ], + bin_outputs: [ + { + amount: '100', + script_pubkey: 'tx-script-pubkey', + }, + ], + lock_time: 1, + extra_data: '00', + timestamp: 1, + version_group_id: 4, + }, + ], + coin: 'btc', + locktime: 0, + timestamp: 1, + version: 0, + expiry: 0, + overwintered: true, + versionGroupId: 4, + branchId: 1, + push: true, + // common: + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + }); + + if (sign.success) { + const { payload } = sign; + (payload.signatures: string[]); + (payload.serializedTx: string); + (payload.txid: string | null | void); + } + + // with invalid params + // $FlowIssue + TrezorConnect.signTransaction(); + // $FlowIssue + TrezorConnect.signTransaction({ coin: 'btc' }); + // $FlowIssue: invalid script_type + TrezorConnect.signTransaction({ + inputs: [{ + address_n: [0], + prev_index: 0, + prev_hash: 'txhash', + script_type: 'SPENDADDRESS-2', + }], + outputs: [], + coin: 'btc', + }); +}; + +export const pushTransaction = async () => { + const push = await TrezorConnect.pushTransaction({ tx: 'serializedTX', coin: 'btc' }); + if (push.success) { + (push.payload.txid: string); + } + + // with invalid params + // $FlowIssue + TrezorConnect.pushTransaction(); + // $FlowIssue + TrezorConnect.pushTransaction({ coin: 'btc' }); +}; + +export const composeTransaction = async () => { + // Method with mixed params and mixed responses + + const compose = await TrezorConnect.composeTransaction({ + outputs: [], + coin: 'btc', + }); + if (compose.success) { + (compose.payload.serializedTx: string); + } + + const precompose = await TrezorConnect.composeTransaction({ + outputs: [], + account: { + path: 'm/49', + addresses: { + used: [], + unused: [], + change: [], + }, + utxo: [], + }, + feeLevels: [{ feePerUnit: '1' }], + coin: 'btc', + }); + // (precompose.success: boolean); + if (precompose.success) { + const tx = precompose.payload[0]; + if (tx.type === 'error') { + (tx.error: string); + } + if (tx.type === 'nonfinal') { + (tx.bytes: number); + (tx.feePerByte: string); + } + if (tx.type === 'final') { + (tx.transaction.inputs: any[]); + (tx.transaction.outputs: any[]); + } + (precompose.payload.error: string); + } else { + (precompose.payload.error: string); + // $FlowIssue: tx does not exists + (precompose.payload.type: 'final'); + } +}; + +export const getAccountInfo = async () => { + // minimum required params + TrezorConnect.getAccountInfo({ coin: 'btc' }); + + const account = await TrezorConnect.getAccountInfo({ + coin: 'btc', + path: 'm/44', + descriptor: 'xpub', + details: 'txs', + tokens: 'used', + page: 1, + pageSize: 2, + from: 1, + to: 100, + contractFilter: 'address', + gap: 25, + marker: { + ledger: 1, + seq: 1, + }, + }); + if (account.success) { + const { payload } = account; + (payload.empty: boolean); + (payload.path: string); + (payload.descriptor: string); + (payload.balance: string); + (payload.availableBalance: string); + if (payload.tokens) { + (payload.tokens: any[]); + } + if (payload.addresses) { + (payload.addresses.used: any[]); + (payload.addresses.unused: any[]); + (payload.addresses.change: any[]); + } + if (payload.utxo) { + (payload.utxo: any[]); + } + + (payload.history.total: number); + (payload.history.tokens: number | null | void); + (payload.history.unconfirmed: number | null | void); + (payload.history.transactions: any[] | null | void); + (payload.history.txids: any[] | null | void); + + if (payload.page) { + (payload.page.index: number); + (payload.page.size: number); + (payload.page.total: number); + } + + if (payload.marker) { + (payload.marker.ledger: number); + (payload.marker.seq: number); + } + + if (payload.misc) { + (payload.misc.nonce: string | null | void); + (payload.misc.sequence: number | null | void); + (payload.misc.reserve: string | null | void); + } + + // (payload.utxo: string); + // (payload.history: string); + // (payload.misc: string); + // (payload.page: string); + // (payload.marker: string); + } + + // bundle + const bundlePK = await TrezorConnect.getAccountInfo({ bundle: [{ path: 'm/44', coin: 'btc' }] }); + (bundlePK.success: boolean); + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + (item.empty: boolean); + }); + // $FlowIssue: payload is Address[] + (bundlePK.payload.xpub: string); + } else { + (bundlePK.payload.error: string); + } +}; + +export const signMessage = async () => { + const sign = await TrezorConnect.signMessage({ path: 'm/44', coin: 'btc', message: 'foo' }); + if (sign.success) { + const { payload } = sign; + (payload.address: string); + (payload.signature: string); + } + const verify = await TrezorConnect.verifyMessage({ address: 'a', signature: 'a', message: 'foo', coin: 'btc' }); + if (verify.success) { + const { payload } = verify; + (payload.message: string); + } +}; diff --git a/src/js/types/__tests__/blockchain.js b/src/js/types/__tests__/blockchain.js new file mode 100644 index 000000000..b87a66f12 --- /dev/null +++ b/src/js/types/__tests__/blockchain.js @@ -0,0 +1,105 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const blockchainEstimateFee = async () => { + const levels = [ + { + label: 'high', + blocks: 1, + feeLimit: '100', + feePerTx: '100', + feePerUnit: '100', + }, + { + label: 'normal', + feePerUnit: '100', + blocks: 0, + }, + { + label: 'economy', + feePerUnit: '100', + blocks: 0, + }, + { + label: 'low', + feePerUnit: '100', + blocks: 0, + }, + { + label: 'custom', + feePerUnit: '100', + blocks: 0, + }, + ]; + + const simple = await TrezorConnect.blockchainEstimateFee({ coin: 'btc' }); + if (simple.success) { + const { payload } = simple; + (payload.blockTime: number); + (payload.minFee: number); + (payload.maxFee: number); + (payload.levels: typeof levels); + } + + TrezorConnect.blockchainEstimateFee({ + coin: 'btc', + request: { + blocks: [0], + specific: { + conservative: true, + data: '0x', + from: '0x', + to: '0x', + txsize: 100, + }, + feeLevels: 'smart', + }, + }); + + TrezorConnect.blockchainEstimateFee({ + coin: 'btc', + request: { + feeLevels: 'preloaded', + }, + }); +}; + +export const blockchainGetTransactions = async () => { + const txs = await TrezorConnect.blockchainGetTransactions({ coin: 'btc', txs: ['txid'] }); + if (txs.success) { + const { payload } = txs; + payload.forEach(tx => { + if (tx.type === 'blockbook') { + // (tx.vin: any[]); + } + }); + } +}; + +export const others = async () => { + const accounts = [ + { + descriptor: 'xpub', + addresses: { + used: [], + unused: [], + change: [], + }, + }, + { + descriptor: '0x00', + }, + ]; + + TrezorConnect.blockchainSubscribe({ + accounts, + coin: 'btc', + }); + + TrezorConnect.blockchainUnsubscribe({ + accounts, + coin: 'btc', + }); + + TrezorConnect.blockchainDisconnect({ coin: 'btc' }); +}; diff --git a/src/js/types/__tests__/cardano.js b/src/js/types/__tests__/cardano.js new file mode 100644 index 000000000..1541970c9 --- /dev/null +++ b/src/js/types/__tests__/cardano.js @@ -0,0 +1,119 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const cardanoGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.cardanoGetAddress({ path: 'm/44' }); + (singleAddress.success: boolean); + if (singleAddress.success) { + const { payload } = singleAddress; + (payload.address: string); + (payload.path: number[]); + (payload.serializedPath: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.address: string); + }); + } + + // bundle + const bundleAddress = await TrezorConnect.cardanoGetAddress({ bundle: [{ path: 'm/44' }] }); + (bundleAddress.success: boolean); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + (item.address: string); + (item.path: number[]); + (item.serializedPath: string); + }); + // $FlowIssue: payload is Address[] + (bundleAddress.payload.address: string); + } else { + (bundleAddress.payload.error: string); + } + + // with all possible params + TrezorConnect.cardanoGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // $FlowIssue + TrezorConnect.cardanoGetAddress(); + // $FlowIssue + TrezorConnect.cardanoGetAddress({ coin: 'btc' }); + // $FlowIssue + TrezorConnect.cardanoGetAddress({ path: 1 }); + // $FlowIssue + TrezorConnect.cardanoGetAddress({ bundle: 1 }); +}; + +export const cardanoGetPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.cardanoGetPublicKey({ path: 'm/44' }); + (singlePK.success: boolean); + if (singlePK.success) { + const { payload } = singlePK; + (payload.path: number[]); + (payload.serializedPath: string); + (payload.publicKey: string); + (payload.node: Object); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.path: string); + }); + } + + // bundle + const bundlePK = await TrezorConnect.cardanoGetPublicKey({ bundle: [{ path: 'm/44' }] }); + (bundlePK.success: boolean); + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + (item.path: number[]); + (item.serializedPath: string); + (item.publicKey: string); + (item.node: Object); + }); + // $FlowIssue: payload is Address[] + (bundlePK.payload.path: string); + } else { + (bundlePK.payload.error: string); + } +}; + +export const cardanoSignTransaction = async () => { + const sign = await TrezorConnect.cardanoSignTransaction({ + inputs: [ + { + prev_hash: '1af..', + path: 'm/44', + prev_index: 0, + type: 0, + }, + ], + outputs: [ + { + address: 'Ae2..', + amount: '3003112', + }, + ], + transactions: ['txid'], + protocol_magic: 764824073, + }); + + if (sign.success) { + const { payload } = sign; + (payload.hash: string); + (payload.body: string); + } +}; diff --git a/src/js/types/__tests__/eos.js b/src/js/types/__tests__/eos.js new file mode 100644 index 000000000..f7a7d4724 --- /dev/null +++ b/src/js/types/__tests__/eos.js @@ -0,0 +1,247 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const eosGetPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.eosGetPublicKey({ path: 'm/44' }); + (singlePK.success: boolean); + if (singlePK.success) { + const { payload } = singlePK; + (payload.path: number[]); + (payload.serializedPath: string); + (payload.wifPublicKey: string); + (payload.rawPublicKey: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.path: string); + }); + } + + // bundle + const bundlePK = await TrezorConnect.eosGetPublicKey({ bundle: [{ path: 'm/44' }] }); + (bundlePK.success: boolean); + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + (item.path: number[]); + (item.serializedPath: string); + (item.wifPublicKey: string); + (item.rawPublicKey: string); + }); + // $FlowIssue: payload is Address[] + (bundlePK.payload.path: string); + } else { + (bundlePK.payload.error: string); + } +}; + +export const eosSignTransaction = async () => { + const common = { + account: 'eosio.token', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + }; + + const sign = await TrezorConnect.eosSignTransaction({ + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [ + { + ...common, + name: 'transfer', + data: { + from: 'miniminimini', + to: 'maximaximaxi', + quantity: '1.0000 EOS', + memo: 'testtest', + }, + }, + { + ...common, + name: 'delegatebw', + data: { + from: 'miniminimini', + receiver: 'maximaximaxi', + stake_net_quantity: '1.0000 EOS', + stake_cpu_quantity: '1.0000 EOS', + transfer: true, + }, + }, + { + ...common, + name: 'undelegatebw', + data: { + from: 'miniminimini', + receiver: 'maximaximaxi', + unstake_net_quantity: '1.0000 EOS', + unstake_cpu_quantity: '1.0000 EOS', + }, + }, + { + ...common, + name: 'buyram', + data: { + payer: 'miniminimini', + receiver: 'miniminimini', + quant: '1000000000.0000 EOS', + }, + }, + { + ...common, + name: 'buyrambytes', + data: { + payer: 'miniminimini', + receiver: 'miniminimini', + bytes: 1023, + }, + }, + { + ...common, + name: 'sellram', + data: { + account: 'miniminimini', + bytes: 1024, + }, + }, + { + ...common, + name: 'voteproducer', + data: { + voter: 'miniminimini', + proxy: '', + producers: ['argentinaeos'], + }, + }, + { + ...common, + name: 'refund', + data: { + owner: 'miniminimini', + }, + }, + { + ...common, + name: 'updateauth', + data: { + account: 'miniminimini', + permission: 'active', + parent: 'owner', + auth: { + threshold: 1, + keys: [ + { + weight: 1, + key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', + }, + { + weight: 2, + key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', + }, + ], + accounts: [{ + permission: { + actor: 'miniminimini', + permission: 'active', + }, + weight: 3, + }], + waits: [ + { + wait_sec: 55, + weight: 4, + }, + ], + }, + }, + }, + { + ...common, + name: 'deleteauth', + data: { + account: 'maximaximaxi', + permission: 'active', + }, + }, + { + ...common, + name: 'linkauth', + data: { + account: 'maximaximaxi', + code: 'eosbet', + type: 'whatever', + requirement: 'active', + }, + }, + { + ...common, + name: 'unlinkauth', + data: { + account: 'miniminimini', + code: 'eosbet', + type: 'whatever', + }, + }, + { + ...common, + name: 'newaccount', + data: { + creator: 'miniminimini', + name: 'maximaximaxi', + owner: { + threshold: 1, + keys: [ + { + key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', + weight: 1, + }, + ], + accounts: [], + waits: [], + }, + active: { + threshold: 1, + keys: [ + { + key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', + weight: 1, + }, + ], + accounts: [], + waits: [], + }, + }, + }, + { + ...common, + name: 'setcode', + data: '0000', + }, + { + ...common, + name: 'setabi', + data: '0000', + }, + { + ...common, + name: 'bar-action', + data: '0000', + }, + ], + }, + }); + + if (sign.success) { + const { payload } = sign; + (payload.signature: string); + } +}; diff --git a/src/js/types/__tests__/ethereum.js b/src/js/types/__tests__/ethereum.js new file mode 100644 index 000000000..bb4dbbb7f --- /dev/null +++ b/src/js/types/__tests__/ethereum.js @@ -0,0 +1,138 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const ethereumGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.ethereumGetAddress({ path: 'm/44' }); + (singleAddress.success: boolean); + if (singleAddress.success) { + const { payload } = singleAddress; + (payload.address: string); + (payload.path: number[]); + (payload.serializedPath: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.address: string); + }); + } + + // bundle + const bundleAddress = await TrezorConnect.ethereumGetAddress({ bundle: [{ path: 'm/44' }] }); + (bundleAddress.success: boolean); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + (item.address: string); + (item.path: number[]); + (item.serializedPath: string); + }); + // $FlowIssue: payload is Address[] + (bundleAddress.payload.address: string); + } else { + (bundleAddress.payload.error: string); + } + + // with all possible params + TrezorConnect.ethereumGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: '0x', + showOnTrezor: true, + }); + + // with invalid params + // $FlowIssue + TrezorConnect.ethereumGetAddress(); + // $FlowIssue + TrezorConnect.ethereumGetAddress({ coin: 'btc' }); + // $FlowIssue + TrezorConnect.ethereumGetAddress({ path: 1 }); + // $FlowIssue + TrezorConnect.ethereumGetAddress({ bundle: 1 }); +}; + +export const ethereumGetPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.ethereumGetPublicKey({ path: 'm/44' }); + (singlePK.success: boolean); + if (singlePK.success) { + const { payload } = singlePK; + (payload.path: number[]); + (payload.serializedPath: string); + (payload.xpub: string); + (payload.xpubSegwit: string | void); + (payload.chainCode: string); + (payload.childNum: number); + (payload.publicKey: string); + (payload.fingerprint: number); + (payload.depth: number); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.path: string); + }); + } + + // bundle + const bundlePK = await TrezorConnect.ethereumGetPublicKey({ bundle: [{ path: 'm/44' }] }); + (bundlePK.success: boolean); + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + (item.path: number[]); + (item.serializedPath: string); + (item.xpub: string); + (item.xpubSegwit: string | void); + (item.chainCode: string); + (item.childNum: number); + (item.publicKey: string); + (item.fingerprint: number); + (item.depth: number); + }); + // $FlowIssue: payload is Address[] + (bundlePK.payload.path: string); + } else { + (bundlePK.payload.error: string); + } +}; + +export const ethereumSignTransaction = async () => { + const sign = await TrezorConnect.ethereumSignTransaction({ + path: 'm/44', + transaction: { + nonce: '0x0', + gasPrice: '0x14', + gasLimit: '0x14', + to: '0xd0d6d6c5fe4a677d343cc433536bb717bae167dd', + chainId: 1, + value: '0x0', + data: '0xa', + }, + }); + + if (sign.success) { + const { payload } = sign; + (payload.r: string); + (payload.s: string); + (payload.v: string); + } +}; + +export const signMessage = async () => { + const sign = await TrezorConnect.ethereumSignMessage({ path: 'm/44', message: 'foo', hex: false }); + if (sign.success) { + const { payload } = sign; + (payload.address: string); + (payload.signature: string); + } + const verify = await TrezorConnect.ethereumVerifyMessage({ address: 'a', signature: 'a', message: 'foo', hex: false }); + if (verify.success) { + const { payload } = verify; + (payload.message: string); + } +}; diff --git a/src/js/types/__tests__/index.js b/src/js/types/__tests__/index.js new file mode 100644 index 000000000..eca90a83f --- /dev/null +++ b/src/js/types/__tests__/index.js @@ -0,0 +1,151 @@ +/* @flow */ +// TrezorConnect API types tests + +// Exported constants +/* eslint-disable no-unused-vars */ +import TrezorConnect, { + UI_EVENT, + DEVICE_EVENT, + RESPONSE_EVENT, + TRANSPORT_EVENT, + BLOCKCHAIN_EVENT, + BLOCKCHAIN, + DEVICE, + ERRORS, + IFRAME, + POPUP, + TRANSPORT, + UI, +} from '../../index'; +/* eslint-disable no-unused-vars */ + +// Exported types +import type { + API, + Device, + DeviceStatus, + FirmwareRelease, + DeviceFirmwareStatus, + DeviceMode, + Features, + AccountInfo, + EthereumAddress, +} from '../../index'; + +export const init = async () => { + const manifest = { appUrl: '', email: '' }; + TrezorConnect.init({ manifest }); + // $FlowIssue: invalid params + TrezorConnect.init(); + // $FlowIssue: invalid params + TrezorConnect.init({}); + // $FlowIssue: invalid params + TrezorConnect.init({ manifest: { appUrl: '', email: '' }, connectSrc: undefined }); + + TrezorConnect.manifest(manifest); + // $FlowIssue: invalid params + TrezorConnect.manifest({}); + // $FlowIssue: invalid params + TrezorConnect.manifest({ appUrl: 1 }); + // $FlowIssue: invalid params + TrezorConnect.manifest({ email: 1 }); + + const settings = await TrezorConnect.getSettings(); + if (settings.success) { + const { payload } = settings; + (payload.manifest: typeof manifest | null | void); + (payload.connectSrc: string | void); + (payload.debug: boolean | void); + (payload.popup: boolean | void); + (payload.lazyLoad: boolean | void); + (payload.webusb: boolean | void); + (payload.pendingTransportEvent: boolean | void); + (payload.pendingTransportEvent: boolean | void); + } + + TrezorConnect.dispose(); + TrezorConnect.cancel(); + TrezorConnect.cancel('Interruption error'); + TrezorConnect.renderWebUSBButton(); + TrezorConnect.disableWebUSB(); +}; + +export const events = async () => { + TrezorConnect.on(DEVICE_EVENT, event => { + const { payload } = event; + (event.type: 'device-connect' | 'device-connect_unacquired' | 'device-changed' | 'device-disconnect'); + (payload.path: string); + (payload.type: 'acquired' | 'unacquired' | 'unreadable'); + if (payload.type === 'acquired') { + (payload.mode: 'normal' | 'bootloader' | 'initialize' | 'seedless'); + (payload.firmware: 'valid' | 'outdated' | 'required' | 'unknown' | 'none'); + (payload.status: 'available' | 'occupied' | 'used'); + } + }); + TrezorConnect.off(DEVICE_EVENT, () => {}); + // $FlowIssue: invalid event type + TrezorConnect.off('DEVICE---EVENT', () => {}); + + TrezorConnect.on(TRANSPORT_EVENT, event => { + if (event.type === TRANSPORT.START) { + event.payload.type; + event.payload.version; + event.payload.outdated; + } + if (event.type === TRANSPORT.ERROR) { + event.payload.bridge; + } + }); + TrezorConnect.off(TRANSPORT_EVENT, () => {}); + + TrezorConnect.on(UI_EVENT, event => { + if (event.type === UI.BUNDLE_PROGRESS) { + event.payload.progress; + event.payload.error; + event.payload.response; + } + if (event.type === UI.REQUEST_BUTTON) { + event.payload.code; + event.payload.data; + event.payload.device; + } + }); + TrezorConnect.off(UI_EVENT, () => {}); + + TrezorConnect.on(UI.BUNDLE_PROGRESS, event => { + event.progress; + event.error; + event.response.empty; + event.response.availableBalance; + }); + + TrezorConnect.on(UI.BUNDLE_PROGRESS, event => { + event.progress; + event.error; + event.response.serializedPath; + event.response.address; + }); + + TrezorConnect.on(UI.REQUEST_BUTTON, event => { + event.code; + event.data; + event.device; + }); + + TrezorConnect.on(BLOCKCHAIN_EVENT, event => { + if (event.type === BLOCKCHAIN.CONNECT) { + event.payload.blockHash; + event.payload.shortcut; + event.payload.testnet; + } + if (event.type === BLOCKCHAIN.BLOCK) { + event.payload.blockHash; + event.payload.blockHeight; + } + if (event.type === BLOCKCHAIN.NOTIFICATION) { + event.payload.notification.descriptor; + event.payload.notification.tx; + } + }); + TrezorConnect.off(BLOCKCHAIN_EVENT, () => {}); +}; diff --git a/src/js/types/__tests__/lisk.js b/src/js/types/__tests__/lisk.js new file mode 100644 index 000000000..604791d90 --- /dev/null +++ b/src/js/types/__tests__/lisk.js @@ -0,0 +1,182 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const liskGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.liskGetAddress({ path: 'm/44' }); + (singleAddress.success: boolean); + if (singleAddress.success) { + const { payload } = singleAddress; + (payload.address: string); + (payload.path: number[]); + (payload.serializedPath: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.address: string); + }); + } + + // bundle + const bundleAddress = await TrezorConnect.liskGetAddress({ bundle: [{ path: 'm/44' }] }); + (bundleAddress.success: boolean); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + (item.address: string); + (item.path: number[]); + (item.serializedPath: string); + }); + // $FlowIssue: payload is Address[] + (bundleAddress.payload.address: string); + } else { + (bundleAddress.payload.error: string); + } + + // with all possible params + TrezorConnect.liskGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // $FlowIssue + TrezorConnect.liskGetAddress(); + // $FlowIssue + TrezorConnect.liskGetAddress({ coin: 'btc' }); + // $FlowIssue + TrezorConnect.liskGetAddress({ path: 1 }); + // $FlowIssue + TrezorConnect.liskGetAddress({ bundle: 1 }); +}; + +export const liskGetPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.liskGetPublicKey({ path: 'm/44' }); + (singlePK.success: boolean); + if (singlePK.success) { + const { payload } = singlePK; + (payload.path: number[]); + (payload.serializedPath: string); + (payload.publicKey: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.path: string); + }); + } + + // bundle + const bundlePK = await TrezorConnect.liskGetPublicKey({ bundle: [{ path: 'm/44' }] }); + (bundlePK.success: boolean); + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + (item.path: number[]); + (item.serializedPath: string); + (item.publicKey: string); + }); + // $FlowIssue: payload is Address[] + (bundlePK.payload.path: string); + } else { + (bundlePK.payload.error: string); + } +}; + +export const liskSignTransaction = async () => { + const common = { + amount: '10000000', + recipientId: '9971262264659915921L', + timestamp: 57525937, + type: 0, + fee: '10000000', + }; + const sign = await TrezorConnect.liskSignTransaction({ + path: 'm/44', + transaction: { + ...common, + asset: { + multisignature: { + min: 2, + lifetime: 5, + keysgroup: [ + '+5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09', + '+922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa', + ], + }, + }, + }, + }); + + if (sign.success) { + const { payload } = sign; + (payload.signature: string); + } + + TrezorConnect.liskSignTransaction({ + path: 'm/44', + transaction: { + ...common, + asset: { + delegate: { + username: 'trezor_t', + }, + }, + }, + }); + + TrezorConnect.liskSignTransaction({ + path: 'm/44', + transaction: { + ...common, + asset: { + votes: [ + '+b002f58531c074c7190714523eec08c48db8c7cfc0c943097db1a2e82ed87f84', + '-ec111c8ad482445cfe83d811a7edd1f1d2765079c99d7d958cca1354740b7614', + ], + }, + }, + }); + + TrezorConnect.liskSignTransaction({ + path: 'm/44', + transaction: { + ...common, + asset: { + signature: { + publicKey: 'publicKey', + }, + }, + }, + }); + + TrezorConnect.liskSignTransaction({ + path: 'm/44', + transaction: { + ...common, + asset: { + data: '00', + }, + }, + }); +}; + +export const signMessage = async () => { + const sign = await TrezorConnect.liskSignMessage({ path: 'm/44', message: 'foo' }); + if (sign.success) { + const { payload } = sign; + (payload.publicKey: string); + (payload.signature: string); + } + const verify = await TrezorConnect.liskVerifyMessage({ publicKey: 'a', signature: 'a', message: 'foo' }); + if (verify.success) { + const { payload } = verify; + (payload.message: string); + } +}; diff --git a/src/js/types/__tests__/management.js b/src/js/types/__tests__/management.js new file mode 100644 index 000000000..de90c957b --- /dev/null +++ b/src/js/types/__tests__/management.js @@ -0,0 +1,47 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const management = async () => { + TrezorConnect.resetDevice({ + strength: 1, + label: 'My Trezor', + u2f_counter: 0, + pin_protection: true, + passphrase_protection: true, + skip_backup: false, + no_backup: false, + backup_type: 0, + }); + + TrezorConnect.wipeDevice({}); + + TrezorConnect.applyFlags({ + flags: 1, + }); + + TrezorConnect.applySettings({ + homescreen: 'string', + display_rotation: 180, + use_passphrase: true, + label: 'My Trezor', + }); + + TrezorConnect.backupDevice({}); + + TrezorConnect.changePin({ + remove: true, + }); + + TrezorConnect.firmwareUpdate({ + payload: new ArrayBuffer(0), + }); + + TrezorConnect.recoveryDevice({ + passphrase_protection: true, + pin_protection: true, + label: 'My Trezor', + type: 1, + dry_run: true, + word_count: 24, + }); +}; diff --git a/src/js/types/__tests__/misc.js b/src/js/types/__tests__/misc.js new file mode 100644 index 000000000..0e05d1797 --- /dev/null +++ b/src/js/types/__tests__/misc.js @@ -0,0 +1,97 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const cipherKeyValue = async () => { + const kv = await TrezorConnect.cipherKeyValue({ + path: 'm/44', + key: 'key', + value: 'hash', + askOnEncrypt: true, + askOnDecrypt: false, + iv: 'advanced', + }); + if (kv.success) { + (kv.payload.value: string); + } + + // bundle + const bundleKV = await TrezorConnect.cipherKeyValue({ bundle: [{ path: 'm/44', key: 'key' }] }); + (bundleKV.success: boolean); + if (bundleKV.success) { + bundleKV.payload.forEach(item => { + (item.value: string); + }); + // $FlowIssue: payload is Address[] + (bundleKV.payload.xpub: string); + } else { + (bundleKV.payload.error: string); + } +}; + +export const customMessage = async () => { + TrezorConnect.customMessage({ + messages: {}, + message: 'MyCustomSignTx', + params: { + inputs: { index: 1, hash: '0' }, + }, + callback: async (request: any) => { + if (request.type === 'MyCustomTxReq') { + return { + message: 'MyCustomTxAck', + params: { + index: 1, + }, + }; + } + return { message: 'MyCustomSigned' }; + }, + }); +}; + +// Method with mixed params +export const requestLogin = async () => { + // async call + const a = await TrezorConnect.requestLogin({ + callback: () => ({ + challengeHidden: 'a', + challengeVisual: 'b', + }), + }); + // const { success, payload } = a; + // if (success && payload.address) { + // (payload.address: string); + // } + // (payload: { error: string }); + (a.success: boolean); + if (a.success) { + (a.payload.address: string); + (a.payload.publicKey: string); + (a.payload.signature: string); + // $FlowIssue: error does not exists + (a.payload.error: string); + } else { + (a.payload.error: string); + // $FlowIssue: address does not exists + (a.payload.address: string); + } + // sync call + TrezorConnect.requestLogin({ + challengeHidden: 'a', + challengeVisual: 'b', + }); + + // $FlowIssue + TrezorConnect.requestLogin(); + // $FlowIssue + TrezorConnect.requestLogin({ callback: 'string' }); + // $FlowIssue + TrezorConnect.requestLogin({ challengeHidden: 'a' }); + // $FlowIssue + TrezorConnect.requestLogin({ challengeVisual: 1 }); +}; + +export const debugLink = async () => { + TrezorConnect.debugLinkDecision({ device: { path: '1' } }); + TrezorConnect.debugLinkGetState({ device: { path: '1' } }); +}; diff --git a/src/js/types/__tests__/nem.js b/src/js/types/__tests__/nem.js new file mode 100644 index 000000000..ae69c2078 --- /dev/null +++ b/src/js/types/__tests__/nem.js @@ -0,0 +1,246 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const nemGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.nemGetAddress({ path: 'm/44', network: 1 }); + (singleAddress.success: boolean); + if (singleAddress.success) { + const { payload } = singleAddress; + (payload.address: string); + (payload.path: number[]); + (payload.serializedPath: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.address: string); + }); + } + + // bundle + const bundleAddress = await TrezorConnect.nemGetAddress({ bundle: [{ path: 'm/44', network: 1 }] }); + (bundleAddress.success: boolean); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + (item.address: string); + (item.path: number[]); + (item.serializedPath: string); + }); + // $FlowIssue: payload is Address[] + (bundleAddress.payload.address: string); + } else { + (bundleAddress.payload.error: string); + } + + // with all possible params + TrezorConnect.nemGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + network: 1, + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // $FlowIssue + TrezorConnect.nemGetAddress(); + // $FlowIssue + TrezorConnect.nemGetAddress({ coin: 'btc' }); + // $FlowIssue + TrezorConnect.nemGetAddress({ path: 1 }); + // $FlowIssue + TrezorConnect.nemGetAddress({ bundle: 1 }); +}; + +export const nemSignTransaction = async () => { + const common = { + version: -1744830464, + timeStamp: 74649215, + fee: 2000000, + deadline: 74735615, + signer: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + }; + const sign = await TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x0101, + recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + amount: 2000000, + message: { + payload: '746573745f6e656d5f7472616e73616374696f6e5f7472616e73666572', + type: 1, + }, + }, + }); + + if (sign.success) { + const { payload } = sign; + (payload.data: string); + (payload.signature: string); + } + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x1001, + modifications: [ + { + modificationType: 1, + cosignatoryAccount: 'c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844', + }, + ], + minCosignatories: { + relativeChange: 3, + }, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x4002, + mosaicId: { + namespaceId: 'hellom', + name: 'Hello mosaic', + }, + supplyType: 1, + delta: 1, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x4002, + mosaicId: { + namespaceId: 'hellom', + name: 'Hello mosaic', + }, + supplyType: 1, + delta: 1, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x1004, + otherTrans: { + timeStamp: 2, + amount: 2000000, + deadline: 67890, + fee: 15000, + recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + type: 0x0101, + message: { + payload: '746573745f6e656d5f7472616e73616374696f6e5f7472616e73666572', + type: 1, + }, + version: -1744830464, + signer: 'c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844', + }, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x1002, + otherTrans: { + timeStamp: 2, + amount: 2000000, + deadline: 67890, + fee: 15000, + recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + type: 0x0101, + message: { + payload: '746573745f6e656d5f7472616e73616374696f6e5f7472616e73666572', + type: 1, + }, + version: -1744830464, + signer: 'c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844', + }, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x0801, + importanceTransfer: { + mode: 1, + publicKey: 'c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844', + }, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x2001, + newPart: 'ABCDE', + rentalFeeSink: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + parent: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + rentalFee: 1500, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x4001, + mosaicDefinition: { + id: { + namespaceId: 'hellom', + name: 'Hello mosaic', + }, + levy: { + type: 1, + fee: 1, + recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + mosaicId: { + namespaceId: 'hellom', + name: 'Hello mosaic', + }, + }, + description: 'lorem', + properties: [ + { + name: 'divisibility', + value: 'string', + }, + { + name: 'initialSupply', + value: 'string', + }, + { + name: 'supplyMutable', + value: 'string', + }, + { + name: 'transferable', + value: 'string', + }, + ], + }, + creationFeeSink: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + creationFee: 1500, + }, + }); +}; diff --git a/src/js/types/__tests__/ripple.js b/src/js/types/__tests__/ripple.js new file mode 100644 index 000000000..5e3f0f709 --- /dev/null +++ b/src/js/types/__tests__/ripple.js @@ -0,0 +1,82 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const rippleGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.rippleGetAddress({ path: 'm/44' }); + (singleAddress.success: boolean); + if (singleAddress.success) { + const { payload } = singleAddress; + (payload.address: string); + (payload.path: number[]); + (payload.serializedPath: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.address: string); + }); + } + + // bundle + const bundleAddress = await TrezorConnect.rippleGetAddress({ bundle: [{ path: 'm/44' }] }); + (bundleAddress.success: boolean); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + (item.address: string); + (item.path: number[]); + (item.serializedPath: string); + }); + // $FlowIssue: payload is Address[] + (bundleAddress.payload.address: string); + } else { + (bundleAddress.payload.error: string); + } + + // with all possible params + TrezorConnect.rippleGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // $FlowIssue + TrezorConnect.rippleGetAddress(); + // $FlowIssue + TrezorConnect.rippleGetAddress({ coin: 'btc' }); + // $FlowIssue + TrezorConnect.rippleGetAddress({ path: 1 }); + // $FlowIssue + TrezorConnect.rippleGetAddress({ bundle: 1 }); +}; + +export const rippleSignTransaction = async () => { + const sign = await TrezorConnect.rippleSignTransaction({ + path: 'm/44', + transaction: { + payment: { + amount: '100', + destination: '1', + destinationTag: 1, + }, + fee: '1', + flags: 1, + sequence: 1, + maxLedgerVersion: 1, + }, + }); + + if (sign.success) { + const { payload } = sign; + (payload.serializedTx: string); + (payload.signature: string); + } +}; diff --git a/src/js/types/__tests__/stellar.js b/src/js/types/__tests__/stellar.js new file mode 100644 index 000000000..e2b568c21 --- /dev/null +++ b/src/js/types/__tests__/stellar.js @@ -0,0 +1,280 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const stellarGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.stellarGetAddress({ path: 'm/44' }); + (singleAddress.success: boolean); + if (singleAddress.success) { + const { payload } = singleAddress; + (payload.address: string); + (payload.path: number[]); + (payload.serializedPath: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.address: string); + }); + } + + // bundle + const bundleAddress = await TrezorConnect.stellarGetAddress({ bundle: [{ path: 'm/44' }] }); + (bundleAddress.success: boolean); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + (item.address: string); + (item.path: number[]); + (item.serializedPath: string); + }); + // $FlowIssue: payload is Address[] + (bundleAddress.payload.address: string); + } else { + (bundleAddress.payload.error: string); + } + + // with all possible params + TrezorConnect.stellarGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // $FlowIssue + TrezorConnect.stellarGetAddress(); + // $FlowIssue + TrezorConnect.stellarGetAddress({ coin: 'btc' }); + // $FlowIssue + TrezorConnect.stellarGetAddress({ path: 1 }); + // $FlowIssue + TrezorConnect.stellarGetAddress({ bundle: 1 }); +}; + +export const stellarSignTransaction = async () => { + const sign = await TrezorConnect.stellarSignTransaction({ + path: 'm/44', + networkPassphrase: 'Test SDF Network ; September 2015', + transaction: { + source: 'GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW', + fee: 100, + sequence: '4294967296', + memo: { + type: 0, + }, + operations: [ + { + type: 'createAccount', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + startingBalance: '1000333000', + }, + { + type: 'accountMerge', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + }, + { + type: 'payment', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + asset: { + type: 0, + code: 'XLM', + }, + amount: '500111000', + }, + { + type: 'payment', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + amount: '500111000', + asset: { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + }, + { + type: 'payment', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + amount: '500111000', + asset: { + type: 2, + code: 'ABCDEFGHIJKL', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + }, + { + type: 'bumpSequence', + bumpTo: '9223372036854775807', + }, + { + type: 'setOptions', + inflationDest: 'GAFXTC5OV5XQD66T7WGOB2HUVUC3ZVJDJMBDPTVQYV3G3K7TUHC6CLBR', + }, + { + type: 'setOptions', + signer: { + type: 0, + key: '72187adb879c414346d77c71af8cce7b6eaa57b528e999fd91feae6b6418628e', + weight: 2, + }, + }, + { + type: 'setOptions', + medThreshold: 0, + }, + { + type: 'setOptions', + clearFlags: 0, + lowThreshold: 0, + highThreshold: 3, + }, + { + type: 'setOptions', + setFlags: 3, + masterWeight: 4, + homeDomain: 'hello', + }, + { + type: 'setOptions', + }, + { + type: 'setOptions', + homeDomain: '', + }, + { + type: 'manageData', + name: 'data', + value: '616263', // Buffer.from('abc').toString('hex') + }, + { + type: 'manageData', + name: 'data', + value: undefined, + }, + { + type: 'pathPayment', + sendAsset: { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + sendMax: '500111000', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + destAsset: { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + destAmount: '500111000', + }, + { + type: 'pathPayment', + sendAsset: { + type: 2, + code: 'ABCDEFGHIJKL', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + sendMax: '500111000', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + destAsset: { + type: 2, + code: 'ABCDEFGHIJKL', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + destAmount: '500111000', + path: [ + { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + { + type: 2, + code: 'ABCDEFGHIJKL', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + ], + }, + { + type: 'createPassiveOffer', + selling: { + type: 0, + code: 'XLM', + }, + buying: { + type: 0, + code: 'XLM', + }, + amount: '500111000', + price: { + n: 500111, + d: 10000, + }, + }, + { + type: 'createPassiveOffer', + selling: { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + buying: { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + amount: '500111000', + price: { + n: 500111, + d: 10000, + }, + }, + { + type: 'manageOffer', + selling: { + type: 0, + code: 'XLM', + }, + buying: { + type: 0, + code: 'XLM', + }, + amount: '500111000', + price: { + n: 500111, + d: 10000, + }, + offerId: '101', + }, + { + type: 'changeTrust', + line: { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + limit: '9223372036854775807', + }, + { + type: 'allowTrust', + trustor: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + assetType: 1, + assetCode: 'XLM', + authorize: true, + }, + ], + }, + }); + + if (sign.success) { + const { payload } = sign; + (payload.publicKey: string); + (payload.signature: string); + } +}; diff --git a/src/js/types/__tests__/tezos.js b/src/js/types/__tests__/tezos.js new file mode 100644 index 000000000..e8f3a180d --- /dev/null +++ b/src/js/types/__tests__/tezos.js @@ -0,0 +1,148 @@ +/* @flow */ +import TrezorConnect from '../../index'; + +export const tezosGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.tezosGetAddress({ path: 'm/44' }); + (singleAddress.success: boolean); + if (singleAddress.success) { + const { payload } = singleAddress; + (payload.address: string); + (payload.path: number[]); + (payload.serializedPath: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.address: string); + }); + } + + // bundle + const bundleAddress = await TrezorConnect.tezosGetAddress({ bundle: [{ path: 'm/44' }] }); + (bundleAddress.success: boolean); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + (item.address: string); + (item.path: number[]); + (item.serializedPath: string); + }); + // $FlowIssue: payload is Address[] + (bundleAddress.payload.address: string); + } else { + (bundleAddress.payload.error: string); + } + + // with all possible params + TrezorConnect.tezosGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // $FlowIssue + TrezorConnect.tezosGetAddress(); + // $FlowIssue + TrezorConnect.tezosGetAddress({ coin: 'btc' }); + // $FlowIssue + TrezorConnect.tezosGetAddress({ path: 1 }); + // $FlowIssue + TrezorConnect.tezosGetAddress({ bundle: 1 }); +}; + +export const tezosGetPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.tezosGetPublicKey({ path: 'm/44' }); + (singlePK.success: boolean); + if (singlePK.success) { + const { payload } = singlePK; + (payload.path: number[]); + (payload.serializedPath: string); + (payload.publicKey: string); + // $FlowIssue: payload is Address + payload.forEach(item => { + (item.path: string); + }); + } + + // bundle + const bundlePK = await TrezorConnect.tezosGetPublicKey({ bundle: [{ path: 'm/44' }] }); + (bundlePK.success: boolean); + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + (item.path: number[]); + (item.serializedPath: string); + (item.publicKey: string); + }); + // $FlowIssue: payload is Address[] + (bundlePK.payload.path: string); + } else { + (bundlePK.payload.error: string); + } +}; + +export const tezosSignTransaction = async () => { + const sign = await TrezorConnect.tezosSignTransaction({ + path: "m/44'/1729'/10'", + branch: 'BLGUkzwvguFu8ei8eLW3KgCbdtrMmv1UCqMvUpHHTGq1UPxypHS', + operation: { + transaction: { + source: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo', + destination: 'tz1Kef7BSg6fo75jk37WkKRYSnJDs69KVqt9', + counter: 297, + amount: 200000, + fee: 10000, + gas_limit: 44825, + storage_limit: 0, + parameters_manager: { + set_delegate: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo', + cancel_delegate: true, + transfer: { + amount: 200, + destination: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo', + }, + }, + }, + reveal: { + source: 'tz1ekQapZCX4AXxTJhJZhroDKDYLHDHegvm1', + counter: 575424, + fee: 10000, + gas_limit: 20000, + storage_limit: 0, + public_key: 'edpkuTPqWjcApwyD3VdJhviKM5C13zGk8c4m87crgFarQboF3Mp56f', + }, + origination: { + source: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo', + balance: 100000, + fee: 20000, + counter: 298, + gas_limit: 20000, + storage_limit: 10000, + script: '0000001c02000000170500036805010368050202000000080316053d036d03420000000a010000000568656c6c6f', + }, + delegation: { + source: 'tz1Kef7BSg6fo75jk37WkKRYSnJDs69KVqt9', + delegate: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo', + fee: 20000, + counter: 564565, + gas_limit: 20000, + storage_limit: 0, + }, + }, + }); + + if (sign.success) { + const { payload } = sign; + (payload.sig_op_contents: string); + (payload.signature: string); + (payload.operation_hash: string); + } +}; diff --git a/src/js/types/account.js b/src/js/types/account.js index b770cf555..928d4fcda 100644 --- a/src/js/types/account.js +++ b/src/js/types/account.js @@ -1,147 +1,258 @@ /* @flow */ +import type { TransactionInput, TransactionOutput } from './trezor/protobuf'; + +// getAccountInfo params +export type GetAccountInfo = { + coin: string; + path?: string; + descriptor?: string; + details?: 'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txs'; + tokens?: 'nonzero' | 'used' | 'derived'; + page?: number; + pageSize?: number; + from?: number; + to?: number; + contractFilter?: string; + gap?: number; + marker?: { + ledger: number; + seq: number; + }; +} + +export type TokenInfo = { + type: string; // token type: ERC20... + address: string; // token address + balance?: string; // token balance + name?: string; // token name + symbol?: string; // token symbol + decimals: number; // token decimals or 0 + // transfers: number, // total transactions? +} + +export type AccountAddress = { + address: string; + path: string; + transfers: number; + balance?: string; + sent?: string; + received?: string; +} + +export type AccountAddresses = { + change: AccountAddress[]; + used: AccountAddress[]; + unused: AccountAddress[]; +} + +export type AccountUtxo = { + txid: string; + vout: number; + amount: string; + blockHeight: number; + address: string; + path: string; + confirmations: number; + coinbase?: boolean; +} // Transaction object type TokenTransfer = { - type: 'sent' | 'recv' | 'self' | 'unknown', - name: string, - symbol: string, - address: string, - decimals: number, - amount: string, - from?: string, - to?: string, -}; + type: 'sent' | 'recv' | 'self' | 'unknown'; + name: string; + symbol: string; + address: string; + decimals: number; + amount: string; + from?: string; + to?: string; +} // Transaction object type TransactionTarget = { - addresses?: string[], - isAddress: boolean, - amount?: string, - coinbase?: string, -}; + addresses?: string[]; + isAddress: boolean; + amount?: string; + coinbase?: string; +} +// Transaction from @trezor/blockchain-link export type AccountTransaction = { - type: 'sent' | 'recv' | 'self' | 'unknown', + type: 'sent' | 'recv' | 'self' | 'unknown'; - txid: string, - blockTime?: number, - blockHeight?: number, - blockHash?: string, + txid: string; + blockTime?: number; + blockHeight?: number; + blockHash?: string; - amount: string, - fee?: string, - total?: string, // amount + total + amount: string; + fee: string; + // total?: string; // amount + total - targets: TransactionTarget[], - tokens: TokenTransfer[], - rbf?: boolean, + targets: TransactionTarget[]; + tokens: TokenTransfer[]; + rbf?: boolean; ethereumSpecific?: { - status: number, - nonce: number, - gasLimit: number, - gasUsed?: number, - gasPrice: string, - }, -}; - -type TokenInfo = { - type: string, // token type: ERC20... - address: string, // token address - balance: string, // token balance - name: string, // token name - symbol: string, // token symbol - decimals: number, // - // transfers: number, // total transactions? -}; - -type Address = { - address: string, - path: string, - transfers: number, - balance?: string, - sent?: string, - received?: string, -}; - -export type AccountAddresses = { - change: Address[], - used: Address[], - unused: Address[], -}; - -export type AccountUtxo = { - txid: string, - vout: number, - amount: string, - blockHeight: number, - address: string, - path: string, - confirmations: number, - coinbase?: boolean, + status: number; + nonce: number; + gasLimit: number; + gasUsed?: number; + gasPrice: string; + }; } +// getAccountInfo response from @trezor/blockchain-link export type AccountInfo = { - empty: boolean, - path: string, - descriptor: string, // address or xpub - balance: string, - availableBalance: string, - tokens?: TokenInfo[], // ethereum tokens - addresses?: AccountAddresses, // bitcoin addresses - utxo?: AccountUtxo[], // bitcoin utxo + empty: boolean; + path: string; + descriptor: string; // address or xpub + balance: string; + availableBalance: string; + tokens?: TokenInfo[]; // ethereum tokens + addresses?: AccountAddresses; // bitcoin addresses + utxo?: AccountUtxo[]; // bitcoin utxo history: { - total: number, // total transactions (unknown in ripple) - tokens?: number, // tokens transactions (unknown in ripple) - unconfirmed?: number, // unconfirmed transactions (unknown in ripple) - transactions?: AccountTransaction[], // list of transactions - txids?: string[], // not implemented - }, + total: number; // total transactions (unknown in ripple) + tokens?: number; // tokens transactions (unknown in ripple) + unconfirmed?: number; // unconfirmed transactions (unknown in ripple) + transactions?: AccountTransaction[]; // list of transactions + txids?: string[]; // not implemented + }; misc?: { // ETH - nonce?: string, + nonce?: string; // XRP - sequence?: number, - reserve?: string, - }, + sequence?: number; + reserve?: string; + }; page?: { // blockbook - index: number, - size: number, - total: number, - }, + index: number; + size: number; + total: number; + }; marker?: { // ripple-lib - ledger: number, - seq: number, - }, -} - -export type AccountInfoRequest = { - coin: string, - path?: string, - descriptor?: string, - details?: 'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txs', - tokens?: 'nonzero' | 'used' | 'derived', - page?: number, - pageSize?: number, - from?: number, - to?: number, - contractFilter?: string, - gap?: number, - marker?: { - ledger: number, - seq: number, - }, -}; + ledger: number; + seq: number; + }; +} + +// Compose transaction + +export type RegularOutput = { + address: string; + amount: string; + script_type?: 'PAYTOADDRESS'; +} + +export type InternalOutput = { + address_n: number[]; + amount: string; + script_type?: string; +} + +export type SendMaxOutput = { + type: 'send-max'; + address: string; +} + +export type OpReturnOutput = { + type: 'opreturn'; + dataHex: string; +} +export type NoAddressOutput = { + type: 'noaddress'; + amount: string; +} + +export type NoAddressSendMaxOutput = { + type: 'send-max-noaddress'; +} + +export type ComposeOutput = + | RegularOutput + | InternalOutput + | SendMaxOutput + | OpReturnOutput + | NoAddressOutput + | NoAddressSendMaxOutput; + +export type PrecomposeParams = { + outputs: ComposeOutput[]; + account: { + path: string; + addresses: AccountAddresses; + utxo: AccountUtxo[]; + }; + feeLevels: { + feePerUnit: string; + }[]; + coin: string; +} + +export type PrecomposedTransaction = + | { + type: 'error'; + error: string; + } + | { + type: 'nonfinal'; + max: string; + totalSpent: string; // all the outputs, no fee, no change + fee: string; + feePerByte: string; + bytes: number; + } + | { + type: 'final'; + max: string; + totalSpent: string; // all the outputs, no fee, no change + fee: string; + feePerByte: string; + bytes: number; + transaction: { + inputs: TransactionInput[]; + outputs: TransactionOutput[]; + }; + }; + +export type ComposeParams = { + outputs: ComposeOutput[]; + coin: string; + push?: boolean; + account?: typeof undefined; + feeLevels?: typeof undefined; +} export type DiscoveryAccountType = 'normal' | 'segwit' | 'legacy'; export type DiscoveryAccount = { - type: DiscoveryAccountType, - label: string, - descriptor: string, - address_n: number[], - empty?: boolean, - balance?: string, - addresses?: AccountAddresses, + type: DiscoveryAccountType; + label: string; + descriptor: string; + address_n: number[]; + empty?: boolean; + balance?: string; + addresses?: AccountAddresses; +} + +export type FeeLevel = { + label: 'high' | 'normal' | 'economy' | 'low' | 'custom'; + feePerUnit: string; + blocks: number; + feeLimit?: string; // eth gas limit + feePerTx?: string; // fee for BlockchainEstimateFeeParams.request.specific +} + +export type SelectFeeLevel = { + name: string; + fee: '0'; + disabled: true; +} | { + name: string; + fee: string; + feePerByte: string; + minutes: number; + total: string; } diff --git a/src/js/types/api.js b/src/js/types/api.js new file mode 100644 index 000000000..b1970e879 --- /dev/null +++ b/src/js/types/api.js @@ -0,0 +1,273 @@ +/* @flow */ +import * as CONSTANTS from '../constants'; +import * as P from './params'; +import * as Device from './trezor/device'; +import * as Mgmnt from './trezor/management'; +import * as Protobuf from './trezor/protobuf'; +import * as Account from './account'; + +import * as Bitcoin from './networks/bitcoin'; +import * as Binance from './networks/binance'; +import * as Cardano from './networks/cardano'; +import * as EOS from './networks/eos'; +import * as Ethereum from './networks/ethereum'; +import * as Lisk from './networks/lisk'; +import * as NEM from './networks/nem'; +import * as Ripple from './networks/ripple'; +import * as Stellar from './networks/stellar'; +import * as Tezos from './networks/tezos'; +import * as Misc from './misc'; + +import * as Events from './events'; +import * as Blockchain from './backend/blockchain'; + +interface Bundled { + (params: $Exact<{...$Exact, ...$Exact}>): P.Response; + (params: $Exact<{...$Exact, ...$Exact>}>): P.BundledResponse; +} + +interface Mixed { + (params: $Exact<{...$Exact, ...$Exact}>): P.Response; + (params: $Exact<{...$Exact, ...$Exact}>): P.Response; +} + +// type Method = (params: P.CommonParams & T) => P.Response; +type Method = (params: $Exact<{...$Exact, ...$Exact

}>) => P.Response; + +interface Emitter { + (type: typeof CONSTANTS.DEVICE_EVENT, cb: (event: Device.DeviceEvent) => void): void; + (type: typeof CONSTANTS.TRANSPORT_EVENT, cb: (event: Events.TransportEvent) => void): void; + (type: typeof CONSTANTS.UI_EVENT, cb: (event: Events.UiEvent) => void): void; + (type: typeof CONSTANTS.BLOCKCHAIN_EVENT, cb: (event: Blockchain.BlockchainEvent) => void): void; + + (type: $PropertyType, cb: () => void): void; + (type: $PropertyType, cb: (event: $PropertyType) => void): void; + (type: $PropertyType, cb: (event: $PropertyType) => void): void; + (type: $PropertyType, cb: (event: $PropertyType) => void): void; + (type: $PropertyType, cb: (event: $PropertyType) => void): void; + (type: $PropertyType, cb: (event: $PropertyType) => void): void; + (type: $PropertyType, cb: (event: $PropertyType) => void): void; + (type: $PropertyType, cb: (event: $PropertyType) => void): void; + (type: typeof CONSTANTS.UI.BUNDLE_PROGRESS, cb: (event: $PropertyType, 'payload'>) => void): void; + (type: $PropertyType, cb: (event: $PropertyType) => void): void; + (type: $PropertyType, cb: (event: $PropertyType) => void): void; +} + +export type API = { + /** + * Set TrezorConnect manifest. + */ + manifest: (params: P.Manifest) => void; + + /** + * Initializes TrezorConnect. + * `manifest` is required + */ + init: (settings: { manifest: P.Manifest } & $Shape) => Promise; + + /** + * Retrieves the settings that TrezorConnect was initialized with. + */ + getSettings: () => P.Response; + + dispose: () => void; + + cancel: (params?: string) => void; + + renderWebUSBButton: () => void; + + disableWebUSB: () => void; + + /** + * Event listeners + */ + on: Emitter; + off: Emitter; + + uiResponse: (response: Events.UiResponse) => void; + + /** + * Backend operations + */ + blockchainEstimateFee: Method; + blockchainGetTransactions: Method; + blockchainSubscribe: Method; + blockchainUnsubscribe: Method; + blockchainDisconnect: Method; + + /** + * Bitcoin and Bitcoin-like + * Display requested address derived by given BIP32 path on device and + * returns it to caller. User is asked to confirm the export on Trezor. + */ + getAddress: Bundled; + + /** + * Bitcoin and Bitcoin-like + * Retrieves BIP32 extended public derived by given BIP32 path. + * User is presented with a description of the requested key and asked to + * confirm the export. + */ + getPublicKey: Bundled; + + /** + * Bitcoin and Bitcoin-like + * Asks device to sign given inputs and outputs of pre-composed transaction. + * User is asked to confirm all transaction details on Trezor. + */ + signTransaction: Method; + + /** + * Bitcoin, Bitcoin-like, Ethereum-like, Ripple + * Broadcasts the transaction to the selected network. + */ + pushTransaction: Method; + + /** + * Bitcoin and Bitcoin-like + * Requests a payment from the users wallet to a set of given outputs. + * Internally a BIP-0044 account discovery is performed and user is presented + * with a list of accounts. After account selection user is presented with + * list of fee selection. After selecting a fee transaction is signed and + * returned in hexadecimal format. Change output is added automatically, if + * needed. + */ + composeTransaction: Mixed< + Account.ComposeParams, + Account.PrecomposeParams, + Bitcoin.SignedTransaction, + Account.PrecomposedTransaction[]>; + + /** + * Bitcoin, Bitcoin-like, Ethereum-like, Ripple + * Gets an info of specified account. + */ + getAccountInfo: Bundled; + + /** + * Bitcoin and Bitcoin-like + * Asks device to sign a message using the private key derived by given BIP32 + * path. + */ + signMessage: Method; + + /** + * Bitcoin and Bitcoin-like + * Asks device to verify a message using the signer address and signature. + */ + verifyMessage: Method; + + // Binance + binanceGetAddress: Bundled; + binanceGetPublicKey: Bundled; + binanceSignTransaction: Method; + + // Cardano (ADA) + cardanoGetAddress: Bundled; + cardanoGetPublicKey: Bundled; + cardanoSignTransaction: Method; + + // EOS + eosGetPublicKey: Bundled; + eosSignTransaction: Method; + + // Ethereum and Ethereum-like + ethereumGetAddress: Bundled; + ethereumGetPublicKey: Bundled; + ethereumSignTransaction: Bundled; + ethereumSignMessage: Method; + ethereumVerifyMessage: Method; + + // Lisk + liskGetAddress: Bundled; + liskGetPublicKey: Bundled; + liskSignTransaction: Bundled; + liskSignMessage: Method; + liskVerifyMessage: Method; + + // NEM + nemGetAddress: Bundled; + nemSignTransaction: Bundled; + + // Ripple + rippleGetAddress: Bundled; + rippleSignTransaction: Bundled; + + // Stellar + stellarGetAddress: Bundled; + stellarSignTransaction: Bundled; + + // // Tezos + tezosGetAddress: Bundled; + tezosGetPublicKey: Bundled; + tezosSignTransaction: Method; + + /** + * Challenge-response authentication via Trezor. + * To protect against replay attacks you should use a server-side generated + * and randomized challengeHidden for every attempt. You can also provide a + * visual challenge that will be shown on the device. + */ + requestLogin: Mixed; + + /** + * Asks device to encrypt value using the private key derived by given BIP32 + * path and the given key. IV is always computed automatically. + */ + cipherKeyValue: Bundled; + + /** + * Retrieves the set of features associated with the device. + */ + getFeatures: Method<{}, Device.Features>; + + /** + * Retrieves device state associated with passphrase. + */ + getDeviceState: Method<{}, Device.DeviceStateResponse>; + + /** + * Resets device to factory defaults and removes all private data. + */ + wipeDevice: Method<{}, P.DefaultMessage>; + + /** + * Performs device setup and generates a new seed. + */ + resetDevice: Method; + + /** + * Applies device setup + */ + applySettings: Method; + + /** + * Increment saved flag on device + */ + applyFlags: Method; + + /** + * Change pin + */ + changePin: Method; + + /** + * Sends FirmwareErase message followed by FirmwareUpdate message + */ + firmwareUpdate: Method; + + /** + * Asks device to initiate seed backup procedure + */ + backupDevice: Method<{}, P.DefaultMessage>; + + /** + * Ask device to initiate recovery procedure + */ + recoveryDevice: Method; + + // // Developer mode + customMessage: Method; + debugLinkDecision: Method<{}, { debugLink: true }>; + debugLinkGetState: Method<{}, { debugLink: true }>; +} diff --git a/src/js/types/backend/blockchain.js b/src/js/types/backend/blockchain.js new file mode 100644 index 000000000..ca91b4cd6 --- /dev/null +++ b/src/js/types/backend/blockchain.js @@ -0,0 +1,121 @@ +/* @flow */ +import { BLOCKCHAIN } from '../../constants'; +import type { CoinInfo } from '../networks/coinInfo'; +import type { AccountAddresses, AccountTransaction, FeeLevel } from '../account'; +import type { BlockbookTransaction, RippleLibTransaction } from './transactions'; +import type { CoreMessage } from '../params'; + +export type BlockchainInfo = { + coin: CoinInfo; + url: string; + blockHash: string; + blockHeight: number; + decimals: number; + name: string; + shortcut: string; + testnet: boolean; + version: string; + misc?: { + reserve?: string; + }; +} + +export type BlockchainBlock = { + blockHash: string; + blockHeight: number; + coin: CoinInfo; +} + +export type BlockchainError = { + coin: CoinInfo; + error: string; +} +export type BlockchainNotification = { + coin: CoinInfo; + notification: { + descriptor: string; + tx: AccountTransaction; + }; +} + +export type BlockchainSubscribeAccount = { + descriptor: string; + addresses?: AccountAddresses; // bitcoin addresses +} + +export type BlockchainSubscribe = { + accounts: BlockchainSubscribeAccount[]; + coin: string; +} + +export type BlockchainSubscribed = { + subscribed: boolean; +} + +export type BlockchainDisconnect = { + coin: string; +} + +export type BlockchainDisconnected = { + disconnected: boolean; +} + +export type BlockchainGetTransactions = { + coin: string; + txs: string[]; +} + +export type BlockchainTransactions = Array<{ + type: 'blockbook'; + tx: BlockbookTransaction; +} | { + type: 'ripple'; + tx: RippleLibTransaction; +}>; + +export type BlockchainEstimateFee = { + coin: string; + request?: { + blocks?: number[]; + specific?: { + conservative?: boolean; + data?: string; + from?: string; + to?: string; + txsize?: number; + }; + feeLevels?: 'preloaded' | 'smart'; + }; +} + +export type BlockchainEstimatedFee = { + blockTime: number; + minFee: number; + maxFee: number; + levels: FeeLevel[]; +} + +export type BlockchainEvent = +| { + type: typeof BLOCKCHAIN.CONNECT; + payload: BlockchainInfo; +} +| { + type: typeof BLOCKCHAIN.ERROR; + payload: BlockchainError; +} +| { + type: typeof BLOCKCHAIN.BLOCK; + payload: BlockchainBlock; +} +| { + type: typeof BLOCKCHAIN.NOTIFICATION; + payload: BlockchainNotification; +}; + +export interface BlockchainMessageBuilder { + (type: typeof BLOCKCHAIN.CONNECT, payload: BlockchainInfo): CoreMessage; + (type: typeof BLOCKCHAIN.BLOCK, payload: BlockchainBlock): CoreMessage; + (type: typeof BLOCKCHAIN.NOTIFICATION, payload: BlockchainNotification): CoreMessage; + (type: typeof BLOCKCHAIN.ERROR, payload: BlockchainError): CoreMessage; +} diff --git a/src/js/types/backend/transactions.js b/src/js/types/backend/transactions.js new file mode 100644 index 000000000..bf6f4498c --- /dev/null +++ b/src/js/types/backend/transactions.js @@ -0,0 +1,97 @@ +/* @flow */ + +// copy-paste from blockchain-link + +export type VinVout = { + n: number; + addresses?: string[]; + isAddress: boolean; + value?: string; + coinbase?: string; + txid?: string; + vout?: number; + sequence?: number; + hex?: string; +} + +export type BlockbookTransaction = { + txid: string; + version?: number; + vin: VinVout[]; + vout: VinVout[]; + blockHeight: number; + blockHash?: string; + confirmations: number; + blockTime: number; + value: string; + valueIn: string; + fees: string; + hex: string; + ethereumSpecific?: { + status: number; + nonce: number; + gasLimit: number; + gasUsed?: number; + gasPrice: string; + }; + tokenTransfers?: { + from?: string; + to?: string; + value: string; + token: string; + name: string; + symbol: string; + decimals?: number; + }[]; +} + +// ripple-lib + +type RippleLibAmount = { + value: string; + currency: string; + issuer?: string; + counterparty?: string; +} + +type RippleLibAdjustment = { + address: string; + amount: RippleLibAmount; + tag?: number; +} + +type RippleLibMemo = { + type?: string; + format?: string; + data?: string; +} + +type RippleLibOutcome = { + result: string; + ledgerVersion: number; + indexInLedger: number; + fee: string; + balanceChanges: { + [key: string]: RippleLibAmount[]; + }; + orderbookChanges: any; + timestamp?: string; +} + +export type RippleLibTransaction = { + type: string; + specification: { + source: RippleLibAdjustment; + destination: RippleLibAdjustment; + paths?: string; + memos?: RippleLibMemo[]; + invoiceID?: string; + allowPartialPayment?: boolean; + noDirectRipple?: boolean; + limitQuality?: boolean; + }; + outcome: RippleLibOutcome; + id: string; + address: string; + sequence: number; +} diff --git a/src/js/types/binance.js b/src/js/types/binance.js deleted file mode 100644 index 11e1ae13f..000000000 --- a/src/js/types/binance.js +++ /dev/null @@ -1,92 +0,0 @@ -/* @flow */ - -import type { $Path, $Common } from './params'; -import type { Unsuccessful$ } from './response'; -import type { - BinanceTransferMsg, - BinanceOrderMsg, - BinanceCancelMsg, - BinanceSignedTx, -} from './trezor'; - -// get address - -export type BinanceAddress = { - address: string, - path: Array, - serializedPath: string, -} - -export type $BinanceGetAddress = $Common & { - path: $Path, - showOnTrezor?: boolean, -} - -export type BinanceGetAddress$ = { - success: true, - payload: BinanceAddress, -} | Unsuccessful$; - -export type BinanceGetAddress$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -// get public key - -export type BinancePublicKey = { - publicKey: string, - path: Array, - serializedPath: string, -} - -export type $BinanceGetPublicKey = { - path: $Path, - showOnTrezor?: boolean, -} - -export type BinanceGetPublicKey$ = { - success: true, - payload: BinancePublicKey, -} | Unsuccessful$; - -export type BinanceGetPublicKey$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -// sign transaction -// fields taken from https://github.com/binance-chain/javascript-sdk/blob/master/src/tx/index.js - -export type BinanceTransaction = { - chain_id: string, - account_number?: number, // default 0 - memo?: string, - sequence?: number, // default 0 - source?: number, // default 0 - - transfer?: BinanceTransferMsg, - placeOrder?: BinanceOrderMsg, - cancelOrder?: BinanceCancelMsg, -} - -export type PreparedMessage = BinanceTransferMsg & { - type: 'BinanceTransferMsg', -} | BinanceOrderMsg & { - type: 'BinanceOrderMsg', -} | BinanceCancelMsg & { - type: 'BinanceCancelMsg', -} - -export type PreparedBinanceTransaction = BinanceTransaction & { - messages: PreparedMessage[], -} - -export type $BinanceSignTransaction = $Common & { - transaction: BinanceTransaction, -} - -export type BinanceSignTransaction$ = { - success: true, - payload: BinanceSignedTx, -} | Unsuccessful$; diff --git a/src/js/types/blockchainEvent.js b/src/js/types/blockchainEvent.js deleted file mode 100644 index 54d1d243b..000000000 --- a/src/js/types/blockchainEvent.js +++ /dev/null @@ -1,94 +0,0 @@ -/* @flow */ - -import * as BLOCKCHAIN from '../constants/blockchain'; -import type { CoreMessage } from './index'; -import type { CoinInfo } from './coinInfo'; - -export type BlockchainConnect = { - type: typeof BLOCKCHAIN.CONNECT, - payload: { - coin: CoinInfo, - url: string, - blockHash: string, - blockHeight: number, - decimals: number, - name: string, - shortcut: string, - testnet: boolean, - version: string, - }, -} - -export type BlockchainError = { - type: typeof BLOCKCHAIN.ERROR, - payload: { - coin: CoinInfo, - error: string, - }, -} - -export type BlockchainBlock = { - type: typeof BLOCKCHAIN.BLOCK, - payload: { - coin: CoinInfo, - blockHash: string, - blockHeight: number, - }, -} - -// copy-paste from blockchain-link -type BlockchainLinkInput = { - addresses: Array, - // amount: string, - // fee: string, - // total: string, -} - -type BlockchainLinkOutput = { - addresses: Array, - // amount: string, -} - -type BlockchainLinkToken = { - name: string, - shortcut: string, - value: string, -} - -export type BlockchainLinkTransaction = { - type: 'send' | 'recv', - timestamp: ?number, - blockHeight: ?number, - blockHash: ?string, - descriptor: string, - inputs: Array, - outputs: Array, - - hash: string, - amount: string, - fee: string, - total: string, - - tokens?: Array, - sequence?: number, // eth: nonce || ripple: sequence -} -// copy-paste from blockchain-link end - -export type BlockchainNotification = { - type: typeof BLOCKCHAIN.NOTIFICATION, - payload: { - coin: CoinInfo, - notification: BlockchainLinkTransaction, - }, -} - -export type BlockchainEvent = BlockchainConnect | BlockchainError | BlockchainBlock | BlockchainNotification; - -/* eslint-disable no-redeclare */ -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -/* eslint-enable no-redeclare */ - -export type BlockchainMessageFactory = typeof MessageFactory; diff --git a/src/js/types/cardano.js b/src/js/types/cardano.js deleted file mode 100644 index e46a20270..000000000 --- a/src/js/types/cardano.js +++ /dev/null @@ -1,87 +0,0 @@ -/* @flow */ - -// Cardano method parameters types - -import type { $Path, $Common } from './params'; -import type { Unsuccessful$ } from './response'; -import type { HDPubNode } from './trezor'; - -// GetAddress - -export type $CardanoGetPublicKey = $Common & { - path: $Path, - showOnTrezor?: boolean, -} - -export type CardanoPublicKey = { - path: Array, - serializedPath: string, - publicKey: string, - node: HDPubNode, -} - -export type CardanoGetPublicKey$ = $Common & { - success: true, - payload: CardanoPublicKey, -} | Unsuccessful$; - -export type CardanoGetPublicKey$$ = $Common & { - success: true, - payload: Array, -} | Unsuccessful$; - -// GetAddress - -export type $CardanoGetAddress = $Common & { - path: $Path, - showOnTrezor?: boolean, -} - -export type CardanoAddress = { - path: Array, - serializedPath: string, - address: string, -} - -export type CardanoGetAddress$ = $Common & { - success: true, - payload: CardanoAddress, -} | Unsuccessful$; - -export type CardanoGetAddress$$ = $Common & { - success: true, - payload: Array, -} | Unsuccessful$; - -// Sign transaction - -export type CardanoInput = { - path: $Path, - prev_hash: string, - prev_index: number, - type: number, -} -export type CardanoOutput = { - path: $Path, - amount: string, -} | { - address: string, - amount: string, -} - -export type $CardanoSignTransaction = $Common & { - inputs: Array, - outputs: Array, - transactions: Array, - protocol_magic: number, -} - -export type CardanoSignedTx = { - hash: string, - body: string, -} - -export type CardanoSignTransaction$ = { - success: true, - payload: CardanoSignedTx, -} | Unsuccessful$; diff --git a/src/js/types/coinInfo.js b/src/js/types/coinInfo.js deleted file mode 100644 index a659cf139..000000000 --- a/src/js/types/coinInfo.js +++ /dev/null @@ -1,130 +0,0 @@ -/* @flow */ - -type CoinSupport = { - connect: boolean, - // electrum not used, - trezor1: string, - trezor2: string, - // webwallet not used -}; - -// copy-paste from 'bitcoinjs-lib-zcash' module -type Network = { - messagePrefix: string, - bech32: ?string, - bip32: { - public: number, - private: number, - }, - pubKeyHash: number, - scriptHash: number, - wif: number, - dustThreshold: number, - bech32: ?string, - coin: string, -}; - -type BlockchainLink = { - type: string, - url: Array, -}; - -export type BitcoinNetworkInfo = { - +type: 'bitcoin', - // address_type: in Network - // address_type_p2sh: in Network - // bech32_prefix: in Network - // consensus_branch_id in Network - // bip115: not used - // bitcore: not used - // blockbook: not used - blockchainLink: ?BlockchainLink, - blocktime: number, - cashAddrPrefix: ?string, - label: string, // this is human readable format, could be different from "name" - name: string, // this is Trezor readable format - shortcut: string, - // cooldown not used - curveName: string, - // decred not used - defaultFees: {[level: string]: number}, - dustLimit: number, - forceBip143: boolean, - forkid: ?number, - // github: not used - hashGenesisBlock: string, - // key not used - // maintainer: not used - maxAddressLength: number, - maxFeeSatoshiKb: number, - minAddressLength: number, - minFeeSatoshiKb: number, - // name: same as coin_label - segwit: boolean, - // signed_message_header: in Network - slip44: number, - support: CoinSupport, - // uri_prefix not used - // version_group_id: not used - // website: not used - // xprv_magic: in Network - xPubMagic: number, - xPubMagicSegwitNative: ?number, - xPubMagicSegwit: ?number, - - // custom - network: Network, - isBitcoin: boolean, - hasTimestamp: boolean, - minFee: number, - maxFee: number, - // used in backend - blocks?: number, - decimals: number, -}; - -export type EthereumNetworkInfo = { - +type: 'ethereum', - blockchainLink: ?BlockchainLink, - blocktime: number, - chain: string, - chainId: number, - // key not used - defaultFees: { - label: string, - feePerUnit: string, - feeLimit: string, - }[], - minFee: number, - maxFee: number, - label: string, // compatibility - name: string, - shortcut: string, - rskip60: boolean, - slip44: number, - support: CoinSupport, - // url not used - network: typeof undefined, // compatibility - decimals: number, -}; - -export type MiscNetworkInfo = { - +type: 'misc' | 'nem', - blockchainLink: ?BlockchainLink, - blocktime: number, - curve: string, - // key not used - defaultFees: {[level: string]: number}, - minFee: number, - maxFee: number, - // links not used - label: string, // compatibility - name: string, - shortcut: string, - slip44: number, - support: CoinSupport, - network: typeof undefined, // compatibility - decimals: number, -}; - -export type CoinInfo = BitcoinNetworkInfo | EthereumNetworkInfo | MiscNetworkInfo; diff --git a/src/js/types/eos.js b/src/js/types/eos.js deleted file mode 100644 index ce5b82a26..000000000 --- a/src/js/types/eos.js +++ /dev/null @@ -1,163 +0,0 @@ -/* @flow */ - -import type { $Path, $Common } from './params'; -import type { Unsuccessful$ } from './response'; -import type { - EosPermissionLevel, - EosAuthorizationKey, - EosActionBuyRamBytes, - EosActionSellRam, - EosActionRefund, - EosActionDeleteAuth, - EosActionLinkAuth, - EosActionUnlinkAuth, - EosSignedTx, -} from './trezor'; - -// get public key - -export type EosPublicKey = { - wifPublicKey: string, - rawPublicKey: string, - path: Array, - serializedPath: string, -} - -export type $EosGetPublicKey = { - path: $Path, - showOnTrezor?: boolean, -} - -export type EosGetPublicKey$ = { - success: true, - payload: EosPublicKey, -} | Unsuccessful$; - -export type EosGetPublicKey$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -// sign tx - -export type EosTxHeader = { - expiration: number | string, - refBlockNum: number, - refBlockPrefix: number, - maxNetUsageWords: number, - maxCpuUsageMs: number, - delaySec: number, -} - -export type EosAuthorization = { - threshold: number, - keys: Array, - accounts: Array<{ - permission: EosPermissionLevel, - weight: number, - }>, - waits: Array<{ - wait_sec: number, - weight: number, - }>, -} - -type Action = { - account: string, - authorization: Array, -} - -export type EosTxAction = Action & { - name: 'transfer', - data: { - from: string, - to: string, - quantity: string, - memo?: string, - }, -} | Action & { - name: 'delegatebw', - data: { - from: string, - receiver: string, - stake_net_quantity: string, - stake_cpu_quantity: string, - transfer?: boolean, - }, -} | Action & { - name: 'undelegatebw', - data: { - from: string, - receiver: string, - unstake_net_quantity: string, - unstake_cpu_quantity: string, - }, -} | Action & { - name: 'buyram', - data: { - payer: string, - receiver: string, - quant: string, - }, -} | Action & { - name: 'buyrambytes', - data: EosActionBuyRamBytes, -} | Action & { - name: 'sellram', - data: EosActionSellRam, -} | Action & { - name: 'voteproducer', - data: { - voter: string, - proxy: string, - producers: Array, - }, -} | Action & { - name: 'refund', - data: EosActionRefund, -} | Action & { - name: 'updateauth', - data: { - account: string, - permission: string, - parent: string, - auth: EosAuthorization, - }, -} | Action & { - name: 'deleteauth', - data: EosActionDeleteAuth, -} | Action & { - name: 'linkauth', - data: EosActionLinkAuth, -} | Action & { - name: 'unlinkauth', - data: EosActionUnlinkAuth, -} | Action & { - name: 'newaccount', - data: { - creator: string, - name: string, - owner: EosAuthorization, - active: EosAuthorization, - }, -} - -export type Transaction = { - chainId: string, - header: ?EosTxHeader, - actions: Array, -} - -export type $EosSignTx = $Common & { - path: $Path, - transaction: { - chainId: string, - header: ?EosTxHeader, - actions: Array, - }, -} - -export type EosSignTx$ = { - success: true, - payload: EosSignedTx, -} | Unsuccessful$; diff --git a/src/js/types/ethereum.js b/src/js/types/ethereum.js deleted file mode 100644 index 1f19e7ff8..000000000 --- a/src/js/types/ethereum.js +++ /dev/null @@ -1,105 +0,0 @@ -/* @flow */ -// Ethereum types -// https://github.com/ethereumjs/ethereumjs-tx - -import type { $Path, $Common } from './params'; -import type { Unsuccessful$ } from './response'; -import type { - Success, - MessageSignature, - EthereumSignedTx, - HDNodeResponse, -} from './trezor'; - -export type Transaction = { - to: string, - value: string, - gasPrice: string, - gasLimit: string, - nonce: string, - data?: string, - chainId?: number, - txType?: number, - v: string, - r: string, - s: string, -} - -// get address - -export type EthereumAddress = { - address: string, - path: Array, - serializedPath: string, -} - -export type $EthereumGetAddress = { - path: $Path, - showOnTrezor?: boolean, -} - -export type EthereumGetAddress$ = { - success: true, - payload: EthereumAddress, -} | Unsuccessful$; - -export type EthereumGetAddress$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -// get public key - -export type $EthereumGetPublicKey = $Common & { - path: $Path, - showOnTrezor?: boolean, -} - -export type EthereumGetPublicKey$ = { - success: true, - payload: HDNodeResponse, -} | Unsuccessful$; - -export type EthereumGetPublicKey$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -// sign transaction - -export type $EthereumSignTransaction = $Common & { - path: $Path, - transaction: Transaction, -} - -export type EthereumSignTransaction$ = { - success: true, - payload: EthereumSignedTx, -} | Unsuccessful$; - -// sign message - -export type $EthereumSignMessage = $Common & { - path: $Path, - message: string, - hex?: boolean, -}; - -export type EthereumSignMessage$ = { - success: true, - payload: MessageSignature, -} | Unsuccessful$; - -// verify message - -export type $EthereumVerifyMessage = $Common & { - address: string, - message: string, - hex?: boolean, - signature: string, -} - -export type EthereumVerifyMessage$ = { - success: true, - payload: Success, -} | Unsuccessful$; diff --git a/src/js/types/events.js b/src/js/types/events.js new file mode 100644 index 000000000..2d411d7c6 --- /dev/null +++ b/src/js/types/events.js @@ -0,0 +1,349 @@ +/* @flow */ +import { + TRANSPORT, + UI, + IFRAME, + POPUP, +} from '../constants'; +import type { ConnectSettings, CoreMessage } from './params'; +import type { Device } from './trezor/device'; +import type { DiscoveryAccount, SelectFeeLevel } from './account'; +import type { CoinInfo, BitcoinNetworkInfo } from './networks/coinInfo'; + +export interface BridgeInfo { + version: number[]; + directory: string; + packages: Array<{ + name: string; + platform: string[]; + url: string; + signature?: string; + preferred?: boolean; + }>; + changelog: string; +} +export type TransportInfo = { + type: string; + version: string; + outdated: boolean; + bridge?: BridgeInfo; +} + +export type TransportEvent = + | { + type: typeof TRANSPORT.START; + payload: TransportInfo; + } + | { + type: typeof TRANSPORT.ERROR; + payload: { + error: string; + bridge?: BridgeInfo; + }; + }; + +/* +* messages to UI emitted as UI_EVENT +*/ + +export type MessageWithoutPayload = { + type: typeof UI.REQUEST_UI_WINDOW | + typeof POPUP.CANCEL_POPUP_REQUEST | + typeof IFRAME.LOADED | + typeof POPUP.LOADED | + typeof UI.TRANSPORT | + typeof UI.CHANGE_ACCOUNT | + typeof UI.INSUFFICIENT_FUNDS | + typeof UI.CLOSE_UI_WINDOW | + typeof UI.LOGIN_CHALLENGE_REQUEST; +} + +export type DeviceMessage = { + type: typeof UI.REQUEST_PIN | + typeof UI.INVALID_PIN | + typeof UI.REQUEST_PASSPHRASE_ON_DEVICE | + typeof UI.REQUEST_PASSPHRASE | + typeof UI.INVALID_PASSPHRASE | + typeof UI.REQUEST_WORD; + payload: { + device: Device; + type?: string; // todo: better flow enum + }; +}; + +export type ButtonRequestData = { + type: 'address'; + serializedPath: string; + address: string; +}; + +export type ButtonRequestMessage = { + type: typeof UI.REQUEST_BUTTON; + payload: { + device: Device; + code: string; + data: ?ButtonRequestData; + }; +} + +export type AddressValidationMessage = { + type: typeof UI.ADDRESS_VALIDATION; + payload: ?ButtonRequestData; +} + +export type IFrameError = { + type: typeof IFRAME.ERROR; + payload: { + error: string; + }; +} + +export type PopupInit = { + type: typeof POPUP.INIT; + payload: { + settings: ConnectSettings; // those are settings from window.opener + }; +} + +export type PopupError = { + type: typeof POPUP.ERROR; + payload: { + error: string; + }; +} + +export type PopupHandshake = { + type: typeof POPUP.HANDSHAKE; + payload?: { + settings: ConnectSettings; // those are settings from the iframe, they could be different from window.opener settings + method: ?string; + transport: ?TransportInfo; + }; +} + +export type RequestPermission = { + type: typeof UI.REQUEST_PERMISSION; + payload: { + permissions: Array; + device: Device; + }; +} + +export type RequestConfirmation = { + type: typeof UI.REQUEST_CONFIRMATION; + payload: { + view: string; + label?: string; + customConfirmButton?: { + className: string; + label: string; + }; + customCancelButton?: { + className: string; + label: string; + }; + }; +} + +export type SelectDevice = { + type: typeof UI.SELECT_DEVICE; + payload: { + devices: Array; + webusb: boolean; + }; +} + +export type UnexpectedDeviceMode = { + type: typeof UI.BOOTLOADER | typeof UI.NOT_IN_BOOTLOADER | typeof UI.INITIALIZE | typeof UI.SEEDLESS | typeof UI.DEVICE_NEEDS_BACKUP; + payload: Device; +} + +export type FirmwareException = { + type: typeof UI.FIRMWARE_OLD + | typeof UI.FIRMWARE_OUTDATED + | typeof UI.FIRMWARE_NOT_SUPPORTED + | typeof UI.FIRMWARE_NOT_COMPATIBLE + | typeof UI.FIRMWARE_NOT_INSTALLED; + payload: Device; +} + +export type SelectAccount = { + type: typeof UI.SELECT_ACCOUNT; + payload: { + type: 'start' | 'progress' | 'end'; + coinInfo: CoinInfo; + accountTypes?: Array<'normal' | 'segwit' | 'legacy'>; + accounts?: Array; + preventEmpty?: boolean; + }; +} + +export type SelectFee = { + type: typeof UI.SELECT_FEE; + payload: { + coinInfo: BitcoinNetworkInfo; + feeLevels: Array; + }; +} + +export type UpdateCustomFee = { + type: typeof UI.UPDATE_CUSTOM_FEE; + payload: { + coinInfo: BitcoinNetworkInfo; + feeLevels: Array; + }; +} + +export type BundleProgress = { + type: typeof UI.BUNDLE_PROGRESS; + payload: { + progress: number; + response: R; + error?: string; + }; +} + +export type FirmwareProgress = { + type: typeof UI.FIRMWARE_PROGRESS; + payload: { + device: Device; + progress: number; + }; +} + +/* +* Callback message for CustomMessage method +*/ +export type CustomMessageRequest = { + type: typeof UI.CUSTOM_MESSAGE_REQUEST; + payload: { + type: string; + message: Object; + }; +} + +export type UiEvent = + MessageWithoutPayload + | DeviceMessage + | ButtonRequestMessage + | PopupHandshake + | RequestPermission + | RequestConfirmation + | SelectDevice + | UnexpectedDeviceMode + | SelectAccount + | SelectFee + | UpdateCustomFee + | BundleProgress + | FirmwareProgress + | CustomMessageRequest; + +type ReceivePermission = { + type: typeof UI.RECEIVE_PERMISSION; + payload: { + granted: boolean; + remember: boolean; + }; +} + +type ReceiveConfirmation = { + type: typeof UI.RECEIVE_CONFIRMATION; + payload: boolean; +} + +type ReceiveDevice = { + type: typeof UI.RECEIVE_DEVICE; + payload: { + device: Device; + remember: boolean; + }; +} + +type ReceivePin = { + type: typeof UI.RECEIVE_PIN; + payload: string; +} + +type ReceiveWord = { + type: typeof UI.RECEIVE_WORD; + payload: string; +} + +type ReceivePassphrase = { + type: typeof UI.RECEIVE_PASSPHRASE; + payload: { + save: boolean; + value: string; + passphraseOnDevice?: boolean; + }; +} + +type ReceivePassphraseAction = { + type: typeof UI.INVALID_PASSPHRASE_ACTION; + payload: boolean; +} + +type ReceiveAccount = { + type: typeof UI.RECEIVE_ACCOUNT; + payload?: number; +} + +type ReceiveFee = { + type: typeof UI.RECEIVE_FEE; + payload: { + type: 'compose-custom'; + value: number; + } | { + type: 'change-account'; + } | { + type: 'send'; + value: string; + }; +} + +export type UiResponse = + ReceivePermission + | ReceiveConfirmation + | ReceiveDevice + | ReceivePin + | ReceiveWord + | ReceivePassphrase + | ReceivePassphraseAction + | ReceiveAccount + | ReceiveFee + | CustomMessageRequest; + +type FT = $PropertyType; +type FP = $PropertyType; + +export interface UiMessageBuilder { + (type: FT): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT>, payload: FP>): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + // ui response + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; + (type: FT, payload: FP): CoreMessage; +} diff --git a/src/js/types/fee.js b/src/js/types/fee.js deleted file mode 100644 index 9f0ef3ea2..000000000 --- a/src/js/types/fee.js +++ /dev/null @@ -1,28 +0,0 @@ -/* @flow */ - -export type SelectFeeLevel = { - name: string, - fee: '0', - disabled: true, -} | { - name: string, - fee: string, - feePerByte: string, - minutes: number, - total: string, -} - -export type FeeLevel = { - label: string, - feePerUnit: string, - feePerTx?: string, - feeLimit?: string, - blocks: number, -}; - -export type FeeInfo = { - blockTime: number, - minFee: number, - maxFee: number, - levels: FeeLevel[], -} diff --git a/src/js/types/index.js b/src/js/types/index.js index 6c85f2d49..fc52b1d18 100644 --- a/src/js/types/index.js +++ b/src/js/types/index.js @@ -1,324 +1,25 @@ /* @flow */ -/* -* Public types accessible from npm library -*/ - -import { UI_EVENT, DEVICE_EVENT, TRANSPORT_EVENT, BLOCKCHAIN_EVENT } from '../constants'; -import * as TRANSPORT from '../constants/transport'; -import * as POPUP from '../constants/popup'; -import * as IFRAME from '../constants/iframe'; -import * as UI from '../constants/ui'; -import * as DEVICE from '../constants/device'; - -export type CoreMessage = { - +event: string, - +type: string, - +payload: any, - - id?: number, // response id in ResponseMessage - success?: boolean, // response status in ResponseMessage -}; - -export type UiPromiseResponse = { - event: string, - payload: any, -}; - -// Override MessageEvent type to have access to "ports" field and typed "data" -export interface PostMessageEvent extends Event { - +origin: string, - +lastEventId: string, - +source: WindowProxy, - +ports: Array, - +data: ?CoreMessage, -} - -export type Deferred = { - id?: string, - device: ?any, - promise: Promise, - resolve: (t: T) => void, - reject: (e: Error) => void, -} - -export type FirmwareRange = { - '1': { - min: string, - max: string, - }, - '2': { - min: string, - max: string, - }, -} - -// copy/paste from trezor.js -export type Features = { - vendor: string, - major_version: number, - minor_version: number, - patch_version: number, - bootloader_mode: boolean, - device_id: string, - pin_protection: boolean, - passphrase_protection: boolean, - language: string, - label: string, - initialized: boolean, - revision: string, - bootloader_hash: string, - imported: boolean, - pin_cached: boolean, - passphrase_cached: boolean, - firmware_present: boolean, - needs_backup: boolean, - flags: number, - model: string, - fw_major: number, - fw_minor: number, - fw_patch: number, - fw_vendor: string, - fw_vendor_keys: string, - unfinished_backup: boolean, - no_backup: boolean, - session_id?: string, - passphrase_always_on_device?: boolean, - capabilities?: string[], -}; - -export type FirmwareRelease = { - required: true, - version: Array, - min_bridge_version: Array, - min_firmware_version: Array, - bootloader_version: Array, - min_bootloader_version: Array, - url: string, - channel: string, - fingerprint: string, - changelog: string, -}; - -export type DeviceStatus = 'available' | 'occupied' | 'used'; -export type DeviceMode = 'normal' | 'bootloader' | 'initialize' | 'seedless'; -export type DeviceFirmwareStatus = 'valid' | 'outdated' | 'required' | 'unknown' | 'none'; -export type UnavailableCapability = 'no-capability' | 'no-support' | 'update-required' | 'trezor-connect-outdated' | string[]; - -export type Device = $Exact<{ - +type: 'acquired', - +path: string, - +label: string, - +firmware: DeviceFirmwareStatus, - +firmwareRelease: ?FirmwareRelease, - +status: DeviceStatus, - +mode: DeviceMode, - state: ?string, - features: Features, - unavailableCapabilities: { [key: string]: UnavailableCapability }, -}> | $Exact<{ - +type: 'unacquired', - +path: string, - +label: string, - features?: typeof undefined, -}> | $Exact<{ - +type: 'unreadable', - +path: string, - +label: string, - features?: typeof undefined, -}> - -export type Settings = { - priority?: number, - connectSrc?: string, - popup?: boolean, - transportReconnect?: boolean, - webusb?: boolean, - pendingTransportEvent?: boolean, -}; - -export type T_POPUP = typeof POPUP; -export type DeviceMessageType = $Values; -export type DeviceMessage = { - event: typeof DEVICE_EVENT, - type: DeviceMessageType, - payload: Device, -} - -export type T_UI_EVENT = typeof UI_EVENT; -export type T_UI = typeof UI; -export type UiMessageType = $Values | typeof IFRAME.LOADED | typeof IFRAME.ERROR; -export type UiMessage = { - event: typeof UI_EVENT, - type: UiMessageType, - payload: { - device: Device, - code?: string, - browser?: any, - data?: any, - }, -} - -export type { UiResponse } from './uiResponse'; - -export type TransportMessageType = $Values; -export type TransportMessage = { - event: typeof TRANSPORT_EVENT, - type: TransportMessageType, - payload: Object, -} - -import type { BlockchainEvent } from './blockchainEvent'; - -/* eslint-disable no-redeclare */ -declare function F_EventListener(type: typeof DEVICE_EVENT, handler: (event: DeviceMessage) => void): void; -declare function F_EventListener(type: typeof UI_EVENT, handler: (event: UiMessage) => void): void; -declare function F_EventListener(type: typeof TRANSPORT_EVENT, handler: (event: TransportMessage) => void): void; -declare function F_EventListener(type: typeof BLOCKCHAIN_EVENT, handler: (event: BlockchainEvent) => void): void; -declare function F_EventListener(type: DeviceMessageType, handler: (device: Device) => void): void; -export type EventListener = typeof F_EventListener; - -import * as P from './params'; -import * as R from './response'; -import * as CARDANO from './cardano'; -import * as RIPPLE from './ripple'; -import * as ETHEREUM from './ethereum'; -import * as NEM from './nem'; -import * as STELLAR from './stellar'; -import * as LISK from './lisk'; -import * as TEZOS from './tezos'; -import * as EOS from './eos'; -import * as BINANCE from './binance'; - -// export type UiResponseFn = (settings: UiResponse) => void; -export type ChangeSettings = (settings: Settings) => void; -export type BlockchainDisconnect = (P.$BlockchainDisconnect) => Promise; -export type BlockchainEstimateFee = (P.$BlockchainEstimateFee) => Promise; -export type BlockchainGetTransactions = (P.$BlockchainGetTransactions) => Promise; -export type BlockchainSubscribe = (P.$BlockchainSubscribe) => Promise; -export type CustomMessage = (P.$CustomMessage) => Promise; -export type RequestLogin = (P.$RequestLogin) => Promise; -export type ResetDevice = (P.$ResetDevice) => Promise; - -declare function F_CardanoGetAddress(params: (P.$Common & CARDANO.$CardanoGetAddress)): Promise; -declare function F_CardanoGetAddress(params: (P.$Common & { bundle: Array })): Promise; -export type CardanoGetAddress = typeof F_CardanoGetAddress; - -declare function F_CardanoGetPublicKey(params: (P.$Common & CARDANO.$CardanoGetPublicKey)): Promise; -declare function F_CardanoGetPublicKey(params: (P.$Common & { bundle: Array })): Promise; -export type CardanoGetPublicKey = typeof F_CardanoGetPublicKey; - -export type CardanoSignTransaction = (CARDANO.$CardanoSignTransaction) => Promise; - -declare function F_TezosGetAddress(params: (P.$Common & TEZOS.$TezosGetAddress)): Promise; -declare function F_TezosGetAddress(params: (P.$Common & { bundle: Array })): Promise; -export type TezosGetAddress = typeof F_TezosGetAddress; - -declare function F_TezosGetPublicKey(params: (P.$Common & TEZOS.$TezosGetPublicKey)): Promise; -declare function F_TezosGetPublicKey(params: (P.$Common & { bundle: Array })): Promise; -export type TezosGetPublicKey = typeof F_TezosGetPublicKey; -export type TezosSignTransaction = (TEZOS.$TezosSignTransaction) => Promise; - -declare function F_CipherKeyValue(params: (P.$Common & P.$CipherKeyValue)): Promise; -declare function F_CipherKeyValue(params: (P.$Common & { bundle: Array })): Promise; -export type CipherKeyValue = typeof F_CipherKeyValue; - -declare function F_ComposeTransaction(params: (P.$Common & P.$ComposeTransaction)): Promise; -declare function F_ComposeTransaction(params: (P.$Common & P.$$ComposeTransaction)): Promise; -export type ComposeTransaction = typeof F_ComposeTransaction; -// export type ComposeTransaction = (P.$ComposeTransaction) => Promise; - -export type DebugLinkDecision = (P.$DebugLinkDecision) => Promise; -export type DebugLinkGetState = (P.$DebugLinkGetState) => Promise; - -declare function F_EthereumGetAddress(params: (P.$Common & ETHEREUM.$EthereumGetAddress)): Promise; -declare function F_EthereumGetAddress(params: (P.$Common & { bundle: Array })): Promise; -export type EthereumGetAddress = typeof F_EthereumGetAddress; - -declare function F_EthereumGetPublicKey(params: (P.$Common & ETHEREUM.$EthereumGetPublicKey)): Promise; -declare function F_EthereumGetPublicKey(params: (P.$Common & { bundle: Array })): Promise; -export type EthereumGetPublicKey = typeof F_EthereumGetPublicKey; - -export type EthereumSignMessage = (ETHEREUM.$EthereumSignMessage) => Promise; -export type EthereumSignTransaction = (ETHEREUM.$EthereumSignTransaction) => Promise; -export type EthereumVerifyMessage = (ETHEREUM.$EthereumVerifyMessage) => Promise; - -declare function F_GetAccountInfo(params: (P.$Common & P.$GetAccountInfo)): Promise; -declare function F_GetAccountInfo(params: (P.$Common & { bundle: Array })): Promise; -export type GetAccountInfo = typeof F_GetAccountInfo; -// export type GetAccountInfo = (P.$GetAccountInfo) => Promise; - -declare function F_GetAddress(params: (P.$Common & P.$GetAddress)): Promise; -declare function F_GetAddress(params: (P.$Common & { bundle: Array })): Promise; -export type GetAddress = typeof F_GetAddress; - -export type GetDeviceState = (P.$GetDeviceState) => Promise; -export type GetFeatures = (P.$GetFeatures) => Promise; - -declare function F_GetPublicKey(params: (P.$Common & P.$GetPublicKey)): Promise; -declare function F_GetPublicKey(params: (P.$Common & { bundle: Array })): Promise; -export type GetPublicKey = typeof F_GetPublicKey; - -declare function F_LiskGetAddress(params: (P.$Common & LISK.$LiskGetAddress)): Promise; -declare function F_LiskGetAddress(params: (P.$Common & { bundle: Array })): Promise; -export type LiskGetAddress = typeof F_LiskGetAddress; - -declare function F_LiskGetPublicKey(params: (P.$Common & LISK.$LiskGetPublicKey)): Promise; -declare function F_LiskGetPublicKey(params: (P.$Common & { bundle: Array })): Promise; -export type LiskGetPublicKey = typeof F_LiskGetPublicKey; - -export type LiskSignMessage = (LISK.$LiskSignMessage) => Promise; -export type LiskSignTransaction = (LISK.$LiskSignTransaction) => Promise -export type LiskVerifyMessage = (LISK.$LiskVerifyMessage) => Promise; - -declare function F_NEMGetAddress(params: (P.$Common & NEM.$NEMGetAddress)): Promise; -declare function F_NEMGetAddress(params: (P.$Common & { bundle: Array })): Promise; -export type NEMGetAddress = typeof F_NEMGetAddress; - -export type NEMSignTransaction = (NEM.$NEMSignTransaction) => Promise; - -export type PushTransaction = (P.$PushTransaction) => Promise; - -declare function F_RippleGetAddress(params: (P.$Common & RIPPLE.$RippleGetAddress)): Promise; -declare function F_RippleGetAddress(params: (P.$Common & { bundle: Array })): Promise; -export type RippleGetAddress = typeof F_RippleGetAddress; - -export type RippleSignTransaction = (RIPPLE.$RippleSignTransaction) => Promise; - -export type SignMessage = (P.$SignMessage) => Promise; -export type SignTransaction = (P.$SignTransaction) => Promise; - -declare function F_StellarGetAddress(params: (P.$Common & STELLAR.$StellarGetAddress)): Promise; -declare function F_StellarGetAddress(params: (P.$Common & { bundle: Array })): Promise; -export type StellarGetAddress = typeof F_StellarGetAddress; - -export type StellarSignTransaction = (STELLAR.$StellarSignTransaction) => Promise; -export type VerifyMessage = (P.$VerifyMessage) => Promise; -export type WipeDevice = (P.$WipeDevice) => Promise; -export type GetSettings = () => Promise; -export type ApplyFlags = (P.$ApplyFlags) => Promise; -export type ApplySettings = (P.$ApplySettings) => Promise; -export type BackupDevice = (P.$BackupDevice) => Promise; -export type ChangePin = (P.$ChangePin) => Promise; -export type FirmwareUpload = (P.$FirmwareUpload) => Promise; -export type RecoveryDevice = (P.$RecoveryDevice) => Promise; - -declare function F_EosGetPublicKey(params: (P.$Common & EOS.$EosGetPublicKey)): Promise; -declare function F_EosGetPublicKey(params: (P.$Common & { bundle: Array })): Promise; - -export type EosGetPublicKey = typeof F_EosGetPublicKey; -export type EosSignTx = (EOS.$EosSignTx) => Promise; - -declare function F_BinanceGetAddress(params: (P.$Common & BINANCE.$BinanceGetAddress)): Promise; -declare function F_BinanceGetAddress(params: (P.$Common & { bundle: Array })): Promise; -export type BinanceGetAddress = typeof F_BinanceGetAddress; - -declare function F_BinanceGetPublicKey(params: (P.$Common & BINANCE.$BinanceGetPublicKey)): Promise; -declare function F_BinanceGetPublicKey(params: (P.$Common & { bundle: Array })): Promise; -export type BinanceGetPublicKey = typeof F_BinanceGetPublicKey; -export type BinanceSignTransaction = (BINANCE.$BinanceSignTransaction) => Promise; - -/* eslint-enable no-redeclare */ - -export * from './response'; -export * from './coinInfo'; +export * from './api'; +export * from './events'; +export * from './misc'; +export * from './params'; + +export * from './account'; +export * from './trezor/device'; +export * from './trezor/management'; + +export * from './networks/bitcoin'; +export * from './networks/binance'; +export * from './networks/cardano'; +export * from './networks/coinInfo'; +export * from './networks/eos'; +export * from './networks/ethereum'; +export * from './networks/lisk'; +export * from './networks/nem'; +export * from './networks/ripple'; +export * from './networks/stellar'; +export * from './networks/tezos'; + +export * from './backend/blockchain'; +export * from './backend/transactions'; diff --git a/src/js/types/lisk.js b/src/js/types/lisk.js deleted file mode 100644 index 6966017c4..000000000 --- a/src/js/types/lisk.js +++ /dev/null @@ -1,142 +0,0 @@ -/* @flow */ -// Lisk types -// https://lisk.io/documentation/lisk-elements/user-guide/transactions - -import type { $Path, $Common } from './params'; -import type { Unsuccessful$ } from './response'; -import type { - Success, - LiskSignedTx, -} from './trezor'; - -export type VoteAsset = { - votes: Array, -} - -export type SignatureAsset = { - signature: { - publicKey: string, - }, -} - -export type DelegateAsset = { - delegate: { - username: string, - }, -} - -export type MultisignatureAsset = { - multisignature: { - min: number, - lifetime: number, - keysgroup: Array, - }, -} - -export type DataAsset = { - data: string, -} - -export type Asset = SignatureAsset | MultisignatureAsset | DelegateAsset | VoteAsset | DataAsset; - -export type Transaction = { - type: number, - fee: string, - amount: string, - timestamp: number, - recipientId?: string, - senderPublicKey?: string, - requesterPublicKey?: string, - signature?: string, - asset?: Asset, -} - -// methods parameters - -// get address - -export type $LiskGetAddress = $Common & { - path: $Path, - showOnTrezor?: boolean, -} - -export type LiskAddress = { - path: Array, - serializedPath: string, - address: string, -} - -export type LiskGetAddress$ = { - success: true, - payload: LiskAddress, -} | Unsuccessful$; - -export type LiskGetAddress$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -// get public key - -export type $LiskGetPublicKey = $Common & { - path: $Path, - showOnTrezor?: boolean, -} - -export type LiskPublicKey = { - path: Array, - serializedPath: string, - publicKey: string, -} - -export type LiskGetPublicKey$ = { - success: true, - payload: LiskPublicKey, -} | Unsuccessful$; - -export type LiskGetPublicKey$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -// sign message - -export type LiskMessageSignature = { - publicKey: string, - signature: string, -} - -export type $LiskSignMessage = $Common & { - path: $Path, - message: string, -} - -export type LiskSignMessage$ = { - success: true, - payload: LiskMessageSignature, -} | Unsuccessful$; - -// sign transaction - -export type $LiskSignTransaction = $Common & { - path: $Path, - transaction: Transaction, -} - -export type LiskSignTransaction$ = { - success: true, - payload: LiskSignedTx, -} | Unsuccessful$ - -// verify message - -export type $LiskVerifyMessage = $Common & { - publicKey: string, - message: string, - signature: string, -} - -export type LiskVerifyMessage$ = { - success: true, - payload: Success, -} | Unsuccessful$; diff --git a/src/js/types/misc.js b/src/js/types/misc.js new file mode 100644 index 000000000..c29fa92b3 --- /dev/null +++ b/src/js/types/misc.js @@ -0,0 +1,34 @@ +/* @flow */ + +export type CipherKeyValue = { + path: string | number[]; + key?: string; + value?: string; + askOnEncrypt?: boolean; + askOnDecrypt?: boolean; + iv?: string; +}; + +export type CipheredValue = { + value: string; +}; + +export type LoginChallenge = { + challengeHidden: string; + challengeVisual: string; +} + +export type RequestLoginAsync = { callback: () => LoginChallenge }; + +export type Login = { + address: string; + publicKey: string; + signature: string; +}; + +export type CustomMessage = { + messages?: JSON | Object; + message: string; + params: JSON | Object; + callback: (request: any) => Promise<{ message: string; params?: Object }>; +}; diff --git a/src/js/types/nem.js b/src/js/types/nem.js deleted file mode 100644 index 533ad3120..000000000 --- a/src/js/types/nem.js +++ /dev/null @@ -1,119 +0,0 @@ -/* @flow */ -// NEM types from nem-sdk -// https://nemproject.github.io/#transferTransaction - -import type { $Path, $Common } from './params'; -import type { Unsuccessful$ } from './response'; -import type { NEMSignedTx } from './trezor'; - -type MosaicID = { - namespaceId: string, - name: string, -} - -type MosaicDefinition = { - levy: { - type: number, - fee: number, - recipient: string, - mosaicId: MosaicID, - }, - id: MosaicID, - description: string, - properties: Array<{ - name: string, - value: string, - }>, -} - -type Modification = { - modificationType: number, - cosignatoryAccount: string, -} - -type Message = { - payload: string, - type: number, - publicKey?: string, // not present in sdk -} - -export type Mosaic = { - mosaicId: MosaicID, - quantity: number, -} - -export type Transaction = { - timeStamp: number, - amount: number, - signature: string, - fee: number, - recipient: string, - type: number, - deadline: number, - message: Message, - version: number, - signer: string, - mosaics: Array, - - // not present in sdk - otherTrans: Transaction, - importanceTransfer: { - mode: number, - publicKey: string, - }, - - modifications: Array, - minCosignatories: { - relativeChange: number, - // TODO - }, - - newPart?: string, - rentalFeeSink?: string, - rentalFee?: number, - parent?: string, - - mosaicDefinition: MosaicDefinition, - creationFeeSink: string, - creationFee: number, - - mosaicId: MosaicID, - supplyType: number, - delta: number, -} - -// get address - -export type NEMAddress = { - address: string, - path: Array, - serializedPath: string, -} - -export type $NEMGetAddress = { - path: $Path, - network: number, - showOnTrezor?: boolean, -} - -export type NEMGetAddress$ = { - success: true, - payload: NEMAddress, -} | Unsuccessful$; - -export type NEMGetAddress$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -// sign transaction - -export type $NEMSignTransaction = $Common & { - path: $Path, - transaction: Transaction, -} - -export type NEMSignTransaction$ = { - success: true, - payload: NEMSignedTx, -} | Unsuccessful$; diff --git a/src/js/types/networks/binance.js b/src/js/types/networks/binance.js new file mode 100644 index 000000000..6e7501d6c --- /dev/null +++ b/src/js/types/networks/binance.js @@ -0,0 +1,62 @@ +/* @flow */ +import type { BinanceTransferMsg, BinanceOrderMsg, BinanceCancelMsg } from '../trezor/protobuf'; + +// get address +export type BinanceGetAddress = { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +}; + +export type BinanceAddress = { + address: string; + path: number[]; + serializedPath: string; +}; + +// get public key +export type BinanceGetPublicKey = { + path: string | number[]; + showOnTrezor?: boolean; +}; + +export type BinancePublicKey = { + publicKey: string; + path: number[]; + serializedPath: string; +}; + +// sign transaction +// fields taken from https://github.com/binance-chain/javascript-sdk/blob/master/src/tx/index.js + +export type BinanceSDKTransaction = { + chain_id: string; + account_number?: number; // default 0 + memo?: string; + sequence?: number; // default 0 + source?: number; // default 0 + + transfer?: BinanceTransferMsg; + placeOrder?: BinanceOrderMsg; + cancelOrder?: BinanceCancelMsg; +}; + +export type BinancePreparedMessage = + | (BinanceTransferMsg & { + type: 'BinanceTransferMsg'; + }) + | (BinanceOrderMsg & { + type: 'BinanceOrderMsg'; + }) + | (BinanceCancelMsg & { + type: 'BinanceCancelMsg'; + }); + +export type BinancePreparedTransaction = BinanceSDKTransaction & { + messages: BinancePreparedMessage[]; +}; + +export type BinanceSignTransaction = { + path: string | number[]; + transaction: BinanceSDKTransaction; +}; diff --git a/src/js/types/networks/bitcoin.js b/src/js/types/networks/bitcoin.js new file mode 100644 index 000000000..b4ac0d098 --- /dev/null +++ b/src/js/types/networks/bitcoin.js @@ -0,0 +1,72 @@ +/* @flow */ +import type { + TransactionInput, + TransactionOutput, + RefTransaction, + Address as ProtobufAddress, + SignedTx, +} from '../trezor/protobuf'; + +// getAddress params +export type GetAddress = { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; + coin?: string; + crossChain?: boolean; +}; + +// getAddress response +export type Address = ProtobufAddress & { + serializedPath: string; +}; + +// getPublicKey params +export type GetPublicKey = { + path: string | number[]; + coin?: string; + crossChain?: boolean; +}; + +// signTransaction params +export type SignTransaction = { + inputs: TransactionInput[]; + outputs: TransactionOutput[]; + refTxs?: RefTransaction[]; + coin: string; + locktime?: number; + timestamp?: number; + version?: number; + expiry?: number; + overwintered?: boolean; + versionGroupId?: number; + branchId?: number; + push?: boolean; +}; +export type SignedTransaction = SignedTx & { + txid?: string; +} + +// push transaction params +export type PushTransaction = { + tx: string; + coin: string; +}; + +// push transaction response +export type PushedTransaction = { + txid: string; +}; + +export type SignMessage = { + path: string | number[]; + coin: string; + message: string; +}; + +export type VerifyMessage = { + address: string; + signature: string; + message: string; + coin: string; +}; diff --git a/src/js/types/networks/cardano.js b/src/js/types/networks/cardano.js new file mode 100644 index 000000000..e36941b46 --- /dev/null +++ b/src/js/types/networks/cardano.js @@ -0,0 +1,60 @@ +/* @flow */ + +// Cardano method parameters types +import type { HDPubNode } from '../trezor/protobuf'; + +// GetAddress + +export type CardanoGetPublicKey = { + path: string | number[]; + showOnTrezor?: boolean; +} + +export type CardanoPublicKey = { + path: number[]; + serializedPath: string; + publicKey: string; + node: HDPubNode; +} + +// GetAddress + +export type CardanoGetAddress = { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export type CardanoAddress = { + path: number[]; + serializedPath: string; + address: string; +} + +// Sign transaction + +export type CardanoInput = { + path: string | number[]; + prev_hash: string; + prev_index: number; + type: number; +} +export type CardanoOutput = { + path: string | number[]; + amount: string; +} | { + address: string; + amount: string; +} + +export type CardanoSignTransaction = { + inputs: CardanoInput[]; + outputs: CardanoOutput[]; + transactions: string[]; + protocol_magic: number; +} + +export type CardanoSignedTx = { + hash: string; + body: string; +} diff --git a/src/js/types/networks/coinInfo.js b/src/js/types/networks/coinInfo.js new file mode 100644 index 000000000..3304dab78 --- /dev/null +++ b/src/js/types/networks/coinInfo.js @@ -0,0 +1,131 @@ +/* @flow */ + +type CoinSupport = { + connect: boolean; + // electrum not used, + trezor1: string; + trezor2: string; + // webwallet not used +}; + +// copy-paste from 'bitcoinjs-lib-zcash' module +type Network = { + messagePrefix: string; + bech32: ?string; + bip32: { + public: number; + private: number; + }; + pubKeyHash: number; + scriptHash: number; + wif: number; + dustThreshold: number; + coin: string; +}; + +type BlockchainLink = { + type: string; + url: Array; +}; + +type DefaultFees = {[level: 'High' | 'Normal' | 'Economy' | 'Low']: number}; + +export type BitcoinNetworkInfo = { + type: 'bitcoin'; + // address_type: in Network + // address_type_p2sh: in Network + // bech32_prefix: in Network + // consensus_branch_id in Network + // bip115: not used + // bitcore: not used + // blockbook: not used + blockchainLink: ?BlockchainLink; + blocktime: number; + cashAddrPrefix: ?string; + label: string; // this is human readable format, could be different from "name" + name: string; // this is Trezor readable format + shortcut: string; + // cooldown not used + curveName: string; + // decred not used + defaultFees: DefaultFees; + dustLimit: number; + forceBip143: boolean; + forkid: ?number; + // github: not used + hashGenesisBlock: string; + // key not used + // maintainer: not used + maxAddressLength: number; + maxFeeSatoshiKb: number; + minAddressLength: number; + minFeeSatoshiKb: number; + // name: same as coin_label + segwit: boolean; + // signed_message_header: in Network + slip44: number; + support: CoinSupport; + // uri_prefix not used + // version_group_id: not used + // website: not used + // xprv_magic: in Network + xPubMagic: number; + xPubMagicSegwitNative: ?number; + xPubMagicSegwit: ?number; + + // custom + network: Network; + isBitcoin: boolean; + hasTimestamp: boolean; + minFee: number; + maxFee: number; + // used in backend + blocks?: number; + decimals: number; +}; + +export type EthereumNetworkInfo = { + type: 'ethereum'; + blockchainLink: ?BlockchainLink; + blocktime: number; + chain: string; + chainId: number; + // key not used + defaultFees: { + label: 'high' | 'normal' | 'low'; + feePerUnit: string; + feeLimit: string; + }[]; + minFee: number; + maxFee: number; + label: string; // compatibility + name: string; + shortcut: string; + rskip60: boolean; + slip44: number; + support: CoinSupport; + // url not used + network: typeof undefined; // compatibility + decimals: number; +}; + +export type MiscNetworkInfo = { + type: 'misc' | 'nem'; + blockchainLink: ?BlockchainLink; + blocktime: number; + curve: string; + // key not used + defaultFees: DefaultFees; + minFee: number; + maxFee: number; + // links not used + label: string; // compatibility + name: string; + shortcut: string; + slip44: number; + support: CoinSupport; + network: typeof undefined; // compatibility + decimals: number; +}; + +export type CoinInfo = BitcoinNetworkInfo | EthereumNetworkInfo | MiscNetworkInfo; diff --git a/src/js/types/networks/eos.js b/src/js/types/networks/eos.js new file mode 100644 index 000000000..49da453ae --- /dev/null +++ b/src/js/types/networks/eos.js @@ -0,0 +1,146 @@ +/* @flow */ +import type { + EosPermissionLevel, + EosAuthorizationKey, + EosActionBuyRamBytes, + EosActionSellRam, + EosActionRefund, + EosActionDeleteAuth, + EosActionLinkAuth, + EosActionUnlinkAuth, +} from '../trezor/protobuf'; + +// get public key + +export type EosGetPublicKey = { + path: string | number[]; + showOnTrezor?: boolean; +} + +export type EosPublicKey = { + wifPublicKey: string; + rawPublicKey: string; + path: number[]; + serializedPath: string; +} + +// sign tx + +export type EosTxHeader = { + expiration: number | string; + refBlockNum: number; + refBlockPrefix: number; + maxNetUsageWords: number; + maxCpuUsageMs: number; + delaySec: number; +} + +export type EosAuthorization = { + threshold: number; + keys: EosAuthorizationKey[]; + accounts: Array<{ + permission: EosPermissionLevel; + weight: number; + }>; + waits: Array<{ + wait_sec: number; + weight: number; + }>; +} + +export type EosTxActionCommon = { + account: string; + authorization: EosPermissionLevel[]; +} + +export type EosTxAction = EosTxActionCommon & { + name: 'transfer'; + data: { + from: string; + to: string; + quantity: string; + memo?: string; + }; +} | EosTxActionCommon & { + name: 'delegatebw'; + data: { + from: string; + receiver: string; + stake_net_quantity: string; + stake_cpu_quantity: string; + transfer?: boolean; + }; +} | EosTxActionCommon & { + name: 'undelegatebw'; + data: { + from: string; + receiver: string; + unstake_net_quantity: string; + unstake_cpu_quantity: string; + }; +} | EosTxActionCommon & { + name: 'buyram'; + data: { + payer: string; + receiver: string; + quant: string; + }; +} | EosTxActionCommon & { + name: 'buyrambytes'; + data: EosActionBuyRamBytes; +} | EosTxActionCommon & { + name: 'sellram'; + data: EosActionSellRam; +} | EosTxActionCommon & { + name: 'voteproducer'; + data: { + voter: string; + proxy: string; + producers: string[]; + }; +} | EosTxActionCommon & { + name: 'refund'; + data: EosActionRefund; +} | EosTxActionCommon & { + name: 'updateauth'; + data: { + account: string; + permission: string; + parent: string; + auth: EosAuthorization; + }; +} | EosTxActionCommon & { + name: 'deleteauth'; + data: EosActionDeleteAuth; +} | EosTxActionCommon & { + name: 'linkauth'; + data: EosActionLinkAuth; +} | EosTxActionCommon & { + name: 'unlinkauth'; + data: EosActionUnlinkAuth; +} | EosTxActionCommon & { + name: 'newaccount'; + data: { + creator: string; + name: string; + owner: EosAuthorization; + active: EosAuthorization; + }; +} + +// | EosTxActionCommon & {| +// name: string; +// data: string; +// |}; + +export type EosSDKTransaction = { + chainId: string; + header: ?EosTxHeader; + actions: Array; + // actions: EosTxAction[]; +} + +export type EosSignTransaction = { + path: string | number[]; + transaction: EosSDKTransaction; +} diff --git a/src/js/types/networks/ethereum.js b/src/js/types/networks/ethereum.js new file mode 100644 index 000000000..cbe0f1872 --- /dev/null +++ b/src/js/types/networks/ethereum.js @@ -0,0 +1,59 @@ +/* @flow */ +// Ethereum types +// https://github.com/ethereumjs/ethereumjs-tx + +// get address + +export type EthereumGetAddress = { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export type EthereumAddress = { + address: string; + path: Array; + serializedPath: string; +} + +// get public key + +export type EthereumGetPublicKey = { + path: string | number[]; + showOnTrezor?: boolean; +} + +// sign transaction + +export type EthereumTransaction = { + to: string; + value: string; + gasPrice: string; + gasLimit: string; + nonce: string; + data?: string; + chainId?: number; + txType?: number; +} + +export type EthereumSignTransaction = { + path: string | number[]; + transaction: EthereumTransaction; +} + +// sign message + +export type EthereumSignMessage = { + path: string | number[]; + message: string; + hex?: boolean; +}; + +// verify message + +export type EthereumVerifyMessage = { + address: string; + message: string; + hex?: boolean; + signature: string; +} diff --git a/src/js/types/networks/lisk.js b/src/js/types/networks/lisk.js new file mode 100644 index 000000000..07507ccf7 --- /dev/null +++ b/src/js/types/networks/lisk.js @@ -0,0 +1,101 @@ +/* @flow */ +// Lisk types +// https://lisk.io/documentation/lisk-elements/user-guide/transactions + +type VoteAsset = { + votes: Array; +} + +type SignatureAsset = { + signature: { + publicKey: string; + }; +} + +type DelegateAsset = { + delegate: { + username: string; + }; +} + +type MultisignatureAsset = { + multisignature: { + min: number; + lifetime: number; + keysgroup: Array; + }; +} + +type DataAsset = { + data: string; +} + +export type LiskAsset = SignatureAsset | MultisignatureAsset | DelegateAsset | VoteAsset | DataAsset; + +export type LiskTransaction = { + type: number; + fee: string; + amount: string; + timestamp: number; + recipientId?: string; + senderPublicKey?: string; + requesterPublicKey?: string; + signature?: string; + asset?: LiskAsset; +} + +// methods parameters + +// get address + +export type LiskGetAddress = { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export type LiskAddress = { + path: number[]; + serializedPath: string; + address: string; +} + +// get public key + +export type LiskGetPublicKey = { + path: string | number[]; + showOnTrezor?: boolean; +} + +export type LiskPublicKey = { + path: number[]; + serializedPath: string; + publicKey: string; +} + +// sign transaction + +export type LiskSignTransaction = { + path: string | number[]; + transaction: LiskTransaction; +} + +// sign message + +export type LiskSignMessage = { + path: string | number[]; + message: string; +} + +export type LiskMessageSignature = { + publicKey: string; + signature: string; +} + +// verify message + +export type LiskVerifyMessage = { + publicKey: string; + message: string; + signature: string; +} diff --git a/src/js/types/networks/nem.js b/src/js/types/networks/nem.js new file mode 100644 index 000000000..dce36b803 --- /dev/null +++ b/src/js/types/networks/nem.js @@ -0,0 +1,130 @@ +/* @flow */ +// NEM types from nem-sdk +// https://nemproject.github.io/#transferTransaction + +type MosaicID = { + namespaceId: string; + name: string; +} + +type MosaicDefinition = { + levy?: { + type?: number; + fee?: number; + recipient?: string; + mosaicId?: MosaicID; + }; + id: MosaicID; + description: string; + properties?: Array<{ + name: 'divisibility' | 'initialSupply' | 'supplyMutable' | 'transferable'; + value: string; + }>; +} + +export type NEMMosaic = { + mosaicId: MosaicID; + quantity: number; +} + +type Modification = { + modificationType: number; + cosignatoryAccount: string; +} + +type Message = { + payload?: string; + type?: number; + publicKey?: string; // not present in sdk +} + +type TransactionCommon = { + version: number; + timeStamp: number; + fee: number; + deadline?: number; + signer?: string; +}; + +export type NEMTransferTransaction = TransactionCommon & { + type: 0x0101; + recipient: string; + amount: number | string; + mosaics?: NEMMosaic[]; + message?: Message; +}; + +export type NEMImportanceTransaction = TransactionCommon & { + type: 0x0801; + importanceTransfer: { + mode: number; + publicKey: string; + }; +}; + +export type NEMAggregateModificationTransaction = TransactionCommon & { + type: 0x1001; + modifications?: Modification[]; + minCosignatories: { + relativeChange: number; + }; +}; + +export type NEMProvisionNamespaceTransaction = TransactionCommon & { + type: 0x2001; + newPart?: string; + parent?: string; + rentalFeeSink?: string; + rentalFee?: number; +}; + +export type NEMMosaicCreationTransaction = TransactionCommon & { + type: 0x4001; + mosaicDefinition: MosaicDefinition; + creationFeeSink?: string; + creationFee?: number; +}; + +export type NEMSupplyChangeTransaction = TransactionCommon & { + type: 0x4002; + mosaicId: MosaicID; + supplyType: number; + delta?: number; +}; + +type Transaction = + | NEMTransferTransaction + | NEMImportanceTransaction + | NEMAggregateModificationTransaction + | NEMProvisionNamespaceTransaction + | NEMMosaicCreationTransaction + | NEMSupplyChangeTransaction; + +export type NEMMultisigTransaction = TransactionCommon & { + type: 0x0102 | 0x1002 | 0x1004; + otherTrans: Transaction; +}; + +export type NEMTransaction = Transaction | NEMMultisigTransaction; + +// get address + +export type NEMGetAddress = { + path: string | number[]; + address?: string; + network: number; + showOnTrezor?: boolean; +} + +export type NEMAddress = { + address: string; + path: number[]; + serializedPath: string; +} + +// sign transaction + +export type NEMSignTransaction = { + path: string | number[]; + transaction: NEMTransaction; +} diff --git a/src/js/types/networks/ripple.js b/src/js/types/networks/ripple.js new file mode 100644 index 000000000..03bdd9bef --- /dev/null +++ b/src/js/types/networks/ripple.js @@ -0,0 +1,41 @@ +/* @flow */ + +// get address + +export type RippleGetAddress = { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export type RippleAddress = { + address: string; + path: number[]; + serializedPath: string; +} + +// sign transaction + +type Payment = { + amount: string; + destination: string; + destinationTag?: number; +} + +export type RippleTransaction = { + fee?: string; + flags?: number; + sequence?: number; + maxLedgerVersion?: number; // Proto: "last_ledger_sequence" + payment: Payment; +} + +export type RippleSignTransaction = { + path: string | number[]; + transaction: RippleTransaction; +} + +export type RippleSignedTx = { + serializedTx: string; + signature: string; +} diff --git a/src/js/types/networks/stellar.js b/src/js/types/networks/stellar.js new file mode 100644 index 000000000..ac8e43ce1 --- /dev/null +++ b/src/js/types/networks/stellar.js @@ -0,0 +1,170 @@ +/* @flow */ + +// Stellar types from stellar-sdk +// https://github.com/stellar/js-stellar-base + +export type StellarAsset = { + type: 0 | 1 | 2; // 0: native, 1: credit_alphanum4, 2: credit_alphanum12 + code: string; + issuer?: string; +} + +export type StellarCreateAccountOperation = { + type: 'createAccount'; // Proto: "StellarCreateAccountOp" + source?: string; // Proto: "source_account" + destination: string; // Proto: "new_account", + startingBalance: string; // Proto: "starting_balance" +} + +export type StellarPaymentOperation = { + type: 'payment'; // Proto: "StellarPaymentOp" + source?: string; // Proto: "source_account" + destination: string; // Proto: "destination_account" + asset?: StellarAsset | typeof undefined; // Proto: ok + amount: string; // Proto: ok +} + +export type StellarPathPaymentOperation = { + type: 'pathPayment'; // Proto: "StellarPathPaymentOp" + source?: string; // Proto: "source_account" + sendAsset: StellarAsset; // Proto: "send_asset" + sendMax: string; // Proto: "send_max" + destination: string; // Proto: "destination_account" + destAsset: StellarAsset; // Proto: "destination_asset" + destAmount: string; // Proto "destination_amount" + path?: StellarAsset[]; // Proto: "paths" +} + +export type StellarPassiveOfferOperation = { + type: 'createPassiveOffer'; // Proto: "StellarCreatePassiveOfferOp" + source?: string; // Proto: "source_account" + buying: StellarAsset; // Proto: "buying_asset" + selling: StellarAsset; // Proto: "selling_asset" + amount: string; // Proto: ok + price: { n: number; d: number }; // Proto: "price_n" and "price_d" +} + +export type StellarManageOfferOperation = { + type: 'manageOffer'; // Proto: "StellarManageOfferOp" + source?: string; // Proto: "source_account" + buying: StellarAsset; // Proto: "buying_asset" + selling: StellarAsset; // Proto: "selling_asset" + amount: string; // Proto: ok + offerId?: string; // Proto: "offer_id" // not found in stellar-sdk + price: { n: number; d: number }; // Proto: "price_n" and "price_d" +} + +export type StellarSetOptionsOperation = { + type: 'setOptions'; // Proto: "StellarSetOptionsOp" + source?: string; // Proto: "source_account" + signer?: { + type: 0 | 1 | 2; + key: string | Buffer; + weight?: number; + }; + inflationDest?: string; // Proto: "inflation_destination_account" + clearFlags?: number; // Proto: "clear_flags" + setFlags?: number; // Proto: "set_flags" + masterWeight?: number | string; // Proto: "master_weight" + lowThreshold?: number | string; // Proto: "low_threshold" + medThreshold?: number | string; // Proto: "medium_threshold" + highThreshold?: number | string; // Proto: "high_threshold" + homeDomain?: string; // Proto: "home_domain" +} + +export type StellarChangeTrustOperation = { + type: 'changeTrust'; // Proto: "StellarChangeTrustOp" + source?: string; // Proto: "source_account" + line: StellarAsset; // Proto: ok + limit?: string; // Proto: ok +} + +export type StellarAllowTrustOperation = { + type: 'allowTrust'; // Proto: "StellarAllowTrustOp" + source?: string; // Proto: "source_account" + trustor: string; // Proto: "trusted_account" + assetCode: string; // Proto: "asset_code" + assetType: number; // Proto: "asset_type" // TODO not found in stellar-sdk + authorize?: boolean | typeof undefined; // Proto: "is_authorized" > parse to number +} + +export type StellarAccountMergeOperation = { + type: 'accountMerge'; // Proto: "StellarAccountMergeOp" + source?: string; // Proto: "source_account" + destination: string; // Proto: "destination_account" +} + +export type StellarManageDataOperation = { + type: 'manageData'; // Proto: "StellarManageDataOp" + source?: string; // Proto: "source_account" + name: string; // Proto: "key" + value?: ?(string | Buffer); // Proto: "value" +} + +// (?) Missing in stellar API but present in Proto messages +export type StellarBumpSequenceOperation = { + type: 'bumpSequence'; // Proto: "StellarBumpSequenceOp" + source?: string; // Proto: "source_account" + bumpTo: string; // Proto: "bump_to" +} + +// (?) Missing in Proto messages, but present in Stellar API +export type StellarInflationOperation = { + type: 'inflation'; + source?: string; // Proto: "source_account" +} + +export type StellarOperation = StellarCreateAccountOperation + | StellarPaymentOperation + | StellarPathPaymentOperation + | StellarPassiveOfferOperation + | StellarManageOfferOperation + | StellarSetOptionsOperation + | StellarChangeTrustOperation + | StellarAllowTrustOperation + | StellarAccountMergeOperation + | StellarInflationOperation + | StellarManageDataOperation + | StellarBumpSequenceOperation; + +export type StellarTransaction = { + source: string; // Proto: "source_account" + fee: number; // Proto: ok + sequence: string | number; // Proto: "sequence_number" + timebounds?: { + minTime: number; // Proto: "timebounds_start" + maxTime: number; // Proto: "timebounds_end" + }; + memo?: { + type: 0 | 1 | 2 | 3 | 4; // Proto: "memo_type" + id?: string; // Proto: "memo_id" + text?: string; // Proto: "memo_text" + hash?: string | Buffer; // Proto: "memo_hash" + }; + operations: StellarOperation[]; // Proto: calculated array length > "num_operations" +} + +export type StellarSignTransaction = { + path: string | number[]; + networkPassphrase: string; + transaction: StellarTransaction; +} + +export type StellarSignedTx = { + publicKey: string; + signature: string; +} + +// get address + +export type StellarGetAddress = { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export type StellarAddress = { + address: string; + path: Array; + serializedPath: string; +} diff --git a/src/js/types/networks/tezos.js b/src/js/types/networks/tezos.js new file mode 100644 index 000000000..6a95fbb8f --- /dev/null +++ b/src/js/types/networks/tezos.js @@ -0,0 +1,95 @@ +/* @flow */ + +// get address + +export type TezosGetAddress = { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export type TezosAddress = { + address: string; + path: number[]; + serializedPath: string; +} + +// get public key + +export type TezosGetPublicKey = { + path: string | number[]; + showOnTrezor?: boolean; +} + +export type TezosPublicKey = { + publicKey: string; + path: number[]; + serializedPath: string; +} + +// sign transaction + +export type TezosRevealOperation = { + source: string; + fee: number; + counter: number; + gas_limit: number; + storage_limit: number; + public_key: string; +}; + +export type TezosManagerTransfer = { + destination: string; + amount: number; +}; + +export type TezosParametersManager = { + set_delegate?: string; + cancel_delegate?: boolean; + transfer?: TezosManagerTransfer; +} + +export type TezosTransactionOperation = { + source: string; + destination: string; + amount: number; + counter: number; + fee: number; + gas_limit: number; + storage_limit: number; + parameters?: number[]; + parameters_manager?: TezosParametersManager; +}; + +export type TezosOriginationOperation = { + source: string; + balance: number; + delegate?: string; + script: string | number[]; + fee: number; + counter: number; + gas_limit: number; + storage_limit: number; +}; + +export type TezosDelegationOperation = { + source: string; + delegate: string; + fee: number; + counter: number; + gas_limit: number; + storage_limit: number; +}; + +export type TezosOperation = { + reveal?: TezosRevealOperation; + transaction?: TezosTransactionOperation; + origination?: TezosOriginationOperation; + delegation?: TezosDelegationOperation; +}; + +export type TezosSignTransaction = { + path: string | number[]; + branch: string; + operation: TezosOperation; +}; diff --git a/src/js/types/params.js b/src/js/types/params.js index baaab440c..88c2aadd8 100644 --- a/src/js/types/params.js +++ b/src/js/types/params.js @@ -1,251 +1,97 @@ /* @flow */ -import type { - TransactionInput, - TransactionOutput, - RefTransaction, - DebugLinkDecision, - MultisigRedeemScriptType, - InputScriptType, -} from './trezor'; -import type { AccountAddresses, AccountUtxo } from './account'; +export type Unsuccessful = { + success: false; + payload: { error: string; code?: string | number }; +}; -export type $BlockchainDisconnect = {| - coin: string, -|} +export type Success = { + success: true; + id: number; + payload: T; +}; -export type $BlockchainEstimateFee = {| - coin: string, - request?: { - blocks?: number[], - specific?: { - conservative?: boolean, // btc - txsize?: number, // btc transaction size - from?: string, // eth from - to?: string, // eth to - data?: string, // eth tx data - }, - feeLevels?: 'preloaded' | 'smart', - }, -|} +export type Response = Promise | Unsuccessful>; +export type BundledResponse = Promise | Unsuccessful>; -export type SubscriptionAccountInfo = { - descriptor: string, - addresses?: AccountAddresses, // bitcoin addresses -} +export type DefaultMessage = { + message: string; +}; -export type $BlockchainGetTransactions = {| - coin: string, - txs: string[], -|} +export type Manifest = { + appUrl: string; + email: string; +}; -export type $BlockchainSubscribe = {| - coin: string, - accounts: SubscriptionAccountInfo[], -|} +export type ConnectSettings = { + manifest: ?Manifest; + connectSrc?: string; + debug?: boolean; + hostLabel?: string; + hostIcon?: string; + popup?: boolean; + transportReconnect?: boolean; + webusb?: boolean; + pendingTransportEvent?: boolean; + lazyLoad?: boolean; + // internal part, not to be accepted from .init() + origin?: string; + configSrc: string; + iframeSrc: string; + popupSrc: string; + webusbSrc: string; + version: string; + priority: number; + trustedHost: boolean; + supportedBrowser?: boolean; + extension?: string; + env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native'; + timestamp: number; +}; -export type $Common = {| +export type CommonParams = { device?: { - path: string, - instance?: ?number, - state?: ?string, - }, - useEmptyPassphrase?: boolean, - allowSeedlessDevice?: boolean, - keepSession?: boolean, - skipFinalReload?: boolean, -|} - -export type $Path = string | Array; - -export type $CipherKeyValue = { - path: $Path, - key?: string, - value?: string, - encrypt?: boolean, - askOnEncrypt?: boolean, - askOnDecrypt?: boolean, - iv?: string, -} - -type ComposeTransactionOutput = {| - amount: string, - address: string, -|} | {| - type: 'send-max', - address: string, -|} | {| - type: 'opreturn', - dataHex: string, -|} | {| - type: 'noaddress', - amount: string, -|} | {| - type: 'send-max-noaddress', -|}; - -export type $ComposeTransaction = {| - outputs: Array, - coin: string, - push?: boolean, -|} - -export type $$ComposeTransaction = {| - outputs: Array, - coin: string, - account: { - path: string, - addresses: AccountAddresses, - utxo: AccountUtxo[], - }, - feeLevels: { - feePerUnit: string, - }[], -|} - -export type $CustomMessage = $Common & { - messages?: JSON, - message: string, - params: JSON, - callback: (request: any) => Promise, -} - -export type $DebugLinkDecision = DebugLinkDecision & { - device: { - path: string, - }, -} - -export type $DebugLinkGetState = {| - device: { - path: string, - }, -|} - -export type $GetAccountInfo = $Common & { - coin: string, - path?: string, - descriptor?: string, - details?: 'basic' | 'txs', - tokens?: 'nonzero' | 'used' | 'derived', - page?: number, - pageSize?: number, - from?: number, - to?: number, - contractFilter?: string, - gap?: number, - marker?: { - ledger: number, - seq: number, - }, -} - -export type $GetAddress = {| - path: $Path, - address?: string, - coin?: string, - showOnTrezor?: boolean, - crossChain?: boolean, - multisig?: MultisigRedeemScriptType, - scriptType?: InputScriptType, -|}; - -export type $GetDeviceState = $Common; - -export type $GetFeatures = $Common; - -export type $GetPublicKey = { - path: $Path, - coin?: string, - crossChain?: boolean, -} - -export type $PushTransaction = $Common & { - tx: string, - coin: string, + path: string; + state?: string; + instance?: number; + }; + useEmptyPassphrase?: boolean; + allowSeedlessDevice?: boolean; + keepSession?: boolean; + skipFinalReload?: boolean; }; -export type $RequestLogin = $Common & $Exact<{ - challengeHidden: string, - challengeVisual: string, -}> | $Common & $Exact<{ - callback: () => Promise, -}> - -export type $ResetDevice = $Common & { - displayRandom?: boolean, - strength?: number, - passphraseProtection?: boolean, - pinProtection?: boolean, - language?: string, - label?: string, - u2fCounter?: number, - skipBackup?: boolean, - noBackup?: boolean, +export type Bundle = { + bundle: T[]; }; -export type $SignMessage = $Common & { - path: $Path, - coin: string, - message: string, -} - -export type $SignTransaction = $Common & { - inputs: Array, - outputs: Array, - refTxs?: Array, - coin: string, - locktime?: number, - timestamp?: number, - version?: number, - expiry?: number, - overwintered?: boolean, - versionGroupId?: number, - branchId?: number, - push?: boolean, -} - -export type $VerifyMessage = $Common & { - address: string, - coin: string, - message: string, - signature: string, -} +export type CoreMessage = { + event: string; + type: string; + payload: any; -export type $WipeDevice = $Common; - -export type $ApplyFlags = $Common & { - flags: number, + id?: number; // response id in ResponseMessage + success?: boolean; // response status in ResponseMessage }; -export type $ApplySettings = $Common & { - language?: string, - label?: string, - use_passphrase?: boolean, - homescreen?: string, - passhprase_source: number, // todo: enum [0, 1, 2] // ask, device, host - auto_lock_delay?: number, - display_rotation?: 0 | 90 | 180 | 270, +export type UiPromiseResponse = { + event: string; + payload: any; }; -export type $BackupDevice = $Common; - -export type $ChangePin = $Common & { - remove?: boolean, +// Override MessageEvent type to have access to "ports" field and typed "data" +export interface PostMessageEvent extends Event { + origin: string; + lastEventId: string; + source: WindowProxy; + ports: Array; + data?: CoreMessage; } -export type $FirmwareUpload = $Common & { - payload: string, - hash?: string, -} - -export type $RecoveryDevice = $Common & { - word_count?: 12 | 18 | 24, - passphrase_protection?: boolean, - pin_protection?: boolean, - language?: string, - enforce_wordlist?: boolean, - type?: 0 | 1, - u2f_counter?: number, - dry_run?: number, -} +export type Deferred = { + id?: string; + device?: any; + promise: Promise; + resolve: (t: T) => void; + reject: (e: Error) => void; +}; diff --git a/src/js/types/response.js b/src/js/types/response.js deleted file mode 100644 index 089020e17..000000000 --- a/src/js/types/response.js +++ /dev/null @@ -1,273 +0,0 @@ -/* @flow */ - -import type { - CipheredKeyValue, - Address, - Features, - HDNodeResponse, - MessageSignature, - Success, - TransactionInput, - TransactionOutput, - SignedTx, - DebugLinkState, -} from './trezor'; - -import type { FeeInfo } from './fee'; -import type { AccountInfo } from './account'; -import type { GetTransactionResponse } from './transactions'; - -import type { ConnectSettings } from '../data/ConnectSettings'; - -export type Unsuccessful$ = { - success: false, - payload: { - error: string, - code?: number, - }, -} - -export type BlockchainDisconnect$ = { - success: true, - payload: { - disconnected: true, - }, -} | Unsuccessful$; - -export type BlockchainEstimateFee$ = { - success: true, - payload: FeeInfo, -} | Unsuccessful$; - -export type BlockchainGetTransactions$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -export type BlockchainSubscribe$ = { - success: true, - payload: { - subscribed: boolean, - }, -} | Unsuccessful$; - -export type CipherKeyValue$ = { - success: true, - payload: CipheredKeyValue, -} | Unsuccessful$; - -export type CipherKeyValue$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -export type CustomMessage$ = { - success: true, - payload: any, -} | Unsuccessful$; - -export type DebugLinkDecision$ = { - success: true, - payload: { - debugLink: true, - }, -} | Unsuccessful$; - -export type DebugLinkGetState$ = { - success: true, - payload: DebugLinkState & { - debugLink: true, - }, -} | Unsuccessful$; - -export type ComposeTransaction$ = { - success: true, - payload: SignedTx, -} | Unsuccessful$; - -// copy/paste from hd-wallet/buildTx -export type PrecomposedTransaction = { - type: 'error', - error: string, -} | { - type: 'nonfinal', - max: string, - totalSpent: string, // all the outputs, no fee, no change - fee: string, - feePerByte: string, - bytes: number, -} | { - type: 'final', - max: string, - totalSpent: string, // all the outputs, no fee, no change - fee: string, - feePerByte: string, - bytes: number, - transaction: { - inputs: TransactionInput[], - outputs: TransactionOutput[], - }, -} - -export type ComposeTransaction$$ = { - success: true, - payload: PrecomposedTransaction[], -} | Unsuccessful$; - -// response for getAccountInfo method - -// copy from hd-wallet -export type Utxo = { - index: number, // index of output IN THE TRANSACTION - transactionHash: string, // hash of the transaction - value: number, // how much money sent - addressPath: [number, number], // path - height: ?number, // null == unconfirmed - coinbase: boolean, - tsize: number, // total size - in case of segwit, total, with segwit data - vsize: number, // virtual size - segwit concept - same as size in non-segwit - own: boolean, -}; - -export type AccountInfoPayload = { - id: number, - path: Array, - serializedPath: string, - xpub: string, - xpubSegwit?: ?string, - address: string, - addressIndex: number, - addressPath: Array, - addressSerializedPath: string, - balance: string, - confirmed: string, - transactions: number, - utxo: Array, - usedAddresses: Array<{ - address: string, - received: string, - }>, - unusedAddresses: Array, -} - -export type GetAccountInfo$ = { - success: true, - payload: AccountInfo, -} | Unsuccessful$; - -export type GetAccountInfo$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -export type GetAddress$ = { - success: true, - payload: Address, -} | Unsuccessful$; - -export type GetAddress$$ = { - success: true, - payload: Array

, -} | Unsuccessful$; - -export type GetDeviceState$ = { - success: true, - payload: { - state: string, - }, -} | Unsuccessful$; - -export type GetFeatures$ = { - success: true, - payload: Features, -} | Unsuccessful$; - -export type GetPublicKey$ = { - success: true, - payload: HDNodeResponse, -} | Unsuccessful$; - -export type GetPublicKey$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -export type PushTransaction$ = { - success: true, - payload: { - txid: string, - }, -} | Unsuccessful$; - -export type RequestLogin$ = { - success: true, - payload: { - address: string, - publicKey: string, - signature: string, - }, -} | Unsuccessful$; - -export type ResetDevice$ = { - success: true, - payload: Success, -} | Unsuccessful$; - -export type SignMessage$ = { - success: true, - payload: MessageSignature, -} | Unsuccessful$; - -export type SignTransaction$ = { - success: true, - payload: SignedTx, -} | Unsuccessful$; - -export type VerifyMessage$ = { - success: true, - payload: Success, -} | Unsuccessful$; - -export type WipeDevice$ = { - success: true, - payload: Success, -} | Unsuccessful$; - -export type GetSettings$ = { - success: true, - payload: ConnectSettings, -} | Unsuccessful$; - -export type ApplyFlags$ = { - success: true, - payload: Success, -} | Unsuccessful$; - -export type ApplySettings$ = { - success: true, - payload: Success, -} | Unsuccessful$; - -export type BackupDevice$ = { - success: true, - payload: Success, -} | Unsuccessful$; - -export type ChangePin$ = { - success: true, - payload: Success, -} | Unsuccessful$; - -export type FirmwareRequest$ = { - length: number, - offset: number, -} -export type FirmwareUpload$ = { - success: true, - payload: Success, -} | FirmwareRequest$ | Unsuccessful$; - -export type RecoveryDevice$ = { - success: true, - payload: Success, -} | Unsuccessful$; diff --git a/src/js/types/ripple.js b/src/js/types/ripple.js deleted file mode 100644 index 23ed7e09f..000000000 --- a/src/js/types/ripple.js +++ /dev/null @@ -1,58 +0,0 @@ -/* @flow */ - -import type { $Path, $Common } from './params'; -import type { Unsuccessful$ } from './response'; - -// get address - -export type RippleAddress = { - address: string, - path: Array, - serializedPath: string, -} - -export type $RippleGetAddress = { - path: $Path, - showOnTrezor?: boolean, -} - -export type RippleGetAddress$ = { - success: true, - payload: RippleAddress, -} | Unsuccessful$; - -export type RippleGetAddress$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -// sign transaction - -type Payment = { - amount: string, - destination: string, - destinationTag?: number, -} - -export type Transaction = { - fee?: string, - flags?: number, - sequence?: number, - maxLedgerVersion?: number, // Proto: "last_ledger_sequence" - payment: Payment, -} - -export type $RippleSignTransaction = $Common & { - path: $Path, - transaction: Transaction, -} - -export type RippleSignedTx = { - serializedTx: string, - signature: string, -} - -export type RippleSignTransaction$ = { - success: true, - payload: RippleSignedTx, -} | Unsuccessful$; diff --git a/src/js/types/stellar.js b/src/js/types/stellar.js deleted file mode 100644 index b63948e3d..000000000 --- a/src/js/types/stellar.js +++ /dev/null @@ -1,187 +0,0 @@ -/* @flow */ - -// Stellar types from stellar-sdk -// https://github.com/stellar/js-stellar-base - -import type { $Path, $Common } from './params'; -import type { Unsuccessful$ } from './response'; - -export type Asset = { - type: 0 | 1 | 2, // 0: native, 1: credit_alphanum4, 2: credit_alphanum12 - code: string, - issuer?: string, -} - -export type CreateAccountOperation = { - +type: 'createAccount', // Proto: "StellarCreateAccountOp" - source?: string, // Proto: "source_account" - destination: string, // Proto: "new_account", - startingBalance: string, // Proto: "starting_balance" -} - -export type PaymentOperation = { - +type: 'payment', // Proto: "StellarPaymentOp" - source?: string, // Proto: "source_account" - destination: string, // Proto: "destination_account" - asset?: Asset | typeof undefined, // Proto: ok - amount: string, // Proto: ok -} - -export type PathPaymentOperation = { - +type: 'pathPayment', // Proto: "StellarPathPaymentOp" - source?: string, // Proto: "source_account" - sendAsset: Asset, // Proto: "send_asset" - sendMax: string, // Proto: "send_max" - destination: string, // Proto: "destination_account" - destAsset: Asset, // Proto: "destination_asset" - destAmount: string, // Proto "destination_amount" - path?: Array, // Proto: "paths" -} - -export type PassiveOfferOperation = { - +type: 'createPassiveOffer', // Proto: "StellarCreatePassiveOfferOp" - source?: string, // Proto: "source_account" - buying: Asset, // Proto: "buying_asset" - selling: Asset, // Proto: "selling_asset" - amount: string, // Proto: ok - price: { n: number, d: number }, // Proto: "price_n" and "price_d" -} - -export type ManageOfferOperation = { - +type: 'manageOffer', // Proto: "StellarManageOfferOp" - source?: string, // Proto: "source_account" - buying: Asset, // Proto: "buying_asset" - selling: Asset, // Proto: "selling_asset" - amount: string, // Proto: ok - offerId?: string, // Proto: "offer_id" // not found in stellar-sdk - price: { n: number, d: number }, // Proto: "price_n" and "price_d" -} - -export type SetOptionsOperation = { - +type: 'setOptions', // Proto: "StellarSetOptionsOp" - source?: string, // Proto: "source_account" - signer?: { - type: 0 | 1 | 2, - key: string | Buffer, - weight?: number, - }, - inflationDest?: string, // Proto: "inflation_destination_account" - clearFlags?: number, // Proto: "clear_flags" - setFlags?: number, // Proto: "set_flags" - masterWeight?: number | string, // Proto: "master_weight" - lowThreshold?: number | string, // Proto: "low_threshold" - medThreshold?: number | string, // Proto: "medium_threshold" - highThreshold?: number | string, // Proto: "high_threshold" - homeDomain?: string, // Proto: "home_domain" -} - -export type ChangeTrustOperation = { - +type: 'changeTrust', // Proto: "StellarChangeTrustOp" - source?: string, // Proto: "source_account" - line: Asset, // Proto: ok - limit?: string, // Proto: ok -} - -export type AllowTrustOperation = { - +type: 'allowTrust', // Proto: "StellarAllowTrustOp" - source?: string, // Proto: "source_account" - trustor: string, // Proto: "trusted_account" - assetCode: string, // Proto: "asset_code" - assetType: number, // Proto: "asset_type" // TODO not found in stellar-sdk - authorize?: boolean | typeof undefined, // Proto: "is_authorized" > parse to number -} - -export type AccountMergeOperation = { - +type: 'accountMerge', // Proto: "StellarAccountMergeOp" - source?: string, // Proto: "source_account" - destination: string, // Proto: "destination_account" -} - -export type ManageDataOperation = { - +type: 'manageData', // Proto: "StellarManageDataOp" - source?: string, // Proto: "source_account" - name: string, // Proto: "key" - value: string | Buffer | typeof undefined, // Proto: "value" -} - -// (?) Missing in stellar API but present in Proto messages -export type BumpSequenceOperation = { - +type: 'bumpSequence', // Proto: "StellarBumpSequenceOp" - source?: string, // Proto: "source_account" - bumpTo: number, // Proto: "bump_to" -} - -// (?) Missing in Proto messages, but present in Stellar API -export type InflationOperation = { - type: 'inflation', - source?: string, // Proto: "source_account" -} - -export type Operation = CreateAccountOperation - | PaymentOperation - | PathPaymentOperation - | PassiveOfferOperation - | ManageOfferOperation - | SetOptionsOperation - | ChangeTrustOperation - | AllowTrustOperation - | AccountMergeOperation - | InflationOperation - | ManageDataOperation - | BumpSequenceOperation; - -export type Transaction = { - source: string, // Proto: "source_account" - fee: number, // Proto: ok - sequence: string, // Proto: "sequence_number" - timebounds?: { - minTime: number, // Proto: "timebounds_start" - maxTime: number, // Proto: "timebounds_end" - }, - memo?: { - type: 0 | 1 | 2 | 3 | 4, // Proto: "memo_type" - id?: string, // Proto: "memo_id" - text?: string, // Proto: "memo_text" - hash?: string | Buffer, // Proto: "memo_hash" - }, - operations: Array, // Proto: calculated array length > "num_operations" -} - -export type $StellarSignTransaction = $Common & { - path: $Path, - networkPassphrase: string, - transaction: Transaction, -} - -export type StellarSignedTx = { - publicKey: string, - signature: string, -} - -export type StellarSignTransaction$ = { - success: true, - payload: StellarSignedTx, -} | Unsuccessful$; - -// get address - -export type StellarAddress = { - address: string, - path: Array, - serializedPath: string, -} - -export type $StellarGetAddress = { - path: $Path, - showOnTrezor?: boolean, -} - -export type StellarGetAddress$ = { - success: true, - payload: StellarAddress, -} | Unsuccessful$; - -export type StellarGetAddress$$ = { - success: true, - payload: Array, -} | Unsuccessful$; diff --git a/src/js/types/tezos.js b/src/js/types/tezos.js deleted file mode 100644 index 4e226ec8b..000000000 --- a/src/js/types/tezos.js +++ /dev/null @@ -1,128 +0,0 @@ -/* @flow */ - -import type { $Path, $Common } from './params'; -import type { Unsuccessful$ } from './response'; - -// get address - -export type TezosAddress = { - address: string, - path: Array, - serializedPath: string, -} - -export type $TezosGetAddress = $Common & { - path: $Path, - showOnTrezor?: boolean, -} - -export type TezosGetAddress$ = { - success: true, - payload: TezosAddress, -} | Unsuccessful$; - -export type TezosGetAddress$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -// get public key - -export type TezosPublicKey = { - publicKey: string, - path: Array, - serializedPath: string, -} - -export type $TezosGetPublicKey = { - path: $Path, - showOnTrezor?: boolean, -} - -export type TezosGetPublicKey$ = { - success: true, - payload: TezosPublicKey, -} | Unsuccessful$; - -export type TezosGetPublicKey$$ = { - success: true, - payload: Array, -} | Unsuccessful$; - -// sign transaction - -export type TezosRevealOperation = { - source: string, - fee: number, - counter: number, - gas_limit: number, - storage_limit: number, - public_key: string, -}; - -export type TezosManagerTransfer = { - destination: string, - amount: number, -}; - -export type TezosParametersManager = { - set_delegate?: string, - cancel_delegate?: boolean, - transfer?: TezosManagerTransfer, -} - -export type TezosTransactionOperation = { - source: string, - destination: string, - amount: number, - counter: number, - fee: number, - gas_limit: number, - storage_limit: number, - parameters?: Array, - parameters_manager?: TezosParametersManager, -}; - -export type TezosOriginationOperation = { - source: string, - balance: number, - delegate?: string, - script: Array, - fee: number, - counter: number, - gas_limit: number, - storage_limit: number, -}; - -export type TezosDelegationOperation = { - source: string, - delegate: string, - fee: number, - counter: number, - gas_limit: number, - storage_limit: number, -}; - -export type TezosOperation = { - reveal?: TezosRevealOperation, - transaction?: TezosTransactionOperation, - origination?: TezosOriginationOperation, - delegation?: TezosDelegationOperation, -}; - -export type $TezosSignTransaction = $Common & { - address_n: Array, - branch: string, - operation: TezosOperation, -}; - -export type TezosSignedTx = { - signatureContents: string, - signature: string, - hash: string, -}; - -export type TezosSignTransaction$ = { - success: true, - payload: TezosSignedTx, -} | Unsuccessful$; diff --git a/src/js/types/transactions.js b/src/js/types/transactions.js deleted file mode 100644 index bdf708a6d..000000000 --- a/src/js/types/transactions.js +++ /dev/null @@ -1,109 +0,0 @@ -/* @flow */ - -// copy-paste from blockchain-link - -export type VinVout = { - n: number, - addresses?: string[], - isAddress: boolean, - value?: string, - coinbase?: string, - txid?: string, - vout?: number, - sequence?: number, - hex?: string, -} - -export type BlockbookTransaction = { - txid: string, - version?: number, - vin: VinVout[], - vout: VinVout[], - blockHeight: number, - blockHash?: string, - confirmations: number, - blockTime: number, - value: string, - valueIn: string, - fees: string, - hex: string, - ethereumSpecific?: { - status: number, - nonce: number, - gasLimit: number, - gasUsed?: number, - gasPrice: string, - }, - tokenTransfers?: { - from?: string, - to?: string, - value: string, - token: string, - name: string, - symbol: string, - decimals?: number, - }[], -} - -// ripple-lib - -type Amount = { - value: string, - currency: string, - issuer?: string, - counterparty?: string, -} - -type Adjustment = { - address: string, - amount: Amount, - tag?: number, -} - -type Memo = { - type?: string, - format?: string, - data?: string, -} - -type Outcome = { - result: string, - ledgerVersion: number, - indexInLedger: number, - fee: string, - balanceChanges: { - [key: string]: { - currency: string, - counterparty?: string, - value: string, - }[], - }, - orderbookChanges: any, - timestamp?: string, -} - -export type RippleTransaction = { - type: string, - specification: { - source: Adjustment, - destination: Adjustment, - paths?: string, - memos?: Array, - invoiceID?: string, - allowPartialPayment?: boolean, - noDirectRipple?: boolean, - limitQuality?: boolean, - }, - outcome: Outcome, - id: string, - address: string, - sequence: number, -} - -export type GetTransactionResponse = { - type: 'blockbook', - tx: BlockbookTransaction, -} | { - type: 'ripple', - tx: RippleTransaction, -} diff --git a/src/js/types/trezor.js b/src/js/types/trezor.js deleted file mode 100644 index 679aa2359..000000000 --- a/src/js/types/trezor.js +++ /dev/null @@ -1,995 +0,0 @@ -/* @flow */ - -// This file has all various types that go into Trezor or out of it. - -export type CipheredKeyValue = { - value: string, -} - -export type Success = {}; - -export type Features = { - vendor: string, - major_version: number, - minor_version: number, - patch_version: number, - bootloader_mode: boolean, - device_id: string, - pin_protection: boolean, - passphrase_protection: boolean, - language: string, - label: string, - initialized: boolean, - revision: string, - bootloader_hash: string, - imported: boolean, - pin_cached: boolean, - passphrase_cached: boolean, - firmware_present: boolean, - needs_backup: boolean, - flags: number, - model: string, - fw_major: number, - fw_minor: number, - fw_patch: number, - fw_vendor: string, - fw_vendor_keys: string, - unfinished_backup: boolean, - no_backup: boolean, -}; - -export type ResetDeviceSettings = { - display_random?: boolean, - strength?: number, - passphrase_protection?: boolean, - pin_protection?: boolean, - language?: string, - label?: string, - u2f_counter?: number, - skip_backup?: boolean, -}; - -export type HDPrivNode = { - depth: number, - fingerprint: number, - child_num: number, - chain_code: string, - private_key: string, -}; - -export type HDPubNode = { - depth: number, - fingerprint: number, - child_num: number, - chain_code: string, - public_key: string, -}; - -export type HDNode = HDPubNode | HDPrivNode; - -export type LoadDeviceSettings = { - pin?: string, - passphrase_protection?: boolean, - language?: string, - label?: string, - skip_checksum?: boolean, - mnemonics?: Array, - mnemonic?: string, - node?: HDNode, - payload?: string, // will be converted - - u2f_counter?: number, -}; - -export type RecoverDeviceSettings = { - word_count?: number, - passphrase_protection?: boolean, - pin_protection?: boolean, - language?: string, - label?: string, - enforce_wordlist?: boolean, - type?: number, - u2f_counter?: number, -}; - -export type ApplySettings = { - language?: string, - label?: string, - use_passphrase?: boolean, - homescreen?: string, -}; - -export type MessageSignature = { - address: string, - signature: string, -} - -export type MultisigRedeemScriptType = { - pubkeys: Array<{ node: string | HDPubNode, address_n: Array }>, - signatures: Array, - m?: number, -} - -export type InputScriptType = 'SPENDADDRESS' | 'SPENDMULTISIG' | 'SPENDWITNESS' | 'SPENDP2SHWITNESS'; -// transaction input, parameter of SignTx message, declared by user -export type TransactionInput = {| - address_n: Array, - prev_hash: string, - prev_index: number, - script_type: InputScriptType, - sequence?: number, - amount?: string, // (segwit, bip143: true, zcash overwinter) - multisig?: MultisigRedeemScriptType, -|}; - -// transaction input, parameter of TxAck message, declared by user or downloaded from backend -export type RefTransactionInput = {| - prev_hash: string, - prev_index: number, - script_sig: string, - sequence: number, -|}; - -export type OutputScriptType = 'PAYTOADDRESS' | 'PAYTOMULTISIG' | 'PAYTOWITNESS' | 'PAYTOP2SHWITNESS'; -// transaction output, parameter of SignTx message, declared by user -export type TransactionOutput = {| - address: string, - script_type: 'PAYTOADDRESS', - amount: string, - multisig?: MultisigRedeemScriptType, -|} | {| - address_n: Array, - script_type: OutputScriptType, - amount: string, - multisig?: MultisigRedeemScriptType, -|} | {| - amount: '0', - op_return_data: string, - script_type: 'PAYTOOPRETURN', -|}; - -type TransactionBinOutput = { - amount: string, - script_pubkey: string, -}; - -export type RefTransaction = { - hash: string, - version?: ?number, - inputs: Array, - bin_outputs: Array, - lock_time?: ?number, - extra_data?: ?string, - timestamp?: ?number, - version_group_id?: ?number, -}; - -export type TransactionOptions = { - lock_time?: ?number, - timestamp?: ?number, - version?: ?number, - expiry?: ?number, - overwintered?: ?boolean, - version_group_id?: ?number, - branch_id?: ?number, -}; - -export type TxRequestDetails = { - request_index: number, - tx_hash?: string, - extra_data_len?: number, - extra_data_offset?: number, -}; - -export type TxRequestSerialized = { - signature_index?: number, - signature?: string, - serialized_tx?: string, -}; - -export type TxRequest = { - request_type: 'TXINPUT' | 'TXOUTPUT' | 'TXMETA' | 'TXFINISHED' | 'TXEXTRADATA', - details: TxRequestDetails, - serialized: TxRequestSerialized, -}; - -export type SignedTx = { - signatures: Array, - serializedTx: string, - txid?: string, -}; - -export type EthereumTxRequest = { - data_length?: number, - signature_v?: number, - signature_r?: string, - signature_s?: string, -}; - -export type EthereumAddress = { - address: string, -}; - -export type EthereumSignedTx = { - // v: number, - v: string, - r: string, - s: string, -}; - -export type Identity = { - proto?: string, - user?: string, - host?: string, - port?: string, - path?: string, - index?: number, -}; - -export type SignedIdentity = { - address: string, - public_key: string, - signature: string, -}; - -export type PublicKey = { - node: HDPubNode, - xpub: string, -}; - -// combined PublicKey and bitcoin.HDNode -export type HDNodeResponse = { - path: Array, - serializedPath: string, - childNum: number, - xpub: string, - xpubSegwit?: string, - chainCode: string, - publicKey: string, - fingerprint: number, - depth: number, -}; - -// this is what Trezor asks for -export type SignTxInfoToTrezor = { - inputs: Array, -} | { - bin_outputs: Array, -} | { - outputs: Array, -} | { - extra_data: string, -} | { - version: ?number, - lock_time: ?number, - inputs_cnt: number, - outputs_cnt: number, - extra_data_len?: number, - timestamp: ?number, - version_group_id: ?number, -}; - -// NEM types -export type NEMAddress = { - address: string, -} - -export type NEMSignedTx = { - data: string, - signature: string, -} - -export type NEMTransactionCommon = { - address_n: ?Array, - network: ?number, - timestamp: ?number, - fee: ?number, - deadline: ?number, - signer: ?string, -} - -export type NEMMosaic = { - namespace: ?string, - mosaic: ?string, - quantity: ?number, -} - -export type NEMTransfer = { - mosaics: ?Array, - public_key: ?string, - recipient: ?string, - amount: ?number, - payload: ?string, -} - -export type NEMProvisionNamespace = { - namespace: ?string, - sink: ?string, - fee: ?number, - parent: ?string, -} - -export type NEMMosaicLevyType = { - id: 1, - name: 'MosaicLevy_Absolute', -} | { - id: 2, - name: 'MosaicLevy_Percentile', -} - -export type NEMSupplyChangeType = { - id: 1, - name: 'SupplyChange_Increase', -} | { - id: 2, - name: 'SupplyChange_Decrease', -} - -export type NEMModificationType = { - id: 1, - name: 'CosignatoryModification_Add', -} | { - id: 2, - name: 'CosignatoryModification_Delete', -} - -export type NEMImportanceTransferMode = { - id: 1, - name: 'ImportanceTransfer_Activate', -} | { - id: 2, - name: 'ImportanceTransfer_Deactivate', -} - -export type NEMMosaicDefinition = { - name?: string, - ticker?: string, - namespace?: string, - mosaic?: string, - divisibility?: number, - fee?: number, - levy?: NEMMosaicLevyType, - levy_address?: string, - levy_namespace?: string, - levy_mosaic?: string, - supply?: number, - mutable_supply?: boolean, - transferable?: boolean, - description?: string, - networks?: number, -} - -export type NEMMosaicCreation = { - definition: ?NEMMosaicDefinition, - sink: ?string, - fee: ?number, -} - -export type NEMMosaicSupplyChange = { - namespace?: string, - type?: NEMSupplyChangeType, - mosaic?: string, - delta?: number, -} - -export type NEMCosignatoryModification = { - type?: NEMModificationType, - public_key?: string, -} - -export type NEMAggregateModification = { - modifications: ?Array, - relative_change: ?number, // TODO: "sint32" -} - -export type NEMImportanceTransfer = { - mode?: NEMImportanceTransferMode, - public_key?: string, -} - -export type NEMSignTxMessage = { - transaction?: NEMTransactionCommon, - cosigning?: boolean, - multisig?: NEMTransactionCommon, - transfer?: NEMTransfer, - provision_namespace?: NEMProvisionNamespace, - mosaic_creation?: NEMMosaicCreation, - supply_change?: NEMMosaicSupplyChange, - aggregate_modification?: NEMAggregateModification, - importance_transfer?: NEMImportanceTransfer, -} - -// Stellar types - -export type StellarAddress = { - address: string, -} - -export type StellarSignedTx = { - public_key: string, - signature: string, -} - -export type StellarPaymentOp = { - type: "StellarTxOpRequest", - message: {}, -} - -export type StellarSignTxMessage = {| - address_n: Array, - source_account: string, - fee: number, - sequence_number: string, - network_passphrase: string, - timebounds_start?: number, - timebounds_end?: number, - memo_type?: number, - memo_text?: string | typeof undefined, - memo_id?: string | typeof undefined, - memo_hash?: string | Buffer | typeof undefined, - num_operations: number, -|} - -export type StellarAsset = { - type: 0 | 1 | 2, - code: string, - issuer?: string, -} - -export type StellarOperationMessage = { - type: 'StellarCreateAccountOp', - source_account?: string, - new_account: string, - starting_balance: string, -} | { - type: 'StellarPaymentOp', - source_account?: string, - destination_account: string, - asset: StellarAsset | typeof undefined, - amount: string, -} | { - type: 'StellarPathPaymentOp', - source_account?: string, - send_asset: StellarAsset, - send_max: string, - destination_account: string, - destination_asset: StellarAsset, - destination_amount: string, - paths?: Array | typeof undefined, -} | { - type: 'StellarManageOfferOp', - source_account?: string, - offer_id?: string, - amount: string, - buying_asset: StellarAsset, - selling_asset: StellarAsset, - price_n: number, - price_d: number, -} | { - type: 'StellarCreatePassiveOfferOp', - source_account?: string, - offer_id?: string, - amount: string, - buying_asset: StellarAsset, - selling_asset: StellarAsset, - price_n: number, - price_d: number, -} | { - type: 'StellarSetOptionsOp', - source_account?: string, - signer_type?: number | typeof undefined, - signer_key?: string | Buffer | typeof undefined, - signer_weight?: number | typeof undefined, - clear_flags: ?number, - set_flags: ?number, - master_weight: ?(number | string), - low_threshold: ?(number | string), - medium_threshold: ?(number | string), - high_threshold: ?(number | string), - home_domain: ?string, - inflation_destination_account: ?string, -} | { - type: 'StellarChangeTrustOp', - source_account?: string, - asset: StellarAsset, - limit?: string, -} | { - type: 'StellarAllowTrustOp', - source_account?: string, - trusted_account: string, - asset_type: number, - asset_code: string, - is_authorized: ?number, -} | { - type: 'StellarAccountMergeOp', - source_account?: string, - destination_account: string, -} | { - type: 'StellarManageDataOp', - source_account?: string, - key: string, - value: string | Buffer | typeof undefined, -} | { - type: 'StellarBumpSequenceOp', - source_account?: string, - bump_to: number, -} - -// Tezos types -export type TezosAddress = { - address: string, -}; - -export type TezosPublicKey = { - public_key: string, -}; - -type TezosContractID = { - tag: number, - hash: Uint8Array, -}; - -export type TezosRevealOp = { - source: Uint8Array, - fee: number, - counter: number, - gas_limit: number, - storage_limit: number, - public_key: Uint8Array, -}; - -export type TezosManagerTransfer = { - amount: number, - destination: TezosContractID, -}; - -export type TezosParametersManager = { - set_delegate?: Uint8Array, - cancel_delegate?: boolean, - transfer?: TezosManagerTransfer, -}; - -export type TezosTransactionOp = { - source: Uint8Array, - destination: TezosContractID, - amount: number, - counter: number, - fee: number, - gas_limit: number, - storage_limit: number, - parameters?: Array, - parameters_manager?: TezosParametersManager, -}; - -export type TezosOriginationOp = { - source: Uint8Array, - balance: number, - delegate?: Uint8Array, - fee: number, - counter: number, - gas_limit: number, - storage_limit: number, - script: Array, -}; - -export type TezosDelegationOp = { - source: Uint8Array, - delegate: Uint8Array, - fee: number, - counter: number, - gas_limit: number, - storage_limit: number, -}; - -export type TezosTransaction = { - address_n: Array, - branch: Uint8Array, - reveal?: TezosRevealOp, - transaction?: TezosTransactionOp, - origination?: TezosOriginationOp, - delegation?: TezosDelegationOp, -}; - -export type TezosSignedTx = { - signature: string, - sig_op_contents: string, - operation_hash: string, -}; - -// Cardano types -export type CardanoAddress = { - address: string, - address_n?: Array, -}; - -export type CardanoPublicKey = { - xpub: string, - node: HDPubNode, -}; - -export type CardanoSignedTx = { - tx_hash: string, - tx_body: string, -}; -export type CardanoTxInput = { - tx_hash: string, - address_n: Array, - output_index: number, - type?: number, -}; -export type CardanoTxOutput = { - address?: string, - address_n?: Array, - amount: string, -}; - -export type CardanoTxRequest = { - tx_index: number, - tx_hash: string, - tx_body: string, -}; - -// Lisk types -export type LiskAddress = { - address: string, -} - -export type LiskPublicKey = { - public_key: string, -} - -export type LiskMessageSignature = { - public_key: string, - signature: string, -}; - -export type LiskAsset = - { data: string } | - { votes: Array } | - { delegate: { username: string } } | - { signature: { public_key: string } } | - { - multisignature: { - min: number, - life_time: number, - keys_group: Array, - }, - }; - -export type LiskTransaction = { - type: number, - fee: string, - amount: string, - timestamp: number, - recipient_id?: string, - sender_public_key?: string, - requester_public_key?: string, - signature?: string, - asset?: LiskAsset, -} - -export type LiskSignedTx = { - signature: string, -} - -// Ripple types -export type RippleAddress = { - address: string, -} - -export type RippleTransaction = { - address_n: Array, - fee?: number, - flags?: number, - sequence?: number, - last_ledger_sequence?: number, - payment: { - amount: string, - destination: string, - }, -} - -export type RippleSignedTx = { - signature: string, - serialized_tx: string, -} - -// EOS types -export type EosPublicKey = { - wif_public_key: string, - raw_public_key: string, -} - -export type EosTxActionRequest = { - data_size: ?number, -} - -export type EosTxHeader = { - expiration: number, - ref_block_num: number, - ref_block_prefix: number, - max_net_usage_words: number, - max_cpu_usage_ms: number, - delay_sec: number, -} - -export type EosSignTx = { - address_n: Array, - chain_id: string, - header: ?EosTxHeader, - num_actions: number, -} - -export type EosAsset = { - amount: string, // uint64 as string - symbol: string, // uint64 as string -} - -export type EosPermissionLevel = { - actor: string, // uint64 as string - permission: string, // uint64 as string -} - -export type EosAuthorizationKey = { - type: number, - key: string, - // address_n?: Array, // this field is not implemented in FW - weight: number, -} - -export type EosAuthorization = { - threshold: number, - keys: Array, - accounts: Array<{ - account: EosPermissionLevel, - weight: number, - }>, - waits: Array<{ - wait_sec: number, - weight: number, - }>, -} - -export type EosActionCommon = { - account: string, // uint64 as string - name: string, // uint64 as string - authorization: Array, -} - -export type EosActionTransfer = { - sender: string, // uint64 as string - receiver: string, // uint64 as string - quantity: EosAsset, - memo?: string, -} - -export type EosActionDelegate = { - sender: string, // uint64 as string - receiver: string, // uint64 as string - net_quantity: EosAsset, - cpu_quantity: EosAsset, - transfer?: boolean, -} - -export type EosActionUndelegate = { - sender: string, // uint64 as string - receiver: string, // uint64 as string - net_quantity: EosAsset, - cpu_quantity: EosAsset, -} - -export type EosActionBuyRam = { - payer: string, // uint64 as string - receiver: string, // uint64 as string - quantity: EosAsset, -} - -export type EosActionBuyRamBytes = { - payer: string, // uint64 as string - receiver: string, // uint64 as string - bytes: number, -} - -export type EosActionSellRam = { - account: string, // uint64 as string - bytes: number, -} - -export type EosActionVoteProducer = { - voter: string, // uint64 as string - proxy: string, // uint64 as string - producers: Array, // uint64[] as string -} - -export type EosActionRefund = { - owner: string, // uint64 as string -} - -export type EosActionUpdateAuth = { - account: string, // uint64 as string - permission: string, // uint64 as string - parent: string, // uint64 as string - auth: EosAuthorization, -} - -export type EosActionDeleteAuth = { - account: string, // uint64 as string - permission: string, // uint64 as string -} - -export type EosActionLinkAuth = { - account: string, // uint64 as string - code: string, // uint64 as string - type: string, // uint64 as string - requirement: string, // uint64 as string -} - -export type EosActionUnlinkAuth = { - account: string, // uint64 as string - code: string, // uint64 as string - type: string, // uint64 as string -} - -export type EosActionNewAccount = { - creator: string, // uint64 as string - name: string, // uint64 as string - owner: EosAuthorization, - active: EosAuthorization, -} - -export type EosActionUnknown = { - data_size: number, - data_chunk: string, -} - -export type EosTxActionAck = { - common?: EosActionCommon, - transfer?: EosActionTransfer, - delegate?: EosActionDelegate, - undelegate?: EosActionUndelegate, - refund?: EosActionRefund, - buy_ram?: EosActionBuyRam, - buy_ram_bytes?: EosActionBuyRamBytes, - sell_ram?: EosActionSellRam, - vote_producer?: EosActionVoteProducer, - update_auth?: EosActionUpdateAuth, - delete_auth?: EosActionDeleteAuth, - link_auth?: EosActionLinkAuth, - unlink_auth?: EosActionUnlinkAuth, - new_account?: EosActionNewAccount, - unknown?: EosActionUnknown, -} - -export type EosSignedTx = { - signature: string, -} - -// Binance types -export type BinanceAddress = { - address: string, -} - -export type BinancePublicKey = { - public_key: string, -} - -export type BinanceSignTx = { - address_n: Array, - msg_count: number, - chain_id: string, - account_number: number, - memo?: string, - sequence: number, - source: number, -} - -export type BinanceTxRequest = { - -} - -export type BinanceInputOutput = { - address: string, - coins: { - amount: number, - denom: string, - }, -} - -export type BinanceTransferMsg = { - inputs: BinanceInputOutput[], - outputs: BinanceInputOutput[], -} - -export type BinanceOrderMsg = { - id: string, - ordertype: number, // 'OT_UNKNOWN' | 'MARKET' | 'LIMIT' | 'OT_RESERVED', - price: number, - quantity: number, - sender: string, - side: number, // 'SIDE_UNKNOWN' | 'BUY' | 'SELL', - symbol: string, - timeinforce: number, // 'TIF_UNKNOWN' | 'GTE' | 'TIF_RESERVED' | 'IOC', -} - -export type BinanceCancelMsg = { - refid: string, - sender: string, - symbol: string, -} - -export type BinanceMessage = BinanceTransferMsg | BinanceOrderMsg | BinanceCancelMsg; - -export type BinanceSignedTx = { - signature: string, - public_key: string, -} - -// GetAddress response -export type Address = { - address: string, - path: Array, - serializedPath: string, -} - -// Reset device flags -export type ResetDeviceFlags = { - display_random?: boolean, - strength?: number, - passphrase_protection?: boolean, - pin_protection?: boolean, - language?: string, - label?: string, - u2f_counter?: number, - skip_backup?: boolean, - no_backup?: boolean, -} - -export type FirmwareErase = { - length?: number, -}; - -export type FirmwareUpload = { - payload: Buffer, - length: number, - // hash?: string, -} - -export type ChangePin = { - remove?: boolean, -} - -export type Flags = { - flags: number, -} - -export type DebugLinkDecision = {| - yes_no?: boolean, - up_down?: boolean, - input?: string, -|} - -export type DebugLinkState = { - layout: string, - pin: string, - matrix: string, - mnemonic: string, - node: HDNode, - passphrase_protection: boolean, - reset_word: string, - reset_entropy: string, - recovery_fake_word: string, - recovery_word_pos: number, - reset_word_pos: number, -} - -export type LoadDeviceFlags = { - mnemonics?: Array, - mnemonic?: string, - node?: HDNode, - pin?: string, - passphrase_protection?: boolean, - language?: string, - label?: string, - skip_checksum?: boolean, - u2f_counter?: number, -} diff --git a/src/js/types/trezor/device.js b/src/js/types/trezor/device.js new file mode 100644 index 000000000..e5fbe0ecb --- /dev/null +++ b/src/js/types/trezor/device.js @@ -0,0 +1,105 @@ +/* @flow */ +import { DEVICE } from '../../constants'; + +export type DeviceStateResponse = { + state: string; +} + +export type DeviceStatus = 'available' | 'occupied' | 'used'; + +export type DeviceMode = 'normal' | 'bootloader' | 'initialize' | 'seedless'; + +export type DeviceFirmwareStatus = 'valid' | 'outdated' | 'required' | 'unknown' | 'none'; + +export type UnavailableCapability = + | 'no-capability' + | 'no-support' + | 'update-required' + | 'trezor-connect-outdated' + | string[]; + +export type FirmwareRange = { + '1': { + min: string; + max: string; + }; + '2': { + min: string; + max: string; + }; +} + +export type FirmwareRelease = { + required: true; + version: Array; + min_bridge_version: Array; + min_firmware_version: Array; + bootloader_version: Array; + min_bootloader_version: Array; + url: string; + channel: string; + fingerprint: string; + changelog: string; +} + +export type Features = { + bootloader_hash?: string | null; + bootloader_mode?: boolean | null; + device_id: string | null; + firmware_present?: boolean | null; + flags: number; + fw_major?: number | null; + fw_minor?: number | null; + fw_patch?: number | null; + fw_vendor?: string | null; + fw_vendor_keys?: string | null; + imported?: boolean | null; + initialized: boolean; + label: string | null; + language?: string | null; + major_version: number; + minor_version: number; + model: string; + needs_backup: boolean; + no_backup: boolean; + passphrase_cached: boolean; + passphrase_protection: boolean; + patch_version: number; + pin_cached: boolean; + pin_protection: boolean; + revision: string; + unfinished_backup: boolean; + vendor: string; + recovery_mode?: boolean; + session_id?: string; + passphrase_always_on_device?: boolean; + capabilities?: string[]; +} + +export type Device = + | { + type: 'acquired'; + path: string; + label: string; + firmware: DeviceFirmwareStatus; + firmwareRelease: ?FirmwareRelease; + status: DeviceStatus; + mode: DeviceMode; + state: ?string; + features: Features; + unavailableCapabilities: { [key: string]: UnavailableCapability }; + } + | { + type: 'unacquired' | 'unreadable'; + path: string; + label: string; + features?: typeof undefined; + }; + +export type DeviceEvent = { + type: | typeof DEVICE.CONNECT + | typeof DEVICE.CONNECT_UNACQUIRED + | typeof DEVICE.CHANGED + | typeof DEVICE.DISCONNECT; + payload: Device; +}; diff --git a/src/js/types/trezor/management.js b/src/js/types/trezor/management.js new file mode 100644 index 000000000..79e33001c --- /dev/null +++ b/src/js/types/trezor/management.js @@ -0,0 +1,46 @@ +/* @flow */ + +export type ResetDevice = { + strength?: number; + label?: string; + u2f_counter?: number; + pin_protection?: boolean; + passphrase_protection?: boolean; + skip_backup?: boolean; + no_backup?: boolean; + backup_type?: 0 | 1; +} + +export type ApplySettings = { + homescreen?: string; + display_rotation?: 0 | 90 | 180 | 270; + use_passphrase?: boolean; + label?: string; +} + +export type ApplyFlags = { + flags: number; +} + +export type ChangePin = { + remove?: boolean; +} + +export type FirmwareUpdate = { + payload: ArrayBuffer; +} + +export type FirmwareRequest = { + length: number; + offset: number; +} + +export type RecoveryDevice = { + passphrase_protection?: boolean; + pin_protection?: boolean; + label?: string; + type?: 0 | 1; + dry_run?: boolean; + word_count?: 12 | 18 | 24; + // there are more of them but dont have a valid usecase now +} diff --git a/src/js/types/trezor/protobuf.js b/src/js/types/trezor/protobuf.js new file mode 100644 index 000000000..8d381cb4a --- /dev/null +++ b/src/js/types/trezor/protobuf.js @@ -0,0 +1,1000 @@ +/* @flow */ + +// This file has all various types that go into Trezor or out of it. + +export type CipheredKeyValue = { + value: string; +} + +export type Success = {}; + +export type Features = { + vendor: string; + major_version: number; + minor_version: number; + patch_version: number; + bootloader_mode: boolean; + device_id: string; + pin_protection: boolean; + passphrase_protection: boolean; + language: string; + label: string; + initialized: boolean; + revision: string; + bootloader_hash: string; + imported: boolean; + pin_cached: boolean; + passphrase_cached: boolean; + firmware_present: boolean; + needs_backup: boolean; + flags: number; + model: string; + fw_major: number; + fw_minor: number; + fw_patch: number; + fw_vendor: string; + fw_vendor_keys: string; + unfinished_backup: boolean; + no_backup: boolean; +}; + +export type HDPrivNode = { + depth: number; + fingerprint: number; + child_num: number; + chain_code: string; + private_key: string; +}; + +export type HDPubNode = { + depth: number; + fingerprint: number; + child_num: number; + chain_code: string; + public_key: string; +}; + +export type HDNode = HDPubNode | HDPrivNode; + +export type PublicKey = { + node: HDPubNode; + xpub: string; +}; + +// combined Bitcoin.PublicKey and Bitcoin.HDNode +export type HDNodeResponse = { + path: Array; + serializedPath: string; + childNum: number; + xpub: string; + xpubSegwit?: string; + chainCode: string; + publicKey: string; + fingerprint: number; + depth: number; +}; + +// Bitcoin.getAddress response +export type Address = { + address: string; + path: number[]; +} + +export type MessageSignature = { + address: string; + signature: string; +} + +// Bitcoin.signTransaction + +export type MultisigRedeemScriptType = { + pubkeys: Array<{ node: string | HDPubNode; address_n: number[] }>; + signatures: string[]; + m?: number; +} + +export type InputScriptType = 'SPENDADDRESS' | 'SPENDMULTISIG' | 'SPENDWITNESS' | 'SPENDP2SHWITNESS'; + +// transaction input, parameter of SignTx message, declared by user +export type TransactionInput = {| + address_n: number[]; + prev_hash: string; + prev_index: number; + script_type?: InputScriptType; + sequence?: number; + amount?: string; // (segwit, bip143: true, zcash overwinter) + multisig?: MultisigRedeemScriptType; +|}; + +export type OutputScriptType = 'PAYTOADDRESS' | 'PAYTOMULTISIG' | 'PAYTOWITNESS' | 'PAYTOP2SHWITNESS'; + +// transaction output, parameter of SignTx message, declared by user +export type TransactionOutput = {| + address: string; + script_type: 'PAYTOADDRESS'; + amount: string; + multisig?: MultisigRedeemScriptType; +|} | {| + address_n: Array; + script_type: OutputScriptType; + amount: string; + multisig?: MultisigRedeemScriptType; +|} | {| + amount: '0'; + op_return_data: string; + script_type: 'PAYTOOPRETURN'; +|}; + +type TransactionBinOutput = { + amount: string; + script_pubkey: string; +}; + +// transaction input, parameter of TxAck message, declared by user or downloaded from backend +export type RefTransactionInput = {| + prev_hash: string; + prev_index: number; + script_sig: string; + sequence: number; +|}; + +export type RefTransaction = { + hash: string; + version?: ?number; + inputs: Array; + bin_outputs: Array; + lock_time?: ?number; + extra_data?: ?string; + timestamp?: ?number; + version_group_id?: ?number; +}; + +export type TransactionOptions = { + lock_time?: ?number; + timestamp?: ?number; + version?: ?number; + expiry?: ?number; + overwintered?: ?boolean; + version_group_id?: ?number; + branch_id?: ?number; +}; + +export type TxRequestDetails = { + request_index: number; + tx_hash?: string; + extra_data_len?: number; + extra_data_offset?: number; +}; + +export type TxRequestSerialized = { + signature_index?: number; + signature?: string; + serialized_tx?: string; +}; + +export type TxRequest = { + request_type: 'TXINPUT' | 'TXOUTPUT' | 'TXMETA' | 'TXFINISHED' | 'TXEXTRADATA'; + details: TxRequestDetails; + serialized: TxRequestSerialized; +}; + +export type SignedTx = { + signatures: string[]; + serializedTx: string; +}; + +// Ethereum.signTransaction + +export type EthereumTxRequest = { + data_length?: number; + signature_v?: number; + signature_r?: string; + signature_s?: string; +}; + +export type EthereumAddress = { + address: string; +}; + +export type EthereumSignedTx = { + // v: number, + v: string; + r: string; + s: string; +}; + +export type Identity = { + proto?: string; + user?: string; + host?: string; + port?: string; + path?: string; + index?: number; +}; + +export type SignedIdentity = { + address: string; + public_key: string; + signature: string; +}; + +// this is what Trezor asks for +export type SignTxInfoToTrezor = { + inputs: Array; +} | { + bin_outputs: Array; +} | { + outputs: Array; +} | { + extra_data: string; +} | { + version: ?number; + lock_time: ?number; + inputs_cnt: number; + outputs_cnt: number; + extra_data_len?: number; + timestamp: ?number; + version_group_id: ?number; +}; + +// NEM types +export type NEMAddress = { + address: string; +} + +export type NEMSignedTx = { + data: string; + signature: string; +} + +export type NEMTransactionCommon = { + address_n: ?Array; + network: ?number; + timestamp: ?number; + fee: ?number; + deadline: ?number; + signer: ?string; +} + +export type NEMMosaic = { + namespace: ?string; + mosaic: ?string; + quantity: ?number; +} + +export type NEMTransfer = { + mosaics: ?Array; + public_key: ?string; + recipient: ?string; + amount: number | string; + payload: ?string; +} + +export type NEMProvisionNamespace = { + namespace: ?string; + sink: ?string; + fee: ?number; + parent: ?string; +} + +export type NEMMosaicLevyType = { + id: 1; + name: 'MosaicLevy_Absolute'; +} | { + id: 2; + name: 'MosaicLevy_Percentile'; +} + +export type NEMSupplyChangeType = { + id: 1; + name: 'SupplyChange_Increase'; +} | { + id: 2; + name: 'SupplyChange_Decrease'; +} + +export type NEMModificationType = { + id: 1; + name: 'CosignatoryModification_Add'; +} | { + id: 2; + name: 'CosignatoryModification_Delete'; +} + +export type NEMImportanceTransferMode = { + id: 1; + name: 'ImportanceTransfer_Activate'; +} | { + id: 2; + name: 'ImportanceTransfer_Deactivate'; +} + +export type NEMMosaicDefinition = { + name?: string; + ticker?: string; + namespace?: string; + mosaic?: string; + divisibility?: number; + fee?: number; + levy?: NEMMosaicLevyType; + levy_address?: string; + levy_namespace?: string; + levy_mosaic?: string; + supply?: number; + mutable_supply?: boolean; + transferable?: boolean; + description?: string; + networks?: number; +} + +export type NEMMosaicCreation = { + definition: ?NEMMosaicDefinition; + sink: ?string; + fee: ?number; +} + +export type NEMMosaicSupplyChange = { + namespace?: string; + type?: NEMSupplyChangeType; + mosaic?: string; + delta?: number; +} + +export type NEMCosignatoryModification = { + type?: NEMModificationType; + public_key?: string; +} + +export type NEMAggregateModification = { + modifications: ?Array; + relative_change: ?number; // TODO: "sint32" +} + +export type NEMImportanceTransfer = { + mode?: NEMImportanceTransferMode; + public_key?: string; +} + +export type NEMSignTxMessage = { + transaction?: NEMTransactionCommon; + cosigning?: boolean; + multisig?: NEMTransactionCommon; + transfer?: NEMTransfer; + provision_namespace?: NEMProvisionNamespace; + mosaic_creation?: NEMMosaicCreation; + supply_change?: NEMMosaicSupplyChange; + aggregate_modification?: NEMAggregateModification; + importance_transfer?: NEMImportanceTransfer; +} + +// Stellar types + +export type StellarAddress = { + address: string; +} + +export type StellarSignedTx = { + public_key: string; + signature: string; +} + +export type StellarPaymentOp = { + type: "StellarTxOpRequest"; + message: {}; +} + +export type StellarSignTxMessage = {| + address_n: Array; + source_account: string; + fee: number; + sequence_number: string | number; + network_passphrase: string; + timebounds_start?: number; + timebounds_end?: number; + memo_type?: number; + memo_text?: string | typeof undefined; + memo_id?: string | typeof undefined; + memo_hash?: string | Buffer | typeof undefined; + num_operations: number; +|} + +export type StellarAsset = { + type: 0 | 1 | 2; + code: string; + issuer?: string; +} + +export type StellarOperationMessage = { + type: 'StellarCreateAccountOp'; + source_account?: string; + new_account: string; + starting_balance: string; +} | { + type: 'StellarPaymentOp'; + source_account?: string; + destination_account: string; + asset: StellarAsset | typeof undefined; + amount: string; +} | { + type: 'StellarPathPaymentOp'; + source_account?: string; + send_asset: StellarAsset; + send_max: string; + destination_account: string; + destination_asset: StellarAsset; + destination_amount: string; + paths?: Array | typeof undefined; +} | { + type: 'StellarManageOfferOp'; + source_account?: string; + offer_id?: string; + amount: string; + buying_asset: StellarAsset; + selling_asset: StellarAsset; + price_n: number; + price_d: number; +} | { + type: 'StellarCreatePassiveOfferOp'; + source_account?: string; + offer_id?: string; + amount: string; + buying_asset: StellarAsset; + selling_asset: StellarAsset; + price_n: number; + price_d: number; +} | { + type: 'StellarSetOptionsOp'; + source_account?: string; + signer_type?: number | typeof undefined; + signer_key?: string | Buffer | typeof undefined; + signer_weight?: number | typeof undefined; + clear_flags: ?number; + set_flags: ?number; + master_weight: ?(number | string); + low_threshold: ?(number | string); + medium_threshold: ?(number | string); + high_threshold: ?(number | string); + home_domain: ?string; + inflation_destination_account: ?string; +} | { + type: 'StellarChangeTrustOp'; + source_account?: string; + asset: StellarAsset; + limit?: string; +} | { + type: 'StellarAllowTrustOp'; + source_account?: string; + trusted_account: string; + asset_type: number; + asset_code: string; + is_authorized: ?number; +} | { + type: 'StellarAccountMergeOp'; + source_account?: string; + destination_account: string; +} | { + type: 'StellarManageDataOp'; + source_account?: string; + key: string; + value: ?(string | Buffer); +} | { + type: 'StellarBumpSequenceOp'; + source_account?: string; + bump_to: string | number; +} + +// Tezos types +export type TezosAddress = { + address: string; +}; + +export type TezosPublicKey = { + public_key: string; +}; + +type TezosContractID = { + tag: number; + hash: Uint8Array; +}; + +export type TezosRevealOp = { + source: Uint8Array; + fee: number; + counter: number; + gas_limit: number; + storage_limit: number; + public_key: Uint8Array; +}; + +export type TezosManagerTransfer = { + amount: number; + destination: TezosContractID; +}; + +export type TezosParametersManager = { + set_delegate?: Uint8Array; + cancel_delegate?: boolean; + transfer?: TezosManagerTransfer; +}; + +export type TezosTransactionOp = { + source: Uint8Array; + destination: TezosContractID; + amount: number; + counter: number; + fee: number; + gas_limit: number; + storage_limit: number; + parameters?: Array; + parameters_manager?: TezosParametersManager; +}; + +export type TezosOriginationOp = { + source: Uint8Array; + balance: number; + delegate?: Uint8Array; + fee: number; + counter: number; + gas_limit: number; + storage_limit: number; + script: string | number[]; +}; + +export type TezosDelegationOp = { + source: Uint8Array; + delegate: Uint8Array; + fee: number; + counter: number; + gas_limit: number; + storage_limit: number; +}; + +export type TezosTransaction = { + address_n: Array; + branch: Uint8Array; + reveal?: TezosRevealOp; + transaction?: TezosTransactionOp; + origination?: TezosOriginationOp; + delegation?: TezosDelegationOp; +}; + +export type TezosSignedTx = { + signature: string; + sig_op_contents: string; + operation_hash: string; +}; + +// Cardano types +export type CardanoAddress = { + address: string; + address_n?: Array; +}; + +export type CardanoPublicKey = { + xpub: string; + node: HDPubNode; +}; + +export type CardanoSignedTx = { + tx_hash: string; + tx_body: string; +}; +export type CardanoTxInput = { + tx_hash: string; + address_n: Array; + output_index: number; + type?: number; +}; +export type CardanoTxOutput = { + address?: string; + address_n?: Array; + amount: string; +}; + +export type CardanoTxRequest = { + tx_index: number; + tx_hash: string; + tx_body: string; +}; + +// Lisk types +export type LiskAddress = { + address: string; +} + +export type LiskPublicKey = { + public_key: string; +} + +export type LiskMessageSignature = { + public_key: string; + signature: string; +}; + +export type LiskAsset = + { data: string } | + { votes: Array } | + { delegate: { username: string } } | + { signature: { public_key: string } } | + { + multisignature: { + min: number; + life_time: number; + keys_group: Array; + }; + }; + +export type LiskTransaction = { + type: number; + fee: string; + amount: string; + timestamp: number; + recipient_id?: string; + sender_public_key?: string; + requester_public_key?: string; + signature?: string; + asset?: LiskAsset | {}; +} + +export type LiskSignedTx = { + signature: string; +} + +// Ripple types +export type RippleAddress = { + address: string; +} + +export type RippleTransaction = { + address_n: Array; + fee?: number; + flags?: number; + sequence?: number; + last_ledger_sequence?: number; + payment: { + amount: string; + destination: string; + }; +} + +export type RippleSignedTx = { + signature: string; + serialized_tx: string; +} + +// EOS types +export type EosPublicKey = { + wif_public_key: string; + raw_public_key: string; +} + +export type EosTxActionRequest = { + data_size: ?number; +} + +export type EosTxHeader = { + expiration: number; + ref_block_num: number; + ref_block_prefix: number; + max_net_usage_words: number; + max_cpu_usage_ms: number; + delay_sec: number; +} + +export type EosSignTx = { + address_n: Array; + chain_id: string; + header: ?EosTxHeader; + num_actions: number; +} + +export type EosAsset = { + amount: string; // uint64 as string + symbol: string; // uint64 as string +} + +export type EosPermissionLevel = { + actor: string; // uint64 as string + permission: string; // uint64 as string +} + +export type EosAuthorizationKey = { + type?: number; + key: string; + address_n?: number[]; // this field is not implemented in FW? + weight: number; +} + +export type EosAuthorization = { + threshold: number; + keys: EosAuthorizationKey[]; + accounts: Array<{ + account: EosPermissionLevel; + weight: number; + }>; + waits: Array<{ + wait_sec: number; + weight: number; + }>; +} + +export type EosActionCommon = { + account: string; // uint64 as string + name: string; // uint64 as string + authorization: Array; +} + +export type EosActionTransfer = { + sender: string; // uint64 as string + receiver: string; // uint64 as string + quantity: EosAsset; + memo?: string; +} + +export type EosActionDelegate = { + sender: string; // uint64 as string + receiver: string; // uint64 as string + net_quantity: EosAsset; + cpu_quantity: EosAsset; + transfer?: boolean; +} + +export type EosActionUndelegate = { + sender: string; // uint64 as string + receiver: string; // uint64 as string + net_quantity: EosAsset; + cpu_quantity: EosAsset; +} + +export type EosActionBuyRam = { + payer: string; // uint64 as string + receiver: string; // uint64 as string + quantity: EosAsset; +} + +export type EosActionBuyRamBytes = { + payer: string; // uint64 as string + receiver: string; // uint64 as string + bytes: number; +} + +export type EosActionSellRam = { + account: string; // uint64 as string + bytes: number; +} + +export type EosActionVoteProducer = { + voter: string; // uint64 as string + proxy: string; // uint64 as string + producers: Array; // uint64[] as string +} + +export type EosActionRefund = { + owner: string; // uint64 as string +} + +export type EosActionUpdateAuth = { + account: string; // uint64 as string + permission: string; // uint64 as string + parent: string; // uint64 as string + auth: EosAuthorization; +} + +export type EosActionDeleteAuth = { + account: string; // uint64 as string + permission: string; // uint64 as string +} + +export type EosActionLinkAuth = { + account: string; // uint64 as string + code: string; // uint64 as string + type: string; // uint64 as string + requirement: string; // uint64 as string +} + +export type EosActionUnlinkAuth = { + account: string; // uint64 as string + code: string; // uint64 as string + type: string; // uint64 as string +} + +export type EosActionNewAccount = { + creator: string; // uint64 as string + name: string; // uint64 as string + owner: EosAuthorization; + active: EosAuthorization; +} + +export type EosActionUnknown = { + data_size: number; + data_chunk: string; +} + +export type EosTxActionAck = { + common?: EosActionCommon; + transfer?: EosActionTransfer; + delegate?: EosActionDelegate; + undelegate?: EosActionUndelegate; + refund?: EosActionRefund; + buy_ram?: EosActionBuyRam; + buy_ram_bytes?: EosActionBuyRamBytes; + sell_ram?: EosActionSellRam; + vote_producer?: EosActionVoteProducer; + update_auth?: EosActionUpdateAuth; + delete_auth?: EosActionDeleteAuth; + link_auth?: EosActionLinkAuth; + unlink_auth?: EosActionUnlinkAuth; + new_account?: EosActionNewAccount; + unknown?: EosActionUnknown; +} + +export type EosSignedTx = { + signature: string; +} + +// Binance types +export type BinanceAddress = { + address: string; +} + +export type BinancePublicKey = { + public_key: string; +} + +export type BinanceSignTx = { + address_n: Array; + msg_count: number; + chain_id: string; + account_number: number; + memo?: string; + sequence: number; + source: number; +} + +export type BinanceTxRequest = { + +} + +export type BinanceInputOutput = { + address: string; + coins: { + amount: number; + denom: string; + }[]; +} + +export type BinanceTransferMsg = { + inputs: BinanceInputOutput[]; + outputs: BinanceInputOutput[]; +} + +export type BinanceOrderMsg = { + id: string; + ordertype: number; // 'OT_UNKNOWN' | 'MARKET' | 'LIMIT' | 'OT_RESERVED', + price: number; + quantity: number; + sender: string; + side: number; // 'SIDE_UNKNOWN' | 'BUY' | 'SELL', + symbol: string; + timeinforce: number; // 'TIF_UNKNOWN' | 'GTE' | 'TIF_RESERVED' | 'IOC', +} + +export type BinanceCancelMsg = { + refid: string; + sender: string; + symbol: string; +} + +export type BinanceMessage = BinanceTransferMsg | BinanceOrderMsg | BinanceCancelMsg; + +export type BinanceSignedTx = { + signature: string; + public_key: string; +} + +// Reset device flags +export type ResetDeviceFlags = { + display_random?: boolean; + strength?: number; + passphrase_protection?: boolean; + pin_protection?: boolean; + language?: string; + label?: string; + u2f_counter?: number; + skip_backup?: boolean; + no_backup?: boolean; +} + +export type FirmwareErase = { + length?: number; +}; + +export type FirmwareUpload = { + payload: Buffer; + length: number; + // hash?: string, +} + +export type ChangePin = { + remove?: boolean; +} + +export type Flags = { + flags: number; +} + +export type DebugLinkDecision = {| + yes_no?: boolean; + up_down?: boolean; + input?: string; +|} + +export type DebugLinkState = { + layout: string; + pin: string; + matrix: string; + mnemonic: string; + node: HDNode; + passphrase_protection: boolean; + reset_word: string; + reset_entropy: string; + recovery_fake_word: string; + recovery_word_pos: number; + reset_word_pos: number; +} + +export type LoadDeviceFlags = { + mnemonics?: Array; + mnemonic?: string; + node?: HDNode; + pin?: string; + passphrase_protection?: boolean; + language?: string; + label?: string; + skip_checksum?: boolean; + u2f_counter?: number; +} + +export type RecoverDeviceSettings = { + word_count?: number; + passphrase_protection?: boolean; + pin_protection?: boolean; + language?: string; + label?: string; + enforce_wordlist?: boolean; + type?: number; + u2f_counter?: number; + dry_run?: boolean; +}; + +export type LoadDeviceSettings = { + pin?: string; + passphrase_protection?: boolean; + language?: string; + label?: string; + skip_checksum?: boolean; + mnemonics?: Array; + mnemonic?: string; + node?: HDNode; + payload?: string; // will be converted + + u2f_counter?: number; +}; + +export type ResetDeviceSettings = { + display_random?: boolean; + strength?: number; + passphrase_protection?: boolean; + pin_protection?: boolean; + language?: string; + label?: string; + u2f_counter?: number; + skip_backup?: boolean; +}; + +export type ApplySettings = { + language?: string; + label?: string; + use_passphrase?: boolean; + homescreen?: string; +}; diff --git a/src/js/types/uiRequest.js b/src/js/types/uiRequest.js deleted file mode 100644 index 5693d1439..000000000 --- a/src/js/types/uiRequest.js +++ /dev/null @@ -1,234 +0,0 @@ -/* @flow */ - -import type { Device, CoreMessage } from './index'; - -import * as POPUP from '../constants/popup'; -import * as IFRAME from '../constants/iframe'; -import * as UI from '../constants/ui'; - -import type { DiscoveryAccount } from './account'; -import type { BitcoinNetworkInfo, CoinInfo } from './coinInfo'; -import type { SelectFeeLevel } from './fee'; - -import type { UiResponseFactory } from './uiResponse'; -import type { ConnectSettings } from '../data/ConnectSettings'; - -export type TransportInfo = { - type: string, - version: string, - outdated: boolean, -} - -/* -* Messages without payload -*/ - -export type MessageWithoutPayload = { - +type: typeof UI.REQUEST_UI_WINDOW | - typeof POPUP.CANCEL_POPUP_REQUEST | - typeof IFRAME.LOADED | - typeof POPUP.LOADED | - typeof UI.TRANSPORT | - typeof UI.CHANGE_ACCOUNT | - typeof UI.INSUFFICIENT_FUNDS | - typeof UI.CLOSE_UI_WINDOW | - typeof UI.LOGIN_CHALLENGE_REQUEST, -} - -/* -* Common message to UI with assigned device -*/ - -export type DeviceMessage = { - +type: typeof UI.REQUEST_PIN | - typeof UI.INVALID_PIN | - typeof UI.REQUEST_PASSPHRASE_ON_DEVICE | - typeof UI.REQUEST_PASSPHRASE | - typeof UI.INVALID_PASSPHRASE | - typeof UI.REQUEST_WORD, - payload: { - device: Device, - type?: string, // todo: better flow enum - }, -}; - -export type ButtonRequestAddressData = {| - type: 'address', - serializedPath: string, - address: string, -|}; - -export type ButtonRequestData = ButtonRequestAddressData; - -export type ButtonRequestMessage = { - +type: typeof UI.REQUEST_BUTTON, - payload: { - device: Device, - code: string, - data: ?ButtonRequestData, - }, -} - -export type AddressValidationMessage = { - +type: typeof UI.ADDRESS_VALIDATION, - payload: ?ButtonRequestData, -} - -/* -* Messages to UI -*/ - -export type IFrameError = { - type: typeof IFRAME.ERROR, - payload: { - error: string, - }, -} - -export type PopupInit = { - +type: typeof POPUP.INIT, - payload: { - settings: ConnectSettings, // those are settings from window.opener - }, -} - -export type PopupError = { - type: typeof POPUP.ERROR, - payload: { - error: string, - }, -} - -export type PopupHandshake = { - +type: typeof POPUP.HANDSHAKE, - payload?: { - settings: ConnectSettings, // those are settings from the iframe, they could be different from window.opener settings - method: ?string, - transport: ?TransportInfo, - }, -} - -export type RequestPermission = { - +type: typeof UI.REQUEST_PERMISSION, - payload: { - permissions: Array, - device: Device, - }, -} - -export type RequestConfirmation = { - +type: typeof UI.REQUEST_CONFIRMATION, - payload: { - view: string, - label?: string, - customConfirmButton?: { - className: string, - label: string, - }, - customCancelButton?: { - className: string, - label: string, - }, - }, -} - -export type SelectDevice = { - +type: typeof UI.SELECT_DEVICE, - payload: { - devices: Array, - webusb: boolean, - }, -} - -export type UnexpectedDeviceMode = { - +type: typeof UI.BOOTLOADER | typeof UI.NOT_IN_BOOTLOADER | typeof UI.INITIALIZE | typeof UI.SEEDLESS | typeof UI.DEVICE_NEEDS_BACKUP, - payload: Device, -} - -export type FirmwareException = { - +type: typeof UI.FIRMWARE_OLD - | typeof UI.FIRMWARE_OUTDATED - | typeof UI.FIRMWARE_NOT_SUPPORTED - | typeof UI.FIRMWARE_NOT_COMPATIBLE - | typeof UI.FIRMWARE_NOT_INSTALLED, - payload: Device, -} - -export type SelectAccount = { - +type: typeof UI.SELECT_ACCOUNT, - payload: { - type: 'start' | 'progress' | 'end', - coinInfo: CoinInfo, - accountTypes?: Array<'normal' | 'segwit' | 'legacy'>, - accounts?: Array, - preventEmpty?: boolean, - }, -} - -export type SelectFee = { - +type: typeof UI.SELECT_FEE, - payload: { - coinInfo: BitcoinNetworkInfo, - feeLevels: Array, - }, -} - -export type UpdateCustomFee = { - +type: typeof UI.UPDATE_CUSTOM_FEE, - payload: { - coinInfo: BitcoinNetworkInfo, - feeLevels: Array, - }, -} - -export type BundleProgress = { - +type: typeof UI.BUNDLE_PROGRESS, - payload: { - progress: number, - response: Object, - }, -} - -export type FirmwareProgress = { - +type: typeof UI.FIRMWARE_PROGRESS, - payload: { - device: Device, - progress: number, - }, -} - -export type UiRequest = - MessageWithoutPayload - | DeviceMessage - | PopupHandshake - | RequestPermission - | RequestConfirmation - | SelectDevice - | UnexpectedDeviceMode - | SelectAccount - | SelectFee - | UpdateCustomFee - | BundleProgress - -/* eslint-disable no-redeclare */ -declare function MessageFactory(type: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; - -/* eslint-enable no-redeclare */ - -export type UiMessageFactory = UiResponseFactory & typeof MessageFactory; diff --git a/src/js/types/uiResponse.js b/src/js/types/uiResponse.js deleted file mode 100644 index e18a57638..000000000 --- a/src/js/types/uiResponse.js +++ /dev/null @@ -1,109 +0,0 @@ -/* @flow */ -import type { Device, CoreMessage } from './index'; -import * as UI from '../constants/ui'; - -/* -* Messages from UI -*/ - -declare type ReceivePermission = {| - +type: typeof UI.RECEIVE_PERMISSION, - payload: { - granted: boolean, - remember: boolean, - }, -|} - -declare type ReceiveConfirmation = {| - +type: typeof UI.RECEIVE_CONFIRMATION, - payload: boolean, -|} - -declare type ReceiveDevice = {| - +type: typeof UI.RECEIVE_DEVICE, - payload: { - device: Device, - remember: boolean, - }, -|} - -declare type ReceivePin = {| - +type: typeof UI.RECEIVE_PIN, - payload: string, -|} - -declare type ReceiveWord = {| - +type: typeof UI.RECEIVE_WORD, - payload: string, -|} - -declare type ReceivePassphrase = {| - +type: typeof UI.RECEIVE_PASSPHRASE, - payload: { - save: boolean, - value: string, - passphraseOnDevice?: boolean, - }, -|} - -declare type ReceivePassphraseAction = {| - +type: typeof UI.INVALID_PASSPHRASE_ACTION, - payload: boolean, -|} - -declare type ReceiveAccount = {| - +type: typeof UI.RECEIVE_ACCOUNT, - payload: ?number, -|} - -declare type ReceiveFee = {| - +type: typeof UI.RECEIVE_FEE, - payload: { - +type: 'compose-custom', - value: number, - } | { - +type: 'change-account', - } | { - +type: 'send', - value: string, - }, -|} - -/* -* Callback message for CustomMessage method -*/ - -declare type CustomMessageRequest = {| - +type: typeof UI.CUSTOM_MESSAGE_REQUEST, - payload: { - type: string, - message: Object, - }, -|} - -export type UiResponse = - ReceivePermission - | ReceiveConfirmation - | ReceiveDevice - | ReceivePin - | ReceiveWord - | ReceivePassphrase - | ReceivePassphraseAction - | ReceiveAccount - | ReceiveFee - | CustomMessageRequest; - -/* eslint-disable no-redeclare */ -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -declare function MessageFactory(type: $PropertyType, payload: $PropertyType): CoreMessage; -/* eslint-enable no-redeclare */ - -export type UiResponseFactory = typeof MessageFactory; diff --git a/src/js/utils/accountUtils.js b/src/js/utils/accountUtils.js index b17c29443..64552dcff 100644 --- a/src/js/utils/accountUtils.js +++ b/src/js/utils/accountUtils.js @@ -3,8 +3,8 @@ import { fromHardened, toHardened } from './pathUtils'; import type { CoinInfo } from '../types'; type Bip44Options = { - purpose?: number, - coinType?: number, + purpose?: number; + coinType?: number; } export const getAccountAddressN = (coinInfo: CoinInfo, accountIndex: number, bip44?: Bip44Options): number[] => { diff --git a/src/js/utils/debug.js b/src/js/utils/debug.js index bcbfa242a..99e01a5d5 100644 --- a/src/js/utils/debug.js +++ b/src/js/utils/debug.js @@ -15,10 +15,10 @@ const colors: {[k: string]: string} = { }; type LogMessage = { - level: string, - prefix: string, - message: Array, - timestamp: number, + level: string; + prefix: string; + message: Array; + timestamp: number; } export default class Log { diff --git a/src/js/utils/deferred.js b/src/js/utils/deferred.js index 5a7b71161..a38f8d6e1 100644 --- a/src/js/utils/deferred.js +++ b/src/js/utils/deferred.js @@ -2,10 +2,10 @@ import type { Deferred } from '../types'; export type AsyncDeferred = { - promise: Promise, - resolve: (t: T) => void, - reject: (e: Error) => void, - run: Function, + promise: Promise; + resolve: (t: T) => void; + reject: (e: Error) => void; + run: Function; }; export function create(arg?: (() => Promise) | string, device?: any): Deferred { diff --git a/src/js/utils/hdnode.js b/src/js/utils/hdnode.js index 31e246590..9e9cf1780 100644 --- a/src/js/utils/hdnode.js +++ b/src/js/utils/hdnode.js @@ -1,13 +1,12 @@ /* @flow */ - -import * as trezor from '../types/trezor'; import * as bitcoin from '@trezor/utxo-lib'; import * as ecurve from 'ecurve'; +import type { PublicKey, HDPubNode } from '../types/trezor/protobuf'; const curve = ecurve.getCurveByName('secp256k1'); const pubNode2bjsNode = ( - node: trezor.HDPubNode, + node: HDPubNode, network: bitcoin.Network ): bitcoin.HDNode => { const chainCode = Buffer.from(node.chain_code, 'hex'); @@ -51,10 +50,10 @@ export const convertBitcoinXpub = (xpub: string, network: bitcoin.Network): stri // converts from internal PublicKey format to bitcoin.js HDNode // network info is necessary. throws error on wrong xpub const pubKey2bjsNode = ( - key: trezor.PublicKey, + key: PublicKey, network: bitcoin.Network ): bitcoin.HDNode => { - const keyNode: trezor.HDPubNode = key.node; + const keyNode: HDPubNode = key.node; const bjsNode: bitcoin.HDNode = pubNode2bjsNode(keyNode, network); const bjsXpub: string = bjsNode.toBase58(); const keyXpub: string = convertXpub(key.xpub, network); @@ -85,12 +84,12 @@ const checkDerivation = ( } }; -export const xpubDerive = (xpub: trezor.PublicKey, - childXPub: trezor.PublicKey, +export const xpubDerive = (xpub: PublicKey, + childXPub: PublicKey, suffix: number, network?: bitcoin.Network, requestedNetwork?: bitcoin.Network -): trezor.PublicKey => { +): PublicKey => { const resNode: bitcoin.HDNode = pubKey2bjsNode(xpub, network || bitcoin.networks.bitcoin); const childNode: bitcoin.HDNode = pubKey2bjsNode(childXPub, network || bitcoin.networks.bitcoin); checkDerivation(resNode, childNode, suffix); @@ -98,7 +97,7 @@ export const xpubDerive = (xpub: trezor.PublicKey, return xpub; }; -export const xpubToHDNodeType = (xpub: string, network: bitcoin.Network): trezor.HDPubNode => { +export const xpubToHDNodeType = (xpub: string, network: bitcoin.Network): HDPubNode => { const hd = bitcoin.HDNode.fromBase58(xpub, network); return { depth: hd.depth, diff --git a/src/js/utils/installers.js b/src/js/utils/installers.js index f1c5d33d8..59d00b1ce 100644 --- a/src/js/utils/installers.js +++ b/src/js/utils/installers.js @@ -12,30 +12,30 @@ export function setFetch(fetch: any) { } type ProtoInstallerShort = { - shortUrl: string, - label: string, - platform: string | Array, + shortUrl: string; + label: string; + platform: string | Array; } type ProtoInstaller = { - url: string, - label: string, - platform: string | Array, + url: string; + label: string; + platform: string | Array; } export type BridgeInstaller = { - version: string, - url: string, - label: string, - platform: string | Array, - preferred: boolean, + version: string; + url: string; + label: string; + platform: string | Array; + preferred: boolean; }; export type UdevInstaller = { - url: string, - label: string, - platform: string | Array, - preferred: boolean, + url: string; + label: string; + platform: string | Array; + preferred: boolean; }; function fillInstallerUrl(installer: ProtoInstallerShort, domain: string): ProtoInstaller { @@ -86,8 +86,8 @@ const UDEV_INSTALLERS: Array = [{ }]; type UdevOptions = { - platform?: string, - domain?: string, + platform?: string; + domain?: string; }; export function udevInstallers(options: ?UdevOptions): Array { @@ -108,7 +108,7 @@ export function udevInstallers(options: ?UdevOptions): Array { } type VersionOptions = { - bridgeUrl?: string, + bridgeUrl?: string; } export function latestVersion(options: ?VersionOptions): Promise { @@ -129,10 +129,10 @@ export function latestVersion(options: ?VersionOptions): Promise { } type BridgeOptions = { - platform?: string, - version?: string, - bridgeUrl?: string, - domain?: string, + platform?: string; + version?: string; + bridgeUrl?: string; + domain?: string; }; // Returns a list of bridge installers, with download URLs and a mark on diff --git a/src/js/utils/pathUtils.js b/src/js/utils/pathUtils.js index eda323a0c..ce3aafe02 100644 --- a/src/js/utils/pathUtils.js +++ b/src/js/utils/pathUtils.js @@ -3,7 +3,7 @@ import { getCoinName } from '../data/CoinInfo'; import { invalidParameter } from '../constants/errors'; import type { BitcoinNetworkInfo, CoinInfo } from '../types'; -import type { InputScriptType, OutputScriptType } from '../types/trezor'; +import type { InputScriptType, OutputScriptType } from '../types/trezor/protobuf'; export const HD_HARDENED: number = 0x80000000; export const toHardened = (n: number): number => (n | HD_HARDENED) >>> 0; diff --git a/src/ts/types/__tests__/binance.ts b/src/ts/types/__tests__/binance.ts new file mode 100644 index 000000000..49b5dba16 --- /dev/null +++ b/src/ts/types/__tests__/binance.ts @@ -0,0 +1,133 @@ +import TrezorConnect from '../index'; + +export const binanceGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.binanceGetAddress({ path: 'm/44' }); + if (singleAddress.success) { + const { payload } = singleAddress; + payload.address; + payload.path; + payload.serializedPath; + // @ts-ignore + payload.forEach(item => { + item.address; + }); + } + + // bundle + const bundleAddress = await TrezorConnect.binanceGetAddress({ bundle: [{ path: 'm/44' }] }); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + item.address; + item.path; + item.serializedPath; + }); + // @ts-ignore + bundleAddress.payload.address; + } else { + bundleAddress.payload.error; + } + + // with all possible params + TrezorConnect.binanceGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // @ts-ignore + TrezorConnect.binanceGetAddress(); + // @ts-ignore + TrezorConnect.binanceGetAddress({ useEmptyPassphrase: true }); + // @ts-ignore + TrezorConnect.binanceGetAddress({ path: 1 }); + // @ts-ignore + TrezorConnect.binanceGetAddress({ bundle: 1 }); +}; + +export const binanceGetPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.binanceGetPublicKey({ path: 'm/44' }); + if (singlePK.success) { + const { payload } = singlePK; + payload.path; + payload.serializedPath; + payload.publicKey; + // @ts-ignore + payload.forEach(item => { + item.path; + }); + } + + // bundle + const bundlePK = await TrezorConnect.binanceGetPublicKey({ bundle: [{ path: 'm/44' }] }); + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + item.path; + item.serializedPath; + item.publicKey; + }); + // @ts-ignore + bundlePK.payload.publicKey; + } else { + bundlePK.payload.error; + } +}; + +export const binanceSignTransaction = async () => { + const sign = await TrezorConnect.binanceSignTransaction({ + path: 'm/44', + transaction: { + chain_id: 'Binance-Chain-Nile', + account_number: 34, + memo: 'test', + sequence: 31, + source: 1, + transfer: { + inputs: [ + { + address: 'tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd', + coins: [{ amount: 1000000000, denom: 'BNB' }], + }, + ], + outputs: [ + { + address: 'tbnb1ss57e8sa7xnwq030k2ctr775uac9gjzglqhvpy', + coins: [{ amount: 1000000000, denom: 'BNB' }], + }, + ], + }, + placeOrder: { + id: 'BA36F0FAD74D8F41045463E4774F328F4AF779E5-33', + ordertype: 2, + price: 100000000, + quantity: 100000000, + sender: 'tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd', + side: 1, + symbol: 'ADA.B-B63_BNB', + timeinforce: 1, + }, + cancelOrder: { + refid: 'BA36F0FAD74D8F41045463E4774F328F4AF779E5-29', + sender: 'tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd', + symbol: 'BCHSV.B-10F_BNB', + }, + }, + }); + + if (sign.success) { + const { payload } = sign; + payload.public_key; + payload.signature; + } +}; diff --git a/src/ts/types/__tests__/bitcoin.ts b/src/ts/types/__tests__/bitcoin.ts new file mode 100644 index 000000000..8c68aeff1 --- /dev/null +++ b/src/ts/types/__tests__/bitcoin.ts @@ -0,0 +1,416 @@ +import TrezorConnect from '../index'; + +export const getAddress = async () => { + // regular + const singleAddress = await TrezorConnect.getAddress({ path: 'm/44' }); + if (singleAddress.success) { + const { payload } = singleAddress; + payload.address; + payload.path; + payload.serializedPath; + // @ts-ignore + payload.forEach(item => { + item.address; + }); + } + + // bundle + const bundleAddress = await TrezorConnect.getAddress({ bundle: [{ path: 'm/44' }] }); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + item.address; + item.path; + item.serializedPath; + }); + // @ts-ignore + bundleAddress.payload.address; + } else { + bundleAddress.payload.error; + } + + // with all possible params + TrezorConnect.getAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + coin: 'btc', + crossChain: true, + }); + + // with invalid params + // @ts-ignore + TrezorConnect.getAddress(); + // @ts-ignore + TrezorConnect.getAddress({ coin: 'btc' }); + // @ts-ignore + TrezorConnect.getAddress({ path: 1 }); + // @ts-ignore + TrezorConnect.getAddress({ bundle: 1 }); +}; + +export const getPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.getPublicKey({ path: 'm/44' }); + if (singlePK.success) { + const { payload } = singlePK; + payload.path; + payload.serializedPath; + payload.xpub; + payload.xpubSegwit; + payload.chainCode; + payload.childNum; + payload.publicKey; + payload.fingerprint; + payload.depth; + // @ts-ignore + payload.forEach(item => { + item.path; + }); + } + + // bundle + const bundlePK = await TrezorConnect.getPublicKey({ bundle: [{ path: 'm/44' }] }); + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + item.path; + item.serializedPath; + item.xpub; + item.xpubSegwit; + item.chainCode; + item.childNum; + item.publicKey; + item.fingerprint; + item.depth; + }); + // @ts-ignore + bundlePK.payload.xpub; + } else { + bundlePK.payload.error; + } +}; + +export const signTransaction = async () => { + // minimum required params + TrezorConnect.signTransaction({ + inputs: [], + outputs: [], + coin: 'btc', + }); + + // with all possible params + const sign = await TrezorConnect.signTransaction({ + inputs: [ + { + address_n: [0], + prev_index: 0, + prev_hash: 'txhash', + script_type: 'SPENDADDRESS', + }, + { + address_n: [0], + prev_index: 0, + prev_hash: 'txhash', + amount: '1', + script_type: 'SPENDWITNESS', + }, + { + address_n: [0], + prev_index: 0, + prev_hash: 'abcd', + amount: '1', + script_type: 'SPENDP2SHWITNESS', + }, + { + address_n: [0], + prev_index: 0, + prev_hash: 'txhash', + script_type: 'SPENDMULTISIG', + sequence: 1, + multisig: { + pubkeys: [ + { node: 'HDNodeAsString', address_n: [0] }, + { + node: { + depth: 0, + fingerprint: 1, + child_num: 1, + chain_code: 'chain_code', + public_key: 'xpubABCD', + }, + address_n: [0], + }, + ], + signatures: ['signature'], + m: 0, + }, + }, + ], + outputs: [ + // external outputs + { + address: 'ExternalAddress', + amount: '100', + script_type: 'PAYTOADDRESS', + }, + { + address: 'ExternalAddress', + amount: '100', + script_type: 'PAYTOADDRESS', + multisig: { + pubkeys: [{ node: 'HDNodeAsString', address_n: [0] }], + signatures: ['signature'], + m: 0, + }, + }, + // change outputs + { + address_n: [0], + amount: '100', + script_type: 'PAYTOADDRESS', + }, + { + address_n: [0], + amount: '100', + script_type: 'PAYTOWITNESS', + }, + { + address_n: [0], + amount: '100', + script_type: 'PAYTOP2SHWITNESS', + }, + { + address_n: [0], + amount: '100', + script_type: 'PAYTOMULTISIG', + multisig: { + pubkeys: [{ node: 'HDNodeAsString', address_n: [0] }], + signatures: ['signature'], + m: 0, + }, + }, + { + amount: '0', + op_return_data: 'deadbeef', + script_type: 'PAYTOOPRETURN', + }, + ], + refTxs: [ + { + hash: 'txhash', + version: 1, + inputs: [ + { + prev_hash: 'txhash', + prev_index: 0, + script_sig: 'tx-signature', + sequence: 1, + }, + ], + bin_outputs: [ + { + amount: '100', + script_pubkey: 'tx-script-pubkey', + }, + ], + lock_time: 1, + extra_data: '00', + timestamp: 1, + version_group_id: 4, + }, + ], + coin: 'btc', + locktime: 0, + timestamp: 1, + version: 0, + expiry: 0, + overwintered: true, + versionGroupId: 4, + branchId: 1, + push: true, + // common: + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + }); + + if (sign.success) { + const { payload } = sign; + payload.signatures; + payload.serializedTx; + payload.txid; + } + + // with invalid params + // @ts-ignore + TrezorConnect.signTransaction(); + // @ts-ignore + TrezorConnect.signTransaction({ coin: 'btc' }); + + TrezorConnect.signTransaction({ + inputs: [ + { + address_n: [0], + prev_index: 0, + prev_hash: 'txhash', + // @ts-ignore + script_type: 'SPENDADDRESS-2', + }, + ], + outputs: [], + coin: 'btc', + }); +}; + +export const pushTransaction = async () => { + const push = await TrezorConnect.pushTransaction({ tx: 'serializedTX', coin: 'btc' }); + if (push.success) { + push.payload.txid; + } + + // with invalid params + // @ts-ignore + TrezorConnect.pushTransaction(); + // @ts-ignore + TrezorConnect.pushTransaction({ coin: 'btc' }); +}; + +export const composeTransaction = async () => { + // Method with mixed params and mixed responses + + const compose = await TrezorConnect.composeTransaction({ + outputs: [], + coin: 'btc', + }); + if (compose.success) { + compose.payload.serializedTx; + } + + const precompose = await TrezorConnect.composeTransaction({ + outputs: [], + account: { + path: 'm/49', + addresses: { + used: [], + unused: [], + change: [], + }, + utxo: [], + }, + feeLevels: [{ feePerUnit: '1' }], + coin: 'btc', + }); + + if (precompose.success) { + const tx = precompose.payload[0]; + if (tx.type === 'error') { + tx.error; + } + if (tx.type === 'nonfinal') { + tx.bytes; + tx.feePerByte; + } + if (tx.type === 'final') { + tx.transaction.inputs; + tx.transaction.outputs; + } + } else { + precompose.payload.error; + // @ts-ignore + precompose.payload.type; + } +}; + +export const getAccountInfo = async () => { + // minimum required params + TrezorConnect.getAccountInfo({ coin: 'btc' }); + + const account = await TrezorConnect.getAccountInfo({ + coin: 'btc', + path: 'm/44', + descriptor: 'xpub', + details: 'txs', + tokens: 'used', + page: 1, + pageSize: 2, + from: 1, + to: 100, + contractFilter: 'address', + gap: 25, + marker: { + ledger: 1, + seq: 1, + }, + }); + if (account.success) { + const { payload } = account; + payload.empty; + payload.path; + payload.descriptor; + payload.balance; + payload.availableBalance; + if (payload.tokens) { + payload.tokens; + } + if (payload.addresses) { + payload.addresses.used; + payload.addresses.unused; + payload.addresses.change; + } + if (payload.utxo) { + payload.utxo; + } + + payload.history.total; + payload.history.tokens; + payload.history.unconfirmed; + payload.history.transactions; + payload.history.txids; + + if (payload.page) { + payload.page.index; + payload.page.size; + payload.page.total; + } + + if (payload.marker) { + payload.marker.ledger; + payload.marker.seq; + } + + if (payload.misc) { + payload.misc.nonce; + payload.misc.sequence; + payload.misc.reserve; + } + + payload.utxo; + payload.history; + payload.misc; + payload.page; + payload.marker; + } +}; + +export const signMessage = async () => { + const sign = await TrezorConnect.signMessage({ path: 'm/44', coin: 'btc', message: 'foo' }); + if (sign.success) { + const { payload } = sign; + payload.address; + payload.signature; + } + const verify = await TrezorConnect.verifyMessage({ address: 'a', signature: 'a', message: 'foo', coin: 'btc' }); + if (verify.success) { + const { payload } = verify; + payload.message; + } +}; diff --git a/src/ts/types/__tests__/blockchain.ts b/src/ts/types/__tests__/blockchain.ts new file mode 100644 index 000000000..31216391f --- /dev/null +++ b/src/ts/types/__tests__/blockchain.ts @@ -0,0 +1,104 @@ +import TrezorConnect from '../index'; + +export const blockchainEstimateFee = async () => { + const levels = [ + { + label: 'high', + blocks: 1, + feeLimit: '100', + feePerTx: '100', + feePerUnit: '100', + }, + { + label: 'normal', + feePerUnit: '100', + blocks: 0, + }, + { + label: 'economy', + feePerUnit: '100', + blocks: 0, + }, + { + label: 'low', + feePerUnit: '100', + blocks: 0, + }, + { + label: 'custom', + feePerUnit: '100', + blocks: 0, + }, + ]; + + const simple = await TrezorConnect.blockchainEstimateFee({ coin: 'btc' }); + if (simple.success) { + const { payload } = simple; + payload.blockTime; + payload.minFee; + payload.maxFee; + payload.levels; + } + + TrezorConnect.blockchainEstimateFee({ + coin: 'btc', + request: { + blocks: [0], + specific: { + conservative: true, + data: '0x', + from: '0x', + to: '0x', + txsize: 100, + }, + feeLevels: 'smart', + }, + }); + + TrezorConnect.blockchainEstimateFee({ + coin: 'btc', + request: { + feeLevels: 'preloaded', + }, + }); +}; + +export const blockchainGetTransactions = async () => { + const txs = await TrezorConnect.blockchainGetTransactions({ coin: 'btc', txs: ['txid'] }); + if (txs.success) { + const { payload } = txs; + payload.forEach(tx => { + if (tx.type === 'blockbook') { + // (tx.vin: any[]); + } + }); + } +}; + +export const others = async () => { + const accounts = [ + { + descriptor: 'xpub', + addresses: { + used: [], + unused: [], + change: [], + }, + }, + { + descriptor: '0x00', + }, + ]; + + TrezorConnect.blockchainSubscribe({ + accounts, + coin: 'btc', + }); + + TrezorConnect.blockchainUnsubscribe({ + accounts, + coin: 'btc', + }); + + TrezorConnect.blockchainDisconnect({ coin: 'btc' }); +}; diff --git a/src/ts/types/__tests__/cardano.ts b/src/ts/types/__tests__/cardano.ts new file mode 100644 index 000000000..7c3751103 --- /dev/null +++ b/src/ts/types/__tests__/cardano.ts @@ -0,0 +1,114 @@ +import TrezorConnect from '../index'; + +export const cardanoGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.cardanoGetAddress({ path: 'm/44' }); + if (singleAddress.success) { + const { payload } = singleAddress; + payload.address; + payload.path; + payload.serializedPath; + // @ts-ignore + payload.forEach(item => { + item.address; + }); + } + + // bundle + const bundleAddress = await TrezorConnect.cardanoGetAddress({ bundle: [{ path: 'm/44' }] }); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + item.address; + item.path; + item.serializedPath; + }); + // @ts-ignore + bundleAddress.payload.address; + } else { + bundleAddress.payload.error; + } + + // with all possible params + TrezorConnect.cardanoGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // @ts-ignore + TrezorConnect.cardanoGetAddress(); + // @ts-ignore + TrezorConnect.cardanoGetAddress({ coin: 'btc' }); + // @ts-ignore + TrezorConnect.cardanoGetAddress({ path: 1 }); + // @ts-ignore + TrezorConnect.cardanoGetAddress({ bundle: 1 }); +}; + +export const cardanoGetPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.cardanoGetPublicKey({ path: 'm/44' }); + if (singlePK.success) { + const { payload } = singlePK; + payload.path; + payload.serializedPath; + payload.publicKey; + payload.node; + // @ts-ignore + payload.forEach(item => { + item.path; + }); + } + + // bundle + const bundlePK = await TrezorConnect.cardanoGetPublicKey({ bundle: [{ path: 'm/44' }] }); + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + item.path; + item.serializedPath; + item.publicKey; + item.node; + }); + // @ts-ignore + bundlePK.payload.path; + } else { + bundlePK.payload.error; + } +}; + +export const cardanoSignTransaction = async () => { + const sign = await TrezorConnect.cardanoSignTransaction({ + inputs: [ + { + prev_hash: '1af..', + path: 'm/44', + prev_index: 0, + type: 0, + }, + ], + outputs: [ + { + address: 'Ae2..', + amount: '3003112', + }, + ], + transactions: ['txid'], + protocol_magic: 764824073, + }); + + if (sign.success) { + const { payload } = sign; + payload.hash; + payload.body; + } +}; diff --git a/src/ts/types/__tests__/eos.ts b/src/ts/types/__tests__/eos.ts new file mode 100644 index 000000000..89a628fd2 --- /dev/null +++ b/src/ts/types/__tests__/eos.ts @@ -0,0 +1,250 @@ +import TrezorConnect from '../index'; + +export const eosGetPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.eosGetPublicKey({ path: 'm/44' }); + + if (singlePK.success) { + const { payload } = singlePK; + payload.path; + payload.serializedPath; + payload.wifPublicKey; + payload.rawPublicKey; + // @ts-ignore + payload.forEach(item => { + item.path; + }); + } + + // bundle + const bundlePK = await TrezorConnect.eosGetPublicKey({ bundle: [{ path: 'm/44' }] }); + + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + item.path; + item.serializedPath; + item.wifPublicKey; + item.rawPublicKey; + }); + // @ts-ignore + bundlePK.payload.path; + } else { + bundlePK.payload.error; + } +}; + +export const eosSignTransaction = async () => { + const common = { + account: 'eosio.token', + authorization: [ + { + actor: 'miniminimini', + permission: 'active', + }, + ], + }; + + const sign = await TrezorConnect.eosSignTransaction({ + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [ + { + ...common, + name: 'transfer', + data: { + from: 'a', + to: 'b', + quantity: '1.0000 EOS', + memo: 'testtest', + }, + }, + { + ...common, + name: 'delegatebw', + data: { + from: 'miniminimini', + receiver: 'maximaximaxi', + stake_net_quantity: '1.0000 EOS', + stake_cpu_quantity: '1.0000 EOS', + transfer: true, + }, + }, + { + ...common, + name: 'undelegatebw', + data: { + from: 'miniminimini', + receiver: 'maximaximaxi', + unstake_net_quantity: '1.0000 EOS', + unstake_cpu_quantity: '1.0000 EOS', + }, + }, + { + ...common, + name: 'buyram', + data: { + payer: 'miniminimini', + receiver: 'miniminimini', + quant: '1000000000.0000 EOS', + }, + }, + { + ...common, + name: 'buyrambytes', + data: { + payer: 'miniminimini', + receiver: 'miniminimini', + bytes: 1023, + }, + }, + { + ...common, + name: 'sellram', + data: { + account: 'miniminimini', + bytes: 1024, + }, + }, + { + ...common, + name: 'voteproducer', + data: { + voter: 'miniminimini', + proxy: '', + producers: ['argentinaeos'], + }, + }, + { + ...common, + name: 'refund', + data: { + owner: 'miniminimini', + }, + }, + { + ...common, + name: 'updateauth', + data: { + account: 'miniminimini', + permission: 'active', + parent: 'owner', + auth: { + threshold: 1, + keys: [ + { + weight: 1, + key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', + }, + { + weight: 2, + key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', + }, + ], + accounts: [ + { + permission: { + actor: 'miniminimini', + permission: 'active', + }, + weight: 3, + }, + ], + waits: [ + { + wait_sec: 55, + weight: 4, + }, + ], + }, + }, + }, + { + ...common, + name: 'deleteauth', + data: { + account: 'maximaximaxi', + permission: 'active', + }, + }, + { + ...common, + name: 'linkauth', + data: { + account: 'maximaximaxi', + code: 'eosbet', + type: 'whatever', + requirement: 'active', + }, + }, + { + ...common, + name: 'unlinkauth', + data: { + account: 'miniminimini', + code: 'eosbet', + type: 'whatever', + }, + }, + { + ...common, + name: 'newaccount', + data: { + creator: 'miniminimini', + name: 'maximaximaxi', + owner: { + threshold: 1, + keys: [ + { + key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', + weight: 1, + }, + ], + accounts: [], + waits: [], + }, + active: { + threshold: 1, + keys: [ + { + key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', + weight: 1, + }, + ], + accounts: [], + waits: [], + }, + }, + }, + { + ...common, + name: 'setcode', + data: '0000', + }, + { + ...common, + name: 'setabi', + data: '0000', + }, + { + ...common, + name: 'bar-action', + data: '0000', + }, + ], + }, + }); + + if (sign.success) { + const { payload } = sign; + payload.signature; + } +}; diff --git a/src/ts/types/__tests__/ethereum.ts b/src/ts/types/__tests__/ethereum.ts new file mode 100644 index 000000000..3d3b99afb --- /dev/null +++ b/src/ts/types/__tests__/ethereum.ts @@ -0,0 +1,142 @@ +import TrezorConnect from '../index'; + +export const ethereumGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.ethereumGetAddress({ path: 'm/44' }); + + if (singleAddress.success) { + const { payload } = singleAddress; + payload.address; + payload.path; + payload.serializedPath; + // @ts-ignore + payload.forEach(item => { + item.address; + }); + } + + // bundle + const bundleAddress = await TrezorConnect.ethereumGetAddress({ bundle: [{ path: 'm/44' }] }); + + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + item.address; + item.path; + item.serializedPath; + }); + // @ts-ignore + bundleAddress.payload.address; + } else { + bundleAddress.payload.error; + } + + // with all possible params + TrezorConnect.ethereumGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: '0x', + showOnTrezor: true, + }); + + // with invalid params + // @ts-ignore + TrezorConnect.ethereumGetAddress(); + // @ts-ignore + TrezorConnect.ethereumGetAddress({ coin: 'btc' }); + // @ts-ignore + TrezorConnect.ethereumGetAddress({ path: 1 }); + // @ts-ignore + TrezorConnect.ethereumGetAddress({ bundle: 1 }); +}; + +export const ethereumGetPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.ethereumGetPublicKey({ path: 'm/44' }); + + if (singlePK.success) { + const { payload } = singlePK; + payload.path; + payload.serializedPath; + payload.xpub; + payload.xpubSegwit; + payload.chainCode; + payload.childNum; + payload.publicKey; + payload.fingerprint; + payload.depth; + // @ts-ignore + payload.forEach(item => { + item.path; + }); + } + + // bundle + const bundlePK = await TrezorConnect.ethereumGetPublicKey({ bundle: [{ path: 'm/44' }] }); + + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + item.path; + item.serializedPath; + item.xpub; + item.xpubSegwit; + item.chainCode; + item.childNum; + item.publicKey; + item.fingerprint; + item.depth; + }); + // @ts-ignore + bundlePK.payload.path; + } else { + bundlePK.payload.error; + } +}; + +export const ethereumSignTransaction = async () => { + const sign = await TrezorConnect.ethereumSignTransaction({ + path: 'm/44', + transaction: { + nonce: '0x0', + gasPrice: '0x14', + gasLimit: '0x14', + to: '0xd0d6d6c5fe4a677d343cc433536bb717bae167dd', + chainId: 1, + value: '0x0', + data: '0xa', + }, + }); + + if (sign.success) { + const { payload } = sign; + payload.r; + payload.s; + payload.v; + } +}; + +export const signMessage = async () => { + const sign = await TrezorConnect.ethereumSignMessage({ path: 'm/44', message: 'foo', hex: false }); + if (sign.success) { + const { payload } = sign; + payload.address; + payload.signature; + } + const verify = await TrezorConnect.ethereumVerifyMessage({ + address: 'a', + signature: 'a', + message: 'foo', + hex: false, + }); + if (verify.success) { + const { payload } = verify; + payload.message; + } +}; diff --git a/src/ts/types/__tests__/index.ts b/src/ts/types/__tests__/index.ts new file mode 100644 index 000000000..491341862 --- /dev/null +++ b/src/ts/types/__tests__/index.ts @@ -0,0 +1,141 @@ +// TrezorConnect API types tests + +// Exported constants +/* eslint-disable no-unused-vars */ +import TrezorConnect, { + UI_EVENT, + DEVICE_EVENT, + RESPONSE_EVENT, + TRANSPORT_EVENT, + BLOCKCHAIN_EVENT, + BLOCKCHAIN, + DEVICE, + IFRAME, + POPUP, + TRANSPORT, + UI, + // Exported types + Device, + DeviceStatus, + FirmwareRelease, + DeviceFirmwareStatus, + DeviceMode, + Features, + AccountInfo, + EthereumAddress, +} from '../index'; +/* eslint-disable no-unused-vars */ + +export const init = async () => { + const manifest = { appUrl: '', email: '' }; + TrezorConnect.init({ manifest }); + // @ts-ignore + TrezorConnect.init(); + // @ts-ignore + TrezorConnect.init({}); + // @ts-ignore + TrezorConnect.manifest({}); + // @ts-ignore + TrezorConnect.manifest({ appUrl: 1 }); + // @ts-ignore + TrezorConnect.manifest({ email: 1 }); + + const settings = await TrezorConnect.getSettings(); + if (settings.success) { + const { payload } = settings; + payload.manifest; + payload.connectSrc; + payload.debug; + payload.popup; + payload.lazyLoad; + payload.webusb; + payload.pendingTransportEvent; + payload.pendingTransportEvent; + } + + TrezorConnect.dispose(); + TrezorConnect.cancel(); + TrezorConnect.cancel('Interruption error'); + TrezorConnect.renderWebUSBButton(); + TrezorConnect.disableWebUSB(); +}; + +export const events = async () => { + TrezorConnect.on(DEVICE_EVENT, event => { + const { payload } = event; + event.type; + payload.path; + payload.type; + if (payload.type === 'acquired') { + payload.mode; + payload.firmware; + payload.status; + } + }); + TrezorConnect.off(DEVICE_EVENT, () => {}); + // @ts-ignore + TrezorConnect.on('DEVICE-EVENT', () => {}); + + TrezorConnect.on(TRANSPORT_EVENT, event => { + if (event.type === TRANSPORT.START) { + event.payload.type; + event.payload.version; + event.payload.outdated; + } + if (event.type === TRANSPORT.ERROR) { + event.payload.bridge; + } + }); + TrezorConnect.off(TRANSPORT_EVENT, () => {}); + + TrezorConnect.on(UI_EVENT, event => { + if (event.type === UI.BUNDLE_PROGRESS) { + event.payload.progress; + event.payload.error; + event.payload.response; + } + if (event.type === UI.REQUEST_BUTTON) { + event.payload.code; + event.payload.data; + event.payload.device; + } + }); + TrezorConnect.off(UI_EVENT, () => {}); + + TrezorConnect.on(UI.BUNDLE_PROGRESS, event => { + event.progress; + event.error; + event.response.empty; + event.response.availableBalance; + }); + + TrezorConnect.on(UI.BUNDLE_PROGRESS, event => { + event.progress; + event.error; + event.response.serializedPath; + event.response.address; + }); + + TrezorConnect.on(UI.REQUEST_BUTTON, event => { + event.code; + event.data; + event.device; + }); + + TrezorConnect.on(BLOCKCHAIN_EVENT, event => { + if (event.type === BLOCKCHAIN.CONNECT) { + event.payload.blockHash; + event.payload.shortcut; + event.payload.testnet; + } + if (event.type === BLOCKCHAIN.BLOCK) { + event.payload.blockHash; + event.payload.blockHeight; + } + if (event.type === BLOCKCHAIN.NOTIFICATION) { + event.payload.notification.descriptor; + event.payload.notification.tx; + } + }); + TrezorConnect.off(BLOCKCHAIN_EVENT, () => {}); +}; diff --git a/src/ts/types/__tests__/lisk.ts b/src/ts/types/__tests__/lisk.ts new file mode 100644 index 000000000..5839b35c4 --- /dev/null +++ b/src/ts/types/__tests__/lisk.ts @@ -0,0 +1,178 @@ +import TrezorConnect from '../index'; +export const liskGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.liskGetAddress({ path: 'm/44' }); + if (singleAddress.success) { + const { payload } = singleAddress; + payload.address; + payload.path; + payload.serializedPath; + // @ts-ignore + payload.forEach(item => { + item.address; + }); + } + + // bundle + const bundleAddress = await TrezorConnect.liskGetAddress({ bundle: [{ path: 'm/44' }] }); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + item.address; + item.path; + item.serializedPath; + }); + // @ts-ignore + bundleAddress.payload.address; + } else { + bundleAddress.payload.error; + } + + // with all possible params + TrezorConnect.liskGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // @ts-ignore + TrezorConnect.liskGetAddress(); + // @ts-ignore + TrezorConnect.liskGetAddress({ coin: 'btc' }); + // @ts-ignore + TrezorConnect.liskGetAddress({ path: 1 }); + // @ts-ignore + TrezorConnect.liskGetAddress({ bundle: 1 }); +}; + +export const liskGetPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.liskGetPublicKey({ path: 'm/44' }); + + if (singlePK.success) { + const { payload } = singlePK; + payload.path; + payload.serializedPath; + payload.publicKey; + // @ts-ignore + payload.forEach(item => { + item.path; + }); + } + + // bundle + const bundlePK = await TrezorConnect.liskGetPublicKey({ bundle: [{ path: 'm/44' }] }); + + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + item.path; + item.serializedPath; + item.publicKey; + }); + // @ts-ignore + bundlePK.payload.path; + } else { + bundlePK.payload.error; + } +}; + +export const liskSignTransaction = async () => { + const common = { + amount: '10000000', + recipientId: '9971262264659915921L', + timestamp: 57525937, + type: 0, + fee: '10000000', + }; + const sign = await TrezorConnect.liskSignTransaction({ + path: 'm/44', + transaction: { + ...common, + asset: { + multisignature: { + min: 2, + lifetime: 5, + keysgroup: [ + '+5d036a858ce89f844491762eb89e2bfbd50a4a0a0da658e4b2628b25b117ae09', + '+922fbfdd596fa78269bbcadc67ec2a1cc15fc929a19c462169568d7a3df1a1aa', + ], + }, + }, + }, + }); + + if (sign.success) { + const { payload } = sign; + payload.signature; + } + + TrezorConnect.liskSignTransaction({ + path: 'm/44', + transaction: { + ...common, + asset: { + delegate: { + username: 'trezor_t', + }, + }, + }, + }); + + TrezorConnect.liskSignTransaction({ + path: 'm/44', + transaction: { + ...common, + asset: { + votes: [ + '+b002f58531c074c7190714523eec08c48db8c7cfc0c943097db1a2e82ed87f84', + '-ec111c8ad482445cfe83d811a7edd1f1d2765079c99d7d958cca1354740b7614', + ], + }, + }, + }); + + TrezorConnect.liskSignTransaction({ + path: 'm/44', + transaction: { + ...common, + asset: { + signature: { + publicKey: 'publicKey', + }, + }, + }, + }); + + TrezorConnect.liskSignTransaction({ + path: 'm/44', + transaction: { + ...common, + asset: { + data: '00', + }, + }, + }); +}; + +export const signMessage = async () => { + const sign = await TrezorConnect.liskSignMessage({ path: 'm/44', message: 'foo' }); + if (sign.success) { + const { payload } = sign; + payload.publicKey; + payload.signature; + } + const verify = await TrezorConnect.liskVerifyMessage({ publicKey: 'a', signature: 'a', message: 'foo' }); + if (verify.success) { + const { payload } = verify; + payload.message; + } +}; diff --git a/src/ts/types/__tests__/management.ts b/src/ts/types/__tests__/management.ts new file mode 100644 index 000000000..abdf23275 --- /dev/null +++ b/src/ts/types/__tests__/management.ts @@ -0,0 +1,46 @@ +import TrezorConnect from '../index'; + +export const management = async () => { + TrezorConnect.resetDevice({ + strength: 1, + label: 'My Trezor', + u2f_counter: 0, + pin_protection: true, + passphrase_protection: true, + skip_backup: false, + no_backup: false, + backup_type: 0, + }); + + TrezorConnect.wipeDevice({}); + + TrezorConnect.applyFlags({ + flags: 1, + }); + + TrezorConnect.applySettings({ + homescreen: 'string', + display_rotation: 180, + use_passphrase: true, + label: 'My Trezor', + }); + + TrezorConnect.backupDevice({}); + + TrezorConnect.changePin({ + remove: true, + }); + + TrezorConnect.firmwareUpdate({ + payload: new ArrayBuffer(0), + }); + + TrezorConnect.recoveryDevice({ + passphrase_protection: true, + pin_protection: true, + label: 'My Trezor', + type: 1, + dry_run: true, + word_count: 24, + }); +}; diff --git a/src/ts/types/__tests__/misc.ts b/src/ts/types/__tests__/misc.ts new file mode 100644 index 000000000..ca8a23607 --- /dev/null +++ b/src/ts/types/__tests__/misc.ts @@ -0,0 +1,96 @@ +import TrezorConnect from '../index'; + +export const cipherKeyValue = async () => { + const kv = await TrezorConnect.cipherKeyValue({ + path: 'm/44', + key: 'key', + value: 'hash', + askOnEncrypt: true, + askOnDecrypt: false, + iv: 'advanced', + }); + if (kv.success) { + kv.payload.value; + } + + // bundle + const bundleKV = await TrezorConnect.cipherKeyValue({ bundle: [{ path: 'm/44', key: 'key' }] }); + + if (bundleKV.success) { + bundleKV.payload.forEach(item => { + item.value; + }); + // @ts-ignore + bundleKV.payload.xpub; + } else { + bundleKV.payload.error; + } +}; + +export const customMessage = async () => { + TrezorConnect.customMessage({ + messages: {}, + message: 'MyCustomSignTx', + params: { + inputs: { index: 1, hash: '0' }, + }, + callback: async (request: any) => { + if (request.type === 'MyCustomTxReq') { + return { + message: 'MyCustomTxAck', + params: { + index: 1, + }, + }; + } + return { message: 'MyCustomSigned' }; + }, + }); +}; + +// Method with mixed params +export const requestLogin = async () => { + // async call + const a = await TrezorConnect.requestLogin({ + callback: () => ({ + challengeHidden: 'a', + challengeVisual: 'b', + }), + }); + // const { success, payload } = a; + // if (success && payload.address) { + // payload.address; + // } + // (payload: { error: string }); + + if (a.success) { + a.payload.address; + a.payload.publicKey; + a.payload.signature; + // @ts-ignore + a.payload.error; + } else { + a.payload.error; + // @ts-ignore + a.payload.address; + } + // sync call + TrezorConnect.requestLogin({ + challengeHidden: 'a', + challengeVisual: 'b', + }); + + // @ts-ignore + TrezorConnect.requestLogin(); + // @ts-ignore + TrezorConnect.requestLogin({ callback: 'string' }); + // @ts-ignore + TrezorConnect.requestLogin({ challengeHidden: 'a' }); + // @ts-ignore + TrezorConnect.requestLogin({ challengeVisual: 1 }); +}; + +export const debugLink = async () => { + TrezorConnect.debugLinkDecision({ device: { path: '1' } }); + TrezorConnect.debugLinkGetState({ device: { path: '1' } }); +}; diff --git a/src/ts/types/__tests__/nem.ts b/src/ts/types/__tests__/nem.ts new file mode 100644 index 000000000..79e7d40a3 --- /dev/null +++ b/src/ts/types/__tests__/nem.ts @@ -0,0 +1,245 @@ +import TrezorConnect from '../index'; + +export const nemGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.nemGetAddress({ path: 'm/44', network: 1 }); + + if (singleAddress.success) { + const { payload } = singleAddress; + payload.address; + payload.path; + payload.serializedPath; + // @ts-ignore + payload.forEach(item => { + item.address; + }); + } + + // bundle + const bundleAddress = await TrezorConnect.nemGetAddress({ bundle: [{ path: 'm/44', network: 1 }] }); + + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + item.address; + item.path; + item.serializedPath; + }); + // @ts-ignore + bundleAddress.payload.address; + } else { + bundleAddress.payload.error; + } + + // with all possible params + TrezorConnect.nemGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + network: 1, + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // @ts-ignore + TrezorConnect.nemGetAddress(); + // @ts-ignore + TrezorConnect.nemGetAddress({ coin: 'btc' }); + // @ts-ignore + TrezorConnect.nemGetAddress({ path: 1 }); + // @ts-ignore + TrezorConnect.nemGetAddress({ bundle: 1 }); +}; + +export const nemSignTransaction = async () => { + const common = { + version: -1744830464, + timeStamp: 74649215, + fee: 2000000, + deadline: 74735615, + signer: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + }; + const sign = await TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x0101, + recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + amount: 2000000, + message: { + payload: '746573745f6e656d5f7472616e73616374696f6e5f7472616e73666572', + type: 1, + }, + }, + }); + + if (sign.success) { + const { payload } = sign; + payload.data; + payload.signature; + } + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x1001, + modifications: [ + { + modificationType: 1, + cosignatoryAccount: 'c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844', + }, + ], + minCosignatories: { + relativeChange: 3, + }, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x4002, + mosaicId: { + namespaceId: 'hellom', + name: 'Hello mosaic', + }, + supplyType: 1, + delta: 1, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x4002, + mosaicId: { + namespaceId: 'hellom', + name: 'Hello mosaic', + }, + supplyType: 1, + delta: 1, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x1004, + otherTrans: { + timeStamp: 2, + amount: 2000000, + deadline: 67890, + fee: 15000, + recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + type: 0x0101, + message: { + payload: '746573745f6e656d5f7472616e73616374696f6e5f7472616e73666572', + type: 1, + }, + version: -1744830464, + signer: 'c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844', + }, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x1002, + otherTrans: { + timeStamp: 2, + amount: 2000000, + deadline: 67890, + fee: 15000, + recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + type: 0x0101, + message: { + payload: '746573745f6e656d5f7472616e73616374696f6e5f7472616e73666572', + type: 1, + }, + version: -1744830464, + signer: 'c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844', + }, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x0801, + importanceTransfer: { + mode: 1, + publicKey: 'c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844', + }, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x2001, + newPart: 'ABCDE', + rentalFeeSink: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + parent: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + rentalFee: 1500, + }, + }); + + TrezorConnect.nemSignTransaction({ + path: 'm/44', + transaction: { + ...common, + type: 0x4001, + mosaicDefinition: { + id: { + namespaceId: 'hellom', + name: 'Hello mosaic', + }, + levy: { + type: 1, + fee: 1, + recipient: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + mosaicId: { + namespaceId: 'hellom', + name: 'Hello mosaic', + }, + }, + description: 'lorem', + properties: [ + { + name: 'divisibility', + value: 'string', + }, + { + name: 'initialSupply', + value: 'string', + }, + { + name: 'supplyMutable', + value: 'string', + }, + { + name: 'transferable', + value: 'string', + }, + ], + }, + creationFeeSink: 'TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J', + creationFee: 1500, + }, + }); +}; diff --git a/src/ts/types/__tests__/ripple.ts b/src/ts/types/__tests__/ripple.ts new file mode 100644 index 000000000..c1ec6074a --- /dev/null +++ b/src/ts/types/__tests__/ripple.ts @@ -0,0 +1,81 @@ +import TrezorConnect from '../index'; + +export const rippleGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.rippleGetAddress({ path: 'm/44' }); + + if (singleAddress.success) { + const { payload } = singleAddress; + payload.address; + payload.path; + payload.serializedPath; + // @ts-ignore + payload.forEach(item => { + item.address; + }); + } + + // bundle + const bundleAddress = await TrezorConnect.rippleGetAddress({ bundle: [{ path: 'm/44' }] }); + + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + item.address; + item.path; + item.serializedPath; + }); + // @ts-ignore + bundleAddress.payload.address; + } else { + bundleAddress.payload.error; + } + + // with all possible params + TrezorConnect.rippleGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // @ts-ignore + TrezorConnect.rippleGetAddress(); + // @ts-ignore + TrezorConnect.rippleGetAddress({ coin: 'btc' }); + // @ts-ignore + TrezorConnect.rippleGetAddress({ path: 1 }); + // @ts-ignore + TrezorConnect.rippleGetAddress({ bundle: 1 }); +}; + +export const rippleSignTransaction = async () => { + const sign = await TrezorConnect.rippleSignTransaction({ + path: 'm/44', + transaction: { + payment: { + amount: '100', + destination: '1', + destinationTag: 1, + }, + fee: '1', + flags: 1, + sequence: 1, + maxLedgerVersion: 1, + }, + }); + + if (sign.success) { + const { payload } = sign; + payload.serializedTx; + payload.signature; + } +}; diff --git a/src/ts/types/__tests__/stellar.ts b/src/ts/types/__tests__/stellar.ts new file mode 100644 index 000000000..046938524 --- /dev/null +++ b/src/ts/types/__tests__/stellar.ts @@ -0,0 +1,279 @@ +import TrezorConnect from '../index'; + +export const stellarGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.stellarGetAddress({ path: 'm/44' }); + + if (singleAddress.success) { + const { payload } = singleAddress; + payload.address; + payload.path; + payload.serializedPath; + // @ts-ignore + payload.forEach(item => { + item.address; + }); + } + + // bundle + const bundleAddress = await TrezorConnect.stellarGetAddress({ bundle: [{ path: 'm/44' }] }); + + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + item.address; + item.path; + item.serializedPath; + }); + // @ts-ignore + bundleAddress.payload.address; + } else { + bundleAddress.payload.error; + } + + // with all possible params + TrezorConnect.stellarGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // @ts-ignore + TrezorConnect.stellarGetAddress(); + // @ts-ignore + TrezorConnect.stellarGetAddress({ coin: 'btc' }); + // @ts-ignore + TrezorConnect.stellarGetAddress({ path: 1 }); + // @ts-ignore + TrezorConnect.stellarGetAddress({ bundle: 1 }); +}; + +export const stellarSignTransaction = async () => { + const sign = await TrezorConnect.stellarSignTransaction({ + path: 'm/44', + networkPassphrase: 'Test SDF Network ; September 2015', + transaction: { + source: 'GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW', + fee: 100, + sequence: '4294967296', + memo: { + type: 0, + }, + operations: [ + { + type: 'createAccount', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + startingBalance: '1000333000', + }, + { + type: 'accountMerge', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + }, + { + type: 'payment', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + asset: { + type: 0, + code: 'XLM', + }, + amount: '500111000', + }, + { + type: 'payment', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + amount: '500111000', + asset: { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + }, + { + type: 'payment', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + amount: '500111000', + asset: { + type: 2, + code: 'ABCDEFGHIJKL', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + }, + { + type: 'bumpSequence', + bumpTo: '9223372036854775807', + }, + { + type: 'setOptions', + inflationDest: 'GAFXTC5OV5XQD66T7WGOB2HUVUC3ZVJDJMBDPTVQYV3G3K7TUHC6CLBR', + }, + { + type: 'setOptions', + signer: { + type: 0, + key: '72187adb879c414346d77c71af8cce7b6eaa57b528e999fd91feae6b6418628e', + weight: 2, + }, + }, + { + type: 'setOptions', + medThreshold: 0, + }, + { + type: 'setOptions', + clearFlags: 0, + lowThreshold: 0, + highThreshold: 3, + }, + { + type: 'setOptions', + setFlags: 3, + masterWeight: 4, + homeDomain: 'hello', + }, + { + type: 'setOptions', + }, + { + type: 'setOptions', + homeDomain: '', + }, + { + type: 'manageData', + name: 'data', + value: '616263', // Buffer.from('abc').toString('hex') + }, + { + type: 'manageData', + name: 'data', + value: undefined, + }, + { + type: 'pathPayment', + sendAsset: { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + sendMax: '500111000', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + destAsset: { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + destAmount: '500111000', + }, + { + type: 'pathPayment', + sendAsset: { + type: 2, + code: 'ABCDEFGHIJKL', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + sendMax: '500111000', + destination: 'GBOVKZBEM2YYLOCDCUXJ4IMRKHN4LCJAE7WEAEA2KF562XFAGDBOB64V', + destAsset: { + type: 2, + code: 'ABCDEFGHIJKL', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + destAmount: '500111000', + path: [ + { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + { + type: 2, + code: 'ABCDEFGHIJKL', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + ], + }, + { + type: 'createPassiveOffer', + selling: { + type: 0, + code: 'XLM', + }, + buying: { + type: 0, + code: 'XLM', + }, + amount: '500111000', + price: { + n: 500111, + d: 10000, + }, + }, + { + type: 'createPassiveOffer', + selling: { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + buying: { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + amount: '500111000', + price: { + n: 500111, + d: 10000, + }, + }, + { + type: 'manageOffer', + selling: { + type: 0, + code: 'XLM', + }, + buying: { + type: 0, + code: 'XLM', + }, + amount: '500111000', + price: { + n: 500111, + d: 10000, + }, + offerId: '101', + }, + { + type: 'changeTrust', + line: { + type: 1, + code: 'X', + issuer: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + }, + limit: '9223372036854775807', + }, + { + type: 'allowTrust', + trustor: 'GAUYJFQCYIHFQNS7CI6BFWD2DSSFKDIQZUQ3BLQODDKE4PSW7VVBKENC', + assetType: 1, + assetCode: 'XLM', + authorize: true, + }, + ], + }, + }); + + if (sign.success) { + const { payload } = sign; + payload.publicKey; + payload.signature; + } +}; diff --git a/src/ts/types/__tests__/tezos.ts b/src/ts/types/__tests__/tezos.ts new file mode 100644 index 000000000..12deeb9fb --- /dev/null +++ b/src/ts/types/__tests__/tezos.ts @@ -0,0 +1,145 @@ +import TrezorConnect from '../index'; + +export const tezosGetAddress = async () => { + // regular + const singleAddress = await TrezorConnect.tezosGetAddress({ path: 'm/44' }); + if (singleAddress.success) { + const { payload } = singleAddress; + payload.address; + payload.path; + payload.serializedPath; + // @ts-ignore + payload.forEach(item => { + item.address; + }); + } + + // bundle + const bundleAddress = await TrezorConnect.tezosGetAddress({ bundle: [{ path: 'm/44' }] }); + if (bundleAddress.success) { + bundleAddress.payload.forEach(item => { + item.address; + item.path; + item.serializedPath; + }); + // @ts-ignore + bundleAddress.payload.address; + } else { + bundleAddress.payload.error; + } + + // with all possible params + TrezorConnect.tezosGetAddress({ + device: { + path: '1', + instance: 1, + state: 'state@device-id:1', + }, + useEmptyPassphrase: true, + allowSeedlessDevice: false, + keepSession: false, + skipFinalReload: false, + path: 'm/44', + address: 'a', + showOnTrezor: true, + }); + + // with invalid params + // @ts-ignore + TrezorConnect.tezosGetAddress(); + // @ts-ignore + TrezorConnect.tezosGetAddress({ coin: 'btc' }); + // @ts-ignore + TrezorConnect.tezosGetAddress({ path: 1 }); + // @ts-ignore + TrezorConnect.tezosGetAddress({ bundle: 1 }); +}; + +export const tezosGetPublicKey = async () => { + // regular + const singlePK = await TrezorConnect.tezosGetPublicKey({ path: 'm/44' }); + + if (singlePK.success) { + const { payload } = singlePK; + payload.path; + payload.serializedPath; + payload.publicKey; + // @ts-ignore + payload.forEach(item => { + item.path; + }); + } + + // bundle + const bundlePK = await TrezorConnect.tezosGetPublicKey({ bundle: [{ path: 'm/44' }] }); + + if (bundlePK.success) { + bundlePK.payload.forEach(item => { + item.path; + item.serializedPath; + item.publicKey; + }); + // @ts-ignore + bundlePK.payload.path; + } else { + bundlePK.payload.error; + } +}; + +export const tezosSignTransaction = async () => { + const sign = await TrezorConnect.tezosSignTransaction({ + path: "m/44'/1729'/10'", + branch: 'BLGUkzwvguFu8ei8eLW3KgCbdtrMmv1UCqMvUpHHTGq1UPxypHS', + operation: { + transaction: { + source: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo', + destination: 'tz1Kef7BSg6fo75jk37WkKRYSnJDs69KVqt9', + counter: 297, + amount: 200000, + fee: 10000, + gas_limit: 44825, + storage_limit: 0, + parameters_manager: { + set_delegate: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo', + cancel_delegate: true, + transfer: { + amount: 200, + destination: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo', + }, + }, + }, + reveal: { + source: 'tz1ekQapZCX4AXxTJhJZhroDKDYLHDHegvm1', + counter: 575424, + fee: 10000, + gas_limit: 20000, + storage_limit: 0, + public_key: 'edpkuTPqWjcApwyD3VdJhviKM5C13zGk8c4m87crgFarQboF3Mp56f', + }, + origination: { + source: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo', + balance: 100000, + fee: 20000, + counter: 298, + gas_limit: 20000, + storage_limit: 10000, + script: '0000001c02000000170500036805010368050202000000080316053d036d03420000000a010000000568656c6c6f', + }, + delegation: { + source: 'tz1Kef7BSg6fo75jk37WkKRYSnJDs69KVqt9', + delegate: 'tz1UKmZhi8dhUX5a5QTfCrsH9pK4dt1dVfJo', + fee: 20000, + counter: 564565, + gas_limit: 20000, + storage_limit: 0, + }, + }, + }); + + if (sign.success) { + const { payload } = sign; + payload.sig_op_contents; + payload.signature; + payload.operation_hash; + } +}; diff --git a/src/ts/types/account.d.ts b/src/ts/types/account.d.ts new file mode 100644 index 000000000..5e287c8ac --- /dev/null +++ b/src/ts/types/account.d.ts @@ -0,0 +1,256 @@ +import { TransactionInput, TransactionOutput } from './trezor/protobuf'; + +// getAccountInfo params +export interface GetAccountInfo { + coin: string; + path?: string; + descriptor?: string; + details?: 'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txs'; + tokens?: 'nonzero' | 'used' | 'derived'; + page?: number; + pageSize?: number; + from?: number; + to?: number; + contractFilter?: string; + gap?: number; + marker?: { + ledger: number; + seq: number; + }; +} + +export interface TokenInfo { + type: string; // token type: ERC20... + address: string; // token address + balance?: string; // token balance + name?: string; // token name + symbol?: string; // token symbol + decimals: number; // token decimals or 0 + // transfers: number, // total transactions? +} + +export interface AccountAddress { + address: string; + path: string; + transfers: number; + balance?: string; + sent?: string; + received?: string; +} + +export interface AccountAddresses { + change: AccountAddress[]; + used: AccountAddress[]; + unused: AccountAddress[]; +} + +export interface AccountUtxo { + txid: string; + vout: number; + amount: string; + blockHeight: number; + address: string; + path: string; + confirmations: number; + coinbase?: boolean; +} + +// Transaction object +export interface TokenTransfer { + type: 'sent' | 'recv' | 'self' | 'unknown'; + name: string; + symbol: string; + address: string; + decimals: number; + amount: string; + from?: string; + to?: string; +} + +// Transaction object +export interface TransactionTarget { + addresses?: string[]; + isAddress: boolean; + amount?: string; + coinbase?: string; +} + +export interface AccountTransaction { + type: 'sent' | 'recv' | 'self' | 'unknown'; + + txid: string; + blockTime?: number; + blockHeight?: number; + blockHash?: string; + + amount: string; + fee: string; + // total?: string; // amount + total + + targets: TransactionTarget[]; + tokens: TokenTransfer[]; + rbf?: boolean; + ethereumSpecific?: { + status: number; + nonce: number; + gasLimit: number; + gasUsed?: number; + gasPrice: string; + }; +} + +// getAccountInfo response +export interface AccountInfo { + empty: boolean; + path: string; + descriptor: string; // address or xpub + balance: string; + availableBalance: string; + tokens?: TokenInfo[]; // ethereum tokens + addresses?: AccountAddresses; // bitcoin addresses + utxo?: AccountUtxo[]; // bitcoin utxo + history: { + total: number; // total transactions (unknown in ripple) + tokens?: number; // tokens transactions (unknown in ripple) + unconfirmed?: number; // unconfirmed transactions (unknown in ripple) + transactions?: AccountTransaction[]; // list of transactions + txids?: string[]; // not implemented + }; + misc?: { + // ETH + nonce?: string; + // XRP + sequence?: number; + reserve?: string; + }; + page?: { + // blockbook + index: number; + size: number; + total: number; + }; + marker?: { + // ripple-lib + ledger: number; + seq: number; + }; +} + +// Compose transaction + +export interface RegularOutput { + address: string; + amount: string; + script_type?: 'PAYTOADDRESS'; +} + +export interface InternalOutput { + address_n: number[]; + amount: string; + script_type?: string; +} + +export interface SendMaxOutput { + type: 'send-max'; + address: string; +} + +export interface OpReturnOutput { + type: 'opreturn'; + dataHex: string; +} +export interface NoAddressOutput { + type: 'noaddress'; + amount: string; +} + +export interface NoAddressSendMaxOutput { + type: 'send-max-noaddress'; +} + +export type ComposeOutput = + | RegularOutput + | InternalOutput + | SendMaxOutput + | OpReturnOutput + | NoAddressOutput + | NoAddressSendMaxOutput; + +export interface PrecomposeParams { + outputs: ComposeOutput[]; + account: { + path: string; + addresses: AccountAddresses; + utxo: AccountUtxo[]; + }; + feeLevels: Array<{ + feePerUnit: string; + }>; + coin: string; +} + +export type PrecomposedTransaction = + | { + type: 'error'; + error: string; + } + | { + type: 'nonfinal'; + max: string; + totalSpent: string; // all the outputs, no fee, no change + fee: string; + feePerByte: string; + bytes: number; + } + | { + type: 'final'; + max: string; + totalSpent: string; // all the outputs, no fee, no change + fee: string; + feePerByte: string; + bytes: number; + transaction: { + inputs: TransactionInput[]; + outputs: TransactionOutput[]; + }; + }; + +export interface ComposeParams { + outputs: ComposeOutput[]; + coin: string; + push?: boolean; +} + +export type DiscoveryAccountType = 'normal' | 'segwit' | 'legacy'; + +export interface DiscoveryAccount { + type: DiscoveryAccountType; + label: string; + descriptor: string; + address_n: number[]; + empty?: boolean; + balance?: string; + addresses?: AccountAddresses; +} + +export interface FeeLevel { + label: 'high' | 'normal' | 'economy' | 'low' | 'custom'; + feePerUnit: string; + blocks: number; + feeLimit?: string; // eth gas limit + feePerTx?: string; // fee for BlockchainEstimateFeeParams.request.specific +} + +export type SelectFeeLevel = + | { + name: string; + fee: '0'; + disabled: true; + } + | { + name: string; + fee: string; + feePerByte: string; + minutes: number; + total: string; + }; diff --git a/src/ts/types/api.d.ts b/src/ts/types/api.d.ts new file mode 100644 index 000000000..ba8cbc1c5 --- /dev/null +++ b/src/ts/types/api.d.ts @@ -0,0 +1,342 @@ +import * as CONSTANTS from './constants'; +import * as P from './params'; +import * as Device from './trezor/device'; +import * as Mgmnt from './trezor/management'; +import * as Protobuf from './trezor/protobuf'; +import * as Account from './account'; + +import * as Bitcoin from './networks/bitcoin'; +import * as Binance from './networks/binance'; +import * as Cardano from './networks/cardano'; +import * as EOS from './networks/eos'; +import * as Ethereum from './networks/ethereum'; +import * as Lisk from './networks/lisk'; +import * as NEM from './networks/nem'; +import * as Ripple from './networks/ripple'; +import * as Stellar from './networks/stellar'; +import * as Tezos from './networks/tezos'; +import * as Misc from './misc'; + +import * as Events from './events'; +import * as Blockchain from './backend/blockchain'; + +export namespace TrezorConnect { + /** + * Set TrezorConnect manifest. + */ + function manifest(params: P.Manifest): void; + + /** + * Initializes TrezorConnect. + * `manifest` is required + */ + function init(settings: { manifest: P.Manifest } & Partial): Promise; + + /** + * Retrieves the settings that TrezorConnect was initialized with. + */ + function getSettings(): P.Response; + + function dispose(): void; + + function cancel(params?: string): void; + + function renderWebUSBButton(): void; + + function disableWebUSB(): void; + + /** + * Event listeners + */ + function on(type: typeof CONSTANTS.DEVICE_EVENT, cb: (event: Device.DeviceEvent & { event: typeof CONSTANTS.DEVICE_EVENT }) => void): void; + function on(type: typeof CONSTANTS.TRANSPORT_EVENT, cb: (event: Events.TransportEvent & { event: typeof CONSTANTS.TRANSPORT_EVENT }) => void): void; + function on(type: typeof CONSTANTS.UI_EVENT, cb: (event: Events.UiEvent & { event: typeof CONSTANTS.UI_EVENT }) => void): void; + function on(type: typeof CONSTANTS.BLOCKCHAIN_EVENT, cb: (event: Blockchain.BlockchainEvent & { event: typeof CONSTANTS.BLOCKCHAIN_EVENT }) => void): void; + function on(type: Events.MessageWithoutPayload['type'], cb: () => void): void; + function on(type: Events.DeviceMessage['type'], cb: (event: Events.DeviceMessage['payload']) => void): void; + function on(type: Events.ButtonRequestMessage['type'], cb: (event: Events.ButtonRequestMessage['payload']) => void): void; + function on(type: Events.AddressValidationMessage['type'], cb: (event: Events.AddressValidationMessage['payload']) => void): void; + function on(type: Events.RequestPermission['type'], cb: (event: Events.RequestPermission['payload']) => void): void; + function on(type: Events.RequestConfirmation['type'], cb: (event: Events.RequestConfirmation['payload']) => void): void; + function on(type: Events.UnexpectedDeviceMode['type'], cb: (event: Events.UnexpectedDeviceMode['payload']) => void): void; + function on(type: Events.FirmwareException['type'], cb: (event: Events.FirmwareException['payload']) => void): void; + function on(type: typeof CONSTANTS.UI.BUNDLE_PROGRESS, cb: (event: Events.BundleProgress['payload']) => void): void; + function on(type: Events.FirmwareProgress['type'], cb: (event: Events.FirmwareProgress['payload']) => void): void; + function on(type: Events.CustomMessageRequest['type'], cb: (event: Events.CustomMessageRequest['payload']) => void): void; + function off(type: string, cb: any): void; + + function uiResponse(response: Events.UiResponse): void; + + /** + * Backend operations + */ + function blockchainEstimateFee( + params: P.CommonParams & Blockchain.BlockchainEstimateFee, + ): P.Response; + function blockchainGetTransactions( + params: P.CommonParams & Blockchain.BlockchainGetTransactions, + ): P.Response; + function blockchainSubscribe( + params: P.CommonParams & Blockchain.BlockchainSubscribe, + ): P.Response; + function blockchainUnsubscribe( + params: P.CommonParams & Blockchain.BlockchainSubscribe, + ): P.Response; + function blockchainDisconnect( + params: P.CommonParams & Blockchain.BlockchainDisconnect, + ): P.Response; + + /** + * Bitcoin and Bitcoin-like + * Display requested address derived by given BIP32 path on device and + * returns it to caller. User is asked to confirm the export on Trezor. + */ + function getAddress(params: P.CommonParams & Bitcoin.GetAddress): P.Response; + function getAddress(params: P.CommonParams & P.Bundle): P.BundledResponse; + + /** + * Bitcoin and Bitcoin-like + * Retrieves BIP32 extended public derived by given BIP32 path. + * User is presented with a description of the requested key and asked to + * confirm the export. + */ + function getPublicKey(params: P.CommonParams & Bitcoin.GetPublicKey): P.Response; + function getPublicKey( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + + /** + * Bitcoin and Bitcoin-like + * Asks device to sign given inputs and outputs of pre-composed transaction. + * User is asked to confirm all transaction details on Trezor. + */ + function signTransaction(params: P.CommonParams & Bitcoin.SignTransaction): P.Response; + + /** + * Bitcoin, Bitcoin-like, Ethereum-like, Ripple + * Broadcasts the transaction to the selected network. + */ + function pushTransaction(params: P.CommonParams & Bitcoin.PushTransaction): P.Response; + + /** + * Bitcoin and Bitcoin-like + * Requests a payment from the users wallet to a set of given outputs. + * Internally a BIP-0044 account discovery is performed and user is presented + * with a list of accounts. After account selection user is presented with + * list of fee selection. After selecting a fee transaction is signed and + * returned in hexadecimal format. Change output is added automatically, if + * needed. + */ + function composeTransaction(params: P.CommonParams & Account.ComposeParams): P.Response; + function composeTransaction( + params: P.CommonParams & Account.PrecomposeParams, + ): P.Response; + + /** + * Bitcoin, Bitcoin-like, Ethereum-like, Ripple + * Gets an info of specified account. + */ + function getAccountInfo(params: P.CommonParams & Account.GetAccountInfo): P.Response; + function getAccountInfo( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + + /** + * Bitcoin and Bitcoin-like + * Asks device to sign a message using the private key derived by given BIP32 + * path. + */ + function signMessage(params: P.CommonParams & Bitcoin.SignMessage): P.Response; + + /** + * Bitcoin and Bitcoin-like + * Asks device to verify a message using the signer address and signature. + */ + function verifyMessage(params: P.CommonParams & Bitcoin.VerifyMessage): P.Response; + + // Binance + function binanceGetAddress(params: P.CommonParams & Binance.BinanceGetAddress): P.Response; + function binanceGetAddress( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function binanceGetPublicKey( + params: P.CommonParams & Binance.BinanceGetPublicKey, + ): P.Response; + function binanceGetPublicKey( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function binanceSignTransaction( + params: P.CommonParams & Binance.BinanceSignTransaction, + ): P.Response; + + // Cardano (ADA) + function cardanoGetAddress(params: P.CommonParams & Cardano.CardanoGetAddress): P.Response; + function cardanoGetAddress( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function cardanoGetPublicKey( + params: P.CommonParams & Cardano.CardanoGetPublicKey, + ): P.Response; + function cardanoGetPublicKey( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function cardanoSignTransaction( + params: P.CommonParams & Cardano.CardanoSignTransaction, + ): P.Response; + + // EOS + function eosGetPublicKey(params: P.CommonParams & EOS.EosGetPublicKey): P.Response; + function eosGetPublicKey( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function eosSignTransaction(params: P.CommonParams & EOS.EosSignTransaction): P.Response; + + // Ethereum and Ethereum-like + function ethereumGetAddress( + params: P.CommonParams & Ethereum.EthereumGetAddress, + ): P.Response; + function ethereumGetAddress( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function ethereumGetPublicKey( + params: P.CommonParams & Ethereum.EthereumGetPublicKey, + ): P.Response; + function ethereumGetPublicKey( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function ethereumSignTransaction( + params: P.CommonParams & Ethereum.EthereumSignTransaction, + ): P.Response; + function ethereumSignTransaction( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function ethereumSignMessage( + params: P.CommonParams & Ethereum.EthereumSignMessage, + ): P.Response; + function ethereumVerifyMessage( + params: P.CommonParams & Ethereum.EthereumVerifyMessage, + ): P.Response; + + // Lisk + function liskGetAddress(params: P.CommonParams & Lisk.LiskGetAddress): P.Response; + function liskGetAddress( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function liskGetPublicKey(params: P.CommonParams & Lisk.LiskGetPublicKey): P.Response; + function liskGetPublicKey( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function liskSignTransaction(params: P.CommonParams & Lisk.LiskSignTransaction): P.Response; + function liskSignMessage(params: P.CommonParams & Lisk.LiskSignMessage): P.Response; + function liskVerifyMessage(params: P.CommonParams & Lisk.LiskVerifyMessage): P.Response; + + // NEM + function nemGetAddress(params: P.CommonParams & NEM.NEMGetAddress): P.Response; + function nemGetAddress(params: P.CommonParams & P.Bundle): P.BundledResponse; + function nemSignTransaction(params: P.CommonParams & NEM.NEMSignTransaction): P.Response; + + // Ripple + function rippleGetAddress(params: P.CommonParams & Ripple.RippleGetAddress): P.Response; + function rippleGetAddress( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function rippleSignTransaction( + params: P.CommonParams & Ripple.RippleSignTransaction, + ): P.Response; + + // Stellar + function stellarGetAddress(params: P.CommonParams & Stellar.StellarGetAddress): P.Response; + function stellarGetAddress( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function stellarSignTransaction( + params: P.CommonParams & Stellar.StellarSignTransaction, + ): P.Response; + + // // Tezos + function tezosGetAddress(params: P.CommonParams & Tezos.TezosGetAddress): P.Response; + function tezosGetAddress( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function tezosGetPublicKey(params: P.CommonParams & Tezos.TezosGetPublicKey): P.Response; + function tezosGetPublicKey( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + function tezosSignTransaction( + params: P.CommonParams & Tezos.TezosSignTransaction, + ): P.Response; + + /** + * Challenge-response authentication via Trezor. + * To protect against replay attacks you should use a server-side generated + * and randomized challengeHidden for every attempt. You can also provide a + * visual challenge that will be shown on the device. + */ + function requestLogin( + params: P.CommonParams & (Misc.RequestLoginAsync | Misc.LoginChallenge), + ): P.Response; + + /** + * Asks device to encrypt value using the private key derived by given BIP32 + * path and the given key. IV is always computed automatically. + */ + function cipherKeyValue(params: P.CommonParams & Misc.CipherKeyValue): P.Response; + function cipherKeyValue( + params: P.CommonParams & P.Bundle, + ): P.BundledResponse; + + /** + * Retrieves the set of features associated with the device. + */ + function getFeatures(params?: P.CommonParams): P.Response; + + /** + * Retrieves device state associated with passphrase. + */ + function getDeviceState(params?: P.CommonParams): P.Response; + + /** + * Resets device to factory defaults and removes all private data. + */ + function wipeDevice(params?: P.CommonParams): P.Response; + + /** + * Performs device setup and generates a new seed. + */ + function resetDevice(params: P.CommonParams & Mgmnt.ResetDevice): P.Response; + + /** + * Applies device setup + */ + function applySettings(params: P.CommonParams & Mgmnt.ApplySettings): P.Response; + + /** + * Increment saved flag on device + */ + function applyFlags(params: P.CommonParams & Mgmnt.ApplyFlags): P.Response; + + /** + * Change pin + */ + function changePin(params: P.CommonParams & Mgmnt.ChangePin): P.Response; + + /** + * Sends FirmwareErase message followed by FirmwareUpdate message + */ + function firmwareUpdate(params: P.CommonParams & Mgmnt.FirmwareUpdate): P.Response; + + /** + * Asks device to initiate seed backup procedure + */ + function backupDevice(params?: P.CommonParams): P.Response; + + /** + * Ask device to initiate recovery procedure + */ + function recoveryDevice(params: P.CommonParams & Mgmnt.RecoveryDevice): P.Response; + + // // Developer mode + function customMessage(params: P.CommonParams & Misc.CustomMessage): P.Response; + function debugLinkDecision(params?: P.CommonParams): P.Response<{ debugLink: true }>; + function debugLinkGetState(params?: P.CommonParams): P.Response<{ debugLink: true }>; +} diff --git a/src/ts/types/backend/blockchain.d.ts b/src/ts/types/backend/blockchain.d.ts new file mode 100644 index 000000000..e964b4e71 --- /dev/null +++ b/src/ts/types/backend/blockchain.d.ts @@ -0,0 +1,116 @@ +import { BLOCKCHAIN } from '../constants'; +import { CoinInfo } from '../networks/coinInfo'; +import { AccountAddresses, AccountTransaction, FeeLevel } from '../account'; +import { BlockbookTransaction, RippleLibTransaction } from './transactions'; + +export interface BlockchainInfo { + coin: CoinInfo; + url: string; + blockHash: string; + blockHeight: number; + decimals: number; + name: string; + shortcut: string; + testnet: boolean; + version: string; + misc?: { + reserve?: string; + }; +} + +export interface BlockchainBlock { + blockHash: string; + blockHeight: number; + coin: CoinInfo; +} + +export interface BlockchainError { + coin: CoinInfo; + error: string; +} + +export interface BlockchainNotification { + coin: CoinInfo; + notification: { + descriptor: string; + tx: AccountTransaction; + }; +} + +export interface BlockchainSubscribeAccount { + descriptor: string; + addresses?: AccountAddresses; // bitcoin addresses +} + +export interface BlockchainSubscribe { + accounts: BlockchainSubscribeAccount[]; + coin: string; +} + +export interface BlockchainSubscribed { + subscribed: boolean; +} + +export interface BlockchainDisconnect { + coin: string; +} + +export interface BlockchainDisconnected { + disconnected: boolean; +} + +export interface BlockchainGetTransactions { + coin: string; + txs: string[]; +} + +export type BlockchainTransactions = Array< + | { + type: 'blockbook'; + tx: BlockbookTransaction; + } + | { + type: 'ripple'; + tx: RippleLibTransaction; + } +>; + +export interface BlockchainEstimateFee { + coin: string; + request?: { + blocks?: number[]; + specific?: { + conservative?: boolean; + data?: string; + from?: string; + to?: string; + txsize?: number; + }; + feeLevels?: 'preloaded' | 'smart'; + }; +} + +export interface BlockchainEstimatedFee { + blockTime: number; + minFee: number; + maxFee: number; + levels: FeeLevel[]; +} + +export type BlockchainEvent = + | { + type: typeof BLOCKCHAIN.CONNECT; + payload: BlockchainInfo; + } + | { + type: typeof BLOCKCHAIN.ERROR; + payload: BlockchainError; + } + | { + type: typeof BLOCKCHAIN.BLOCK; + payload: BlockchainBlock; + } + | { + type: typeof BLOCKCHAIN.NOTIFICATION; + payload: BlockchainNotification; + }; diff --git a/src/ts/types/backend/transactions.d.ts b/src/ts/types/backend/transactions.d.ts new file mode 100644 index 000000000..99b42d5f4 --- /dev/null +++ b/src/ts/types/backend/transactions.d.ts @@ -0,0 +1,94 @@ +// copy-paste from blockchain-link +export interface VinVout { + n: number; + addresses?: string[]; + isAddress: boolean; + value?: string; + coinbase?: string; + txid?: string; + vout?: number; + sequence?: number; + hex?: string; +} + +export interface BlockbookTransaction { + txid: string; + version?: number; + vin: VinVout[]; + vout: VinVout[]; + blockHeight: number; + blockHash?: string; + confirmations: number; + blockTime: number; + value: string; + valueIn: string; + fees: string; + hex: string; + ethereumSpecific?: { + status: number; + nonce: number; + gasLimit: number; + gasUsed?: number; + gasPrice: string; + }; + tokenTransfers?: Array<{ + from?: string; + to?: string; + value: string; + token: string; + name: string; + symbol: string; + decimals?: number; + }>; +} + +// ripple-lib + +export interface RippleLibAmount { + value: string; + currency: string; + issuer?: string; + counterparty?: string; +} + +export interface RippleLibAdjustment { + address: string; + amount: RippleLibAmount; + tag?: number; +} + +export interface RippleLibMemo { + type?: string; + format?: string; + data?: string; +} + +export interface RippleLibOutcome { + result: string; + ledgerVersion: number; + indexInLedger: number; + fee: string; + balanceChanges: { + [key: string]: RippleLibAmount[]; + }; + orderbookChanges: any; + timestamp?: string; +} + +export interface RippleLibTransaction { + type: string; + specification: { + source: RippleLibAdjustment; + destination: RippleLibAdjustment; + paths?: string; + memos?: RippleLibMemo[]; + invoiceID?: string; + allowPartialPayment?: boolean; + noDirectRipple?: boolean; + limitQuality?: boolean; + }; + outcome: RippleLibOutcome; + id: string; + address: string; + sequence: number; +} diff --git a/src/ts/types/constants.d.ts b/src/ts/types/constants.d.ts new file mode 100644 index 000000000..e00f7c484 --- /dev/null +++ b/src/ts/types/constants.d.ts @@ -0,0 +1,144 @@ +export const CORE_EVENT = 'CORE_EVENT'; +export const UI_EVENT = 'UI_EVENT'; +export const DEVICE_EVENT = 'DEVICE_EVENT'; +export const TRANSPORT_EVENT = 'TRANSPORT_EVENT'; +export const RESPONSE_EVENT = 'RESPONSE_EVENT'; +export const BLOCKCHAIN_EVENT = 'BLOCKCHAIN_EVENT'; + +export namespace BLOCKCHAIN { + const CONNECT = 'blockchain-connect'; + const ERROR = 'blockchain-error'; + const NOTIFICATION = 'blockchain-notification'; + const BLOCK = 'blockchain-block'; +} + +export namespace IFRAME { + const BOOTSTRAP = 'iframe-bootstrap'; + const LOADED = 'iframe-loaded'; + const INIT = 'iframe-init'; + const ERROR = 'iframe-error'; + const CALL = 'iframe-call'; +} + +export namespace POPUP { + // Message called from popup.html inline script before "window.onload" event. This is first message from popup to window.opener. + const BOOTSTRAP = 'popup-bootstrap'; + // Message from popup.js to window.opener, called after "window.onload" event. This is second message from popup to window.opener. + const LOADED = 'popup-loaded'; + // Message from window.opener to popup.js. Send settings to popup. This is first message from window.opener to popup. + const INIT = 'popup-init'; + // Error message from popup to window.opener. Could be thrown during popup initialization process (POPUP.INIT) + const ERROR = 'popup-error'; + // Message to webextensions, opens "trezor-usb-permission.html" within webextension + const EXTENSION_USB_PERMISSIONS = 'open-usb-permissions'; + // Message called from both [popup > iframe] then [iframe > popup] in this exact order. + // Firstly popup call iframe to resolve popup promise in Core + // Then iframe reacts to POPUP.HANDSHAKE message and sends ConnectSettings, transport information and requested method details back to popup + const HANDSHAKE = 'popup-handshake'; + // Event emitted from PopupManager at the end of popup closing process. + // Sent from popup thru window.opener to an iframe because message channel between popup and iframe is no longer available + const CLOSED = 'popup-closed'; + // Message called from iframe to popup, it means that popup will not be needed (example: Blockchain methods are not using popup at all) + // This will close active popup window and/or clear opening process in PopupManager (maybe popup wasn't opened yet) + const CANCEL_POPUP_REQUEST = 'ui-cancel-popup-request'; + // Message called from inline element in popup.html (window.closeWindow), this is used only with webextensions to properly handle popup close event + const CLOSE_WINDOW = 'window.close'; +} + +export namespace TRANSPORT { + const START = 'transport-start'; + const ERROR = 'transport-error'; + const UPDATE = 'transport-update'; + const STREAM = 'transport-stream'; + const REQUEST = 'transport-request_device'; + const RECONNECT = 'transport-reconnect'; + const DISABLE_WEBUSB = 'transport-disable_webusb'; + const START_PENDING = 'transport-start_pending'; +} + +export namespace DEVICE { + // device list events + const CONNECT = 'device-connect'; + const CONNECT_UNACQUIRED = 'device-connect_unacquired'; + const DISCONNECT = 'device-disconnect'; + const CHANGED = 'device-changed'; + const ACQUIRE = 'device-acquire'; + const RELEASE = 'device-release'; + const ACQUIRED = 'device-acquired'; + const RELEASED = 'device-released'; + const USED_ELSEWHERE = 'device-used_elsewhere'; + + const LOADING = 'device-loading'; + + // trezor-link events in protobuf format + const BUTTON = 'button'; + const PIN = 'pin'; + const PASSPHRASE = 'passphrase'; + const PASSPHRASE_ON_DEVICE = 'passphrase_on_device'; + const WORD = 'word'; + + // custom + const WAIT_FOR_SELECTION = 'device-wait_for_selection'; + + // this string has different prefix than other constants and it's used as device path + const UNREADABLE = 'unreadable-device'; +} + +export namespace UI { + const TRANSPORT = 'ui-no_transport'; + const BOOTLOADER = 'ui-device_bootloader_mode'; + const NOT_IN_BOOTLOADER = 'ui-device_not_in_bootloader_mode'; + const REQUIRE_MODE = 'ui-device_require_mode'; + const INITIALIZE = 'ui-device_not_initialized'; + const SEEDLESS = 'ui-device_seedless'; + const FIRMWARE_OLD = 'ui-device_firmware_old'; + const FIRMWARE_OUTDATED = 'ui-device_firmware_outdated'; + const FIRMWARE_NOT_SUPPORTED = 'ui-device_firmware_unsupported'; + const FIRMWARE_NOT_COMPATIBLE = 'ui-device_firmware_not_compatible'; + const FIRMWARE_NOT_INSTALLED = 'ui-device_firmware_not_installed'; + const FIRMWARE_PROGRESS = 'ui-firmware-progress'; + const DEVICE_NEEDS_BACKUP = 'ui-device_needs_backup'; + + const REQUEST_UI_WINDOW = 'ui-request_window'; + const CLOSE_UI_WINDOW = 'ui-close_window'; + + const REQUEST_PERMISSION = 'ui-request_permission'; + const REQUEST_CONFIRMATION = 'ui-request_confirmation'; + const REQUEST_PIN = 'ui-request_pin'; + const INVALID_PIN = 'ui-invalid_pin'; + const REQUEST_PASSPHRASE = 'ui-request_passphrase'; + const REQUEST_PASSPHRASE_ON_DEVICE = 'ui-request_passphrase_on_device'; + const INVALID_PASSPHRASE = 'ui-invalid_passphrase'; + const INVALID_PASSPHRASE_ACTION = 'ui-invalid_passphrase_action'; + const CONNECT = 'ui-connect'; + const LOADING = 'ui-loading'; + const SET_OPERATION = 'ui-set_operation'; + const SELECT_DEVICE = 'ui-select_device'; + const SELECT_ACCOUNT = 'ui-select_account'; + const SELECT_FEE = 'ui-select_fee'; + const UPDATE_CUSTOM_FEE = 'ui-update_custom_fee'; + const INSUFFICIENT_FUNDS = 'ui-insufficient_funds'; + const REQUEST_BUTTON = 'ui-button'; + const REQUEST_WORD = 'ui-request_word'; + + const RECEIVE_PERMISSION = 'ui-receive_permission'; + const RECEIVE_CONFIRMATION = 'ui-receive_confirmation'; + const RECEIVE_PIN = 'ui-receive_pin'; + const RECEIVE_PASSPHRASE = 'ui-receive_passphrase'; + const RECEIVE_DEVICE = 'ui-receive_device'; + const CHANGE_ACCOUNT = 'ui-change_account'; + const RECEIVE_ACCOUNT = 'ui-receive_account'; + const RECEIVE_FEE = 'ui-receive_fee'; + const RECEIVE_WORD = 'ui-receive_word'; + + const CHANGE_SETTINGS = 'ui-change_settings'; + + const CUSTOM_MESSAGE_REQUEST = 'ui-custom_request'; + const CUSTOM_MESSAGE_RESPONSE = 'ui-custom_response'; + + const LOGIN_CHALLENGE_REQUEST = 'ui-login_challenge_request'; + const LOGIN_CHALLENGE_RESPONSE = 'ui-login_challenge_response'; + + const BUNDLE_PROGRESS = 'ui-bundle_progress'; + const ADDRESS_VALIDATION = 'ui-address_validation'; +} diff --git a/src/ts/types/events.d.ts b/src/ts/types/events.d.ts new file mode 100644 index 000000000..054394783 --- /dev/null +++ b/src/ts/types/events.d.ts @@ -0,0 +1,320 @@ +import { TRANSPORT, UI, IFRAME, POPUP } from './constants'; +import { ConnectSettings } from './params'; +import { Device } from './trezor/device'; +import { DiscoveryAccount, SelectFeeLevel } from './account'; +import { CoinInfo, BitcoinNetworkInfo } from './networks/coinInfo'; + +export interface BridgeInfo { + version: number[]; + directory: string; + packages: Array<{ + name: string; + platform: string[]; + url: string; + signature?: string; + preferred?: boolean; + }>; + changelog: string; +} + +export interface TransportInfo { + type: string; + version: string; + outdated: boolean; + bridge?: BridgeInfo; +} + +export type TransportEvent = + | { + type: typeof TRANSPORT.START; + payload: TransportInfo; + } + | { + type: typeof TRANSPORT.ERROR; + payload: { + error: string; + bridge?: BridgeInfo; + }; + }; + +/* + * messages to UI emitted as UI_EVENT + */ + +export interface MessageWithoutPayload { + type: + | typeof UI.REQUEST_UI_WINDOW + | typeof POPUP.CANCEL_POPUP_REQUEST + | typeof IFRAME.LOADED + | typeof POPUP.LOADED + | typeof UI.TRANSPORT + | typeof UI.CHANGE_ACCOUNT + | typeof UI.INSUFFICIENT_FUNDS + | typeof UI.CLOSE_UI_WINDOW + | typeof UI.LOGIN_CHALLENGE_REQUEST; +} + +export interface DeviceMessage { + type: + | typeof UI.REQUEST_PIN + | typeof UI.INVALID_PIN + | typeof UI.REQUEST_PASSPHRASE_ON_DEVICE + | typeof UI.REQUEST_PASSPHRASE + | typeof UI.INVALID_PASSPHRASE + | typeof UI.REQUEST_WORD; + payload: { + device: Device; + type?: string; // todo: better flow enum + }; +} + +export interface ButtonRequestData { + type: 'address'; + serializedPath: string; + address: string; +} + +export interface ButtonRequestMessage { + type: typeof UI.REQUEST_BUTTON; + payload: { + device: Device; + code: string; + data?: ButtonRequestData; + }; +} + +export interface AddressValidationMessage { + type: typeof UI.ADDRESS_VALIDATION; + payload?: ButtonRequestData; +} + +export interface FrameError { + type: typeof IFRAME.ERROR; + payload: { + error: string; + }; +} + +export interface PopupInit { + type: typeof POPUP.INIT; + payload: { + settings: ConnectSettings; // those are settings from window.opener + }; +} + +export interface PopupError { + type: typeof POPUP.ERROR; + payload: { + error: string; + }; +} + +export interface PopupHandshake { + type: typeof POPUP.HANDSHAKE; + payload?: { + settings: ConnectSettings; // those are settings from the iframe, they could be different from window.opener settings + method?: string; + transport?: TransportInfo; + }; +} + +export interface RequestPermission { + type: typeof UI.REQUEST_PERMISSION; + payload: { + permissions: string[]; + device: Device; + }; +} + +export interface RequestConfirmation { + type: typeof UI.REQUEST_CONFIRMATION; + payload: { + view: string; + label?: string; + customConfirmButton?: { + className: string; + label: string; + }; + customCancelButton?: { + className: string; + label: string; + }; + }; +} + +export interface SelectDevice { + type: typeof UI.SELECT_DEVICE; + payload: { + devices: Device[]; + webusb: boolean; + }; +} + +export interface UnexpectedDeviceMode { + type: + | typeof UI.BOOTLOADER + | typeof UI.NOT_IN_BOOTLOADER + | typeof UI.INITIALIZE + | typeof UI.SEEDLESS + | typeof UI.DEVICE_NEEDS_BACKUP; + payload: Device; +} + +export interface FirmwareException { + type: + | typeof UI.FIRMWARE_OLD + | typeof UI.FIRMWARE_OUTDATED + | typeof UI.FIRMWARE_NOT_SUPPORTED + | typeof UI.FIRMWARE_NOT_COMPATIBLE + | typeof UI.FIRMWARE_NOT_INSTALLED; + payload: Device; +} + +export interface SelectAccount { + type: typeof UI.SELECT_ACCOUNT; + payload: { + type: 'start' | 'progress' | 'end'; + coinInfo: CoinInfo; + accountTypes?: Array<'normal' | 'segwit' | 'legacy'>; + accounts?: DiscoveryAccount[]; + preventEmpty?: boolean; + }; +} + +export interface SelectFee { + type: typeof UI.SELECT_FEE; + payload: { + coinInfo: BitcoinNetworkInfo; + feeLevels: SelectFeeLevel[]; + }; +} + +export interface UpdateCustomFee { + type: typeof UI.UPDATE_CUSTOM_FEE; + payload: { + coinInfo: BitcoinNetworkInfo; + feeLevels: SelectFeeLevel[]; + }; +} + +export interface BundleProgress { + type: typeof UI.BUNDLE_PROGRESS; + payload: { + progress: number; + response: R; + error?: string; + }; +} + +export interface FirmwareProgress { + type: typeof UI.FIRMWARE_PROGRESS; + payload: { + device: Device; + progress: number; + }; +} + +/* + * Callback message for CustomMessage method + */ +export interface CustomMessageRequest { + type: typeof UI.CUSTOM_MESSAGE_REQUEST; + payload: { + type: string; + message: object; + }; +} + +export type UiEvent = + | MessageWithoutPayload + | DeviceMessage + | ButtonRequestMessage + | PopupHandshake + | RequestPermission + | RequestConfirmation + | SelectDevice + | UnexpectedDeviceMode + | SelectAccount + | SelectFee + | UpdateCustomFee + | BundleProgress + | FirmwareProgress + | CustomMessageRequest; + +export interface ReceivePermission { + type: typeof UI.RECEIVE_PERMISSION; + payload: { + granted: boolean; + remember: boolean; + }; +} + +export interface ReceiveConfirmation { + type: typeof UI.RECEIVE_CONFIRMATION; + payload: boolean; +} + +export interface ReceiveDevice { + type: typeof UI.RECEIVE_DEVICE; + payload: { + device: Device; + remember: boolean; + }; +} + +export interface ReceivePin { + type: typeof UI.RECEIVE_PIN; + payload: string; +} + +export interface ReceiveWord { + type: typeof UI.RECEIVE_WORD; + payload: string; +} + +export interface ReceivePassphrase { + type: typeof UI.RECEIVE_PASSPHRASE; + payload: { + save: boolean; + value: string; + passphraseOnDevice?: boolean; + }; +} + +export interface ReceivePassphraseAction { + type: typeof UI.INVALID_PASSPHRASE_ACTION; + payload: boolean; +} + +export interface ReceiveAccount { + type: typeof UI.RECEIVE_ACCOUNT; + payload?: number; +} + +export interface ReceiveFee { + type: typeof UI.RECEIVE_FEE; + payload: + | { + type: 'compose-custom'; + value: number; + } + | { + type: 'change-account'; + } + | { + type: 'send'; + value: string; + }; +} + +export type UiResponse = + | ReceivePermission + | ReceiveConfirmation + | ReceiveDevice + | ReceivePin + | ReceiveWord + | ReceivePassphrase + | ReceivePassphraseAction + | ReceiveAccount + | ReceiveFee + | CustomMessageRequest; diff --git a/src/ts/types/index.d.ts b/src/ts/types/index.d.ts new file mode 100644 index 000000000..d042f433d --- /dev/null +++ b/src/ts/types/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for trezor-connect 8.0 +// Project: https://github.com/trezor/connect +// Definitions by: Federico Bond , Szymon Lesisz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.5 + +/// + +import { TrezorConnect } from './api'; +export * from './events'; +export * from './misc'; +export * from './params'; +export * from './constants'; + +export * from './account'; +export * from './trezor/device'; +export * from './trezor/management'; + +export * from './networks/bitcoin'; +export * from './networks/binance'; +export * from './networks/cardano'; +export * from './networks/coinInfo'; +export * from './networks/eos'; +export * from './networks/ethereum'; +export * from './networks/lisk'; +export * from './networks/nem'; +export * from './networks/ripple'; +export * from './networks/stellar'; +export * from './networks/tezos'; + +export * from './backend/blockchain'; +export * from './backend/transactions'; + +export default TrezorConnect; diff --git a/src/ts/types/misc.d.ts b/src/ts/types/misc.d.ts new file mode 100644 index 000000000..7e3ef2d63 --- /dev/null +++ b/src/ts/types/misc.d.ts @@ -0,0 +1,34 @@ +export interface CipherKeyValue { + path: string | number[]; + key?: string; + value?: string; + askOnEncrypt?: boolean; + askOnDecrypt?: boolean; + iv?: string; +} + +export interface CipheredValue { + value: string; +} + +export interface LoginChallenge { + challengeHidden: string; + challengeVisual: string; +} + +export interface RequestLoginAsync { + callback: () => LoginChallenge; +} + +export interface Login { + address: string; + publicKey: string; + signature: string; +} + +export interface CustomMessage { + messages?: JSON | object; + message: string; + params: JSON | object; + callback: (request: any) => Promise<{ message: string; params?: object }>; +} diff --git a/src/ts/types/networks/binance.d.ts b/src/ts/types/networks/binance.d.ts new file mode 100644 index 000000000..8d46d1bcd --- /dev/null +++ b/src/ts/types/networks/binance.d.ts @@ -0,0 +1,61 @@ +import { BinanceTransferMsg, BinanceOrderMsg, BinanceCancelMsg } from '../trezor/protobuf'; + +// get address +export interface BinanceGetAddress { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export interface BinanceAddress { + address: string; + path: number[]; + serializedPath: string; +} + +// get public key +export interface BinanceGetPublicKey { + path: string | number[]; + showOnTrezor?: boolean; +} + +export interface BinancePublicKey { + publicKey: string; + path: number[]; + serializedPath: string; +} + +// sign transaction +// fields taken from https://github.com/binance-chain/javascript-sdk/blob/master/src/tx/index.js + +export interface BinanceSDKTransaction { + chain_id: string; + account_number?: number; // default 0 + memo?: string; + sequence?: number; // default 0 + source?: number; // default 0 + + transfer?: BinanceTransferMsg; + placeOrder?: BinanceOrderMsg; + cancelOrder?: BinanceCancelMsg; +} + +export type BinancePreparedMessage = + | (BinanceTransferMsg & { + type: 'BinanceTransferMsg'; + }) + | (BinanceOrderMsg & { + type: 'BinanceOrderMsg'; + }) + | (BinanceCancelMsg & { + type: 'BinanceCancelMsg'; + }); + +export type BinancePreparedTransaction = BinanceSDKTransaction & { + messages: BinancePreparedMessage[]; +}; + +export interface BinanceSignTransaction { + path: string | number[]; + transaction: BinanceSDKTransaction; +} diff --git a/src/ts/types/networks/bitcoin.d.ts b/src/ts/types/networks/bitcoin.d.ts new file mode 100644 index 000000000..7619de1a6 --- /dev/null +++ b/src/ts/types/networks/bitcoin.d.ts @@ -0,0 +1,71 @@ +import { + TransactionInput, + TransactionOutput, + RefTransaction, + Address as ProtobufAddress, + SignedTx, +} from '../trezor/protobuf'; + +// getAddress params +export interface GetAddress { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; + coin?: string; + crossChain?: boolean; +} + +// getAddress response +export type Address = ProtobufAddress & { + serializedPath: string; +}; + +// getPublicKey params +export interface GetPublicKey { + path: string | number[]; + coin?: string; + crossChain?: boolean; +} + +// signTransaction params +export interface SignTransaction { + inputs: TransactionInput[]; + outputs: TransactionOutput[]; + refTxs?: RefTransaction[]; + coin: string; + locktime?: number; + timestamp?: number; + version?: number; + expiry?: number; + overwintered?: boolean; + versionGroupId?: number; + branchId?: number; + push?: boolean; +} +export type SignedTransaction = SignedTx & { + txid?: string; +}; + +// push transaction params +export interface PushTransaction { + tx: string; + coin: string; +} + +// push transaction response +export interface PushedTransaction { + txid: string; +} + +export interface SignMessage { + path: string | number[]; + coin: string; + message: string; +} + +export interface VerifyMessage { + address: string; + signature: string; + message: string; + coin: string; +} diff --git a/src/ts/types/networks/cardano.d.ts b/src/ts/types/networks/cardano.d.ts new file mode 100644 index 000000000..abc3335ca --- /dev/null +++ b/src/ts/types/networks/cardano.d.ts @@ -0,0 +1,60 @@ +// Cardano method parameters types +import { HDPubNode } from '../trezor/protobuf'; + +// GetAddress + +export interface CardanoGetPublicKey { + path: string | number[]; + showOnTrezor?: boolean; +} + +export interface CardanoPublicKey { + path: number[]; + serializedPath: string; + publicKey: string; + node: HDPubNode; +} + +// GetAddress + +export interface CardanoGetAddress { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export interface CardanoAddress { + path: number[]; + serializedPath: string; + address: string; +} + +// Sign transaction + +export interface CardanoInput { + path: string | number[]; + prev_hash: string; + prev_index: number; + type: number; +} +export type CardanoOutput = + | { + path: string | number[]; + amount: string; + } + | { + address: string; + amount: string; + }; + +export interface CardanoSignTransaction { + inputs: CardanoInput[]; + outputs: CardanoOutput[]; + transactions: string[]; + protocol_magic: number; +} + +export interface CardanoSignedTx { + hash: string; + body: string; +} diff --git a/src/ts/types/networks/coinInfo.d.ts b/src/ts/types/networks/coinInfo.d.ts new file mode 100644 index 000000000..c6e4cffb8 --- /dev/null +++ b/src/ts/types/networks/coinInfo.d.ts @@ -0,0 +1,130 @@ +export interface CoinSupport { + connect: boolean; + // electrum not used, + trezor1: string; + trezor2: string; + // webwallet not used +} + +// copy-paste from 'bitcoinjs-lib-zcash' module +export interface Network { + messagePrefix: string; + bech32?: string; + bip32: { + public: number; + private: number; + }; + pubKeyHash: number; + scriptHash: number; + wif: number; + dustThreshold: number; + coin: string; +} + +export interface BlockchainLink { + type: string; + url: string[]; +} + +export type BitcoinDefaultFeesKeys = 'High' | 'Normal' | 'Economy' | 'Low'; +export type BitcoinDefaultFees = { [key in BitcoinDefaultFeesKeys]: number }; + +export interface BitcoinNetworkInfo { + type: 'bitcoin'; + // address_type: in Network + // address_type_p2sh: in Network + // bech32_prefix: in Network + // consensus_branch_id in Network + // bip115: not used + // bitcore: not used + // blockbook: not used + blockchainLink?: BlockchainLink; + blocktime: number; + cashAddrPrefix?: string; + label: string; // this is human readable format, could be different from "name" + name: string; // this is Trezor readable format + shortcut: string; + // cooldown not used + curveName: string; + // decred not used + defaultFees: BitcoinDefaultFees; + dustLimit: number; + forceBip143: boolean; + forkid?: number; + // github: not used + hashGenesisBlock: string; + // key not used + // maintainer: not used + maxAddressLength: number; + maxFeeSatoshiKb: number; + minAddressLength: number; + minFeeSatoshiKb: number; + // name: same as coin_label + segwit: boolean; + // signed_message_header: in Network + slip44: number; + support: CoinSupport; + // uri_prefix not used + // version_group_id: not used + // website: not used + // xprv_magic: in Network + xPubMagic: number; + xPubMagicSegwitNative?: number; + xPubMagicSegwit?: number; + + // custom + network: Network; + isBitcoin: boolean; + hasTimestamp: boolean; + minFee: number; + maxFee: number; + // used in backend + blocks?: number; + decimals: number; +} + +export interface EthereumNetworkInfo { + type: 'ethereum'; + blockchainLink?: BlockchainLink; + blocktime: number; + chain: string; + chainId: number; + // key not used + defaultFees: Array<{ + label: 'high' | 'normal' | 'low'; + feePerUnit: string; + feeLimit: string; + }>; + minFee: number; + maxFee: number; + label: string; // compatibility + name: string; + shortcut: string; + rskip60: boolean; + slip44: number; + support: CoinSupport; + // url not used + network: typeof undefined; // compatibility + decimals: number; +} + +export interface MiscNetworkInfo { + type: 'misc' | 'nem'; + blockchainLink?: BlockchainLink; + blocktime: number; + curve: string; + // key not used + defaultFees: BitcoinDefaultFees; + minFee: number; + maxFee: number; + // links not used + label: string; // compatibility + name: string; + shortcut: string; + slip44: number; + support: CoinSupport; + network: typeof undefined; // compatibility + decimals: number; +} + +export type CoinInfo = BitcoinNetworkInfo | EthereumNetworkInfo | MiscNetworkInfo; diff --git a/src/ts/types/networks/eos.d.ts b/src/ts/types/networks/eos.d.ts new file mode 100644 index 000000000..69670335c --- /dev/null +++ b/src/ts/types/networks/eos.d.ts @@ -0,0 +1,158 @@ +import { + EosPermissionLevel, + EosAuthorizationKey, + EosActionBuyRamBytes, + EosActionSellRam, + EosActionRefund, + EosActionDeleteAuth, + EosActionLinkAuth, + EosActionUnlinkAuth, +} from '../trezor/protobuf'; + +// get public key + +export interface EosGetPublicKey { + path: string | number[]; + showOnTrezor?: boolean; +} + +export interface EosPublicKey { + wifPublicKey: string; + rawPublicKey: string; + path: number[]; + serializedPath: string; +} + +// sign tx + +export interface EosTxHeader { + expiration: number | string; + refBlockNum: number; + refBlockPrefix: number; + maxNetUsageWords: number; + maxCpuUsageMs: number; + delaySec: number; +} + +export interface EosAuthorization { + threshold: number; + keys: EosAuthorizationKey[]; + accounts: Array<{ + permission: EosPermissionLevel; + weight: number; + }>; + waits: Array<{ + wait_sec: number; + weight: number; + }>; +} + +export interface EosTxActionCommon { + account: string; + authorization: EosPermissionLevel[]; +} + +export type EosTxAction = + | (EosTxActionCommon & { + name: 'transfer'; + data: { + from: string; + to: string; + quantity: string; + memo?: string; + }; + }) + | (EosTxActionCommon & { + name: 'delegatebw'; + data: { + from: string; + receiver: string; + stake_net_quantity: string; + stake_cpu_quantity: string; + transfer?: boolean; + }; + }) + | (EosTxActionCommon & { + name: 'undelegatebw'; + data: { + from: string; + receiver: string; + unstake_net_quantity: string; + unstake_cpu_quantity: string; + }; + }) + | (EosTxActionCommon & { + name: 'buyram'; + data: { + payer: string; + receiver: string; + quant: string; + }; + }) + | (EosTxActionCommon & { + name: 'buyrambytes'; + data: EosActionBuyRamBytes; + }) + | (EosTxActionCommon & { + name: 'sellram'; + data: EosActionSellRam; + }) + | (EosTxActionCommon & { + name: 'voteproducer'; + data: { + voter: string; + proxy: string; + producers: string[]; + }; + }) + | (EosTxActionCommon & { + name: 'refund'; + data: EosActionRefund; + }) + | (EosTxActionCommon & { + name: 'updateauth'; + data: { + account: string; + permission: string; + parent: string; + auth: EosAuthorization; + }; + }) + | (EosTxActionCommon & { + name: 'deleteauth'; + data: EosActionDeleteAuth; + }) + | (EosTxActionCommon & { + name: 'linkauth'; + data: EosActionLinkAuth; + }) + | (EosTxActionCommon & { + name: 'unlinkauth'; + data: EosActionUnlinkAuth; + }) + | (EosTxActionCommon & { + name: 'newaccount'; + data: { + creator: string; + name: string; + owner: EosAuthorization; + active: EosAuthorization; + }; + }); + +// | EosTxActionCommon & { +// name: string; +// data: string; +// }; + +export interface EosSDKTransaction { + chainId: string; + header?: EosTxHeader; + actions: Array; + // actions: EosTxAction[]; +} + +export interface EosSignTransaction { + path: string | number[]; + transaction: EosSDKTransaction; +} diff --git a/src/ts/types/networks/ethereum.d.ts b/src/ts/types/networks/ethereum.d.ts new file mode 100644 index 000000000..d2fd05b70 --- /dev/null +++ b/src/ts/types/networks/ethereum.d.ts @@ -0,0 +1,58 @@ +// Ethereum types +// https://github.com/ethereumjs/ethereumjs-tx + +// get address + +export interface EthereumGetAddress { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export interface EthereumAddress { + address: string; + path: number[]; + serializedPath: string; +} + +// get public key + +export interface EthereumGetPublicKey { + path: string | number[]; + showOnTrezor?: boolean; +} + +// sign transaction + +export interface EthereumTransaction { + to: string; + value: string; + gasPrice: string; + gasLimit: string; + nonce: string; + data?: string; + chainId?: number; + txType?: number; +} + +export interface EthereumSignTransaction { + path: string | number[]; + transaction: EthereumTransaction; +} + +// sign message + +export interface EthereumSignMessage { + path: string | number[]; + message: string; + hex?: boolean; +} + +// verify message + +export interface EthereumVerifyMessage { + address: string; + message: string; + hex?: boolean; + signature: string; +} diff --git a/src/ts/types/networks/lisk.d.ts b/src/ts/types/networks/lisk.d.ts new file mode 100644 index 000000000..24eb97d67 --- /dev/null +++ b/src/ts/types/networks/lisk.d.ts @@ -0,0 +1,100 @@ +// Lisk types +// https://lisk.io/documentation/lisk-elements/user-guide/transactions + +export interface VoteAsset { + votes: string[]; +} + +export interface SignatureAsset { + signature: { + publicKey: string; + }; +} + +export interface DelegateAsset { + delegate: { + username: string; + }; +} + +export interface MultisignatureAsset { + multisignature: { + min: number; + lifetime: number; + keysgroup: string[]; + }; +} + +export interface DataAsset { + data: string; +} + +export type LiskAsset = SignatureAsset | MultisignatureAsset | DelegateAsset | VoteAsset | DataAsset; + +export interface LiskTransaction { + type: number; + fee: string; + amount: string; + timestamp: number; + recipientId?: string; + senderPublicKey?: string; + requesterPublicKey?: string; + signature?: string; + asset?: LiskAsset; +} + +// methods parameters + +// get address + +export interface LiskGetAddress { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export interface LiskAddress { + path: number[]; + serializedPath: string; + address: string; +} + +// get public key + +export interface LiskGetPublicKey { + path: string | number[]; + showOnTrezor?: boolean; +} + +export interface LiskPublicKey { + path: number[]; + serializedPath: string; + publicKey: string; +} + +// sign transaction + +export interface LiskSignTransaction { + path: string | number[]; + transaction: LiskTransaction; +} + +// sign message + +export interface LiskSignMessage { + path: string | number[]; + message: string; +} + +export interface LiskMessageSignature { + publicKey: string; + signature: string; +} + +// verify message + +export interface LiskVerifyMessage { + publicKey: string; + message: string; + signature: string; +} diff --git a/src/ts/types/networks/nem.d.ts b/src/ts/types/networks/nem.d.ts new file mode 100644 index 000000000..5d29a6831 --- /dev/null +++ b/src/ts/types/networks/nem.d.ts @@ -0,0 +1,129 @@ +// NEM types from nem-sdk +// https://nemproject.github.io/#transferTransaction + +export interface MosaicID { + namespaceId: string; + name: string; +} + +export interface MosaicDefinition { + levy?: { + type?: number; + fee?: number; + recipient?: string; + mosaicId?: MosaicID; + }; + id: MosaicID; + description: string; + properties?: Array<{ + name: 'divisibility' | 'initialSupply' | 'supplyMutable' | 'transferable'; + value: string; + }>; +} + +export interface NEMMosaic { + mosaicId: MosaicID; + quantity: number; +} + +export interface Modification { + modificationType: number; + cosignatoryAccount: string; +} + +export interface Message { + payload?: string; + type?: number; + publicKey?: string; // not present in sdk +} + +export interface TransactionCommon { + version: number; + timeStamp: number; + fee: number; + deadline?: number; + signer?: string; +} + +export type NEMTransferTransaction = TransactionCommon & { + type: 0x0101; + recipient: string; + amount: number | string; + mosaics?: NEMMosaic[]; + message?: Message; +}; + +export type NEMImportanceTransaction = TransactionCommon & { + type: 0x0801; + importanceTransfer: { + mode: number; + publicKey: string; + }; +}; + +export type NEMAggregateModificationTransaction = TransactionCommon & { + type: 0x1001; + modifications?: Modification[]; + minCosignatories: { + relativeChange: number; + }; +}; + +export type NEMProvisionNamespaceTransaction = TransactionCommon & { + type: 0x2001; + newPart?: string; + parent?: string; + rentalFeeSink?: string; + rentalFee?: number; +}; + +export type NEMMosaicCreationTransaction = TransactionCommon & { + type: 0x4001; + mosaicDefinition: MosaicDefinition; + creationFeeSink?: string; + creationFee?: number; +}; + +export type NEMSupplyChangeTransaction = TransactionCommon & { + type: 0x4002; + mosaicId: MosaicID; + supplyType: number; + delta?: number; +}; + +export type NEMRegularTransaction = + | NEMTransferTransaction + | NEMImportanceTransaction + | NEMAggregateModificationTransaction + | NEMProvisionNamespaceTransaction + | NEMMosaicCreationTransaction + | NEMSupplyChangeTransaction; + +export type NEMMultisigTransaction = TransactionCommon & { + type: 0x0102 | 0x1002 | 0x1004; + otherTrans: NEMRegularTransaction; +}; + +export type NEMTransaction = NEMRegularTransaction | NEMMultisigTransaction; + +// get address + +export interface NEMGetAddress { + path: string | number[]; + address?: string; + network: number; + showOnTrezor?: boolean; +} + +export interface NEMAddress { + address: string; + path: number[]; + serializedPath: string; +} + +// sign transaction + +export interface NEMSignTransaction { + path: string | number[]; + transaction: NEMTransaction; +} diff --git a/src/ts/types/networks/ripple.d.ts b/src/ts/types/networks/ripple.d.ts new file mode 100644 index 000000000..af02d0a75 --- /dev/null +++ b/src/ts/types/networks/ripple.d.ts @@ -0,0 +1,39 @@ +// get address + +export interface RippleGetAddress { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export interface RippleAddress { + address: string; + path: number[]; + serializedPath: string; +} + +// sign transaction + +export interface RipplePayment { + amount: string; + destination: string; + destinationTag?: number; +} + +export interface RippleTransaction { + fee?: string; + flags?: number; + sequence?: number; + maxLedgerVersion?: number; // Proto: "last_ledger_sequence" + payment: RipplePayment; +} + +export interface RippleSignTransaction { + path: string | number[]; + transaction: RippleTransaction; +} + +export interface RippleSignedTx { + serializedTx: string; + signature: string; +} diff --git a/src/ts/types/networks/stellar.d.ts b/src/ts/types/networks/stellar.d.ts new file mode 100644 index 000000000..ca6c370bb --- /dev/null +++ b/src/ts/types/networks/stellar.d.ts @@ -0,0 +1,169 @@ +// Stellar types from stellar-sdk +// https://github.com/stellar/js-stellar-base + +export interface StellarAsset { + type: 0 | 1 | 2; // 0: native, 1: credit_alphanum4, 2: credit_alphanum12 + code: string; + issuer?: string; +} + +export interface StellarCreateAccountOperation { + type: 'createAccount'; // Proto: "StellarCreateAccountOp" + source?: string; // Proto: "source_account" + destination: string; // Proto: "new_account", + startingBalance: string; // Proto: "starting_balance" +} + +export interface StellarPaymentOperation { + type: 'payment'; // Proto: "StellarPaymentOp" + source?: string; // Proto: "source_account" + destination: string; // Proto: "destination_account" + asset?: StellarAsset | typeof undefined; // Proto: ok + amount: string; // Proto: ok +} + +export interface StellarPathPaymentOperation { + type: 'pathPayment'; // Proto: "StellarPathPaymentOp" + source?: string; // Proto: "source_account" + sendAsset: StellarAsset; // Proto: "send_asset" + sendMax: string; // Proto: "send_max" + destination: string; // Proto: "destination_account" + destAsset: StellarAsset; // Proto: "destination_asset" + destAmount: string; // Proto "destination_amount" + path?: StellarAsset[]; // Proto: "paths" +} + +export interface StellarPassiveOfferOperation { + type: 'createPassiveOffer'; // Proto: "StellarCreatePassiveOfferOp" + source?: string; // Proto: "source_account" + buying: StellarAsset; // Proto: "buying_asset" + selling: StellarAsset; // Proto: "selling_asset" + amount: string; // Proto: ok + price: { n: number; d: number }; // Proto: "price_n" and "price_d" +} + +export interface StellarManageOfferOperation { + type: 'manageOffer'; // Proto: "StellarManageOfferOp" + source?: string; // Proto: "source_account" + buying: StellarAsset; // Proto: "buying_asset" + selling: StellarAsset; // Proto: "selling_asset" + amount: string; // Proto: ok + offerId?: string; // Proto: "offer_id" // not found in stellar-sdk + price: { n: number; d: number }; // Proto: "price_n" and "price_d" +} + +export interface StellarSetOptionsOperation { + type: 'setOptions'; // Proto: "StellarSetOptionsOp" + source?: string; // Proto: "source_account" + signer?: { + type: 0 | 1 | 2; + key: string | Buffer; + weight?: number; + }; + inflationDest?: string; // Proto: "inflation_destination_account" + clearFlags?: number; // Proto: "clear_flags" + setFlags?: number; // Proto: "set_flags" + masterWeight?: number | string; // Proto: "master_weight" + lowThreshold?: number | string; // Proto: "low_threshold" + medThreshold?: number | string; // Proto: "medium_threshold" + highThreshold?: number | string; // Proto: "high_threshold" + homeDomain?: string; // Proto: "home_domain" +} + +export interface StellarChangeTrustOperation { + type: 'changeTrust'; // Proto: "StellarChangeTrustOp" + source?: string; // Proto: "source_account" + line: StellarAsset; // Proto: ok + limit?: string; // Proto: ok +} + +export interface StellarAllowTrustOperation { + type: 'allowTrust'; // Proto: "StellarAllowTrustOp" + source?: string; // Proto: "source_account" + trustor: string; // Proto: "trusted_account" + assetCode: string; // Proto: "asset_code" + assetType: number; // Proto: "asset_type" // TODO not found in stellar-sdk + authorize?: boolean | typeof undefined; // Proto: "is_authorized" > parse to number +} + +export interface StellarAccountMergeOperation { + type: 'accountMerge'; // Proto: "StellarAccountMergeOp" + source?: string; // Proto: "source_account" + destination: string; // Proto: "destination_account" +} + +export interface StellarManageDataOperation { + type: 'manageData'; // Proto: "StellarManageDataOp" + source?: string; // Proto: "source_account" + name: string; // Proto: "key" + value?: string | Buffer; // Proto: "value" +} + +// (?) Missing in stellar API but present in Proto messages +export interface StellarBumpSequenceOperation { + type: 'bumpSequence'; // Proto: "StellarBumpSequenceOp" + source?: string; // Proto: "source_account" + bumpTo: string; // Proto: "bump_to" +} + +// (?) Missing in Proto messages, but present in Stellar API +export interface StellarInflationOperation { + type: 'inflation'; + source?: string; // Proto: "source_account" +} + +export type StellarOperation = + | StellarCreateAccountOperation + | StellarPaymentOperation + | StellarPathPaymentOperation + | StellarPassiveOfferOperation + | StellarManageOfferOperation + | StellarSetOptionsOperation + | StellarChangeTrustOperation + | StellarAllowTrustOperation + | StellarAccountMergeOperation + | StellarInflationOperation + | StellarManageDataOperation + | StellarBumpSequenceOperation; + +export interface StellarTransaction { + source: string; // Proto: "source_account" + fee: number; // Proto: ok + sequence: string | number; // Proto: "sequence_number" + timebounds?: { + minTime: number; // Proto: "timebounds_start" + maxTime: number; // Proto: "timebounds_end" + }; + memo?: { + type: 0 | 1 | 2 | 3 | 4; // Proto: "memo_type" + id?: string; // Proto: "memo_id" + text?: string; // Proto: "memo_text" + hash?: string | Buffer; // Proto: "memo_hash" + }; + operations: StellarOperation[]; // Proto: calculated array length > "num_operations" +} + +export interface StellarSignTransaction { + path: string | number[]; + networkPassphrase: string; + transaction: StellarTransaction; +} + +export interface StellarSignedTx { + publicKey: string; + signature: string; +} + +// get address + +export interface StellarGetAddress { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export interface StellarAddress { + address: string; + path: number[]; + serializedPath: string; +} diff --git a/src/ts/types/networks/tezos.d.ts b/src/ts/types/networks/tezos.d.ts new file mode 100644 index 000000000..8b2c79033 --- /dev/null +++ b/src/ts/types/networks/tezos.d.ts @@ -0,0 +1,93 @@ +// get address + +export interface TezosGetAddress { + path: string | number[]; + address?: string; + showOnTrezor?: boolean; +} + +export interface TezosAddress { + address: string; + path: number[]; + serializedPath: string; +} + +// get public key + +export interface TezosGetPublicKey { + path: string | number[]; + showOnTrezor?: boolean; +} + +export interface TezosPublicKey { + publicKey: string; + path: number[]; + serializedPath: string; +} + +// sign transaction + +export interface TezosRevealOperation { + source: string; + fee: number; + counter: number; + gas_limit: number; + storage_limit: number; + public_key: string; +} + +export interface TezosManagerTransfer { + destination: string; + amount: number; +} + +export interface TezosParametersManager { + set_delegate?: string; + cancel_delegate?: boolean; + transfer?: TezosManagerTransfer; +} + +export interface TezosTransactionOperation { + source: string; + destination: string; + amount: number; + counter: number; + fee: number; + gas_limit: number; + storage_limit: number; + parameters?: number[]; + parameters_manager?: TezosParametersManager; +} + +export interface TezosOriginationOperation { + source: string; + balance: number; + delegate?: string; + script: string | number[]; + fee: number; + counter: number; + gas_limit: number; + storage_limit: number; +} + +export interface TezosDelegationOperation { + source: string; + delegate: string; + fee: number; + counter: number; + gas_limit: number; + storage_limit: number; +} + +export interface TezosOperation { + reveal?: TezosRevealOperation; + transaction?: TezosTransactionOperation; + origination?: TezosOriginationOperation; + delegation?: TezosDelegationOperation; +} + +export interface TezosSignTransaction { + path: string | number[]; + branch: string; + operation: TezosOperation; +} diff --git a/src/ts/types/params.d.ts b/src/ts/types/params.d.ts new file mode 100644 index 000000000..7a18c6981 --- /dev/null +++ b/src/ts/types/params.d.ts @@ -0,0 +1,64 @@ +export interface Unsuccessful { + success: false; + payload: { error: string; code?: string | number }; +} + +export interface Success { + success: true; + id: number; + payload: T; +} + +export type Response = Promise | Unsuccessful>; +export type BundledResponse = Promise | Unsuccessful>; + +export interface DefaultMessage { + message: string; +} + +export interface Manifest { + appUrl: string; + email: string; +} + +export interface ConnectSettings { + manifest?: Manifest; + connectSrc?: string; + debug?: boolean; + hostLabel?: string; + hostIcon?: string; + popup?: boolean; + transportReconnect?: boolean; + webusb?: boolean; + pendingTransportEvent?: boolean; + lazyLoad?: boolean; + // internal part, not to be accepted from .init() + origin?: string; + configSrc: string; + iframeSrc: string; + popupSrc: string; + webusbSrc: string; + version: string; + priority: number; + trustedHost: boolean; + supportedBrowser?: boolean; + extension?: string; + env: 'node' | 'web' | 'webextension' | 'electron' | 'react-native'; + timestamp: number; +} + +export interface CommonParams { + device?: { + path: string; + state?: string; + instance?: number; + }; + useEmptyPassphrase?: boolean; + allowSeedlessDevice?: boolean; + keepSession?: boolean; + skipFinalReload?: boolean; +} + +export interface Bundle { + bundle: T[]; +} diff --git a/src/ts/types/trezor/device.d.ts b/src/ts/types/trezor/device.d.ts new file mode 100644 index 000000000..2de71c886 --- /dev/null +++ b/src/ts/types/trezor/device.d.ts @@ -0,0 +1,101 @@ +import { DEVICE } from '../constants'; + +export interface DeviceStateResponse { + state: string; +} + +export type DeviceStatus = 'available' | 'occupied' | 'used'; + +export type DeviceMode = 'normal' | 'bootloader' | 'initialize' | 'seedless'; + +export type DeviceFirmwareStatus = 'valid' | 'outdated' | 'required' | 'unknown' | 'none'; + +export type UnavailableCapability = + | 'no-capability' + | 'no-support' + | 'update-required' + | 'trezor-connect-outdated' + | string[]; + +export interface FirmwareRange { + '1': { + min: string; + max: string; + }; + '2': { + min: string; + max: string; + }; +} + +export interface FirmwareRelease { + required: true; + version: number[]; + min_bridge_version: number[]; + min_firmware_version: number[]; + bootloader_version: number[]; + min_bootloader_version: number[]; + url: string; + channel: string; + fingerprint: string; + changelog: string; +} + +export interface Features { + bootloader_hash?: string | null; + bootloader_mode?: boolean | null; + device_id: string | null; + firmware_present?: boolean | null; + flags: number; + fw_major?: number | null; + fw_minor?: number | null; + fw_patch?: number | null; + fw_vendor?: string | null; + fw_vendor_keys?: string | null; + imported?: boolean | null; + initialized: boolean; + label: string | null; + language?: string | null; + major_version: number; + minor_version: number; + model: string; + needs_backup: boolean; + no_backup: boolean; + passphrase_cached: boolean; + passphrase_protection: boolean; + patch_version: number; + pin_cached: boolean; + pin_protection: boolean; + revision: string; + unfinished_backup: boolean; + vendor: string; + recovery_mode?: boolean; + session_id?: string; + passphrase_always_on_device?: boolean; + capabilities?: string[]; +} + +export type Device = + | { + type: 'acquired'; + path: string; + label: string; + firmware: DeviceFirmwareStatus; + firmwareRelease?: FirmwareRelease; + status: DeviceStatus; + mode: DeviceMode; + state?: string; + features: Features; + unavailableCapabilities: { [key: string]: UnavailableCapability }; + } + | { + type: 'unacquired' | 'unreadable'; + path: string; + label: string; + features?: typeof undefined; + }; + +export interface DeviceEvent { + type: typeof DEVICE.CONNECT | typeof DEVICE.CONNECT_UNACQUIRED | typeof DEVICE.CHANGED | typeof DEVICE.DISCONNECT; + payload: Device; +} diff --git a/src/ts/types/trezor/management.d.ts b/src/ts/types/trezor/management.d.ts new file mode 100644 index 000000000..9f3ecc5cb --- /dev/null +++ b/src/ts/types/trezor/management.d.ts @@ -0,0 +1,44 @@ +export interface ResetDevice { + strength?: number; + label?: string; + u2f_counter?: number; + pin_protection?: boolean; + passphrase_protection?: boolean; + skip_backup?: boolean; + no_backup?: boolean; + backup_type?: 0 | 1; +} + +export interface ApplySettings { + homescreen?: string; + display_rotation?: 0 | 90 | 180 | 270; + use_passphrase?: boolean; + label?: string; +} + +export interface ApplyFlags { + flags: number; +} + +export interface ChangePin { + remove?: boolean; +} + +export interface FirmwareUpdate { + payload: ArrayBuffer; +} + +export interface FirmwareRequest { + length: number; + offset: number; +} + +export interface RecoveryDevice { + passphrase_protection?: boolean; + pin_protection?: boolean; + label?: string; + type?: 0 | 1; + dry_run?: boolean; + word_count?: 12 | 18 | 24; + // there are more of them but dont have a valid usecase now +} diff --git a/src/ts/types/trezor/protobuf.d.ts b/src/ts/types/trezor/protobuf.d.ts new file mode 100644 index 000000000..b6b0eb871 --- /dev/null +++ b/src/ts/types/trezor/protobuf.d.ts @@ -0,0 +1,1026 @@ +// This file has all various types that go into Trezor or out of it. + +export interface CipheredKeyValue { + value: string; +} + +export interface Success { + __avoid_empty?: null; +} + +export interface Features { + vendor: string; + major_version: number; + minor_version: number; + patch_version: number; + bootloader_mode: boolean; + device_id: string; + pin_protection: boolean; + passphrase_protection: boolean; + language: string; + label: string; + initialized: boolean; + revision: string; + bootloader_hash: string; + imported: boolean; + pin_cached: boolean; + passphrase_cached: boolean; + firmware_present: boolean; + needs_backup: boolean; + flags: number; + model: string; + fw_major: number; + fw_minor: number; + fw_patch: number; + fw_vendor: string; + fw_vendor_keys: string; + unfinished_backup: boolean; + no_backup: boolean; +} + +export interface HDPrivNode { + depth: number; + fingerprint: number; + child_num: number; + chain_code: string; + private_key: string; +} + +export interface HDPubNode { + depth: number; + fingerprint: number; + child_num: number; + chain_code: string; + public_key: string; +} + +export type HDNode = HDPubNode | HDPrivNode; + +export interface PublicKey { + node: HDPubNode; + xpub: string; +} + +// combined Bitcoin.PublicKey and Bitcoin.HDNode +export interface HDNodeResponse { + path: number[]; + serializedPath: string; + childNum: number; + xpub: string; + xpubSegwit?: string; + chainCode: string; + publicKey: string; + fingerprint: number; + depth: number; +} + +// Bitcoin.getAddress response +export interface Address { + address: string; + path: number[]; +} + +export interface MessageSignature { + address: string; + signature: string; +} + +// Bitcoin.signTransaction + +export interface MultisigRedeemScriptType { + pubkeys: Array<{ node: string | HDPubNode; address_n: number[] }>; + signatures: string[]; + m?: number; +} + +export type InputScriptType = 'SPENDADDRESS' | 'SPENDMULTISIG' | 'SPENDWITNESS' | 'SPENDP2SHWITNESS'; + +// transaction input, parameter of SignTx message, declared by user +export interface TransactionInput { + address_n: number[]; + prev_hash: string; + prev_index: number; + script_type?: InputScriptType; + sequence?: number; + amount?: string; // (segwit, bip143: true, zcash overwinter) + multisig?: MultisigRedeemScriptType; +} + +export type OutputScriptType = 'PAYTOADDRESS' | 'PAYTOMULTISIG' | 'PAYTOWITNESS' | 'PAYTOP2SHWITNESS'; + +// transaction output, parameter of SignTx message, declared by user +export type TransactionOutput = + | { + address: string; + script_type: 'PAYTOADDRESS'; + amount: string; + multisig?: MultisigRedeemScriptType; + } + | { + address_n: number[]; + script_type: OutputScriptType; + amount: string; + multisig?: MultisigRedeemScriptType; + } + | { + amount: '0'; + op_return_data: string; + script_type: 'PAYTOOPRETURN'; + }; + +export interface TransactionBinOutput { + amount: string; + script_pubkey: string; +} + +// transaction input, parameter of TxAck message, declared by user or downloaded from backend +export interface RefTransactionInput { + prev_hash: string; + prev_index: number; + script_sig: string; + sequence: number; +} + +export interface RefTransaction { + hash: string; + version?: number; + inputs: RefTransactionInput[]; + bin_outputs: TransactionBinOutput[]; + lock_time?: number; + extra_data?: string; + timestamp?: number; + version_group_id?: number; +} + +export interface TransactionOptions { + lock_time?: number; + timestamp?: number; + version?: number; + expiry?: number; + overwintered?: boolean; + version_group_id?: number; + branch_id?: number; +} + +export interface TxRequestDetails { + request_index: number; + tx_hash?: string; + extra_data_len?: number; + extra_data_offset?: number; +} + +export interface TxRequestSerialized { + signature_index?: number; + signature?: string; + serialized_tx?: string; +} + +export interface TxRequest { + request_type: 'TXINPUT' | 'TXOUTPUT' | 'TXMETA' | 'TXFINISHED' | 'TXEXTRADATA'; + details: TxRequestDetails; + serialized: TxRequestSerialized; +} + +export interface SignedTx { + signatures: string[]; + serializedTx: string; +} + +// Ethereum.signTransaction + +export interface EthereumTxRequest { + data_length?: number; + signature_v?: number; + signature_r?: string; + signature_s?: string; +} + +export interface EthereumAddress { + address: string; +} + +export interface EthereumSignedTx { + // v: number, + v: string; + r: string; + s: string; +} + +export interface Identity { + proto?: string; + user?: string; + host?: string; + port?: string; + path?: string; + index?: number; +} + +export interface SignedIdentity { + address: string; + public_key: string; + signature: string; +} + +// this is what Trezor asks for +export type SignTxInfoToTrezor = + | { + inputs: Array; + } + | { + bin_outputs: TransactionBinOutput[]; + } + | { + outputs: TransactionOutput[]; + } + | { + extra_data: string; + } + | { + version: number; + lock_time: number; + inputs_cnt: number; + outputs_cnt: number; + extra_data_len?: number; + timestamp: number; + version_group_id: number; + }; + +// NEM types +export interface NEMAddress { + address: string; +} + +export interface NEMSignedTx { + data: string; + signature: string; +} + +export interface NEMTransactionCommon { + address_n: number[]; + network: number; + timestamp: number; + fee: number; + deadline: number; + signer: string; +} + +export interface NEMMosaic { + namespace: string; + mosaic: string; + quantity: number; +} + +export interface NEMTransfer { + mosaics: NEMMosaic[]; + public_key: string; + recipient: string; + amount: number | string; + payload: string; +} + +export interface NEMProvisionNamespace { + namespace: string; + sink: string; + fee: number; + parent: string; +} + +export type NEMMosaicLevyType = + | { + id: 1; + name: 'MosaicLevy_Absolute'; + } + | { + id: 2; + name: 'MosaicLevy_Percentile'; + }; + +export type NEMSupplyChangeType = + | { + id: 1; + name: 'SupplyChange_Increase'; + } + | { + id: 2; + name: 'SupplyChange_Decrease'; + }; + +export type NEMModificationType = + | { + id: 1; + name: 'CosignatoryModification_Add'; + } + | { + id: 2; + name: 'CosignatoryModification_Delete'; + }; + +export type NEMImportanceTransferMode = + | { + id: 1; + name: 'ImportanceTransfer_Activate'; + } + | { + id: 2; + name: 'ImportanceTransfer_Deactivate'; + }; + +export interface NEMMosaicDefinition { + name?: string; + ticker?: string; + namespace?: string; + mosaic?: string; + divisibility?: number; + fee?: number; + levy?: NEMMosaicLevyType; + levy_address?: string; + levy_namespace?: string; + levy_mosaic?: string; + supply?: number; + mutable_supply?: boolean; + transferable?: boolean; + description?: string; + networks?: number; +} + +export interface NEMMosaicCreation { + definition: NEMMosaicDefinition; + sink: string; + fee: number; +} + +export interface NEMMosaicSupplyChange { + namespace?: string; + type?: NEMSupplyChangeType; + mosaic?: string; + delta?: number; +} + +export interface NEMCosignatoryModification { + type?: NEMModificationType; + public_key?: string; +} + +export interface NEMAggregateModification { + modifications: NEMCosignatoryModification[]; + relative_change: number; // TODO: "sint32" +} + +export interface NEMImportanceTransfer { + mode?: NEMImportanceTransferMode; + public_key?: string; +} + +export interface NEMSignTxMessage { + transaction?: NEMTransactionCommon; + cosigning?: boolean; + multisig?: NEMTransactionCommon; + transfer?: NEMTransfer; + provision_namespace?: NEMProvisionNamespace; + mosaic_creation?: NEMMosaicCreation; + supply_change?: NEMMosaicSupplyChange; + aggregate_modification?: NEMAggregateModification; + importance_transfer?: NEMImportanceTransfer; +} + +// Stellar types + +export interface StellarAddress { + address: string; +} + +export interface StellarSignedTx { + public_key: string; + signature: string; +} + +export interface StellarPaymentOp { + type: 'StellarTxOpRequest'; + message: {}; +} + +export interface StellarSignTxMessage { + address_n: number[]; + source_account: string; + fee: number; + sequence_number: string | number; + network_passphrase: string; + timebounds_start?: number; + timebounds_end?: number; + memo_type?: number; + memo_text?: string | typeof undefined; + memo_id?: string | typeof undefined; + memo_hash?: string | Buffer | typeof undefined; + num_operations: number; +} + +export interface StellarAsset { + type: 0 | 1 | 2; + code: string; + issuer?: string; +} + +export type StellarOperationMessage = + | { + type: 'StellarCreateAccountOp'; + source_account?: string; + new_account: string; + starting_balance: string; + } + | { + type: 'StellarPaymentOp'; + source_account?: string; + destination_account: string; + asset: StellarAsset | typeof undefined; + amount: string; + } + | { + type: 'StellarPathPaymentOp'; + source_account?: string; + send_asset: StellarAsset; + send_max: string; + destination_account: string; + destination_asset: StellarAsset; + destination_amount: string; + paths?: StellarAsset[] | typeof undefined; + } + | { + type: 'StellarManageOfferOp'; + source_account?: string; + offer_id?: string; + amount: string; + buying_asset: StellarAsset; + selling_asset: StellarAsset; + price_n: number; + price_d: number; + } + | { + type: 'StellarCreatePassiveOfferOp'; + source_account?: string; + offer_id?: string; + amount: string; + buying_asset: StellarAsset; + selling_asset: StellarAsset; + price_n: number; + price_d: number; + } + | { + type: 'StellarSetOptionsOp'; + source_account?: string; + signer_type?: number | typeof undefined; + signer_key?: string | Buffer | typeof undefined; + signer_weight?: number | typeof undefined; + clear_flags: number; + set_flags: number; + master_weight: number | string; + low_threshold: number | string; + medium_threshold: number | string; + high_threshold: number | string; + home_domain: string; + inflation_destination_account: string; + } + | { + type: 'StellarChangeTrustOp'; + source_account?: string; + asset: StellarAsset; + limit?: string; + } + | { + type: 'StellarAllowTrustOp'; + source_account?: string; + trusted_account: string; + asset_type: number; + asset_code: string; + is_authorized: number; + } + | { + type: 'StellarAccountMergeOp'; + source_account?: string; + destination_account: string; + } + | { + type: 'StellarManageDataOp'; + source_account?: string; + key: string; + value: string | Buffer; + } + | { + type: 'StellarBumpSequenceOp'; + source_account?: string; + bump_to: string | number; + }; + +// Tezos types +export interface TezosAddress { + address: string; +} + +export interface TezosPublicKey { + public_key: string; +} + +export interface TezosContractID { + tag: number; + hash: Uint8Array; +} + +export interface TezosRevealOp { + source: Uint8Array; + fee: number; + counter: number; + gas_limit: number; + storage_limit: number; + public_key: Uint8Array; +} + +export interface TezosManagerTransfer { + amount: number; + destination: TezosContractID; +} + +export interface TezosParametersManager { + set_delegate?: Uint8Array; + cancel_delegate?: boolean; + transfer?: TezosManagerTransfer; +} + +export interface TezosTransactionOp { + source: Uint8Array; + destination: TezosContractID; + amount: number; + counter: number; + fee: number; + gas_limit: number; + storage_limit: number; + parameters?: number[]; + parameters_manager?: TezosParametersManager; +} + +export interface TezosOriginationOp { + source: Uint8Array; + balance: number; + delegate?: Uint8Array; + fee: number; + counter: number; + gas_limit: number; + storage_limit: number; + script: string | number[]; +} + +export interface TezosDelegationOp { + source: Uint8Array; + delegate: Uint8Array; + fee: number; + counter: number; + gas_limit: number; + storage_limit: number; +} + +export interface TezosTransaction { + address_n: number[]; + branch: Uint8Array; + reveal?: TezosRevealOp; + transaction?: TezosTransactionOp; + origination?: TezosOriginationOp; + delegation?: TezosDelegationOp; +} + +export interface TezosSignedTx { + signature: string; + sig_op_contents: string; + operation_hash: string; +} + +// Cardano types +export interface CardanoAddress { + address: string; + address_n?: number[]; +} + +export interface CardanoPublicKey { + xpub: string; + node: HDPubNode; +} + +export interface CardanoSignedTx { + tx_hash: string; + tx_body: string; +} +export interface CardanoTxInput { + tx_hash: string; + address_n: number[]; + output_index: number; + type?: number; +} +export interface CardanoTxOutput { + address?: string; + address_n?: number[]; + amount: string; +} + +export interface CardanoTxRequest { + tx_index: number; + tx_hash: string; + tx_body: string; +} + +// Lisk types +export interface LiskAddress { + address: string; +} + +export interface LiskPublicKey { + public_key: string; +} + +export interface LiskMessageSignature { + public_key: string; + signature: string; +} + +export type LiskAsset = + | { data: string } + | { votes: string[] } + | { delegate: { username: string } } + | { signature: { public_key: string } } + | { + multisignature: { + min: number; + life_time: number; + keys_group: string[]; + }; + }; + +export interface LiskTransaction { + type: number; + fee: string; + amount: string; + timestamp: number; + recipient_id?: string; + sender_public_key?: string; + requester_public_key?: string; + signature?: string; + asset?: LiskAsset | {}; +} + +export interface LiskSignedTx { + signature: string; +} + +// Ripple types +export interface RippleAddress { + address: string; +} + +export interface RippleTransaction { + address_n: number[]; + fee?: number; + flags?: number; + sequence?: number; + last_ledger_sequence?: number; + payment: { + amount: string; + destination: string; + }; +} + +export interface RippleSignedTx { + signature: string; + serialized_tx: string; +} + +// EOS types +export interface EosPublicKey { + wif_public_key: string; + raw_public_key: string; +} + +export interface EosTxActionRequest { + data_size: number; +} + +export interface EosTxHeader { + expiration: number; + ref_block_num: number; + ref_block_prefix: number; + max_net_usage_words: number; + max_cpu_usage_ms: number; + delay_sec: number; +} + +export interface EosSignTx { + address_n: number[]; + chain_id: string; + header: EosTxHeader; + num_actions: number; +} + +export interface EosAsset { + amount: string; // uint64 as string + symbol: string; // uint64 as string +} + +export interface EosPermissionLevel { + actor: string; // uint64 as string + permission: string; // uint64 as string +} + +export interface EosAuthorizationKey { + type?: number; + key: string; + address_n?: number[]; // this field is not implemented in FW? + weight: number; +} + +export interface EosAuthorization { + threshold: number; + keys: EosAuthorizationKey[]; + accounts: Array<{ + account: EosPermissionLevel; + weight: number; + }>; + waits: Array<{ + wait_sec: number; + weight: number; + }>; +} + +export interface EosActionCommon { + account: string; // uint64 as string + name: string; // uint64 as string + authorization: EosPermissionLevel[]; +} + +export interface EosActionTransfer { + sender: string; // uint64 as string + receiver: string; // uint64 as string + quantity: EosAsset; + memo?: string; +} + +export interface EosActionDelegate { + sender: string; // uint64 as string + receiver: string; // uint64 as string + net_quantity: EosAsset; + cpu_quantity: EosAsset; + transfer?: boolean; +} + +export interface EosActionUndelegate { + sender: string; // uint64 as string + receiver: string; // uint64 as string + net_quantity: EosAsset; + cpu_quantity: EosAsset; +} + +export interface EosActionBuyRam { + payer: string; // uint64 as string + receiver: string; // uint64 as string + quantity: EosAsset; +} + +export interface EosActionBuyRamBytes { + payer: string; // uint64 as string + receiver: string; // uint64 as string + bytes: number; +} + +export interface EosActionSellRam { + account: string; // uint64 as string + bytes: number; +} + +export interface EosActionVoteProducer { + voter: string; // uint64 as string + proxy: string; // uint64 as string + producers: string[]; // uint64[] as string +} + +export interface EosActionRefund { + owner: string; // uint64 as string +} + +export interface EosActionUpdateAuth { + account: string; // uint64 as string + permission: string; // uint64 as string + parent: string; // uint64 as string + auth: EosAuthorization; +} + +export interface EosActionDeleteAuth { + account: string; // uint64 as string + permission: string; // uint64 as string +} + +export interface EosActionLinkAuth { + account: string; // uint64 as string + code: string; // uint64 as string + type: string; // uint64 as string + requirement: string; // uint64 as string +} + +export interface EosActionUnlinkAuth { + account: string; // uint64 as string + code: string; // uint64 as string + type: string; // uint64 as string +} + +export interface EosActionNewAccount { + creator: string; // uint64 as string + name: string; // uint64 as string + owner: EosAuthorization; + active: EosAuthorization; +} + +export interface EosActionUnknown { + data_size: number; + data_chunk: string; +} + +export interface EosTxActionAck { + common?: EosActionCommon; + transfer?: EosActionTransfer; + delegate?: EosActionDelegate; + undelegate?: EosActionUndelegate; + refund?: EosActionRefund; + buy_ram?: EosActionBuyRam; + buy_ram_bytes?: EosActionBuyRamBytes; + sell_ram?: EosActionSellRam; + vote_producer?: EosActionVoteProducer; + update_auth?: EosActionUpdateAuth; + delete_auth?: EosActionDeleteAuth; + link_auth?: EosActionLinkAuth; + unlink_auth?: EosActionUnlinkAuth; + new_account?: EosActionNewAccount; + unknown?: EosActionUnknown; +} + +export interface EosSignedTx { + signature: string; +} + +// Binance types +export interface BinanceAddress { + address: string; +} + +export interface BinancePublicKey { + public_key: string; +} + +export interface BinanceSignTx { + address_n: number[]; + msg_count: number; + chain_id: string; + account_number: number; + memo?: string; + sequence: number; + source: number; +} + +export interface BinanceTxRequest { + __avoid_empty?: null; +} + +export interface BinanceInputOutput { + address: string; + coins: Array<{ + amount: number; + denom: string; + }>; +} + +export interface BinanceTransferMsg { + inputs: BinanceInputOutput[]; + outputs: BinanceInputOutput[]; +} + +export interface BinanceOrderMsg { + id: string; + ordertype: number; // 'OT_UNKNOWN' | 'MARKET' | 'LIMIT' | 'OT_RESERVED', + price: number; + quantity: number; + sender: string; + side: number; // 'SIDE_UNKNOWN' | 'BUY' | 'SELL', + symbol: string; + timeinforce: number; // 'TIF_UNKNOWN' | 'GTE' | 'TIF_RESERVED' | 'IOC', +} + +export interface BinanceCancelMsg { + refid: string; + sender: string; + symbol: string; +} + +export type BinanceMessage = BinanceTransferMsg | BinanceOrderMsg | BinanceCancelMsg; + +export interface BinanceSignedTx { + signature: string; + public_key: string; +} + +// Reset device flags +export interface ResetDeviceFlags { + display_random?: boolean; + strength?: number; + passphrase_protection?: boolean; + pin_protection?: boolean; + language?: string; + label?: string; + u2f_counter?: number; + skip_backup?: boolean; + no_backup?: boolean; +} + +export interface FirmwareErase { + length?: number; +} + +export interface FirmwareUpload { + payload: Buffer; + length: number; + // hash?: string, +} + +export interface ChangePin { + remove?: boolean; +} + +export interface Flags { + flags: number; +} + +export interface DebugLinkDecision { + yes_no?: boolean; + up_down?: boolean; + input?: string; +} + +export interface DebugLinkState { + layout: string; + pin: string; + matrix: string; + mnemonic: string; + node: HDNode; + passphrase_protection: boolean; + reset_word: string; + reset_entropy: string; + recovery_fake_word: string; + recovery_word_pos: number; + reset_word_pos: number; +} + +export interface LoadDeviceFlags { + mnemonics?: string[]; + mnemonic?: string; + node?: HDNode; + pin?: string; + passphrase_protection?: boolean; + language?: string; + label?: string; + skip_checksum?: boolean; + u2f_counter?: number; +} + +export interface RecoverDeviceSettings { + word_count?: number; + passphrase_protection?: boolean; + pin_protection?: boolean; + language?: string; + label?: string; + enforce_wordlist?: boolean; + type?: number; + u2f_counter?: number; +} + +export interface LoadDeviceSettings { + pin?: string; + passphrase_protection?: boolean; + language?: string; + label?: string; + skip_checksum?: boolean; + mnemonics?: string[]; + mnemonic?: string; + node?: HDNode; + payload?: string; // will be converted + + u2f_counter?: number; +} + +export interface ResetDeviceSettings { + display_random?: boolean; + strength?: number; + passphrase_protection?: boolean; + pin_protection?: boolean; + language?: string; + label?: string; + u2f_counter?: number; + skip_backup?: boolean; +} + +export interface ApplySettings { + language?: string; + label?: string; + use_passphrase?: boolean; + homescreen?: string; +} diff --git a/src/ts/types/tsconfig.json b/src/ts/types/tsconfig.json new file mode 100644 index 000000000..62da51efb --- /dev/null +++ b/src/ts/types/tsconfig.json @@ -0,0 +1,36 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "./__tests__/binance.ts", + "./__tests__/bitcoin.ts", + "./__tests__/blockchain.ts", + "./__tests__/cardano.ts", + "./__tests__/eos.ts", + "./__tests__/ethereum.ts", + "./__tests__/index.ts", + "./__tests__/lisk.ts", + "./__tests__/management.ts", + "./__tests__/misc.ts", + "./__tests__/nem.ts", + "./__tests__/ripple.ts", + "./__tests__/stellar.ts", + "./__tests__/tezos.ts" + ] +} From 9e10d89e4acbda13e0461d4e1b97ed22b51358c7 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 18 Feb 2020 15:02:19 +0100 Subject: [PATCH 05/51] pass backupDevice params --- src/js/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/index.js b/src/js/index.js index f72f20662..37d56a363 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -247,7 +247,7 @@ const TrezorConnect: API = { }, backupDevice: params => { - return call({ method: 'backupDevice' }); + return call({ method: 'backupDevice', ...params }); }, changePin: params => { From d858dbeae557394028ffec62f0bbfdcf88e5f6f7 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 18 Feb 2020 15:07:11 +0100 Subject: [PATCH 06/51] version 8.1.0 --- CHANGELOG.md | 9 +++++++++ README.md | 2 +- package.json | 2 +- src/js/data/ConnectSettings.js | 5 +++-- src/js/plugins/webextension/trezor-usb-permissions.js | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 571d5deb2..ac779e269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# 8.1.0 +#### Added +- Support for FW 1.9.0 and 2.3.0 (passphrase redesign) +- Typescript types +#### Fixed +- General cleanup in flowtype declarations +- disableWebUsb method +- trezor-link protobuf messages overrides + # 8.0.13 #### Fixed - `getAddress` for multisig addresses #509 diff --git a/README.md b/README.md index 3a103fcba..f6956d029 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Trezor Connect API version 8.0.13 +# Trezor Connect API version 8.1.0 [![Build Status](https://travis-ci.org/trezor/connect.png?branch=develop)](https://travis-ci.org/trezor/connect) [![NPM](https://img.shields.io/npm/v/trezor-connect.svg)](https://www.npmjs.org/package/trezor-connect) [![Known Vulnerabilities](https://snyk.io/test/github/trezor/connect/badge.svg?targetFile=package.json)](https://snyk.io/test/github/trezor/connect?targetFile=package.json) diff --git a/package.json b/package.json index dd1858480..a4df11505 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "trezor-connect", - "version": "8.0.13", + "version": "8.1.0", "author": "Trezor ", "homepage": "https://github.com/trezor/connect", "description": "High-level javascript interface for Trezor hardware wallet.", diff --git a/src/js/data/ConnectSettings.js b/src/js/data/ConnectSettings.js index cc74c4eed..d5664c7ad 100644 --- a/src/js/data/ConnectSettings.js +++ b/src/js/data/ConnectSettings.js @@ -10,9 +10,10 @@ import type { * It could be changed by passing values into TrezorConnect.init(...) method */ -const VERSION = '8.0.13'; +const VERSION = '8.1.0'; const versionN = VERSION.split('.').map(s => parseInt(s)); -const DIRECTORY = `${ versionN[0] }${ (versionN[1] > 0 ? `.${versionN[1]}` : '') }/`; +// const DIRECTORY = `${ versionN[0] }${ (versionN[1] > 0 ? `.${versionN[1]}` : '') }/`; +const DIRECTORY = `${versionN[0]}/`; const DEFAULT_DOMAIN = `https://connect.trezor.io/${ DIRECTORY }`; export const DEFAULT_PRIORITY = 2; diff --git a/src/js/plugins/webextension/trezor-usb-permissions.js b/src/js/plugins/webextension/trezor-usb-permissions.js index 8254705dd..c7274002f 100644 --- a/src/js/plugins/webextension/trezor-usb-permissions.js +++ b/src/js/plugins/webextension/trezor-usb-permissions.js @@ -1,4 +1,4 @@ -const VERSION = '8.0.13'; +const VERSION = '8.1.0'; const versionN = VERSION.split('.').map(s => parseInt(s)); const DIRECTORY = `${ versionN[0] }${ (versionN[1] > 0 ? `.${versionN[1]}` : '') }/`; const url = 'https://connect.trezor.io/' + DIRECTORY; From 340c939318eefe97f27aa8ee34d03b974ebbc57b Mon Sep 17 00:00:00 2001 From: Nodar Chkuaselidze Date: Tue, 18 Feb 2020 15:36:45 +0100 Subject: [PATCH 07/51] btc: add hex support to sign message. (#527) Move hex utils from ethereumUtils to formatUtils. --- src/js/core/methods/EthereumGetAddress.js | 3 +- src/js/core/methods/EthereumSignMessage.js | 3 +- .../core/methods/EthereumSignTransaction.js | 3 +- src/js/core/methods/EthereumVerifyMessage.js | 2 +- src/js/core/methods/SignMessage.js | 4 ++- src/js/core/methods/VerifyMessage.js | 5 +-- src/js/utils/ethereumUtils.js | 32 +------------------ src/js/utils/formatUtils.js | 31 ++++++++++++++++++ 8 files changed, 45 insertions(+), 38 deletions(-) diff --git a/src/js/core/methods/EthereumGetAddress.js b/src/js/core/methods/EthereumGetAddress.js index 8b38bb207..736553d69 100644 --- a/src/js/core/methods/EthereumGetAddress.js +++ b/src/js/core/methods/EthereumGetAddress.js @@ -3,8 +3,9 @@ import AbstractMethod from './AbstractMethod'; import { validateParams, getFirmwareRange } from './helpers/paramsValidator'; import { validatePath, getSerializedPath } from '../../utils/pathUtils'; -import { getNetworkLabel, stripHexPrefix } from '../../utils/ethereumUtils'; +import { getNetworkLabel } from '../../utils/ethereumUtils'; import { getEthereumNetwork, getUniqueNetworks } from '../../data/CoinInfo'; +import { stripHexPrefix } from '../../utils/formatUtils'; import * as UI from '../../constants/ui'; import { UiMessage } from '../../message/builder'; diff --git a/src/js/core/methods/EthereumSignMessage.js b/src/js/core/methods/EthereumSignMessage.js index e623acea8..4e3e7ef8b 100644 --- a/src/js/core/methods/EthereumSignMessage.js +++ b/src/js/core/methods/EthereumSignMessage.js @@ -4,7 +4,8 @@ import AbstractMethod from './AbstractMethod'; import { validateParams, getFirmwareRange } from './helpers/paramsValidator'; import { validatePath } from '../../utils/pathUtils'; import { getEthereumNetwork } from '../../data/CoinInfo'; -import { toChecksumAddress, getNetworkLabel, messageToHex } from '../../utils/ethereumUtils'; +import { toChecksumAddress, getNetworkLabel } from '../../utils/ethereumUtils'; +import { messageToHex } from '../../utils/formatUtils'; import type { MessageSignature } from '../../types/trezor/protobuf'; import type { CoreMessage, EthereumNetworkInfo } from '../../types'; diff --git a/src/js/core/methods/EthereumSignTransaction.js b/src/js/core/methods/EthereumSignTransaction.js index 10df2275e..fdf590b0f 100644 --- a/src/js/core/methods/EthereumSignTransaction.js +++ b/src/js/core/methods/EthereumSignTransaction.js @@ -4,7 +4,8 @@ import AbstractMethod from './AbstractMethod'; import { validateParams, getFirmwareRange } from './helpers/paramsValidator'; import { validatePath } from '../../utils/pathUtils'; import { getEthereumNetwork } from '../../data/CoinInfo'; -import { stripHexPrefix, getNetworkLabel } from '../../utils/ethereumUtils'; +import { getNetworkLabel } from '../../utils/ethereumUtils'; +import { stripHexPrefix } from '../../utils/formatUtils'; import * as helper from './helpers/ethereumSignTx'; import type { CoreMessage } from '../../types'; diff --git a/src/js/core/methods/EthereumVerifyMessage.js b/src/js/core/methods/EthereumVerifyMessage.js index ce8c678d9..6ee81c3f2 100644 --- a/src/js/core/methods/EthereumVerifyMessage.js +++ b/src/js/core/methods/EthereumVerifyMessage.js @@ -5,7 +5,7 @@ import { validateParams, getFirmwareRange } from './helpers/paramsValidator'; import type { Success } from '../../types/trezor/protobuf'; import type { CoreMessage } from '../../types'; -import { stripHexPrefix, messageToHex } from '../../utils/ethereumUtils'; +import { stripHexPrefix, messageToHex } from '../../utils/formatUtils'; type Params = { address: string; diff --git a/src/js/core/methods/SignMessage.js b/src/js/core/methods/SignMessage.js index 654381e4b..11125f21c 100644 --- a/src/js/core/methods/SignMessage.js +++ b/src/js/core/methods/SignMessage.js @@ -6,6 +6,7 @@ import { validatePath, getLabel } from '../../utils/pathUtils'; import { getBitcoinNetwork } from '../../data/CoinInfo'; import type { MessageSignature } from '../../types/trezor/protobuf'; import type { CoreMessage, BitcoinNetworkInfo } from '../../types'; +import { messageToHex } from '../../utils/formatUtils'; type Params = { path: Array; @@ -28,6 +29,7 @@ export default class SignMessage extends AbstractMethod { { name: 'path', obligatory: true }, { name: 'coin', type: 'string' }, { name: 'message', type: 'string', obligatory: true }, + { name: 'hex', type: 'boolean' }, ]); const path: Array = validatePath(payload.path); @@ -46,7 +48,7 @@ export default class SignMessage extends AbstractMethod { this.firmwareRange = getFirmwareRange(this.name, coinInfo, this.firmwareRange); } - const messageHex: string = Buffer.from(payload.message, 'utf8').toString('hex'); + const messageHex: string = payload.hex ? messageToHex(payload.message) : Buffer.from(payload.message, 'utf8').toString('hex'); this.params = { path, message: messageHex, diff --git a/src/js/core/methods/VerifyMessage.js b/src/js/core/methods/VerifyMessage.js index 53519f4a5..50a47ba19 100644 --- a/src/js/core/methods/VerifyMessage.js +++ b/src/js/core/methods/VerifyMessage.js @@ -8,6 +8,7 @@ import { NO_COIN_INFO } from '../../constants/errors'; import type { Success } from '../../types/trezor/protobuf'; import type { CoreMessage, BitcoinNetworkInfo } from '../../types'; +import { messageToHex } from '../../utils/formatUtils'; type Params = { address: string; @@ -33,6 +34,7 @@ export default class VerifyMessage extends AbstractMethod { { name: 'signature', type: 'string', obligatory: true }, { name: 'message', type: 'string', obligatory: true }, { name: 'coin', type: 'string', obligatory: true }, + { name: 'hex', type: 'boolean' }, ]); const coinInfo: ?BitcoinNetworkInfo = getBitcoinNetwork(payload.coin); @@ -43,8 +45,7 @@ export default class VerifyMessage extends AbstractMethod { this.firmwareRange = getFirmwareRange(this.name, coinInfo, this.firmwareRange); this.info = getLabel('Verify #NETWORK message', coinInfo); } - // TODO: check if message is already a hex - const messageHex: string = Buffer.from(payload.message, 'utf8').toString('hex'); + const messageHex: string = payload.hex ? messageToHex(payload.message) : Buffer.from(payload.message, 'utf8').toString('hex'); const signatureHex: string = Buffer.from(payload.signature, 'base64').toString('hex'); this.params = { diff --git a/src/js/utils/ethereumUtils.js b/src/js/utils/ethereumUtils.js index 380d7583f..b4965aa84 100644 --- a/src/js/utils/ethereumUtils.js +++ b/src/js/utils/ethereumUtils.js @@ -1,14 +1,7 @@ /* @flow */ import createKeccakHash from 'keccak'; import type { EthereumNetworkInfo, CoinInfo } from '../types'; - -const hasHexPrefix = (str: string): boolean => { - return str.slice(0, 2).toLowerCase() === '0x'; -}; - -export const stripHexPrefix = (str: string): string => { - return hasHexPrefix(str) ? str.slice(2) : str; -}; +import { hasHexPrefix, stripHexPrefix } from './formatUtils'; export const toChecksumAddress = (address: string, network: ?EthereumNetworkInfo): string => { if (hasHexPrefix(address)) return address; @@ -34,26 +27,3 @@ export const getNetworkLabel = (label: string, network: ?CoinInfo): string => { } return label.replace('#NETWORK', ''); }; - -// from (isHexString) https://github.com/ethjs/ethjs-util/blob/master/src/index.js -const isHexString = (value: string, length?: number) => { - if (typeof value !== 'string' || !value.match(/^(0x|0X)?[0-9A-Fa-f]*$/)) { - return false; - } - if (length && value.length !== 2 + 2 * length) { return false; } - return true; -}; - -// from (toBuffer) https://github.com/ethereumjs/ethereumjs-util/blob/master/index.js -export const messageToHex = (message: string): string => { - let buffer: Buffer; - if (isHexString(message)) { - let clean = stripHexPrefix(message); - // pad left even - if (clean.length % 2 !== 0) { clean = '0' + clean; } - buffer = Buffer.from(clean, 'hex'); - } else { - buffer = Buffer.from(message); - } - return buffer.toString('hex'); -}; diff --git a/src/js/utils/formatUtils.js b/src/js/utils/formatUtils.js index 312c3b39e..d265bb49e 100644 --- a/src/js/utils/formatUtils.js +++ b/src/js/utils/formatUtils.js @@ -42,3 +42,34 @@ export const formatTime = (n: number): string => { export const btckb2satoshib = (n: string): string => { return new BigNumber(n).times(1e5).toFixed(0, BigNumber.ROUND_HALF_UP); }; + +export const hasHexPrefix = (str: string): boolean => { + return str.slice(0, 2).toLowerCase() === '0x'; +}; + +export const stripHexPrefix = (str: string): string => { + return hasHexPrefix(str) ? str.slice(2) : str; +}; + +// from (isHexString) https://github.com/ethjs/ethjs-util/blob/master/src/index.js +const isHexString = (value: string, length?: number) => { + if (typeof value !== 'string' || !value.match(/^(0x|0X)?[0-9A-Fa-f]*$/)) { + return false; + } + if (length && value.length !== 2 + 2 * length) { return false; } + return true; +}; + +// from (toBuffer) https://github.com/ethereumjs/ethereumjs-util/blob/master/index.js +export const messageToHex = (message: string): string => { + let buffer: Buffer; + if (isHexString(message)) { + let clean = stripHexPrefix(message); + // pad left even + if (clean.length % 2 !== 0) { clean = '0' + clean; } + buffer = Buffer.from(clean, 'hex'); + } else { + buffer = Buffer.from(message); + } + return buffer.toString('hex'); +}; From 7fa6a84ae902ae78b1da4051555719227dc84415 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 18 Feb 2020 15:42:26 +0100 Subject: [PATCH 08/51] add "hex" param to sigMessage and verifyMessage tests --- src/__tests__/core/signMessage.spec.js | 6 ++++-- src/__tests__/core/verifyMessage.spec.js | 20 +++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/__tests__/core/signMessage.spec.js b/src/__tests__/core/signMessage.spec.js index ae2e32a2b..a35e62e3f 100644 --- a/src/__tests__/core/signMessage.spec.js +++ b/src/__tests__/core/signMessage.spec.js @@ -7,7 +7,8 @@ const sign = () => { method: 'signMessage', coin: 'Bitcoin', path: [0], - message: 'This is an example of a signed message.', + message: Buffer.from('This is an example of a signed message.', 'utf-8').toString('hex'), + hex: true, }, ]; @@ -35,7 +36,8 @@ const signTestnet = () => { method: 'signMessage', coin: 'Testnet', path: "m/49'/1'/0'", - message: 'This is an example of a signed message.', + message: Buffer.from('This is an example of a signed message.', 'utf-8').toString('hex'), + hex: true, }, ]; diff --git a/src/__tests__/core/verifyMessage.spec.js b/src/__tests__/core/verifyMessage.spec.js index ea5aa5eb2..37bb447a1 100644 --- a/src/__tests__/core/verifyMessage.spec.js +++ b/src/__tests__/core/verifyMessage.spec.js @@ -8,15 +8,16 @@ const verify = () => { method: 'verifyMessage', coin: 'Bitcoin', address: '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T', - signature: Buffer.from(/* btoa( */'1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'/* ) */, 'hex').toString('base64'), - message: 'This is an example of a signed message.', + signature: Buffer.from('1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2', 'hex').toString('base64'), + message: Buffer.from('This is an example of a signed message.', 'utf-8').toString('hex'), + hex: true, }, { // compressed pubkey - wrong sig method: 'verifyMessage', coin: 'Bitcoin', address: '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T', - signature: Buffer.from(/* btoa( */'1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c800'/* ) */, 'hex').toString('base64'), + signature: Buffer.from('1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c800', 'hex').toString('base64'), message: 'This is an example of a signed message.', }, { @@ -24,7 +25,7 @@ const verify = () => { method: 'verifyMessage', coin: 'Bitcoin', address: '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T', - signature: Buffer.from(/* btoa( */'1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2'/* ) */, 'hex').toString('base64'), + signature: Buffer.from('1ba77e01a9e17ba158b962cfef5f13dfed676ffc2b4bada24e58f784458b52b97421470d001d53d5880cf5e10e76f02be3e80bf21e18398cbd41e8c3b4af74c8c2', 'hex').toString('base64'), message: 'This is an example of a signed message!', }, { @@ -32,7 +33,7 @@ const verify = () => { method: 'verifyMessage', coin: 'Bitcoin', address: '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8', - signature: Buffer.from(/* btoa( */'1f44e3e461f7ca9f57c472ce1a28214df1de1dadefb6551a32d1907b80c74d5a1fbfd6daaba12dd8cb06699ce3f6941fbe0f3957b5802d13076181046e741eaaaf'/* ) */, 'hex').toString('base64'), + signature: Buffer.from('1f44e3e461f7ca9f57c472ce1a28214df1de1dadefb6551a32d1907b80c74d5a1fbfd6daaba12dd8cb06699ce3f6941fbe0f3957b5802d13076181046e741eaaaf', 'hex').toString('base64'), message: 'This is an example of a signed message.', }, { @@ -40,7 +41,7 @@ const verify = () => { method: 'verifyMessage', coin: 'Bitcoin', address: '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8', - signature: Buffer.from(/* btoa( */'1f44e3e461f7ca9f57c472ce1a28214df1de1dadefb6551a32d1907b80c74d5a1fbfd6daaba12dd8cb06699ce3f6941fbe0f3957b5802d13076181046e741eaa00'/* ) */, 'hex').toString('base64'), + signature: Buffer.from('1f44e3e461f7ca9f57c472ce1a28214df1de1dadefb6551a32d1907b80c74d5a1fbfd6daaba12dd8cb06699ce3f6941fbe0f3957b5802d13076181046e741eaa00', 'hex').toString('base64'), message: 'This is an example of a signed message.', }, { @@ -48,15 +49,16 @@ const verify = () => { method: 'verifyMessage', coin: 'Bitcoin', address: '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e', - signature: Buffer.from(/* btoa( */'209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80'/* ) */, 'hex').toString('base64'), - message: 'This is an example of a signed message.', + signature: Buffer.from('209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', 'hex').toString('base64'), + message: Buffer.from('This is an example of a signed message.', 'utf-8').toString('hex'), + hex: true, }, { // trezor pubkey - wrong msg method: 'verifyMessage', coin: 'Bitcoin', address: '14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e', - signature: Buffer.from(/* btoa( */'209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80'/* ) */, 'hex').toString('base64'), + signature: Buffer.from('209e23edf0e4e47ff1dec27f32cd78c50e74ef018ee8a6adf35ae17c7a9b0dd96f48b493fd7dbab03efb6f439c6383c9523b3bbc5f1a7d158a6af90ab154e9be80', 'hex').toString('base64'), message: 'This is an example of a signed message!', }, ]; From c3a2b48d9a30dac9aacae030ce1b3d231d0e3416 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 18 Feb 2020 15:44:58 +0100 Subject: [PATCH 09/51] hex parameter in signMessage and verifyMessage (docs, changelog) --- CHANGELOG.md | 1 + docs/methods/signMessage.md | 1 + docs/methods/verifyMessage.md | 1 + 3 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac779e269..c2a76b6f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ #### Added - Support for FW 1.9.0 and 2.3.0 (passphrase redesign) - Typescript types +- `hex` parameter to `signMessage` and `verifyMessage` methods #### Fixed - General cleanup in flowtype declarations - disableWebUsb method diff --git a/docs/methods/signMessage.md b/docs/methods/signMessage.md index 18efd1424..702f35834 100644 --- a/docs/methods/signMessage.md +++ b/docs/methods/signMessage.md @@ -20,6 +20,7 @@ TrezorConnect.signMessage(params).then(function(result) { * `path` — *obligatory* `string | Array` minimum length is `3`. [read more](path.md) * `message` - *obligatory* `string` * `coin` - *optional* `string` Determines network definition specified in [coins.json](../../src/data/coins.json) file. Coin `shortcut`, `name` or `label` can be used. If `coin` is not set API will try to get network definition from `path`. +* `hex` - *optional* `boolean` convert message from hex ### Example ```javascript diff --git a/docs/methods/verifyMessage.md b/docs/methods/verifyMessage.md index 893076f55..290352be7 100644 --- a/docs/methods/verifyMessage.md +++ b/docs/methods/verifyMessage.md @@ -22,6 +22,7 @@ TrezorConnect.verifyMessage(params).then(function(result) { * `message` - *obligatory* `string` signed message, * `signature` - *obligatory* `string` signature in base64 format, * `coin` - *obligatory* `string` Determines network definition specified in [coins.json](../../src/data/coins.json) file. Coin `shortcut`, `name` or `label` can be used. +* `hex` - *optional* `boolean` convert message from hex ### Example ```javascript From 8357dbb38f61ecf22f89f17798b0875ad9cae5d8 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 18 Feb 2020 19:13:56 +0100 Subject: [PATCH 10/51] update dependencies --- .gitlab-ci.yml | 2 +- .travis.yml | 2 +- package.json | 80 +- yarn.lock | 3508 ++++++++++++++++++++++++++---------------------- 4 files changed, 1933 insertions(+), 1659 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 76fd1473c..8fd58e8b4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,7 +9,7 @@ build: script: - yarn - yarn flow - - yarn eslint + - yarn lint - yarn test:unit - make build-connect artifacts: diff --git a/.travis.yml b/.travis.yml index 8eaaa0998..ee9847a06 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,7 +9,7 @@ script: - npm install -g yarn - yarn - yarn flow - - yarn eslint + - yarn lint - yarn test:unit - make build-connect diff --git a/package.json b/package.json index a4df11505..c2fa208ea 100644 --- a/package.json +++ b/package.json @@ -42,87 +42,87 @@ "test:unit": "jest --verbose -c jest.config.js", "flow": "flow check src/js", "flow-tests": "flow check src/__tests__", - "eslint": "eslint src/js", - "eslint-tests": "eslint src/__tests__", - "eslint-tests-fix": "eslint --fix src/__tests__", - "eslint-fix": "eslint --fix src/js" + "lint": "eslint src/js", + "lint:fix": "eslint --fix src/js", + "lint:tests": "eslint src/__tests__", + "lint:tests:fix": "eslint --fix src/__tests__" }, "devDependencies": { - "@babel/cli": "^7.7.0", - "@babel/core": "^7.7.2", - "@babel/node": "^7.7.0", - "@babel/plugin-proposal-class-properties": "^7.7.0", - "@babel/plugin-proposal-object-rest-spread": "^7.6.2", - "@babel/plugin-transform-runtime": "^7.6.2", - "@babel/preset-env": "^7.7.1", - "@babel/preset-flow": "^7.0.0", - "@trezor/blockchain-link": "^1.0.6", - "@trezor/utxo-lib": "0.1.0", + "@babel/cli": "7.8.4", + "@babel/core": "7.8.4", + "@babel/node": "7.8.4", + "@babel/plugin-proposal-class-properties": "7.8.3", + "@babel/plugin-proposal-object-rest-spread": "7.8.3", + "@babel/plugin-transform-runtime": "7.8.3", + "@babel/preset-env": "7.8.4", + "@babel/preset-flow": "7.8.3", + "@trezor/blockchain-link": "^1.0.7", + "@trezor/utxo-lib": "^0.1.0", "babel-collect-imports": "https://github.com/szymonlesisz/babel-collect-imports", "babel-eslint": "^10.0.3", - "babel-jest": "^24.9.0", + "babel-jest": "25.1.0", "babel-loader": "^8.0.0", - "bchaddrjs": "0.4.4", + "bchaddrjs": "0.4.5", "bignumber.js": "^9.0.0", - "bowser": "^2.7.0", + "bowser": "2.9.0", "copy-webpack-plugin": "5.1.1", "css-loader": "3.4.2", "es6-promise": "^4.2.2", - "eslint": "^6.6.0", - "eslint-plugin-flowtype": "^4.4.1", - "eslint-plugin-jest": "^23.0.3", + "eslint": "6.8.0", + "eslint-plugin-flowtype": "4.6.0", + "eslint-plugin-jest": "23.7.0", "eslint-plugin-promise": "^4.1.1", "eslint-plugin-standard": "^4.0.1", - "file-loader": "^4.2.0", - "flow-bin": "0.116.1", + "file-loader": "5.0.2", + "flow-bin": "0.118.0", "fs-extra": "^8.1.0", "hd-wallet": "9.0.0", "html-webpack-plugin": "^3.2.0", "jasmine-core": "^3.5.0", - "jest": "^24.9.0", + "jest": "25.1.0", "karma": "^4.4.1", "karma-babel-preprocessor": "^8.0.0", "karma-chrome-launcher": "^3.1.0", - "karma-firefox-launcher": "^1.2.0", - "karma-jasmine": "^2.0.1", + "karma-firefox-launcher": "1.3.0", + "karma-jasmine": "3.1.1", "karma-jasmine-async": "^0.0.1", "karma-safari-launcher": "^1.0.0", "karma-sourcemap-loader": "^0.3.7", "karma-webpack": "^4.0.2", - "keccak": "^2.0.0", - "less": "^3.10.3", + "keccak": "^3.0.0", + "less": "3.11.1", "less-loader": "^5.0.0", "less-plugin-autoprefix": "^2.0.0", "less-plugin-clean-css": "^1.5.1", "mini-css-extract-plugin": "0.9.0", "node-fetch": "^2.6.0", "parse-uri": "^1.0.0", - "ripple-lib": "^1.4.0", + "ripple-lib": "1.6.3", "sharedworker-loader": "^2.1.1", "style-loader": "1.1.3", - "terser-webpack-plugin": "2.3.2", + "terser-webpack-plugin": "2.3.5", "tiny-worker": "^2.3.0", "trezor-link": "1.6.7", "uglify-es": "3.3.9", - "version-bump-prompt": "5.0.7", - "webpack": "4.41.5", - "webpack-cli": "3.3.10", - "webpack-dev-server": "3.10.1", + "version-bump-prompt": "6.0.0", + "webpack": "4.41.6", + "webpack-cli": "3.3.11", + "webpack-dev-server": "3.10.3", "worker-loader": "2.0.0" }, "dependencies": { - "@babel/runtime": "^7.7.2", - "events": "^3.0.0", + "@babel/runtime": "^7.8.4", + "events": "^3.1.0", "whatwg-fetch": "^3.0.0" }, "extendedDependencies": { - "@trezor/blockchain-link": "^1.0.6", - "@trezor/utxo-lib": "0.1.0", - "bchaddrjs": "^0.4.4", + "@trezor/blockchain-link": "^1.0.7", + "@trezor/utxo-lib": "^0.1.0", + "bchaddrjs": "0.4.5", "bignumber.js": "^9.0.0", - "bowser": "^2.7.0", + "bowser": "^2.9.0", "hd-wallet": "9.0.0", - "keccak": "^2.0.0", + "keccak": "^3.0.0", "node-fetch": "^2.6.0", "parse-uri": "^1.0.0", "tiny-worker": "^2.3.0", diff --git a/yarn.lock b/yarn.lock index f9646cf59..316bcbda9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,12 +2,12 @@ # yarn lockfile v1 -"@babel/cli@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.7.0.tgz#8d10c9acb2acb362d7614a9493e1791c69100d89" - integrity sha512-jECEqAq6Ngf3pOhLSg7od9WKyrIacyh1oNNYtRXNn+ummSHCTXBamGywOAtiae34Vk7zKuQNnLvo2BKTMCoV4A== +"@babel/cli@7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.8.4.tgz#505fb053721a98777b2b175323ea4f090b7d3c1c" + integrity sha512-XXLgAm6LBbaNxaGhMAznXXaxtCWfuv6PIDJ9Alsy9JYTOh+j2jJz+L/162kkfU1j/pTSxK1xGmlwI4pdIMkoag== dependencies: - commander "^2.8.1" + commander "^4.0.1" convert-source-map "^1.1.0" fs-readdir-recursive "^1.1.0" glob "^7.0.0" @@ -25,6 +25,43 @@ dependencies: "@babel/highlight" "^7.0.0" +"@babel/code-frame@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.8.3.tgz#33e25903d7481181534e12ec0a25f16b6fcf419e" + integrity sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g== + dependencies: + "@babel/highlight" "^7.8.3" + +"@babel/compat-data@^7.8.4": + version "7.8.5" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.8.5.tgz#d28ce872778c23551cbb9432fc68d28495b613b9" + integrity sha512-jWYUqQX/ObOhG1UiEkbH5SANsE/8oKXiQWjj7p7xgj9Zmnt//aUvyz4dBkK0HNsS8/cbyC5NmmH87VekW+mXFg== + dependencies: + browserslist "^4.8.5" + invariant "^2.2.4" + semver "^5.5.0" + +"@babel/core@7.8.4", "@babel/core@^7.7.5": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.8.4.tgz#d496799e5c12195b3602d0fddd77294e3e38e80e" + integrity sha512-0LiLrB2PwrVI+a2/IEskBopDYSd8BCb3rOvH7D5tzoWd696TBEduBvuLVm4Nx6rltrLZqvI3MCalB2K2aVzQjA== + dependencies: + "@babel/code-frame" "^7.8.3" + "@babel/generator" "^7.8.4" + "@babel/helpers" "^7.8.4" + "@babel/parser" "^7.8.4" + "@babel/template" "^7.8.3" + "@babel/traverse" "^7.8.4" + "@babel/types" "^7.8.3" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.1" + json5 "^2.1.0" + lodash "^4.17.13" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + "@babel/core@^7.0.0-beta.56": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.5.tgz#17b2686ef0d6bc58f963dddd68ab669755582c30" @@ -45,7 +82,7 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.1.0", "@babel/core@^7.7.2": +"@babel/core@^7.1.0": version "7.7.2" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.7.2.tgz#ea5b99693bcfc058116f42fa1dd54da412b29d91" integrity sha512-eeD7VEZKfhK1KUXGiyPFettgF3m513f8FoBSWiQ1xTvl1RAopLs42Wp9+Ze911I6H0N9lNqJMDgoZT7gHsipeQ== @@ -65,7 +102,18 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.4.0", "@babel/generator@^7.7.2": +"@babel/generator@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.5.5.tgz#873a7f936a3c89491b43536d12245b626664e3cf" + integrity sha512-ETI/4vyTSxTzGnU2c49XHv2zhExkv9JHLTwDAFz85kmcwuShvYG2H08FwgIguQf4JC75CBnXAUM5PqeF4fj0nQ== + dependencies: + "@babel/types" "^7.5.5" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.5.0" + trim-right "^1.0.1" + +"@babel/generator@^7.7.2": version "7.7.2" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.7.2.tgz#2f4852d04131a5e17ea4f6645488b5da66ebf3af" integrity sha512-WthSArvAjYLz4TcbKOi88me+KmDJdKSlfwwN8CnUYn9jBkzhq0ZEPuBfkAWIvjJ3AdEV1Cf/+eSQTnp3IDJKlQ== @@ -75,84 +123,87 @@ lodash "^4.17.13" source-map "^0.5.0" -"@babel/generator@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.5.5.tgz#873a7f936a3c89491b43536d12245b626664e3cf" - integrity sha512-ETI/4vyTSxTzGnU2c49XHv2zhExkv9JHLTwDAFz85kmcwuShvYG2H08FwgIguQf4JC75CBnXAUM5PqeF4fj0nQ== +"@babel/generator@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.8.4.tgz#35bbc74486956fe4251829f9f6c48330e8d0985e" + integrity sha512-PwhclGdRpNAf3IxZb0YVuITPZmmrXz9zf6fH8lT4XbrmfQKr6ryBzhv593P5C6poJRciFCL/eHGW2NuGrgEyxA== dependencies: - "@babel/types" "^7.5.5" + "@babel/types" "^7.8.3" jsesc "^2.5.1" lodash "^4.17.13" source-map "^0.5.0" - trim-right "^1.0.1" -"@babel/helper-annotate-as-pure@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32" - integrity sha512-3UYcJUj9kvSLbLbUIfQTqzcy5VX7GRZ/CCDrnOaZorFFM01aXp1+GJwuFGV4NDDoAS+mOUyHcO6UD/RfqOks3Q== +"@babel/helper-annotate-as-pure@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.8.3.tgz#60bc0bc657f63a0924ff9a4b4a0b24a13cf4deee" + integrity sha512-6o+mJrZBxOoEX77Ezv9zwW7WV8DdluouRKNY/IR5u/YTMuKHgugHOzYWlYvYLpLA9nPsQCAAASpCIbjI9Mv+Uw== dependencies: - "@babel/types" "^7.0.0" + "@babel/types" "^7.8.3" -"@babel/helper-annotate-as-pure@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.7.0.tgz#efc54032d43891fe267679e63f6860aa7dbf4a5e" - integrity sha512-k50CQxMlYTYo+GGyUGFwpxKVtxVJi9yh61sXZji3zYHccK9RYliZGSTOgci85T+r+0VFN2nWbGM04PIqwfrpMg== +"@babel/helper-builder-binary-assignment-operator-visitor@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.8.3.tgz#c84097a427a061ac56a1c30ebf54b7b22d241503" + integrity sha512-5eFOm2SyFPK4Rh3XMMRDjN7lBH0orh3ss0g3rTYZnBQ+r6YPj7lgDyCvPphynHvUrobJmeMignBr6Acw9mAPlw== dependencies: - "@babel/types" "^7.7.0" + "@babel/helper-explode-assignable-expression" "^7.8.3" + "@babel/types" "^7.8.3" -"@babel/helper-builder-binary-assignment-operator-visitor@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.1.0.tgz#6b69628dfe4087798e0c4ed98e3d4a6b2fbd2f5f" - integrity sha512-qNSR4jrmJ8M1VMM9tibvyRAHXQs2PmaksQF7c1CGJNipfe3D8p+wgNwgso/P2A2r2mdgBWAXljNWR0QRZAMW8w== +"@babel/helper-call-delegate@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.8.3.tgz#de82619898aa605d409c42be6ffb8d7204579692" + integrity sha512-6Q05px0Eb+N4/GTyKPPvnkig7Lylw+QzihMpws9iiZQv7ZImf84ZsZpQH7QoWN4n4tm81SnSzPgHw2qtO0Zf3A== dependencies: - "@babel/helper-explode-assignable-expression" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/helper-hoist-variables" "^7.8.3" + "@babel/traverse" "^7.8.3" + "@babel/types" "^7.8.3" -"@babel/helper-call-delegate@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.4.4.tgz#87c1f8ca19ad552a736a7a27b1c1fcf8b1ff1f43" - integrity sha512-l79boDFJ8S1c5hvQvG+rc+wHw6IuH7YldmRKsYtpbawsxURu/paVy57FZMomGK22/JckepaikOkY0MoAmdyOlQ== +"@babel/helper-compilation-targets@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.8.4.tgz#03d7ecd454b7ebe19a254f76617e61770aed2c88" + integrity sha512-3k3BsKMvPp5bjxgMdrFyq0UaEO48HciVrOVF0+lon8pp95cyJ2ujAh0TrBHNMnJGT2rr0iKOJPFFbSqjDyf/Pg== dependencies: - "@babel/helper-hoist-variables" "^7.4.4" - "@babel/traverse" "^7.4.4" - "@babel/types" "^7.4.4" + "@babel/compat-data" "^7.8.4" + browserslist "^4.8.5" + invariant "^2.2.4" + levenary "^1.1.1" + semver "^5.5.0" -"@babel/helper-create-class-features-plugin@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.7.0.tgz#bcdc223abbfdd386f94196ae2544987f8df775e8" - integrity sha512-MZiB5qvTWoyiFOgootmRSDV1udjIqJW/8lmxgzKq6oDqxdmHUjeP2ZUOmgHdYjmUVNABqRrHjYAYRvj8Eox/UA== +"@babel/helper-create-class-features-plugin@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.8.3.tgz#5b94be88c255f140fd2c10dd151e7f98f4bff397" + integrity sha512-qmp4pD7zeTxsv0JNecSBsEmG1ei2MqwJq4YQcK3ZWm/0t07QstWfvuV/vm3Qt5xNMFETn2SZqpMx2MQzbtq+KA== dependencies: - "@babel/helper-function-name" "^7.7.0" - "@babel/helper-member-expression-to-functions" "^7.7.0" - "@babel/helper-optimise-call-expression" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.7.0" - "@babel/helper-split-export-declaration" "^7.7.0" + "@babel/helper-function-name" "^7.8.3" + "@babel/helper-member-expression-to-functions" "^7.8.3" + "@babel/helper-optimise-call-expression" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-replace-supers" "^7.8.3" + "@babel/helper-split-export-declaration" "^7.8.3" -"@babel/helper-create-regexp-features-plugin@^7.7.0": - version "7.7.2" - resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.7.2.tgz#6f20443778c8fce2af2ff4206284afc0ced65db6" - integrity sha512-pAil/ZixjTlrzNpjx+l/C/wJk002Wo7XbbZ8oujH/AoJ3Juv0iN/UTcPUHXKMFLqsfS0Hy6Aow8M31brUYBlQQ== +"@babel/helper-create-regexp-features-plugin@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.8.3.tgz#c774268c95ec07ee92476a3862b75cc2839beb79" + integrity sha512-Gcsm1OHCUr9o9TcJln57xhWHtdXbA2pgQ58S0Lxlks0WMGNXuki4+GLfX0p+L2ZkINUGZvfkz8rzoqJQSthI+Q== dependencies: - "@babel/helper-regex" "^7.4.4" + "@babel/helper-regex" "^7.8.3" regexpu-core "^4.6.0" -"@babel/helper-define-map@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.7.0.tgz#60b0e9fd60def9de5054c38afde8c8ee409c7529" - integrity sha512-kPKWPb0dMpZi+ov1hJiwse9dWweZsz3V9rP4KdytnX1E7z3cTNmFGglwklzFPuqIcHLIY3bgKSs4vkwXXdflQA== +"@babel/helper-define-map@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.8.3.tgz#a0655cad5451c3760b726eba875f1cd8faa02c15" + integrity sha512-PoeBYtxoZGtct3md6xZOCWPcKuMuk3IHhgxsRRNtnNShebf4C8YonTSblsK4tvDbm+eJAw2HAPOfCr+Q/YRG/g== dependencies: - "@babel/helper-function-name" "^7.7.0" - "@babel/types" "^7.7.0" + "@babel/helper-function-name" "^7.8.3" + "@babel/types" "^7.8.3" lodash "^4.17.13" -"@babel/helper-explode-assignable-expression@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.1.0.tgz#537fa13f6f1674df745b0c00ec8fe4e99681c8f6" - integrity sha512-NRQpfHrJ1msCHtKjbzs9YcMmJZOg6mQMmGRB+hbamEdG5PNpaSm95275VD92DvJKuyl0s2sFiDmMZ+EnnvufqA== +"@babel/helper-explode-assignable-expression@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.8.3.tgz#a728dc5b4e89e30fc2dfc7d04fa28a930653f982" + integrity sha512-N+8eW86/Kj147bO9G2uclsg5pwfs/fqqY5rwgIL7eTBklgXjcOJ3btzS5iM6AitJcftnY7pm2lGsrJVYLGjzIw== dependencies: - "@babel/traverse" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/traverse" "^7.8.3" + "@babel/types" "^7.8.3" "@babel/helper-function-name@^7.1.0": version "7.1.0" @@ -172,6 +223,15 @@ "@babel/template" "^7.7.0" "@babel/types" "^7.7.0" +"@babel/helper-function-name@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.8.3.tgz#eeeb665a01b1f11068e9fb86ad56a1cb1a824cca" + integrity sha512-BCxgX1BC2hD/oBlIFUgOCQDOPV8nSINxCwM3o93xP4P9Fq6aV5sgv2cOOITDMtCfQ+3PvHp3l689XZvAM9QyOA== + dependencies: + "@babel/helper-get-function-arity" "^7.8.3" + "@babel/template" "^7.8.3" + "@babel/types" "^7.8.3" + "@babel/helper-get-function-arity@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0.tgz#83572d4320e2a4657263734113c42868b64e49c3" @@ -186,144 +246,98 @@ dependencies: "@babel/types" "^7.7.0" -"@babel/helper-hoist-variables@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.4.4.tgz#0298b5f25c8c09c53102d52ac4a98f773eb2850a" - integrity sha512-VYk2/H/BnYbZDDg39hr3t2kKyifAm1W6zHRfhx8jGjIHpQEBv9dry7oQ2f3+J703TLu69nYdxsovl0XYfcnK4w== +"@babel/helper-get-function-arity@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.8.3.tgz#b894b947bd004381ce63ea1db9f08547e920abd5" + integrity sha512-FVDR+Gd9iLjUMY1fzE2SR0IuaJToR4RkCDARVfsBBPSP53GEqSFjD8gNyxg246VUyc/ALRxFaAK8rVG7UT7xRA== dependencies: - "@babel/types" "^7.4.4" + "@babel/types" "^7.8.3" -"@babel/helper-hoist-variables@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.7.0.tgz#b4552e4cfe5577d7de7b183e193e84e4ec538c81" - integrity sha512-LUe/92NqsDAkJjjCEWkNe+/PcpnisvnqdlRe19FahVapa4jndeuJ+FBiTX1rcAKWKcJGE+C3Q3tuEuxkSmCEiQ== +"@babel/helper-hoist-variables@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-hoist-variables/-/helper-hoist-variables-7.8.3.tgz#1dbe9b6b55d78c9b4183fc8cdc6e30ceb83b7134" + integrity sha512-ky1JLOjcDUtSc+xkt0xhYff7Z6ILTAHKmZLHPxAhOP0Nd77O+3nCsd6uSVYur6nJnCI029CrNbYlc0LoPfAPQg== dependencies: - "@babel/types" "^7.7.0" + "@babel/types" "^7.8.3" -"@babel/helper-member-expression-to-functions@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.5.5.tgz#1fb5b8ec4453a93c439ee9fe3aeea4a84b76b590" - integrity sha512-5qZ3D1uMclSNqYcXqiHoA0meVdv+xUEex9em2fqMnrk/scphGlGgg66zjMrPJESPwrFJ6sbfFQYUSa0Mz7FabA== +"@babel/helper-member-expression-to-functions@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.8.3.tgz#659b710498ea6c1d9907e0c73f206eee7dadc24c" + integrity sha512-fO4Egq88utkQFjbPrSHGmGLFqmrshs11d46WI+WZDESt7Wu7wN2G2Iu+NMMZJFDOVRHAMIkB5SNh30NtwCA7RA== dependencies: - "@babel/types" "^7.5.5" + "@babel/types" "^7.8.3" -"@babel/helper-member-expression-to-functions@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.7.0.tgz#472b93003a57071f95a541ea6c2b098398bcad8a" - integrity sha512-QaCZLO2RtBcmvO/ekOLp8p7R5X2JriKRizeDpm5ChATAFWrrYDcDxPuCIBXKyBjY+i1vYSdcUTMIb8psfxHDPA== - dependencies: - "@babel/types" "^7.7.0" - -"@babel/helper-module-imports@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.0.0.tgz#96081b7111e486da4d2cd971ad1a4fe216cc2e3d" - integrity sha512-aP/hlLq01DWNEiDg4Jn23i+CXxW/owM4WpDLFUbpjxe4NS3BhLVZQ5i7E0ZrxuQ/vwekIeciyamgB1UIYxxM6A== +"@babel/helper-module-imports@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.8.3.tgz#7fe39589b39c016331b6b8c3f441e8f0b1419498" + integrity sha512-R0Bx3jippsbAEtzkpZ/6FIiuzOURPcMjHp+Z6xPe6DtApDJx+w7UYyOLanZqO8+wKR9G10s/FmHXvxaMd9s6Kg== dependencies: - "@babel/types" "^7.0.0" - -"@babel/helper-module-imports@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.7.0.tgz#99c095889466e5f7b6d66d98dffc58baaf42654d" - integrity sha512-Dv3hLKIC1jyfTkClvyEkYP2OlkzNvWs5+Q8WgPbxM5LMeorons7iPP91JM+DU7tRbhqA1ZeooPaMFvQrn23RHw== - dependencies: - "@babel/types" "^7.7.0" - -"@babel/helper-module-transforms@^7.1.0": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.5.5.tgz#f84ff8a09038dcbca1fd4355661a500937165b4a" - integrity sha512-jBeCvETKuJqeiaCdyaheF40aXnnU1+wkSiUs/IQg3tB85up1LyL8x77ClY8qJpuRJUcXQo+ZtdNESmZl4j56Pw== - dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-simple-access" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/template" "^7.4.4" - "@babel/types" "^7.5.5" - lodash "^4.17.13" + "@babel/types" "^7.8.3" -"@babel/helper-module-transforms@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.7.0.tgz#154a69f0c5b8fd4d39e49750ff7ac4faa3f36786" - integrity sha512-rXEefBuheUYQyX4WjV19tuknrJFwyKw0HgzRwbkyTbB+Dshlq7eqkWbyjzToLrMZk/5wKVKdWFluiAsVkHXvuQ== +"@babel/helper-module-transforms@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.8.3.tgz#d305e35d02bee720fbc2c3c3623aa0c316c01590" + integrity sha512-C7NG6B7vfBa/pwCOshpMbOYUmrYQDfCpVL/JCRu0ek8B5p8kue1+BCXpg2vOYs7w5ACB9GTOBYQ5U6NwrMg+3Q== dependencies: - "@babel/helper-module-imports" "^7.7.0" - "@babel/helper-simple-access" "^7.7.0" - "@babel/helper-split-export-declaration" "^7.7.0" - "@babel/template" "^7.7.0" - "@babel/types" "^7.7.0" + "@babel/helper-module-imports" "^7.8.3" + "@babel/helper-simple-access" "^7.8.3" + "@babel/helper-split-export-declaration" "^7.8.3" + "@babel/template" "^7.8.3" + "@babel/types" "^7.8.3" lodash "^4.17.13" -"@babel/helper-optimise-call-expression@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.0.0.tgz#a2920c5702b073c15de51106200aa8cad20497d5" - integrity sha512-u8nd9NQePYNQV8iPWu/pLLYBqZBa4ZaY1YWRFMuxrid94wKI1QNt67NEZ7GAe5Kc/0LLScbim05xZFWkAdrj9g== +"@babel/helper-optimise-call-expression@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.8.3.tgz#7ed071813d09c75298ef4f208956006b6111ecb9" + integrity sha512-Kag20n86cbO2AvHca6EJsvqAd82gc6VMGule4HwebwMlwkpXuVqrNRj6CkCV2sKxgi9MyAUnZVnZ6lJ1/vKhHQ== dependencies: - "@babel/types" "^7.0.0" - -"@babel/helper-optimise-call-expression@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.7.0.tgz#4f66a216116a66164135dc618c5d8b7a959f9365" - integrity sha512-48TeqmbazjNU/65niiiJIJRc5JozB8acui1OS7bSd6PgxfuovWsvjfWSzlgx+gPFdVveNzUdpdIg5l56Pl5jqg== - dependencies: - "@babel/types" "^7.7.0" + "@babel/types" "^7.8.3" "@babel/helper-plugin-utils@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.0.0.tgz#bbb3fbee98661c569034237cc03967ba99b4f250" integrity sha512-CYAOUCARwExnEixLdB6sDm2dIJ/YgEAKDM1MOeMeZu9Ld/bDgVo8aiWrXwcY7OBh+1Ea2uUcVRcxKk0GJvW7QA== -"@babel/helper-regex@^7.0.0", "@babel/helper-regex@^7.4.4": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.5.5.tgz#0aa6824f7100a2e0e89c1527c23936c152cab351" - integrity sha512-CkCYQLkfkiugbRDO8eZn6lRuR8kzZoGXCg3149iTk5se7g6qykSpy3+hELSwquhu+TgHn8nkLiBwHvNX8Hofcw== - dependencies: - lodash "^4.17.13" - -"@babel/helper-remap-async-to-generator@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.7.0.tgz#4d69ec653e8bff5bce62f5d33fc1508f223c75a7" - integrity sha512-pHx7RN8X0UNHPB/fnuDnRXVZ316ZigkO8y8D835JlZ2SSdFKb6yH9MIYRU4fy/KPe5sPHDFOPvf8QLdbAGGiyw== - dependencies: - "@babel/helper-annotate-as-pure" "^7.7.0" - "@babel/helper-wrap-function" "^7.7.0" - "@babel/template" "^7.7.0" - "@babel/traverse" "^7.7.0" - "@babel/types" "^7.7.0" +"@babel/helper-plugin-utils@^7.8.0", "@babel/helper-plugin-utils@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.8.3.tgz#9ea293be19babc0f52ff8ca88b34c3611b208670" + integrity sha512-j+fq49Xds2smCUNYmEHF9kGNkhbet6yVIBp4e6oeQpH1RUs/Ir06xUKzDjDkGcaaokPiTNs2JBWHjaE4csUkZQ== -"@babel/helper-replace-supers@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.5.5.tgz#f84ce43df031222d2bad068d2626cb5799c34bc2" - integrity sha512-XvRFWrNnlsow2u7jXDuH4jDDctkxbS7gXssrP4q2nUD606ukXHRvydj346wmNg+zAgpFx4MWf4+usfC93bElJg== +"@babel/helper-regex@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-regex/-/helper-regex-7.8.3.tgz#139772607d51b93f23effe72105b319d2a4c6965" + integrity sha512-BWt0QtYv/cg/NecOAZMdcn/waj/5P26DR4mVLXfFtDokSR6fyuG0Pj+e2FqtSME+MqED1khnSMulkmGl8qWiUQ== dependencies: - "@babel/helper-member-expression-to-functions" "^7.5.5" - "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/traverse" "^7.5.5" - "@babel/types" "^7.5.5" + lodash "^4.17.13" -"@babel/helper-replace-supers@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.7.0.tgz#d5365c8667fe7cbd13b8ddddceb9bd7f2b387512" - integrity sha512-5ALYEul5V8xNdxEeWvRsBzLMxQksT7MaStpxjJf9KsnLxpAKBtfw5NeMKZJSYDa0lKdOcy0g+JT/f5mPSulUgg== +"@babel/helper-remap-async-to-generator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.8.3.tgz#273c600d8b9bf5006142c1e35887d555c12edd86" + integrity sha512-kgwDmw4fCg7AVgS4DukQR/roGp+jP+XluJE5hsRZwxCYGg+Rv9wSGErDWhlI90FODdYfd4xG4AQRiMDjjN0GzA== dependencies: - "@babel/helper-member-expression-to-functions" "^7.7.0" - "@babel/helper-optimise-call-expression" "^7.7.0" - "@babel/traverse" "^7.7.0" - "@babel/types" "^7.7.0" + "@babel/helper-annotate-as-pure" "^7.8.3" + "@babel/helper-wrap-function" "^7.8.3" + "@babel/template" "^7.8.3" + "@babel/traverse" "^7.8.3" + "@babel/types" "^7.8.3" -"@babel/helper-simple-access@^7.1.0": - version "7.1.0" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.1.0.tgz#65eeb954c8c245beaa4e859da6188f39d71e585c" - integrity sha512-Vk+78hNjRbsiu49zAPALxTb+JUQCz1aolpd8osOF16BGnLtseD21nbHgLPGUwrXEurZgiCOUmvs3ExTu4F5x6w== +"@babel/helper-replace-supers@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.8.3.tgz#91192d25f6abbcd41da8a989d4492574fb1530bc" + integrity sha512-xOUssL6ho41U81etpLoT2RTdvdus4VfHamCuAm4AHxGr+0it5fnwoVdwUJ7GFEqCsQYzJUhcbsN9wB9apcYKFA== dependencies: - "@babel/template" "^7.1.0" - "@babel/types" "^7.0.0" + "@babel/helper-member-expression-to-functions" "^7.8.3" + "@babel/helper-optimise-call-expression" "^7.8.3" + "@babel/traverse" "^7.8.3" + "@babel/types" "^7.8.3" -"@babel/helper-simple-access@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.7.0.tgz#97a8b6c52105d76031b86237dc1852b44837243d" - integrity sha512-AJ7IZD7Eem3zZRuj5JtzFAptBw7pMlS3y8Qv09vaBWoFsle0d1kAn5Wq6Q9MyBXITPOKnxwkZKoAm4bopmv26g== +"@babel/helper-simple-access@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz#7f8109928b4dab4654076986af575231deb639ae" + integrity sha512-VNGUDjx5cCWg4vvCTR8qQ7YJYZ+HBjxOgXEl7ounz+4Sn7+LMD3CFrCTEU6/qXKbA2nKg21CwhhBzO0RpRbdCw== dependencies: - "@babel/template" "^7.7.0" - "@babel/types" "^7.7.0" + "@babel/template" "^7.8.3" + "@babel/types" "^7.8.3" "@babel/helper-split-export-declaration@^7.4.4": version "7.4.4" @@ -339,15 +353,22 @@ dependencies: "@babel/types" "^7.7.0" -"@babel/helper-wrap-function@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.7.0.tgz#15af3d3e98f8417a60554acbb6c14e75e0b33b74" - integrity sha512-sd4QjeMgQqzshSjecZjOp8uKfUtnpmCyQhKQrVJBBgeHAB/0FPi33h3AbVlVp07qQtMD4QgYSzaMI7VwncNK/w== +"@babel/helper-split-export-declaration@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.8.3.tgz#31a9f30070f91368a7182cf05f831781065fc7a9" + integrity sha512-3x3yOeyBhW851hroze7ElzdkeRXQYQbFIb7gLK1WQYsw2GWDay5gAJNw1sWJ0VFP6z5J1whqeXH/WCdCjZv6dA== dependencies: - "@babel/helper-function-name" "^7.7.0" - "@babel/template" "^7.7.0" - "@babel/traverse" "^7.7.0" - "@babel/types" "^7.7.0" + "@babel/types" "^7.8.3" + +"@babel/helper-wrap-function@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/helper-wrap-function/-/helper-wrap-function-7.8.3.tgz#9dbdb2bb55ef14aaa01fe8c99b629bd5352d8610" + integrity sha512-LACJrbUET9cQDzb6kG7EeD7+7doC3JNvUgTEQOx2qaO1fKlzE/Bf05qs9w1oXQMmXlPO65lC3Tq9S6gZpTErEQ== + dependencies: + "@babel/helper-function-name" "^7.8.3" + "@babel/template" "^7.8.3" + "@babel/traverse" "^7.8.3" + "@babel/types" "^7.8.3" "@babel/helpers@^7.5.5": version "7.5.5" @@ -367,6 +388,15 @@ "@babel/traverse" "^7.7.0" "@babel/types" "^7.7.0" +"@babel/helpers@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.8.4.tgz#754eb3ee727c165e0a240d6c207de7c455f36f73" + integrity sha512-VPbe7wcQ4chu4TDQjimHv/5tj73qz88o12EPkO2ValS2QiQS/1F2SsjyIGNnAD0vF/nZS6Cf9i+vW6HIlnaR8w== + dependencies: + "@babel/template" "^7.8.3" + "@babel/traverse" "^7.8.4" + "@babel/types" "^7.8.3" + "@babel/highlight@^7.0.0": version "7.5.0" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.5.0.tgz#56d11312bd9248fa619591d02472be6e8cb32540" @@ -376,17 +406,27 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/node@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.7.0.tgz#fba73fdaf75ab1a0eaf03923f5f4ce7fa41c9974" - integrity sha512-CZFTjfCGysChOJ90ksndqct5bXkByzV5Ef8YgYS3A513MhyFQgsXJMRu2QyGOlfoP3hBZ3AmDd37ARyv/L1Zvw== +"@babel/highlight@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.8.3.tgz#28f173d04223eaaa59bc1d439a3836e6d1265797" + integrity sha512-PX4y5xQUvy0fnEVHrYOarRPXVWafSjTW9T0Hab8gVIawpl2Sj0ORyrygANq+KjcNlSSTw0YCLSNA8OyZ1I4yEg== + dependencies: + chalk "^2.0.0" + esutils "^2.0.2" + js-tokens "^4.0.0" + +"@babel/node@7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.8.4.tgz#59b2ed7e5a9df2224592f83292d77d616fbf1ab8" + integrity sha512-MlczXI/VYRnoaWHjicqrzq2z4DhRPaWQIC+C3ISEQs5z+mEccBsn7IAI5Q97ZDTnFYw6ts5IUTzqArilC/g7nw== dependencies: - "@babel/register" "^7.7.0" - commander "^2.8.1" + "@babel/register" "^7.8.3" + commander "^4.0.1" core-js "^3.2.1" lodash "^4.17.13" node-environment-flags "^1.0.5" regenerator-runtime "^0.13.3" + resolve "^1.13.1" v8flags "^3.1.1" "@babel/parser@^7.0.0", "@babel/parser@^7.4.4", "@babel/parser@^7.5.5": @@ -394,448 +434,504 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== -"@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.7.0", "@babel/parser@^7.7.2": +"@babel/parser@^7.1.0", "@babel/parser@^7.7.0", "@babel/parser@^7.7.2": version "7.7.3" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.3.tgz#5fad457c2529de476a248f75b0f090b3060af043" integrity sha512-bqv+iCo9i+uLVbI0ILzKkvMorqxouI+GbV13ivcARXn9NNEabi2IEz912IgNpT/60BNXac5dgcfjb94NjsF33A== -"@babel/plugin-proposal-async-generator-functions@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.7.0.tgz#83ef2d6044496b4c15d8b4904e2219e6dccc6971" - integrity sha512-ot/EZVvf3mXtZq0Pd0+tSOfGWMizqmOohXmNZg6LNFjHOV+wOPv7BvVYh8oPR8LhpIP3ye8nNooKL50YRWxpYA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-remap-async-to-generator" "^7.7.0" - "@babel/plugin-syntax-async-generators" "^7.2.0" +"@babel/parser@^7.7.5", "@babel/parser@^7.8.3", "@babel/parser@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.4.tgz#d1dbe64691d60358a974295fa53da074dd2ce8e8" + integrity sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw== -"@babel/plugin-proposal-class-properties@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.7.0.tgz#ac54e728ecf81d90e8f4d2a9c05a890457107917" - integrity sha512-tufDcFA1Vj+eWvwHN+jvMN6QsV5o+vUlytNKrbMiCeDL0F2j92RURzUsUMWE5EJkLyWxjdUslCsMQa9FWth16A== +"@babel/plugin-proposal-async-generator-functions@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.8.3.tgz#bad329c670b382589721b27540c7d288601c6e6f" + integrity sha512-NZ9zLv848JsV3hs8ryEh7Uaz/0KsmPLqv0+PdkDJL1cJy0K4kOCFa8zc1E3mp+RHPQcpdfb/6GovEsW4VDrOMw== dependencies: - "@babel/helper-create-class-features-plugin" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-remap-async-to-generator" "^7.8.3" + "@babel/plugin-syntax-async-generators" "^7.8.0" -"@babel/plugin-proposal-dynamic-import@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.7.0.tgz#dc02a8bad8d653fb59daf085516fa416edd2aa7f" - integrity sha512-7poL3Xi+QFPC7sGAzEIbXUyYzGJwbc2+gSD0AkiC5k52kH2cqHdqxm5hNFfLW3cRSTcx9bN0Fl7/6zWcLLnKAQ== +"@babel/plugin-proposal-class-properties@7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.8.3.tgz#5e06654af5cd04b608915aada9b2a6788004464e" + integrity sha512-EqFhbo7IosdgPgZggHaNObkmO1kNUe3slaKu54d5OWvy+p9QIKOzK1GAEpAIsZtWVtPXUHSMcT4smvDrCfY4AA== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-dynamic-import" "^7.2.0" + "@babel/helper-create-class-features-plugin" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-proposal-json-strings@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" - integrity sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg== +"@babel/plugin-proposal-dynamic-import@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.8.3.tgz#38c4fe555744826e97e2ae930b0fb4cc07e66054" + integrity sha512-NyaBbyLFXFLT9FP+zk0kYlUlA8XtCUbehs67F0nnEg7KICgMc2mNkIeu9TYhKzyXMkrapZFwAhXLdnt4IYHy1w== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-dynamic-import" "^7.8.0" -"@babel/plugin-proposal-object-rest-spread@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.6.2.tgz#8ffccc8f3a6545e9f78988b6bf4fe881b88e8096" - integrity sha512-LDBXlmADCsMZV1Y9OQwMc0MyGZ8Ta/zlD9N67BfQT8uYwkRswiu2hU6nJKrjrt/58aH/vqfQlR/9yId/7A2gWw== +"@babel/plugin-proposal-json-strings@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.8.3.tgz#da5216b238a98b58a1e05d6852104b10f9a70d6b" + integrity sha512-KGhQNZ3TVCQG/MjRbAUwuH+14y9q0tpxs1nWWs3pbSleRdDro9SAMMDyye8HhY1gqZ7/NqIc8SKhya0wRDgP1Q== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-json-strings" "^7.8.0" -"@babel/plugin-proposal-optional-catch-binding@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" - integrity sha512-mgYj3jCcxug6KUcX4OBoOJz3CMrwRfQELPQ5560F70YQUBZB7uac9fqaWamKR1iWUzGiK2t0ygzjTScZnVz75g== +"@babel/plugin-proposal-nullish-coalescing-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.8.3.tgz#e4572253fdeed65cddeecfdab3f928afeb2fd5d2" + integrity sha512-TS9MlfzXpXKt6YYomudb/KU7nQI6/xnapG6in1uZxoxDghuSMZsPb6D2fyUwNYSAp4l1iR7QtFOjkqcRYcUsfw== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.0" -"@babel/plugin-proposal-unicode-property-regex@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.7.0.tgz#549fe1717a1bd0a2a7e63163841cb37e78179d5d" - integrity sha512-mk34H+hp7kRBWJOOAR0ZMGCydgKMD4iN9TpDRp3IIcbunltxEY89XSimc6WbtSLCDrwcdy/EEw7h5CFCzxTchw== +"@babel/plugin-proposal-object-rest-spread@7.8.3", "@babel/plugin-proposal-object-rest-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.8.3.tgz#eb5ae366118ddca67bed583b53d7554cad9951bb" + integrity sha512-8qvuPwU/xxUCt78HocNlv0mXXo0wdh9VT1R04WU8HGOfaOob26pF+9P5/lYjN/q7DHOX1bvX60hnhOvuQUJdbA== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-object-rest-spread" "^7.8.0" -"@babel/plugin-syntax-async-generators@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz#69e1f0db34c6f5a0cf7e2b3323bf159a76c8cb7f" - integrity sha512-1ZrIRBv2t0GSlcwVoQ6VgSLpLgiN/FVQUzt9znxo7v2Ov4jJrs8RY8tv0wvDmFN3qIdMKWrmMMW6yZ0G19MfGg== +"@babel/plugin-proposal-optional-catch-binding@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.8.3.tgz#9dee96ab1650eed88646ae9734ca167ac4a9c5c9" + integrity sha512-0gkX7J7E+AtAw9fcwlVQj8peP61qhdg/89D5swOkjYbkboA2CVckn3kiyum1DE0wskGb7KJJxBdyEBApDLLVdw== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.0" -"@babel/plugin-syntax-dynamic-import@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.2.0.tgz#69c159ffaf4998122161ad8ebc5e6d1f55df8612" - integrity sha512-mVxuJ0YroI/h/tbFTPGZR8cv6ai+STMKNBq0f8hFxsxWjl94qqhsb+wXbpNMDPU3cfR1TIsVFzU3nXyZMqyK4w== +"@babel/plugin-proposal-optional-chaining@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.8.3.tgz#ae10b3214cb25f7adb1f3bc87ba42ca10b7e2543" + integrity sha512-QIoIR9abkVn+seDE3OjA08jWcs3eZ9+wJCKSRgo3WdEU2csFYgdScb+8qHB3+WXsGJD55u+5hWCISI7ejXS+kg== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-optional-chaining" "^7.8.0" -"@babel/plugin-syntax-flow@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.2.0.tgz#a765f061f803bc48f240c26f8747faf97c26bf7c" - integrity sha512-r6YMuZDWLtLlu0kqIim5o/3TNRAlWb073HwT3e2nKf9I8IIvOggPrnILYPsrrKilmn/mYEMCf/Z07w3yQJF6dg== +"@babel/plugin-proposal-unicode-property-regex@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.8.3.tgz#b646c3adea5f98800c9ab45105ac34d06cd4a47f" + integrity sha512-1/1/rEZv2XGweRwwSkLpY+s60za9OZ1hJs4YDqFHCw0kYWYwL5IFljVY1MYBL+weT1l9pokDO2uhSTLVxzoHkQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-create-regexp-features-plugin" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-syntax-json-strings@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470" - integrity sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg== +"@babel/plugin-syntax-async-generators@^7.8.0": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz#a983fb1aeb2ec3f6ed042a210f640e90e786fe0d" + integrity sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" - integrity sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA== +"@babel/plugin-syntax-bigint@^7.0.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz#4c9a6f669f5d0cdf1b90a1671e9a146be5300cea" + integrity sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-optional-catch-binding@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz#a94013d6eda8908dfe6a477e7f9eda85656ecf5c" - integrity sha512-bDe4xKNhb0LI7IvZHiA13kff0KEfaGX/Hv4lMA9+7TEc63hMNvfKo6ZFpXhKuEp+II/q35Gc4NoMeDZyaUbj9w== +"@babel/plugin-syntax-dynamic-import@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz#62bf98b2da3cd21d626154fc96ee5b3cb68eacb3" + integrity sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-top-level-await@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.7.0.tgz#f5699549f50bbe8d12b1843a4e82f0a37bb65f4d" - integrity sha512-hi8FUNiFIY1fnUI2n1ViB1DR0R4QeK4iHcTlW6aJkrPoTdb8Rf1EMQ6GT3f67DDkYyWgew9DFoOZ6gOoEsdzTA== +"@babel/plugin-syntax-flow@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.8.3.tgz#f2c883bd61a6316f2c89380ae5122f923ba4527f" + integrity sha512-innAx3bUbA0KSYj2E2MNFSn9hiCeowOFLxlsuhXzw8hMQnzkDomUr9QCD7E9VF60NmnG1sNTuuv6Qf4f8INYsg== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-arrow-functions@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550" - integrity sha512-ER77Cax1+8/8jCB9fo4Ud161OZzWN5qawi4GusDuRLcDbDG+bIGYY20zb2dfAFdTRGzrfq2xZPvF0R64EHnimg== +"@babel/plugin-syntax-json-strings@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz#01ca21b668cd8218c9e640cb6dd88c5412b2c96a" + integrity sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-transform-async-to-generator@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.7.0.tgz#e2b84f11952cf5913fe3438b7d2585042772f492" - integrity sha512-vLI2EFLVvRBL3d8roAMqtVY0Bm9C1QzLkdS57hiKrjUBSqsQYrBsMCeOg/0KK7B0eK9V71J5mWcha9yyoI2tZw== +"@babel/plugin-syntax-nullish-coalescing-operator@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz#167ed70368886081f74b5c36c65a88c03b66d1a9" + integrity sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ== dependencies: - "@babel/helper-module-imports" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-remap-async-to-generator" "^7.7.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-transform-block-scoped-functions@^7.2.0": +"@babel/plugin-syntax-object-rest-spread@^7.0.0": version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz#5d3cc11e8d5ddd752aa64c9148d0db6cb79fd190" - integrity sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w== + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" + integrity sha512-t0JKGgqk2We+9may3t0xDdmneaXmyxq0xieYcKHxIsrJO64n1OiMWNUtc5gQK1PA0NpdCRrtZp4z+IUaKugrSA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-block-scoping@^7.6.3": - version "7.6.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.3.tgz#6e854e51fbbaa84351b15d4ddafe342f3a5d542a" - integrity sha512-7hvrg75dubcO3ZI2rjYTzUrEuh1E9IyDEhhB6qfcooxhDA33xx2MasuLVgdxzcP6R/lipAC6n9ub9maNW6RKdw== +"@babel/plugin-syntax-object-rest-spread@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz#60e225edcbd98a640332a2e72dd3e66f1af55871" + integrity sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - lodash "^4.17.13" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-transform-classes@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.7.0.tgz#b411ecc1b8822d24b81e5d184f24149136eddd4a" - integrity sha512-/b3cKIZwGeUesZheU9jNYcwrEA7f/Bo4IdPmvp7oHgvks2majB5BoT5byAql44fiNQYOPzhk2w8DbgfuafkMoA== +"@babel/plugin-syntax-optional-catch-binding@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz#6111a265bcfb020eb9efd0fdfd7d26402b9ed6c1" + integrity sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q== dependencies: - "@babel/helper-annotate-as-pure" "^7.7.0" - "@babel/helper-define-map" "^7.7.0" - "@babel/helper-function-name" "^7.7.0" - "@babel/helper-optimise-call-expression" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.7.0" - "@babel/helper-split-export-declaration" "^7.7.0" - globals "^11.1.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-transform-computed-properties@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz#83a7df6a658865b1c8f641d510c6f3af220216da" - integrity sha512-kP/drqTxY6Xt3NNpKiMomfgkNn4o7+vKxK2DDKcBG9sHj51vHqMBGy8wbDS/J4lMxnqs153/T3+DmCEAkC5cpA== +"@babel/plugin-syntax-optional-chaining@^7.8.0": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz#4f69c2ab95167e0180cd5336613f8c5788f7d48a" + integrity sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-transform-destructuring@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.6.0.tgz#44bbe08b57f4480094d57d9ffbcd96d309075ba6" - integrity sha512-2bGIS5P1v4+sWTCnKNDZDxbGvEqi0ijeqM/YqHtVGrvG2y0ySgnEEhXErvE9dA0bnIzY9bIzdFK0jFA46ASIIQ== +"@babel/plugin-syntax-top-level-await@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.8.3.tgz#3acdece695e6b13aaf57fc291d1a800950c71391" + integrity sha512-kwj1j9lL/6Wd0hROD3b/OZZ7MSrZLqqn9RAZ5+cYYsflQ9HZBIKCUkr3+uL1MEJ1NePiUbf98jjiMQSv0NMR9g== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-dotall-regex@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.7.0.tgz#c5c9ecacab3a5e0c11db6981610f0c32fd698b3b" - integrity sha512-3QQlF7hSBnSuM1hQ0pS3pmAbWLax/uGNCbPBND9y+oJ4Y776jsyujG2k0Sn2Aj2a0QwVOiOFL5QVPA7spjvzSA== +"@babel/plugin-transform-arrow-functions@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.8.3.tgz#82776c2ed0cd9e1a49956daeb896024c9473b8b6" + integrity sha512-0MRF+KC8EqH4dbuITCWwPSzsyO3HIWWlm30v8BbbpOrS1B++isGxPnnuq/IZvOX5J2D/p7DQalQm+/2PnlKGxg== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-duplicate-keys@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.5.0.tgz#c5dbf5106bf84cdf691222c0974c12b1df931853" - integrity sha512-igcziksHizyQPlX9gfSjHkE2wmoCH3evvD2qR5w29/Dk0SMKE/eOI7f1HhBdNhR/zxJDqrgpoDTq5YSLH/XMsQ== +"@babel/plugin-transform-async-to-generator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.8.3.tgz#4308fad0d9409d71eafb9b1a6ee35f9d64b64086" + integrity sha512-imt9tFLD9ogt56Dd5CI/6XgpukMwd/fLGSrix2httihVe7LOGVPhyhMh1BU5kDM7iHD08i8uUtmV2sWaBFlHVQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-module-imports" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-remap-async-to-generator" "^7.8.3" -"@babel/plugin-transform-exponentiation-operator@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz#a63868289e5b4007f7054d46491af51435766008" - integrity sha512-umh4hR6N7mu4Elq9GG8TOu9M0bakvlsREEC+ialrQN6ABS4oDQ69qJv1VtR3uxlKMCQMCvzk7vr17RHKcjx68A== +"@babel/plugin-transform-block-scoped-functions@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.8.3.tgz#437eec5b799b5852072084b3ae5ef66e8349e8a3" + integrity sha512-vo4F2OewqjbB1+yaJ7k2EJFHlTP3jR634Z9Cj9itpqNjuLXvhlVxgnjsHsdRgASR8xYDrx6onw4vW5H6We0Jmg== dependencies: - "@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-flow-strip-types@^7.0.0": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.4.4.tgz#d267a081f49a8705fc9146de0768c6b58dccd8f7" - integrity sha512-WyVedfeEIILYEaWGAUWzVNyqG4sfsNooMhXWsu/YzOvVGcsnPb5PguysjJqI3t3qiaYj0BR8T2f5njdjTGe44Q== +"@babel/plugin-transform-block-scoping@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.8.3.tgz#97d35dab66857a437c166358b91d09050c868f3a" + integrity sha512-pGnYfm7RNRgYRi7bids5bHluENHqJhrV4bCZRwc5GamaWIIs07N4rZECcmJL6ZClwjDz1GbdMZFtPs27hTB06w== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-flow" "^7.2.0" + "@babel/helper-plugin-utils" "^7.8.3" + lodash "^4.17.13" -"@babel/plugin-transform-for-of@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.4.tgz#0267fc735e24c808ba173866c6c4d1440fc3c556" - integrity sha512-9T/5Dlr14Z9TIEXLXkt8T1DU7F24cbhwhMNUziN3hB1AXoZcdzPcTiKGRn/6iOymDqtTKWnr/BtRKN9JwbKtdQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-classes@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.8.3.tgz#46fd7a9d2bb9ea89ce88720477979fe0d71b21b8" + integrity sha512-SjT0cwFJ+7Rbr1vQsvphAHwUHvSUPmMjMU/0P59G8U2HLFqSa082JO7zkbDNWs9kH/IUqpHI6xWNesGf8haF1w== + dependencies: + "@babel/helper-annotate-as-pure" "^7.8.3" + "@babel/helper-define-map" "^7.8.3" + "@babel/helper-function-name" "^7.8.3" + "@babel/helper-optimise-call-expression" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-replace-supers" "^7.8.3" + "@babel/helper-split-export-declaration" "^7.8.3" + globals "^11.1.0" -"@babel/plugin-transform-function-name@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.7.0.tgz#0fa786f1eef52e3b7d4fc02e54b2129de8a04c2a" - integrity sha512-P5HKu0d9+CzZxP5jcrWdpe7ZlFDe24bmqP6a6X8BHEBl/eizAsY8K6LX8LASZL0Jxdjm5eEfzp+FIrxCm/p8bA== +"@babel/plugin-transform-computed-properties@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.8.3.tgz#96d0d28b7f7ce4eb5b120bb2e0e943343c86f81b" + integrity sha512-O5hiIpSyOGdrQZRQ2ccwtTVkgUDBBiCuK//4RJ6UfePllUTCENOzKxfh6ulckXKc0DixTFLCfb2HVkNA7aDpzA== dependencies: - "@babel/helper-function-name" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-literals@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz#690353e81f9267dad4fd8cfd77eafa86aba53ea1" - integrity sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg== +"@babel/plugin-transform-destructuring@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.8.3.tgz#20ddfbd9e4676906b1056ee60af88590cc7aaa0b" + integrity sha512-H4X646nCkiEcHZUZaRkhE2XVsoz0J/1x3VVujnn96pSoGCtKPA99ZZA+va+gK+92Zycd6OBKCD8tDb/731bhgQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-member-expression-literals@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.2.0.tgz#fa10aa5c58a2cb6afcf2c9ffa8cb4d8b3d489a2d" - integrity sha512-HiU3zKkSU6scTidmnFJ0bMX8hz5ixC93b4MHMiYebmk2lUVNGOboPsqQvx5LzooihijUoLR/v7Nc1rbBtnc7FA== +"@babel/plugin-transform-dotall-regex@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.8.3.tgz#c3c6ec5ee6125c6993c5cbca20dc8621a9ea7a6e" + integrity sha512-kLs1j9Nn4MQoBYdRXH6AeaXMbEJFaFu/v1nQkvib6QzTj8MZI5OQzqmD83/2jEM1z0DLilra5aWO5YpyC0ALIw== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-create-regexp-features-plugin" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-modules-amd@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.5.0.tgz#ef00435d46da0a5961aa728a1d2ecff063e4fb91" - integrity sha512-n20UsQMKnWrltocZZm24cRURxQnWIvsABPJlw/fvoy9c6AgHZzoelAIzajDHAQrDpuKFFPPcFGd7ChsYuIUMpg== +"@babel/plugin-transform-duplicate-keys@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.8.3.tgz#8d12df309aa537f272899c565ea1768e286e21f1" + integrity sha512-s8dHiBUbcbSgipS4SMFuWGqCvyge5V2ZeAWzR6INTVC3Ltjig/Vw1G2Gztv0vU/hRG9X8IvKvYdoksnUfgXOEQ== dependencies: - "@babel/helper-module-transforms" "^7.1.0" - "@babel/helper-plugin-utils" "^7.0.0" - babel-plugin-dynamic-import-node "^2.3.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-modules-commonjs@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.7.0.tgz#3e5ffb4fd8c947feede69cbe24c9554ab4113fe3" - integrity sha512-KEMyWNNWnjOom8vR/1+d+Ocz/mILZG/eyHHO06OuBQ2aNhxT62fr4y6fGOplRx+CxCSp3IFwesL8WdINfY/3kg== +"@babel/plugin-transform-exponentiation-operator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.8.3.tgz#581a6d7f56970e06bf51560cd64f5e947b70d7b7" + integrity sha512-zwIpuIymb3ACcInbksHaNcR12S++0MDLKkiqXHl3AzpgdKlFNhog+z/K0+TGW+b0w5pgTq4H6IwV/WhxbGYSjQ== dependencies: - "@babel/helper-module-transforms" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-simple-access" "^7.7.0" - babel-plugin-dynamic-import-node "^2.3.0" + "@babel/helper-builder-binary-assignment-operator-visitor" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-modules-systemjs@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.7.0.tgz#9baf471213af9761c1617bb12fd278e629041417" - integrity sha512-ZAuFgYjJzDNv77AjXRqzQGlQl4HdUM6j296ee4fwKVZfhDR9LAGxfvXjBkb06gNETPnN0sLqRm9Gxg4wZH6dXg== +"@babel/plugin-transform-flow-strip-types@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.8.3.tgz#da705a655466b2a9b36046b57bf0cbcd53551bd4" + integrity sha512-g/6WTWG/xbdd2exBBzMfygjX/zw4eyNC4X8pRaq7aRHRoDUCzAIu3kGYIXviOv8BjCuWm8vDBwjHcjiRNgXrPA== dependencies: - "@babel/helper-hoist-variables" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - babel-plugin-dynamic-import-node "^2.3.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-syntax-flow" "^7.8.3" -"@babel/plugin-transform-modules-umd@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.7.0.tgz#d62c7da16670908e1d8c68ca0b5d4c0097b69966" - integrity sha512-u7eBA03zmUswQ9LQ7Qw0/ieC1pcAkbp5OQatbWUzY1PaBccvuJXUkYzoN1g7cqp7dbTu6Dp9bXyalBvD04AANA== +"@babel/plugin-transform-for-of@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.8.4.tgz#6fe8eae5d6875086ee185dd0b098a8513783b47d" + integrity sha512-iAXNlOWvcYUYoV8YIxwS7TxGRJcxyl8eQCfT+A5j8sKUzRFvJdcyjp97jL2IghWSRDaL2PU2O2tX8Cu9dTBq5A== dependencies: - "@babel/helper-module-transforms" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-named-capturing-groups-regex@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.7.0.tgz#358e6fd869b9a4d8f5cbc79e4ed4fc340e60dcaf" - integrity sha512-+SicSJoKouPctL+j1pqktRVCgy+xAch1hWWTMy13j0IflnyNjaoskj+DwRQFimHbLqO3sq2oN2CXMvXq3Bgapg== +"@babel/plugin-transform-function-name@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.8.3.tgz#279373cb27322aaad67c2683e776dfc47196ed8b" + integrity sha512-rO/OnDS78Eifbjn5Py9v8y0aR+aSYhDhqAwVfsTl0ERuMZyr05L1aFSCJnbv2mmsLkit/4ReeQ9N2BgLnOcPCQ== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.7.0" + "@babel/helper-function-name" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-new-target@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.4.tgz#18d120438b0cc9ee95a47f2c72bc9768fbed60a5" - integrity sha512-r1z3T2DNGQwwe2vPGZMBNjioT2scgWzK9BCnDEh+46z8EEwXBq24uRzd65I7pjtugzPSj921aM15RpESgzsSuA== +"@babel/plugin-transform-literals@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.8.3.tgz#aef239823d91994ec7b68e55193525d76dbd5dc1" + integrity sha512-3Tqf8JJ/qB7TeldGl+TT55+uQei9JfYaregDcEAyBZ7akutriFrt6C/wLYIer6OYhleVQvH/ntEhjE/xMmy10A== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-object-super@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.5.5.tgz#c70021df834073c65eb613b8679cc4a381d1a9f9" - integrity sha512-un1zJQAhSosGFBduPgN/YFNvWVpRuHKU7IHBglLoLZsGmruJPOo6pbInneflUdmq7YvSVqhpPs5zdBvLnteltQ== +"@babel/plugin-transform-member-expression-literals@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.8.3.tgz#963fed4b620ac7cbf6029c755424029fa3a40410" + integrity sha512-3Wk2EXhnw+rP+IDkK6BdtPKsUE5IeZ6QOGrPYvw52NwBStw9V1ZVzxgK6fSKSxqUvH9eQPR3tm3cOq79HlsKYA== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.5.5" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-parameters@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.4.tgz#7556cf03f318bd2719fe4c922d2d808be5571e16" - integrity sha512-oMh5DUO1V63nZcu/ZVLQFqiihBGo4OpxJxR1otF50GMeCLiRx5nUdtokd+u9SuVJrvvuIh9OosRFPP4pIPnwmw== +"@babel/plugin-transform-modules-amd@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.8.3.tgz#65606d44616b50225e76f5578f33c568a0b876a5" + integrity sha512-MadJiU3rLKclzT5kBH4yxdry96odTUwuqrZM+GllFI/VhxfPz+k9MshJM+MwhfkCdxxclSbSBbUGciBngR+kEQ== dependencies: - "@babel/helper-call-delegate" "^7.4.4" - "@babel/helper-get-function-arity" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-module-transforms" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-property-literals@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.2.0.tgz#03e33f653f5b25c4eb572c98b9485055b389e905" - integrity sha512-9q7Dbk4RhgcLp8ebduOpCbtjh7C0itoLYHXd9ueASKAG/is5PQtMR5VJGka9NKqGhYEGn5ITahd4h9QeBMylWQ== +"@babel/plugin-transform-modules-commonjs@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.8.3.tgz#df251706ec331bd058a34bdd72613915f82928a5" + integrity sha512-JpdMEfA15HZ/1gNuB9XEDlZM1h/gF/YOH7zaZzQu2xCFRfwc01NXBMHHSTT6hRjlXJJs5x/bfODM3LiCk94Sxg== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-module-transforms" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-simple-access" "^7.8.3" + babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-regenerator@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.7.0.tgz#f1b20b535e7716b622c99e989259d7dd942dd9cc" - integrity sha512-AXmvnC+0wuj/cFkkS/HFHIojxH3ffSXE+ttulrqWjZZRaUOonfJc60e1wSNT4rV8tIunvu/R3wCp71/tLAa9xg== +"@babel/plugin-transform-modules-systemjs@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.8.3.tgz#d8bbf222c1dbe3661f440f2f00c16e9bb7d0d420" + integrity sha512-8cESMCJjmArMYqa9AO5YuMEkE4ds28tMpZcGZB/jl3n0ZzlsxOAi3mC+SKypTfT8gjMupCnd3YiXCkMjj2jfOg== dependencies: - regenerator-transform "^0.14.0" + "@babel/helper-hoist-variables" "^7.8.3" + "@babel/helper-module-transforms" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-reserved-words@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.2.0.tgz#4792af87c998a49367597d07fedf02636d2e1634" - integrity sha512-fz43fqW8E1tAB3DKF19/vxbpib1fuyCwSPE418ge5ZxILnBhWyhtPgz8eh1RCGGJlwvksHkyxMxh0eenFi+kFw== +"@babel/plugin-transform-modules-umd@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.8.3.tgz#592d578ce06c52f5b98b02f913d653ffe972661a" + integrity sha512-evhTyWhbwbI3/U6dZAnx/ePoV7H6OUG+OjiJFHmhr9FPn0VShjwC2kdxqIuQ/+1P50TMrneGzMeyMTFOjKSnAw== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-module-transforms" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-runtime@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.6.2.tgz#2669f67c1fae0ae8d8bf696e4263ad52cb98b6f8" - integrity sha512-cqULw/QB4yl73cS5Y0TZlQSjDvNkzDbu0FurTZyHlJpWE5T3PCMdnyV+xXoH1opr1ldyHODe3QAX3OMAii5NxA== +"@babel/plugin-transform-named-capturing-groups-regex@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.8.3.tgz#a2a72bffa202ac0e2d0506afd0939c5ecbc48c6c" + integrity sha512-f+tF/8UVPU86TrCb06JoPWIdDpTNSGGcAtaD9mLP0aYGA0OS0j7j7DHJR0GTFrUZPUU6loZhbsVZgTh0N+Qdnw== dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - resolve "^1.8.1" - semver "^5.5.1" + "@babel/helper-create-regexp-features-plugin" "^7.8.3" -"@babel/plugin-transform-shorthand-properties@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0" - integrity sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg== +"@babel/plugin-transform-new-target@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.8.3.tgz#60cc2ae66d85c95ab540eb34babb6434d4c70c43" + integrity sha512-QuSGysibQpyxexRyui2vca+Cmbljo8bcRckgzYV4kRIsHpVeyeC3JDO63pY+xFZ6bWOBn7pfKZTqV4o/ix9sFw== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-spread@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.6.2.tgz#fc77cf798b24b10c46e1b51b1b88c2bf661bb8dd" - integrity sha512-DpSvPFryKdK1x+EDJYCy28nmAaIMdxmhot62jAXF/o99iA33Zj2Lmcp3vDmz+MUh0LNYVPvfj5iC3feb3/+PFg== +"@babel/plugin-transform-object-super@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.8.3.tgz#ebb6a1e7a86ffa96858bd6ac0102d65944261725" + integrity sha512-57FXk+gItG/GejofIyLIgBKTas4+pEU47IXKDBWFTxdPd7F80H8zybyAY7UoblVfBhBGs2EKM+bJUu2+iUYPDQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-replace-supers" "^7.8.3" -"@babel/plugin-transform-sticky-regex@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz#a1e454b5995560a9c1e0d537dfc15061fd2687e1" - integrity sha512-KKYCoGaRAf+ckH8gEL3JHUaFVyNHKe3ASNsZ+AlktgHevvxGigoIttrEJb8iKN03Q7Eazlv1s6cx2B2cQ3Jabw== +"@babel/plugin-transform-parameters@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.8.4.tgz#1d5155de0b65db0ccf9971165745d3bb990d77d3" + integrity sha512-IsS3oTxeTsZlE5KqzTbcC2sV0P9pXdec53SU+Yxv7o/6dvGM5AkTotQKhoSffhNgZ/dftsSiOoxy7evCYJXzVA== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.0.0" + "@babel/helper-call-delegate" "^7.8.3" + "@babel/helper-get-function-arity" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-template-literals@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.4.4.tgz#9d28fea7bbce637fb7612a0750989d8321d4bcb0" - integrity sha512-mQrEC4TWkhLN0z8ygIvEL9ZEToPhG5K7KDW3pzGqOfIGZ28Jb0POUkeWcoz8HnHvhFy6dwAT1j8OzqN8s804+g== +"@babel/plugin-transform-property-literals@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.8.3.tgz#33194300d8539c1ed28c62ad5087ba3807b98263" + integrity sha512-uGiiXAZMqEoQhRWMK17VospMZh5sXWg+dlh2soffpkAl96KAm+WZuJfa6lcELotSRmooLqg0MWdH6UUq85nmmg== dependencies: - "@babel/helper-annotate-as-pure" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-typeof-symbol@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz#117d2bcec2fbf64b4b59d1f9819894682d29f2b2" - integrity sha512-2LNhETWYxiYysBtrBTqL8+La0jIoQQnIScUJc74OYvUGRmkskNY4EzLCnjHBzdmb38wqtTaixpo1NctEcvMDZw== +"@babel/plugin-transform-regenerator@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.8.3.tgz#b31031e8059c07495bf23614c97f3d9698bc6ec8" + integrity sha512-qt/kcur/FxrQrzFR432FGZznkVAjiyFtCOANjkAKwCbt465L6ZCiUQh2oMYGU3Wo8LRFJxNDFwWn106S5wVUNA== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" + regenerator-transform "^0.14.0" -"@babel/plugin-transform-unicode-regex@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.7.0.tgz#743d9bcc44080e3cc7d49259a066efa30f9187a3" - integrity sha512-RrThb0gdrNwFAqEAAx9OWgtx6ICK69x7i9tCnMdVrxQwSDp/Abu9DXFU5Hh16VP33Rmxh04+NGW28NsIkFvFKA== +"@babel/plugin-transform-reserved-words@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.8.3.tgz#9a0635ac4e665d29b162837dd3cc50745dfdf1f5" + integrity sha512-mwMxcycN3omKFDjDQUl+8zyMsBfjRFr0Zn/64I41pmjv4NJuqcYlEtezwYtw9TFd9WR1vN5kiM+O0gMZzO6L0A== dependencies: - "@babel/helper-create-regexp-features-plugin" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" -"@babel/preset-env@^7.7.1": - version "7.7.1" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.7.1.tgz#04a2ff53552c5885cf1083e291c8dd5490f744bb" - integrity sha512-/93SWhi3PxcVTDpSqC+Dp4YxUu3qZ4m7I76k0w73wYfn7bGVuRIO4QUz95aJksbS+AD1/mT1Ie7rbkT0wSplaA== +"@babel/plugin-transform-runtime@7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.8.3.tgz#c0153bc0a5375ebc1f1591cb7eea223adea9f169" + integrity sha512-/vqUt5Yh+cgPZXXjmaG9NT8aVfThKk7G4OqkVhrXqwsC5soMn/qTCxs36rZ2QFhpfTJcjw4SNDIZ4RUb8OL4jQ== dependencies: - "@babel/helper-module-imports" "^7.7.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.7.0" - "@babel/plugin-proposal-dynamic-import" "^7.7.0" - "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.6.2" - "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.7.0" - "@babel/plugin-syntax-async-generators" "^7.2.0" - "@babel/plugin-syntax-dynamic-import" "^7.2.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" - "@babel/plugin-syntax-top-level-await" "^7.7.0" - "@babel/plugin-transform-arrow-functions" "^7.2.0" - "@babel/plugin-transform-async-to-generator" "^7.7.0" - "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.6.3" - "@babel/plugin-transform-classes" "^7.7.0" - "@babel/plugin-transform-computed-properties" "^7.2.0" - "@babel/plugin-transform-destructuring" "^7.6.0" - "@babel/plugin-transform-dotall-regex" "^7.7.0" - "@babel/plugin-transform-duplicate-keys" "^7.5.0" - "@babel/plugin-transform-exponentiation-operator" "^7.2.0" - "@babel/plugin-transform-for-of" "^7.4.4" - "@babel/plugin-transform-function-name" "^7.7.0" - "@babel/plugin-transform-literals" "^7.2.0" - "@babel/plugin-transform-member-expression-literals" "^7.2.0" - "@babel/plugin-transform-modules-amd" "^7.5.0" - "@babel/plugin-transform-modules-commonjs" "^7.7.0" - "@babel/plugin-transform-modules-systemjs" "^7.7.0" - "@babel/plugin-transform-modules-umd" "^7.7.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.7.0" - "@babel/plugin-transform-new-target" "^7.4.4" - "@babel/plugin-transform-object-super" "^7.5.5" - "@babel/plugin-transform-parameters" "^7.4.4" - "@babel/plugin-transform-property-literals" "^7.2.0" - "@babel/plugin-transform-regenerator" "^7.7.0" - "@babel/plugin-transform-reserved-words" "^7.2.0" - "@babel/plugin-transform-shorthand-properties" "^7.2.0" - "@babel/plugin-transform-spread" "^7.6.2" - "@babel/plugin-transform-sticky-regex" "^7.2.0" - "@babel/plugin-transform-template-literals" "^7.4.4" - "@babel/plugin-transform-typeof-symbol" "^7.2.0" - "@babel/plugin-transform-unicode-regex" "^7.7.0" - "@babel/types" "^7.7.1" - browserslist "^4.6.0" - core-js-compat "^3.1.1" + "@babel/helper-module-imports" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + resolve "^1.8.1" + semver "^5.5.1" + +"@babel/plugin-transform-shorthand-properties@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.8.3.tgz#28545216e023a832d4d3a1185ed492bcfeac08c8" + integrity sha512-I9DI6Odg0JJwxCHzbzW08ggMdCezoWcuQRz3ptdudgwaHxTjxw5HgdFJmZIkIMlRymL6YiZcped4TTCB0JcC8w== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + +"@babel/plugin-transform-spread@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.8.3.tgz#9c8ffe8170fdfb88b114ecb920b82fb6e95fe5e8" + integrity sha512-CkuTU9mbmAoFOI1tklFWYYbzX5qCIZVXPVy0jpXgGwkplCndQAa58s2jr66fTeQnA64bDox0HL4U56CFYoyC7g== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + +"@babel/plugin-transform-sticky-regex@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.8.3.tgz#be7a1290f81dae767475452199e1f76d6175b100" + integrity sha512-9Spq0vGCD5Bb4Z/ZXXSK5wbbLFMG085qd2vhL1JYu1WcQ5bXqZBAYRzU1d+p79GcHs2szYv5pVQCX13QgldaWw== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/helper-regex" "^7.8.3" + +"@babel/plugin-transform-template-literals@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.8.3.tgz#7bfa4732b455ea6a43130adc0ba767ec0e402a80" + integrity sha512-820QBtykIQOLFT8NZOcTRJ1UNuztIELe4p9DCgvj4NK+PwluSJ49we7s9FB1HIGNIYT7wFUJ0ar2QpCDj0escQ== + dependencies: + "@babel/helper-annotate-as-pure" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + +"@babel/plugin-transform-typeof-symbol@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.8.4.tgz#ede4062315ce0aaf8a657a920858f1a2f35fc412" + integrity sha512-2QKyfjGdvuNfHsb7qnBBlKclbD4CfshH2KvDabiijLMGXPHJXGxtDzwIF7bQP+T0ysw8fYTtxPafgfs/c1Lrqg== + dependencies: + "@babel/helper-plugin-utils" "^7.8.3" + +"@babel/plugin-transform-unicode-regex@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.8.3.tgz#0cef36e3ba73e5c57273effb182f46b91a1ecaad" + integrity sha512-+ufgJjYdmWfSQ+6NS9VGUR2ns8cjJjYbrbi11mZBTaWm+Fui/ncTLFF28Ei1okavY+xkojGr1eJxNsWYeA5aZw== + dependencies: + "@babel/helper-create-regexp-features-plugin" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + +"@babel/preset-env@7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.8.4.tgz#9dac6df5f423015d3d49b6e9e5fa3413e4a72c4e" + integrity sha512-HihCgpr45AnSOHRbS5cWNTINs0TwaR8BS8xIIH+QwiW8cKL0llV91njQMpeMReEPVs+1Ao0x3RLEBLtt1hOq4w== + dependencies: + "@babel/compat-data" "^7.8.4" + "@babel/helper-compilation-targets" "^7.8.4" + "@babel/helper-module-imports" "^7.8.3" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-proposal-async-generator-functions" "^7.8.3" + "@babel/plugin-proposal-dynamic-import" "^7.8.3" + "@babel/plugin-proposal-json-strings" "^7.8.3" + "@babel/plugin-proposal-nullish-coalescing-operator" "^7.8.3" + "@babel/plugin-proposal-object-rest-spread" "^7.8.3" + "@babel/plugin-proposal-optional-catch-binding" "^7.8.3" + "@babel/plugin-proposal-optional-chaining" "^7.8.3" + "@babel/plugin-proposal-unicode-property-regex" "^7.8.3" + "@babel/plugin-syntax-async-generators" "^7.8.0" + "@babel/plugin-syntax-dynamic-import" "^7.8.0" + "@babel/plugin-syntax-json-strings" "^7.8.0" + "@babel/plugin-syntax-nullish-coalescing-operator" "^7.8.0" + "@babel/plugin-syntax-object-rest-spread" "^7.8.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.8.0" + "@babel/plugin-syntax-optional-chaining" "^7.8.0" + "@babel/plugin-syntax-top-level-await" "^7.8.3" + "@babel/plugin-transform-arrow-functions" "^7.8.3" + "@babel/plugin-transform-async-to-generator" "^7.8.3" + "@babel/plugin-transform-block-scoped-functions" "^7.8.3" + "@babel/plugin-transform-block-scoping" "^7.8.3" + "@babel/plugin-transform-classes" "^7.8.3" + "@babel/plugin-transform-computed-properties" "^7.8.3" + "@babel/plugin-transform-destructuring" "^7.8.3" + "@babel/plugin-transform-dotall-regex" "^7.8.3" + "@babel/plugin-transform-duplicate-keys" "^7.8.3" + "@babel/plugin-transform-exponentiation-operator" "^7.8.3" + "@babel/plugin-transform-for-of" "^7.8.4" + "@babel/plugin-transform-function-name" "^7.8.3" + "@babel/plugin-transform-literals" "^7.8.3" + "@babel/plugin-transform-member-expression-literals" "^7.8.3" + "@babel/plugin-transform-modules-amd" "^7.8.3" + "@babel/plugin-transform-modules-commonjs" "^7.8.3" + "@babel/plugin-transform-modules-systemjs" "^7.8.3" + "@babel/plugin-transform-modules-umd" "^7.8.3" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.8.3" + "@babel/plugin-transform-new-target" "^7.8.3" + "@babel/plugin-transform-object-super" "^7.8.3" + "@babel/plugin-transform-parameters" "^7.8.4" + "@babel/plugin-transform-property-literals" "^7.8.3" + "@babel/plugin-transform-regenerator" "^7.8.3" + "@babel/plugin-transform-reserved-words" "^7.8.3" + "@babel/plugin-transform-shorthand-properties" "^7.8.3" + "@babel/plugin-transform-spread" "^7.8.3" + "@babel/plugin-transform-sticky-regex" "^7.8.3" + "@babel/plugin-transform-template-literals" "^7.8.3" + "@babel/plugin-transform-typeof-symbol" "^7.8.4" + "@babel/plugin-transform-unicode-regex" "^7.8.3" + "@babel/types" "^7.8.3" + browserslist "^4.8.5" + core-js-compat "^3.6.2" invariant "^2.2.2" - js-levenshtein "^1.1.3" + levenary "^1.1.1" semver "^5.5.0" -"@babel/preset-flow@^7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" - integrity sha512-bJOHrYOPqJZCkPVbG1Lot2r5OSsB+iUOaxiHdlOeB1yPWS6evswVHwvkDLZ54WTaTRIk89ds0iHmGZSnxlPejQ== +"@babel/preset-flow@7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.8.3.tgz#52af74c6a4e80d889bd9436e8e278d0fecac6e18" + integrity sha512-iCXFk+T4demnq+dNLLvlGOgvYF6sPZ/hS1EmswugOqh1Ysp2vuiqJzpgsnp5rW8+6dLJT/0CXDzye28ZH6BAfQ== dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-flow-strip-types" "^7.0.0" + "@babel/helper-plugin-utils" "^7.8.3" + "@babel/plugin-transform-flow-strip-types" "^7.8.3" -"@babel/register@^7.7.0": - version "7.7.0" - resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.7.0.tgz#4e23ecf840296ef79c605baaa5c89e1a2426314b" - integrity sha512-HV3GJzTvSoyOMWGYn2TAh6uL6g+gqKTgEZ99Q3+X9UURT1VPT/WcU46R61XftIc5rXytcOHZ4Z0doDlsjPomIg== +"@babel/register@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.8.3.tgz#5d5d30cfcc918437535d724b8ac1e4a60c5db1f8" + integrity sha512-t7UqebaWwo9nXWClIPLPloa5pN33A2leVs8Hf0e9g9YwUP8/H9NeR7DJU+4CXo23QtjChQv5a3DjEtT83ih1rg== dependencies: find-cache-dir "^2.0.0" lodash "^4.17.13" @@ -843,10 +939,10 @@ pirates "^4.0.0" source-map-support "^0.5.16" -"@babel/runtime@^7.7.2": - version "7.7.2" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.7.2.tgz#111a78002a5c25fc8e3361bedc9529c696b85a6a" - integrity sha512-JONRbXbTXc9WQE2mAZd1p0Z3DZ/6vaQIkgYMSTP3KjRCyd7rCZCcfhCyX+YjwcKxcZ82UrxbRD358bpExNgrjw== +"@babel/runtime@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.8.4.tgz#d79f5a2040f7caa24d53e563aad49cbc05581308" + integrity sha512-neAp3zt80trRVBI1x0azq6c57aNBqYZH8KhMm3TaB7wEI5Q4A2SHfBHE8w9gOhI/lrqxtEbXZgQIrHP+wvSGwQ== dependencies: regenerator-runtime "^0.13.2" @@ -859,7 +955,7 @@ "@babel/parser" "^7.4.4" "@babel/types" "^7.4.4" -"@babel/template@^7.4.0", "@babel/template@^7.7.0": +"@babel/template@^7.7.0": version "7.7.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.7.0.tgz#4fadc1b8e734d97f56de39c77de76f2562e597d0" integrity sha512-OKcwSYOW1mhWbnTBgQY5lvg1Fxg+VyfQGjcBduZFljfc044J5iDlnDSfhQ867O17XHiSCxYHUxHg2b7ryitbUQ== @@ -868,7 +964,16 @@ "@babel/parser" "^7.7.0" "@babel/types" "^7.7.0" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5": +"@babel/template@^7.7.4", "@babel/template@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.3.tgz#e02ad04fe262a657809327f578056ca15fd4d1b8" + integrity sha512-04m87AcQgAFdvuoyiQ2kgELr2tV8B4fP/xJAVUL3Yb3bkNdMedD3d0rlSQr3PegP0cms3eHjl1F7PWlvWbU8FQ== + dependencies: + "@babel/code-frame" "^7.8.3" + "@babel/parser" "^7.8.3" + "@babel/types" "^7.8.3" + +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.5.tgz#f664f8f368ed32988cd648da9f72d5ca70f165bb" integrity sha512-MqB0782whsfffYfSjH4TM+LMjrJnhCNEDMDIjeTpl+ASaUvxcjoiVCo/sM1GhS1pHOXYfWVCYneLjMckuUxDaQ== @@ -883,7 +988,7 @@ globals "^11.1.0" lodash "^4.17.13" -"@babel/traverse@^7.4.3", "@babel/traverse@^7.7.0", "@babel/traverse@^7.7.2": +"@babel/traverse@^7.7.0", "@babel/traverse@^7.7.2": version "7.7.2" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.7.2.tgz#ef0a65e07a2f3c550967366b3d9b62a2dcbeae09" integrity sha512-TM01cXib2+rgIZrGJOLaHV/iZUAxf4A0dt5auY6KNZ+cm6aschuJGqKJM3ROTt3raPUdIDk9siAufIFEleRwtw== @@ -898,6 +1003,21 @@ globals "^11.1.0" lodash "^4.17.13" +"@babel/traverse@^7.7.4", "@babel/traverse@^7.8.3", "@babel/traverse@^7.8.4": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.8.4.tgz#f0845822365f9d5b0e312ed3959d3f827f869e3c" + integrity sha512-NGLJPZwnVEyBPLI+bl9y9aSnxMhsKz42so7ApAv9D+b4vAFPpY013FTS9LdKxcABoIYFU52HcYga1pPlx454mg== + dependencies: + "@babel/code-frame" "^7.8.3" + "@babel/generator" "^7.8.4" + "@babel/helper-function-name" "^7.8.3" + "@babel/helper-split-export-declaration" "^7.8.3" + "@babel/parser" "^7.8.4" + "@babel/types" "^7.8.3" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.13" + "@babel/types@^7.0.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a" @@ -907,7 +1027,7 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" -"@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.7.0", "@babel/types@^7.7.1", "@babel/types@^7.7.2": +"@babel/types@^7.3.0", "@babel/types@^7.7.0", "@babel/types@^7.7.2": version "7.7.2" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.7.2.tgz#550b82e5571dcd174af576e23f0adba7ffc683f7" integrity sha512-YTf6PXoh3+eZgRCBzzP25Bugd2ngmpQVrk7kXX0i5N9BO7TFBtIgZYs7WtxtOGs8e6A4ZI7ECkbBCEHeXocvOA== @@ -916,6 +1036,20 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@babel/types@^7.8.3": + version "7.8.3" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.8.3.tgz#5a383dffa5416db1b73dedffd311ffd0788fb31c" + integrity sha512-jBD+G8+LWpMBBWvVcdr4QysjUE4mU/syrhN17o1u3gx0/WzJB1kwiVZAXRtWbsIPOwW8pF/YJV5+nmetPzepXg== + dependencies: + esutils "^2.0.2" + lodash "^4.17.13" + to-fast-properties "^2.0.0" + +"@bcoe/v8-coverage@^0.2.3": + version "0.2.3" + resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" + integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== + "@cnakazawa/watch@^1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" @@ -924,153 +1058,193 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@jest/console@^24.7.1", "@jest/console@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-24.9.0.tgz#79b1bc06fb74a8cfb01cbdedf945584b1b9707f0" - integrity sha512-Zuj6b8TnKXi3q4ymac8EQfc3ea/uhLeCGThFqXeC8H9/raaH8ARPUTdId+XyGd03Z4In0/VjD2OYFcBF09fNLQ== +"@istanbuljs/load-nyc-config@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@istanbuljs/load-nyc-config/-/load-nyc-config-1.0.0.tgz#10602de5570baea82f8afbfa2630b24e7a8cfe5b" + integrity sha512-ZR0rq/f/E4f4XcgnDvtMWXCUJpi8eO0rssVhmztsZqLIEFA9UUP9zmpE0VxlM+kv/E1ul2I876Fwil2ayptDVg== dependencies: - "@jest/source-map" "^24.9.0" - chalk "^2.0.1" - slash "^2.0.0" + camelcase "^5.3.1" + find-up "^4.1.0" + js-yaml "^3.13.1" + resolve-from "^5.0.0" + +"@istanbuljs/schema@^0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.2.tgz#26520bf09abe4a5644cd5414e37125a8954241dd" + integrity sha512-tsAQNx32a8CoFhjhijUIhI4kccIAgmGhy8LZMZgGfmXcpMbPRUqn5LWmgRttILi6yeGmBJd2xsPkFMs0PzgPCw== -"@jest/core@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-24.9.0.tgz#2ceccd0b93181f9c4850e74f2a9ad43d351369c4" - integrity sha512-Fogg3s4wlAr1VX7q+rhV9RVnUv5tD7VuWfYy1+whMiWUrvl7U3QJSJyWcDio9Lq2prqYsZaeTv2Rz24pWGkJ2A== - dependencies: - "@jest/console" "^24.7.1" - "@jest/reporters" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/transform" "^24.9.0" - "@jest/types" "^24.9.0" - ansi-escapes "^3.0.0" - chalk "^2.0.1" +"@jest/console@^25.1.0": + version "25.1.0" + resolved "https://registry.yarnpkg.com/@jest/console/-/console-25.1.0.tgz#1fc765d44a1e11aec5029c08e798246bd37075ab" + integrity sha512-3P1DpqAMK/L07ag/Y9/Jup5iDEG9P4pRAuZiMQnU0JB3UOvCyYCjCoxr7sIA80SeyUCUKrr24fKAxVpmBgQonA== + dependencies: + "@jest/source-map" "^25.1.0" + chalk "^3.0.0" + jest-util "^25.1.0" + slash "^3.0.0" + +"@jest/core@^25.1.0": + version "25.1.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-25.1.0.tgz#3d4634fc3348bb2d7532915d67781cdac0869e47" + integrity sha512-iz05+NmwCmZRzMXvMo6KFipW7nzhbpEawrKrkkdJzgytavPse0biEnCNr2wRlyCsp3SmKaEY+SGv7YWYQnIdig== + dependencies: + "@jest/console" "^25.1.0" + "@jest/reporters" "^25.1.0" + "@jest/test-result" "^25.1.0" + "@jest/transform" "^25.1.0" + "@jest/types" "^25.1.0" + ansi-escapes "^4.2.1" + chalk "^3.0.0" exit "^0.1.2" - graceful-fs "^4.1.15" - jest-changed-files "^24.9.0" - jest-config "^24.9.0" - jest-haste-map "^24.9.0" - jest-message-util "^24.9.0" - jest-regex-util "^24.3.0" - jest-resolve "^24.9.0" - jest-resolve-dependencies "^24.9.0" - jest-runner "^24.9.0" - jest-runtime "^24.9.0" - jest-snapshot "^24.9.0" - jest-util "^24.9.0" - jest-validate "^24.9.0" - jest-watcher "^24.9.0" - micromatch "^3.1.10" - p-each-series "^1.0.0" + graceful-fs "^4.2.3" + jest-changed-files "^25.1.0" + jest-config "^25.1.0" + jest-haste-map "^25.1.0" + jest-message-util "^25.1.0" + jest-regex-util "^25.1.0" + jest-resolve "^25.1.0" + jest-resolve-dependencies "^25.1.0" + jest-runner "^25.1.0" + jest-runtime "^25.1.0" + jest-snapshot "^25.1.0" + jest-util "^25.1.0" + jest-validate "^25.1.0" + jest-watcher "^25.1.0" + micromatch "^4.0.2" + p-each-series "^2.1.0" realpath-native "^1.1.0" - rimraf "^2.5.4" - slash "^2.0.0" - strip-ansi "^5.0.0" - -"@jest/environment@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-24.9.0.tgz#21e3afa2d65c0586cbd6cbefe208bafade44ab18" - integrity sha512-5A1QluTPhvdIPFYnO3sZC3smkNeXPVELz7ikPbhUj0bQjB07EoE9qtLrem14ZUYWdVayYbsjVwIiL4WBIMV4aQ== - dependencies: - "@jest/fake-timers" "^24.9.0" - "@jest/transform" "^24.9.0" - "@jest/types" "^24.9.0" - jest-mock "^24.9.0" - -"@jest/fake-timers@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-24.9.0.tgz#ba3e6bf0eecd09a636049896434d306636540c93" - integrity sha512-eWQcNa2YSwzXWIMC5KufBh3oWRIijrQFROsIqt6v/NS9Io/gknw1jsAC9c+ih/RQX4A3O7SeWAhQeN0goKhT9A== - dependencies: - "@jest/types" "^24.9.0" - jest-message-util "^24.9.0" - jest-mock "^24.9.0" - -"@jest/reporters@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-24.9.0.tgz#86660eff8e2b9661d042a8e98a028b8d631a5b43" - integrity sha512-mu4X0yjaHrffOsWmVLzitKmmmWSQ3GGuefgNscUSWNiUNcEOSEQk9k3pERKEQVBb0Cnn88+UESIsZEMH3o88Gw== - dependencies: - "@jest/environment" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/transform" "^24.9.0" - "@jest/types" "^24.9.0" - chalk "^2.0.1" + rimraf "^3.0.0" + slash "^3.0.0" + strip-ansi "^6.0.0" + +"@jest/environment@^25.1.0": + version "25.1.0" + resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-25.1.0.tgz#4a97f64770c9d075f5d2b662b5169207f0a3f787" + integrity sha512-cTpUtsjU4cum53VqBDlcW0E4KbQF03Cn0jckGPW/5rrE9tb+porD3+hhLtHAwhthsqfyF+bizyodTlsRA++sHg== + dependencies: + "@jest/fake-timers" "^25.1.0" + "@jest/types" "^25.1.0" + jest-mock "^25.1.0" + +"@jest/fake-timers@^25.1.0": + version "25.1.0" + resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-25.1.0.tgz#a1e0eff51ffdbb13ee81f35b52e0c1c11a350ce8" + integrity sha512-Eu3dysBzSAO1lD7cylZd/CVKdZZ1/43SF35iYBNV1Lvvn2Undp3Grwsv8PrzvbLhqwRzDd4zxrY4gsiHc+wygQ== + dependencies: + "@jest/types" "^25.1.0" + jest-message-util "^25.1.0" + jest-mock "^25.1.0" + jest-util "^25.1.0" + lolex "^5.0.0" + +"@jest/reporters@^25.1.0": + version "25.1.0" + resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-25.1.0.tgz#9178ecf136c48f125674ac328f82ddea46e482b0" + integrity sha512-ORLT7hq2acJQa8N+NKfs68ZtHFnJPxsGqmofxW7v7urVhzJvpKZG9M7FAcgh9Ee1ZbCteMrirHA3m5JfBtAaDg== + dependencies: + "@bcoe/v8-coverage" "^0.2.3" + "@jest/console" "^25.1.0" + "@jest/environment" "^25.1.0" + "@jest/test-result" "^25.1.0" + "@jest/transform" "^25.1.0" + "@jest/types" "^25.1.0" + chalk "^3.0.0" + collect-v8-coverage "^1.0.0" exit "^0.1.2" glob "^7.1.2" - istanbul-lib-coverage "^2.0.2" - istanbul-lib-instrument "^3.0.1" - istanbul-lib-report "^2.0.4" - istanbul-lib-source-maps "^3.0.1" - istanbul-reports "^2.2.6" - jest-haste-map "^24.9.0" - jest-resolve "^24.9.0" - jest-runtime "^24.9.0" - jest-util "^24.9.0" - jest-worker "^24.6.0" - node-notifier "^5.4.2" - slash "^2.0.0" + istanbul-lib-coverage "^3.0.0" + istanbul-lib-instrument "^4.0.0" + istanbul-lib-report "^3.0.0" + istanbul-lib-source-maps "^4.0.0" + istanbul-reports "^3.0.0" + jest-haste-map "^25.1.0" + jest-resolve "^25.1.0" + jest-runtime "^25.1.0" + jest-util "^25.1.0" + jest-worker "^25.1.0" + slash "^3.0.0" source-map "^0.6.0" - string-length "^2.0.0" + string-length "^3.1.0" + terminal-link "^2.0.0" + v8-to-istanbul "^4.0.1" + optionalDependencies: + node-notifier "^6.0.0" -"@jest/source-map@^24.3.0", "@jest/source-map@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" - integrity sha512-/Xw7xGlsZb4MJzNDgB7PW5crou5JqWiBQaz6xyPd3ArOg2nfn/PunV8+olXbbEZzNl591o5rWKE9BRDaFAuIBg== +"@jest/source-map@^25.1.0": + version "25.1.0" + resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-25.1.0.tgz#b012e6c469ccdbc379413f5c1b1ffb7ba7034fb0" + integrity sha512-ohf2iKT0xnLWcIUhL6U6QN+CwFWf9XnrM2a6ybL9NXxJjgYijjLSitkYHIdzkd8wFliH73qj/+epIpTiWjRtAA== dependencies: callsites "^3.0.0" - graceful-fs "^4.1.15" + graceful-fs "^4.2.3" source-map "^0.6.0" -"@jest/test-result@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-24.9.0.tgz#11796e8aa9dbf88ea025757b3152595ad06ba0ca" - integrity sha512-XEFrHbBonBJ8dGp2JmF8kP/nQI/ImPpygKHwQ/SY+es59Z3L5PI4Qb9TQQMAEeYsThG1xF0k6tmG0tIKATNiiA== +"@jest/test-result@^25.1.0": + version "25.1.0" + resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-25.1.0.tgz#847af2972c1df9822a8200457e64be4ff62821f7" + integrity sha512-FZzSo36h++U93vNWZ0KgvlNuZ9pnDnztvaM7P/UcTx87aPDotG18bXifkf1Ji44B7k/eIatmMzkBapnAzjkJkg== dependencies: - "@jest/console" "^24.9.0" - "@jest/types" "^24.9.0" + "@jest/console" "^25.1.0" + "@jest/transform" "^25.1.0" + "@jest/types" "^25.1.0" "@types/istanbul-lib-coverage" "^2.0.0" + collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-24.9.0.tgz#f8f334f35b625a4f2f355f2fe7e6036dad2e6b31" - integrity sha512-6qqsU4o0kW1dvA95qfNog8v8gkRN9ph6Lz7r96IvZpHdNipP2cBcb07J1Z45mz/VIS01OHJ3pY8T5fUY38tg4A== +"@jest/test-sequencer@^25.1.0": + version "25.1.0" + resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-25.1.0.tgz#4df47208542f0065f356fcdb80026e3c042851ab" + integrity sha512-WgZLRgVr2b4l/7ED1J1RJQBOharxS11EFhmwDqknpknE0Pm87HLZVS2Asuuw+HQdfQvm2aXL2FvvBLxOD1D0iw== dependencies: - "@jest/test-result" "^24.9.0" - jest-haste-map "^24.9.0" - jest-runner "^24.9.0" - jest-runtime "^24.9.0" + "@jest/test-result" "^25.1.0" + jest-haste-map "^25.1.0" + jest-runner "^25.1.0" + jest-runtime "^25.1.0" -"@jest/transform@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-24.9.0.tgz#4ae2768b296553fadab09e9ec119543c90b16c56" - integrity sha512-TcQUmyNRxV94S0QpMOnZl0++6RMiqpbH/ZMccFB/amku6Uwvyb1cjYX7xkp5nGNkbX4QPH/FcB6q1HBTHynLmQ== +"@jest/transform@^25.1.0": + version "25.1.0" + resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-25.1.0.tgz#221f354f512b4628d88ce776d5b9e601028ea9da" + integrity sha512-4ktrQ2TPREVeM+KxB4zskAT84SnmG1vaz4S+51aTefyqn3zocZUnliLLm5Fsl85I3p/kFPN4CRp1RElIfXGegQ== dependencies: "@babel/core" "^7.1.0" - "@jest/types" "^24.9.0" - babel-plugin-istanbul "^5.1.0" - chalk "^2.0.1" + "@jest/types" "^25.1.0" + babel-plugin-istanbul "^6.0.0" + chalk "^3.0.0" convert-source-map "^1.4.0" fast-json-stable-stringify "^2.0.0" - graceful-fs "^4.1.15" - jest-haste-map "^24.9.0" - jest-regex-util "^24.9.0" - jest-util "^24.9.0" - micromatch "^3.1.10" + graceful-fs "^4.2.3" + jest-haste-map "^25.1.0" + jest-regex-util "^25.1.0" + jest-util "^25.1.0" + micromatch "^4.0.2" pirates "^4.0.1" realpath-native "^1.1.0" - slash "^2.0.0" + slash "^3.0.0" source-map "^0.6.1" - write-file-atomic "2.4.1" + write-file-atomic "^3.0.0" -"@jest/types@^24.9.0": - version "24.9.0" - resolved "https://registry.yarnpkg.com/@jest/types/-/types-24.9.0.tgz#63cb26cb7500d069e5a389441a7c6ab5e909fc59" - integrity sha512-XKK7ze1apu5JWQ5eZjHITP66AX+QsLlbaJRBGYr8pNzwcAE2JVkwnf0yqjHTsDRcjR0mujy/NmZMXw5kl+kGBw== +"@jest/types@^25.1.0": + version "25.1.0" + resolved "https://registry.yarnpkg.com/@jest/types/-/types-25.1.0.tgz#b26831916f0d7c381e11dbb5e103a72aed1b4395" + integrity sha512-VpOtt7tCrgvamWZh1reVsGADujKigBUFTi19mlRjqEGsE8qH4r3s+skY33dNdXOwyZIvuftZ5tqdF1IgsMejMA== dependencies: "@types/istanbul-lib-coverage" "^2.0.0" "@types/istanbul-reports" "^1.1.1" - "@types/yargs" "^13.0.0" + "@types/yargs" "^15.0.0" + chalk "^3.0.0" + +"@jsdevtools/version-bump-prompt@6.0.0": + version "6.0.0" + resolved "https://registry.yarnpkg.com/@jsdevtools/version-bump-prompt/-/version-bump-prompt-6.0.0.tgz#0229b0bd5ba852ab46885e9cacf9b94e058f1ddb" + integrity sha512-TL/4IQJFKrDVpcVvLaISrfJcxvBIeO/OPcwNvFd7+A3dWq61b2uoTMd1r7eImUCuNYdR9P6CIDq+QtMi0SbqeQ== + dependencies: + command-line-args "^5.1.1" + detect-indent "^6.0.0" + detect-newline "^3.1.0" + ez-spawn "^2.1.6" + globby "^11.0.0" + inquirer "^7.0.1" + log-symbols "^3.0.0" + semver "^7.1.1" "@nodelib/fs.scandir@2.1.3": version "2.1.3" @@ -1093,15 +1267,22 @@ "@nodelib/fs.scandir" "2.1.3" fastq "^1.6.0" -"@trezor/blockchain-link@^1.0.6": - version "1.0.6" - resolved "https://registry.yarnpkg.com/@trezor/blockchain-link/-/blockchain-link-1.0.6.tgz#8b6945f15c216289c727a3d3c108cb4f508c8a3a" - integrity sha512-pHskSzzcUaWw/8YTGCbIy0tIItCXcYVwCjTDoqxqQ9cTc/jjEMQOO5w+hRPOlEBf6RvVJaf9OId/nWeRy3LSnw== +"@sinonjs/commons@^1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.7.0.tgz#f90ffc52a2e519f018b13b6c4da03cbff36ebed6" + integrity sha512-qbk9AP+cZUsKdW1GJsBpxPKFmCJ0T8swwzVje3qFd+AkQb74Q/tiuzrdfFg8AD2g5HH/XbE/I8Uc1KYHVYWfhg== + dependencies: + type-detect "4.0.8" + +"@trezor/blockchain-link@^1.0.7": + version "1.0.7" + resolved "https://registry.yarnpkg.com/@trezor/blockchain-link/-/blockchain-link-1.0.7.tgz#a9f3b84a707714f784e275b4f510135410b2bbc2" + integrity sha512-z8ZW+gdY2AXCuCOSw3LJTWyyWnS+92HA0d8JojJ5+SVOGkAA8m0F9+w06sFTzGnFPpY8S6WPzHJJf8yvnWlhoA== dependencies: es6-promise "^4.2.8" - events "^3.0.0" + events "^3.1.0" -"@trezor/utxo-lib@0.1.0": +"@trezor/utxo-lib@0.1.0", "@trezor/utxo-lib@^0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@trezor/utxo-lib/-/utxo-lib-0.1.0.tgz#f7a60d514ab75bef2f2206200cf0317d2d8523b2" integrity sha512-jkqFRKL++xTga3xUgu5pWw1ArzTfraK0unXuj31V9g6wu+MKPbvcXW1+tMOVh+WNZZ3QUSGSQNNflSyh+qD0Vw== @@ -1166,6 +1347,11 @@ dependencies: "@types/node" "*" +"@types/color-name@^1.1.1": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" + integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ== + "@types/events@*": version "3.0.0" resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" @@ -1180,7 +1366,7 @@ "@types/minimatch" "*" "@types/node" "*" -"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": +"@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0", "@types/istanbul-lib-coverage@^2.0.1": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" integrity sha512-hRJD2ahnnpLgsj6KWMYSrmXkM3rm2Dl1qkx6IOFD5FnuNPXJIG5L0dhgKXCYTRMGzU4n0wImQ/xfmRc4POUFlg== @@ -1225,10 +1411,10 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== -"@types/ws@^6.0.3": - version "6.0.3" - resolved "https://registry.yarnpkg.com/@types/ws/-/ws-6.0.3.tgz#b772375ba59d79066561c8d87500144d674ba6b3" - integrity sha512-yBTM0P05Tx9iXGq00BbJPo37ox68R5vaGTXivs6RGh/BQ6QP5zqZDGWdAO6JbRE/iR1l80xeGAwCQS2nMV9S/w== +"@types/ws@^7.2.0": + version "7.2.1" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-7.2.1.tgz#b800f2b8aee694e2b581113643e20d79dd3b8556" + integrity sha512-UEmRNbXFGvfs/sLncf01GuVv6U1mZP3Df0iXWx4kUlikJxbFyFADp95mDn1XDTE2mXpzzoHcKlfFcbytLq4vaA== dependencies: "@types/node" "*" @@ -1237,10 +1423,10 @@ resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228" integrity sha512-gCubfBUZ6KxzoibJ+SCUc/57Ms1jz5NjHe4+dI2krNmU5zCPAphyLJYyTOg06ueIyfj+SaCUqmzun7ImlxDcKg== -"@types/yargs@^13.0.0": - version "13.0.3" - resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-13.0.3.tgz#76482af3981d4412d65371a318f992d33464a380" - integrity sha512-K8/LfZq2duW33XW/tFwEAfnZlqIfVsoyRB3kfXdPXYhl0nfM8mmh7GS0jg7WrX2Dgq/0Ha/pR1PaR+BvmWwjiQ== +"@types/yargs@^15.0.0": + version "15.0.3" + resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-15.0.3.tgz#41453a0bc7ab393e995d1f5451455638edbd2baf" + integrity sha512-XCMQRK6kfpNBixHLyHUsGmXrpEmFFxzMrcnSXFMziHd8CoNJo8l16FkHyQq4x+xbM7E2XL83/O78OD8u+iZTdQ== dependencies: "@types/yargs-parser" "*" @@ -1439,7 +1625,7 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.7: mime-types "~2.1.24" negotiator "0.6.2" -acorn-globals@^4.1.0: +acorn-globals@^4.3.2: version "4.3.4" resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-4.3.4.tgz#9fa1926addc11c97308c4e66d7add0d40c3272e7" integrity sha512-clfQEh21R+D0leSbUdWf3OcfqyaCSAQ8Ryq00bofSekfr9W8u1jyYZo6ir0xu9Gtcf7BjcHJpnbZH7JOCpP60A== @@ -1457,11 +1643,6 @@ acorn-walk@^6.0.1: resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-6.2.0.tgz#123cb8f3b84c2171f1f7fb252615b1c78a6b1a8c" integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA== -acorn@^5.5.3: - version "5.7.3" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" - integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== - acorn@^6.0.1, acorn@^6.2.1: version "6.3.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" @@ -1477,12 +1658,10 @@ after@0.8.2: resolved "https://registry.yarnpkg.com/after/-/after-0.8.2.tgz#fedb394f9f0e02aa9768e702bda23b505fae7e1f" integrity sha1-/ts5T58OAqqXaOcCvaI7UF+ufh8= -agent-base@^4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-4.3.0.tgz#8165f01c436009bccad0b1d122f05ed770efc6ee" - integrity sha512-salcGninV0nPrwpGNn4VTXBb1SOuXQBiqbrNXoeizJsHrsL6ERFM2Ne3JUSBWRE6aeNJI2ROP/WEEIDUiDe3cg== - dependencies: - es6-promisify "^5.0.0" +agent-base@5: + version "5.1.1" + resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-5.1.1.tgz#e8fb3f242959db44d63be665db7a8e739537a32c" + integrity sha512-TMeqbNl2fMW0nMjTEPOwe3J/PRFP4vqeoNuQMG0HlMrtm5QxKqdvAkZ1pRBQ/ulIyDD5Yq0nJ7YbdD8ey0TO3g== aggregate-error@^3.0.0: version "3.0.1" @@ -1522,11 +1701,6 @@ ansi-colors@^3.0.0: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf" integrity sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA== -ansi-escapes@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b" - integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ== - ansi-escapes@^4.2.1: version "4.2.1" resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.2.1.tgz#4dccdb846c3eee10f6d64dea66273eab90c37228" @@ -1549,11 +1723,16 @@ ansi-regex@^3.0.0: resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= -ansi-regex@^4.0.0, ansi-regex@^4.1.0: +ansi-regex@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-4.1.0.tgz#8b9f8f08cf1acb843756a839ca8c7e3168c51997" integrity sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg== +ansi-regex@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-5.0.0.tgz#388539f55179bf39339c81af30a654d69f87cb75" + integrity sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg== + ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" @@ -1566,6 +1745,14 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" +ansi-styles@^4.0.0, ansi-styles@^4.1.0: + version "4.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359" + integrity sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA== + dependencies: + "@types/color-name" "^1.1.1" + color-convert "^2.0.1" + any-promise@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f" @@ -1587,6 +1774,14 @@ anymatch@^3.0.1: normalize-path "^3.0.0" picomatch "^2.0.4" +anymatch@^3.0.3: + version "3.1.1" + resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.1.tgz#c55ecf02185e2469259399310c173ce31233b142" + integrity sha512-mM8522psRCqzV+6LhomX5wgp25YVibjh8Wj23I5RPkPppSVSjyKD2A2mBJmWGa+KN7f2D6LNh9jkBCeyLktzjg== + dependencies: + normalize-path "^3.0.0" + picomatch "^2.0.4" + aproba@^1.0.3, aproba@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/aproba/-/aproba-1.2.0.tgz#6802e6264efd18c790a1b0d517f0f2627bf2c94a" @@ -1875,18 +2070,18 @@ babel-helpers@^6.24.1: babel-runtime "^6.22.0" babel-template "^6.24.1" -babel-jest@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-24.9.0.tgz#3fc327cb8467b89d14d7bc70e315104a783ccd54" - integrity sha512-ntuddfyiN+EhMw58PTNL1ph4C9rECiQXjI4nMMBKBaNjXvqLdkXpPRcMSr4iyBrJg/+wz9brFUD6RhOAT6r4Iw== +babel-jest@25.1.0, babel-jest@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-25.1.0.tgz#206093ac380a4b78c4404a05b3277391278f80fb" + integrity sha512-tz0VxUhhOE2y+g8R2oFrO/2VtVjA1lkJeavlhExuRBg3LdNJY9gwQ+Vcvqt9+cqy71MCTJhewvTB7Qtnnr9SWg== dependencies: - "@jest/transform" "^24.9.0" - "@jest/types" "^24.9.0" + "@jest/transform" "^25.1.0" + "@jest/types" "^25.1.0" "@types/babel__core" "^7.1.0" - babel-plugin-istanbul "^5.1.0" - babel-preset-jest "^24.9.0" - chalk "^2.4.2" - slash "^2.0.0" + babel-plugin-istanbul "^6.0.0" + babel-preset-jest "^25.1.0" + chalk "^3.0.0" + slash "^3.0.0" babel-loader@^8.0.0: version "8.0.6" @@ -1912,20 +2107,21 @@ babel-plugin-dynamic-import-node@^2.3.0: dependencies: object.assign "^4.1.0" -babel-plugin-istanbul@^5.1.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-5.2.0.tgz#df4ade83d897a92df069c4d9a25cf2671293c854" - integrity sha512-5LphC0USA8t4i1zCtjbbNb6jJj/9+X6P37Qfirc/70EQ34xKlMW+a1RHGwxGI+SwWpNwZ27HqvzAobeqaXwiZw== +babel-plugin-istanbul@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-6.0.0.tgz#e159ccdc9af95e0b570c75b4573b7c34d671d765" + integrity sha512-AF55rZXpe7trmEylbaE1Gv54wn6rwU03aptvRoVIGP8YykoSxqdVLV1TfwflBCE/QtHmqtP8SWlTENqbK8GCSQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" - find-up "^3.0.0" - istanbul-lib-instrument "^3.3.0" - test-exclude "^5.2.3" + "@istanbuljs/load-nyc-config" "^1.0.0" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-instrument "^4.0.0" + test-exclude "^6.0.0" -babel-plugin-jest-hoist@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-24.9.0.tgz#4f837091eb407e01447c8843cbec546d0002d756" - integrity sha512-2EMA2P8Vp7lG0RAzr4HXqtYwacfMErOuv1U3wrvxHX6rD1sV6xS3WXG3r8TRQ2r6w8OhvSdWt+z41hQNwNm3Xw== +babel-plugin-jest-hoist@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-25.1.0.tgz#fb62d7b3b53eb36c97d1bc7fec2072f9bd115981" + integrity sha512-oIsopO41vW4YFZ9yNYoLQATnnN46lp+MZ6H4VvPKFkcc2/fkl3CfE/NZZSmnEIEsJRmJAgkVEK0R7Zbl50CpTw== dependencies: "@types/babel__traverse" "^7.0.6" @@ -1941,13 +2137,14 @@ babel-plugin-tester@^3.0.0: path-exists "^3.0.0" strip-indent "^2.0.0" -babel-preset-jest@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc" - integrity sha512-izTUuhE4TMfTRPF92fFwD2QfdXaZW08qvWTFCI51V8rW5x00UuPgc3ajRoWofXOuxjfcOM5zzSYsQS3H8KGCAg== +babel-preset-jest@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-25.1.0.tgz#d0aebfebb2177a21cde710996fce8486d34f1d33" + integrity sha512-eCGn64olaqwUMaugXsTtGAM2I0QTahjEtnRu0ql8Ie+gDWAc1N6wqN0k2NilnyTunM69Pad7gJY7LOtwLimoFQ== dependencies: + "@babel/plugin-syntax-bigint" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.0.0" - babel-plugin-jest-hoist "^24.9.0" + babel-plugin-jest-hoist "^25.1.0" babel-register@^6.26.0: version "6.26.0" @@ -1962,13 +2159,6 @@ babel-register@^6.26.0: mkdirp "^0.5.1" source-map-support "^0.4.15" -babel-runtime@^5.8.20: - version "5.8.38" - resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-5.8.38.tgz#1c0b02eb63312f5f087ff20450827b425c9d4c19" - integrity sha1-HAsC62MxL18If/IEUIJ7QlydTBk= - dependencies: - core-js "^1.0.0" - babel-runtime@^6.22.0, babel-runtime@^6.26.0, babel-runtime@^6.6.1: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" @@ -2035,11 +2225,6 @@ base-x@3.0.4: dependencies: safe-buffer "^5.0.1" -base-x@^1.0.1: - version "1.1.0" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-1.1.0.tgz#42d3d717474f9ea02207f6d1aa1f426913eeb7ac" - integrity sha1-QtPXF0dPnqAiB/bRqh9CaRPut6w= - base-x@^3.0.2: version "3.0.6" resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.6.tgz#de047ec95f5f7b99ae63d830a2a894c96538b2cd" @@ -2080,13 +2265,13 @@ batch@0.6.1: resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" integrity sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY= -bchaddrjs@0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/bchaddrjs/-/bchaddrjs-0.4.4.tgz#9f52ce67ea84181ba45c43a930cba5abeb59ff3f" - integrity sha512-WCgxhGeJ4LVwtMjiCzwAJd6OsBWd/fgYuhYbFhVvMrjhIurIqirYKWkwJVjNO+Xxa9K0SntFR2taxod03MKEHA== +bchaddrjs@0.4.5: + version "0.4.5" + resolved "https://registry.yarnpkg.com/bchaddrjs/-/bchaddrjs-0.4.5.tgz#4b8ca28d7b5f2e1d0e5056b40021be0405f701fd" + integrity sha512-ZmGjcI7KyleD39YkNqm02YhSEwRH1IPxcQ1eKgQHOQtnaJB1JN5ZymtNrzxFPKE2Cgza2yXBETgq99+0fknq/A== dependencies: bs58check "^2.1.2" - cashaddrjs "^0.3.8" + cashaddrjs "^0.3.9" bchaddrjs@^0.3.2: version "0.3.2" @@ -2135,11 +2320,6 @@ bigi@^1.1.0, bigi@^1.4.0, bigi@^1.4.1: resolved "https://registry.yarnpkg.com/bigi/-/bigi-1.4.2.tgz#9c665a95f88b8b08fc05cfd731f561859d725825" integrity sha1-nGZalfiLiwj8Bc/XMfVhhZ1yWCU= -bignumber.js@8.1.1: - version "8.1.1" - resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-8.1.1.tgz#4b072ae5aea9c20f6730e4e5d529df1271c4d885" - integrity sha512-QD46ppGintwPGuL1KqmwhR0O+N2cZUg8JG/VzwI2e28sM9TqHjQB10lI4QAaMHVbLzwVLLAwEglpKPViWX+5NQ== - bignumber.js@^9.0.0: version "9.0.0" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.0.tgz#805880f84a329b5eac6e7cb6f8274b6d82bdf075" @@ -2155,7 +2335,7 @@ binary-extensions@^2.0.0: resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" integrity sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow== -bindings@^1.2.1, bindings@^1.5.0: +bindings@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.5.0.tgz#10353c9e945334bc0511a6d90b38fbc7c9c504df" integrity sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ== @@ -2180,9 +2360,9 @@ bitcoin-ops@^1.3.0: dependencies: nanoassert "^1.0.0" -"blake2b@https://github.com/BitGo/blake2b#6268e6dd678661e0acc4359e9171b97eb1ebf8ac": +"blake2b@git+https://github.com/BitGo/blake2b.git#6268e6dd678661e0acc4359e9171b97eb1ebf8ac": version "2.1.3" - resolved "https://github.com/BitGo/blake2b#6268e6dd678661e0acc4359e9171b97eb1ebf8ac" + resolved "git+https://github.com/BitGo/blake2b.git#6268e6dd678661e0acc4359e9171b97eb1ebf8ac" dependencies: blake2b-wasm "https://github.com/BitGo/blake2b-wasm#193cdb71656c1a6c7f89b05d0327bb9b758d071b" nanoassert "^1.0.0" @@ -2197,16 +2377,16 @@ bluebird@^3.3.0, bluebird@^3.5.5: resolved "https://registry.yarnpkg.com/bluebird/-/bluebird-3.5.5.tgz#a8d0afd73251effbbd5fe384a77d73003c17a71f" integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w== -bn.js@^3.1.1: - version "3.3.0" - resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-3.3.0.tgz#1138e577889fdc97bbdab51844f2190dfc0ae3d7" - integrity sha1-ETjld4if3Je72rUYRPIZDfwK49c= - -bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.11.3, bn.js@^4.11.8, bn.js@^4.4.0: +bn.js@^4.0.0, bn.js@^4.1.0, bn.js@^4.1.1, bn.js@^4.11.8, bn.js@^4.4.0: version "4.11.8" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.11.8.tgz#2cde09eb5ee341f484746bb0309b3253b1b1442f" integrity sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA== +bn.js@^5.1.1: + version "5.1.1" + resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.1.1.tgz#48efc4031a9c4041b9c99c6941d903463ab62eb5" + integrity sha512-IUTD/REb78Z2eodka1QZyyEk66pciRcP6Sroka0aI3tG/iwIdYLrBD62RsubR7vqdt3WyX8p4jxeatzmRSphtA== + body-parser@1.19.0, body-parser@^1.16.1: version "1.19.0" resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.19.0.tgz#96b2709e57c9c4e09a6fd66a8fd979844f69f08a" @@ -2240,10 +2420,10 @@ boolbase@~1.0.0: resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" integrity sha1-aN/1++YMUes3cl6p4+0xDcwed24= -bowser@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.7.0.tgz#96eab1fa07fab08c1ec4c75977a7c8ddf8e0fe1f" - integrity sha512-aIlMvstvu8x+34KEiOHD3AsBgdrzg6sxALYiukOWhFvGMbQI6TRP/iY0LMhUrHs56aD6P1G0Z7h45PUJaa5m9w== +bowser@2.9.0: + version "2.9.0" + resolved "https://registry.yarnpkg.com/bowser/-/bowser-2.9.0.tgz#3bed854233b419b9a7422d9ee3e85504373821c9" + integrity sha512-2ld76tuLBNFekRgmJfT2+3j5MIrP6bFict8WAIT3beq+srz1gcKNAdNKMqHqauQt63NmAa88HfP1/Ypa9Er3HA== brace-expansion@^1.1.7: version "1.1.11" @@ -2360,14 +2540,14 @@ browserslist@^3.2.8: caniuse-lite "^1.0.30000844" electron-to-chromium "^1.3.47" -browserslist@^4.6.0, browserslist@^4.6.2: - version "4.6.6" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.6.tgz#6e4bf467cde520bc9dbdf3747dafa03531cec453" - integrity sha512-D2Nk3W9JL9Fp/gIcWei8LrERCS+eXu9AM5cfXA8WEZ84lFks+ARnZ0q/R69m2SV3Wjma83QDDPxsNKXUwdIsyA== +browserslist@^4.8.3, browserslist@^4.8.5: + version "4.8.7" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.8.7.tgz#ec8301ff415e6a42c949d0e66b405eb539c532d0" + integrity sha512-gFOnZNYBHrEyUML0xr5NJ6edFaaKbTFX9S9kQHlYfCP0Rit/boRIz4G+Avq6/4haEKJXdGGUnoolx+5MWW2BoA== dependencies: - caniuse-lite "^1.0.30000984" - electron-to-chromium "^1.3.191" - node-releases "^1.1.25" + caniuse-lite "^1.0.30001027" + electron-to-chromium "^1.3.349" + node-releases "^1.1.49" bs58@^4.0.0: version "4.0.1" @@ -2571,11 +2751,16 @@ camelcase@^5.0.0, camelcase@^5.3.1: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30000864, caniuse-lite@^1.0.30000984: +caniuse-lite@^1.0.30000844, caniuse-lite@^1.0.30000864: version "1.0.30000988" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000988.tgz#742f35ec1b8b75b9628d705d7652eea1fef983db" integrity sha512-lPj3T8poYrRc/bniW5SQPND3GRtSrQdUM/R4mCYTbZxyi3jQiggLvZH4+BYUuX0t4TXjU+vMM7KFDQg+rSzZUQ== +caniuse-lite@^1.0.30001027: + version "1.0.30001028" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001028.tgz#f2241242ac70e0fa9cda55c2776d32a0867971c2" + integrity sha512-Vnrq+XMSHpT7E+LWoIYhs3Sne8h9lx9YJV3acH3THNCwU/9zV93/ta4xVfzTtnqd3rvnuVpVjE3DFqf56tr3aQ== + capture-exit@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" @@ -2595,14 +2780,14 @@ cashaddrjs@^0.3.3: dependencies: big-integer "1.6.36" -cashaddrjs@^0.3.8: - version "0.3.8" - resolved "https://registry.yarnpkg.com/cashaddrjs/-/cashaddrjs-0.3.8.tgz#fc391bccccef7ec7e0523195a3b1e5df45893bf5" - integrity sha512-gpXj9Qki9noucK0ahPB6dx9A539KQ4TbqKLwl/JsCvD4iLLu1thtoAIDy2hwP6PWg6o1nvK+igsutMA6OvO2Mg== +cashaddrjs@^0.3.9: + version "0.3.9" + resolved "https://registry.yarnpkg.com/cashaddrjs/-/cashaddrjs-0.3.9.tgz#e98078cf61061e0c5c865a95924d06a6b9ced020" + integrity sha512-2FyYuNnIICPsEZvuC0NWNQgw+OFCpGdUyVl9Jmj3sunyH8cHfkaZq7EADKngEO/pI2OOwDvVMQN8k62xev7+aw== dependencies: big-integer "1.6.36" -chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1, chalk@^2.4.2: +chalk@2.4.2, chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -2622,6 +2807,14 @@ chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" +chalk@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-3.0.0.tgz#3f73c2bf526591f574cc492c51e2456349f844e4" + integrity sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" @@ -2770,6 +2963,15 @@ cliui@^5.0.0: strip-ansi "^5.2.0" wrap-ansi "^5.1.0" +cliui@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/cliui/-/cliui-6.0.0.tgz#511d702c0c4e41ca156d7d0e96021f23e13225b1" + integrity sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^6.2.0" + clone-deep@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" @@ -2794,6 +2996,11 @@ code-point-at@^1.0.0: resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" integrity sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c= +collect-v8-coverage@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collect-v8-coverage/-/collect-v8-coverage-1.0.0.tgz#150ee634ac3650b71d9c985eb7f608942334feb1" + integrity sha512-VKIhJgvk8E1W28m5avZ2Gv2Ruv5YiF56ug2oclvaG9md69BuZImMG2sk9g7QNKLUbtYAKQjXjYxbYZVUlMMKmQ== + collection-visit@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" @@ -2809,11 +3016,23 @@ color-convert@^1.9.0: dependencies: color-name "1.1.3" +color-convert@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/color-convert/-/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3" + integrity sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ== + dependencies: + color-name "~1.1.4" + color-name@1.1.3: version "1.1.3" resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25" integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU= +color-name@~1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" + integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== + colors@^1.1.0: version "1.3.3" resolved "https://registry.yarnpkg.com/colors/-/colors-1.3.3.tgz#39e005d546afe01e01f9c4ca8fa50f686a01205d" @@ -2853,11 +3072,16 @@ commander@2.8.x: dependencies: graceful-readlink ">= 1.0.0" -commander@^2.20.0, commander@^2.8.1: +commander@^2.20.0: version "2.20.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422" integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ== +commander@^4.0.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" + integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== + commander@~2.13.0: version "2.13.0" resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c" @@ -2868,11 +3092,6 @@ commander@~2.19.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a" integrity sha512-6tvAOO+D6OENvRAh524Dh9jcfKTYDQAqvqezbCW82xj5X0pSrcpxtvRKHLG0yBY6SD7PSDrJaj+0AiOcKVd1Xg== -commander@~2.20.3: - version "2.20.3" - resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" - integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== - common-tags@^1.4.0: version "1.8.0" resolved "https://registry.yarnpkg.com/common-tags/-/common-tags-1.8.0.tgz#8e3153e542d4a39e9b10554434afaaf98956a937" @@ -2989,7 +3208,7 @@ convert-source-map@^1.1.0, convert-source-map@^1.5.1: dependencies: safe-buffer "~5.1.1" -convert-source-map@^1.4.0, convert-source-map@^1.7.0: +convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.7.0.tgz#17a2cb882d7f77d3490585e2ce6c524424a3a442" integrity sha512-4FJkXzKXEDB1snCFZlLP4gpC3JILicCpGbzG9f9G7tGqGCzETQ2hWPrcinA9oU4wtf2biUaEH5065UnMeR33oA== @@ -3046,24 +3265,13 @@ copy-webpack-plugin@5.1.1: serialize-javascript "^2.1.2" webpack-log "^2.0.0" -core-js-compat@^3.1.1: - version "3.1.4" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.1.4.tgz#e4d0c40fbd01e65b1d457980fe4112d4358a7408" - integrity sha512-Z5zbO9f1d0YrJdoaQhphVAnKPimX92D6z8lCGphH89MNRxlL1prI9ExJPqVwP0/kgkQCv8c4GJGT8X16yUncOg== +core-js-compat@^3.6.2: + version "3.6.4" + resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.6.4.tgz#938476569ebb6cda80d339bcf199fae4f16fff17" + integrity sha512-zAa3IZPvsJ0slViBQ2z+vgyyTuhd3MFn1rBQjZSKVEgB0UMYhUkCj9jJUVPgGTGqWvsBVmfnruXgTcNyTlEiSA== dependencies: - browserslist "^4.6.2" - core-js-pure "3.1.4" - semver "^6.1.1" - -core-js-pure@3.1.4: - version "3.1.4" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.1.4.tgz#5fa17dc77002a169a3566cc48dc774d2e13e3769" - integrity sha512-uJ4Z7iPNwiu1foygbcZYJsJs1jiXrTTCvxfLDXNhI/I+NHbSIEyr548y4fcsCEyWY0XgfAG/qqaunJ1SThHenA== - -core-js@^1.0.0: - version "1.2.7" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-1.2.7.tgz#652294c14651db28fa93bd2d5ff2983a4f08c636" - integrity sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY= + browserslist "^4.8.3" + semver "7.0.0" core-js@^2.4.0, core-js@^2.5.0: version "2.6.9" @@ -3122,7 +3330,7 @@ cross-spawn@6.0.5, cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" -cross-spawn@^7.0.1: +cross-spawn@^7.0.0, cross-spawn@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14" integrity sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg== @@ -3186,17 +3394,22 @@ cssesc@^3.0.0: resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-3.0.0.tgz#37741919903b868565e1c09ea747445cd18983ee" integrity sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg== -cssom@0.3.x, "cssom@>= 0.3.2 < 0.4.0": +cssom@^0.4.1: + version "0.4.4" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.4.4.tgz#5a66cf93d2d0b661d80bf6a44fb65f5c2e4e0a10" + integrity sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw== + +cssom@~0.3.6: version "0.3.8" resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== -cssstyle@^1.0.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-1.4.0.tgz#9d31328229d3c565c61e586b02041a28fccdccf1" - integrity sha512-GBrLZYZ4X4x6/QEoBnIrqb8B/f5l4+8me2dkom/j1Gtbxy0kBv6OGzKuAsGM75bkGwGAFkt56Iwg28S3XTZgSA== +cssstyle@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.2.0.tgz#e4c44debccd6b7911ed617a4395e5754bba59992" + integrity sha512-sEb3XFPx3jNnCAMtqrXPDeSgQr+jojtCeNf8cvMNMh1cG970+lljssvQDzPq6lmmJu2Vhqood/gtEomBiHOGnA== dependencies: - cssom "0.3.x" + cssom "~0.3.6" custom-event@~1.0.0: version "1.0.1" @@ -3215,7 +3428,7 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -data-urls@^1.0.0: +data-urls@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-1.1.0.tgz#15ee0582baa5e22bb59c77140da8f9c76963bbfe" integrity sha512-YTWYI9se1P55u58gL5GkQHW4P6VJBJ5iBT+B5a7i2Tjadhv52paJG0qHX4A0OR6/t52odI64KP2YvFpkDOi3eQ== @@ -3241,20 +3454,20 @@ debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9: dependencies: ms "2.0.0" -debug@^3.1.0, debug@^3.1.1, debug@^3.2.5, debug@^3.2.6: - version "3.2.6" - resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" - integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== - dependencies: - ms "^2.1.1" - -debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: +debug@4, debug@^4.0.1, debug@^4.1.0, debug@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/debug/-/debug-4.1.1.tgz#3b72260255109c6b589cee050f1d516139664791" integrity sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw== dependencies: ms "^2.1.1" +debug@^3.1.1, debug@^3.2.5, debug@^3.2.6: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + debug@~3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/debug/-/debug-3.1.0.tgz#5bb5a0672628b64149566ba16819e61518c67261" @@ -3267,10 +3480,10 @@ decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= -decimal.js@^5.0.8: - version "5.0.8" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-5.0.8.tgz#b48c3fb7d73a2d4d4940e0b38f1cd21db5b367ce" - integrity sha1-tIw/t9c6LU1JQOCzjxzSHbWzZ84= +decimal.js@^10.2.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.2.0.tgz#39466113a9e036111d02f82489b5fd6b0b5ed231" + integrity sha512-vDPw+rDgn3bZe1+F/pyEwb1oMG2XTlRVgAa6B4KccTEpYgF8w6eQllVbQcfIJnZyvzFtFpxnpGtx8dd7DJp/Rw== decode-uri-component@^0.2.0: version "0.2.0" @@ -3392,12 +3605,7 @@ detect-libc@^1.0.2: resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= -detect-newline@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-2.1.0.tgz#f41f1c10be4b00e87b5f13da680759f2c5bfd3e2" - integrity sha1-9B8cEL5LAOh7XxPaaAdZ8sW/0+I= - -detect-newline@^3.1.0: +detect-newline@^3.0.0, detect-newline@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" integrity sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA== @@ -3412,10 +3620,10 @@ di@^0.0.1: resolved "https://registry.yarnpkg.com/di/-/di-0.0.1.tgz#806649326ceaa7caa3306d75d985ea2748ba913c" integrity sha1-gGZJMmzqp8qjMG112YXqJ0i6kTw= -diff-sequences@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-24.9.0.tgz#5715d6244e2aa65f48bba0bc972db0b0b11e95b5" - integrity sha512-Dj6Wk3tWyTE+Fo1rW8v0Xhwk80um6yFYKbuAxc9c3EZxIHFDYwbi34Uk42u1CdnIiVorvt4RmlSDjIPyzGC2ew== +diff-sequences@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-25.1.0.tgz#fd29a46f1c913fd66c22645dc75bffbe43051f32" + integrity sha512-nFIfVk5B/NStCsJ+zaPO4vYuLjlzQ6uFvPxzYyHlejNZ/UGa7G/n7peOXVrVNvRuyfstt+mZQYGpjxg9Z6N8Kw== diffie-hellman@^5.0.0: version "5.0.3" @@ -3572,7 +3780,12 @@ ee-first@1.1.1: resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" integrity sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0= -electron-to-chromium@^1.3.191, electron-to-chromium@^1.3.47: +electron-to-chromium@^1.3.349: + version "1.3.354" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.354.tgz#6c6ad9ef63654c4c022269517c5a3095cebc94db" + integrity sha512-24YMkNiZWOUeF6YeoscWfIGP0oMx+lJpU/miwI+lcu7plIDpyZn8Gx0lx0qTDlzGoz7hx+lpyD8QkbkX5L2Pqw== + +electron-to-chromium@^1.3.47: version "1.3.207" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.207.tgz#b19ce94d61187d72411ebb83dfe287366a785102" integrity sha512-RIgAnfqbjZNECBLjslfy4cIYvcPl3GAXmnENrcoo0TZ8fGkyEEAealAbO7MoevW4xYUPe+e68cWAj6eP0DmMHw== @@ -3590,10 +3803,10 @@ elliptic@^6.0.0, elliptic@^6.4.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.0" -elliptic@^6.4.0: - version "6.5.1" - resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.1.tgz#c380f5f909bf1b9b4428d028cd18d3b0efd6b52b" - integrity sha512-xvJINNLbTeWQjrl6X+7eQCrIy/YPv5XCpKW6kB5mKvtnGILoLDcySuwomfdzt0BMdLNVnuRNTuzKNHj0bva1Cg== +elliptic@^6.5.2: + version "6.5.2" + resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.2.tgz#05c5678d7173c049d8ca433552224a495d0e3762" + integrity sha512-f4x70okzZbIQl/NSRLkI/+tteV/9WqL98zx+SQ69KbXxmVrmjwsNUPn/gYJJ0sHvEak24cZgHIPegRePAtA/xw== dependencies: bn.js "^4.4.0" brorand "^1.0.1" @@ -3713,13 +3926,6 @@ errno@^0.1.1, errno@^0.1.3, errno@~0.1.7: dependencies: prr "~1.0.1" -error-ex@^1.3.1: - version "1.3.2" - resolved "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf" - integrity sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g== - dependencies: - is-arrayish "^0.2.1" - es-abstract@^1.12.0, es-abstract@^1.5.1: version "1.13.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" @@ -3741,18 +3947,11 @@ es-to-primitive@^1.2.0: is-date-object "^1.0.1" is-symbol "^1.0.2" -es6-promise@^4.0.3, es6-promise@^4.2.2, es6-promise@^4.2.8: +es6-promise@^4.2.2, es6-promise@^4.2.8: version "4.2.8" resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.8.tgz#4eb21594c972bc40553d276e510539143db53e0a" integrity sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w== -es6-promisify@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/es6-promisify/-/es6-promisify-5.0.0.tgz#5109d62f3e56ea967c4b63505aef08291c8a5203" - integrity sha1-UQnWLz5W6pZ8S2NQWu8IKRyKUgM= - dependencies: - es6-promise "^4.0.3" - escape-html@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988" @@ -3763,29 +3962,29 @@ escape-string-regexp@^1.0.2, escape-string-regexp@^1.0.5: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -escodegen@^1.9.1: - version "1.12.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.12.0.tgz#f763daf840af172bb3a2b6dd7219c0e17f7ff541" - integrity sha512-TuA+EhsanGcme5T3R0L80u4t8CpbXQjegRmf7+FPTJrtCTErXFeelblRgHQa1FofEzqYYJmJ/OqjTwREp9qgmg== +escodegen@^1.11.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.1.tgz#ba01d0c8278b5e95a9a45350142026659027a457" + integrity sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ== dependencies: - esprima "^3.1.3" + esprima "^4.0.1" estraverse "^4.2.0" esutils "^2.0.2" optionator "^0.8.1" optionalDependencies: source-map "~0.6.1" -eslint-plugin-flowtype@^4.4.1: - version "4.4.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-4.4.1.tgz#b388f42bdc1237f68a8010d2ede52cd67a057e40" - integrity sha512-TNkrdJbvmBEIf02tjMKrYmLILV7OVwcvDUAnrnoGQZJhBMsu61X7E7/A1yvLTsFeDaqhbBx7rgsHzh4Yx7IqvA== +eslint-plugin-flowtype@4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-flowtype/-/eslint-plugin-flowtype-4.6.0.tgz#82b2bd6f21770e0e5deede0228e456cb35308451" + integrity sha512-W5hLjpFfZyZsXfo5anlu7HM970JBDqbEshAJUkeczP6BFCIfJXuiIBQXyberLRtOStT0OGPF8efeTbxlHk4LpQ== dependencies: lodash "^4.17.15" -eslint-plugin-jest@^23.0.3: - version "23.0.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.0.3.tgz#d3f157f7791f97713372c13259ba1dfc436eb4c1" - integrity sha512-9cNxr66zeOyz1S9AkQL4/ouilR6QHpYj8vKOQZ60fu9hAt5PJWS4KqWqfr1aqN5NFEZSPjFOla2Azn+KTWiGwg== +eslint-plugin-jest@23.7.0: + version "23.7.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.7.0.tgz#84d5603b6e745b59898cb6750df6a44782a39b04" + integrity sha512-zkiyGlvJeHNjAEz8FaIxTXNblJJ/zj3waNbYbgflK7K6uy0cpE5zJBt/JpJtOBGM/UGkC6BqsQ4n0y7kQ2HA8w== dependencies: "@typescript-eslint/experimental-utils" "^2.5.0" @@ -3827,10 +4026,10 @@ eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== -eslint@^6.6.0: - version "6.6.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.6.0.tgz#4a01a2fb48d32aacef5530ee9c5a78f11a8afd04" - integrity sha512-PpEBq7b6qY/qrOmpYQ/jTMDYfuQMELR4g4WI1M/NaSDDD/bdcMb+dj4Hgks7p41kW2caXsPsEZAEAyAgjVVC0g== +eslint@6.8.0: + version "6.8.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.8.0.tgz#62262d6729739f9275723824302fb227c8c93ffb" + integrity sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig== dependencies: "@babel/code-frame" "^7.0.0" ajv "^6.10.0" @@ -3847,7 +4046,7 @@ eslint@^6.6.0: file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" glob-parent "^5.0.0" - globals "^11.7.0" + globals "^12.1.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" @@ -3860,7 +4059,7 @@ eslint@^6.6.0: minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" - optionator "^0.8.2" + optionator "^0.8.3" progress "^2.0.0" regexpp "^2.0.1" semver "^6.1.2" @@ -3884,12 +4083,7 @@ espree@^6.1.2: acorn-jsx "^5.1.0" eslint-visitor-keys "^1.1.0" -esprima@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" - integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= - -esprima@^4.0.0: +esprima@^4.0.0, esprima@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== @@ -3938,6 +4132,11 @@ events@^3.0.0: resolved "https://registry.yarnpkg.com/events/-/events-3.0.0.tgz#9a0a0dfaf62893d92b875b8f2698ca4114973e88" integrity sha512-Dc381HFWJzEOhQ+d8pkNon++bk9h6cdAoAj4iE6Q4y6xgTzySWXlKn05/TVNpjnfRqi/X0EpJEJohPjNI3zpVA== +events@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/events/-/events-3.1.0.tgz#84279af1b34cb75aa88bf5ff291f6d0bd9b31a59" + integrity sha512-Rv+u8MLHNOdMjTAFeT3nCjHn2aGlx435FP/sDHNaRhDEMwyI/aB22Kj2qIN8R0cw3z28psEQLYwxVKLsKrMgWg== + eventsource@^1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/eventsource/-/eventsource-1.0.7.tgz#8fbc72c93fcd34088090bc0a4e64f4b5cee6d8d0" @@ -3971,6 +4170,22 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@^3.2.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-3.4.0.tgz#c08ed4550ef65d858fac269ffc8572446f37eb89" + integrity sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + human-signals "^1.1.1" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.0" + onetime "^5.1.0" + p-finally "^2.0.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" @@ -3996,17 +4211,17 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2: dependencies: homedir-polyfill "^1.0.1" -expect@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-24.9.0.tgz#b75165b4817074fa4a157794f46fe9f1ba15b6ca" - integrity sha512-wvVAx8XIol3Z5m9zvZXiyZOQ+sRJqNTIm6sGjdWlaZIeupQGO3WbYI+15D/AmEwZywL6wtJkbAbJtzkOfBuR0Q== +expect@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-25.1.0.tgz#7e8d7b06a53f7d66ec927278db3304254ee683ee" + integrity sha512-wqHzuoapQkhc3OKPlrpetsfueuEiMf3iWh0R8+duCu9PIjXoP7HgD5aeypwTnXUAjC8aMsiVDaWwlbJ1RlQ38g== dependencies: - "@jest/types" "^24.9.0" - ansi-styles "^3.2.0" - jest-get-type "^24.9.0" - jest-matcher-utils "^24.9.0" - jest-message-util "^24.9.0" - jest-regex-util "^24.9.0" + "@jest/types" "^25.1.0" + ansi-styles "^4.0.0" + jest-get-type "^25.1.0" + jest-matcher-utils "^25.1.0" + jest-message-util "^25.1.0" + jest-regex-util "^25.1.0" express@^4.17.1: version "4.17.1" @@ -4112,10 +4327,10 @@ fast-deep-equal@^2.0.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= -fast-glob@^3.0.3: - version "3.1.0" - resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.1.0.tgz#77375a7e3e6f6fc9b18f061cddd28b8d1eec75ae" - integrity sha512-TrUz3THiq2Vy3bjfQUB2wNyPdGBeGmdjbzzBLhfHN4YFurYptCKwGq/TfiRavbGywFRzY6U2CdmQ1zmsY5yYaw== +fast-glob@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.1.1.tgz#87ee30e9e9f3eb40d6f254a7997655da753d7c82" + integrity sha512-nTCREpBY8w8r+boyFYAx21iL6faSsQynliPHM4Uf56SbkyohCNxpVPEH9xrF5TXKy+IsjkPUHDKiUkzBVRXn9g== dependencies: "@nodelib/fs.stat" "^2.0.2" "@nodelib/fs.walk" "^1.2.3" @@ -4128,7 +4343,7 @@ fast-json-stable-stringify@^2.0.0: resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" integrity sha1-1RQsDK7msRifh9OnYREGT4bIu/I= -fast-levenshtein@~2.0.4, fast-levenshtein@~2.0.6: +fast-levenshtein@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" integrity sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc= @@ -4180,13 +4395,13 @@ file-entry-cache@^5.0.1: dependencies: flat-cache "^2.0.1" -file-loader@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-4.2.0.tgz#5fb124d2369d7075d70a9a5abecd12e60a95215e" - integrity sha512-+xZnaK5R8kBJrHK0/6HRlrKNamvVS5rjyuju+rnyxRGuwUJwpAMsVzUl5dz6rK8brkzjV6JpcFNjp6NqV0g1OQ== +file-loader@5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-5.0.2.tgz#7f3d8b4ac85a5e8df61338cfec95d7405f971caa" + integrity sha512-QMiQ+WBkGLejKe81HU8SZ9PovsU/5uaLo0JdTCEXOYv7i7jfAjHZi1tcwp9tSASJPOmmHZtbdCervFmXMH/Dcg== dependencies: loader-utils "^1.2.3" - schema-utils "^2.0.0" + schema-utils "^2.5.0" file-uri-to-path@1.0.0: version "1.0.0" @@ -4255,7 +4470,7 @@ find-up@^3.0.0: dependencies: locate-path "^3.0.0" -find-up@^4.0.0: +find-up@^4.0.0, find-up@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== @@ -4287,10 +4502,10 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== -flow-bin@0.116.1: - version "0.116.1" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.116.1.tgz#797964df40f2e32cad7e334583535105161434f4" - integrity sha512-ZSvjx+S4PtDNKcA4U0Afm8sHzzSlTdBBT//N2AltcaN6M/gyxAOGXjC6VkMMGqKWttw+5Psq6fU+RIvD1q/ocA== +flow-bin@0.118.0: + version "0.118.0" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.118.0.tgz#fb706364a58c682d67a2ca7df39396467dc397d1" + integrity sha512-jlbUu0XkbpXeXhan5xyTqVK1jmEKNxE8hpzznI3TThHTr76GiFwK0iRzhDo4KNy+S9h/KxHaqVhTP86vA6wHCg== flush-write-stream@^1.0.0: version "1.1.1" @@ -4416,6 +4631,11 @@ fsevents@^2.0.6: resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.0.7.tgz#382c9b443c6cbac4c57187cdda23aa3bf1ccfc2a" integrity sha512-a7YT0SV3RB+DjYcppwVDLtn13UQnmg0SWZS7ezZD0UjnLwXmy8Zm21GMVGLaFGimIqcvyMQaOJBrop8MyOp1kQ== +fsevents@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.1.2.tgz#4c0a1fb34bc68e543b4b82a9ec392bfbda840805" + integrity sha512-R4wDiBwZ0KzpgOWetKDug1FZcYhqYnUYKtfZYt4mD5SBz76q0KR4Q9o7GIPamsVPGmW3EYPPJ0dOOjvx32ldZA== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" @@ -4440,6 +4660,11 @@ gauge@~2.7.3: strip-ansi "^3.0.1" wide-align "^1.1.0" +gensync@^1.0.0-beta.1: + version "1.0.0-beta.1" + resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.1.tgz#58f4361ff987e5ff6e1e7a210827aa371eaac269" + integrity sha512-r8EC6NO1sngH/zdD9fiRDLdcgnbayXah+mLgManTaIZJqEC1MZstmnox8KpnI2/fxQwrp5OpCOYWLp4rBl4Jcg== + get-caller-file@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-1.0.3.tgz#f978fa4c90d1dfe7ff2d6beda2a515e713bdcf4a" @@ -4457,6 +4682,13 @@ get-stream@^4.0.0: dependencies: pump "^3.0.0" +get-stream@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" + integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw== + dependencies: + pump "^3.0.0" + get-value@^2.0.3, get-value@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/get-value/-/get-value-2.0.6.tgz#dc15ca1c672387ca76bd37ac0a395ba2042a2c28" @@ -4539,28 +4771,33 @@ global-prefix@^3.0.0: kind-of "^6.0.2" which "^1.3.1" -globals@^11.1.0, globals@^11.7.0: +globals@^11.1.0: version "11.12.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== +globals@^12.1.0: + version "12.3.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-12.3.0.tgz#1e564ee5c4dded2ab098b0f88f24702a3c56be13" + integrity sha512-wAfjdLgFsPZsklLJvOBUBmzYE8/CwhEqSBEMRXA3qxIiNtyqvjYurAtIfDh6chlEPUfmTY3MnZh5Hfh4q0UlIw== + dependencies: + type-fest "^0.8.1" + globals@^9.18.0: version "9.18.0" resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== -globby@^10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/globby/-/globby-10.0.1.tgz#4782c34cb75dd683351335c5829cc3420e606b22" - integrity sha512-sSs4inE1FB2YQiymcmTv6NWENryABjUNPeWhOvmn4SjtKybglsyPZxFB3U1/+L1bYi0rNZDqCLlHyLYDl1Pq5A== +globby@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.0.tgz#56fd0e9f0d4f8fb0c456f1ab0dee96e1380bc154" + integrity sha512-iuehFnR3xu5wBBtm4xi0dMe92Ob87ufyu/dHwpDYfbcpYpIbrO5OnS8M1vWvrBhSGEJ3/Ecj7gnX76P8YxpPEg== dependencies: - "@types/glob" "^7.1.1" array-union "^2.1.0" dir-glob "^3.0.1" - fast-glob "^3.0.3" - glob "^7.1.3" - ignore "^5.1.1" - merge2 "^1.2.3" + fast-glob "^3.1.1" + ignore "^5.1.4" + merge2 "^1.3.0" slash "^3.0.0" globby@^6.1.0: @@ -4591,7 +4828,7 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.0.tgz#8d8fdc73977cb04104721cb53666c1ca64cd328b" integrity sha512-jpSvDPV4Cq/bgtpndIWbI5hmYxhQGHPC4d4cqBPb4DLniCfhJokdXhwhaDuLBGLQdvvRum/UiX6ECVIPvDXqdg== -graceful-fs@^4.2.2: +graceful-fs@^4.2.2, graceful-fs@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== @@ -4611,23 +4848,12 @@ handle-thing@^2.0.0: resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.0.tgz#0e039695ff50c93fc288557d696f3c1dc6776754" integrity sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ== -handlebars@^4.1.2: - version "4.5.1" - resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.5.1.tgz#8a01c382c180272260d07f2d1aa3ae745715c7ba" - integrity sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA== - dependencies: - neo-async "^2.6.0" - optimist "^0.6.1" - source-map "^0.6.1" - optionalDependencies: - uglify-js "^3.1.4" - har-schema@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/har-schema/-/har-schema-2.0.0.tgz#a94c2224ebcac04782a0d9035521f24735b7ec92" integrity sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI= -har-validator@~5.1.0: +har-validator@~5.1.0, har-validator@~5.1.3: version "5.1.3" resolved "https://registry.yarnpkg.com/har-validator/-/har-validator-5.1.3.tgz#1ef89ebd3e4996557675eed9893110dc350fa080" integrity sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g== @@ -4659,6 +4885,11 @@ has-flag@^3.0.0: resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0= +has-flag@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b" + integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ== + has-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" @@ -4763,11 +4994,6 @@ homedir-polyfill@^1.0.1: dependencies: parse-passwd "^1.0.0" -hosted-git-info@^2.1.4: - version "2.8.5" - resolved "https://registry.yarnpkg.com/hosted-git-info/-/hosted-git-info-2.8.5.tgz#759cfcf2c4d156ade59b0b2dfabddc42a6b9c70c" - integrity sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg== - hpack.js@^2.1.6: version "2.1.6" resolved "https://registry.yarnpkg.com/hpack.js/-/hpack.js-2.1.6.tgz#87774c0949e513f42e84575b3c45681fade2a0b2" @@ -4790,6 +5016,11 @@ html-entities@^1.2.1: resolved "https://registry.yarnpkg.com/html-entities/-/html-entities-1.2.1.tgz#0df29351f0721163515dfb9e5543e5f6eed5162f" integrity sha1-DfKTUfByEWNRXfueVUPl9u7VFi8= +html-escaper@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.0.tgz#71e87f931de3fe09e56661ab9a29aadec707b491" + integrity sha512-a4u9BeERWGu/S8JiWEAQcdrg9v4QArtP9keViQjGMdff20fBdd8waotXaNmODqBe6uZ3Nafi7K/ho4gCQHV3Ig== + html-minifier@^3.2.3: version "3.5.21" resolved "https://registry.yarnpkg.com/html-minifier/-/html-minifier-3.5.21.tgz#d0040e054730e354db008463593194015212d20c" @@ -4903,13 +5134,18 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= -https-proxy-agent@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-3.0.1.tgz#b8c286433e87602311b01c8ea34413d856a4af81" - integrity sha512-+ML2Rbh6DAuee7d07tYGEKOEi2voWPUGan+ExdPbPW6Z3svq+JCqr0v8WmKPOkz1vOVykPCBSuobe7G8GJUtVg== +https-proxy-agent@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-4.0.0.tgz#702b71fb5520a132a66de1f67541d9e62154d82b" + integrity sha512-zoDhWrkR3of1l9QAL8/scJZyLu8j/gBkcwcaQOZh7Gyh/+uJQzGVETdgT30akuwkpL8HTRfssqI3BZuV18teDg== dependencies: - agent-base "^4.3.0" - debug "^3.1.0" + agent-base "5" + debug "4" + +human-signals@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" + integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4: version "0.4.24" @@ -4952,7 +5188,7 @@ ignore@^4.0.6: resolved "https://registry.yarnpkg.com/ignore/-/ignore-4.0.6.tgz#750e3db5862087b4737ebac8207ffd1ef27b25fc" integrity sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg== -ignore@^5.1.1: +ignore@^5.1.4: version "5.1.4" resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.1.4.tgz#84b7b3dbe64552b6ef0eca99f6743dbec6d97adf" integrity sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A== @@ -4978,6 +5214,14 @@ import-local@2.0.0, import-local@^2.0.0: pkg-dir "^3.0.0" resolve-cwd "^2.0.0" +import-local@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/import-local/-/import-local-3.0.2.tgz#a8cfd0431d1de4a2199703d003e3e62364fa6db6" + integrity sha512-vjL3+w0oulAVZ0hBHnxa/Nm5TAurf9YLQJDhqRZyqb+VKGOB6LU8t9H1Nr5CIo16vh9XfJTOoHwU0B71S557gA== + dependencies: + pkg-dir "^4.2.0" + resolve-cwd "^3.0.0" + imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" @@ -5133,11 +5377,6 @@ is-accessor-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" -is-arrayish@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" - integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0= - is-binary-path@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-1.0.1.tgz#75f16642b480f187a711c814161fd3a4a7655898" @@ -5326,6 +5565,11 @@ is-stream@^1.1.0: resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" integrity sha1-EtSj3U5o4Lec6428hBc66A2RykQ= +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + is-symbol@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" @@ -5333,7 +5577,7 @@ is-symbol@^1.0.2: dependencies: has-symbols "^1.0.0" -is-typedarray@~1.0.0: +is-typedarray@^1.0.0, is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" integrity sha1-5HnICFjfDBsR3dppQPlgEfzaSpo= @@ -5348,7 +5592,7 @@ is-wsl@^1.1.0: resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0= -is-wsl@^2.1.0: +is-wsl@^2.1.0, is-wsl@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.1.1.tgz#4a1c152d429df3d441669498e2486d3596ebaf1d" integrity sha512-umZHcSrwlDHo2TGMXv0DZ8dIUGunZ2Iv68YZnrmCiBPkZ4aaOhtv7pXJKeki9k3qJ3RJr0cDyitcl5wEH3AYog== @@ -5392,419 +5636,402 @@ isstream@~0.1.2: resolved "https://registry.yarnpkg.com/isstream/-/isstream-0.1.2.tgz#47e63f7af55afa6f92e1500e690eb8b8529c099a" integrity sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo= -istanbul-lib-coverage@^2.0.2, istanbul-lib-coverage@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.5.tgz#675f0ab69503fad4b1d849f736baaca803344f49" - integrity sha512-8aXznuEPCJvGnMSRft4udDRDtb1V3pkQkMMI5LI+6HuQz5oQ4J2UFn1H82raA3qJtyOLkkwVqICBQkjnGtn5mA== +istanbul-lib-coverage@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.0.0.tgz#f5944a37c70b550b02a78a5c3b2055b280cec8ec" + integrity sha512-UiUIqxMgRDET6eR+o5HbfRYP1l0hqkWOs7vNxC/mggutCMUIhWMm8gAHb8tHlyfD3/l6rlgNA5cKdDzEAf6hEg== -istanbul-lib-instrument@^3.0.1, istanbul-lib-instrument@^3.3.0: - version "3.3.0" - resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-3.3.0.tgz#a5f63d91f0bbc0c3e479ef4c5de027335ec6d630" - integrity sha512-5nnIN4vo5xQZHdXno/YDXJ0G+I3dAm4XgzfSVTPLQpj/zAV2dV6Juy0yaf10/zrJOJeHoN3fraFe+XRq2bFVZA== - dependencies: - "@babel/generator" "^7.4.0" - "@babel/parser" "^7.4.3" - "@babel/template" "^7.4.0" - "@babel/traverse" "^7.4.3" - "@babel/types" "^7.4.0" - istanbul-lib-coverage "^2.0.5" - semver "^6.0.0" +istanbul-lib-instrument@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.1.tgz#61f13ac2c96cfefb076fe7131156cc05907874e6" + integrity sha512-imIchxnodll7pvQBYOqUu88EufLCU56LMeFPZZM/fJZ1irYcYdqroaV+ACK1Ila8ls09iEYArp+nqyC6lW1Vfg== + dependencies: + "@babel/core" "^7.7.5" + "@babel/parser" "^7.7.5" + "@babel/template" "^7.7.4" + "@babel/traverse" "^7.7.4" + "@istanbuljs/schema" "^0.1.2" + istanbul-lib-coverage "^3.0.0" + semver "^6.3.0" -istanbul-lib-report@^2.0.4: - version "2.0.8" - resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-2.0.8.tgz#5a8113cd746d43c4889eba36ab10e7d50c9b4f33" - integrity sha512-fHBeG573EIihhAblwgxrSenp0Dby6tJMFR/HvlerBsrCTD5bkUuoNtn3gVh29ZCS824cGGBPn7Sg7cNk+2xUsQ== +istanbul-lib-report@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz#7518fe52ea44de372f460a76b5ecda9ffb73d8a6" + integrity sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw== dependencies: - istanbul-lib-coverage "^2.0.5" - make-dir "^2.1.0" - supports-color "^6.1.0" + istanbul-lib-coverage "^3.0.0" + make-dir "^3.0.0" + supports-color "^7.1.0" -istanbul-lib-source-maps@^3.0.1: - version "3.0.6" - resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-3.0.6.tgz#284997c48211752ec486253da97e3879defba8c8" - integrity sha512-R47KzMtDJH6X4/YW9XTx+jrLnZnscW4VpNN+1PViSYTejLVPWv7oov+Duf8YQSPyVRUvueQqz1TcsC6mooZTXw== +istanbul-lib-source-maps@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0.tgz#75743ce6d96bb86dc7ee4352cf6366a23f0b1ad9" + integrity sha512-c16LpFRkR8vQXyHZ5nLpY35JZtzj1PQY1iZmesUbf1FZHbIupcWfjgOXBY9YHkLEQ6puz1u4Dgj6qmU/DisrZg== dependencies: debug "^4.1.1" - istanbul-lib-coverage "^2.0.5" - make-dir "^2.1.0" - rimraf "^2.6.3" + istanbul-lib-coverage "^3.0.0" source-map "^0.6.1" -istanbul-reports@^2.2.6: - version "2.2.6" - resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-2.2.6.tgz#7b4f2660d82b29303a8fe6091f8ca4bf058da1af" - integrity sha512-SKi4rnMyLBKe0Jy2uUdx28h8oG7ph2PPuQPvIAh31d+Ci+lSiEu4C+h3oBPuJ9+mPKhOyW0M8gY4U5NM1WLeXA== +istanbul-reports@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/istanbul-reports/-/istanbul-reports-3.0.0.tgz#d4d16d035db99581b6194e119bbf36c963c5eb70" + integrity sha512-2osTcC8zcOSUkImzN2EWQta3Vdi4WjjKw99P2yWx5mLnigAM0Rd5uYFn1cf2i/Ois45GkNjaoTqc5CxgMSX80A== dependencies: - handlebars "^4.1.2" - -jasmine-core@^3.3: - version "3.4.0" - resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.4.0.tgz#2a74618e966026530c3518f03e9f845d26473ce3" - integrity sha512-HU/YxV4i6GcmiH4duATwAbJQMlE0MsDIR5XmSVxURxKHn3aGAdbY1/ZJFmVRbKtnLwIxxMJD7gYaPsypcbYimg== + html-escaper "^2.0.0" + istanbul-lib-report "^3.0.0" jasmine-core@^3.5.0: version "3.5.0" resolved "https://registry.yarnpkg.com/jasmine-core/-/jasmine-core-3.5.0.tgz#132c23e645af96d85c8bca13c8758b18429fc1e4" integrity sha512-nCeAiw37MIMA9w9IXso7bRaLl+c/ef3wnxsoSAlYrzS+Ot0zTG6nU8G/cIfGkqpkjX2wNaIW9RFG0TwIFnG6bA== -jest-changed-files@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-24.9.0.tgz#08d8c15eb79a7fa3fc98269bc14b451ee82f8039" - integrity sha512-6aTWpe2mHF0DhL28WjdkO8LyGjs3zItPET4bMSeXU6T3ub4FPMw+mcOcbdGXQOAfmLcxofD23/5Bl9Z4AkFwqg== +jest-changed-files@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-25.1.0.tgz#73dae9a7d9949fdfa5c278438ce8f2ff3ec78131" + integrity sha512-bdL1aHjIVy3HaBO3eEQeemGttsq1BDlHgWcOjEOIAcga7OOEGWHD2WSu8HhL7I1F0mFFyci8VKU4tRNk+qtwDA== dependencies: - "@jest/types" "^24.9.0" - execa "^1.0.0" - throat "^4.0.0" + "@jest/types" "^25.1.0" + execa "^3.2.0" + throat "^5.0.0" -jest-cli@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-24.9.0.tgz#ad2de62d07472d419c6abc301fc432b98b10d2af" - integrity sha512-+VLRKyitT3BWoMeSUIHRxV/2g8y9gw91Jh5z2UmXZzkZKpbC08CSehVxgHUwTpy+HwGcns/tqafQDJW7imYvGg== +jest-cli@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-25.1.0.tgz#75f0b09cf6c4f39360906bf78d580be1048e4372" + integrity sha512-p+aOfczzzKdo3AsLJlhs8J5EW6ffVidfSZZxXedJ0mHPBOln1DccqFmGCoO8JWd4xRycfmwy1eoQkMsF8oekPg== dependencies: - "@jest/core" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - chalk "^2.0.1" + "@jest/core" "^25.1.0" + "@jest/test-result" "^25.1.0" + "@jest/types" "^25.1.0" + chalk "^3.0.0" exit "^0.1.2" - import-local "^2.0.0" + import-local "^3.0.2" is-ci "^2.0.0" - jest-config "^24.9.0" - jest-util "^24.9.0" - jest-validate "^24.9.0" + jest-config "^25.1.0" + jest-util "^25.1.0" + jest-validate "^25.1.0" prompts "^2.0.1" realpath-native "^1.1.0" - yargs "^13.3.0" + yargs "^15.0.0" -jest-config@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-24.9.0.tgz#fb1bbc60c73a46af03590719efa4825e6e4dd1b5" - integrity sha512-RATtQJtVYQrp7fvWg6f5y3pEFj9I+H8sWw4aKxnDZ96mob5i5SD6ZEGWgMLXQ4LE8UurrjbdlLWdUeo+28QpfQ== +jest-config@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-25.1.0.tgz#d114e4778c045d3ef239452213b7ad3ec1cbea90" + integrity sha512-tLmsg4SZ5H7tuhBC5bOja0HEblM0coS3Wy5LTCb2C8ZV6eWLewHyK+3qSq9Bi29zmWQ7ojdCd3pxpx4l4d2uGw== dependencies: "@babel/core" "^7.1.0" - "@jest/test-sequencer" "^24.9.0" - "@jest/types" "^24.9.0" - babel-jest "^24.9.0" - chalk "^2.0.1" + "@jest/test-sequencer" "^25.1.0" + "@jest/types" "^25.1.0" + babel-jest "^25.1.0" + chalk "^3.0.0" glob "^7.1.1" - jest-environment-jsdom "^24.9.0" - jest-environment-node "^24.9.0" - jest-get-type "^24.9.0" - jest-jasmine2 "^24.9.0" - jest-regex-util "^24.3.0" - jest-resolve "^24.9.0" - jest-util "^24.9.0" - jest-validate "^24.9.0" - micromatch "^3.1.10" - pretty-format "^24.9.0" + jest-environment-jsdom "^25.1.0" + jest-environment-node "^25.1.0" + jest-get-type "^25.1.0" + jest-jasmine2 "^25.1.0" + jest-regex-util "^25.1.0" + jest-resolve "^25.1.0" + jest-util "^25.1.0" + jest-validate "^25.1.0" + micromatch "^4.0.2" + pretty-format "^25.1.0" realpath-native "^1.1.0" -jest-diff@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" - integrity sha512-qMfrTs8AdJE2iqrTp0hzh7kTd2PQWrsFyj9tORoKmu32xjPjeE4NyjVRDz8ybYwqS2ik8N4hsIpiVTyFeo2lBQ== - dependencies: - chalk "^2.0.1" - diff-sequences "^24.9.0" - jest-get-type "^24.9.0" - pretty-format "^24.9.0" - -jest-docblock@^24.3.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-24.9.0.tgz#7970201802ba560e1c4092cc25cbedf5af5a8ce2" - integrity sha512-F1DjdpDMJMA1cN6He0FNYNZlo3yYmOtRUnktrT9Q37njYzC5WEaDdmbynIgy0L/IvXvvgsG8OsqhLPXTpfmZAA== - dependencies: - detect-newline "^2.1.0" - -jest-each@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-24.9.0.tgz#eb2da602e2a610898dbc5f1f6df3ba86b55f8b05" - integrity sha512-ONi0R4BvW45cw8s2Lrx8YgbeXL1oCQ/wIDwmsM3CqM/nlblNCPmnC3IPQlMbRFZu3wKdQ2U8BqM6lh3LJ5Bsog== - dependencies: - "@jest/types" "^24.9.0" - chalk "^2.0.1" - jest-get-type "^24.9.0" - jest-util "^24.9.0" - pretty-format "^24.9.0" - -jest-environment-jsdom@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-24.9.0.tgz#4b0806c7fc94f95edb369a69cc2778eec2b7375b" - integrity sha512-Zv9FV9NBRzLuALXjvRijO2351DRQeLYXtpD4xNvfoVFw21IOKNhZAEUKcbiEtjTkm2GsJ3boMVgkaR7rN8qetA== - dependencies: - "@jest/environment" "^24.9.0" - "@jest/fake-timers" "^24.9.0" - "@jest/types" "^24.9.0" - jest-mock "^24.9.0" - jest-util "^24.9.0" - jsdom "^11.5.1" - -jest-environment-node@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-24.9.0.tgz#333d2d2796f9687f2aeebf0742b519f33c1cbfd3" - integrity sha512-6d4V2f4nxzIzwendo27Tr0aFm+IXWa0XEUnaH6nU0FMaozxovt+sfRvh4J47wL1OvF83I3SSTu0XK+i4Bqe7uA== - dependencies: - "@jest/environment" "^24.9.0" - "@jest/fake-timers" "^24.9.0" - "@jest/types" "^24.9.0" - jest-mock "^24.9.0" - jest-util "^24.9.0" - -jest-get-type@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-24.9.0.tgz#1684a0c8a50f2e4901b6644ae861f579eed2ef0e" - integrity sha512-lUseMzAley4LhIcpSP9Jf+fTrQ4a1yHQwLNeeVa2cEmbCGeoZAtYPOIv8JaxLD/sUpKxetKGP+gsHl8f8TSj8Q== - -jest-haste-map@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d" - integrity sha512-kfVFmsuWui2Sj1Rp1AJ4D9HqJwE4uwTlS/vO+eRUaMmd54BFpli2XhMQnPC2k4cHFVbB2Q2C+jtI1AGLgEnCjQ== - dependencies: - "@jest/types" "^24.9.0" - anymatch "^2.0.0" +jest-diff@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-25.1.0.tgz#58b827e63edea1bc80c1de952b80cec9ac50e1ad" + integrity sha512-nepXgajT+h017APJTreSieh4zCqnSHEJ1iT8HDlewu630lSJ4Kjjr9KNzm+kzGwwcpsDE6Snx1GJGzzsefaEHw== + dependencies: + chalk "^3.0.0" + diff-sequences "^25.1.0" + jest-get-type "^25.1.0" + pretty-format "^25.1.0" + +jest-docblock@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-25.1.0.tgz#0f44bea3d6ca6dfc38373d465b347c8818eccb64" + integrity sha512-370P/mh1wzoef6hUKiaMcsPtIapY25suP6JqM70V9RJvdKLrV4GaGbfUseUVk4FZJw4oTZ1qSCJNdrClKt5JQA== + dependencies: + detect-newline "^3.0.0" + +jest-each@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-25.1.0.tgz#a6b260992bdf451c2d64a0ccbb3ac25e9b44c26a" + integrity sha512-R9EL8xWzoPySJ5wa0DXFTj7NrzKpRD40Jy+zQDp3Qr/2QmevJgkN9GqioCGtAJ2bW9P/MQRznQHQQhoeAyra7A== + dependencies: + "@jest/types" "^25.1.0" + chalk "^3.0.0" + jest-get-type "^25.1.0" + jest-util "^25.1.0" + pretty-format "^25.1.0" + +jest-environment-jsdom@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-25.1.0.tgz#6777ab8b3e90fd076801efd3bff8e98694ab43c3" + integrity sha512-ILb4wdrwPAOHX6W82GGDUiaXSSOE274ciuov0lztOIymTChKFtC02ddyicRRCdZlB5YSrv3vzr1Z5xjpEe1OHQ== + dependencies: + "@jest/environment" "^25.1.0" + "@jest/fake-timers" "^25.1.0" + "@jest/types" "^25.1.0" + jest-mock "^25.1.0" + jest-util "^25.1.0" + jsdom "^15.1.1" + +jest-environment-node@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-25.1.0.tgz#797bd89b378cf0bd794dc8e3dca6ef21126776db" + integrity sha512-U9kFWTtAPvhgYY5upnH9rq8qZkj6mYLup5l1caAjjx9uNnkLHN2xgZy5mo4SyLdmrh/EtB9UPpKFShvfQHD0Iw== + dependencies: + "@jest/environment" "^25.1.0" + "@jest/fake-timers" "^25.1.0" + "@jest/types" "^25.1.0" + jest-mock "^25.1.0" + jest-util "^25.1.0" + +jest-get-type@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-25.1.0.tgz#1cfe5fc34f148dc3a8a3b7275f6b9ce9e2e8a876" + integrity sha512-yWkBnT+5tMr8ANB6V+OjmrIJufHtCAqI5ic2H40v+tRqxDmE0PGnIiTyvRWFOMtmVHYpwRqyazDbTnhpjsGvLw== + +jest-haste-map@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-25.1.0.tgz#ae12163d284f19906260aa51fd405b5b2e5a4ad3" + integrity sha512-/2oYINIdnQZAqyWSn1GTku571aAfs8NxzSErGek65Iu5o8JYb+113bZysRMcC/pjE5v9w0Yz+ldbj9NxrFyPyw== + dependencies: + "@jest/types" "^25.1.0" + anymatch "^3.0.3" fb-watchman "^2.0.0" - graceful-fs "^4.1.15" - invariant "^2.2.4" - jest-serializer "^24.9.0" - jest-util "^24.9.0" - jest-worker "^24.9.0" - micromatch "^3.1.10" + graceful-fs "^4.2.3" + jest-serializer "^25.1.0" + jest-util "^25.1.0" + jest-worker "^25.1.0" + micromatch "^4.0.2" sane "^4.0.3" walker "^1.0.7" optionalDependencies: - fsevents "^1.2.7" + fsevents "^2.1.2" -jest-jasmine2@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-24.9.0.tgz#1f7b1bd3242c1774e62acabb3646d96afc3be6a0" - integrity sha512-Cq7vkAgaYKp+PsX+2/JbTarrk0DmNhsEtqBXNwUHkdlbrTBLtMJINADf2mf5FkowNsq8evbPc07/qFO0AdKTzw== +jest-jasmine2@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-25.1.0.tgz#681b59158a430f08d5d0c1cce4f01353e4b48137" + integrity sha512-GdncRq7jJ7sNIQ+dnXvpKO2MyP6j3naNK41DTTjEAhLEdpImaDA9zSAZwDhijjSF/D7cf4O5fdyUApGBZleaEg== dependencies: "@babel/traverse" "^7.1.0" - "@jest/environment" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - chalk "^2.0.1" + "@jest/environment" "^25.1.0" + "@jest/source-map" "^25.1.0" + "@jest/test-result" "^25.1.0" + "@jest/types" "^25.1.0" + chalk "^3.0.0" co "^4.6.0" - expect "^24.9.0" + expect "^25.1.0" is-generator-fn "^2.0.0" - jest-each "^24.9.0" - jest-matcher-utils "^24.9.0" - jest-message-util "^24.9.0" - jest-runtime "^24.9.0" - jest-snapshot "^24.9.0" - jest-util "^24.9.0" - pretty-format "^24.9.0" - throat "^4.0.0" - -jest-leak-detector@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-24.9.0.tgz#b665dea7c77100c5c4f7dfcb153b65cf07dcf96a" - integrity sha512-tYkFIDsiKTGwb2FG1w8hX9V0aUb2ot8zY/2nFg087dUageonw1zrLMP4W6zsRO59dPkTSKie+D4rhMuP9nRmrA== - dependencies: - jest-get-type "^24.9.0" - pretty-format "^24.9.0" - -jest-matcher-utils@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-24.9.0.tgz#f5b3661d5e628dffe6dd65251dfdae0e87c3a073" - integrity sha512-OZz2IXsu6eaiMAwe67c1T+5tUAtQyQx27/EMEkbFAGiw52tB9em+uGbzpcgYVpA8wl0hlxKPZxrly4CXU/GjHA== - dependencies: - chalk "^2.0.1" - jest-diff "^24.9.0" - jest-get-type "^24.9.0" - pretty-format "^24.9.0" - -jest-message-util@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-24.9.0.tgz#527f54a1e380f5e202a8d1149b0ec872f43119e3" - integrity sha512-oCj8FiZ3U0hTP4aSui87P4L4jC37BtQwUMqk+zk/b11FR19BJDeZsZAvIHutWnmtw7r85UmR3CEWZ0HWU2mAlw== + jest-each "^25.1.0" + jest-matcher-utils "^25.1.0" + jest-message-util "^25.1.0" + jest-runtime "^25.1.0" + jest-snapshot "^25.1.0" + jest-util "^25.1.0" + pretty-format "^25.1.0" + throat "^5.0.0" + +jest-leak-detector@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-25.1.0.tgz#ed6872d15aa1c72c0732d01bd073dacc7c38b5c6" + integrity sha512-3xRI264dnhGaMHRvkFyEKpDeaRzcEBhyNrOG5oT8xPxOyUAblIAQnpiR3QXu4wDor47MDTiHbiFcbypdLcLW5w== + dependencies: + jest-get-type "^25.1.0" + pretty-format "^25.1.0" + +jest-matcher-utils@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-25.1.0.tgz#fa5996c45c7193a3c24e73066fc14acdee020220" + integrity sha512-KGOAFcSFbclXIFE7bS4C53iYobKI20ZWleAdAFun4W1Wz1Kkej8Ng6RRbhL8leaEvIOjGXhGf/a1JjO8bkxIWQ== + dependencies: + chalk "^3.0.0" + jest-diff "^25.1.0" + jest-get-type "^25.1.0" + pretty-format "^25.1.0" + +jest-message-util@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-25.1.0.tgz#702a9a5cb05c144b9aa73f06e17faa219389845e" + integrity sha512-Nr/Iwar2COfN22aCqX0kCVbXgn8IBm9nWf4xwGr5Olv/KZh0CZ32RKgZWMVDXGdOahicM10/fgjdimGNX/ttCQ== dependencies: "@babel/code-frame" "^7.0.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" + "@jest/test-result" "^25.1.0" + "@jest/types" "^25.1.0" "@types/stack-utils" "^1.0.1" - chalk "^2.0.1" - micromatch "^3.1.10" - slash "^2.0.0" + chalk "^3.0.0" + micromatch "^4.0.2" + slash "^3.0.0" stack-utils "^1.0.1" -jest-mock@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-24.9.0.tgz#c22835541ee379b908673ad51087a2185c13f1c6" - integrity sha512-3BEYN5WbSq9wd+SyLDES7AHnjH9A/ROBwmz7l2y+ol+NtSFO8DYiEBzoO1CeFc9a8DYy10EO4dDFVv/wN3zl1w== +jest-mock@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-25.1.0.tgz#411d549e1b326b7350b2e97303a64715c28615fd" + integrity sha512-28/u0sqS+42vIfcd1mlcg4ZVDmSUYuNvImP4X2lX5hRMLW+CN0BeiKVD4p+ujKKbSPKd3rg/zuhCF+QBLJ4vag== dependencies: - "@jest/types" "^24.9.0" + "@jest/types" "^25.1.0" jest-pnp-resolver@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" integrity sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ== -jest-regex-util@^24.3.0, jest-regex-util@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-24.9.0.tgz#c13fb3380bde22bf6575432c493ea8fe37965636" - integrity sha512-05Cmb6CuxaA+Ys6fjr3PhvV3bGQmO+2p2La4hFbU+W5uOc479f7FdLXUWXw4pYMAhhSZIuKHwSXSu6CsSBAXQA== +jest-regex-util@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-25.1.0.tgz#efaf75914267741838e01de24da07b2192d16d87" + integrity sha512-9lShaDmDpqwg+xAd73zHydKrBbbrIi08Kk9YryBEBybQFg/lBWR/2BDjjiSE7KIppM9C5+c03XiDaZ+m4Pgs1w== -jest-resolve-dependencies@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-24.9.0.tgz#ad055198959c4cfba8a4f066c673a3f0786507ab" - integrity sha512-Fm7b6AlWnYhT0BXy4hXpactHIqER7erNgIsIozDXWl5dVm+k8XdGVe1oTg1JyaFnOxarMEbax3wyRJqGP2Pq+g== +jest-resolve-dependencies@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-25.1.0.tgz#8a1789ec64eb6aaa77fd579a1066a783437e70d2" + integrity sha512-Cu/Je38GSsccNy4I2vL12ZnBlD170x2Oh1devzuM9TLH5rrnLW1x51lN8kpZLYTvzx9j+77Y5pqBaTqfdzVzrw== dependencies: - "@jest/types" "^24.9.0" - jest-regex-util "^24.3.0" - jest-snapshot "^24.9.0" + "@jest/types" "^25.1.0" + jest-regex-util "^25.1.0" + jest-snapshot "^25.1.0" -jest-resolve@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-24.9.0.tgz#dff04c7687af34c4dd7e524892d9cf77e5d17321" - integrity sha512-TaLeLVL1l08YFZAt3zaPtjiVvyy4oSA6CRe+0AFPPVX3Q/VI0giIWWoAvoS5L96vj9Dqxj4fB5p2qrHCmTU/MQ== +jest-resolve@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-25.1.0.tgz#23d8b6a4892362baf2662877c66aa241fa2eaea3" + integrity sha512-XkBQaU1SRCHj2Evz2Lu4Czs+uIgJXWypfO57L7JYccmAXv4slXA6hzNblmcRmf7P3cQ1mE7fL3ABV6jAwk4foQ== dependencies: - "@jest/types" "^24.9.0" + "@jest/types" "^25.1.0" browser-resolve "^1.11.3" - chalk "^2.0.1" + chalk "^3.0.0" jest-pnp-resolver "^1.2.1" realpath-native "^1.1.0" -jest-runner@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-24.9.0.tgz#574fafdbd54455c2b34b4bdf4365a23857fcdf42" - integrity sha512-KksJQyI3/0mhcfspnxxEOBueGrd5E4vV7ADQLT9ESaCzz02WnbdbKWIf5Mkaucoaj7obQckYPVX6JJhgUcoWWg== +jest-runner@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-25.1.0.tgz#fef433a4d42c89ab0a6b6b268e4a4fbe6b26e812" + integrity sha512-su3O5fy0ehwgt+e8Wy7A8CaxxAOCMzL4gUBftSs0Ip32S0epxyZPDov9Znvkl1nhVOJNf4UwAsnqfc3plfQH9w== dependencies: - "@jest/console" "^24.7.1" - "@jest/environment" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - chalk "^2.4.2" + "@jest/console" "^25.1.0" + "@jest/environment" "^25.1.0" + "@jest/test-result" "^25.1.0" + "@jest/types" "^25.1.0" + chalk "^3.0.0" exit "^0.1.2" - graceful-fs "^4.1.15" - jest-config "^24.9.0" - jest-docblock "^24.3.0" - jest-haste-map "^24.9.0" - jest-jasmine2 "^24.9.0" - jest-leak-detector "^24.9.0" - jest-message-util "^24.9.0" - jest-resolve "^24.9.0" - jest-runtime "^24.9.0" - jest-util "^24.9.0" - jest-worker "^24.6.0" + graceful-fs "^4.2.3" + jest-config "^25.1.0" + jest-docblock "^25.1.0" + jest-haste-map "^25.1.0" + jest-jasmine2 "^25.1.0" + jest-leak-detector "^25.1.0" + jest-message-util "^25.1.0" + jest-resolve "^25.1.0" + jest-runtime "^25.1.0" + jest-util "^25.1.0" + jest-worker "^25.1.0" source-map-support "^0.5.6" - throat "^4.0.0" - -jest-runtime@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-24.9.0.tgz#9f14583af6a4f7314a6a9d9f0226e1a781c8e4ac" - integrity sha512-8oNqgnmF3v2J6PVRM2Jfuj8oX3syKmaynlDMMKQ4iyzbQzIG6th5ub/lM2bCMTmoTKM3ykcUYI2Pw9xwNtjMnw== - dependencies: - "@jest/console" "^24.7.1" - "@jest/environment" "^24.9.0" - "@jest/source-map" "^24.3.0" - "@jest/transform" "^24.9.0" - "@jest/types" "^24.9.0" - "@types/yargs" "^13.0.0" - chalk "^2.0.1" + throat "^5.0.0" + +jest-runtime@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-25.1.0.tgz#02683218f2f95aad0f2ec1c9cdb28c1dc0ec0314" + integrity sha512-mpPYYEdbExKBIBB16ryF6FLZTc1Rbk9Nx0ryIpIMiDDkOeGa0jQOKVI/QeGvVGlunKKm62ywcioeFVzIbK03bA== + dependencies: + "@jest/console" "^25.1.0" + "@jest/environment" "^25.1.0" + "@jest/source-map" "^25.1.0" + "@jest/test-result" "^25.1.0" + "@jest/transform" "^25.1.0" + "@jest/types" "^25.1.0" + "@types/yargs" "^15.0.0" + chalk "^3.0.0" + collect-v8-coverage "^1.0.0" exit "^0.1.2" glob "^7.1.3" - graceful-fs "^4.1.15" - jest-config "^24.9.0" - jest-haste-map "^24.9.0" - jest-message-util "^24.9.0" - jest-mock "^24.9.0" - jest-regex-util "^24.3.0" - jest-resolve "^24.9.0" - jest-snapshot "^24.9.0" - jest-util "^24.9.0" - jest-validate "^24.9.0" + graceful-fs "^4.2.3" + jest-config "^25.1.0" + jest-haste-map "^25.1.0" + jest-message-util "^25.1.0" + jest-mock "^25.1.0" + jest-regex-util "^25.1.0" + jest-resolve "^25.1.0" + jest-snapshot "^25.1.0" + jest-util "^25.1.0" + jest-validate "^25.1.0" realpath-native "^1.1.0" - slash "^2.0.0" - strip-bom "^3.0.0" - yargs "^13.3.0" + slash "^3.0.0" + strip-bom "^4.0.0" + yargs "^15.0.0" -jest-serializer@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-24.9.0.tgz#e6d7d7ef96d31e8b9079a714754c5d5c58288e73" - integrity sha512-DxYipDr8OvfrKH3Kel6NdED3OXxjvxXZ1uIY2I9OFbGg+vUkkg7AGvi65qbhbWNPvDckXmzMPbK3u3HaDO49bQ== +jest-serializer@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-25.1.0.tgz#73096ba90e07d19dec4a0c1dd89c355e2f129e5d" + integrity sha512-20Wkq5j7o84kssBwvyuJ7Xhn7hdPeTXndnwIblKDR2/sy1SUm6rWWiG9kSCgJPIfkDScJCIsTtOKdlzfIHOfKA== -jest-snapshot@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-24.9.0.tgz#ec8e9ca4f2ec0c5c87ae8f925cf97497b0e951ba" - integrity sha512-uI/rszGSs73xCM0l+up7O7a40o90cnrk429LOiK3aeTvfC0HHmldbd81/B7Ix81KSFe1lwkbl7GnBGG4UfuDew== +jest-snapshot@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-25.1.0.tgz#d5880bd4b31faea100454608e15f8d77b9d221d9" + integrity sha512-xZ73dFYN8b/+X2hKLXz4VpBZGIAn7muD/DAg+pXtDzDGw3iIV10jM7WiHqhCcpDZfGiKEj7/2HXAEPtHTj0P2A== dependencies: "@babel/types" "^7.0.0" - "@jest/types" "^24.9.0" - chalk "^2.0.1" - expect "^24.9.0" - jest-diff "^24.9.0" - jest-get-type "^24.9.0" - jest-matcher-utils "^24.9.0" - jest-message-util "^24.9.0" - jest-resolve "^24.9.0" + "@jest/types" "^25.1.0" + chalk "^3.0.0" + expect "^25.1.0" + jest-diff "^25.1.0" + jest-get-type "^25.1.0" + jest-matcher-utils "^25.1.0" + jest-message-util "^25.1.0" + jest-resolve "^25.1.0" mkdirp "^0.5.1" natural-compare "^1.4.0" - pretty-format "^24.9.0" - semver "^6.2.0" - -jest-util@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-24.9.0.tgz#7396814e48536d2e85a37de3e4c431d7cb140162" - integrity sha512-x+cZU8VRmOJxbA1K5oDBdxQmdq0OIdADarLxk0Mq+3XS4jgvhG/oKGWcIDCtPG0HgjxOYvF+ilPJQsAyXfbNOg== - dependencies: - "@jest/console" "^24.9.0" - "@jest/fake-timers" "^24.9.0" - "@jest/source-map" "^24.9.0" - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - callsites "^3.0.0" - chalk "^2.0.1" - graceful-fs "^4.1.15" + pretty-format "^25.1.0" + semver "^7.1.1" + +jest-util@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-25.1.0.tgz#7bc56f7b2abd534910e9fa252692f50624c897d9" + integrity sha512-7did6pLQ++87Qsj26Fs/TIwZMUFBXQ+4XXSodRNy3luch2DnRXsSnmpVtxxQ0Yd6WTipGpbhh2IFP1mq6/fQGw== + dependencies: + "@jest/types" "^25.1.0" + chalk "^3.0.0" is-ci "^2.0.0" mkdirp "^0.5.1" - slash "^2.0.0" - source-map "^0.6.0" -jest-validate@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-24.9.0.tgz#0775c55360d173cd854e40180756d4ff52def8ab" - integrity sha512-HPIt6C5ACwiqSiwi+OfSSHbK8sG7akG8eATl+IPKaeIjtPOeBUd/g3J7DghugzxrGjI93qS/+RPKe1H6PqvhRQ== - dependencies: - "@jest/types" "^24.9.0" - camelcase "^5.3.1" - chalk "^2.0.1" - jest-get-type "^24.9.0" - leven "^3.1.0" - pretty-format "^24.9.0" - -jest-watcher@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-24.9.0.tgz#4b56e5d1ceff005f5b88e528dc9afc8dd4ed2b3b" - integrity sha512-+/fLOfKPXXYJDYlks62/4R4GoT+GU1tYZed99JSCOsmzkkF7727RqKrjNAxtfO4YpGv11wybgRvCjR73lK2GZw== - dependencies: - "@jest/test-result" "^24.9.0" - "@jest/types" "^24.9.0" - "@types/yargs" "^13.0.0" - ansi-escapes "^3.0.0" - chalk "^2.0.1" - jest-util "^24.9.0" - string-length "^2.0.0" - -jest-worker@^24.6.0, jest-worker@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" - integrity sha512-51PE4haMSXcHohnSMdM42anbvZANYTqMrr52tVKPqqsPJMzoP6FYYDVqahX/HrAoKEKz3uUPzSvKs9A3qR4iVw== +jest-validate@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-25.1.0.tgz#1469fa19f627bb0a9a98e289f3e9ab6a668c732a" + integrity sha512-kGbZq1f02/zVO2+t1KQGSVoCTERc5XeObLwITqC6BTRH3Adv7NZdYqCpKIZLUgpLXf2yISzQ465qOZpul8abXA== + dependencies: + "@jest/types" "^25.1.0" + camelcase "^5.3.1" + chalk "^3.0.0" + jest-get-type "^25.1.0" + leven "^3.1.0" + pretty-format "^25.1.0" + +jest-watcher@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-25.1.0.tgz#97cb4a937f676f64c9fad2d07b824c56808e9806" + integrity sha512-Q9eZ7pyaIr6xfU24OeTg4z1fUqBF/4MP6J801lyQfg7CsnZ/TCzAPvCfckKdL5dlBBEKBeHV0AdyjFZ5eWj4ig== + dependencies: + "@jest/test-result" "^25.1.0" + "@jest/types" "^25.1.0" + ansi-escapes "^4.2.1" + chalk "^3.0.0" + jest-util "^25.1.0" + string-length "^3.1.0" + +jest-worker@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-25.1.0.tgz#75d038bad6fdf58eba0d2ec1835856c497e3907a" + integrity sha512-ZHhHtlxOWSxCoNOKHGbiLzXnl42ga9CxDr27H36Qn+15pQZd3R/F24jrmjDelw9j/iHUIWMWs08/u2QN50HHOg== dependencies: merge-stream "^2.0.0" - supports-color "^6.1.0" + supports-color "^7.0.0" -jest@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-24.9.0.tgz#987d290c05a08b52c56188c1002e368edb007171" - integrity sha512-YvkBL1Zm7d2B1+h5fHEOdyjCG+sGMz4f8D86/0HiqJ6MB4MnDc8FgP5vdWsGnemOQro7lnYo8UakZ3+5A0jxGw== +jest@25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-25.1.0.tgz#b85ef1ddba2fdb00d295deebbd13567106d35be9" + integrity sha512-FV6jEruneBhokkt9MQk0WUFoNTwnF76CLXtwNMfsc0um0TlB/LG2yxUd0KqaFjEJ9laQmVWQWS0sG/t2GsuI0w== dependencies: - import-local "^2.0.0" - jest-cli "^24.9.0" - -js-levenshtein@^1.1.3: - version "1.1.6" - resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" - integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== + "@jest/core" "^25.1.0" + import-local "^3.0.2" + jest-cli "^25.1.0" "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" @@ -5829,36 +6056,36 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= -jsdom@^11.5.1: - version "11.12.0" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" - integrity sha512-y8Px43oyiBM13Zc1z780FrfNLJCXTL40EWlty/LXUtcjykRBNgLlCjWXpfSPBl2iv+N7koQN+dvqszHZgT/Fjw== +jsdom@^15.1.1: + version "15.2.1" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-15.2.1.tgz#d2feb1aef7183f86be521b8c6833ff5296d07ec5" + integrity sha512-fAl1W0/7T2G5vURSyxBzrJ1LSdQn6Tr5UX/xD4PXDx/PDgwygedfW6El/KIj3xJ7FU61TTYnc/l/B7P49Eqt6g== dependencies: abab "^2.0.0" - acorn "^5.5.3" - acorn-globals "^4.1.0" + acorn "^7.1.0" + acorn-globals "^4.3.2" array-equal "^1.0.0" - cssom ">= 0.3.2 < 0.4.0" - cssstyle "^1.0.0" - data-urls "^1.0.0" + cssom "^0.4.1" + cssstyle "^2.0.0" + data-urls "^1.1.0" domexception "^1.0.1" - escodegen "^1.9.1" + escodegen "^1.11.1" html-encoding-sniffer "^1.0.2" - left-pad "^1.3.0" - nwsapi "^2.0.7" - parse5 "4.0.0" + nwsapi "^2.2.0" + parse5 "5.1.0" pn "^1.1.0" - request "^2.87.0" - request-promise-native "^1.0.5" - sax "^1.2.4" + request "^2.88.0" + request-promise-native "^1.0.7" + saxes "^3.1.9" symbol-tree "^3.2.2" - tough-cookie "^2.3.4" + tough-cookie "^3.0.1" w3c-hr-time "^1.0.1" + w3c-xmlserializer "^1.1.2" webidl-conversions "^4.0.2" - whatwg-encoding "^1.0.3" - whatwg-mimetype "^2.1.0" - whatwg-url "^6.4.1" - ws "^5.2.0" + whatwg-encoding "^1.0.5" + whatwg-mimetype "^2.3.0" + whatwg-url "^7.0.0" + ws "^7.0.0" xml-name-validator "^3.0.0" jsesc@^1.3.0: @@ -5876,7 +6103,7 @@ jsesc@~0.5.0: resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-0.5.0.tgz#e7dee66e35d6fc16f710fe91d5cf69f70f08911d" integrity sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0= -json-parse-better-errors@^1.0.1, json-parse-better-errors@^1.0.2: +json-parse-better-errors@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9" integrity sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw== @@ -5971,10 +6198,10 @@ karma-chrome-launcher@^3.1.0: dependencies: which "^1.2.1" -karma-firefox-launcher@^1.2.0: - version "1.2.0" - resolved "https://registry.yarnpkg.com/karma-firefox-launcher/-/karma-firefox-launcher-1.2.0.tgz#64fe03dd10300f9754d48f9ebfbf31f6c94a200c" - integrity sha512-j9Zp8M8+VLq1nI/5xZGfzeaEPtGQ/vk3G+Y8vpmFWLvKLNZ2TDjD6cu2dUu7lDbu1HXNgatsAX4jgCZTkR9qhQ== +karma-firefox-launcher@1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/karma-firefox-launcher/-/karma-firefox-launcher-1.3.0.tgz#ebcbb1d1ddfada6be900eb8fae25bcf2dcdc8171" + integrity sha512-Fi7xPhwrRgr+94BnHX0F5dCl1miIW4RHnzjIGxF8GaIEp7rNqX7LSi7ok63VXs3PS/5MQaQMhGxw+bvD+pibBQ== dependencies: is-wsl "^2.1.0" @@ -5983,12 +6210,12 @@ karma-jasmine-async@^0.0.1: resolved "https://registry.yarnpkg.com/karma-jasmine-async/-/karma-jasmine-async-0.0.1.tgz#687224989d6f062030c862a64b731797daf665a2" integrity sha1-aHIkmJ1vBiAwyGKmS3MXl9r2ZaI= -karma-jasmine@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/karma-jasmine/-/karma-jasmine-2.0.1.tgz#26e3e31f2faf272dd80ebb0e1898914cc3a19763" - integrity sha512-iuC0hmr9b+SNn1DaUD2QEYtUxkS1J+bSJSn7ejdEexs7P8EYvA1CWkEdrDQ+8jVH3AgWlCNwjYsT1chjcNW9lA== +karma-jasmine@3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/karma-jasmine/-/karma-jasmine-3.1.1.tgz#f592b253e7619a8d84559d7daf473a647498ade8" + integrity sha512-pxBmv5K7IkBRLsFSTOpgiK/HzicQT3mfFF+oHAC7nxMfYKhaYFgxOa5qjnHW4sL5rUnmdkSajoudOnnOdPyW4Q== dependencies: - jasmine-core "^3.3" + jasmine-core "^3.5.0" karma-safari-launcher@^1.0.0: version "1.0.0" @@ -6046,15 +6273,13 @@ karma@^4.4.1: tmp "0.0.33" useragent "2.3.0" -keccak@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/keccak/-/keccak-2.0.0.tgz#7456ea5023284271e6f362b4397e8df4d2bb994c" - integrity sha512-rKe/lRr0KGhjoz97cwg+oeT1Rj/Y4cjae6glArioUC8JBF9ROGZctwIaaruM7d7naovME4Q8WcQSO908A8qcyQ== +keccak@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.0.tgz#420d1de4a38a04f33ff8401f0535fb93756861d4" + integrity sha512-/4h4FIfFEpTEuySXi/nVFM5rqSKPnnhI7cL4K3MFSwoI3VyM7AhPSq3SsysARtnEBEeIKMBUWD8cTh9nHE8AkA== dependencies: - bindings "^1.2.1" - inherits "^2.0.3" - nan "^2.2.1" - safe-buffer "^5.1.0" + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" killable@^1.0.1: version "1.0.1" @@ -6097,11 +6322,6 @@ lcid@^2.0.0: dependencies: invert-kv "^2.0.0" -left-pad@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/left-pad/-/left-pad-1.3.0.tgz#5b8a3a7765dfe001261dde915589e782f8c94d1e" - integrity sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA== - less-loader@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/less-loader/-/less-loader-5.0.0.tgz#498dde3a6c6c4f887458ee9ed3f086a12ad1b466" @@ -6126,12 +6346,13 @@ less-plugin-clean-css@^1.5.1: dependencies: clean-css "^3.0.1" -less@^3.10.3: - version "3.10.3" - resolved "https://registry.yarnpkg.com/less/-/less-3.10.3.tgz#417a0975d5eeecc52cff4bcfa3c09d35781e6792" - integrity sha512-vz32vqfgmoxF1h3K4J+yKCtajH0PWmjkIFgbs5d78E/c/e+UQTnI+lWK+1eQRE95PXM2mC3rJlLSSP9VQHnaow== +less@3.11.1: + version "3.11.1" + resolved "https://registry.yarnpkg.com/less/-/less-3.11.1.tgz#c6bf08e39e02404fe6b307a3dfffafdc55bd36e2" + integrity sha512-tlWX341RECuTOvoDIvtFqXsKj072hm3+9ymRBe76/mD6O5ZZecnlAOVDlWAleF2+aohFrxNidXhv2773f6kY7g== dependencies: clone "^2.1.2" + tslib "^1.10.0" optionalDependencies: errno "^0.1.1" graceful-fs "^4.1.2" @@ -6147,6 +6368,13 @@ leven@^3.1.0: resolved "https://registry.yarnpkg.com/leven/-/leven-3.1.0.tgz#77891de834064cccba82ae7842bb6b14a13ed7f2" integrity sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A== +levenary@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/levenary/-/levenary-1.1.1.tgz#842a9ee98d2075aa7faeedbe32679e9205f46f77" + integrity sha512-mkAdOIt79FD6irqjYSs4rdbnlT5vRonMEvBVPVb3XmevfS8kgRXwfes0dhPdEtzTWD/1eNE/Bm/G1iRt6DcnQQ== + dependencies: + leven "^3.1.0" + levn@^0.3.0, levn@~0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/levn/-/levn-0.3.0.tgz#3b09924edf9f083c0490fdd4c0bc4421e04764ee" @@ -6155,16 +6383,6 @@ levn@^0.3.0, levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -load-json-file@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-4.0.0.tgz#2f5f45ab91e33216234fd53adab668eb4ec0993b" - integrity sha1-L19Fq5HjMhYjT9U62rZo607AmTs= - dependencies: - graceful-fs "^4.1.2" - parse-json "^4.0.0" - pify "^3.0.0" - strip-bom "^3.0.0" - loader-runner@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/loader-runner/-/loader-runner-2.4.0.tgz#ed47066bfe534d7e84c4c7b9998c2a75607d9357" @@ -6257,6 +6475,13 @@ loglevel@^1.6.6: resolved "https://registry.yarnpkg.com/loglevel/-/loglevel-1.6.6.tgz#0ee6300cc058db6b3551fa1c4bf73b83bb771312" integrity sha512-Sgr5lbboAUBo3eXCSPL4/KoVz3ROKquOjcctxmHIt+vol2DrqTQe3SwkKKuYhEiWB5kYa13YyopJ69deJ1irzQ== +lolex@^5.0.0: + version "5.1.2" + resolved "https://registry.yarnpkg.com/lolex/-/lolex-5.1.2.tgz#953694d098ce7c07bc5ed6d0e42bc6c0c6d5a367" + integrity sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A== + dependencies: + "@sinonjs/commons" "^1.7.0" + "long@~2 >=2.2.3": version "2.4.0" resolved "https://registry.yarnpkg.com/long/-/long-2.4.0.tgz#9fa180bb1d9500cdc29c4156766a1995e1f4524f" @@ -6376,7 +6601,7 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -merge2@^1.2.3, merge2@^1.3.0: +merge2@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.3.0.tgz#5b366ee83b2f1582c48f87e47cf1a9352103ca81" integrity sha512-2j4DAdlBOkiSZIsaXk4mTE3sRS02yBHAtfy127xRV3bQUFqXkjHCHLW6Scv7DwNRbIWNHH8zpnz9zMaKXIdvYw== @@ -6614,7 +6839,7 @@ mute-stream@0.0.8: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -nan@^2.12.1, nan@^2.14.0, nan@^2.2.1: +nan@^2.12.1, nan@^2.14.0: version "2.14.0" resolved "https://registry.yarnpkg.com/nan/-/nan-2.14.0.tgz#7818f722027b2459a86f0295d434d1fc2336c52c" integrity sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg== @@ -6660,7 +6885,7 @@ negotiator@0.6.2: resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" integrity sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw== -neo-async@^2.5.0, neo-async@^2.6.0, neo-async@^2.6.1: +neo-async@^2.5.0, neo-async@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.1.tgz#ac27ada66167fa8849a6addd837f6b189ad2081c" integrity sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw== @@ -6677,6 +6902,11 @@ no-case@^2.2.0: dependencies: lower-case "^1.1.1" +node-addon-api@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-2.0.0.tgz#f9afb8d777a91525244b01775ea0ddbe1125483b" + integrity sha512-ASCL5U13as7HhOExbT6OlWJJUV/lLzL2voOSP1UVehpRD8FbSrSDjfScK/KwAvVTI5AS6r4VwbOMlIqtvRidnA== + node-environment-flags@^1.0.5: version "1.0.6" resolved "https://registry.yarnpkg.com/node-environment-flags/-/node-environment-flags-1.0.6.tgz#a30ac13621f6f7d674260a54dede048c3982c088" @@ -6695,6 +6925,11 @@ node-forge@0.9.0: resolved "https://registry.yarnpkg.com/node-forge/-/node-forge-0.9.0.tgz#d624050edbb44874adca12bb9a52ec63cb782579" integrity sha512-7ASaDa3pD+lJ3WvXFsxekJQelBKRpne+GOVbLbtHYdd7pFspyeuJHnWfLplGf3SwKGbfs/aYl5V/JCIaHVUKKQ== +node-gyp-build@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/node-gyp-build/-/node-gyp-build-4.2.0.tgz#2c2b05f461f4178641a6ce2d7159f04094e9376d" + integrity sha512-4oiumOLhCDU9Rronz8PZ5S4IvT39H5+JEv/hps9V8s7RSLhsac0TCP78ulnHXOo8X1wdpPiTayGlM1jr4IbnaQ== + node-int64@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/node-int64/-/node-int64-0.4.0.tgz#87a9065cdb355d3182d8f94ce11188b825c68a3b" @@ -6734,16 +6969,16 @@ node-modules-regexp@^1.0.0: resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" integrity sha1-jZ2+KJZKSsVxLpExZCEHxx6Q7EA= -node-notifier@^5.4.2: - version "5.4.3" - resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-5.4.3.tgz#cb72daf94c93904098e28b9c590fd866e464bd50" - integrity sha512-M4UBGcs4jeOK9CjTsYwkvH6/MzuUmGCyTW+kCY7uO+1ZVr0+FHGdPdIf5CCLqAaxnRrWidyoQlNkMIIVwbKB8Q== +node-notifier@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/node-notifier/-/node-notifier-6.0.0.tgz#cea319e06baa16deec8ce5cd7f133c4a46b68e12" + integrity sha512-SVfQ/wMw+DesunOm5cKqr6yDcvUTDl/yc97ybGHMrteNEY6oekXpNpS3lZwgLlwz0FLgHoiW28ZpmBHUDg37cw== dependencies: growly "^1.3.0" - is-wsl "^1.1.0" - semver "^5.5.0" + is-wsl "^2.1.1" + semver "^6.3.0" shellwords "^0.1.1" - which "^1.3.0" + which "^1.3.1" node-pre-gyp@^0.12.0: version "0.12.0" @@ -6761,12 +6996,12 @@ node-pre-gyp@^0.12.0: semver "^5.3.0" tar "^4" -node-releases@^1.1.25: - version "1.1.26" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.26.tgz#f30563edc5c7dc20cf524cc8652ffa7be0762937" - integrity sha512-fZPsuhhUHMTlfkhDLGtfY80DSJTjOcx+qD1j5pqPkuhUHVS7xHZIg9EE4DHK8O3f0zTxXHX5VIkDG8pu98/wfQ== +node-releases@^1.1.49: + version "1.1.49" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.49.tgz#67ba5a3fac2319262675ef864ed56798bb33b93e" + integrity sha512-xH8t0LS0disN0mtRCh+eByxFPie+msJUBL/lJDBuap53QGiYPa9joh83K4pCZgWJ+2L4b9h88vCVdXQ60NO2bg== dependencies: - semver "^5.3.0" + semver "^6.3.0" nopt@^4.0.1: version "4.0.1" @@ -6776,16 +7011,6 @@ nopt@^4.0.1: abbrev "1" osenv "^0.1.4" -normalize-package-data@^2.3.2: - version "2.5.0" - resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" - integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== - dependencies: - hosted-git-info "^2.1.4" - resolve "^1.10.0" - semver "2 || 3 || 4 || 5" - validate-npm-package-license "^3.0.1" - normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" @@ -6833,6 +7058,13 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" +npm-run-path@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + npmlog@^4.0.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" @@ -6860,7 +7092,7 @@ number-is-nan@^1.0.0: resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= -nwsapi@^2.0.7: +nwsapi@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.0.tgz#204879a9e3d068ff2a55139c2c772780681a38b7" integrity sha512-h2AatdwYH+JHiZpv7pt/gSX1XoRGb7L/qSIeuqA6GwYoF9w1vP1cw42TO0aI2pNyshRK5893hNSl+1//vHK7hQ== @@ -6982,7 +7214,7 @@ optimist@^0.6.1: minimist "~0.0.1" wordwrap "~0.0.2" -optionator@^0.8.1: +optionator@^0.8.1, optionator@^0.8.3: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" integrity sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA== @@ -6994,18 +7226,6 @@ optionator@^0.8.1: type-check "~0.3.2" word-wrap "~1.2.3" -optionator@^0.8.2: - version "0.8.2" - resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.2.tgz#364c5e409d3f4d6301d6c0b4c05bba50180aeb64" - integrity sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q= - dependencies: - deep-is "~0.1.3" - fast-levenshtein "~2.0.4" - levn "~0.3.0" - prelude-ls "~1.1.2" - type-check "~0.3.2" - wordwrap "~1.0.0" - optjs@latest: version "3.2.2" resolved "https://registry.yarnpkg.com/optjs/-/optjs-3.2.2.tgz#69a6ce89c442a44403141ad2f9b370bd5bb6f4ee" @@ -7055,18 +7275,21 @@ p-defer@^1.0.0: resolved "https://registry.yarnpkg.com/p-defer/-/p-defer-1.0.0.tgz#9f6eb182f6c9aa8cd743004a7d4f96b196b0fb0c" integrity sha1-n26xgvbJqozXQwBKfU+WsZaw+ww= -p-each-series@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-1.0.0.tgz#930f3d12dd1f50e7434457a22cd6f04ac6ad7f71" - integrity sha1-kw89Et0fUOdDRFeiLNbwSsatf3E= - dependencies: - p-reduce "^1.0.0" +p-each-series@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/p-each-series/-/p-each-series-2.1.0.tgz#961c8dd3f195ea96c747e636b262b800a6b1af48" + integrity sha512-ZuRs1miPT4HrjFa+9fRfOFXxGJfORgelKV9f9nNOWw2gl6gVsRaVDOQP0+MI0G0wGKns1Yacsu0GjOFbTK0JFQ== p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" integrity sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4= +p-finally@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" + integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== + p-is-promise@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/p-is-promise/-/p-is-promise-2.1.0.tgz#918cebaea248a62cf7ffab8e3bca8c5f882fc42e" @@ -7086,6 +7309,13 @@ p-limit@^2.2.0, p-limit@^2.2.1: dependencies: p-try "^2.0.0" +p-limit@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.2.tgz#61279b67721f5287aa1c13a9a7fbbc48c9291b1e" + integrity sha512-WGR+xHecKTr7EbUEhyLSh5Dube9JtdiG78ufaeLxTgpudf/20KqyMioIUZJAezlTIi6evxuoUs9YXc11cU+yzQ== + dependencies: + p-try "^2.0.0" + p-locate@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-3.0.0.tgz#322d69a05c0264b25997d9f40cd8a891ab0064a4" @@ -7112,11 +7342,6 @@ p-map@^3.0.0: dependencies: aggregate-error "^3.0.0" -p-reduce@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/p-reduce/-/p-reduce-1.0.0.tgz#18c2b0dd936a4690a529f8231f58a0fdb6a47dfa" - integrity sha1-GMKw3ZNqRpClKfgjH1ig/bakffo= - p-retry@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-3.0.1.tgz#316b4c8893e2c8dc1cfa891f406c4b422bebf328" @@ -7169,14 +7394,6 @@ parse-asn1@^5.0.0: pbkdf2 "^3.0.3" safe-buffer "^5.1.1" -parse-json@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-4.0.0.tgz#be35f5425be1f7f6c747184f98a788cb99477ee0" - integrity sha1-vjX1Qlvh9/bHRxhPmKeIy5lHfuA= - dependencies: - error-ex "^1.3.1" - json-parse-better-errors "^1.0.1" - parse-passwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" @@ -7187,10 +7404,10 @@ parse-uri@^1.0.0: resolved "https://registry.yarnpkg.com/parse-uri/-/parse-uri-1.0.0.tgz#2872dcc22f1a797acde1583d8a0ac29552ddac20" integrity sha1-KHLcwi8aeXrN4Vg9igrClVLdrCA= -parse5@4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" - integrity sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA== +parse5@5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.0.tgz#c59341c9723f414c452975564c7c00a68d58acd2" + integrity sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ== parseqs@0.0.5: version "0.0.5" @@ -7251,6 +7468,11 @@ path-key@^2.0.0, path-key@^2.0.1: resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" integrity sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A= +path-key@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + path-key@^3.1.0: version "3.1.0" resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.0.tgz#99a10d870a803bdd5ee6f0470e58dfcd2f9a54d3" @@ -7345,7 +7567,7 @@ pkg-dir@^3.0.0: dependencies: find-up "^3.0.0" -pkg-dir@^4.1.0: +pkg-dir@^4.1.0, pkg-dir@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== @@ -7473,15 +7695,15 @@ pretty-error@^2.0.2: renderkid "^2.0.1" utila "~0.4" -pretty-format@^24.9.0: - version "24.9.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-24.9.0.tgz#12fac31b37019a4eea3c11aa9a959eb7628aa7c9" - integrity sha512-00ZMZUiHaJrNfk33guavqgvfJS30sLYf0f8+Srklv0AMPodGGHcoHgksZ3OThYnIvOd+8yMCn0YiEOogjlgsnA== +pretty-format@^25.1.0: + version "25.1.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-25.1.0.tgz#ed869bdaec1356fc5ae45de045e2c8ec7b07b0c8" + integrity sha512-46zLRSGLd02Rp+Lhad9zzuNZ+swunitn8zIpfD2B4OPCRLXbM87RJT2aBLBWYOznNUML/2l/ReMyWNC80PJBUQ== dependencies: - "@jest/types" "^24.9.0" - ansi-regex "^4.0.0" - ansi-styles "^3.2.0" - react-is "^16.8.4" + "@jest/types" "^25.1.0" + ansi-regex "^5.0.0" + ansi-styles "^4.0.0" + react-is "^16.12.0" private@^0.1.6, private@^0.1.8: version "0.1.8" @@ -7703,10 +7925,10 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -react-is@^16.8.4: - version "16.11.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.11.0.tgz#b85dfecd48ad1ce469ff558a882ca8e8313928fa" - integrity sha512-gbBVYR2p8mnriqAwWx9LbuUrShnAuSCNnuPGyc7GJrMVQtPDAh8iLpv7FRuMPFb56KkaVZIYSz1PrjI9q0QPCw== +react-is@^16.12.0: + version "16.12.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.12.0.tgz#2cc0fe0fba742d97fd527c42a13bec4eeb06241c" + integrity sha512-rPCkf/mWBtKc97aLL9/txD8DZdemK0vkA3JMLShjlJB3Pj3s+lpf1KaBzMfQrAmhMQB0n1cU/SUGgKKBCe837Q== read-file-async@^1.0.0: version "1.0.0" @@ -7716,23 +7938,6 @@ read-file-async@^1.0.0: graceful-fs "^4.1.11" typeable-promisify "^1.0.1" -read-pkg-up@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-4.0.0.tgz#1b221c6088ba7799601c808f91161c66e58f8978" - integrity sha512-6etQSH7nJGsK0RbG/2TeDzZFa8shjQ1um+SwQQ5cwKy0dhSXdOncEhb1CPpvQG4h7FyOV6EB6YlV0yJvZQNAkA== - dependencies: - find-up "^3.0.0" - read-pkg "^3.0.0" - -read-pkg@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-3.0.0.tgz#9cbc686978fee65d16c00e2b19c237fcf6e38389" - integrity sha1-nLxoaXj+5l0WwA4rGcI3/Pbjg4k= - dependencies: - load-json-file "^4.0.0" - normalize-package-data "^2.3.2" - path-type "^3.0.0" - "readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" @@ -7889,7 +8094,7 @@ request-promise-core@1.1.3: dependencies: lodash "^4.17.15" -request-promise-native@^1.0.5: +request-promise-native@^1.0.7: version "1.0.8" resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.8.tgz#a455b960b826e44e2bf8999af64dff2bfe58cb36" integrity sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ== @@ -7898,7 +8103,7 @@ request-promise-native@^1.0.5: stealthy-require "^1.1.1" tough-cookie "^2.3.3" -request@^2.83.0, request@^2.87.0: +request@^2.83.0: version "2.88.0" resolved "https://registry.yarnpkg.com/request/-/request-2.88.0.tgz#9c2fca4f7d35b592efe57c7f0a55e81052124fef" integrity sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg== @@ -7924,6 +8129,32 @@ request@^2.83.0, request@^2.87.0: tunnel-agent "^0.6.0" uuid "^3.3.2" +request@^2.88.0: + version "2.88.2" + resolved "https://registry.yarnpkg.com/request/-/request-2.88.2.tgz#d73c918731cb5a87da047e207234146f664d12b3" + integrity sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw== + dependencies: + aws-sign2 "~0.7.0" + aws4 "^1.8.0" + caseless "~0.12.0" + combined-stream "~1.0.6" + extend "~3.0.2" + forever-agent "~0.6.1" + form-data "~2.3.2" + har-validator "~5.1.3" + http-signature "~1.2.0" + is-typedarray "~1.0.0" + isstream "~0.1.2" + json-stringify-safe "~5.0.1" + mime-types "~2.1.19" + oauth-sign "~0.9.0" + performance-now "^2.1.0" + qs "~6.5.2" + safe-buffer "^5.1.2" + tough-cookie "~2.5.0" + tunnel-agent "^0.6.0" + uuid "^3.3.2" + require-directory@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" @@ -7959,6 +8190,13 @@ resolve-cwd@^2.0.0: dependencies: resolve-from "^3.0.0" +resolve-cwd@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-3.0.0.tgz#0f0075f1bb2544766cf73ba6a6e2adfebcb13f2d" + integrity sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg== + dependencies: + resolve-from "^5.0.0" + resolve-dir@^1.0.0, resolve-dir@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/resolve-dir/-/resolve-dir-1.0.1.tgz#79a40644c362be82f26effe739c9bb5382046f43" @@ -7977,6 +8215,11 @@ resolve-from@^4.0.0: resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6" integrity sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g== +resolve-from@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-5.0.0.tgz#c35225843df8f776df21c57557bc087e9dfdfc69" + integrity sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw== + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" @@ -7987,13 +8230,20 @@ resolve@1.1.7: resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@^1.10.0, resolve@^1.12.0: +resolve@^1.12.0: version "1.12.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== dependencies: path-parse "^1.0.6" +resolve@^1.13.1: + version "1.15.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.15.1.tgz#27bdcdeffeaf2d6244b95bb0f9f4b4653451f3e8" + integrity sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w== + dependencies: + path-parse "^1.0.6" + resolve@^1.3.2, resolve@^1.3.3, resolve@^1.5.0, resolve@^1.8.1: version "1.11.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e" @@ -8043,6 +8293,13 @@ rimraf@^2.7.1: dependencies: glob "^7.1.3" +rimraf@^3.0.0: + version "3.0.2" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-3.0.2.tgz#f1a5402ba6220ad52cc1282bac1ae3aa49fd061a" + integrity sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA== + dependencies: + glob "^7.1.3" + ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" @@ -8051,22 +8308,6 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -ripple-address-codec@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/ripple-address-codec/-/ripple-address-codec-2.0.1.tgz#eddbe3a7960d2e02c5c1c74fb9a9fa0d2dfb6571" - integrity sha1-7dvjp5YNLgLFwcdPuan6DS37ZXE= - dependencies: - hash.js "^1.0.3" - x-address-codec "^0.7.0" - -ripple-address-codec@^3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/ripple-address-codec/-/ripple-address-codec-3.0.4.tgz#a7a8bb040df41cb082330fd828f09b9e6478c7fd" - integrity sha512-GFk1BgavW+9oy5Z1Cp6YAGMfB51QdbeuhOo0Zir+s+S40F5vHtVZYu6zZE1eOAX92A5kygPuBRX4APH2v8Yhmg== - dependencies: - base-x "3.0.4" - create-hash "^1.1.2" - ripple-address-codec@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/ripple-address-codec/-/ripple-address-codec-4.0.0.tgz#c20f39eea38def43d2379462e47bff4adabece30" @@ -8076,55 +8317,54 @@ ripple-address-codec@^4.0.0: base-x "3.0.4" create-hash "^1.1.2" -ripple-binary-codec@^0.2.4: - version "0.2.4" - resolved "https://registry.yarnpkg.com/ripple-binary-codec/-/ripple-binary-codec-0.2.4.tgz#555d64c52182a215222af6045b5170e43f0530b1" - integrity sha512-lfT9bybaVqA8IJmGFnSWaISCXmwvNY/P5HHKm6zQ1yTIXJpC+hDIeQqm/eD/2HLv82y2IvqGYd0GhEQ41lpNpQ== +ripple-binary-codec@^0.2.5: + version "0.2.6" + resolved "https://registry.yarnpkg.com/ripple-binary-codec/-/ripple-binary-codec-0.2.6.tgz#a8c45c905c12d5dc6fa7e179c3584d56fb8bdb07" + integrity sha512-k0efyjpcde7p+rJ9PXW9tJSYsUDdlC9Z9xU7OPM7fJiHVKlR1E7nfu0jqw9vVXtTG3tujqKeEgtcb8yaa7rMXA== dependencies: babel-runtime "^6.6.1" - bn.js "^4.11.3" + bn.js "^5.1.1" create-hash "^1.1.2" - decimal.js "^5.0.8" + decimal.js "^10.2.0" inherits "^2.0.1" lodash "^4.17.15" - ripple-address-codec "^3.0.4" + ripple-address-codec "^4.0.0" -ripple-keypairs@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/ripple-keypairs/-/ripple-keypairs-0.11.0.tgz#ee9f4172d615106f4d3c0af15805960742dab045" - integrity sha512-kzYwlWaLu1fl+StJdfZuEmcooJI18QuWxatII+Rcd3QeWXne16ml7N1e4HpYI/aJ69Cn4npsJef7kHSaA83Fgg== +ripple-keypairs@^1.0.0-beta.6: + version "1.0.0" + resolved "https://registry.yarnpkg.com/ripple-keypairs/-/ripple-keypairs-1.0.0.tgz#8f1c604f89daeac5e61b7eebbbca2da99da2bacf" + integrity sha512-MQ3d6fU3D+Cqu5ma4dfkfa+KakN2sKpVVVN0FeJyAYPVIGXu8Rcvd1g028TdwYAZcSYk0tGn5UhHxd0gUG3T8g== dependencies: - babel-runtime "^5.8.20" - bn.js "^3.1.1" + bn.js "^5.1.1" brorand "^1.0.5" - elliptic "^6.4.0" + elliptic "^6.5.2" hash.js "^1.0.3" - ripple-address-codec "^2.0.1" + ripple-address-codec "^4.0.0" -ripple-lib-transactionparser@0.8.0: - version "0.8.0" - resolved "https://registry.yarnpkg.com/ripple-lib-transactionparser/-/ripple-lib-transactionparser-0.8.0.tgz#1dea607f8c16a410a4211386accc3388d7239272" - integrity sha512-M3HjfPABR6tpU5goQQh1b6tx1PbpDNMyYSKMkyW9LzYSMzJLFfWiQJ8wFFBrduJkwmtDfuolIVT0/f235a3YTw== +ripple-lib-transactionparser@0.8.2: + version "0.8.2" + resolved "https://registry.yarnpkg.com/ripple-lib-transactionparser/-/ripple-lib-transactionparser-0.8.2.tgz#7aaad3ba1e1aeee1d5bcff32334a7a838f834dce" + integrity sha512-1teosQLjYHLyOQrKUQfYyMjDR3MAq/Ga+MJuLUfpBMypl4LZB4bEoMcmG99/+WVTEiZOezJmH9iCSvm/MyxD+g== dependencies: - bignumber.js "8.1.1" - lodash "^4.17.4" + bignumber.js "^9.0.0" + lodash "^4.17.15" -ripple-lib@^1.4.0: - version "1.4.1" - resolved "https://registry.yarnpkg.com/ripple-lib/-/ripple-lib-1.4.1.tgz#819bc366464a5398eb68420340700a2565ca67b2" - integrity sha512-23wK5xia65h8NndppTay55a8y7ZFnfVpTraQ3JTouMli0hIu/cOVlOwytLMxLmcLgI82TNnMK2Qujh49CGRAGw== +ripple-lib@1.6.3: + version "1.6.3" + resolved "https://registry.yarnpkg.com/ripple-lib/-/ripple-lib-1.6.3.tgz#de68e656bd49d743e31b8bf30d41004519d05dfe" + integrity sha512-Vu6aUgbL2Kw1F0fMOJs13wu0seQLfURz00iQit03gJbAXiTmRR5zAWpDuC7DYjIqTEIgQFI/GSYLLEz/ZQNH0A== dependencies: "@types/lodash" "^4.14.136" - "@types/ws" "^6.0.3" + "@types/ws" "^7.2.0" bignumber.js "^9.0.0" - https-proxy-agent "^3.0.0" + https-proxy-agent "^4.0.0" jsonschema "1.2.2" lodash "^4.17.4" lodash.isequal "^4.5.0" ripple-address-codec "^4.0.0" - ripple-binary-codec "^0.2.4" - ripple-keypairs "^0.11.0" - ripple-lib-transactionparser "0.8.0" + ripple-binary-codec "^0.2.5" + ripple-keypairs "^1.0.0-beta.6" + ripple-lib-transactionparser "0.8.2" ws "^7.2.0" rsvp@^4.8.4: @@ -8207,6 +8447,13 @@ sax@^1.2.4: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== +saxes@^3.1.9: + version "3.1.11" + resolved "https://registry.yarnpkg.com/saxes/-/saxes-3.1.11.tgz#d59d1fd332ec92ad98a2e0b2ee644702384b1c5b" + integrity sha512-Ydydq3zC+WYDJK1+gRxRapLIED9PWeSuuS41wqyoRmzvhhh9nc+QQrVMKJYzJFULazeGhzSV0QleN2wD3boh2g== + dependencies: + xmlchars "^2.1.1" + schema-utils@^0.4.0: version "0.4.7" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.7.tgz#ba74f597d2be2ea880131746ee17d0a093c68187" @@ -8224,15 +8471,7 @@ schema-utils@^1.0.0: ajv-errors "^1.0.0" ajv-keywords "^3.1.0" -schema-utils@^2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.0.1.tgz#1eec2e059556af841b7f3a83b61af13d7a3f9196" - integrity sha512-HJFKJ4JixDpRur06QHwi8uu2kZbng318ahWEKgBjc0ZklcE4FDvmm2wghb448q0IRaABxIESt8vqPFvwgMB80A== - dependencies: - ajv "^6.1.0" - ajv-keywords "^3.1.0" - -schema-utils@^2.6.0, schema-utils@^2.6.1, schema-utils@^2.6.4: +schema-utils@^2.5.0, schema-utils@^2.6.0, schema-utils@^2.6.4: version "2.6.4" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.4.tgz#a27efbf6e4e78689d91872ee3ccfa57d7bdd0f53" integrity sha512-VNjcaUxVnEeun6B2fiiUDjXXBtD4ZSH7pdbfIu1pOFwgptDPLMo/z9jr4sUfsjFVPqDCEin/F7IYlq7/E6yDbQ== @@ -8271,17 +8510,17 @@ semver-compare@^1.0.0: resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w= -"semver@2 || 3 || 4 || 5": - version "5.7.1" - resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== +semver@7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" + integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0: version "5.7.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== -semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.2.0, semver@^6.3.0: +semver@^6.0.0, semver@^6.1.2, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -8652,32 +8891,6 @@ source-map@^0.7.3: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== -spdx-correct@^3.0.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-3.1.0.tgz#fb83e504445268f154b074e218c87c003cd31df4" - integrity sha512-lr2EZCctC2BNR7j7WzJ2FpDznxky1sjfxvvYEyzxNyb6lZXHODmEoJeFu4JupYlkfha1KZpJyoqiJ7pgA1qq8Q== - dependencies: - spdx-expression-parse "^3.0.0" - spdx-license-ids "^3.0.0" - -spdx-exceptions@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/spdx-exceptions/-/spdx-exceptions-2.2.0.tgz#2ea450aee74f2a89bfb94519c07fcd6f41322977" - integrity sha512-2XQACfElKi9SlVb1CYadKDXvoajPgBVPn/gOQLrTvHdElaVhr7ZEbqJaRnJLVNeaI4cMEAgVCeBMKF6MWRDCRA== - -spdx-expression-parse@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz#99e119b7a5da00e05491c9fa338b7904823b41d0" - integrity sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg== - dependencies: - spdx-exceptions "^2.1.0" - spdx-license-ids "^3.0.0" - -spdx-license-ids@^3.0.0: - version "3.0.5" - resolved "https://registry.yarnpkg.com/spdx-license-ids/-/spdx-license-ids-3.0.5.tgz#3694b5804567a458d3c8045842a6358632f62654" - integrity sha512-J+FWzZoynJEXGphVIS+XEh3kFSjZX/1i9gFBaWQcB+/tmpe2qUsSBABpcxqxnAxFdiUFEgAX1bjYGQvIZmoz9Q== - spdy-transport@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/spdy-transport/-/spdy-transport-3.0.0.tgz#00d4863a6400ad75df93361a1608605e5dcdcf31" @@ -8819,13 +9032,13 @@ string-argv@^0.3.1: resolved "https://registry.yarnpkg.com/string-argv/-/string-argv-0.3.1.tgz#95e2fbec0427ae19184935f816d74aaa4c5c19da" integrity sha512-a1uQGz7IyVy9YwhqjZIZu1c8JO8dNIe20xBmSS6qu9kv++k3JGzCVmprbNN5Kn+BgzD5E7YYwg1CcjuJMRNsvg== -string-length@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/string-length/-/string-length-2.0.0.tgz#d40dbb686a3ace960c1cffca562bf2c45f8363ed" - integrity sha1-1A27aGo6zpYMHP/KVivyxF+DY+0= +string-length@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/string-length/-/string-length-3.1.0.tgz#107ef8c23456e187a8abd4a61162ff4ac6e25837" + integrity sha512-Ttp5YvkGm5v9Ijagtaz1BnN+k9ObpvS0eIBblPMp2YWL8FBmi9qblQ9fexc2k/CXFgrTIteU3jAw3payCnwSTA== dependencies: astral-regex "^1.0.0" - strip-ansi "^4.0.0" + strip-ansi "^5.2.0" string-width@^1.0.1: version "1.0.2" @@ -8862,6 +9075,15 @@ string-width@^4.1.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^5.2.0" +string-width@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.0.tgz#952182c46cc7b2c313d1596e623992bd163b72b5" + integrity sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.0" + string_decoder@^1.0.0, string_decoder@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.2.0.tgz#fe86e738b19544afe70469243b2a1ee9240eae8d" @@ -8897,16 +9119,28 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" -strip-bom@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" - integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= +strip-ansi@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.0.tgz#0b1571dd7669ccd4f3e06e14ef1eed26225ae532" + integrity sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w== + dependencies: + ansi-regex "^5.0.0" + +strip-bom@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-4.0.0.tgz#9c3505c1db45bcedca3d9cf7a16f5c5aa3901878" + integrity sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w== strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" integrity sha1-u0P/VZim6wXYm1n80SnJgzE2Br8= +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + strip-indent@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" @@ -8949,6 +9183,21 @@ supports-color@^5.3.0, supports-color@^5.4.0: dependencies: has-flag "^3.0.0" +supports-color@^7.0.0, supports-color@^7.1.0: + version "7.1.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" + integrity sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g== + dependencies: + has-flag "^4.0.0" + +supports-hyperlinks@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.1.0.tgz#f663df252af5f37c5d49bbd7eeefa9e0b9e59e47" + integrity sha512-zoE5/e+dnEijk6ASB6/qrK+oYdm2do1hjoLWrqUC/8WEIW1gbxFcKuBof7sW8ArN6e+AYvsE8HBGiVRWL/F5CA== + dependencies: + has-flag "^4.0.0" + supports-color "^7.0.0" + symbol-tree@^3.2.2: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" @@ -8982,15 +9231,24 @@ tar@^4: safe-buffer "^5.1.2" yallist "^3.0.3" -terser-webpack-plugin@2.3.2: - version "2.3.2" - resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.3.2.tgz#6d3d1b0590c8f729bfbaeb7fb2528b8b62db4c74" - integrity sha512-SmvB/6gtEPv+CJ88MH5zDOsZdKXPS/Uzv2//e90+wM1IHFUhsguPKEILgzqrM1nQ4acRXN/SV4Obr55SXC+0oA== +terminal-link@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" + integrity sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ== + dependencies: + ansi-escapes "^4.2.1" + supports-hyperlinks "^2.0.0" + +terser-webpack-plugin@2.3.5: + version "2.3.5" + resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-2.3.5.tgz#5ad971acce5c517440ba873ea4f09687de2f4a81" + integrity sha512-WlWksUoq+E4+JlJ+h+U+QUzXpcsMSSNXkDy9lBVkSqDn1w23Gg29L/ary9GeJVYCGiNJJX7LnVc4bwL1N3/g1w== dependencies: cacache "^13.0.1" find-cache-dir "^3.2.0" - jest-worker "^24.9.0" - schema-utils "^2.6.1" + jest-worker "^25.1.0" + p-limit "^2.2.2" + schema-utils "^2.6.4" serialize-javascript "^2.1.2" source-map "^0.6.1" terser "^4.4.3" @@ -9029,25 +9287,24 @@ terser@^4.4.3: source-map "~0.6.1" source-map-support "~0.5.12" -test-exclude@^5.2.3: - version "5.2.3" - resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0" - integrity sha512-M+oxtseCFO3EDtAaGH7iiej3CBkzXqFMbzqYAACdzKui4eZA+pq3tZEwChvOdNfa7xxy8BfbmgJSIr43cC/+2g== +test-exclude@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" + integrity sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w== dependencies: - glob "^7.1.3" + "@istanbuljs/schema" "^0.1.2" + glob "^7.1.4" minimatch "^3.0.4" - read-pkg-up "^4.0.0" - require-main-filename "^2.0.0" text-table@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4" integrity sha1-f17oI66AUgfACvLfSoTsP8+lcLQ= -throat@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/throat/-/throat-4.1.0.tgz#89037cbc92c56ab18926e6ba4cbb200e15672a6a" - integrity sha1-iQN8vJLFarGJJua6TLsgDhVnKmo= +throat@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/throat/-/throat-5.0.0.tgz#c5199235803aad18754a667d659b5e72ce16764b" + integrity sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA== through2@^2.0.0: version "2.0.5" @@ -9155,7 +9412,7 @@ toposort@^1.0.0: resolved "https://registry.yarnpkg.com/toposort/-/toposort-1.0.7.tgz#2e68442d9f64ec720b8cc89e6443ac6caa950029" integrity sha1-LmhELZ9k7HILjMieZEOsbKqVACk= -tough-cookie@^2.3.3, tough-cookie@^2.3.4: +tough-cookie@^2.3.3, tough-cookie@~2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== @@ -9163,6 +9420,15 @@ tough-cookie@^2.3.3, tough-cookie@^2.3.4: psl "^1.1.28" punycode "^2.1.1" +tough-cookie@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-3.0.1.tgz#9df4f57e739c26930a018184887f4adb7dca73b2" + integrity sha512-yQyJ0u4pZsv9D4clxO69OEjLWYw+jbgspjTue4lTQZLfV0c5l1VmK2y1JK8E9ahdpltPOaAThPcp5nKPUgSnsg== + dependencies: + ip-regex "^2.1.0" + psl "^1.1.28" + punycode "^2.1.1" + tough-cookie@~2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" @@ -9197,7 +9463,7 @@ trim-right@^1.0.1: resolved "https://registry.yarnpkg.com/trim-right/-/trim-right-1.0.1.tgz#cb2e1203067e0c8de1f614094b9fe45704ea6003" integrity sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM= -tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.10.0, tslib@^1.8.1, tslib@^1.9.0: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== @@ -9233,7 +9499,7 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" -type-detect@^4.0.8: +type-detect@4.0.8, type-detect@^4.0.8: version "4.0.8" resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== @@ -9243,6 +9509,11 @@ type-fest@^0.5.2: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2" integrity sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw== +type-fest@^0.8.1: + version "0.8.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" + integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== + type-is@~1.6.17, type-is@~1.6.18: version "1.6.18" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" @@ -9258,6 +9529,13 @@ typeable-promisify@^1.0.1: dependencies: any-promise "^1.3.0" +typedarray-to-buffer@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz#a97ee7a9ff42691b9f783ff1bc5112fe3fca9080" + integrity sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q== + dependencies: + is-typedarray "^1.0.0" + typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" @@ -9289,14 +9567,6 @@ uglify-js@3.4.x: commander "~2.19.0" source-map "~0.6.1" -uglify-js@^3.1.4: - version "3.6.9" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.6.9.tgz#85d353edb6ddfb62a9d798f36e91792249320611" - integrity sha512-pcnnhaoG6RtrvHJ1dFncAe8Od6Nuy30oaJ82ts6//sGSXOP5UjBMEthiProjXmMNHOfd93sqlkztifFMcb+4yw== - dependencies: - commander "~2.20.3" - source-map "~0.6.1" - ultron@~1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" @@ -9475,6 +9745,15 @@ v8-compile-cache@^2.0.3: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== +v8-to-istanbul@^4.0.1: + version "4.1.2" + resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-4.1.2.tgz#387d173be5383dbec209d21af033dcb892e3ac82" + integrity sha512-G9R+Hpw0ITAmPSr47lSlc5A1uekSYzXxTMlFxso2xoffwo4jQnzbv1p9yXIinO8UMZKfAFewaCHwWvnH4Jb4Ug== + dependencies: + "@types/istanbul-lib-coverage" "^2.0.1" + convert-source-map "^1.6.0" + source-map "^0.7.3" + v8flags@^3.1.1: version "3.1.3" resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.1.3.tgz#fc9dc23521ca20c5433f81cc4eb9b3033bb105d8" @@ -9482,14 +9761,6 @@ v8flags@^3.1.1: dependencies: homedir-polyfill "^1.0.1" -validate-npm-package-license@^3.0.1: - version "3.0.4" - resolved "https://registry.yarnpkg.com/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz#fc91f6b9c7ba15c857f4cb2c5defeec39d4f410a" - integrity sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew== - dependencies: - spdx-correct "^3.0.0" - spdx-expression-parse "^3.0.0" - varuint-bitcoin@^1.0.4: version "1.1.0" resolved "https://registry.yarnpkg.com/varuint-bitcoin/-/varuint-bitcoin-1.1.0.tgz#7a343f50537607af6a3059312b9782a170894540" @@ -9511,19 +9782,12 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -version-bump-prompt@5.0.7: - version "5.0.7" - resolved "https://registry.yarnpkg.com/version-bump-prompt/-/version-bump-prompt-5.0.7.tgz#bdb7aea109f0b198a360cdb52a7c627307689fc1" - integrity sha512-+HWtzCySSFDuV5ljvzZNX4K+lYoR5L89lIt2dkrTCk3o6/eqNc8k/+mxMpugHeRGPn5MzygmgW0e9auJ/AOtgg== +version-bump-prompt@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/version-bump-prompt/-/version-bump-prompt-6.0.0.tgz#964b128c97c0a6eca5265846a2acaf7b98aa2ff1" + integrity sha512-khGwb7LT50DAKcrjqo4CYC4V4SM/roI7K0luY4Ofd45k8OFeixAyAwjm9/ZMc4I8QdWvb0mdeuYFGUiSXCe8+w== dependencies: - command-line-args "^5.1.1" - detect-indent "^6.0.0" - detect-newline "^3.1.0" - ez-spawn "^2.1.6" - globby "^10.0.1" - inquirer "^7.0.1" - log-symbols "^3.0.0" - semver "^7.1.1" + "@jsdevtools/version-bump-prompt" "6.0.0" vm-browserify@^1.0.1: version "1.1.0" @@ -9542,6 +9806,15 @@ w3c-hr-time@^1.0.1: dependencies: browser-process-hrtime "^0.1.2" +w3c-xmlserializer@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-1.1.2.tgz#30485ca7d70a6fd052420a3d12fd90e6339ce794" + integrity sha512-p10l/ayESzrBMYWRID6xbuCKh2Fp77+sA0doRuGn4tTIMrrZVeqfpKjXHY+oDh3K4nLdPgNwMTVP6Vp4pvqbNg== + dependencies: + domexception "^1.0.1" + webidl-conversions "^4.0.2" + xml-name-validator "^3.0.0" + walker@^1.0.7, walker@~1.0.5: version "1.0.7" resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.7.tgz#2f7f9b8fd10d677262b18a884e28d19618e028fb" @@ -9570,10 +9843,10 @@ webidl-conversions@^4.0.2: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-4.0.2.tgz#a855980b1f0b6b359ba1d5d9fb39ae941faa63ad" integrity sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg== -webpack-cli@3.3.10: - version "3.3.10" - resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.3.10.tgz#17b279267e9b4fb549023fae170da8e6e766da13" - integrity sha512-u1dgND9+MXaEt74sJR4PR7qkPxXUSQ0RXYq8x1L6Jg1MYVEmGPrH6Ah6C4arD4r0J1P5HKjRqpab36k0eIzPqg== +webpack-cli@3.3.11: + version "3.3.11" + resolved "https://registry.yarnpkg.com/webpack-cli/-/webpack-cli-3.3.11.tgz#3bf21889bf597b5d82c38f215135a411edfdc631" + integrity sha512-dXlfuml7xvAFwYUPsrtQAA9e4DOe58gnzSxhgrO/ZM/gyXTBowrsYeubyN4mqGhYdpXMFNyQ6emjJS9M7OBd4g== dependencies: chalk "2.4.2" cross-spawn "6.0.5" @@ -9608,10 +9881,10 @@ webpack-dev-middleware@^3.7.2: range-parser "^1.2.1" webpack-log "^2.0.0" -webpack-dev-server@3.10.1: - version "3.10.1" - resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.10.1.tgz#1ff3e5cccf8e0897aa3f5909c654e623f69b1c0e" - integrity sha512-AGG4+XrrXn4rbZUueyNrQgO4KGnol+0wm3MPdqGLmmA+NofZl3blZQKxZ9BND6RDNuvAK9OMYClhjOSnxpWRoA== +webpack-dev-server@3.10.3: + version "3.10.3" + resolved "https://registry.yarnpkg.com/webpack-dev-server/-/webpack-dev-server-3.10.3.tgz#f35945036813e57ef582c2420ef7b470e14d3af0" + integrity sha512-e4nWev8YzEVNdOMcNzNeCN947sWJNd43E5XvsJzbAL08kGc2frm1tQ32hTJslRS+H65LCb/AaUCYU7fjHCpDeQ== dependencies: ansi-html "0.0.7" bonjour "^3.5.0" @@ -9671,10 +9944,10 @@ webpack-sources@^1.4.1, webpack-sources@^1.4.3: source-list-map "^2.0.0" source-map "~0.6.1" -webpack@4.41.5: - version "4.41.5" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.41.5.tgz#3210f1886bce5310e62bb97204d18c263341b77c" - integrity sha512-wp0Co4vpyumnp3KlkmpM5LWuzvZYayDwM2n17EHFr4qxBBbRokC7DJawPJC7TfSFZ9HZ6GsdH40EBj4UV0nmpw== +webpack@4.41.6: + version "4.41.6" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.41.6.tgz#12f2f804bf6542ef166755050d4afbc8f66ba7e1" + integrity sha512-yxXfV0Zv9WMGRD+QexkZzmGIh54bsvEs+9aRWxnN8erLWEOehAKUTeNBoUbA6HPEZPlRo7KDi2ZcNveoZgK9MA== dependencies: "@webassemblyjs/ast" "1.8.5" "@webassemblyjs/helper-module-context" "1.8.5" @@ -9714,7 +9987,7 @@ websocket-extensions@>=0.1.1: resolved "https://registry.yarnpkg.com/websocket-extensions/-/websocket-extensions-0.1.3.tgz#5d2ff22977003ec687a4b87073dfbbac146ccf29" integrity sha512-nqHUnMXmBzT0w570r2JpJxfiSD1IzoI+HGVdd3aZ0yNi3ngvQ4jv1dtHt5VGxfI2yj5yqImPhOK4vmIh2xMbGg== -whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3: +whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== @@ -9726,20 +9999,11 @@ whatwg-fetch@^3.0.0: resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q== -whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0: +whatwg-mimetype@^2.2.0, whatwg-mimetype@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== -whatwg-url@^6.4.1: - version "6.5.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-6.5.0.tgz#f2df02bff176fd65070df74ad5ccbb5a199965a8" - integrity sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ== - dependencies: - lodash.sortby "^4.7.0" - tr46 "^1.0.1" - webidl-conversions "^4.0.2" - whatwg-url@^7.0.0: version "7.1.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-7.1.0.tgz#c2c492f1eca612988efd3d2266be1b9fc6170d06" @@ -9754,7 +10018,7 @@ which-module@^2.0.0: resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" integrity sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho= -which@^1.2.1, which@^1.2.14, which@^1.2.9, which@^1.3.0, which@^1.3.1: +which@^1.2.1, which@^1.2.14, which@^1.2.9, which@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" integrity sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ== @@ -9792,11 +10056,6 @@ wordwrap@~0.0.2: resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-0.0.3.tgz#a3d5da6cd5c0bc0008d37234bbaf1bed63059107" integrity sha1-o9XabNXAvAAI03I0u68b7WMFkQc= -wordwrap@~1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb" - integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus= - worker-farm@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/worker-farm/-/worker-farm-1.7.0.tgz#26a94c5391bbca926152002f69b84a4bf772e5a8" @@ -9829,19 +10088,29 @@ wrap-ansi@^5.1.0: string-width "^3.0.0" strip-ansi "^5.0.0" +wrap-ansi@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" + integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -write-file-atomic@2.4.1: - version "2.4.1" - resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.1.tgz#d0b05463c188ae804396fd5ab2a370062af87529" - integrity sha512-TGHFeZEZMnv+gBFRfjAcxL5bPHrsGKtnb4qsFAws7/vlh+QfwAaySIw4AXP9ZskTTh5GWu3FLuJhsWVdiJPGvg== +write-file-atomic@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-3.0.1.tgz#558328352e673b5bb192cf86500d60b230667d4b" + integrity sha512-JPStrIyyVJ6oCSz/691fAjFtefZ6q+fP6tm+OS4Qw6o+TGQxNp1ziY2PgS+X/m0V8OWhZiO/m4xSj+Pr4RrZvw== dependencies: - graceful-fs "^4.1.11" imurmurhash "^0.1.4" + is-typedarray "^1.0.0" signal-exit "^3.0.2" + typedarray-to-buffer "^3.1.5" write@1.0.3: version "1.0.3" @@ -9850,13 +10119,6 @@ write@1.0.3: dependencies: mkdirp "^0.5.1" -ws@^5.2.0: - version "5.2.2" - resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" - integrity sha512-jaHFD6PFv6UgoIVda6qZllptQsMlDEJkTQcybzzXDYM1XO9Y8em691FGMPmM46WGyLU4z9KMgQN+qrux/nhlHA== - dependencies: - async-limiter "~1.0.0" - ws@^6.2.1: version "6.2.1" resolved "https://registry.yarnpkg.com/ws/-/ws-6.2.1.tgz#442fdf0a47ed64f59b6a5d8ff130f4748ed524fb" @@ -9864,6 +10126,11 @@ ws@^6.2.1: dependencies: async-limiter "~1.0.0" +ws@^7.0.0: + version "7.2.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.1.tgz#03ed52423cd744084b2cf42ed197c8b65a936b8e" + integrity sha512-sucePNSafamSKoOqoNfBd8V0StlkzJKL2ZAhGQinCfNQ+oacw+Pk7lcdAElecBF2VkLNZRiIb5Oi1Q5lVUVt2A== + ws@^7.2.0: version "7.2.0" resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.0.tgz#422eda8c02a4b5dba7744ba66eebbd84bcef0ec7" @@ -9887,18 +10154,16 @@ ws@~6.1.0: dependencies: async-limiter "~1.0.0" -x-address-codec@^0.7.0: - version "0.7.2" - resolved "https://registry.yarnpkg.com/x-address-codec/-/x-address-codec-0.7.2.tgz#2a2f7bb00278520bd13733a7959a05443d6802e0" - integrity sha1-Ki97sAJ4UgvRNzOnlZoFRD1oAuA= - dependencies: - base-x "^1.0.1" - xml-name-validator@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== +xmlchars@^2.1.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" + integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== + xmlhttprequest-ssl@~1.5.4: version "1.5.5" resolved "https://registry.yarnpkg.com/xmlhttprequest-ssl/-/xmlhttprequest-ssl-1.5.5.tgz#c2876b06168aadc40e57d97e81191ac8f4398b3e" @@ -9937,7 +10202,7 @@ yargs-parser@^11.1.1: camelcase "^5.0.0" decamelize "^1.2.0" -yargs-parser@^13.1.0, yargs-parser@^13.1.1: +yargs-parser@^13.1.0: version "13.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.1.tgz#d26058532aa06d365fe091f6a1fc06b2f7e5eca0" integrity sha512-oVAVsHz6uFrg3XQheFII8ESO2ssAf9luWuAd6Wexsu4F3OtIW0o8IribPXYrD4WC24LWtPrJlGy87y5udK+dxQ== @@ -9945,6 +10210,14 @@ yargs-parser@^13.1.0, yargs-parser@^13.1.1: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-parser@^16.1.0: + version "16.1.0" + resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-16.1.0.tgz#73747d53ae187e7b8dbe333f95714c76ea00ecf1" + integrity sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg== + dependencies: + camelcase "^5.0.0" + decamelize "^1.2.0" + yargs@12.0.5: version "12.0.5" resolved "https://registry.yarnpkg.com/yargs/-/yargs-12.0.5.tgz#05f5997b609647b64f66b81e3b4b10a368e7ad13" @@ -9980,21 +10253,22 @@ yargs@13.2.4: y18n "^4.0.0" yargs-parser "^13.1.0" -yargs@^13.3.0: - version "13.3.0" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-13.3.0.tgz#4c657a55e07e5f2cf947f8a366567c04a0dedc83" - integrity sha512-2eehun/8ALW8TLoIl7MVaRUrg+yCnenu8B4kBlRxj3GJGDKU1Og7sMXPNm1BYyM1DOJmTZ4YeN/Nwxv+8XJsUA== +yargs@^15.0.0: + version "15.1.0" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.1.0.tgz#e111381f5830e863a89550bd4b136bb6a5f37219" + integrity sha512-T39FNN1b6hCW4SOIk1XyTOWxtXdcen0t+XYrysQmChzSipvhBO8Bj0nK1ozAasdk24dNWuMZvr4k24nz+8HHLg== dependencies: - cliui "^5.0.0" - find-up "^3.0.0" + cliui "^6.0.0" + decamelize "^1.2.0" + find-up "^4.1.0" get-caller-file "^2.0.1" require-directory "^2.1.1" require-main-filename "^2.0.0" set-blocking "^2.0.0" - string-width "^3.0.0" + string-width "^4.2.0" which-module "^2.0.0" y18n "^4.0.0" - yargs-parser "^13.1.1" + yargs-parser "^16.1.0" yeast@0.1.2: version "0.1.2" From d8b731e38499eb0efb10039779ee644fc8ce3673 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 19 Feb 2020 09:25:11 +0100 Subject: [PATCH 11/51] Update build-npm-extended.js --- scripts/build-npm-extended.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/build-npm-extended.js b/scripts/build-npm-extended.js index a9a0a9aae..dc469b60e 100644 --- a/scripts/build-npm-extended.js +++ b/scripts/build-npm-extended.js @@ -14,8 +14,8 @@ fse.copySync(src, lib, { filter: function (src, dest) { // do not copy "*/_old" directory if (src.indexOf('_old') >= 0) return false; - // do not copy "types/__test__" directory - if (src.indexOf('types/__tests__') >= 0) return false; + // do not copy "__test__" directory + if (src.indexOf('__tests__') >= 0) return false; const ext = src.split('.').pop(); if (ext === 'js') { fse.copySync(src, dest + '.flow'); @@ -27,7 +27,8 @@ fse.copySync(src, lib, { // copy typescript fse.copySync(ts, `${lib}/typescript`, { filter: function (src, dest) { - if (src.indexOf('types/__tests__') >= 0) return false; + // do not copy "__test__" directory + if (src.indexOf('__tests__') >= 0) return false; if (src.indexOf('.json') >= 0) return false; return true; }, From 4bc940a781ef6bc507b23f98b0076e828042a10d Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 19 Feb 2020 09:42:12 +0100 Subject: [PATCH 12/51] update coins & fw releases --- src/data/coins.json | 16 ++++++++++++++++ src/data/firmware/2/releases.json | 13 +++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/data/coins.json b/src/data/coins.json index bdd9e4cd7..2bbff904b 100644 --- a/src/data/coins.json +++ b/src/data/coins.json @@ -2400,6 +2400,22 @@ }, "url": "https://www.mix-blockchain.org" }, + { + "blockbook": [], + "chain": "ere", + "chain_id": 466, + "name": "EtherCore", + "rskip60": false, + "shortcut": "ERE", + "slip44": 466, + "support": { + "connect": true, + "trezor1": "1.8.4", + "trezor2": "2.2.2", + "webwallet": false + }, + "url": "https://ethercore.org" + }, { "blockbook": [], "chain": "clo", diff --git a/src/data/firmware/2/releases.json b/src/data/firmware/2/releases.json index 6b9e2cff2..c86a76c7b 100644 --- a/src/data/firmware/2/releases.json +++ b/src/data/firmware/2/releases.json @@ -1,4 +1,17 @@ [ + { + "required": false, + "version": [2, 2, 0], + "min_bridge_version": [2, 0, 7], + "min_firmware_version": [2, 0, 8], + "min_bootloader_version": [2, 0, 0], + "url": "data/firmware/2/trezor-2.2.0.bin", + "url_bitcoinonly": "data/firmware/2/trezor-2.2.0-bitcoinonly.bin", + "fingerprint": "1df674a59e718199a381cb10885ac4ba4ef580161da4fac3bbd95e989f428b7b", + "fingerprint_bitcoinonly": "f48e49cf3ab6369eeb3fbe4ede008b1ca6becc8f99eac3388111f93dccfc4c43", + "channel": "beta", + "changelog": "* Introduce Wipe code\n* U2F UX improvements\n* Fix continuous display blinking with Android in U2F\n* Rework Recovery persistence internally\n* Add screen for time bounds in Stellar" + }, { "required": false, "version": [2, 1, 8], From 886a467636ffb6dd72bd1eaee77c738c38e63732 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 19 Feb 2020 10:11:30 +0100 Subject: [PATCH 13/51] Update build-npm-extended.js --- scripts/build-npm-extended.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/build-npm-extended.js b/scripts/build-npm-extended.js index dc469b60e..ca96accb9 100644 --- a/scripts/build-npm-extended.js +++ b/scripts/build-npm-extended.js @@ -9,13 +9,17 @@ const lib = path.resolve(__dirname, '../npm-extended/lib'); const dataSrc = path.resolve(__dirname, '../src/data'); const data = path.resolve(__dirname, '../npm-extended/data'); +const ignored = ['__tests__', '_old', 'icons', 'udev']; +const shouldIgnore = (src) => ignored.find(i => src.indexOf(i) >= 0); + // copy all js files any make a copy with .flow extension fse.copySync(src, lib, { filter: function (src, dest) { + if (shouldIgnore(src)) return false; // do not copy "*/_old" directory - if (src.indexOf('_old') >= 0) return false; + // if (src.indexOf('_old') >= 0) return false; // do not copy "__test__" directory - if (src.indexOf('__tests__') >= 0) return false; + // if (src.indexOf('__tests__') >= 0) return false; const ext = src.split('.').pop(); if (ext === 'js') { fse.copySync(src, dest + '.flow'); @@ -27,8 +31,9 @@ fse.copySync(src, lib, { // copy typescript fse.copySync(ts, `${lib}/typescript`, { filter: function (src, dest) { + if (shouldIgnore(src)) return false; // do not copy "__test__" directory - if (src.indexOf('__tests__') >= 0) return false; + // if (src.indexOf('__tests__') >= 0) return false; if (src.indexOf('.json') >= 0) return false; return true; }, @@ -37,9 +42,10 @@ fse.copySync(ts, `${lib}/typescript`, { // copy assets (only json) fse.copySync(dataSrc, data, { filter: function (src, dest) { - const ext = src.split('.').pop(); - const copy = ext === 'json' || ext.indexOf('/') >= 0; - return copy; + return !shouldIgnore(src); + // const ext = src.split('.').pop(); + // const copy = ext === 'json' || ext.indexOf('/') >= 0; + // return copy; }, }); From f45f60ad79a88b1130c036ea92465823e61731fe Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 19 Feb 2020 10:36:21 +0100 Subject: [PATCH 14/51] Update messages.json --- src/data/messages/messages.json | 113 ++++++++++++++++++++++++++++---- 1 file changed, 101 insertions(+), 12 deletions(-) diff --git a/src/data/messages/messages.json b/src/data/messages/messages.json index fcc4f5212..f03a4b3e8 100644 --- a/src/data/messages/messages.json +++ b/src/data/messages/messages.json @@ -1896,15 +1896,6 @@ "name": "passphrase", "id": 1 }, - { - "rule": "optional", - "options": { - "deprecated": true - }, - "type": "bytes", - "name": "_state", - "id": 2 - }, { "rule": "optional", "options": {}, @@ -2458,6 +2449,102 @@ "options": {}, "oneofs": {} }, + { + "name": "DebugLinkShowText", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "header_text", + "id": 1 + }, + { + "rule": "repeated", + "options": {}, + "type": "DebugLinkShowTextItem", + "name": "body_text", + "id": 2 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "header_icon", + "id": 3 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "icon_color", + "id": 4 + } + ], + "enums": [ + { + "name": "DebugLinkShowTextStyle", + "values": [ + { + "name": "NORMAL", + "id": 0 + }, + { + "name": "BOLD", + "id": 1 + }, + { + "name": "MONO", + "id": 2 + }, + { + "name": "MONO_BOLD", + "id": 3 + }, + { + "name": "BR", + "id": 4 + }, + { + "name": "BR_HALF", + "id": 5 + }, + { + "name": "SET_COLOR", + "id": 6 + } + ], + "options": {} + } + ], + "messages": [ + { + "name": "DebugLinkShowTextItem", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "DebugLinkShowTextStyle", + "name": "style", + "id": 1 + }, + { + "rule": "optional", + "options": {}, + "type": "string", + "name": "content", + "id": 2 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + } + ], + "options": {}, + "oneofs": {} + }, { "name": "DebugLinkGetState", "fields": [ @@ -4035,9 +4122,7 @@ }, { "rule": "optional", - "options": { - "default": 0 - }, + "options": {}, "type": "uint64", "name": "amount", "id": 2 @@ -9459,6 +9544,10 @@ "name": "MessageType_DebugLinkRecordScreen", "id": 9003 }, + { + "name": "MessageType_DebugLinkShowText", + "id": 9004 + }, { "name": "MessageType_EthereumGetPublicKey", "id": 450 From 1500cef5ea91ef587d370ee9722990972a7fc964 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 19 Feb 2020 10:42:42 +0100 Subject: [PATCH 15/51] Update deviceFeaturesUtils.test.js --- src/js/utils/__tests__/deviceFeaturesUtils.test.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/js/utils/__tests__/deviceFeaturesUtils.test.js b/src/js/utils/__tests__/deviceFeaturesUtils.test.js index 70855a3fb..02af40706 100644 --- a/src/js/utils/__tests__/deviceFeaturesUtils.test.js +++ b/src/js/utils/__tests__/deviceFeaturesUtils.test.js @@ -103,6 +103,7 @@ describe('utils/deviceFeaturesUtils', () => { bnb: 'no-capability', cpc: 'no-support', eos: 'no-capability', + ere: 'update-required', ppc: 'update-required', tppc: 'update-required', txrp: 'no-capability', @@ -122,7 +123,9 @@ describe('utils/deviceFeaturesUtils', () => { feat2.capabilities = parseCapabilities(feat2); // default Capabilities T2 - expect(getUnavailableCapabilities(feat2, coins, support)).toEqual({}); + expect(getUnavailableCapabilities(feat2, coins, support)).toEqual({ + ere: 'update-required', + }); // excluded single method without specified coins expect( @@ -137,6 +140,7 @@ describe('utils/deviceFeaturesUtils', () => { ] ), ).toEqual({ + ere: 'update-required', getAccountInfo: 'update-required', }); @@ -154,6 +158,7 @@ describe('utils/deviceFeaturesUtils', () => { ] ), ).toEqual({ + ere: 'update-required', getAccountInfo: ['xrp', 'txrp'], }); @@ -175,6 +180,7 @@ describe('utils/deviceFeaturesUtils', () => { ] ), ).toEqual({ + ere: 'update-required', rippleGetAddress: ['xrp', 'txrp'], tezosSignTransaction: 'trezor-connect-outdated', }); From ed0cd684c3fea7b2637e5b1091e114417980e94e Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 19 Feb 2020 11:02:14 +0100 Subject: [PATCH 16/51] Update build-npm-extended.js --- scripts/build-npm-extended.js | 9 --------- 1 file changed, 9 deletions(-) diff --git a/scripts/build-npm-extended.js b/scripts/build-npm-extended.js index ca96accb9..73dcb41df 100644 --- a/scripts/build-npm-extended.js +++ b/scripts/build-npm-extended.js @@ -16,10 +16,6 @@ const shouldIgnore = (src) => ignored.find(i => src.indexOf(i) >= 0); fse.copySync(src, lib, { filter: function (src, dest) { if (shouldIgnore(src)) return false; - // do not copy "*/_old" directory - // if (src.indexOf('_old') >= 0) return false; - // do not copy "__test__" directory - // if (src.indexOf('__tests__') >= 0) return false; const ext = src.split('.').pop(); if (ext === 'js') { fse.copySync(src, dest + '.flow'); @@ -32,8 +28,6 @@ fse.copySync(src, lib, { fse.copySync(ts, `${lib}/typescript`, { filter: function (src, dest) { if (shouldIgnore(src)) return false; - // do not copy "__test__" directory - // if (src.indexOf('__tests__') >= 0) return false; if (src.indexOf('.json') >= 0) return false; return true; }, @@ -43,9 +37,6 @@ fse.copySync(ts, `${lib}/typescript`, { fse.copySync(dataSrc, data, { filter: function (src, dest) { return !shouldIgnore(src); - // const ext = src.split('.').pop(); - // const copy = ext === 'json' || ext.indexOf('/') >= 0; - // return copy; }, }); From 20fdb0d45cd140fb36162d5db4f91ed923ef39d8 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Thu, 20 Feb 2020 09:40:25 +0100 Subject: [PATCH 17/51] Update GetAccountInfo.js --- src/js/core/methods/GetAccountInfo.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/js/core/methods/GetAccountInfo.js b/src/js/core/methods/GetAccountInfo.js index ef497eaf2..638ac16fd 100644 --- a/src/js/core/methods/GetAccountInfo.js +++ b/src/js/core/methods/GetAccountInfo.js @@ -239,7 +239,6 @@ export default class GetAccountInfo extends AbstractMethod { if (accountDescriptor) { descriptor = accountDescriptor.descriptor; } - if (request.coinInfo.shortcut === 'LTC') { throw Error('Some fail...'); } } catch (error) { if (this.hasBundle) { responses.push(null); From a53eaf83bf07e6dcfc5c908932ded9e730437121 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Fri, 6 Mar 2020 13:34:01 +0100 Subject: [PATCH 18/51] update modules (blockchain-link 1.0.8) --- package.json | 26 ++-- yarn.lock | 411 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 288 insertions(+), 149 deletions(-) diff --git a/package.json b/package.json index c2fa208ea..bf6dffe31 100644 --- a/package.json +++ b/package.json @@ -49,17 +49,17 @@ }, "devDependencies": { "@babel/cli": "7.8.4", - "@babel/core": "7.8.4", - "@babel/node": "7.8.4", + "@babel/core": "7.8.7", + "@babel/node": "7.8.7", "@babel/plugin-proposal-class-properties": "7.8.3", "@babel/plugin-proposal-object-rest-spread": "7.8.3", "@babel/plugin-transform-runtime": "7.8.3", - "@babel/preset-env": "7.8.4", + "@babel/preset-env": "7.8.7", "@babel/preset-flow": "7.8.3", - "@trezor/blockchain-link": "^1.0.7", + "@trezor/blockchain-link": "^1.0.8", "@trezor/utxo-lib": "^0.1.0", "babel-collect-imports": "https://github.com/szymonlesisz/babel-collect-imports", - "babel-eslint": "^10.0.3", + "babel-eslint": "^10.1.0", "babel-jest": "25.1.0", "babel-loader": "^8.0.0", "bchaddrjs": "0.4.5", @@ -70,11 +70,11 @@ "es6-promise": "^4.2.2", "eslint": "6.8.0", "eslint-plugin-flowtype": "4.6.0", - "eslint-plugin-jest": "23.7.0", + "eslint-plugin-jest": "23.8.2", "eslint-plugin-promise": "^4.1.1", "eslint-plugin-standard": "^4.0.1", - "file-loader": "5.0.2", - "flow-bin": "0.118.0", + "file-loader": "5.1.0", + "flow-bin": "0.120.1", "fs-extra": "^8.1.0", "hd-wallet": "9.0.0", "html-webpack-plugin": "^3.2.0", @@ -97,26 +97,26 @@ "mini-css-extract-plugin": "0.9.0", "node-fetch": "^2.6.0", "parse-uri": "^1.0.0", - "ripple-lib": "1.6.3", + "ripple-lib": "1.6.4", "sharedworker-loader": "^2.1.1", "style-loader": "1.1.3", "terser-webpack-plugin": "2.3.5", "tiny-worker": "^2.3.0", "trezor-link": "1.6.7", "uglify-es": "3.3.9", - "version-bump-prompt": "6.0.0", - "webpack": "4.41.6", + "version-bump-prompt": "6.0.2", + "webpack": "^4.42.0", "webpack-cli": "3.3.11", "webpack-dev-server": "3.10.3", "worker-loader": "2.0.0" }, "dependencies": { - "@babel/runtime": "^7.8.4", + "@babel/runtime": "^7.8.7", "events": "^3.1.0", "whatwg-fetch": "^3.0.0" }, "extendedDependencies": { - "@trezor/blockchain-link": "^1.0.7", + "@trezor/blockchain-link": "^1.0.8", "@trezor/utxo-lib": "^0.1.0", "bchaddrjs": "0.4.5", "bignumber.js": "^9.0.0", diff --git a/yarn.lock b/yarn.lock index 316bcbda9..5afebf06a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -32,27 +32,27 @@ dependencies: "@babel/highlight" "^7.8.3" -"@babel/compat-data@^7.8.4": - version "7.8.5" - resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.8.5.tgz#d28ce872778c23551cbb9432fc68d28495b613b9" - integrity sha512-jWYUqQX/ObOhG1UiEkbH5SANsE/8oKXiQWjj7p7xgj9Zmnt//aUvyz4dBkK0HNsS8/cbyC5NmmH87VekW+mXFg== +"@babel/compat-data@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.8.6.tgz#7eeaa0dfa17e50c7d9c0832515eee09b56f04e35" + integrity sha512-CurCIKPTkS25Mb8mz267vU95vy+TyUpnctEX2lV33xWNmHAfjruztgiPBbXZRh3xZZy1CYvGx6XfxyTVS+sk7Q== dependencies: browserslist "^4.8.5" invariant "^2.2.4" semver "^5.5.0" -"@babel/core@7.8.4", "@babel/core@^7.7.5": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.8.4.tgz#d496799e5c12195b3602d0fddd77294e3e38e80e" - integrity sha512-0LiLrB2PwrVI+a2/IEskBopDYSd8BCb3rOvH7D5tzoWd696TBEduBvuLVm4Nx6rltrLZqvI3MCalB2K2aVzQjA== +"@babel/core@7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.8.7.tgz#b69017d221ccdeb203145ae9da269d72cf102f3b" + integrity sha512-rBlqF3Yko9cynC5CCFy6+K/w2N+Sq/ff2BPy+Krp7rHlABIr5epbA7OxVeKoMHB39LZOp1UY5SuLjy6uWi35yA== dependencies: "@babel/code-frame" "^7.8.3" - "@babel/generator" "^7.8.4" + "@babel/generator" "^7.8.7" "@babel/helpers" "^7.8.4" - "@babel/parser" "^7.8.4" - "@babel/template" "^7.8.3" - "@babel/traverse" "^7.8.4" - "@babel/types" "^7.8.3" + "@babel/parser" "^7.8.7" + "@babel/template" "^7.8.6" + "@babel/traverse" "^7.8.6" + "@babel/types" "^7.8.7" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.1" @@ -102,6 +102,27 @@ semver "^5.4.1" source-map "^0.5.0" +"@babel/core@^7.7.5": + version "7.8.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.8.4.tgz#d496799e5c12195b3602d0fddd77294e3e38e80e" + integrity sha512-0LiLrB2PwrVI+a2/IEskBopDYSd8BCb3rOvH7D5tzoWd696TBEduBvuLVm4Nx6rltrLZqvI3MCalB2K2aVzQjA== + dependencies: + "@babel/code-frame" "^7.8.3" + "@babel/generator" "^7.8.4" + "@babel/helpers" "^7.8.4" + "@babel/parser" "^7.8.4" + "@babel/template" "^7.8.3" + "@babel/traverse" "^7.8.4" + "@babel/types" "^7.8.3" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.1" + json5 "^2.1.0" + lodash "^4.17.13" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + "@babel/generator@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.5.5.tgz#873a7f936a3c89491b43536d12245b626664e3cf" @@ -133,6 +154,16 @@ lodash "^4.17.13" source-map "^0.5.0" +"@babel/generator@^7.8.6", "@babel/generator@^7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.8.7.tgz#870b3cf7984f5297998152af625c4f3e341400f7" + integrity sha512-DQwjiKJqH4C3qGiyQCAExJHoZssn49JTMJgZ8SANGgVFdkupcUhLOdkAeoC6kmHZCPfoDG5M0b6cFlSN5wW7Ew== + dependencies: + "@babel/types" "^7.8.7" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.5.0" + "@babel/helper-annotate-as-pure@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.8.3.tgz#60bc0bc657f63a0924ff9a4b4a0b24a13cf4deee" @@ -148,22 +179,22 @@ "@babel/helper-explode-assignable-expression" "^7.8.3" "@babel/types" "^7.8.3" -"@babel/helper-call-delegate@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.8.3.tgz#de82619898aa605d409c42be6ffb8d7204579692" - integrity sha512-6Q05px0Eb+N4/GTyKPPvnkig7Lylw+QzihMpws9iiZQv7ZImf84ZsZpQH7QoWN4n4tm81SnSzPgHw2qtO0Zf3A== +"@babel/helper-call-delegate@^7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.8.7.tgz#28a279c2e6c622a6233da548127f980751324cab" + integrity sha512-doAA5LAKhsFCR0LAFIf+r2RSMmC+m8f/oQ+URnUET/rWeEzC0yTRmAGyWkD4sSu3xwbS7MYQ2u+xlt1V5R56KQ== dependencies: "@babel/helper-hoist-variables" "^7.8.3" "@babel/traverse" "^7.8.3" - "@babel/types" "^7.8.3" + "@babel/types" "^7.8.7" -"@babel/helper-compilation-targets@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.8.4.tgz#03d7ecd454b7ebe19a254f76617e61770aed2c88" - integrity sha512-3k3BsKMvPp5bjxgMdrFyq0UaEO48HciVrOVF0+lon8pp95cyJ2ujAh0TrBHNMnJGT2rr0iKOJPFFbSqjDyf/Pg== +"@babel/helper-compilation-targets@^7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.8.7.tgz#dac1eea159c0e4bd46e309b5a1b04a66b53c1dde" + integrity sha512-4mWm8DCK2LugIS+p1yArqvG1Pf162upsIsjE7cNBjez+NjliQpVhj20obE520nao0o14DaTnFJv+Fw5a0JpoUw== dependencies: - "@babel/compat-data" "^7.8.4" - browserslist "^4.8.5" + "@babel/compat-data" "^7.8.6" + browserslist "^4.9.1" invariant "^2.2.4" levenary "^1.1.1" semver "^5.5.0" @@ -331,6 +362,16 @@ "@babel/traverse" "^7.8.3" "@babel/types" "^7.8.3" +"@babel/helper-replace-supers@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.8.6.tgz#5ada744fd5ad73203bf1d67459a27dcba67effc8" + integrity sha512-PeMArdA4Sv/Wf4zXwBKPqVj7n9UF/xg6slNRtZW84FM7JpE1CbG8B612FyM4cxrf4fMAMGO0kR7voy1ForHHFA== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.8.3" + "@babel/helper-optimise-call-expression" "^7.8.3" + "@babel/traverse" "^7.8.6" + "@babel/types" "^7.8.6" + "@babel/helper-simple-access@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.8.3.tgz#7f8109928b4dab4654076986af575231deb639ae" @@ -415,35 +456,40 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/node@7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.8.4.tgz#59b2ed7e5a9df2224592f83292d77d616fbf1ab8" - integrity sha512-MlczXI/VYRnoaWHjicqrzq2z4DhRPaWQIC+C3ISEQs5z+mEccBsn7IAI5Q97ZDTnFYw6ts5IUTzqArilC/g7nw== +"@babel/node@7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/node/-/node-7.8.7.tgz#4213ea99f0c86cc1cf460e61131e7acbb723e13a" + integrity sha512-o8cBT3cfRPLwoPh7VBYonSeZypIawGUeVfOIt1xSDgcDdirRGDPZ7/x+FLhhgQmKp3PKbz5Juh9/BNP4Jzrr9Q== dependencies: "@babel/register" "^7.8.3" commander "^4.0.1" core-js "^3.2.1" lodash "^4.17.13" node-environment-flags "^1.0.5" - regenerator-runtime "^0.13.3" + regenerator-runtime "^0.13.4" resolve "^1.13.1" v8flags "^3.1.1" -"@babel/parser@^7.0.0", "@babel/parser@^7.4.4", "@babel/parser@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" - integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== - "@babel/parser@^7.1.0", "@babel/parser@^7.7.0", "@babel/parser@^7.7.2": version "7.7.3" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.7.3.tgz#5fad457c2529de476a248f75b0f090b3060af043" integrity sha512-bqv+iCo9i+uLVbI0ILzKkvMorqxouI+GbV13ivcARXn9NNEabi2IEz912IgNpT/60BNXac5dgcfjb94NjsF33A== +"@babel/parser@^7.4.4", "@babel/parser@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" + integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== + "@babel/parser@^7.7.5", "@babel/parser@^7.8.3", "@babel/parser@^7.8.4": version "7.8.4" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.4.tgz#d1dbe64691d60358a974295fa53da074dd2ce8e8" integrity sha512-0fKu/QqildpXmPVaRBoXOlyBb3MC+J0A66x97qEfLOMkn3u6nfY5esWogQwi/K0BjASYy4DbnsEWnpNL6qT5Mw== +"@babel/parser@^7.8.6", "@babel/parser@^7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.8.7.tgz#7b8facf95d25fef9534aad51c4ffecde1a61e26a" + integrity sha512-9JWls8WilDXFGxs0phaXAZgpxTZhSk/yOYH2hTHC0X1yC7Z78IJfvR1vJ+rmJKq3I35td2XzXzN6ZLYlna+r/A== + "@babel/plugin-proposal-async-generator-functions@^7.8.3": version "7.8.3" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.8.3.tgz#bad329c670b382589721b27540c7d288601c6e6f" @@ -625,17 +671,17 @@ "@babel/helper-plugin-utils" "^7.8.3" lodash "^4.17.13" -"@babel/plugin-transform-classes@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.8.3.tgz#46fd7a9d2bb9ea89ce88720477979fe0d71b21b8" - integrity sha512-SjT0cwFJ+7Rbr1vQsvphAHwUHvSUPmMjMU/0P59G8U2HLFqSa082JO7zkbDNWs9kH/IUqpHI6xWNesGf8haF1w== +"@babel/plugin-transform-classes@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.8.6.tgz#77534447a477cbe5995ae4aee3e39fbc8090c46d" + integrity sha512-k9r8qRay/R6v5aWZkrEclEhKO6mc1CCQr2dLsVHBmOQiMpN6I2bpjX3vgnldUWeEI1GHVNByULVxZ4BdP4Hmdg== dependencies: "@babel/helper-annotate-as-pure" "^7.8.3" "@babel/helper-define-map" "^7.8.3" "@babel/helper-function-name" "^7.8.3" "@babel/helper-optimise-call-expression" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" - "@babel/helper-replace-supers" "^7.8.3" + "@babel/helper-replace-supers" "^7.8.6" "@babel/helper-split-export-declaration" "^7.8.3" globals "^11.1.0" @@ -684,10 +730,10 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-syntax-flow" "^7.8.3" -"@babel/plugin-transform-for-of@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.8.4.tgz#6fe8eae5d6875086ee185dd0b098a8513783b47d" - integrity sha512-iAXNlOWvcYUYoV8YIxwS7TxGRJcxyl8eQCfT+A5j8sKUzRFvJdcyjp97jL2IghWSRDaL2PU2O2tX8Cu9dTBq5A== +"@babel/plugin-transform-for-of@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.8.6.tgz#a051bd1b402c61af97a27ff51b468321c7c2a085" + integrity sha512-M0pw4/1/KI5WAxPsdcUL/w2LJ7o89YHN3yLkzNjg7Yl15GlVGgzHyCU+FMeAxevHGsLVmUqbirlUIKTafPmzdw== dependencies: "@babel/helper-plugin-utils" "^7.8.3" @@ -772,12 +818,12 @@ "@babel/helper-plugin-utils" "^7.8.3" "@babel/helper-replace-supers" "^7.8.3" -"@babel/plugin-transform-parameters@^7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.8.4.tgz#1d5155de0b65db0ccf9971165745d3bb990d77d3" - integrity sha512-IsS3oTxeTsZlE5KqzTbcC2sV0P9pXdec53SU+Yxv7o/6dvGM5AkTotQKhoSffhNgZ/dftsSiOoxy7evCYJXzVA== +"@babel/plugin-transform-parameters@^7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.8.7.tgz#66fa2f1de4129b4e0447509223ac71bda4955395" + integrity sha512-brYWaEPTRimOctz2NDA3jnBbDi7SVN2T4wYuu0aqSzxC3nozFZngGaw29CJ9ZPweB7k+iFmZuoG3IVPIcXmD2g== dependencies: - "@babel/helper-call-delegate" "^7.8.3" + "@babel/helper-call-delegate" "^7.8.7" "@babel/helper-get-function-arity" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" @@ -788,12 +834,12 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.3" -"@babel/plugin-transform-regenerator@^7.8.3": - version "7.8.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.8.3.tgz#b31031e8059c07495bf23614c97f3d9698bc6ec8" - integrity sha512-qt/kcur/FxrQrzFR432FGZznkVAjiyFtCOANjkAKwCbt465L6ZCiUQh2oMYGU3Wo8LRFJxNDFwWn106S5wVUNA== +"@babel/plugin-transform-regenerator@^7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.8.7.tgz#5e46a0dca2bee1ad8285eb0527e6abc9c37672f8" + integrity sha512-TIg+gAl4Z0a3WmD3mbYSk+J9ZUH6n/Yc57rtKRnlA/7rcCvpekHXe0CMZHP1gYp7/KLe9GHTuIba0vXmls6drA== dependencies: - regenerator-transform "^0.14.0" + regenerator-transform "^0.14.2" "@babel/plugin-transform-reserved-words@^7.8.3": version "7.8.3" @@ -857,13 +903,13 @@ "@babel/helper-create-regexp-features-plugin" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" -"@babel/preset-env@7.8.4": - version "7.8.4" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.8.4.tgz#9dac6df5f423015d3d49b6e9e5fa3413e4a72c4e" - integrity sha512-HihCgpr45AnSOHRbS5cWNTINs0TwaR8BS8xIIH+QwiW8cKL0llV91njQMpeMReEPVs+1Ao0x3RLEBLtt1hOq4w== +"@babel/preset-env@7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.8.7.tgz#1fc7d89c7f75d2d70c2b6768de6c2e049b3cb9db" + integrity sha512-BYftCVOdAYJk5ASsznKAUl53EMhfBbr8CJ1X+AJLfGPscQkwJFiaV/Wn9DPH/7fzm2v6iRYJKYHSqyynTGw0nw== dependencies: - "@babel/compat-data" "^7.8.4" - "@babel/helper-compilation-targets" "^7.8.4" + "@babel/compat-data" "^7.8.6" + "@babel/helper-compilation-targets" "^7.8.7" "@babel/helper-module-imports" "^7.8.3" "@babel/helper-plugin-utils" "^7.8.3" "@babel/plugin-proposal-async-generator-functions" "^7.8.3" @@ -886,13 +932,13 @@ "@babel/plugin-transform-async-to-generator" "^7.8.3" "@babel/plugin-transform-block-scoped-functions" "^7.8.3" "@babel/plugin-transform-block-scoping" "^7.8.3" - "@babel/plugin-transform-classes" "^7.8.3" + "@babel/plugin-transform-classes" "^7.8.6" "@babel/plugin-transform-computed-properties" "^7.8.3" "@babel/plugin-transform-destructuring" "^7.8.3" "@babel/plugin-transform-dotall-regex" "^7.8.3" "@babel/plugin-transform-duplicate-keys" "^7.8.3" "@babel/plugin-transform-exponentiation-operator" "^7.8.3" - "@babel/plugin-transform-for-of" "^7.8.4" + "@babel/plugin-transform-for-of" "^7.8.6" "@babel/plugin-transform-function-name" "^7.8.3" "@babel/plugin-transform-literals" "^7.8.3" "@babel/plugin-transform-member-expression-literals" "^7.8.3" @@ -903,9 +949,9 @@ "@babel/plugin-transform-named-capturing-groups-regex" "^7.8.3" "@babel/plugin-transform-new-target" "^7.8.3" "@babel/plugin-transform-object-super" "^7.8.3" - "@babel/plugin-transform-parameters" "^7.8.4" + "@babel/plugin-transform-parameters" "^7.8.7" "@babel/plugin-transform-property-literals" "^7.8.3" - "@babel/plugin-transform-regenerator" "^7.8.3" + "@babel/plugin-transform-regenerator" "^7.8.7" "@babel/plugin-transform-reserved-words" "^7.8.3" "@babel/plugin-transform-shorthand-properties" "^7.8.3" "@babel/plugin-transform-spread" "^7.8.3" @@ -913,7 +959,7 @@ "@babel/plugin-transform-template-literals" "^7.8.3" "@babel/plugin-transform-typeof-symbol" "^7.8.4" "@babel/plugin-transform-unicode-regex" "^7.8.3" - "@babel/types" "^7.8.3" + "@babel/types" "^7.8.7" browserslist "^4.8.5" core-js-compat "^3.6.2" invariant "^2.2.2" @@ -946,6 +992,13 @@ dependencies: regenerator-runtime "^0.13.2" +"@babel/runtime@^7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.8.7.tgz#8fefce9802db54881ba59f90bb28719b4996324d" + integrity sha512-+AATMUFppJDw6aiR5NVPHqIQBlV/Pj8wY/EZH+lmvRdUo9xBaz/rF3alAwFJQavvKfeOlPE7oaaDHVbcySbCsg== + dependencies: + regenerator-runtime "^0.13.4" + "@babel/template@^7.1.0", "@babel/template@^7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" @@ -973,7 +1026,16 @@ "@babel/parser" "^7.8.3" "@babel/types" "^7.8.3" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.5.5": +"@babel/template@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.8.6.tgz#86b22af15f828dfb086474f964dcc3e39c43ce2b" + integrity sha512-zbMsPMy/v0PWFZEhQJ66bqjhH+z0JgMoBWuikXybgG3Gkd/3t5oQ1Rw2WQhnSrsOmsKXnZOx15tkC4qON/+JPg== + dependencies: + "@babel/code-frame" "^7.8.3" + "@babel/parser" "^7.8.6" + "@babel/types" "^7.8.6" + +"@babel/traverse@^7.1.0", "@babel/traverse@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.5.tgz#f664f8f368ed32988cd648da9f72d5ca70f165bb" integrity sha512-MqB0782whsfffYfSjH4TM+LMjrJnhCNEDMDIjeTpl+ASaUvxcjoiVCo/sM1GhS1pHOXYfWVCYneLjMckuUxDaQ== @@ -1018,6 +1080,21 @@ globals "^11.1.0" lodash "^4.17.13" +"@babel/traverse@^7.8.6": + version "7.8.6" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.8.6.tgz#acfe0c64e1cd991b3e32eae813a6eb564954b5ff" + integrity sha512-2B8l0db/DPi8iinITKuo7cbPznLCEk0kCxDoB9/N6gGNg/gxOXiR/IcymAFPiBwk5w6TtQ27w4wpElgp9btR9A== + dependencies: + "@babel/code-frame" "^7.8.3" + "@babel/generator" "^7.8.6" + "@babel/helper-function-name" "^7.8.3" + "@babel/helper-split-export-declaration" "^7.8.3" + "@babel/parser" "^7.8.6" + "@babel/types" "^7.8.6" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.13" + "@babel/types@^7.0.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a" @@ -1045,6 +1122,15 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@babel/types@^7.8.6", "@babel/types@^7.8.7": + version "7.8.7" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.8.7.tgz#1fc9729e1acbb2337d5b6977a63979b4819f5d1d" + integrity sha512-k2TreEHxFA4CjGkL+GYjRyx35W0Mr7DP5+9q6WMkyKXB+904bYmG40syjMFV0oLlhhFCwWl0vA0DyzTDkwAiJw== + dependencies: + esutils "^2.0.2" + lodash "^4.17.13" + to-fast-properties "^2.0.0" + "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -1232,17 +1318,27 @@ "@types/yargs" "^15.0.0" chalk "^3.0.0" -"@jsdevtools/version-bump-prompt@6.0.0": - version "6.0.0" - resolved "https://registry.yarnpkg.com/@jsdevtools/version-bump-prompt/-/version-bump-prompt-6.0.0.tgz#0229b0bd5ba852ab46885e9cacf9b94e058f1ddb" - integrity sha512-TL/4IQJFKrDVpcVvLaISrfJcxvBIeO/OPcwNvFd7+A3dWq61b2uoTMd1r7eImUCuNYdR9P6CIDq+QtMi0SbqeQ== +"@jsdevtools/ez-spawn@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@jsdevtools/ez-spawn/-/ez-spawn-3.0.0.tgz#621f37395034500c91c95ac538f24c89c4230740" + integrity sha512-9YSL7HvGRQWXX9VGfsBLi7tp2FvBl1KHJT+fbvmjexwId3Om/A96OdGjS1bZTPOH/ecaboTrzLHyPtH/Nt1drQ== dependencies: + call-me-maybe "^1.0.1" + cross-spawn "^7.0.1" + string-argv "^0.3.1" + type-detect "^4.0.8" + +"@jsdevtools/version-bump-prompt@6.0.2": + version "6.0.2" + resolved "https://registry.yarnpkg.com/@jsdevtools/version-bump-prompt/-/version-bump-prompt-6.0.2.tgz#8ba3bdbac5d657a0294975406798fe363454f3ec" + integrity sha512-nBXrckBHktLT55dZvlH38hb6v6VgNyi45+7ISQxwilQiuMU0IApTOKT0S9Oy33Asn1TEGMBa4YllNHPilMJJhw== + dependencies: + "@jsdevtools/ez-spawn" "^3.0.0" command-line-args "^5.1.1" detect-indent "^6.0.0" detect-newline "^3.1.0" - ez-spawn "^2.1.6" globby "^11.0.0" - inquirer "^7.0.1" + inquirer "^7.0.6" log-symbols "^3.0.0" semver "^7.1.1" @@ -1274,10 +1370,10 @@ dependencies: type-detect "4.0.8" -"@trezor/blockchain-link@^1.0.7": - version "1.0.7" - resolved "https://registry.yarnpkg.com/@trezor/blockchain-link/-/blockchain-link-1.0.7.tgz#a9f3b84a707714f784e275b4f510135410b2bbc2" - integrity sha512-z8ZW+gdY2AXCuCOSw3LJTWyyWnS+92HA0d8JojJ5+SVOGkAA8m0F9+w06sFTzGnFPpY8S6WPzHJJf8yvnWlhoA== +"@trezor/blockchain-link@^1.0.8": + version "1.0.8" + resolved "https://registry.yarnpkg.com/@trezor/blockchain-link/-/blockchain-link-1.0.8.tgz#5d2b9bdf624492cb68349f83d42cadc848b6fc35" + integrity sha512-d/dC4KNaUB4ip2QgTd5YuebvL3vp45kaGp13Dj6BNqIQmchzCX8OpztzjofYhzLRPmf2QFZjVlaIaRuLGP3E0Q== dependencies: es6-promise "^4.2.8" events "^3.1.0" @@ -2016,15 +2112,15 @@ babel-errors@^1.0.1: resolved "https://registry.yarnpkg.com/babel-errors/-/babel-errors-1.1.1.tgz#43f7142dd3b365633c758d155bffa3ba41523794" integrity sha1-Q/cULdOzZWM8dY0VW/+jukFSN5Q= -babel-eslint@^10.0.3: - version "10.0.3" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.3.tgz#81a2c669be0f205e19462fed2482d33e4687a88a" - integrity sha512-z3U7eMY6r/3f3/JB9mTsLjyxrv0Yb1zb8PCWCLpguxfCzBIZUwy23R1t/XKewP+8mEN2Ck8Dtr4q20z6ce6SoA== +babel-eslint@^10.1.0: + version "10.1.0" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.1.0.tgz#6968e568a910b78fb3779cdd8b6ac2f479943232" + integrity sha512-ifWaTHQ0ce+448CYop8AdrQiBsGrnC+bMgfyKFdi6EsPLTAWG+QfyDeM6OH+FmWnKvEq5NnBMLvlBUPKQZoDSg== dependencies: "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.0.0" - "@babel/traverse" "^7.0.0" - "@babel/types" "^7.0.0" + "@babel/parser" "^7.7.0" + "@babel/traverse" "^7.7.0" + "@babel/types" "^7.7.0" eslint-visitor-keys "^1.0.0" resolve "^1.12.0" @@ -2360,9 +2456,9 @@ bitcoin-ops@^1.3.0: dependencies: nanoassert "^1.0.0" -"blake2b@git+https://github.com/BitGo/blake2b.git#6268e6dd678661e0acc4359e9171b97eb1ebf8ac": +"blake2b@https://github.com/BitGo/blake2b#6268e6dd678661e0acc4359e9171b97eb1ebf8ac": version "2.1.3" - resolved "git+https://github.com/BitGo/blake2b.git#6268e6dd678661e0acc4359e9171b97eb1ebf8ac" + resolved "https://github.com/BitGo/blake2b#6268e6dd678661e0acc4359e9171b97eb1ebf8ac" dependencies: blake2b-wasm "https://github.com/BitGo/blake2b-wasm#193cdb71656c1a6c7f89b05d0327bb9b758d071b" nanoassert "^1.0.0" @@ -2549,6 +2645,15 @@ browserslist@^4.8.3, browserslist@^4.8.5: electron-to-chromium "^1.3.349" node-releases "^1.1.49" +browserslist@^4.9.1: + version "4.9.1" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.9.1.tgz#01ffb9ca31a1aef7678128fc6a2253316aa7287c" + integrity sha512-Q0DnKq20End3raFulq6Vfp1ecB9fh8yUNV55s8sekaDDeqBaCtWlRHCUdaWyUeSSBJM7IbM6HcsyaeYqgeDhnw== + dependencies: + caniuse-lite "^1.0.30001030" + electron-to-chromium "^1.3.363" + node-releases "^1.1.50" + bs58@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/bs58/-/bs58-4.0.1.tgz#be161e76c354f6f788ae4071f63f34e8c4f0a42a" @@ -2761,6 +2866,11 @@ caniuse-lite@^1.0.30001027: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001028.tgz#f2241242ac70e0fa9cda55c2776d32a0867971c2" integrity sha512-Vnrq+XMSHpT7E+LWoIYhs3Sne8h9lx9YJV3acH3THNCwU/9zV93/ta4xVfzTtnqd3rvnuVpVjE3DFqf56tr3aQ== +caniuse-lite@^1.0.30001030: + version "1.0.30001032" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001032.tgz#b8d224914e2cd7f507085583d4e38144c652bce4" + integrity sha512-8joOm7BwcpEN4BfVHtfh0hBXSAPVYk+eUIcNntGtMkUWy/6AKRCDZINCLe3kB1vHhT2vBxBF85Hh9VlPXi/qjA== + capture-exit@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" @@ -3785,6 +3895,11 @@ electron-to-chromium@^1.3.349: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.354.tgz#6c6ad9ef63654c4c022269517c5a3095cebc94db" integrity sha512-24YMkNiZWOUeF6YeoscWfIGP0oMx+lJpU/miwI+lcu7plIDpyZn8Gx0lx0qTDlzGoz7hx+lpyD8QkbkX5L2Pqw== +electron-to-chromium@^1.3.363: + version "1.3.370" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.370.tgz#420fba483d30ba3f7965b30ecf850fdb5f08a0bc" + integrity sha512-399cXDE9C7qoVF2CUgCA/MLflfvxbo1F0kB/pkB94426freL/JgZ0HNaloomsOfnE+VC/qgTFZqzmivSdaNfPQ== + electron-to-chromium@^1.3.47: version "1.3.207" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.207.tgz#b19ce94d61187d72411ebb83dfe287366a785102" @@ -3831,6 +3946,11 @@ emojis-list@^2.0.0: resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" integrity sha1-TapNnbAPmBmIDHn6RXrlsJof04k= +emojis-list@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78" + integrity sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q== + encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" @@ -3981,10 +4101,10 @@ eslint-plugin-flowtype@4.6.0: dependencies: lodash "^4.17.15" -eslint-plugin-jest@23.7.0: - version "23.7.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.7.0.tgz#84d5603b6e745b59898cb6750df6a44782a39b04" - integrity sha512-zkiyGlvJeHNjAEz8FaIxTXNblJJ/zj3waNbYbgflK7K6uy0cpE5zJBt/JpJtOBGM/UGkC6BqsQ4n0y7kQ2HA8w== +eslint-plugin-jest@23.8.2: + version "23.8.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-jest/-/eslint-plugin-jest-23.8.2.tgz#6f28b41c67ef635f803ebd9e168f6b73858eb8d4" + integrity sha512-xwbnvOsotSV27MtAe7s8uGWOori0nUsrXh2f1EnpmXua8sDfY6VZhHAhHg2sqK7HBNycRQExF074XSZ7DvfoFg== dependencies: "@typescript-eslint/experimental-utils" "^2.5.0" @@ -4312,16 +4432,6 @@ extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= -ez-spawn@^2.1.6: - version "2.1.6" - resolved "https://registry.yarnpkg.com/ez-spawn/-/ez-spawn-2.1.6.tgz#e6343ba59f9ef6f32396e53427876d7a4b5fa539" - integrity sha512-SXH+o93DtsKug2tUB+iySoNw0TBCwAUGGiQr6f+1uMULPETKEd4Y7iSk3FgQwUo27Umz0wpkfEKbNEueILWzYQ== - dependencies: - call-me-maybe "^1.0.1" - cross-spawn "^7.0.1" - string-argv "^0.3.1" - type-detect "^4.0.8" - fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" @@ -4395,12 +4505,12 @@ file-entry-cache@^5.0.1: dependencies: flat-cache "^2.0.1" -file-loader@5.0.2: - version "5.0.2" - resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-5.0.2.tgz#7f3d8b4ac85a5e8df61338cfec95d7405f971caa" - integrity sha512-QMiQ+WBkGLejKe81HU8SZ9PovsU/5uaLo0JdTCEXOYv7i7jfAjHZi1tcwp9tSASJPOmmHZtbdCervFmXMH/Dcg== +file-loader@5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-5.1.0.tgz#cb56c070efc0e40666424309bd0d9e45ac6f2bb8" + integrity sha512-u/VkLGskw3Ue59nyOwUwXI/6nuBCo7KBkniB/l7ICwr/7cPNGsL1WCXUp3GB0qgOOKU1TiP49bv4DZF/LJqprg== dependencies: - loader-utils "^1.2.3" + loader-utils "^1.4.0" schema-utils "^2.5.0" file-uri-to-path@1.0.0: @@ -4502,10 +4612,10 @@ flatted@^2.0.0: resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08" integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg== -flow-bin@0.118.0: - version "0.118.0" - resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.118.0.tgz#fb706364a58c682d67a2ca7df39396467dc397d1" - integrity sha512-jlbUu0XkbpXeXhan5xyTqVK1jmEKNxE8hpzznI3TThHTr76GiFwK0iRzhDo4KNy+S9h/KxHaqVhTP86vA6wHCg== +flow-bin@0.120.1: + version "0.120.1" + resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.120.1.tgz#ab051d6df71829b70a26a2c90bb81f9d43797cae" + integrity sha512-KgE+d+rKzdXzhweYVJty1QIOOZTTbtnXZf+4SLnmArLvmdfeLreQOZpeLbtq5h79m7HhDzX/HkUkoyu/fmSC2A== flush-write-stream@^1.0.0: version "1.1.1" @@ -5294,23 +5404,23 @@ inquirer@^7.0.0: strip-ansi "^5.1.0" through "^2.3.6" -inquirer@^7.0.1: - version "7.0.3" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.0.3.tgz#f9b4cd2dff58b9f73e8d43759436ace15bed4567" - integrity sha512-+OiOVeVydu4hnCGLCSX+wedovR/Yzskv9BFqUNNKq9uU2qg7LCcCo3R86S2E7WLo0y/x2pnEZfZe1CoYnORUAw== +inquirer@^7.0.6: + version "7.0.6" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.0.6.tgz#ee4ff0ea7ecda5324656fe665878790f66df7d0c" + integrity sha512-7SVO4h+QIdMq6XcqIqrNte3gS5MzCCKZdsq9DO4PJziBFNYzP3PGFbDjgadDb//MCahzgjCxvQ/O2wa7kx9o4w== dependencies: ansi-escapes "^4.2.1" - chalk "^2.4.2" + chalk "^3.0.0" cli-cursor "^3.1.0" cli-width "^2.0.0" external-editor "^3.0.3" figures "^3.0.0" lodash "^4.17.15" mute-stream "0.0.8" - run-async "^2.2.0" + run-async "^2.4.0" rxjs "^6.5.3" string-width "^4.1.0" - strip-ansi "^5.1.0" + strip-ansi "^6.0.0" through "^2.3.6" internal-ip@^4.3.0: @@ -6407,6 +6517,15 @@ loader-utils@^0.2.16: json5 "^0.5.0" object-assign "^4.0.1" +loader-utils@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613" + integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA== + dependencies: + big.js "^5.2.2" + emojis-list "^3.0.0" + json5 "^1.0.1" + locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -7003,6 +7122,13 @@ node-releases@^1.1.49: dependencies: semver "^6.3.0" +node-releases@^1.1.50: + version "1.1.50" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.50.tgz#803c40d2c45db172d0410e4efec83aa8c6ad0592" + integrity sha512-lgAmPv9eYZ0bGwUYAKlr8MG6K4CvWliWqnkcT2P8mMAgVrH3lqfBPorFlxiG1pHQnqmavJZ9vbMXUTNyMLbrgQ== + dependencies: + semver "^6.3.0" + nopt@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/nopt/-/nopt-4.0.1.tgz#d0d4685afd5415193c8c7505602d0d17cd64474d" @@ -7705,7 +7831,7 @@ pretty-format@^25.1.0: ansi-styles "^4.0.0" react-is "^16.12.0" -private@^0.1.6, private@^0.1.8: +private@^0.1.8: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== @@ -8000,17 +8126,23 @@ regenerator-runtime@^0.11.0: resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== -regenerator-runtime@^0.13.2, regenerator-runtime@^0.13.3: +regenerator-runtime@^0.13.2: version "0.13.3" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.3.tgz#7cf6a77d8f5c6f60eb73c5fc1955b2ceb01e6bf5" integrity sha512-naKIZz2GQ8JWh///G7L3X6LaQUAMp2lvb1rvwwsURe/VXwD6VMfr+/1NuNw3ag8v2kY1aQ/go5SNn79O9JU7yw== -regenerator-transform@^0.14.0: - version "0.14.1" - resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.1.tgz#3b2fce4e1ab7732c08f665dfdb314749c7ddd2fb" - integrity sha512-flVuee02C3FKRISbxhXl9mGzdbWUVHubl1SMaknjxkFB1/iqpJhArQUvRxOOPEc/9tAiX0BaQ28FJH10E4isSQ== +regenerator-runtime@^0.13.4: + version "0.13.4" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.4.tgz#e96bf612a3362d12bb69f7e8f74ffeab25c7ac91" + integrity sha512-plpwicqEzfEyTQohIKktWigcLzmNStMGwbOUbykx51/29Z3JOGYldaaNGK7ngNXV+UcoqvIMmloZ48Sr74sd+g== + +regenerator-transform@^0.14.2: + version "0.14.2" + resolved "https://registry.yarnpkg.com/regenerator-transform/-/regenerator-transform-0.14.2.tgz#949d9d87468ff88d5a7e4734ebb994a892de1ff2" + integrity sha512-V4+lGplCM/ikqi5/mkkpJ06e9Bujq1NFmNLvsCs56zg3ZbzrnUzAtizZ24TXxtRX/W2jcdScwQCnbL0CICTFkQ== dependencies: - private "^0.1.6" + "@babel/runtime" "^7.8.4" + private "^0.1.8" regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" @@ -8330,7 +8462,7 @@ ripple-binary-codec@^0.2.5: lodash "^4.17.15" ripple-address-codec "^4.0.0" -ripple-keypairs@^1.0.0-beta.6: +ripple-keypairs@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/ripple-keypairs/-/ripple-keypairs-1.0.0.tgz#8f1c604f89daeac5e61b7eebbbca2da99da2bacf" integrity sha512-MQ3d6fU3D+Cqu5ma4dfkfa+KakN2sKpVVVN0FeJyAYPVIGXu8Rcvd1g028TdwYAZcSYk0tGn5UhHxd0gUG3T8g== @@ -8349,10 +8481,10 @@ ripple-lib-transactionparser@0.8.2: bignumber.js "^9.0.0" lodash "^4.17.15" -ripple-lib@1.6.3: - version "1.6.3" - resolved "https://registry.yarnpkg.com/ripple-lib/-/ripple-lib-1.6.3.tgz#de68e656bd49d743e31b8bf30d41004519d05dfe" - integrity sha512-Vu6aUgbL2Kw1F0fMOJs13wu0seQLfURz00iQit03gJbAXiTmRR5zAWpDuC7DYjIqTEIgQFI/GSYLLEz/ZQNH0A== +ripple-lib@1.6.4: + version "1.6.4" + resolved "https://registry.yarnpkg.com/ripple-lib/-/ripple-lib-1.6.4.tgz#56458bd08a59b38646c832b9dca3e9c8bb439758" + integrity sha512-6PDooo5b23oY89WVQ+IqTDerG8FXYeu4ZuprrIbqe7/A3Iy6zCGatez9AcNMgUnq+bCk3P/oylJXrBYLqpe3bA== dependencies: "@types/lodash" "^4.14.136" "@types/ws" "^7.2.0" @@ -8363,7 +8495,7 @@ ripple-lib@1.6.3: lodash.isequal "^4.5.0" ripple-address-codec "^4.0.0" ripple-binary-codec "^0.2.5" - ripple-keypairs "^1.0.0-beta.6" + ripple-keypairs "^1.0.0" ripple-lib-transactionparser "0.8.2" ws "^7.2.0" @@ -8379,6 +8511,13 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" +run-async@^2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.0.tgz#e59054a5b86876cfae07f431d18cbaddc594f1e8" + integrity sha512-xJTbh/d7Lm7SBhc1tNvTpeCHaEzoyxPrqNlvSdMfBTYwaY++UJFyXUOxAtsRUXjlqOfj8luNaR9vjCh4KeV+pg== + dependencies: + is-promise "^2.1.0" + run-parallel@^1.1.9: version "1.1.9" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.1.9.tgz#c9dd3a7cf9f4b2c4b6244e173a6ed866e61dd679" @@ -9782,12 +9921,12 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -version-bump-prompt@6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/version-bump-prompt/-/version-bump-prompt-6.0.0.tgz#964b128c97c0a6eca5265846a2acaf7b98aa2ff1" - integrity sha512-khGwb7LT50DAKcrjqo4CYC4V4SM/roI7K0luY4Ofd45k8OFeixAyAwjm9/ZMc4I8QdWvb0mdeuYFGUiSXCe8+w== +version-bump-prompt@6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/version-bump-prompt/-/version-bump-prompt-6.0.2.tgz#27543fffc23ef132aa00193b2808d948e934adb0" + integrity sha512-MzPReH0tzqOU+J+vQr9LMb15ORHVgRAwvKKyUuOGD6ePgdwpPAOhpxEH14yx3UYay6Q1u0TNiLBhTqP0RvvyPw== dependencies: - "@jsdevtools/version-bump-prompt" "6.0.0" + "@jsdevtools/version-bump-prompt" "6.0.2" vm-browserify@^1.0.1: version "1.1.0" @@ -9944,10 +10083,10 @@ webpack-sources@^1.4.1, webpack-sources@^1.4.3: source-list-map "^2.0.0" source-map "~0.6.1" -webpack@4.41.6: - version "4.41.6" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.41.6.tgz#12f2f804bf6542ef166755050d4afbc8f66ba7e1" - integrity sha512-yxXfV0Zv9WMGRD+QexkZzmGIh54bsvEs+9aRWxnN8erLWEOehAKUTeNBoUbA6HPEZPlRo7KDi2ZcNveoZgK9MA== +webpack@^4.42.0: + version "4.42.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.42.0.tgz#b901635dd6179391d90740a63c93f76f39883eb8" + integrity sha512-EzJRHvwQyBiYrYqhyjW9AqM90dE4+s1/XtCfn7uWg6cS72zH+2VPFAlsnW0+W0cDi0XRjNKUMoJtpSi50+Ph6w== dependencies: "@webassemblyjs/ast" "1.8.5" "@webassemblyjs/helper-module-context" "1.8.5" From 81de5d598e063e8a7733eae9cb569cd184381e4e Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Fri, 6 Mar 2020 13:35:19 +0100 Subject: [PATCH 19/51] Update messages.json --- src/data/messages/messages.json | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/data/messages/messages.json b/src/data/messages/messages.json index f03a4b3e8..2c34909f2 100644 --- a/src/data/messages/messages.json +++ b/src/data/messages/messages.json @@ -1773,6 +1773,10 @@ "name": "ButtonRequest_MnemonicInput", "id": 13 }, + { + "name": "_Deprecated_ButtonRequest_PassphraseType", + "id": 14 + }, { "name": "ButtonRequest_UnknownDerivationPath", "id": 15 @@ -1896,6 +1900,15 @@ "name": "passphrase", "id": 1 }, + { + "rule": "optional", + "options": { + "deprecated": true + }, + "type": "bytes", + "name": "_state", + "id": 2 + }, { "rule": "optional", "options": {}, @@ -2798,6 +2811,22 @@ "options": {}, "oneofs": {} }, + { + "name": "DebugLinkEraseSdCard", + "fields": [ + { + "rule": "optional", + "options": {}, + "type": "bool", + "name": "format", + "id": 1 + } + ], + "enums": [], + "messages": [], + "options": {}, + "oneofs": {} + }, { "name": "EosGetPublicKey", "fields": [ @@ -9548,6 +9577,10 @@ "name": "MessageType_DebugLinkShowText", "id": 9004 }, + { + "name": "MessageType_DebugLinkEraseSdCard", + "id": 9005 + }, { "name": "MessageType_EthereumGetPublicKey", "id": 450 From 2beca2599c524ff9a5c8dd9196c901c6542f1aad Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Fri, 6 Mar 2020 16:17:32 +0100 Subject: [PATCH 20/51] fix 1.8.0+ internal state caching --- src/js/device/Device.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/js/device/Device.js b/src/js/device/Device.js index e71f1ced0..a49dbc75f 100644 --- a/src/js/device/Device.js +++ b/src/js/device/Device.js @@ -298,7 +298,7 @@ export default class Device extends EventEmitter { } // T1: forget passphrase cached in internal state - if (this.isT1() && !this.useLegacyPassphrase()) { + if (this.isT1() && this.useLegacyPassphrase()) { this.setInternalState(undefined); } } @@ -390,6 +390,10 @@ export default class Device extends EventEmitter { this.firmwareStatus = checkFirmware(version, feat); this.firmwareRelease = getLatestRelease(version); } + // GetFeatures doesn't return 'session_id' + if (this.features && this.features.session_id && !feat.session_id) { + feat.session_id = this.features.session_id; + } this.features = feat; this.featuresNeedsReload = false; } @@ -599,6 +603,7 @@ export default class Device extends EventEmitter { const label = this.features.label === '' || this.features.label === null ? defaultLabel : this.features.label; return { type: 'acquired', + id: this.features.device_id, path: this.originalDescriptor.path, label: label, state: this.getExternalState(), From aa62a43c540566e6e126ab2dfa03b1e37599c2f5 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Fri, 6 Mar 2020 16:19:26 +0100 Subject: [PATCH 21/51] move Device.Features.device_id to Device.id --- src/js/types/trezor/device.js | 25 +++++++++++++------------ src/ts/types/trezor/device.d.ts | 25 +++++++++++++------------ 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/src/js/types/trezor/device.js b/src/js/types/trezor/device.js index e5fbe0ecb..5132518ed 100644 --- a/src/js/types/trezor/device.js +++ b/src/js/types/trezor/device.js @@ -43,20 +43,20 @@ export type FirmwareRelease = { } export type Features = { - bootloader_hash?: string | null; - bootloader_mode?: boolean | null; - device_id: string | null; - firmware_present?: boolean | null; + bootloader_hash?: string; + bootloader_mode?: boolean; + device_id?: string; + firmware_present?: boolean; flags: number; - fw_major?: number | null; - fw_minor?: number | null; - fw_patch?: number | null; - fw_vendor?: string | null; - fw_vendor_keys?: string | null; - imported?: boolean | null; + fw_major?: number; + fw_minor?: number; + fw_patch?: number; + fw_vendor?: string; + fw_vendor_keys?: string; + imported?: boolean; initialized: boolean; - label: string | null; - language?: string | null; + label: string; + language?: string; major_version: number; minor_version: number; model: string; @@ -79,6 +79,7 @@ export type Features = { export type Device = | { type: 'acquired'; + id?: string; path: string; label: string; firmware: DeviceFirmwareStatus; diff --git a/src/ts/types/trezor/device.d.ts b/src/ts/types/trezor/device.d.ts index 2de71c886..c93194ef3 100644 --- a/src/ts/types/trezor/device.d.ts +++ b/src/ts/types/trezor/device.d.ts @@ -42,20 +42,20 @@ export interface FirmwareRelease { } export interface Features { - bootloader_hash?: string | null; - bootloader_mode?: boolean | null; - device_id: string | null; - firmware_present?: boolean | null; + bootloader_hash?: string; + bootloader_mode?: boolean; + device_id?: string; + firmware_present?: boolean; flags: number; - fw_major?: number | null; - fw_minor?: number | null; - fw_patch?: number | null; - fw_vendor?: string | null; - fw_vendor_keys?: string | null; - imported?: boolean | null; + fw_major?: number; + fw_minor?: number; + fw_patch?: number; + fw_vendor?: string; + fw_vendor_keys?: string; + imported?: boolean; initialized: boolean; - label: string | null; - language?: string | null; + label: string; + language?: string; major_version: number; minor_version: number; model: string; @@ -78,6 +78,7 @@ export interface Features { export type Device = | { type: 'acquired'; + id?: string; path: string; label: string; firmware: DeviceFirmwareStatus; From d2fbe500d726b0020362a5dd75f6ec19d2bf3592 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Fri, 6 Mar 2020 16:44:51 +0100 Subject: [PATCH 22/51] Revert "move Device.Features.device_id to Device.id" This reverts commit aa62a43c540566e6e126ab2dfa03b1e37599c2f5. --- src/js/types/trezor/device.js | 25 ++++++++++++------------- src/ts/types/trezor/device.d.ts | 25 ++++++++++++------------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/src/js/types/trezor/device.js b/src/js/types/trezor/device.js index 5132518ed..e5fbe0ecb 100644 --- a/src/js/types/trezor/device.js +++ b/src/js/types/trezor/device.js @@ -43,20 +43,20 @@ export type FirmwareRelease = { } export type Features = { - bootloader_hash?: string; - bootloader_mode?: boolean; - device_id?: string; - firmware_present?: boolean; + bootloader_hash?: string | null; + bootloader_mode?: boolean | null; + device_id: string | null; + firmware_present?: boolean | null; flags: number; - fw_major?: number; - fw_minor?: number; - fw_patch?: number; - fw_vendor?: string; - fw_vendor_keys?: string; - imported?: boolean; + fw_major?: number | null; + fw_minor?: number | null; + fw_patch?: number | null; + fw_vendor?: string | null; + fw_vendor_keys?: string | null; + imported?: boolean | null; initialized: boolean; - label: string; - language?: string; + label: string | null; + language?: string | null; major_version: number; minor_version: number; model: string; @@ -79,7 +79,6 @@ export type Features = { export type Device = | { type: 'acquired'; - id?: string; path: string; label: string; firmware: DeviceFirmwareStatus; diff --git a/src/ts/types/trezor/device.d.ts b/src/ts/types/trezor/device.d.ts index c93194ef3..2de71c886 100644 --- a/src/ts/types/trezor/device.d.ts +++ b/src/ts/types/trezor/device.d.ts @@ -42,20 +42,20 @@ export interface FirmwareRelease { } export interface Features { - bootloader_hash?: string; - bootloader_mode?: boolean; - device_id?: string; - firmware_present?: boolean; + bootloader_hash?: string | null; + bootloader_mode?: boolean | null; + device_id: string | null; + firmware_present?: boolean | null; flags: number; - fw_major?: number; - fw_minor?: number; - fw_patch?: number; - fw_vendor?: string; - fw_vendor_keys?: string; - imported?: boolean; + fw_major?: number | null; + fw_minor?: number | null; + fw_patch?: number | null; + fw_vendor?: string | null; + fw_vendor_keys?: string | null; + imported?: boolean | null; initialized: boolean; - label: string; - language?: string; + label: string | null; + language?: string | null; major_version: number; minor_version: number; model: string; @@ -78,7 +78,6 @@ export interface Features { export type Device = | { type: 'acquired'; - id?: string; path: string; label: string; firmware: DeviceFirmwareStatus; From 81731efecfa4a0f0683f2b49381f78a379380c1e Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Fri, 6 Mar 2020 16:47:11 +0100 Subject: [PATCH 23/51] move Device.Features.device_id to Device.id (2) --- src/js/types/trezor/device.js | 1 + src/ts/types/trezor/device.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/src/js/types/trezor/device.js b/src/js/types/trezor/device.js index e5fbe0ecb..3f82ff76b 100644 --- a/src/js/types/trezor/device.js +++ b/src/js/types/trezor/device.js @@ -79,6 +79,7 @@ export type Features = { export type Device = | { type: 'acquired'; + id: string | null; path: string; label: string; firmware: DeviceFirmwareStatus; diff --git a/src/ts/types/trezor/device.d.ts b/src/ts/types/trezor/device.d.ts index 2de71c886..d75c18acb 100644 --- a/src/ts/types/trezor/device.d.ts +++ b/src/ts/types/trezor/device.d.ts @@ -78,6 +78,7 @@ export interface Features { export type Device = | { type: 'acquired'; + id: string | null; path: string; label: string; firmware: DeviceFirmwareStatus; From e2a1dcc258a9ac08639a9d431119b3a4de91f585 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maro=C5=A1?= Date: Tue, 17 Mar 2020 17:20:52 +0100 Subject: [PATCH 24/51] Feature/blockchain-link fiat rates (#536) * integrade new blockchain-link methods * change btc blockbook url to staging * fix flow * rename type * add missing coin param to blockchainSubscribeFiatRates * add ts types * restore prod blockbook url * fix return type for blockchainGetAccountBalanceHistory * bump blockchain-link * revert some ugly prettier changes * review fixes * unsubscribe rates in common unsubscribe method * remove fiatRates listener on unsubscribeFiatRates * update changelog * bump blockchain-link --- CHANGELOG.md | 1 + package.json | 4 +- src/js/backend/BlockchainLink.js | 41 +++++++++ src/js/constants/blockchain.js | 1 + .../BlockchainGetAccountBalanceHistory.js | 66 ++++++++++++++ .../BlockchainGetCurrentFiatRates.js | 53 +++++++++++ .../BlockchainGetFiatRatesForTimestamps.js | 53 +++++++++++ .../BlockchainSubscribeFiatRates.js | 50 +++++++++++ .../BlockchainUnsubscribeFiatRates.js | 47 ++++++++++ src/js/core/methods/index.js | 12 ++- src/js/index.js | 20 +++++ src/js/types/api.js | 5 ++ src/js/types/backend/blockchain.js | 86 ++++++++++++++---- src/ts/types/api.d.ts | 16 ++++ src/ts/types/backend/blockchain.d.ts | 89 +++++++++++++++---- src/ts/types/constants.d.ts | 1 + yarn.lock | 8 +- 17 files changed, 512 insertions(+), 41 deletions(-) create mode 100644 src/js/core/methods/blockchain/BlockchainGetAccountBalanceHistory.js create mode 100644 src/js/core/methods/blockchain/BlockchainGetCurrentFiatRates.js create mode 100644 src/js/core/methods/blockchain/BlockchainGetFiatRatesForTimestamps.js create mode 100644 src/js/core/methods/blockchain/BlockchainSubscribeFiatRates.js create mode 100644 src/js/core/methods/blockchain/BlockchainUnsubscribeFiatRates.js diff --git a/CHANGELOG.md b/CHANGELOG.md index c2a76b6f5..88c40d7b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Support for FW 1.9.0 and 2.3.0 (passphrase redesign) - Typescript types - `hex` parameter to `signMessage` and `verifyMessage` methods +- added blockchain-link methods for fiat rates (`blockchainGetAccountBalanceHistory`, `blockchainGetCurrentFiatRates`, `blockchainGetFiatRatesForTimestamps`, `blockchainSubscribeFiatRates`, `blockchainUnsubscribeFiatRates`) #### Fixed - General cleanup in flowtype declarations - disableWebUsb method diff --git a/package.json b/package.json index bf6dffe31..81d26db78 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@babel/plugin-transform-runtime": "7.8.3", "@babel/preset-env": "7.8.7", "@babel/preset-flow": "7.8.3", - "@trezor/blockchain-link": "^1.0.8", + "@trezor/blockchain-link": "^1.0.9", "@trezor/utxo-lib": "^0.1.0", "babel-collect-imports": "https://github.com/szymonlesisz/babel-collect-imports", "babel-eslint": "^10.1.0", @@ -116,7 +116,7 @@ "whatwg-fetch": "^3.0.0" }, "extendedDependencies": { - "@trezor/blockchain-link": "^1.0.8", + "@trezor/blockchain-link": "^1.0.9", "@trezor/utxo-lib": "^0.1.0", "bchaddrjs": "0.4.5", "bignumber.js": "^9.0.0", diff --git a/src/js/backend/BlockchainLink.js b/src/js/backend/BlockchainLink.js index bcbdcd746..c14be6321 100644 --- a/src/js/backend/BlockchainLink.js +++ b/src/js/backend/BlockchainLink.js @@ -10,6 +10,10 @@ import type { BlockchainBlock, BlockchainSubscribeAccount, BlockchainTransactions, + BlockchainFiatRates, + BlockchainTimestampedFiatRates, + BlockchainAccountBalanceHistory, + BlockchainGetAccountBalanceHistory, } from '../types'; import { @@ -121,6 +125,18 @@ export default class Blockchain { ); } + async getCurrentFiatRates(params: { currencies?: ?string[] }): Promise { + return this.link.getCurrentFiatRates(params); + } + + async getFiatRatesForTimestamps(params: { timestamps?: ?number[] }): Promise { + return this.link.getFiatRatesForTimestamps(params); + } + + async getAccountBalanceHistory(params: $Shape): Promise { + return this.link.getAccountBalanceHistory(params); + } + async getNetworkInfo() { return this.link.getInfo(); } @@ -183,19 +199,44 @@ export default class Blockchain { }); } + async subscribeFiatRates(currency?: string): Promise<{ subscribed: boolean }> { + // set block listener if it wasn't set before + if (this.link.listenerCount('fiatRates') === 0) { + this.link.on('fiatRates', (res: { + rates: BlockchainFiatRates; + }) => { + this.postMessage(BlockchainMessage(BLOCKCHAIN.FIAT_RATES_UPDATE, { + coin: this.coinInfo, + rates: res.rates, + })); + }); + } + + return this.link.subscribe({ + type: 'fiatRates', + }); + } + async unsubscribe(accounts?: BlockchainSubscribeAccount[]): Promise { if (!accounts) { this.link.removeAllListeners('block'); + this.link.removeAllListeners('fiatRates'); this.link.removeAllListeners('notification'); // remove all subscriptions await this.link.unsubscribe({ type: 'block' }); + await this.link.unsubscribe({ type: 'fiatRates' }); return this.link.unsubscribe({ type: 'notification' }); } // unsubscribe only requested accounts return this.link.unsubscribe({ type: 'accounts', accounts }); } + async unsubscribeFiatRates(): Promise { + this.link.removeAllListeners('fiatRates'); + return this.link.unsubscribe({ type: 'fiatRates' }); + } + async pushTransaction(tx: string): Promise { return await this.link.pushTransaction(tx); } diff --git a/src/js/constants/blockchain.js b/src/js/constants/blockchain.js index 1abfd99d6..9030a9a83 100644 --- a/src/js/constants/blockchain.js +++ b/src/js/constants/blockchain.js @@ -5,3 +5,4 @@ export const ERROR: 'blockchain-error' = 'blockchain-error'; export const CONNECT: 'blockchain-connect' = 'blockchain-connect'; export const BLOCK: 'blockchain-block' = 'blockchain-block'; export const NOTIFICATION: 'blockchain-notification' = 'blockchain-notification'; +export const FIAT_RATES_UPDATE: 'fiat-rates-update' = 'fiat-rates-update'; diff --git a/src/js/core/methods/blockchain/BlockchainGetAccountBalanceHistory.js b/src/js/core/methods/blockchain/BlockchainGetAccountBalanceHistory.js new file mode 100644 index 000000000..737a119cd --- /dev/null +++ b/src/js/core/methods/blockchain/BlockchainGetAccountBalanceHistory.js @@ -0,0 +1,66 @@ +/* @flow */ + +import AbstractMethod from '../AbstractMethod'; +import { validateParams } from '../helpers/paramsValidator'; +import { NO_COIN_INFO, backendNotSupported } from '../../../constants/errors'; + +import { initBlockchain } from '../../../backend/BlockchainLink'; +import { getCoinInfo } from '../../../data/CoinInfo'; +import type { CoreMessage, CoinInfo } from '../../../types'; + +type Params = { + coinInfo: CoinInfo; + request: { + descriptor: string; + from?: number; + to?: number; + groupBy?: number; + }; +}; + +export default class BlockchainGetAccountBalanceHistory extends AbstractMethod { + params: Params; + + constructor(message: CoreMessage) { + super(message); + this.useDevice = false; + this.useUi = false; + + const payload: Object = message.payload; + + // validate incoming parameters + validateParams(payload, [ + { name: 'coin', type: 'string', obligatory: true }, + { name: 'descriptor', type: 'string', obligatory: true }, + { name: 'from', type: 'number', obligatory: false }, + { name: 'to', type: 'number', obligatory: false }, + { name: 'groupBy', type: 'number', obligatory: false }, + ]); + + const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + if (!coinInfo) { + throw NO_COIN_INFO; + } + if (!coinInfo.blockchainLink) { + throw backendNotSupported(coinInfo.name); + } + + this.params = { + coinInfo: coinInfo, + request: { + descriptor: payload.descriptor, + from: payload.from, + to: payload.to, + groupBy: payload.groupBy, + }, + }; + } + + async run() { + const backend = await initBlockchain( + this.params.coinInfo, + this.postMessage + ); + return backend.getAccountBalanceHistory(this.params.request); + } +} diff --git a/src/js/core/methods/blockchain/BlockchainGetCurrentFiatRates.js b/src/js/core/methods/blockchain/BlockchainGetCurrentFiatRates.js new file mode 100644 index 000000000..89630169d --- /dev/null +++ b/src/js/core/methods/blockchain/BlockchainGetCurrentFiatRates.js @@ -0,0 +1,53 @@ +/* @flow */ + +import AbstractMethod from '../AbstractMethod'; +import { validateParams } from '../helpers/paramsValidator'; +import { NO_COIN_INFO, backendNotSupported } from '../../../constants/errors'; + +import { initBlockchain } from '../../../backend/BlockchainLink'; +import { getCoinInfo } from '../../../data/CoinInfo'; +import type { CoreMessage, CoinInfo } from '../../../types'; + +type Params = { + coinInfo: CoinInfo; + currencies?: string[]; +}; + +export default class BlockchainGetCurrentFiatRates extends AbstractMethod { + params: Params; + + constructor(message: CoreMessage) { + super(message); + this.useDevice = false; + this.useUi = false; + + const payload: Object = message.payload; + + // validate incoming parameters + validateParams(payload, [ + { name: 'currencies', type: 'array', obligatory: false }, + { name: 'coin', type: 'string', obligatory: true }, + ]); + + const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + if (!coinInfo) { + throw NO_COIN_INFO; + } + if (!coinInfo.blockchainLink) { + throw backendNotSupported(coinInfo.name); + } + + this.params = { + currencies: payload.currencies, + coinInfo: coinInfo, + }; + } + + async run() { + const backend = await initBlockchain( + this.params.coinInfo, + this.postMessage + ); + return backend.getCurrentFiatRates({ currencies: this.params.currencies }); + } +} diff --git a/src/js/core/methods/blockchain/BlockchainGetFiatRatesForTimestamps.js b/src/js/core/methods/blockchain/BlockchainGetFiatRatesForTimestamps.js new file mode 100644 index 000000000..97f129aec --- /dev/null +++ b/src/js/core/methods/blockchain/BlockchainGetFiatRatesForTimestamps.js @@ -0,0 +1,53 @@ +/* @flow */ + +import AbstractMethod from '../AbstractMethod'; +import { validateParams } from '../helpers/paramsValidator'; +import { NO_COIN_INFO, backendNotSupported } from '../../../constants/errors'; + +import { initBlockchain } from '../../../backend/BlockchainLink'; +import { getCoinInfo } from '../../../data/CoinInfo'; +import type { CoreMessage, CoinInfo } from '../../../types'; + +type Params = { + coinInfo: CoinInfo; + timestamps?: number[]; +}; + +export default class BlockchainGetFiatRatesForTimestamps extends AbstractMethod { + params: Params; + + constructor(message: CoreMessage) { + super(message); + this.useDevice = false; + this.useUi = false; + + const payload: Object = message.payload; + + // validate incoming parameters + validateParams(payload, [ + { name: 'timestamps', type: 'array', obligatory: true }, + { name: 'coin', type: 'string', obligatory: true }, + ]); + + const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + if (!coinInfo) { + throw NO_COIN_INFO; + } + if (!coinInfo.blockchainLink) { + throw backendNotSupported(coinInfo.name); + } + + this.params = { + timestamps: payload.timestamps, + coinInfo: coinInfo, + }; + } + + async run() { + const backend = await initBlockchain( + this.params.coinInfo, + this.postMessage + ); + return backend.getFiatRatesForTimestamps({ timestamps: this.params.timestamps }); + } +} diff --git a/src/js/core/methods/blockchain/BlockchainSubscribeFiatRates.js b/src/js/core/methods/blockchain/BlockchainSubscribeFiatRates.js new file mode 100644 index 000000000..6e9a734b7 --- /dev/null +++ b/src/js/core/methods/blockchain/BlockchainSubscribeFiatRates.js @@ -0,0 +1,50 @@ +/* @flow */ + +import AbstractMethod from '../AbstractMethod'; +import { validateParams } from '../helpers/paramsValidator'; +import { NO_COIN_INFO, backendNotSupported } from '../../../constants/errors'; + +import { initBlockchain } from '../../../backend/BlockchainLink'; +import { getCoinInfo } from '../../../data/CoinInfo'; +import type { CoreMessage, CoinInfo } from '../../../types'; + +type Params = { + currency?: string; + coinInfo: CoinInfo; +} + +export default class BlockchainSubscribeFiatRates extends AbstractMethod { + params: Params; + + constructor(message: CoreMessage) { + super(message); + this.useDevice = false; + this.useUi = false; + + const payload: Object = message.payload; + + // validate incoming parameters + validateParams(payload, [ + { name: 'currency', type: 'string', obligatory: false }, + { name: 'coin', type: 'string', obligatory: true }, + ]); + + const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + if (!coinInfo) { + throw NO_COIN_INFO; + } + if (!coinInfo.blockchainLink) { + throw backendNotSupported(coinInfo.name); + } + + this.params = { + currency: payload.currency, + coinInfo, + }; + } + + async run(): Promise<{ subscribed: boolean }> { + const backend = await initBlockchain(this.params.coinInfo, this.postMessage); + return backend.subscribeFiatRates(this.params.currency); + } +} diff --git a/src/js/core/methods/blockchain/BlockchainUnsubscribeFiatRates.js b/src/js/core/methods/blockchain/BlockchainUnsubscribeFiatRates.js new file mode 100644 index 000000000..75264c4b6 --- /dev/null +++ b/src/js/core/methods/blockchain/BlockchainUnsubscribeFiatRates.js @@ -0,0 +1,47 @@ +/* @flow */ + +import AbstractMethod from '../AbstractMethod'; +import { validateParams } from '../helpers/paramsValidator'; +import { NO_COIN_INFO, backendNotSupported } from '../../../constants/errors'; + +import { initBlockchain } from '../../../backend/BlockchainLink'; +import { getCoinInfo } from '../../../data/CoinInfo'; +import type { CoreMessage, CoinInfo } from '../../../types'; + +type Params = { + coinInfo: CoinInfo; +} + +export default class BlockchainUnsubscribeFiatRates extends AbstractMethod { + params: Params; + + constructor(message: CoreMessage) { + super(message); + this.useDevice = false; + this.useUi = false; + + const payload: Object = message.payload; + + // validate incoming parameters + validateParams(payload, [ + { name: 'coin', type: 'string', obligatory: true }, + ]); + + const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + if (!coinInfo) { + throw NO_COIN_INFO; + } + if (!coinInfo.blockchainLink) { + throw backendNotSupported(coinInfo.name); + } + + this.params = { + coinInfo, + }; + } + + async run(): Promise { + const backend = await initBlockchain(this.params.coinInfo, this.postMessage); + return backend.unsubscribeFiatRates(); + } +} diff --git a/src/js/core/methods/index.js b/src/js/core/methods/index.js index 4bb2126c5..4111493ad 100644 --- a/src/js/core/methods/index.js +++ b/src/js/core/methods/index.js @@ -7,6 +7,11 @@ import AbstractMethod from './AbstractMethod'; import BlockchainDisconnect from './blockchain/BlockchainDisconnect'; import BlockchainEstimateFee from './blockchain/BlockchainEstimateFee'; import BlockchainGetTransactions from './blockchain/BlockchainGetTransactions'; +import BlockchainGetCurrentFiatRates from './blockchain/BlockchainGetCurrentFiatRates'; +import BlockchainGetFiatRatesForTimestamps from './blockchain/BlockchainGetFiatRatesForTimestamps'; +import BlockchainGetAccountBalanceHistory from './blockchain/BlockchainGetAccountBalanceHistory'; +import BlockchainSubscribeFiatRates from './blockchain/BlockchainSubscribeFiatRates'; +import BlockchainUnsubscribeFiatRates from './blockchain/BlockchainUnsubscribeFiatRates'; import BlockchainSubscribe from './blockchain/BlockchainSubscribe'; import BlockchainUnsubscribe from './blockchain/BlockchainUnsubscribe'; import CardanoGetAddress from './CardanoGetAddress'; @@ -62,12 +67,17 @@ import ChangePin from './ChangePin'; import FirmwareUpdate from './FirmwareUpdate'; import RecoveryDevice from './RecoveryDevice'; -const classes: {[k: string]: any} = { +const classes: { [k: string]: any } = { 'blockchainDisconnect': BlockchainDisconnect, 'blockchainEstimateFee': BlockchainEstimateFee, + 'blockchainGetAccountBalanceHistory': BlockchainGetAccountBalanceHistory, + 'blockchainGetCurrentFiatRates': BlockchainGetCurrentFiatRates, + 'blockchainGetFiatRatesForTimestamps': BlockchainGetFiatRatesForTimestamps, 'blockchainGetTransactions': BlockchainGetTransactions, 'blockchainSubscribe': BlockchainSubscribe, + 'blockchainSubscribeFiatRates': BlockchainSubscribeFiatRates, 'blockchainUnsubscribe': BlockchainUnsubscribe, + 'blockchainUnsubscribeFiatRates': BlockchainUnsubscribeFiatRates, 'cardanoGetAddress': CardanoGetAddress, 'cardanoGetPublicKey': CardanoGetPublicKey, 'cardanoSignTransaction': CardanoSignTransaction, diff --git a/src/js/index.js b/src/js/index.js index 37d56a363..8b5db64e8 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -33,6 +33,18 @@ const TrezorConnect: API = { // methods + blockchainGetAccountBalanceHistory: params => { + return call({ method: 'blockchainGetAccountBalanceHistory', ...params }); + }, + + blockchainGetCurrentFiatRates: params => { + return call({ method: 'blockchainGetCurrentFiatRates', ...params }); + }, + + blockchainGetFiatRatesForTimestamps: params => { + return call({ method: 'blockchainGetFiatRatesForTimestamps', ...params }); + }, + blockchainDisconnect: params => { return call({ method: 'blockchainDisconnect', ...params }); }, @@ -49,10 +61,18 @@ const TrezorConnect: API = { return call({ method: 'blockchainSubscribe', ...params }); }, + blockchainSubscribeFiatRates: params => { + return call({ method: 'blockchainSubscribeFiatRates', ...params }); + }, + blockchainUnsubscribe: params => { return call({ method: 'blockchainUnsubscribe', ...params }); }, + blockchainUnsubscribeFiatRates: params => { + return call({ method: 'blockchainUnsubscribeFiatRates', ...params }); + }, + customMessage: params => { return customMessage(params); }, diff --git a/src/js/types/api.js b/src/js/types/api.js index b1970e879..132eb1a99 100644 --- a/src/js/types/api.js +++ b/src/js/types/api.js @@ -90,9 +90,14 @@ export type API = { * Backend operations */ blockchainEstimateFee: Method; + blockchainGetAccountBalanceHistory: Method; + blockchainGetCurrentFiatRates: Method; + blockchainGetFiatRatesForTimestamps: Method; blockchainGetTransactions: Method; blockchainSubscribe: Method; + blockchainSubscribeFiatRates: Method; blockchainUnsubscribe: Method; + blockchainUnsubscribeFiatRates: Method; blockchainDisconnect: Method; /** diff --git a/src/js/types/backend/blockchain.js b/src/js/types/backend/blockchain.js index ca91b4cd6..3c4716be8 100644 --- a/src/js/types/backend/blockchain.js +++ b/src/js/types/backend/blockchain.js @@ -38,11 +38,25 @@ export type BlockchainNotification = { }; } +export type BlockchainFiatRates = { + [string]: ?number; +} + +export type BlockchainFiatRatesUpdate = { + coin: CoinInfo; + rates: BlockchainFiatRates; +} + export type BlockchainSubscribeAccount = { descriptor: string; addresses?: AccountAddresses; // bitcoin addresses } +export type BlockchainSubscribeFiatRates = { + currency?: string; + coin: string; +} + export type BlockchainSubscribe = { accounts: BlockchainSubscribeAccount[]; coin: string; @@ -65,6 +79,41 @@ export type BlockchainGetTransactions = { txs: string[]; } +export type BlockchainGetCurrentFiatRates = { + coin: string; + currencies?: string[]; +} + +export type BlockchainTimestampedFiatRates = { + ts: number; + rates: BlockchainFiatRates; +} + +export type BlockchainGetFiatRatesForTimestamps = { + coin: string; + timestamps: number[]; +} + +export type BlockchainFiatRatesForTimestamps = { + tickers: BlockchainTimestampedFiatRates[]; +} + +export type BlockchainGetAccountBalanceHistory = { + coin: string; + descriptor: string; + from?: number; + to?: number; + groupBy?: number; +}; + +export type BlockchainAccountBalanceHistory = { + time: number; + txs: number; + received: string; + sent: string; + fiatRate: number; +}; + export type BlockchainTransactions = Array<{ type: 'blockbook'; tx: BlockbookTransaction; @@ -96,26 +145,31 @@ export type BlockchainEstimatedFee = { } export type BlockchainEvent = -| { - type: typeof BLOCKCHAIN.CONNECT; - payload: BlockchainInfo; -} -| { - type: typeof BLOCKCHAIN.ERROR; - payload: BlockchainError; -} -| { - type: typeof BLOCKCHAIN.BLOCK; - payload: BlockchainBlock; -} -| { - type: typeof BLOCKCHAIN.NOTIFICATION; - payload: BlockchainNotification; -}; + | { + type: typeof BLOCKCHAIN.CONNECT; + payload: BlockchainInfo; + } + | { + type: typeof BLOCKCHAIN.ERROR; + payload: BlockchainError; + } + | { + type: typeof BLOCKCHAIN.BLOCK; + payload: BlockchainBlock; + } + | { + type: typeof BLOCKCHAIN.NOTIFICATION; + payload: BlockchainNotification; + } + | { + type: typeof BLOCKCHAIN.FIAT_RATES_UPDATE; + payload: BlockchainFiatRatesUpdate; + }; export interface BlockchainMessageBuilder { (type: typeof BLOCKCHAIN.CONNECT, payload: BlockchainInfo): CoreMessage; (type: typeof BLOCKCHAIN.BLOCK, payload: BlockchainBlock): CoreMessage; (type: typeof BLOCKCHAIN.NOTIFICATION, payload: BlockchainNotification): CoreMessage; (type: typeof BLOCKCHAIN.ERROR, payload: BlockchainError): CoreMessage; + (type: typeof BLOCKCHAIN.FIAT_RATES_UPDATE, payload: BlockchainFiatRatesUpdate): CoreMessage; } diff --git a/src/ts/types/api.d.ts b/src/ts/types/api.d.ts index ba8cbc1c5..c30b9b304 100644 --- a/src/ts/types/api.d.ts +++ b/src/ts/types/api.d.ts @@ -73,19 +73,35 @@ export namespace TrezorConnect { function blockchainEstimateFee( params: P.CommonParams & Blockchain.BlockchainEstimateFee, ): P.Response; + function blockchainGetAccountBalanceHistory( + params: Blockchain.BlockchainGetAccountBalanceHistory + ): P.Response; + function blockchainGetCurrentFiatRates( + params: Blockchain.BlockchainGetCurrentFiatRates + ): P.Response; + function blockchainGetFiatRatesForTimestamps( + params: Blockchain.BlockchainGetFiatRatesForTimestamps + ): P.Response; function blockchainGetTransactions( params: P.CommonParams & Blockchain.BlockchainGetTransactions, ): P.Response; function blockchainSubscribe( params: P.CommonParams & Blockchain.BlockchainSubscribe, ): P.Response; + function blockchainSubscribeFiatRates( + params: Blockchain.BlockchainSubscribeFiatRates + ): P.Response; function blockchainUnsubscribe( params: P.CommonParams & Blockchain.BlockchainSubscribe, ): P.Response; + function blockchainUnsubscribeFiatRates( + params: Blockchain.BlockchainSubscribeFiatRates + ): P.Response; function blockchainDisconnect( params: P.CommonParams & Blockchain.BlockchainDisconnect, ): P.Response; + /** * Bitcoin and Bitcoin-like * Display requested address derived by given BIP32 path on device and diff --git a/src/ts/types/backend/blockchain.d.ts b/src/ts/types/backend/blockchain.d.ts index e964b4e71..98bac6998 100644 --- a/src/ts/types/backend/blockchain.d.ts +++ b/src/ts/types/backend/blockchain.d.ts @@ -66,13 +66,13 @@ export interface BlockchainGetTransactions { export type BlockchainTransactions = Array< | { - type: 'blockbook'; - tx: BlockbookTransaction; - } + type: 'blockbook'; + tx: BlockbookTransaction; + } | { - type: 'ripple'; - tx: RippleLibTransaction; - } + type: 'ripple'; + tx: RippleLibTransaction; + } >; export interface BlockchainEstimateFee { @@ -97,20 +97,73 @@ export interface BlockchainEstimatedFee { levels: FeeLevel[]; } +export interface BlockchainFiatRates { + [k: string]: number | undefined; +} + +export interface BlockchainFiatRatesUpdate { + coin: CoinInfo; + rates: BlockchainFiatRates; +} + +export interface BlockchainSubscribeFiatRates { + currency?: string; + coin: string; +} + +export interface BlockchainGetCurrentFiatRates { + coin: string; + currencies?: string[]; +} + +export interface BlockchainTimestampedFiatRates { + ts: number; + rates: BlockchainFiatRates; +} + +export interface BlockchainGetFiatRatesForTimestamps { + coin: string; + timestamps: number[]; +} + +export interface BlockchainFiatRatesForTimestamps { + tickers: BlockchainTimestampedFiatRates[]; +} + +export interface BlockchainGetAccountBalanceHistory { + coin: string; + descriptor: string; + from?: number; + to?: number; + groupBy?: number; +} + +export interface BlockchainAccountBalanceHistory { + time: number; + txs: number; + received: string; + sent: string; + fiatRate: number; +} + export type BlockchainEvent = | { - type: typeof BLOCKCHAIN.CONNECT; - payload: BlockchainInfo; - } + type: typeof BLOCKCHAIN.CONNECT; + payload: BlockchainInfo; + } + | { + type: typeof BLOCKCHAIN.ERROR; + payload: BlockchainError; + } | { - type: typeof BLOCKCHAIN.ERROR; - payload: BlockchainError; - } + type: typeof BLOCKCHAIN.BLOCK; + payload: BlockchainBlock; + } | { - type: typeof BLOCKCHAIN.BLOCK; - payload: BlockchainBlock; - } + type: typeof BLOCKCHAIN.NOTIFICATION; + payload: BlockchainNotification; + } | { - type: typeof BLOCKCHAIN.NOTIFICATION; - payload: BlockchainNotification; - }; + type: typeof BLOCKCHAIN.FIAT_RATES_UPDATE; + payload: BlockchainFiatRatesUpdate; + }; diff --git a/src/ts/types/constants.d.ts b/src/ts/types/constants.d.ts index e00f7c484..b7ab37c3b 100644 --- a/src/ts/types/constants.d.ts +++ b/src/ts/types/constants.d.ts @@ -10,6 +10,7 @@ export namespace BLOCKCHAIN { const ERROR = 'blockchain-error'; const NOTIFICATION = 'blockchain-notification'; const BLOCK = 'blockchain-block'; + const FIAT_RATES_UPDATE = 'fiat-rates-update'; } export namespace IFRAME { diff --git a/yarn.lock b/yarn.lock index 5afebf06a..6132baf58 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1370,10 +1370,10 @@ dependencies: type-detect "4.0.8" -"@trezor/blockchain-link@^1.0.8": - version "1.0.8" - resolved "https://registry.yarnpkg.com/@trezor/blockchain-link/-/blockchain-link-1.0.8.tgz#5d2b9bdf624492cb68349f83d42cadc848b6fc35" - integrity sha512-d/dC4KNaUB4ip2QgTd5YuebvL3vp45kaGp13Dj6BNqIQmchzCX8OpztzjofYhzLRPmf2QFZjVlaIaRuLGP3E0Q== +"@trezor/blockchain-link@^1.0.9": + version "1.0.9" + resolved "https://registry.yarnpkg.com/@trezor/blockchain-link/-/blockchain-link-1.0.9.tgz#3993085f9a9b45f358f9212ead2476cae70c91eb" + integrity sha512-VLEnt5QGWPg7/wA4biVZwlryz/E1zY5vOefn47RqsEygz5YVmZT5XjtDEbZzrn2AEKaMynjfz2mu7wiaLUZYuQ== dependencies: es6-promise "^4.2.8" events "^3.1.0" From a1de0bfb37dab1599bd207afb9bc540589d880e7 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Tue, 17 Mar 2020 17:29:11 +0100 Subject: [PATCH 25/51] fix: invalid default capabilities for TT@2.1.0+ --- .../__tests__/deviceFeaturesUtils.test.js | 20 +++++++++++++++++++ src/js/utils/deviceFeaturesUtils.js | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/js/utils/__tests__/deviceFeaturesUtils.test.js b/src/js/utils/__tests__/deviceFeaturesUtils.test.js index 02af40706..15249fffb 100644 --- a/src/js/utils/__tests__/deviceFeaturesUtils.test.js +++ b/src/js/utils/__tests__/deviceFeaturesUtils.test.js @@ -65,6 +65,26 @@ describe('utils/deviceFeaturesUtils', () => { 'Capability_U2F', ]); + expect(parseCapabilities({ + major_version: 2, + capabilities: [], + })).toEqual([ + 'Capability_Bitcoin', + 'Capability_Bitcoin_like', + 'Capability_Binance', + 'Capability_Cardano', + 'Capability_Crypto', + 'Capability_EOS', + 'Capability_Ethereum', + 'Capability_Lisk', + 'Capability_Monero', + 'Capability_NEM', + 'Capability_Ripple', + 'Capability_Stellar', + 'Capability_Tezos', + 'Capability_U2F', + ]); + // bitcoin only expect(parseCapabilities({ major_version: 1, diff --git a/src/js/utils/deviceFeaturesUtils.js b/src/js/utils/deviceFeaturesUtils.js index 89fa4dbfa..ce9ae285f 100644 --- a/src/js/utils/deviceFeaturesUtils.js +++ b/src/js/utils/deviceFeaturesUtils.js @@ -47,7 +47,7 @@ export const parseCapabilities = (features?: Features): string[] => { // needs to be "any" since Features.capabilities are declared as string[] but in fact it's a number[] const filter = (c: any) => CAPABILITIES[c] || 'Capability_Unknown_trezor-connect'; // fallback for older firmware - if (!features.capabilities) return features.major_version === 1 ? DEFAULT_CAPABILITIES_T1.map(filter) : DEFAULT_CAPABILITIES_TT.map(filter); + if (!features.capabilities || !features.capabilities.length) return features.major_version === 1 ? DEFAULT_CAPABILITIES_T1.map(filter) : DEFAULT_CAPABILITIES_TT.map(filter); // regular capabilities return features.capabilities.map(filter); }; From 00c858d32b06ed4001bce1ffb8599fd185cab631 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Sat, 7 Dec 2019 16:49:06 +0100 Subject: [PATCH 26/51] cherry-pick fix #504 --- src/js/env/node/index.js | 3 ++- src/js/env/react-native/index.js | 3 ++- src/js/iframe/builder.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/js/env/node/index.js b/src/js/env/node/index.js index 6cdfafd5a..1379d7bbd 100644 --- a/src/js/env/node/index.js +++ b/src/js/env/node/index.js @@ -104,8 +104,9 @@ const postMessage = (message: any, usePromise: boolean = true) => { _messageID++; message.id = _messageID; messagePromises[_messageID] = createDeferred(); + const { promise } = messagePromises[_messageID]; _core.handleMessage(message, true); - return messagePromises[_messageID].promise; + return promise; } _core.handleMessage(message, true); diff --git a/src/js/env/react-native/index.js b/src/js/env/react-native/index.js index 3bbbb1a22..529af94ec 100644 --- a/src/js/env/react-native/index.js +++ b/src/js/env/react-native/index.js @@ -106,8 +106,9 @@ const postMessage = (message: any, usePromise: boolean = true) => { _messageID++; message.id = _messageID; messagePromises[_messageID] = createDeferred(); + const { promise } = messagePromises[_messageID]; _core.handleMessage(message, true); - return messagePromises[_messageID].promise; + return promise; } _core.handleMessage(message, true); diff --git a/src/js/iframe/builder.js b/src/js/iframe/builder.js index 0d1cc7536..543635793 100644 --- a/src/js/iframe/builder.js +++ b/src/js/iframe/builder.js @@ -161,8 +161,9 @@ export const postMessage = (message: any, usePromise: boolean = true): ?Promise< _messageID++; message.id = _messageID; messagePromises[_messageID] = createDeferred(); + const { promise } = messagePromises[_messageID]; instance.contentWindow.postMessage(message, origin); - return messagePromises[_messageID].promise; + return promise; } instance.contentWindow.postMessage(message, origin); From 685b50f3ab296fad72729ad812521b6cb4080eba Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 18 Mar 2020 12:37:25 +0100 Subject: [PATCH 27/51] Feature/cancel (#537) * separate Device types to KnownDevice & UnknownDevice * handle iframe unload instead beforeunload * implement transport.post('Cancel') --- src/js/device/Device.js | 6 ++++- src/js/device/DeviceCommands.js | 4 +++ src/js/env/browser/index.js | 2 +- src/js/iframe/iframe.js | 2 +- src/js/types/trezor/device.js | 43 ++++++++++++++++++--------------- src/ts/types/trezor/device.d.ts | 43 ++++++++++++++++++--------------- 6 files changed, 57 insertions(+), 43 deletions(-) diff --git a/src/js/device/Device.js b/src/js/device/Device.js index a49dbc75f..5bbef9020 100644 --- a/src/js/device/Device.js +++ b/src/js/device/Device.js @@ -204,6 +204,7 @@ export default class Device extends EventEmitter { interruptionFromUser(error: Error): void { _log.debug('+++++interruptionFromUser'); if (this.commands) { + this.commands.cancel(); this.commands.dispose(); } if (this.runPromise) { @@ -570,6 +571,9 @@ export default class Device extends EventEmitter { onBeforeUnload() { if (this.isUsedHere() && this.activitySessionID) { try { + if (this.commands) { + this.commands.cancel(); + } this.transport.release(this.activitySessionID, true, false); } catch (err) { // empty @@ -600,7 +604,7 @@ export default class Device extends EventEmitter { }; } else { const defaultLabel: string = 'My Trezor'; - const label = this.features.label === '' || this.features.label === null ? defaultLabel : this.features.label; + const label = this.features.label === '' || !this.features.label ? defaultLabel : this.features.label; return { type: 'acquired', id: this.features.device_id, diff --git a/src/js/device/DeviceCommands.js b/src/js/device/DeviceCommands.js index ac8c24dbd..cf18c058c 100644 --- a/src/js/device/DeviceCommands.js +++ b/src/js/device/DeviceCommands.js @@ -840,4 +840,8 @@ export default class DeviceCommands { return; } + + async cancel() { + this.transport.post(this.sessionId, 'Cancel', {}, false); + } } diff --git a/src/js/env/browser/index.js b/src/js/env/browser/index.js index f67f495da..c0a9fc522 100644 --- a/src/js/env/browser/index.js +++ b/src/js/env/browser/index.js @@ -149,7 +149,7 @@ export const init = async (settings: $Shape<$T.ConnectSettings> = {}): Promise { }; window.addEventListener('message', handleMessage, false); -window.addEventListener('beforeunload', () => { +window.addEventListener('unload', () => { if (_core) { _core.onBeforeUnload(); } diff --git a/src/js/types/trezor/device.js b/src/js/types/trezor/device.js index 3f82ff76b..2464ba067 100644 --- a/src/js/types/trezor/device.js +++ b/src/js/types/trezor/device.js @@ -76,26 +76,29 @@ export type Features = { capabilities?: string[]; } -export type Device = - | { - type: 'acquired'; - id: string | null; - path: string; - label: string; - firmware: DeviceFirmwareStatus; - firmwareRelease: ?FirmwareRelease; - status: DeviceStatus; - mode: DeviceMode; - state: ?string; - features: Features; - unavailableCapabilities: { [key: string]: UnavailableCapability }; - } - | { - type: 'unacquired' | 'unreadable'; - path: string; - label: string; - features?: typeof undefined; - }; +export type KnownDevice = { + type: 'acquired'; + id: string | null; + path: string; + label: string; + firmware: DeviceFirmwareStatus; + firmwareRelease: ?FirmwareRelease; + status: DeviceStatus; + mode: DeviceMode; + state: ?string; + features: Features; + unavailableCapabilities: { [key: string]: UnavailableCapability }; +}; + +export type UnknownDevice = { + type: 'unacquired' | 'unreadable'; + id?: null; + path: string; + label: string; + features?: typeof undefined; +}; + +export type Device = KnownDevice | UnknownDevice; export type DeviceEvent = { type: | typeof DEVICE.CONNECT diff --git a/src/ts/types/trezor/device.d.ts b/src/ts/types/trezor/device.d.ts index d75c18acb..487907c26 100644 --- a/src/ts/types/trezor/device.d.ts +++ b/src/ts/types/trezor/device.d.ts @@ -75,26 +75,29 @@ export interface Features { capabilities?: string[]; } -export type Device = - | { - type: 'acquired'; - id: string | null; - path: string; - label: string; - firmware: DeviceFirmwareStatus; - firmwareRelease?: FirmwareRelease; - status: DeviceStatus; - mode: DeviceMode; - state?: string; - features: Features; - unavailableCapabilities: { [key: string]: UnavailableCapability }; - } - | { - type: 'unacquired' | 'unreadable'; - path: string; - label: string; - features?: typeof undefined; - }; +export type KnownDevice = { + type: 'acquired'; + id: string | null; + path: string; + label: string; + firmware: DeviceFirmwareStatus; + firmwareRelease?: FirmwareRelease; + status: DeviceStatus; + mode: DeviceMode; + state?: string; + features: Features; + unavailableCapabilities: { [key: string]: UnavailableCapability }; +}; + +export type UnknownDevice = { + type: 'unacquired' | 'unreadable'; + id?: null; + path: string; + label: string; + features?: typeof undefined; +}; + +export type Device = KnownDevice | UnknownDevice; export interface DeviceEvent { type: typeof DEVICE.CONNECT | typeof DEVICE.CONNECT_UNACQUIRED | typeof DEVICE.CHANGED | typeof DEVICE.DISCONNECT; From 299f4f4b9b22cb43c24460ed07ac8c9767ae5be3 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 18 Mar 2020 12:43:02 +0100 Subject: [PATCH 28/51] Feature/custom backend (#538) * remove unnecessary typings from blockchain methods * spearate Common types in CoinInfo * add TrezorConnect.blockchainSetCustomBackend types * TrezorConnect.blockchainSetCustomBackend implementation * remove unused `updateSettings` --- src/js/backend/BlockchainLink.js | 49 ++++---- .../blockchain/BlockchainDisconnect.js | 13 +- .../blockchain/BlockchainEstimateFee.js | 2 +- .../BlockchainGetAccountBalanceHistory.js | 2 +- .../BlockchainGetCurrentFiatRates.js | 2 +- .../BlockchainGetFiatRatesForTimestamps.js | 2 +- .../blockchain/BlockchainGetTransactions.js | 2 +- .../blockchain/BlockchainSetCustomBackend.js | 56 +++++++++ .../methods/blockchain/BlockchainSubscribe.js | 4 +- .../BlockchainSubscribeFiatRates.js | 4 +- .../blockchain/BlockchainUnsubscribe.js | 4 +- .../BlockchainUnsubscribeFiatRates.js | 4 +- src/js/core/methods/index.js | 10 +- src/js/data/CoinInfo.js | 2 +- src/js/index.js | 4 + src/js/types/__tests__/blockchain.js | 13 ++ src/js/types/api.js | 1 + src/js/types/backend/blockchain.js | 5 + src/js/types/networks/coinInfo.js | 112 +++++------------- src/ts/types/__tests__/blockchain.ts | 13 ++ src/ts/types/api.d.ts | 3 + src/ts/types/backend/blockchain.d.ts | 5 + src/ts/types/networks/coinInfo.d.ts | 78 +++--------- 23 files changed, 199 insertions(+), 191 deletions(-) create mode 100644 src/js/core/methods/blockchain/BlockchainSetCustomBackend.js diff --git a/src/js/backend/BlockchainLink.js b/src/js/backend/BlockchainLink.js index c14be6321..ffcb07afb 100644 --- a/src/js/backend/BlockchainLink.js +++ b/src/js/backend/BlockchainLink.js @@ -9,10 +9,7 @@ import type { GetAccountInfo, BlockchainBlock, BlockchainSubscribeAccount, - BlockchainTransactions, BlockchainFiatRates, - BlockchainTimestampedFiatRates, - BlockchainAccountBalanceHistory, BlockchainGetAccountBalanceHistory, } from '../types'; @@ -108,32 +105,32 @@ export default class Blockchain { } } - async loadTransaction(id: string): Promise { + async loadTransaction(id: string) { const transaction = await this.link.getTransaction(id); return BitcoinJsTransaction.fromHex(transaction.tx.hex, this.coinInfo.network); } - async getTransactions(txs: string[]): Promise { + async getTransactions(txs: string[]) { return Promise.all( txs.map(id => this.link.getTransaction(id)) ); } - async getReferencedTransactions(txs: string[]): Promise { + async getReferencedTransactions(txs: string[]) { return Promise.all( txs.map(id => this.loadTransaction(id)) ); } - async getCurrentFiatRates(params: { currencies?: ?string[] }): Promise { + async getCurrentFiatRates(params: { currencies?: ?string[] }) { return this.link.getCurrentFiatRates(params); } - async getFiatRatesForTimestamps(params: { timestamps?: ?number[] }): Promise { + async getFiatRatesForTimestamps(params: { timestamps?: ?number[] }) { return this.link.getFiatRatesForTimestamps(params); } - async getAccountBalanceHistory(params: $Shape): Promise { + async getAccountBalanceHistory(params: $Shape) { return this.link.getAccountBalanceHistory(params); } @@ -170,7 +167,7 @@ export default class Blockchain { return this.link.estimateFee(request); } - async subscribe(accounts: BlockchainSubscribeAccount[]): Promise<{ subscribed: boolean }> { + async subscribe(accounts: BlockchainSubscribeAccount[]) { // set block listener if it wasn't set before if (this.link.listenerCount('block') === 0) { this.link.on('block', (block: BlockchainBlock) => { @@ -199,7 +196,7 @@ export default class Blockchain { }); } - async subscribeFiatRates(currency?: string): Promise<{ subscribed: boolean }> { + async subscribeFiatRates(currency?: string) { // set block listener if it wasn't set before if (this.link.listenerCount('fiatRates') === 0) { this.link.on('fiatRates', (res: { @@ -217,7 +214,7 @@ export default class Blockchain { }); } - async unsubscribe(accounts?: BlockchainSubscribeAccount[]): Promise { + async unsubscribe(accounts?: BlockchainSubscribeAccount[]) { if (!accounts) { this.link.removeAllListeners('block'); this.link.removeAllListeners('fiatRates'); @@ -232,12 +229,12 @@ export default class Blockchain { return this.link.unsubscribe({ type: 'accounts', accounts }); } - async unsubscribeFiatRates(): Promise { + async unsubscribeFiatRates() { this.link.removeAllListeners('fiatRates'); return this.link.unsubscribe({ type: 'fiatRates' }); } - async pushTransaction(tx: string): Promise { + async pushTransaction(tx: string) { return await this.link.pushTransaction(tx); } @@ -249,16 +246,17 @@ export default class Blockchain { } const instances: Blockchain[] = []; +const customBackends: { [coin: string]: CoinInfo } = {}; -const remove = (backend: Blockchain): void => { - const index: number = instances.indexOf(backend); +export const remove = (backend: Blockchain) => { + const index = instances.indexOf(backend); if (index >= 0) { instances.splice(index, 1); } }; -export const find = (name: string): ?Blockchain => { - for (let i: number = 0; i < instances.length; i++) { +export const find = (name: string) => { + for (let i = 0; i < instances.length; i++) { if (instances[i].coinInfo.name === name) { return instances[i]; } @@ -266,11 +264,20 @@ export const find = (name: string): ?Blockchain => { return null; }; -export const initBlockchain = async (coinInfo: $ElementType, postMessage: $ElementType) => { - let backend: ?Blockchain = find(coinInfo.name); +export const setCustomBackend = (coinInfo: CoinInfo, blockchainLink: $ElementType) => { + if (!blockchainLink) { + delete customBackends[coinInfo.shortcut]; + } else { + customBackends[coinInfo.shortcut] = coinInfo; + customBackends[coinInfo.shortcut].blockchainLink = blockchainLink; + } +}; + +export const initBlockchain = async (coinInfo: CoinInfo, postMessage: $ElementType) => { + let backend = find(coinInfo.name); if (!backend) { backend = new Blockchain({ - coinInfo, + coinInfo: customBackends[coinInfo.shortcut] || coinInfo, postMessage, }); try { diff --git a/src/js/core/methods/blockchain/BlockchainDisconnect.js b/src/js/core/methods/blockchain/BlockchainDisconnect.js index 877b60fa3..289996d84 100644 --- a/src/js/core/methods/blockchain/BlockchainDisconnect.js +++ b/src/js/core/methods/blockchain/BlockchainDisconnect.js @@ -29,11 +29,7 @@ export default class BlockchainDisconnect extends AbstractMethod { { name: 'coin', type: 'string', obligatory: true }, ]); - let coinInfo: ?CoinInfo = getCoinInfo(payload.coin); - if (!coinInfo) { - coinInfo = getCoinInfo(payload.coin); - } - + const coinInfo = getCoinInfo(payload.coin); if (!coinInfo) { throw NO_COIN_INFO; } @@ -46,14 +42,11 @@ export default class BlockchainDisconnect extends AbstractMethod { }; } - async run(): Promise<{ disconnected: true }> { + async run() { const backend = await findBlockchainBackend(this.params.coinInfo.name); if (backend) { backend.disconnect(); } - - return { - disconnected: true, - }; + return { disconnected: true }; } } diff --git a/src/js/core/methods/blockchain/BlockchainEstimateFee.js b/src/js/core/methods/blockchain/BlockchainEstimateFee.js index 63109d01f..d9037fc46 100644 --- a/src/js/core/methods/blockchain/BlockchainEstimateFee.js +++ b/src/js/core/methods/blockchain/BlockchainEstimateFee.js @@ -54,7 +54,7 @@ export default class BlockchainEstimateFee extends AbstractMethod { ]); } } - const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + const coinInfo = getCoinInfo(payload.coin); if (!coinInfo) { throw NO_COIN_INFO; diff --git a/src/js/core/methods/blockchain/BlockchainGetAccountBalanceHistory.js b/src/js/core/methods/blockchain/BlockchainGetAccountBalanceHistory.js index 737a119cd..a1125e99b 100644 --- a/src/js/core/methods/blockchain/BlockchainGetAccountBalanceHistory.js +++ b/src/js/core/methods/blockchain/BlockchainGetAccountBalanceHistory.js @@ -37,7 +37,7 @@ export default class BlockchainGetAccountBalanceHistory extends AbstractMethod { { name: 'groupBy', type: 'number', obligatory: false }, ]); - const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + const coinInfo = getCoinInfo(payload.coin); if (!coinInfo) { throw NO_COIN_INFO; } diff --git a/src/js/core/methods/blockchain/BlockchainGetCurrentFiatRates.js b/src/js/core/methods/blockchain/BlockchainGetCurrentFiatRates.js index 89630169d..95536e99e 100644 --- a/src/js/core/methods/blockchain/BlockchainGetCurrentFiatRates.js +++ b/src/js/core/methods/blockchain/BlockchainGetCurrentFiatRates.js @@ -29,7 +29,7 @@ export default class BlockchainGetCurrentFiatRates extends AbstractMethod { { name: 'coin', type: 'string', obligatory: true }, ]); - const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + const coinInfo = getCoinInfo(payload.coin); if (!coinInfo) { throw NO_COIN_INFO; } diff --git a/src/js/core/methods/blockchain/BlockchainGetFiatRatesForTimestamps.js b/src/js/core/methods/blockchain/BlockchainGetFiatRatesForTimestamps.js index 97f129aec..3dc19a25b 100644 --- a/src/js/core/methods/blockchain/BlockchainGetFiatRatesForTimestamps.js +++ b/src/js/core/methods/blockchain/BlockchainGetFiatRatesForTimestamps.js @@ -29,7 +29,7 @@ export default class BlockchainGetFiatRatesForTimestamps extends AbstractMethod { name: 'coin', type: 'string', obligatory: true }, ]); - const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + const coinInfo = getCoinInfo(payload.coin); if (!coinInfo) { throw NO_COIN_INFO; } diff --git a/src/js/core/methods/blockchain/BlockchainGetTransactions.js b/src/js/core/methods/blockchain/BlockchainGetTransactions.js index 7abc2f682..93e940f98 100644 --- a/src/js/core/methods/blockchain/BlockchainGetTransactions.js +++ b/src/js/core/methods/blockchain/BlockchainGetTransactions.js @@ -29,7 +29,7 @@ export default class BlockchainGetTransactions extends AbstractMethod { { name: 'coin', type: 'string', obligatory: true }, ]); - const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + const coinInfo = getCoinInfo(payload.coin); if (!coinInfo) { throw NO_COIN_INFO; } diff --git a/src/js/core/methods/blockchain/BlockchainSetCustomBackend.js b/src/js/core/methods/blockchain/BlockchainSetCustomBackend.js new file mode 100644 index 000000000..7bedaf463 --- /dev/null +++ b/src/js/core/methods/blockchain/BlockchainSetCustomBackend.js @@ -0,0 +1,56 @@ +/* @flow */ + +import AbstractMethod from '../AbstractMethod'; +import { validateParams } from '../helpers/paramsValidator'; +import { NO_COIN_INFO } from '../../../constants/errors'; + +import { find as findBackend, remove as removeBackend, setCustomBackend, initBlockchain } from '../../../backend/BlockchainLink'; +import { getCoinInfo } from '../../../data/CoinInfo'; +import type { CoreMessage, CoinInfo } from '../../../types'; + +type Params = { + coinInfo: CoinInfo; +} + +export default class BlockchainSetCustomBackend extends AbstractMethod { + params: Params; + + constructor(message: CoreMessage) { + super(message); + this.requiredPermissions = []; + this.info = ''; + this.useDevice = false; + this.useUi = false; + + const { payload } = message; + + // validate incoming parameters + validateParams(payload, [ + { name: 'coin', type: 'string', obligatory: true }, + { name: 'blockchainLink', type: 'object' }, + ]); + + const coinInfo = getCoinInfo(payload.coin); + if (!coinInfo) { + throw NO_COIN_INFO; + } + + setCustomBackend(coinInfo, payload.blockchainLink); + + this.params = { + coinInfo, + }; + } + + async run() { + const current = await findBackend(this.params.coinInfo.name); + if (current) { + await current.disconnect(); + removeBackend(current); + + await initBlockchain(this.params.coinInfo, this.postMessage); + } + + return true; + } +} diff --git a/src/js/core/methods/blockchain/BlockchainSubscribe.js b/src/js/core/methods/blockchain/BlockchainSubscribe.js index f97531c57..da4eb9a8a 100644 --- a/src/js/core/methods/blockchain/BlockchainSubscribe.js +++ b/src/js/core/methods/blockchain/BlockchainSubscribe.js @@ -35,7 +35,7 @@ export default class BlockchainSubscribe extends AbstractMethod { ]); }); - const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + const coinInfo = getCoinInfo(payload.coin); if (!coinInfo) { throw NO_COIN_INFO; } @@ -49,7 +49,7 @@ export default class BlockchainSubscribe extends AbstractMethod { }; } - async run(): Promise<{ subscribed: boolean }> { + async run() { const backend = await initBlockchain(this.params.coinInfo, this.postMessage); return backend.subscribe(this.params.accounts); } diff --git a/src/js/core/methods/blockchain/BlockchainSubscribeFiatRates.js b/src/js/core/methods/blockchain/BlockchainSubscribeFiatRates.js index 6e9a734b7..2ea04f1d9 100644 --- a/src/js/core/methods/blockchain/BlockchainSubscribeFiatRates.js +++ b/src/js/core/methods/blockchain/BlockchainSubscribeFiatRates.js @@ -29,7 +29,7 @@ export default class BlockchainSubscribeFiatRates extends AbstractMethod { { name: 'coin', type: 'string', obligatory: true }, ]); - const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + const coinInfo = getCoinInfo(payload.coin); if (!coinInfo) { throw NO_COIN_INFO; } @@ -43,7 +43,7 @@ export default class BlockchainSubscribeFiatRates extends AbstractMethod { }; } - async run(): Promise<{ subscribed: boolean }> { + async run() { const backend = await initBlockchain(this.params.coinInfo, this.postMessage); return backend.subscribeFiatRates(this.params.currency); } diff --git a/src/js/core/methods/blockchain/BlockchainUnsubscribe.js b/src/js/core/methods/blockchain/BlockchainUnsubscribe.js index 7c2918eb4..b0bc691f0 100644 --- a/src/js/core/methods/blockchain/BlockchainUnsubscribe.js +++ b/src/js/core/methods/blockchain/BlockchainUnsubscribe.js @@ -37,7 +37,7 @@ export default class BlockchainUnsubscribe extends AbstractMethod { }); } - const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + const coinInfo = getCoinInfo(payload.coin); if (!coinInfo) { throw NO_COIN_INFO; } @@ -51,7 +51,7 @@ export default class BlockchainUnsubscribe extends AbstractMethod { }; } - async run(): Promise { + async run() { const backend = await initBlockchain(this.params.coinInfo, this.postMessage); return backend.unsubscribe(this.params.accounts); } diff --git a/src/js/core/methods/blockchain/BlockchainUnsubscribeFiatRates.js b/src/js/core/methods/blockchain/BlockchainUnsubscribeFiatRates.js index 75264c4b6..2b33d6e97 100644 --- a/src/js/core/methods/blockchain/BlockchainUnsubscribeFiatRates.js +++ b/src/js/core/methods/blockchain/BlockchainUnsubscribeFiatRates.js @@ -27,7 +27,7 @@ export default class BlockchainUnsubscribeFiatRates extends AbstractMethod { { name: 'coin', type: 'string', obligatory: true }, ]); - const coinInfo: ?CoinInfo = getCoinInfo(payload.coin); + const coinInfo = getCoinInfo(payload.coin); if (!coinInfo) { throw NO_COIN_INFO; } @@ -40,7 +40,7 @@ export default class BlockchainUnsubscribeFiatRates extends AbstractMethod { }; } - async run(): Promise { + async run() { const backend = await initBlockchain(this.params.coinInfo, this.postMessage); return backend.unsubscribeFiatRates(); } diff --git a/src/js/core/methods/index.js b/src/js/core/methods/index.js index 4111493ad..4d1b29dd3 100644 --- a/src/js/core/methods/index.js +++ b/src/js/core/methods/index.js @@ -6,14 +6,15 @@ import AbstractMethod from './AbstractMethod'; import BlockchainDisconnect from './blockchain/BlockchainDisconnect'; import BlockchainEstimateFee from './blockchain/BlockchainEstimateFee'; -import BlockchainGetTransactions from './blockchain/BlockchainGetTransactions'; +import BlockchainGetAccountBalanceHistory from './blockchain/BlockchainGetAccountBalanceHistory'; import BlockchainGetCurrentFiatRates from './blockchain/BlockchainGetCurrentFiatRates'; import BlockchainGetFiatRatesForTimestamps from './blockchain/BlockchainGetFiatRatesForTimestamps'; -import BlockchainGetAccountBalanceHistory from './blockchain/BlockchainGetAccountBalanceHistory'; -import BlockchainSubscribeFiatRates from './blockchain/BlockchainSubscribeFiatRates'; -import BlockchainUnsubscribeFiatRates from './blockchain/BlockchainUnsubscribeFiatRates'; +import BlockchainGetTransactions from './blockchain/BlockchainGetTransactions'; +import BlockchainSetCustomBackend from './blockchain/BlockchainSetCustomBackend'; import BlockchainSubscribe from './blockchain/BlockchainSubscribe'; +import BlockchainSubscribeFiatRates from './blockchain/BlockchainSubscribeFiatRates'; import BlockchainUnsubscribe from './blockchain/BlockchainUnsubscribe'; +import BlockchainUnsubscribeFiatRates from './blockchain/BlockchainUnsubscribeFiatRates'; import CardanoGetAddress from './CardanoGetAddress'; import CardanoGetPublicKey from './CardanoGetPublicKey'; import CardanoSignTransaction from './CardanoSignTransaction'; @@ -74,6 +75,7 @@ const classes: { [k: string]: any } = { 'blockchainGetCurrentFiatRates': BlockchainGetCurrentFiatRates, 'blockchainGetFiatRatesForTimestamps': BlockchainGetFiatRatesForTimestamps, 'blockchainGetTransactions': BlockchainGetTransactions, + 'blockchainSetCustomBackend': BlockchainSetCustomBackend, 'blockchainSubscribe': BlockchainSubscribe, 'blockchainSubscribeFiatRates': BlockchainSubscribeFiatRates, 'blockchainUnsubscribe': BlockchainUnsubscribe, diff --git a/src/js/data/CoinInfo.js b/src/js/data/CoinInfo.js index 24810777b..cb8734d5f 100644 --- a/src/js/data/CoinInfo.js +++ b/src/js/data/CoinInfo.js @@ -165,7 +165,7 @@ const parseBitcoinNetworksJson = (json: JSON) => { const isBitcoin = shortcut === 'BTC' || shortcut === 'TEST'; const hasTimestamp = shortcut === 'CPC' || shortcut === 'PPC' || shortcut === 'tPPC'; - const network: $ElementType = { + const network = { messagePrefix: coin.signed_message_header, bech32: coin.bech32_prefix, bip32: { diff --git a/src/js/index.js b/src/js/index.js index 8b5db64e8..839825c4a 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -57,6 +57,10 @@ const TrezorConnect: API = { return call({ method: 'blockchainGetTransactions', ...params }); }, + blockchainSetCustomBackend: params => { + return call({ method: 'blockchainSetCustomBackend', ...params }); + }, + blockchainSubscribe: params => { return call({ method: 'blockchainSubscribe', ...params }); }, diff --git a/src/js/types/__tests__/blockchain.js b/src/js/types/__tests__/blockchain.js index b87a66f12..747581942 100644 --- a/src/js/types/__tests__/blockchain.js +++ b/src/js/types/__tests__/blockchain.js @@ -102,4 +102,17 @@ export const others = async () => { }); TrezorConnect.blockchainDisconnect({ coin: 'btc' }); + + TrezorConnect.blockchainSetCustomBackend({ + coin: 'btc', + blockchainLink: undefined, + }); + + TrezorConnect.blockchainSetCustomBackend({ + coin: 'btc', + blockchainLink: { + type: 'blockbook', + url: ['https://btc1.trezor.io/'], + }, + }); }; diff --git a/src/js/types/api.js b/src/js/types/api.js index 132eb1a99..f43822b82 100644 --- a/src/js/types/api.js +++ b/src/js/types/api.js @@ -94,6 +94,7 @@ export type API = { blockchainGetCurrentFiatRates: Method; blockchainGetFiatRatesForTimestamps: Method; blockchainGetTransactions: Method; + blockchainSetCustomBackend: Method; blockchainSubscribe: Method; blockchainSubscribeFiatRates: Method; blockchainUnsubscribe: Method; diff --git a/src/js/types/backend/blockchain.js b/src/js/types/backend/blockchain.js index 3c4716be8..e99eb3dc6 100644 --- a/src/js/types/backend/blockchain.js +++ b/src/js/types/backend/blockchain.js @@ -144,6 +144,11 @@ export type BlockchainEstimatedFee = { levels: FeeLevel[]; } +export type BlockchainSetCustomBackend = { + coin: string; + blockchainLink: $PropertyType; +} + export type BlockchainEvent = | { type: typeof BLOCKCHAIN.CONNECT; diff --git a/src/js/types/networks/coinInfo.js b/src/js/types/networks/coinInfo.js index 3304dab78..9900cd6e8 100644 --- a/src/js/types/networks/coinInfo.js +++ b/src/js/types/networks/coinInfo.js @@ -1,131 +1,77 @@ /* @flow */ +import type { Network } from '@trezor/utxo-lib'; type CoinSupport = { connect: boolean; - // electrum not used, trezor1: string; trezor2: string; - // webwallet not used -}; - -// copy-paste from 'bitcoinjs-lib-zcash' module -type Network = { - messagePrefix: string; - bech32: ?string; - bip32: { - public: number; - private: number; - }; - pubKeyHash: number; - scriptHash: number; - wif: number; - dustThreshold: number; - coin: string; }; type BlockchainLink = { type: string; - url: Array; + url: string[]; }; -type DefaultFees = {[level: 'High' | 'Normal' | 'Economy' | 'Low']: number}; +type BitcoinDefaultFees = {[level: 'High' | 'Normal' | 'Economy' | 'Low']: number}; -export type BitcoinNetworkInfo = { - type: 'bitcoin'; - // address_type: in Network - // address_type_p2sh: in Network - // bech32_prefix: in Network - // consensus_branch_id in Network - // bip115: not used - // bitcore: not used - // blockbook: not used - blockchainLink: ?BlockchainLink; - blocktime: number; - cashAddrPrefix: ?string; - label: string; // this is human readable format, could be different from "name" - name: string; // this is Trezor readable format +type Common = { + label: string; // Human readable format, label != name + name: string; // Trezor readable format shortcut: string; - // cooldown not used + slip44: number; + support: CoinSupport; + decimals: number; + blockchainLink?: BlockchainLink; + blocktime: number; + minFee: number; + maxFee: number; +}; + +export type BitcoinNetworkInfo = Common & { + type: 'bitcoin'; + cashAddrPrefix?: string; curveName: string; - // decred not used - defaultFees: DefaultFees; dustLimit: number; forceBip143: boolean; - forkid: ?number; - // github: not used + forkid?: number; hashGenesisBlock: string; - // key not used - // maintainer: not used maxAddressLength: number; maxFeeSatoshiKb: number; minAddressLength: number; minFeeSatoshiKb: number; - // name: same as coin_label + defaultFees: BitcoinDefaultFees; segwit: boolean; - // signed_message_header: in Network - slip44: number; - support: CoinSupport; - // uri_prefix not used - // version_group_id: not used - // website: not used - // xprv_magic: in Network + xPubMagic: number; - xPubMagicSegwitNative: ?number; - xPubMagicSegwit: ?number; + xPubMagicSegwitNative?: number; + xPubMagicSegwit?: number; // custom network: Network; isBitcoin: boolean; hasTimestamp: boolean; - minFee: number; - maxFee: number; // used in backend blocks?: number; - decimals: number; }; -export type EthereumNetworkInfo = { +export type EthereumNetworkInfo = Common & { type: 'ethereum'; - blockchainLink: ?BlockchainLink; - blocktime: number; chain: string; chainId: number; - // key not used + rskip60: boolean; defaultFees: { label: 'high' | 'normal' | 'low'; feePerUnit: string; feeLimit: string; }[]; - minFee: number; - maxFee: number; - label: string; // compatibility - name: string; - shortcut: string; - rskip60: boolean; - slip44: number; - support: CoinSupport; - // url not used - network: typeof undefined; // compatibility - decimals: number; + network: typeof undefined; }; -export type MiscNetworkInfo = { +export type MiscNetworkInfo = Common & { type: 'misc' | 'nem'; - blockchainLink: ?BlockchainLink; - blocktime: number; curve: string; - // key not used - defaultFees: DefaultFees; - minFee: number; - maxFee: number; - // links not used - label: string; // compatibility - name: string; - shortcut: string; - slip44: number; - support: CoinSupport; - network: typeof undefined; // compatibility - decimals: number; + defaultFees: BitcoinDefaultFees; + network: typeof undefined; }; export type CoinInfo = BitcoinNetworkInfo | EthereumNetworkInfo | MiscNetworkInfo; diff --git a/src/ts/types/__tests__/blockchain.ts b/src/ts/types/__tests__/blockchain.ts index 31216391f..de08d693a 100644 --- a/src/ts/types/__tests__/blockchain.ts +++ b/src/ts/types/__tests__/blockchain.ts @@ -101,4 +101,17 @@ export const others = async () => { }); TrezorConnect.blockchainDisconnect({ coin: 'btc' }); + + TrezorConnect.blockchainSetCustomBackend({ + coin: 'btc', + blockchainLink: undefined, + }); + + TrezorConnect.blockchainSetCustomBackend({ + coin: 'btc', + blockchainLink: { + type: 'blockbook', + url: ['https://btc1.trezor.io/'], + }, + }); }; diff --git a/src/ts/types/api.d.ts b/src/ts/types/api.d.ts index c30b9b304..da5314245 100644 --- a/src/ts/types/api.d.ts +++ b/src/ts/types/api.d.ts @@ -85,6 +85,9 @@ export namespace TrezorConnect { function blockchainGetTransactions( params: P.CommonParams & Blockchain.BlockchainGetTransactions, ): P.Response; + function blockchainSetCustomBackend( + params: P.CommonParams & Blockchain.BlockchainSetCustomBackend, + ): P.Response; function blockchainSubscribe( params: P.CommonParams & Blockchain.BlockchainSubscribe, ): P.Response; diff --git a/src/ts/types/backend/blockchain.d.ts b/src/ts/types/backend/blockchain.d.ts index 98bac6998..d797ae70f 100644 --- a/src/ts/types/backend/blockchain.d.ts +++ b/src/ts/types/backend/blockchain.d.ts @@ -146,6 +146,11 @@ export interface BlockchainAccountBalanceHistory { fiatRate: number; } +export interface BlockchainSetCustomBackend { + coin: string; + blockchainLink: CoinInfo['blockchainLink']; +} + export type BlockchainEvent = | { type: typeof BLOCKCHAIN.CONNECT; diff --git a/src/ts/types/networks/coinInfo.d.ts b/src/ts/types/networks/coinInfo.d.ts index c6e4cffb8..d99b22821 100644 --- a/src/ts/types/networks/coinInfo.d.ts +++ b/src/ts/types/networks/coinInfo.d.ts @@ -1,9 +1,7 @@ export interface CoinSupport { connect: boolean; - // electrum not used, trezor1: string; trezor2: string; - // webwallet not used } // copy-paste from 'bitcoinjs-lib-zcash' module @@ -29,45 +27,34 @@ export interface BlockchainLink { export type BitcoinDefaultFeesKeys = 'High' | 'Normal' | 'Economy' | 'Low'; export type BitcoinDefaultFees = { [key in BitcoinDefaultFeesKeys]: number }; -export interface BitcoinNetworkInfo { - type: 'bitcoin'; - // address_type: in Network - // address_type_p2sh: in Network - // bech32_prefix: in Network - // consensus_branch_id in Network - // bip115: not used - // bitcore: not used - // blockbook: not used +type Common = { + label: string; // Human readable format, label != name + name: string; // Trezor readable format + shortcut: string; + slip44: number; + support: CoinSupport; + decimals: number; blockchainLink?: BlockchainLink; blocktime: number; + minFee: number; + maxFee: number; +}; + +export interface BitcoinNetworkInfo extends Common { + type: 'bitcoin'; cashAddrPrefix?: string; - label: string; // this is human readable format, could be different from "name" - name: string; // this is Trezor readable format - shortcut: string; - // cooldown not used curveName: string; - // decred not used - defaultFees: BitcoinDefaultFees; dustLimit: number; forceBip143: boolean; forkid?: number; - // github: not used hashGenesisBlock: string; - // key not used - // maintainer: not used maxAddressLength: number; maxFeeSatoshiKb: number; minAddressLength: number; minFeeSatoshiKb: number; - // name: same as coin_label + defaultFees: BitcoinDefaultFees; segwit: boolean; - // signed_message_header: in Network - slip44: number; - support: CoinSupport; - // uri_prefix not used - // version_group_id: not used - // website: not used - // xprv_magic: in Network + xPubMagic: number; xPubMagicSegwitNative?: number; xPubMagicSegwit?: number; @@ -76,55 +63,28 @@ export interface BitcoinNetworkInfo { network: Network; isBitcoin: boolean; hasTimestamp: boolean; - minFee: number; - maxFee: number; // used in backend blocks?: number; - decimals: number; } -export interface EthereumNetworkInfo { +export interface EthereumNetworkInfo extends Common { type: 'ethereum'; - blockchainLink?: BlockchainLink; - blocktime: number; chain: string; chainId: number; - // key not used + rskip60: boolean; defaultFees: Array<{ label: 'high' | 'normal' | 'low'; feePerUnit: string; feeLimit: string; }>; - minFee: number; - maxFee: number; - label: string; // compatibility - name: string; - shortcut: string; - rskip60: boolean; - slip44: number; - support: CoinSupport; - // url not used - network: typeof undefined; // compatibility - decimals: number; + network: typeof undefined; } -export interface MiscNetworkInfo { +export interface MiscNetworkInfo extends Common { type: 'misc' | 'nem'; - blockchainLink?: BlockchainLink; - blocktime: number; curve: string; - // key not used defaultFees: BitcoinDefaultFees; - minFee: number; - maxFee: number; - // links not used - label: string; // compatibility - name: string; - shortcut: string; - slip44: number; - support: CoinSupport; network: typeof undefined; // compatibility - decimals: number; } export type CoinInfo = BitcoinNetworkInfo | EthereumNetworkInfo | MiscNetworkInfo; From 511f345a1d604f42f1e63d3fe59656373b2ca1db Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 18 Mar 2020 12:58:51 +0100 Subject: [PATCH 29/51] Update CHANGELOG.md --- CHANGELOG.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88c40d7b3..93db8b89a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,11 +3,19 @@ - Support for FW 1.9.0 and 2.3.0 (passphrase redesign) - Typescript types - `hex` parameter to `signMessage` and `verifyMessage` methods -- added blockchain-link methods for fiat rates (`blockchainGetAccountBalanceHistory`, `blockchainGetCurrentFiatRates`, `blockchainGetFiatRatesForTimestamps`, `blockchainSubscribeFiatRates`, `blockchainUnsubscribeFiatRates`) +- Blockchain methods for fiat rates: + - `TrezorConnect.blockchainGetAccountBalanceHistory` + - `TrezorConnect.blockchainGetCurrentFiatRates` + - `TrezorConnect.blockchainGetFiatRatesForTimestamps` + - `TrezorConnect.blockchainSubscribeFiatRates` + - `TrezorConnect.blockchainUnsubscribeFiatRates` +- `TrezorConnect.blockchainSetCustomBackend` method +- `TrezorConnect.cancel` is now trying to send (post) 'Cancel' message to acquired device (not working with TrezorBridge < 2.0.29) #### Fixed - General cleanup in flowtype declarations - disableWebUsb method - trezor-link protobuf messages overrides +- Fixed race condition in nodejs https://github.com/trezor/connect/issues/504 # 8.0.13 #### Fixed From bbf9ec50bf7e18d1a9023aa419e71e09d8f34f21 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 18 Mar 2020 13:11:02 +0100 Subject: [PATCH 30/51] update dependencies --- package.json | 6 +++--- yarn.lock | 42 +++++++++++++++++++++--------------------- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/package.json b/package.json index 81d26db78..b2d795362 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "babel-eslint": "^10.1.0", "babel-jest": "25.1.0", "babel-loader": "^8.0.0", - "bchaddrjs": "0.4.5", + "bchaddrjs": "0.4.7", "bignumber.js": "^9.0.0", "bowser": "2.9.0", "copy-webpack-plugin": "5.1.1", @@ -104,7 +104,7 @@ "tiny-worker": "^2.3.0", "trezor-link": "1.6.7", "uglify-es": "3.3.9", - "version-bump-prompt": "6.0.2", + "version-bump-prompt": "6.0.3", "webpack": "^4.42.0", "webpack-cli": "3.3.11", "webpack-dev-server": "3.10.3", @@ -118,7 +118,7 @@ "extendedDependencies": { "@trezor/blockchain-link": "^1.0.9", "@trezor/utxo-lib": "^0.1.0", - "bchaddrjs": "0.4.5", + "bchaddrjs": "0.4.7", "bignumber.js": "^9.0.0", "bowser": "^2.9.0", "hd-wallet": "9.0.0", diff --git a/yarn.lock b/yarn.lock index 6132baf58..a819511ce 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1328,10 +1328,10 @@ string-argv "^0.3.1" type-detect "^4.0.8" -"@jsdevtools/version-bump-prompt@6.0.2": - version "6.0.2" - resolved "https://registry.yarnpkg.com/@jsdevtools/version-bump-prompt/-/version-bump-prompt-6.0.2.tgz#8ba3bdbac5d657a0294975406798fe363454f3ec" - integrity sha512-nBXrckBHktLT55dZvlH38hb6v6VgNyi45+7ISQxwilQiuMU0IApTOKT0S9Oy33Asn1TEGMBa4YllNHPilMJJhw== +"@jsdevtools/version-bump-prompt@6.0.3": + version "6.0.3" + resolved "https://registry.yarnpkg.com/@jsdevtools/version-bump-prompt/-/version-bump-prompt-6.0.3.tgz#7b3f8018ac787f8c2a10558e266344717b84e2ae" + integrity sha512-75zDqsnFK/KHpl/2rGyo3cJG0OJmVOHeafgbGeINlEV+maiUZ3bwkMIi877TBUa6JJgWjQYT8phdO7MYnwaaag== dependencies: "@jsdevtools/ez-spawn" "^3.0.0" command-line-args "^5.1.1" @@ -2361,13 +2361,13 @@ batch@0.6.1: resolved "https://registry.yarnpkg.com/batch/-/batch-0.6.1.tgz#dc34314f4e679318093fc760272525f94bf25c16" integrity sha1-3DQxT05nkxgJP8dgJyUl+UvyXBY= -bchaddrjs@0.4.5: - version "0.4.5" - resolved "https://registry.yarnpkg.com/bchaddrjs/-/bchaddrjs-0.4.5.tgz#4b8ca28d7b5f2e1d0e5056b40021be0405f701fd" - integrity sha512-ZmGjcI7KyleD39YkNqm02YhSEwRH1IPxcQ1eKgQHOQtnaJB1JN5ZymtNrzxFPKE2Cgza2yXBETgq99+0fknq/A== +bchaddrjs@0.4.7: + version "0.4.7" + resolved "https://registry.yarnpkg.com/bchaddrjs/-/bchaddrjs-0.4.7.tgz#9d33e25816091e43a0cb4ce474d6210d6f006a37" + integrity sha512-+KAWllIzFDZUhaQqkzKEr2Nroh2v+63mdAtib2y7G+J0zoynFhFAV4tFr/HPEwWZPEAtK46LjenvN/o8P+JIiw== dependencies: bs58check "^2.1.2" - cashaddrjs "^0.3.9" + cashaddrjs "^0.3.10" bchaddrjs@^0.3.2: version "0.3.2" @@ -2883,6 +2883,13 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= +cashaddrjs@^0.3.10: + version "0.3.10" + resolved "https://registry.yarnpkg.com/cashaddrjs/-/cashaddrjs-0.3.10.tgz#8eb281573184e343cc9186c28fb95e65d5695ebc" + integrity sha512-x+r0TxRzLR7Z9wy9JBHCCe1d6Yong5BH//vjWB/uldNT/IEb8cMGo8HNY5/QZmCr3KYcsLIToM8u6whXfKFbRw== + dependencies: + big-integer "1.6.36" + cashaddrjs@^0.3.3: version "0.3.6" resolved "https://registry.yarnpkg.com/cashaddrjs/-/cashaddrjs-0.3.6.tgz#de0b84b98e224de18e6d5ba14a97584e6aa7f823" @@ -2890,13 +2897,6 @@ cashaddrjs@^0.3.3: dependencies: big-integer "1.6.36" -cashaddrjs@^0.3.9: - version "0.3.9" - resolved "https://registry.yarnpkg.com/cashaddrjs/-/cashaddrjs-0.3.9.tgz#e98078cf61061e0c5c865a95924d06a6b9ced020" - integrity sha512-2FyYuNnIICPsEZvuC0NWNQgw+OFCpGdUyVl9Jmj3sunyH8cHfkaZq7EADKngEO/pI2OOwDvVMQN8k62xev7+aw== - dependencies: - big-integer "1.6.36" - chalk@2.4.2, chalk@^2.0.0, chalk@^2.1.0, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" @@ -9921,12 +9921,12 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -version-bump-prompt@6.0.2: - version "6.0.2" - resolved "https://registry.yarnpkg.com/version-bump-prompt/-/version-bump-prompt-6.0.2.tgz#27543fffc23ef132aa00193b2808d948e934adb0" - integrity sha512-MzPReH0tzqOU+J+vQr9LMb15ORHVgRAwvKKyUuOGD6ePgdwpPAOhpxEH14yx3UYay6Q1u0TNiLBhTqP0RvvyPw== +version-bump-prompt@6.0.3: + version "6.0.3" + resolved "https://registry.yarnpkg.com/version-bump-prompt/-/version-bump-prompt-6.0.3.tgz#b053466991f7868689ceeb84d9a013176d67c237" + integrity sha512-MNpE4IHGK8t2e06KRAM7VXDC0iwuwzSRyAL2aJJXGarnZguIHKj5ufTKMg7EaFaCSOG2lXZv1/+lC+Vl3EAseQ== dependencies: - "@jsdevtools/version-bump-prompt" "6.0.2" + "@jsdevtools/version-bump-prompt" "6.0.3" vm-browserify@^1.0.1: version "1.1.0" From 98e8825112919b1bfbed74a27077d7dd4358d8d9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Mar 2020 13:11:45 +0100 Subject: [PATCH 31/51] Bump acorn from 6.3.0 to 6.4.1 (#534) Bumps [acorn](https://github.com/acornjs/acorn) from 6.3.0 to 6.4.1. - [Release notes](https://github.com/acornjs/acorn/releases) - [Commits](https://github.com/acornjs/acorn/compare/6.3.0...6.4.1) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index a819511ce..6adbc5532 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1740,9 +1740,9 @@ acorn-walk@^6.0.1: integrity sha512-7evsyfH1cLOCdAzZAd43Cic04yKydNx0cF+7tiA19p1XnLLPU4dpCQOqpjqwokFe//vS0QqfqqjCS2JkiIs0cA== acorn@^6.0.1, acorn@^6.2.1: - version "6.3.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.3.0.tgz#0087509119ffa4fc0a0041d1e93a417e68cb856e" - integrity sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA== + version "6.4.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474" + integrity sha512-ZVA9k326Nwrj3Cj9jlh3wGFutC2ZornPNARZwsNYqQYgN0EsV2d53w5RN/co65Ohn4sUAUtb1rSUAOD6XN9idA== acorn@^7.1.0: version "7.1.0" From d31fdc2940aee1f5922f0805a87aba8dfa018ceb Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 18 Mar 2020 14:10:24 +0100 Subject: [PATCH 32/51] update/trezor-link@1.7.0 (#539) * bump trezor-link@1.7.0 * implement trezor-link@1.7.0 changes --- package.json | 6 ++-- src/js/device/DeviceList.js | 7 ++-- yarn.lock | 67 ++++++++++++++++++++++++++++--------- 3 files changed, 58 insertions(+), 22 deletions(-) diff --git a/package.json b/package.json index b2d795362..2fb053142 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "eslint-plugin-jest": "23.8.2", "eslint-plugin-promise": "^4.1.1", "eslint-plugin-standard": "^4.0.1", - "file-loader": "5.1.0", + "file-loader": "^6.0.0", "flow-bin": "0.120.1", "fs-extra": "^8.1.0", "hd-wallet": "9.0.0", @@ -102,7 +102,7 @@ "style-loader": "1.1.3", "terser-webpack-plugin": "2.3.5", "tiny-worker": "^2.3.0", - "trezor-link": "1.6.7", + "trezor-link": "1.7.0", "uglify-es": "3.3.9", "version-bump-prompt": "6.0.3", "webpack": "^4.42.0", @@ -126,6 +126,6 @@ "node-fetch": "^2.6.0", "parse-uri": "^1.0.0", "tiny-worker": "^2.3.0", - "trezor-link": "1.6.7" + "trezor-link": "1.7.0" } } diff --git a/src/js/device/DeviceList.js b/src/js/device/DeviceList.js index d8f4c25a3..10aa3a097 100644 --- a/src/js/device/DeviceList.js +++ b/src/js/device/DeviceList.js @@ -53,12 +53,13 @@ export default class DeviceList extends EventEmitter { if (env === 'react-native' && typeof ReactNativeUsbPlugin !== 'undefined') { transports.push(ReactNativeUsbPlugin()); } else { - // $FlowIssue: `version` is missing in `JSON` - const bridgeVersion: string = getBridgeInfo().version.join('.'); + const bridgeLatestVersion = getBridgeInfo().version.join('.'); + const bridge = new BridgeV2(null, null); + bridge.setBridgeLatestVersion(bridgeLatestVersion); if (env === 'node' || env === 'electron') { BridgeV2.setFetch(fetch, true); } - transports.push(new BridgeV2(null, null, bridgeVersion)); + transports.push(bridge); } if (webusb && typeof WebUsbPlugin !== 'undefined') { diff --git a/yarn.lock b/yarn.lock index 6adbc5532..92bd4a4e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1787,6 +1787,16 @@ ajv@^6.1.0, ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^6.12.0: + version "6.12.0" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.0.tgz#06d60b96d87b8454a5adaba86e7854da629db4b7" + integrity sha512-D6gFiFA0RRLyUbvijN74DWAjXSFxWKaWP7mldxkVhyhAV3+SWA9HEJPHQ2c9soIeTFJqcSdFDGFgdqs1iUU2Hw== + dependencies: + fast-deep-equal "^3.1.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + amdefine@>=0.0.4: version "1.0.1" resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" @@ -4437,6 +4447,11 @@ fast-deep-equal@^2.0.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" integrity sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk= +fast-deep-equal@^3.1.1: + version "3.1.1" + resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz#545145077c501491e33b15ec408c294376e94ae4" + integrity sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA== + fast-glob@^3.1.1: version "3.1.1" resolved "https://registry.yarnpkg.com/fast-glob/-/fast-glob-3.1.1.tgz#87ee30e9e9f3eb40d6f254a7997655da753d7c82" @@ -4505,13 +4520,13 @@ file-entry-cache@^5.0.1: dependencies: flat-cache "^2.0.1" -file-loader@5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-5.1.0.tgz#cb56c070efc0e40666424309bd0d9e45ac6f2bb8" - integrity sha512-u/VkLGskw3Ue59nyOwUwXI/6nuBCo7KBkniB/l7ICwr/7cPNGsL1WCXUp3GB0qgOOKU1TiP49bv4DZF/LJqprg== +file-loader@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-6.0.0.tgz#97bbfaab7a2460c07bcbd72d3a6922407f67649f" + integrity sha512-/aMOAYEFXDdjG0wytpTL5YQLfZnnTmLNjn+AIrJ/6HVnTfDqLsVKUUwkDf4I4kgex36BvjuXEn/TX9B/1ESyqQ== dependencies: - loader-utils "^1.4.0" - schema-utils "^2.5.0" + loader-utils "^2.0.0" + schema-utils "^2.6.5" file-uri-to-path@1.0.0: version "1.0.0" @@ -6269,6 +6284,13 @@ json5@^2.1.0: dependencies: minimist "^1.2.0" +json5@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.1.2.tgz#43ef1f0af9835dd624751a6b7fa48874fb2d608e" + integrity sha512-MoUOQ4WdiN3yxhm7NEVJSJrieAo5hNSLQ5sj05OTRHPL9HOBy8u4Bu88jsC1jvqAdN+E1bJmsUcZH+1HQxliqQ== + dependencies: + minimist "^1.2.5" + jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -6517,14 +6539,14 @@ loader-utils@^0.2.16: json5 "^0.5.0" object-assign "^4.0.1" -loader-utils@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.0.tgz#c579b5e34cb34b1a74edc6c1fb36bfa371d5a613" - integrity sha512-qH0WSMBtn/oHuwjy/NucEgbx5dbxxnxup9s4PVXJUDHZBQY+s0NWA9rJf53RBnQZxfch7euUui7hpoAPvALZdA== +loader-utils@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/loader-utils/-/loader-utils-2.0.0.tgz#e4cace5b816d425a166b5f097e10cd12b36064b0" + integrity sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ== dependencies: big.js "^5.2.2" emojis-list "^3.0.0" - json5 "^1.0.1" + json5 "^2.1.2" locate-path@^3.0.0: version "3.0.0" @@ -6834,6 +6856,11 @@ minimist@^1.1.1, minimist@^1.2.0: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= +minimist@^1.2.5: + version "1.2.5" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.5.tgz#67d66014b66a6a8aaa0c083c5fd58df4e4e97602" + integrity sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw== + minimist@~0.0.1: version "0.0.10" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" @@ -8610,7 +8637,7 @@ schema-utils@^1.0.0: ajv-errors "^1.0.0" ajv-keywords "^3.1.0" -schema-utils@^2.5.0, schema-utils@^2.6.0, schema-utils@^2.6.4: +schema-utils@^2.6.0, schema-utils@^2.6.4: version "2.6.4" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.4.tgz#a27efbf6e4e78689d91872ee3ccfa57d7bdd0f53" integrity sha512-VNjcaUxVnEeun6B2fiiUDjXXBtD4ZSH7pdbfIu1pOFwgptDPLMo/z9jr4sUfsjFVPqDCEin/F7IYlq7/E6yDbQ== @@ -8618,6 +8645,14 @@ schema-utils@^2.5.0, schema-utils@^2.6.0, schema-utils@^2.6.4: ajv "^6.10.2" ajv-keywords "^3.4.1" +schema-utils@^2.6.5: + version "2.6.5" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.6.5.tgz#c758f0a7e624263073d396e29cd40aa101152d8a" + integrity sha512-5KXuwKziQrTVHh8j/Uxz+QUbxkaLW9X/86NBlx/gnKgtsZA2GIVMUn17qWhRFwF8jdYb3Dig5hRO/W5mZqy6SQ== + dependencies: + ajv "^6.12.0" + ajv-keywords "^3.4.1" + secp256k1@^3.5.2: version "3.7.1" resolved "https://registry.yarnpkg.com/secp256k1/-/secp256k1-3.7.1.tgz#12e473e0e9a7c2f2d4d4818e722ad0e14cc1e2f1" @@ -9583,10 +9618,10 @@ tr46@^1.0.1: dependencies: punycode "^2.1.0" -trezor-link@1.6.7: - version "1.6.7" - resolved "https://registry.yarnpkg.com/trezor-link/-/trezor-link-1.6.7.tgz#674a80d1efbc44db2908b77fbfb3c56e0d5ecdb4" - integrity sha512-Eqi8OFd4eI+c1KTsGTONt4K4P2Lba6ijXx8S1cHuvPGV5UYj65+PiG/e9Ze4OVuHPvWKk4ilYOCcUPEmDZYYDA== +trezor-link@1.7.0: + version "1.7.0" + resolved "https://registry.yarnpkg.com/trezor-link/-/trezor-link-1.7.0.tgz#6119de00f4fc57fff0cd4d4d214353c761fad896" + integrity sha512-JJ4vVp5md8SVn3kLRkjMbxCUbqPTf78MH5fVXPa0yvUhsPKElCP0PjeEmCwJZ4f0tmnorkUE/9+ZlZDoUjLBKQ== dependencies: bigi "^1.4.1" ecurve "^1.0.3" From 8a6e0d55ef36893ab6c260f97cdf98b779636c98 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 18 Mar 2020 14:31:48 +0100 Subject: [PATCH 33/51] Update coins.json --- src/data/coins.json | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/data/coins.json b/src/data/coins.json index 2bbff904b..b7cd7738a 100644 --- a/src/data/coins.json +++ b/src/data/coins.json @@ -180,6 +180,50 @@ "xpub_magic_segwit_native": null, "xpub_magic_segwit_p2sh": null }, + { + "address_type": 81, + "address_type_p2sh": 5, + "bech32_prefix": "bz", + "bip115": false, + "blockbook": [ + "https://zny.blockbook.ovh" + ], + "blocktime_seconds": 90, + "cashaddr_prefix": null, + "coin_label": "BitZeny", + "coin_name": "BitZeny", + "coin_shortcut": "ZNY", + "consensus_branch_id": null, + "curve_name": "secp256k1", + "decimals": 8, + "decred": false, + "default_fee_b": { + "Normal": 20 + }, + "dust_limit": 546, + "force_bip143": false, + "fork_id": null, + "hash_genesis_block": "000009f7e55e9e3b4781e22bd87a7cfa4acada9e4340d43ca738bf4e9fb8f5ce", + "max_address_length": 34, + "maxfee_kb": 1000000, + "min_address_length": 27, + "minfee_kb": 1000, + "name": "BitZeny", + "segwit": true, + "shortcut": "ZNY", + "signed_message_header": "BitZeny Signed Message:\n", + "slip44": 123, + "support": { + "connect": true, + "trezor1": "1.8.2", + "trezor2": "2.1.1", + "webwallet": false + }, + "xprv_magic": 76066276, + "xpub_magic": 76067358, + "xpub_magic_segwit_native": 78792518, + "xpub_magic_segwit_p2sh": 77429938 + }, { "address_type": 0, "address_type_p2sh": 5, From d43c0cd054abc7a4a74860d90eb2531b50b3f8b5 Mon Sep 17 00:00:00 2001 From: Buck Perley Date: Thu, 19 Mar 2020 07:25:39 -0500 Subject: [PATCH 34/51] p2wsh program patch (#541) --- src/js/core/methods/helpers/signtxVerify.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/js/core/methods/helpers/signtxVerify.js b/src/js/core/methods/helpers/signtxVerify.js index d5c36c3f3..9249c0f06 100644 --- a/src/js/core/methods/helpers/signtxVerify.js +++ b/src/js/core/methods/helpers/signtxVerify.js @@ -53,13 +53,19 @@ const deriveWitnessOutput = (pkh: Buffer): Buffer => { return scriptPubKey; }; -const deriveBech32Output = (pkh: Buffer): Buffer => { +const deriveBech32Output = (program: Buffer): Buffer => { // see https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#Segwit_address_format // address derivation + test vectors - const scriptSig = Buffer.alloc(pkh.length + 2); + // ideally we would also have program version with this, but + // currently it's fixed to version 0. + if (program.length !== 32 && program.length !== 20) { + throw new Error('deriveBech32Output: Unknown size for witness program v0.'); + } + + const scriptSig = Buffer.alloc(program.length + 2); scriptSig[0] = 0; - scriptSig[1] = 0x14; - pkh.copy(scriptSig, 2); + scriptSig[1] = program.length; + program.copy(scriptSig, 2); return scriptSig; }; From df224ea4f97863d91ecd37486f60d923aeb1090a Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Thu, 19 Mar 2020 13:29:31 +0100 Subject: [PATCH 35/51] add unit tests to signTxVerify --- .../helpers/__tests__/signtxVerify.test.js | 179 ++++++++++++++++++ src/js/core/methods/helpers/signtxVerify.js | 7 +- 2 files changed, 180 insertions(+), 6 deletions(-) create mode 100644 src/js/core/methods/helpers/__tests__/signtxVerify.test.js diff --git a/src/js/core/methods/helpers/__tests__/signtxVerify.test.js b/src/js/core/methods/helpers/__tests__/signtxVerify.test.js new file mode 100644 index 000000000..18c0fa4bb --- /dev/null +++ b/src/js/core/methods/helpers/__tests__/signtxVerify.test.js @@ -0,0 +1,179 @@ +import { networks } from '@trezor/utxo-lib'; +import verifyTx from '../signtxVerify'; + +// public keys and signatures generated from "all-all" seed + +const getHDNode = () => ({ + xpub: '', +}); + +const coinInfo = { + network: networks.bitcoin, +}; + +const PATH = [2147483692, 2147483648, 2147483648, 0, 5]; +const inputs = [{ + address_n: PATH, + prev_hash: '50f6f1209ca92d7359564be803cb2c932cde7d370f7cee50fd1fad6790f6206d', + prev_index: 1, +}]; + +const fixtures = [ + { + description: 'external P2PKH output', + inputs, + outputs: [{ + address: '1MJ2tj2ThBE62zXbBYA5ZaN3fdve5CPAz1', + amount: '10000', + script_type: 'PAYTOADDRESS', + }], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006b483045022100a200ea1278c3d32251a63c56f5f0861f48167c61d84de8d951eac1204856ccd402201fc03f446557bcbcef1e473616bb7bddc96561b656b7ddd6b419501543ed5044012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff0110270000000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac00000000', + }, + { + description: 'internal P2PKH output', + inputs, + outputs: [{ + address_n: PATH, + amount: '10000', + script_type: 'PAYTOADDRESS', + }], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006a47304402203d784f8134a0afe40dfc5ff479a99352110855b845fb4a7524915272cd249f47022079f90d8713035c99a46975d3bca9a8bc2464b02437f09b2cf3d34df91bb53ad2012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff0110270000000000001976a914a6450f1945831a81912616691e721b787383f4ed88ac00000000', + getHDNode: () => ({ + xpub: 'xpub6Ex8WCdj1KH5mK9r99QKENUmhpjEPgYm1dJmKY2nxx16tSAiQCVYjHfymFdzfpYDAHGtWYTif7WkUKLMULRJFPeV1hvEbeXqrM11K85yPjp', + }), + }, + { + description: 'internal P2PKH output (custom path)', + inputs, + outputs: [{ + address_n: [0], + amount: '10000', + script_type: 'PAYTOADDRESS', + }], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006a473044022046c0e8694878140567d55665f85fb09c28e07605873c4ebd6b1ed46aac67f0e7022032405c728d8d2726d9b297804882e684c0d5f9ca5df291c4ebca6857056a0eaa012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff0110270000000000001976a9144e145e3b27f90d854fba11106654c11451eb960088ac00000000', + getHDNode: () => ({ + xpub: 'xpub68Zyu13hPwsx8egknnRtfGmk6n9f6S5zbousZUJmQDZsB3GCppTz73oD2WS8DcCa4hqvNePCt8dFt5TKSSBgvCdgg48iWZQ7qgKnFaQnj21', + }), + }, + { + description: 'external P2SH output', + inputs, + outputs: [{ + address: '3L6TyTisPBmrDAj6RoKmDzNnj4eQi54gD2', + amount: '10000', + script_type: 'PAYTOADDRESS', + }], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006a47304402203239b33a93c205e1a463304c10383fcfea109012aa7c8b71238c22d2f02dfb98022074f687be14198ca844ab35823dfb70cabbb208338ea7154516a1c657e8b5a3de012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff01102700000000000017a914c9e193b1af9e4349d2ee53b4190e2bd36e59719e8700000000', + }, + { + description: 'internal P2SH output', + inputs, + outputs: [{ + address_n: [2147483697, 2147483648, 2147483648, 0, 5], + amount: '10000', + script_type: 'PAYTOP2SHWITNESS', + }], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006a4730440220240b8780aa29f5afa7d9d040ef8c406a9f44f981bf819b01d9e6d68e5a02c59b022020f40e21ef9c3cf6e5f7d4a776593e8bf3971166e1a0324dfdcfcec8c3bce8c0012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff01102700000000000017a9140c598ef0edacdc76bd460441b41d069c62eead278700000000', + getHDNode: () => ({ + xpub: 'xpub6EnV9K1LzPtRDXqqcDkBk99uCFneHiHR3DBQxXcbuWzQoUGLfJiHeF3uDW1JZH3ZG7mr4TuNtPbgLYwEibEkcDcnQkQksZi7jm3eY8PqKFv', + }), + }, + { + description: 'external P2WPKH output', + inputs, + outputs: [{ + address: 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4', + amount: '10000', + script_type: 'PAYTOADDRESS', + }], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006b483045022100cdf268cb89433f2cdc990ca3f45bf356befe51bbbbd6b57f1ca08ac69298acad022032beef4e1380bd3819c0cbf1b1a70b434a115199d1cbe5c59de8d94f98086452012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff011027000000000000160014751e76e8199196d454941c45d1b3a323f1433bd600000000', + }, + { + description: 'external P2WSH output', + inputs, + outputs: [{ + address: 'bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3', + amount: '10000', + script_type: 'PAYTOADDRESS', + }], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006a4730440220714c3704cb9aee785a5e03eb77eacf5bd95d29a4fe9cf33e4a868aa4100d2b6902207c5bdef296404d3fedeaaa71579140768b72c0bea882c7a2f16c029963d7c622012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff0110270000000000002200201863143c14c5166804bd19203356da136c985678cd4d27a1b8c632960490326200000000', + }, + { + description: 'opreturn output', + inputs, + outputs: [{ + op_return_data: 'deadbeef', + amount: '0', + script_type: 'PAYTOOPRETURN', + }], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006b483045022100ab05878122fa124067dafccd47b6c55567ed7564ae50676dff89dd9fd920a544022025cdf05643234329fec08fc81abec07e2b9f4e14adfa2e2e507e4debc5d36073012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff010000000000000000066a04deadbeef00000000', + }, + { + description: 'opreturn output without amount', + inputs, + outputs: [{ + op_return_data: 'deadbeef', + script_type: 'PAYTOOPRETURN', + }], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006b483045022100ab05878122fa124067dafccd47b6c55567ed7564ae50676dff89dd9fd920a544022025cdf05643234329fec08fc81abec07e2b9f4e14adfa2e2e507e4debc5d36073012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff010000000000000000066a04deadbeef00000000', + }, + { + description: 'Error, output scripts differ', + inputs, + outputs: [{ + // P2WPKH instead of P2WSH + address: 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4', + amount: '10000', + script_type: 'PAYTOADDRESS', + }], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006a4730440220714c3704cb9aee785a5e03eb77eacf5bd95d29a4fe9cf33e4a868aa4100d2b6902207c5bdef296404d3fedeaaa71579140768b72c0bea882c7a2f16c029963d7c622012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff0110270000000000002200201863143c14c5166804bd19203356da136c985678cd4d27a1b8c632960490326200000000', + error: 'Output 0 scripts differ.', + }, + { + description: 'Error, amount differ', + inputs, + outputs: [{ + address: 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4', + amount: '20000', + script_type: 'PAYTOADDRESS', + }], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006b483045022100cdf268cb89433f2cdc990ca3f45bf356befe51bbbbd6b57f1ca08ac69298acad022032beef4e1380bd3819c0cbf1b1a70b434a115199d1cbe5c59de8d94f98086452012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff011027000000000000160014751e76e8199196d454941c45d1b3a323f1433bd600000000', + error: 'Wrong output amount at output 0. Requested: 20000, signed: 10000', + }, + { + description: 'Error, wrong length (inputs)', + inputs: [], + outputs: [], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006b483045022100cdf268cb89433f2cdc990ca3f45bf356befe51bbbbd6b57f1ca08ac69298acad022032beef4e1380bd3819c0cbf1b1a70b434a115199d1cbe5c59de8d94f98086452012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff011027000000000000160014751e76e8199196d454941c45d1b3a323f1433bd600000000', + error: 'Signed transaction has wrong length.', + }, + { + description: 'Error, wrong length (outputs)', + inputs, + outputs: [], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006b483045022100cdf268cb89433f2cdc990ca3f45bf356befe51bbbbd6b57f1ca08ac69298acad022032beef4e1380bd3819c0cbf1b1a70b434a115199d1cbe5c59de8d94f98086452012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff011027000000000000160014751e76e8199196d454941c45d1b3a323f1433bd600000000', + error: 'Signed transaction has wrong length.', + }, + { + description: 'Error, output without address', + inputs, + outputs: [{ + amount: '10000', + script_type: 'PAYTOADDRESS', + }], + tx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006b483045022100cdf268cb89433f2cdc990ca3f45bf356befe51bbbbd6b57f1ca08ac69298acad022032beef4e1380bd3819c0cbf1b1a70b434a115199d1cbe5c59de8d94f98086452012102a7a079c1ef9916b289c2ff21a992c808d0de3dfcf8a9f163205c5c9e21f55d5cffffffff011027000000000000160014751e76e8199196d454941c45d1b3a323f1433bd600000000', + error: 'deriveOutputScript: Neither address or address_n is set', + }, +]; + +describe('helpers/signtxVerify', () => { + fixtures.forEach(f => { + it(f.description, async () => { + try { + await verifyTx(f.getHDNode || getHDNode, f.inputs, f.outputs, f.tx, coinInfo); + } catch (error) { + expect(error).toEqual(new Error(f.error)); + } + }); + }); +}); diff --git a/src/js/core/methods/helpers/signtxVerify.js b/src/js/core/methods/helpers/signtxVerify.js index 9249c0f06..22e69f3f0 100644 --- a/src/js/core/methods/helpers/signtxVerify.js +++ b/src/js/core/methods/helpers/signtxVerify.js @@ -19,11 +19,9 @@ import type { type GetHDNode = (path: Array, coinInfo: ?BitcoinNetworkInfo, validation?: boolean) => Promise; -const changePaths: Array = []; - BitcoinJsTransaction.USE_STRING_VALUES = true; -export const derivePubKeyHash = async (address_n: Array, getHDNode: GetHDNode, coinInfo: BitcoinNetworkInfo): Promise => { +const derivePubKeyHash = async (address_n: Array, getHDNode: GetHDNode, coinInfo: BitcoinNetworkInfo): Promise => { // regular bip44 output if (address_n.length === 5) { const response = await getHDNode(address_n.slice(0, 4), coinInfo); @@ -110,9 +108,6 @@ export default async (getHDNode: GetHDNode, serializedTx: string, coinInfo: BitcoinNetworkInfo, ): Promise => { - // clear cached values - changePaths.splice(0, changePaths.length); - // deserialize signed transaction const bitcoinTx = BitcoinJsTransaction.fromHex(serializedTx, coinInfo.network); From b7497a2578f0c21ebb782583666a3b6d63c71129 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Thu, 19 Mar 2020 15:09:09 +0100 Subject: [PATCH 36/51] Merge branch 'v8' into develop --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 93db8b89a..8e0a41a14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ - disableWebUsb method - trezor-link protobuf messages overrides - Fixed race condition in nodejs https://github.com/trezor/connect/issues/504 +# 8.0.14 (server side only) +#### Fixed +- `signtxVerify` P2WSH output #541 # 8.0.13 #### Fixed From 49de14809773a638e602a6c4582cd7e980b7419a Mon Sep 17 00:00:00 2001 From: martin <30367552+mroz22@users.noreply.github.com> Date: Mon, 23 Mar 2020 12:41:42 +0100 Subject: [PATCH 37/51] implement rollout lib (#532) * implement rollout lib * use rollout from npm * change device.firmware property * rollout 1.0.2 * rename methods in FirmwareInfo * firmware upload method accepts only version param now * @trezor/rollout@1.0.3 * add btc only param * allow to send binary, add isBitcoinOnly to device * fix ts * add rollout to extended dependencies * rollout 1.0.4, baseUrl, cleanup * flowtypes --- package.json | 2 + src/js/core/methods/FirmwareUpdate.js | 55 +++++++++++++++------ src/js/data/DataManager.js | 4 +- src/js/data/FirmwareInfo.js | 44 ++++++++--------- src/js/device/Device.js | 6 +-- src/js/popup/view/firmwareRequiredUpdate.js | 4 +- src/js/popup/view/notification.js | 5 +- src/js/types/__tests__/management.js | 7 ++- src/js/types/trezor/device.js | 11 ++++- src/js/types/trezor/management.js | 5 +- src/js/types/trezor/protobuf.js | 1 - src/ts/types/trezor/device.d.ts | 14 +----- src/ts/types/trezor/management.d.ts | 8 ++- yarn.lock | 25 +++++++++- 14 files changed, 126 insertions(+), 65 deletions(-) diff --git a/package.json b/package.json index 2fb053142..b0aa49f66 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "@babel/preset-env": "7.8.7", "@babel/preset-flow": "7.8.3", "@trezor/blockchain-link": "^1.0.9", + "@trezor/rollout": "^1.0.4", "@trezor/utxo-lib": "^0.1.0", "babel-collect-imports": "https://github.com/szymonlesisz/babel-collect-imports", "babel-eslint": "^10.1.0", @@ -117,6 +118,7 @@ }, "extendedDependencies": { "@trezor/blockchain-link": "^1.0.9", + "@trezor/rollout": "^1.0.4", "@trezor/utxo-lib": "^0.1.0", "bchaddrjs": "0.4.7", "bignumber.js": "^9.0.0", diff --git a/src/js/core/methods/FirmwareUpdate.js b/src/js/core/methods/FirmwareUpdate.js index a6a15ee28..902fdce92 100644 --- a/src/js/core/methods/FirmwareUpdate.js +++ b/src/js/core/methods/FirmwareUpdate.js @@ -1,16 +1,17 @@ /* @flow */ - +import { getBinary } from '@trezor/rollout'; import AbstractMethod from './AbstractMethod'; import * as UI from '../../constants/ui'; -import { validateParams } from './helpers/paramsValidator'; import { uploadFirmware } from './helpers/uploadFirmware'; import { UiMessage } from '../../message/builder'; -import type { FirmwareUpload } from '../../types/trezor/protobuf'; // flowtype only +import DataManager from '../../data/DataManager'; +import { validateParams } from './helpers/paramsValidator'; +import type { FirmwareUpdate as FirmwareUpdateParams } from '../../types/trezor/management'; // flowtype only import type { CoreMessage } from '../../types'; export default class FirmwareUpdate extends AbstractMethod { - params: FirmwareUpload; + params: FirmwareUpdateParams; run: () => Promise; constructor(message: CoreMessage) { @@ -22,16 +23,22 @@ export default class FirmwareUpdate extends AbstractMethod { this.useDeviceState = false; this.skipFirmwareCheck = true; - const payload: Object = message.payload; + const payload: FirmwareUpdateParams = message.payload; validateParams(payload, [ - { name: 'payload', type: 'buffer', obligatory: true }, - // { name: 'hash', type: 'string' }, + { name: 'version', type: 'array' }, + { name: 'btcOnly', type: 'boolean' }, + { name: 'baseUrl', type: 'string' }, + { name: 'binary', type: 'buffer' }, ]); this.params = { - payload: payload.payload, - length: payload.payload.byteLength, + // either receive version and btcOnly + version: payload.version, + btcOnly: payload.btcOnly, + baseUrl: payload.baseUrl || 'https://wallet.trezor.io/', + // or binary + binary: payload.binary, }; } @@ -57,14 +64,34 @@ export default class FirmwareUpdate extends AbstractMethod { } async run(): Promise { - const { device, params } = this; - const response = await uploadFirmware( + const { device } = this; + + let binary; + + if (this.params.binary) { + binary = this.params.binary; + } else { + const firmware = await getBinary({ + // features and releases are used for sanity checking inside @trezor/rollout + features: device.features, + releases: DataManager.assets[`firmware-t${device.features.major_version}`], + // version argument is used to find and fetch concrete release from releases list + version: this.params.version, + btcOnly: this.params.btcOnly, + baseUrl: this.params.baseUrl, + baseUrlBeta: 'https://beta-wallet.trezor.io/', + }); + binary = firmware.binary; + } + + return uploadFirmware( this.device.getCommands().typedCall.bind(this.device.getCommands()), this.postMessage, device, - params, + { + payload: binary, + length: binary.byteLength, + } ); - - return response; } } diff --git a/src/js/data/DataManager.js b/src/js/data/DataManager.js index a3518b3b4..6defe2116 100644 --- a/src/js/data/DataManager.js +++ b/src/js/data/DataManager.js @@ -128,8 +128,8 @@ export default class DataManager { parseCoinsJson(this.assets['coins']); // parse firmware definitions - parseFirmware(this.assets['firmware-t1']); - parseFirmware(this.assets['firmware-t2']); + parseFirmware(this.assets['firmware-t1'], 1); + parseFirmware(this.assets['firmware-t2'], 2); } static getProtobufMessages(version?: number[]): JSON { diff --git a/src/js/data/FirmwareInfo.js b/src/js/data/FirmwareInfo.js index 2df33d302..1e4f761f2 100644 --- a/src/js/data/FirmwareInfo.js +++ b/src/js/data/FirmwareInfo.js @@ -1,46 +1,44 @@ /* @flow */ +import { getInfo } from '@trezor/rollout'; import type { DeviceFirmwareStatus, FirmwareRelease, Features } from '../types'; -const releases: Array = []; +// [] is weird flow hack https://github.com/facebook/flow/issues/380#issuecomment-224380551 +const releases = { + [1]: [], + [2]: [], +}; -export const parseFirmware = (json: JSON): void => { +export const parseFirmware = (json: JSON, model: number): void => { const obj: Object = json; Object.keys(obj).forEach(key => { const release = obj[key]; - releases.push({ ...release }); + releases[model].push({ ...release }); }); }; -export const checkFirmware = (fw: Array, features: Features): DeviceFirmwareStatus => { +export const getFirmwareStatus = (features: Features): DeviceFirmwareStatus => { // indication that firmware is not installed at all. This information is set to false in bl mode. Otherwise it is null. if (features.firmware_present === false) { return 'none'; } // for t1 in bootloader, what device reports as firmware version is in fact bootloader version, so we can // not safely tell firmware version - if (fw[0] === 1 && features.bootloader_mode) { + if (features.major_version === 1 && features.bootloader_mode) { return 'unknown'; } - // find all releases for device model - const modelFirmware = releases.filter(r => r.version[0] === fw[0]); - // find latest firmware for this model - const latestFirmware = modelFirmware.filter(r => r.version[1] > fw[1] || (r.version[1] === fw[1] && r.version[2] > fw[2])); - if (latestFirmware.length > 0) { - // check if any of releases is required - const requiredFirmware: ?FirmwareRelease = latestFirmware.find(r => r.required); - if (requiredFirmware) { - return 'required'; - } else { - return 'outdated'; - } - } + const info = getInfo({features, releases: releases[features.major_version]}); + + // should not happen, possibly if releases list contains inconsistent data or so + if (!info) return 'unknown'; + + if (info.isRequired) return 'required'; + + if (info.isNewer) return 'outdated'; + return 'valid'; }; -export const getLatestRelease = (fw: Array): ?FirmwareRelease => { - // find all releases for device model - const modelFirmware = releases.filter(r => r.version[0] === fw[0]); - // find latest firmware for this model - return modelFirmware.find(r => r.version[1] > fw[1] || (r.version[1] === fw[1] && r.version[2] > fw[2])); +export const getRelease = (features: Features): ?FirmwareRelease => { + return getInfo({features, releases: releases[features.major_version]}); }; diff --git a/src/js/device/Device.js b/src/js/device/Device.js index 5bbef9020..9ab6e592f 100644 --- a/src/js/device/Device.js +++ b/src/js/device/Device.js @@ -12,7 +12,7 @@ import * as ERROR from '../constants/errors'; import { create as createDeferred } from '../utils/deferred'; import DataManager from '../data/DataManager'; import { getAllNetworks } from '../data/CoinInfo'; -import { checkFirmware, getLatestRelease } from '../data/FirmwareInfo'; +import { getFirmwareStatus, getRelease } from '../data/FirmwareInfo'; import { versionCompare, parseCapabilities, getUnavailableCapabilities } from '../utils/deviceFeaturesUtils'; import Log, { init as initLog } from '../utils/debug'; @@ -388,8 +388,8 @@ export default class Device extends EventEmitter { // check if FW version did change if (versionCompare(version, this.getVersion()) !== 0) { this.unavailableCapabilities = getUnavailableCapabilities(feat, getAllNetworks(), DataManager.getConfig().supportedFirmware); - this.firmwareStatus = checkFirmware(version, feat); - this.firmwareRelease = getLatestRelease(version); + this.firmwareStatus = getFirmwareStatus(feat); + this.firmwareRelease = getRelease(feat); } // GetFeatures doesn't return 'session_id' if (this.features && this.features.session_id && !feat.session_id) { diff --git a/src/js/popup/view/firmwareRequiredUpdate.js b/src/js/popup/view/firmwareRequiredUpdate.js index 841cfa8f9..2a2c9ec74 100644 --- a/src/js/popup/view/firmwareRequiredUpdate.js +++ b/src/js/popup/view/firmwareRequiredUpdate.js @@ -6,8 +6,8 @@ import type { UnexpectedDeviceMode } from '../../types/events'; export const firmwareRequiredUpdate = (device: $PropertyType): void => { const view = showView('firmware-update'); if (!device.features) return; - const release = device.firmwareRelease; - if (!release) return; + if (!device.firmwareRelease) return; + const { release } = device.firmwareRelease; const button = view.getElementsByClassName('confirm')[0]; const url = release.channel === 'beta' ? 'https://beta-wallet.trezor.io/' : 'https://wallet.trezor.io/'; diff --git a/src/js/popup/view/notification.js b/src/js/popup/view/notification.js index 235d4ad67..98e7a0bc0 100644 --- a/src/js/popup/view/notification.js +++ b/src/js/popup/view/notification.js @@ -11,8 +11,9 @@ export const showFirmwareUpdateNotification = (device: $PropertyType { }); TrezorConnect.firmwareUpdate({ - payload: new ArrayBuffer(0), + binary: new Buffer(123), + }); + + TrezorConnect.firmwareUpdate({ + version: [2, 2, 0], + btcOnly: false, }); TrezorConnect.recoveryDevice({ diff --git a/src/js/types/trezor/device.js b/src/js/types/trezor/device.js index 2464ba067..d07bb7207 100644 --- a/src/js/types/trezor/device.js +++ b/src/js/types/trezor/device.js @@ -29,7 +29,7 @@ export type FirmwareRange = { }; } -export type FirmwareRelease = { +type Release = { required: true; version: Array; min_bridge_version: Array; @@ -40,6 +40,15 @@ export type FirmwareRelease = { channel: string; fingerprint: string; changelog: string; + channel?: string; +} + +export type FirmwareRelease = { + changelog: Release[] | null; + release: Release; + isLatest: boolean | null; + isRequired: boolean | null; + isNewer: boolean | null; } export type Features = { diff --git a/src/js/types/trezor/management.js b/src/js/types/trezor/management.js index 79e33001c..2b0d9c3bd 100644 --- a/src/js/types/trezor/management.js +++ b/src/js/types/trezor/management.js @@ -27,7 +27,10 @@ export type ChangePin = { } export type FirmwareUpdate = { - payload: ArrayBuffer; + version?: Array; + btcOnly?: boolean; + baseUrl?: string; + binary?: Buffer; } export type FirmwareRequest = { diff --git a/src/js/types/trezor/protobuf.js b/src/js/types/trezor/protobuf.js index 8d381cb4a..84900e6e4 100644 --- a/src/js/types/trezor/protobuf.js +++ b/src/js/types/trezor/protobuf.js @@ -912,7 +912,6 @@ export type FirmwareErase = { export type FirmwareUpload = { payload: Buffer; length: number; - // hash?: string, } export type ChangePin = { diff --git a/src/ts/types/trezor/device.d.ts b/src/ts/types/trezor/device.d.ts index 487907c26..4587d34c5 100644 --- a/src/ts/types/trezor/device.d.ts +++ b/src/ts/types/trezor/device.d.ts @@ -1,3 +1,4 @@ +import { getInfo } from '@trezor/rollout'; import { DEVICE } from '../constants'; export interface DeviceStateResponse { @@ -28,18 +29,7 @@ export interface FirmwareRange { }; } -export interface FirmwareRelease { - required: true; - version: number[]; - min_bridge_version: number[]; - min_firmware_version: number[]; - bootloader_version: number[]; - min_bootloader_version: number[]; - url: string; - channel: string; - fingerprint: string; - changelog: string; -} +export type FirmwareRelease = ReturnType; export interface Features { bootloader_hash?: string | null; diff --git a/src/ts/types/trezor/management.d.ts b/src/ts/types/trezor/management.d.ts index 9f3ecc5cb..f46a0f343 100644 --- a/src/ts/types/trezor/management.d.ts +++ b/src/ts/types/trezor/management.d.ts @@ -25,7 +25,13 @@ export interface ChangePin { } export interface FirmwareUpdate { - payload: ArrayBuffer; + binary: number[]; +} + +export interface FirmwareUpdate { + version: number[]; + btcOnly: boolean; + baseUrl?: string; } export interface FirmwareRequest { diff --git a/yarn.lock b/yarn.lock index 92bd4a4e9..33a007233 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1378,6 +1378,14 @@ es6-promise "^4.2.8" events "^3.1.0" +"@trezor/rollout@^1.0.4": + version "1.0.4" + resolved "https://registry.yarnpkg.com/@trezor/rollout/-/rollout-1.0.4.tgz#501238c4a0025014af5f3372ca3136b94292cb77" + integrity sha512-wqqnE2TqxOnzA9shqW0aS8dcJVCfu+7zc4x198dbJw8J9zLgP+gC/rIiS5knPAR+nIvsoPBKSWbrHy/TGjwHUw== + dependencies: + cross-fetch "^3.0.4" + runtypes "^4.2.0" + "@trezor/utxo-lib@0.1.0", "@trezor/utxo-lib@^0.1.0": version "0.1.0" resolved "https://registry.yarnpkg.com/@trezor/utxo-lib/-/utxo-lib-0.1.0.tgz#f7a60d514ab75bef2f2206200cf0317d2d8523b2" @@ -3439,6 +3447,14 @@ create-hmac@^1.1.0, create-hmac@^1.1.2, create-hmac@^1.1.3, create-hmac@^1.1.4: safe-buffer "^5.0.1" sha.js "^2.4.8" +cross-fetch@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.0.4.tgz#7bef7020207e684a7638ef5f2f698e24d9eb283c" + integrity sha512-MSHgpjQqgbT/94D4CyADeNoYh52zMkCX4pcJvPP5WqPsLFMKjr2TCMg381ox5qI0ii2dPwaLx/00477knXqXVw== + dependencies: + node-fetch "2.6.0" + whatwg-fetch "3.0.0" + cross-spawn@6.0.5, cross-spawn@^6.0.0, cross-spawn@^6.0.5: version "6.0.5" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4" @@ -7061,7 +7077,7 @@ node-environment-flags@^1.0.5: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" -node-fetch@^2.6.0: +node-fetch@2.6.0, node-fetch@^2.6.0: version "2.6.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.0.tgz#e633456386d4aa55863f676a7ab0daa8fdecb0fd" integrity sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA== @@ -8557,6 +8573,11 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" +runtypes@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/runtypes/-/runtypes-4.2.0.tgz#6bb01a4683c1ac76015de8669df32a034c6cb0fe" + integrity sha512-s89DYbxI7qKSpDMmdKQCGg61nH45tYA5LJMR0pWfJ/1nwPdpww75fusQqGzXE7llpk+rwe8fNPSx78FRGKenJg== + rxjs@^6.4.0: version "6.5.2" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz#2e35ce815cd46d84d02a209fb4e5921e051dbec7" @@ -10168,7 +10189,7 @@ whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.5: dependencies: iconv-lite "0.4.24" -whatwg-fetch@^3.0.0: +whatwg-fetch@3.0.0, whatwg-fetch@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb" integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q== From fe5c4a142e7c2293deda1077047748f3a0aba8d9 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 23 Mar 2020 12:51:27 +0100 Subject: [PATCH 38/51] changelog for 8.1.0-beta.4 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index df03a8a99..7e4880bfb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 8.1.0-beta.4 +- Implement @trezor/rollout module https://github.com/trezor/connect/issues/295 + # 8.1.0 #### Added - Support for FW 1.9.0 and 2.3.0 (passphrase redesign) @@ -11,6 +14,7 @@ - `TrezorConnect.blockchainUnsubscribeFiatRates` - `TrezorConnect.blockchainSetCustomBackend` method - `TrezorConnect.cancel` is now trying to send (post) 'Cancel' message to acquired device (not working with TrezorBridge < 2.0.29) + #### Fixed - General cleanup in flowtype declarations - disableWebUsb method From 8f3db7b07e9d5e38e82f6f3bf3160905ea36ef3c Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 23 Mar 2020 12:57:58 +0100 Subject: [PATCH 39/51] correct changelog --- CHANGELOG.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e4880bfb..cb3c0ba6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,3 @@ -# 8.1.0-beta.4 -- Implement @trezor/rollout module https://github.com/trezor/connect/issues/295 - # 8.1.0 #### Added - Support for FW 1.9.0 and 2.3.0 (passphrase redesign) @@ -14,7 +11,7 @@ - `TrezorConnect.blockchainUnsubscribeFiatRates` - `TrezorConnect.blockchainSetCustomBackend` method - `TrezorConnect.cancel` is now trying to send (post) 'Cancel' message to acquired device (not working with TrezorBridge < 2.0.29) - +- Implement @trezor/rollout module https://github.com/trezor/connect/issues/295 #### Fixed - General cleanup in flowtype declarations - disableWebUsb method From 24825a5fc03c5b61975cccd6d5ecd4d3342afd8c Mon Sep 17 00:00:00 2001 From: martin <30367552+mroz22@users.noreply.github.com> Date: Mon, 23 Mar 2020 15:57:36 +0100 Subject: [PATCH 40/51] fix firmware update types (#545) --- src/js/core/methods/FirmwareUpdate.js | 12 +++++++++--- src/js/types/api.js | 2 +- src/js/types/trezor/management.js | 4 +++- src/ts/types/api.d.ts | 4 +++- src/ts/types/trezor/management.d.ts | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/js/core/methods/FirmwareUpdate.js b/src/js/core/methods/FirmwareUpdate.js index 902fdce92..cd0da2b75 100644 --- a/src/js/core/methods/FirmwareUpdate.js +++ b/src/js/core/methods/FirmwareUpdate.js @@ -6,12 +6,18 @@ import { uploadFirmware } from './helpers/uploadFirmware'; import { UiMessage } from '../../message/builder'; import DataManager from '../../data/DataManager'; import { validateParams } from './helpers/paramsValidator'; -import type { FirmwareUpdate as FirmwareUpdateParams } from '../../types/trezor/management'; // flowtype only import type { CoreMessage } from '../../types'; +type Params = { + binary?: Buffer; + version?: Array; + btcOnly?: boolean; + baseUrl?: string; +} + export default class FirmwareUpdate extends AbstractMethod { - params: FirmwareUpdateParams; + params: Params; run: () => Promise; constructor(message: CoreMessage) { @@ -23,7 +29,7 @@ export default class FirmwareUpdate extends AbstractMethod { this.useDeviceState = false; this.skipFirmwareCheck = true; - const payload: FirmwareUpdateParams = message.payload; + const payload: Params = message.payload; validateParams(payload, [ { name: 'version', type: 'array' }, diff --git a/src/js/types/api.js b/src/js/types/api.js index f43822b82..8612456c5 100644 --- a/src/js/types/api.js +++ b/src/js/types/api.js @@ -260,7 +260,7 @@ export type API = { /** * Sends FirmwareErase message followed by FirmwareUpdate message */ - firmwareUpdate: Method; + firmwareUpdate: Mixed; /** * Asks device to initiate seed backup procedure diff --git a/src/js/types/trezor/management.js b/src/js/types/trezor/management.js index 2b0d9c3bd..e6d261553 100644 --- a/src/js/types/trezor/management.js +++ b/src/js/types/trezor/management.js @@ -26,11 +26,13 @@ export type ChangePin = { remove?: boolean; } +export type FirmwareUpdateBinary = { + binary?: Buffer; +} export type FirmwareUpdate = { version?: Array; btcOnly?: boolean; baseUrl?: string; - binary?: Buffer; } export type FirmwareRequest = { diff --git a/src/ts/types/api.d.ts b/src/ts/types/api.d.ts index da5314245..9c2a2bb9a 100644 --- a/src/ts/types/api.d.ts +++ b/src/ts/types/api.d.ts @@ -342,7 +342,9 @@ export namespace TrezorConnect { /** * Sends FirmwareErase message followed by FirmwareUpdate message */ - function firmwareUpdate(params: P.CommonParams & Mgmnt.FirmwareUpdate): P.Response; + function firmwareUpdate( + params: P.CommonParams & (Mgmnt.FirmwareUpdate | Mgmnt.FirmwareUpdateBinary), + ): P.Response; /** * Asks device to initiate seed backup procedure diff --git a/src/ts/types/trezor/management.d.ts b/src/ts/types/trezor/management.d.ts index f46a0f343..281ba4cea 100644 --- a/src/ts/types/trezor/management.d.ts +++ b/src/ts/types/trezor/management.d.ts @@ -24,7 +24,7 @@ export interface ChangePin { remove?: boolean; } -export interface FirmwareUpdate { +export interface FirmwareUpdateBinary { binary: number[]; } From b5320d3f4a9a1aa38bba0387bb76e78fab7a3665 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Sun, 29 Mar 2020 19:39:12 +0200 Subject: [PATCH 41/51] add missing types from branch v8 --- src/js/types/__tests__/bitcoin.js | 1 + src/js/types/account.js | 1 + src/js/types/events.js | 1 + src/ts/types/__tests__/bitcoin.ts | 1 + src/ts/types/account.d.ts | 1 + 5 files changed, 5 insertions(+) diff --git a/src/js/types/__tests__/bitcoin.js b/src/js/types/__tests__/bitcoin.js index b6485b2ff..7fc6bf7cb 100644 --- a/src/js/types/__tests__/bitcoin.js +++ b/src/js/types/__tests__/bitcoin.js @@ -357,6 +357,7 @@ export const getAccountInfo = async () => { ledger: 1, seq: 1, }, + defaultAccountType: 'normal', }); if (account.success) { const { payload } = account; diff --git a/src/js/types/account.js b/src/js/types/account.js index 928d4fcda..7d98f17f1 100644 --- a/src/js/types/account.js +++ b/src/js/types/account.js @@ -18,6 +18,7 @@ export type GetAccountInfo = { ledger: number; seq: number; }; + defaultAccountType?: 'normal' | 'segwit' | 'legacy'; } export type TokenInfo = { diff --git a/src/js/types/events.js b/src/js/types/events.js index 2d411d7c6..a2f95ef3d 100644 --- a/src/js/types/events.js +++ b/src/js/types/events.js @@ -173,6 +173,7 @@ export type SelectAccount = { type: 'start' | 'progress' | 'end'; coinInfo: CoinInfo; accountTypes?: Array<'normal' | 'segwit' | 'legacy'>; + defaultAccountType?: 'normal' | 'segwit' | 'legacy'; accounts?: Array; preventEmpty?: boolean; }; diff --git a/src/ts/types/__tests__/bitcoin.ts b/src/ts/types/__tests__/bitcoin.ts index 8c68aeff1..68787a6d7 100644 --- a/src/ts/types/__tests__/bitcoin.ts +++ b/src/ts/types/__tests__/bitcoin.ts @@ -350,6 +350,7 @@ export const getAccountInfo = async () => { ledger: 1, seq: 1, }, + defaultAccountType: 'normal', }); if (account.success) { const { payload } = account; diff --git a/src/ts/types/account.d.ts b/src/ts/types/account.d.ts index 5e287c8ac..f06dcfd3f 100644 --- a/src/ts/types/account.d.ts +++ b/src/ts/types/account.d.ts @@ -17,6 +17,7 @@ export interface GetAccountInfo { ledger: number; seq: number; }; + defaultAccountType?: 'normal' | 'segwit' | 'legacy'; } export interface TokenInfo { From c8aef29b94e13b2afdf592a3bb9832ce4e9b7834 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Mon, 30 Mar 2020 20:53:13 +0200 Subject: [PATCH 42/51] add flowtype missing fields --- src/js/types/api.js | 2 ++ src/js/types/params.js | 4 ++-- src/js/types/trezor/device.js | 16 +++++++++++----- src/ts/types/trezor/device.d.ts | 8 +++++++- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/js/types/api.js b/src/js/types/api.js index 8612456c5..c9eae6fa2 100644 --- a/src/js/types/api.js +++ b/src/js/types/api.js @@ -40,6 +40,8 @@ interface Emitter { (type: typeof CONSTANTS.UI_EVENT, cb: (event: Events.UiEvent) => void): void; (type: typeof CONSTANTS.BLOCKCHAIN_EVENT, cb: (event: Blockchain.BlockchainEvent) => void): void; + (type: $PropertyType, cb: (event: $PropertyType) => void): void; + (type: $PropertyType, cb: () => void): void; (type: $PropertyType, cb: (event: $PropertyType) => void): void; (type: $PropertyType, cb: (event: $PropertyType) => void): void; diff --git a/src/js/types/params.js b/src/js/types/params.js index 88c2aadd8..d2d77863b 100644 --- a/src/js/types/params.js +++ b/src/js/types/params.js @@ -52,8 +52,8 @@ export type ConnectSettings = { export type CommonParams = { device?: { path: string; - state?: string; - instance?: number; + state?: ?string; + instance?: ?number; }; useEmptyPassphrase?: boolean; allowSeedlessDevice?: boolean; diff --git a/src/js/types/trezor/device.js b/src/js/types/trezor/device.js index d07bb7207..4fefd7741 100644 --- a/src/js/types/trezor/device.js +++ b/src/js/types/trezor/device.js @@ -85,7 +85,7 @@ export type Features = { capabilities?: string[]; } -export type KnownDevice = { +export type KnownDevice = {| type: 'acquired'; id: string | null; path: string; @@ -97,15 +97,21 @@ export type KnownDevice = { state: ?string; features: Features; unavailableCapabilities: { [key: string]: UnavailableCapability }; -}; +|}; -export type UnknownDevice = { +export type UnknownDevice = {| type: 'unacquired' | 'unreadable'; id?: null; path: string; label: string; - features?: typeof undefined; -}; + features?: typeof undefined | null; + firmware?: typeof undefined | null; + firmwareRelease?: typeof undefined | null; + status?: typeof undefined | null; + mode?: typeof undefined | null; + state?: typeof undefined | null; + unavailableCapabilities?: typeof undefined | null; +|}; export type Device = KnownDevice | UnknownDevice; diff --git a/src/ts/types/trezor/device.d.ts b/src/ts/types/trezor/device.d.ts index 4587d34c5..79651ce9d 100644 --- a/src/ts/types/trezor/device.d.ts +++ b/src/ts/types/trezor/device.d.ts @@ -84,7 +84,13 @@ export type UnknownDevice = { id?: null; path: string; label: string; - features?: typeof undefined; + features?: typeof undefined | null; + firmware?: typeof undefined | null; + firmwareRelease?: typeof undefined | null; + status?: typeof undefined | null; + mode?: typeof undefined | null; + state?: typeof undefined | null; + unavailableCapabilities?: typeof undefined | null; }; export type Device = KnownDevice | UnknownDevice; From e029507dd516953eaa73295dae5232ad302378a1 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 1 Apr 2020 12:37:20 +0200 Subject: [PATCH 43/51] Feature/custom connectSrc (#549) * Update ConnectSettings.js * bring __TREZOR_CONNECT_SRC back (as global) --- src/js/data/ConnectSettings.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/js/data/ConnectSettings.js b/src/js/data/ConnectSettings.js index d5664c7ad..2e8c5b4da 100644 --- a/src/js/data/ConnectSettings.js +++ b/src/js/data/ConnectSettings.js @@ -88,8 +88,21 @@ export const parse = (input: $Shape = {}) => { if (typeof input.connectSrc === 'string') { settings.connectSrc = input.connectSrc; - } else if (typeof window !== 'undefined' && typeof window.__TREZOR_CONNECT_SRC === 'string') { - settings.connectSrc = window.__TREZOR_CONNECT_SRC; + } + // For debugging purposes `connectSrc` could be defined in `global.__TREZOR_CONNECT_SRC` variable + if (typeof global !== 'undefined' && typeof global.__TREZOR_CONNECT_SRC === 'string') { + settings.connectSrc = global.__TREZOR_CONNECT_SRC; + } + + // For debugging purposes `connectSrc` could be defined in url query of hosting page. Usage: + // https://3rdparty-page.com/?trezor-connect-src=https://localhost:8088/ + if (typeof window !== 'undefined' && window.location && typeof window.location.search === 'string') { + const vars = window.location.search.split('&'); + const customUrl = vars.find(v => v.indexOf('trezor-connect-src') >= 0); + if (customUrl) { + const [, connectSrc] = customUrl.split('='); + settings.connectSrc = decodeURIComponent(connectSrc); + } } const src = settings.connectSrc || DEFAULT_DOMAIN; settings.iframeSrc = `${src}iframe.html`; From 1051df922c4e1753b911658f3875b1f2f41e22e6 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 1 Apr 2020 14:10:58 +0200 Subject: [PATCH 44/51] Fix/blockchain link bump (#550) * bump blockchain-link@1.0.10 * donwgrade flow back to 0.120.1 0.121.0 has beaking changes with error suppression --- package.json | 6 +++--- src/js/types/account.js | 1 + src/ts/types/account.d.ts | 1 + yarn.lock | 16 ++++++++-------- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index b0aa49f66..21afbe7e7 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@babel/plugin-transform-runtime": "7.8.3", "@babel/preset-env": "7.8.7", "@babel/preset-flow": "7.8.3", - "@trezor/blockchain-link": "^1.0.9", + "@trezor/blockchain-link": "^1.0.10", "@trezor/rollout": "^1.0.4", "@trezor/utxo-lib": "^0.1.0", "babel-collect-imports": "https://github.com/szymonlesisz/babel-collect-imports", @@ -98,7 +98,7 @@ "mini-css-extract-plugin": "0.9.0", "node-fetch": "^2.6.0", "parse-uri": "^1.0.0", - "ripple-lib": "1.6.4", + "ripple-lib": "1.6.5", "sharedworker-loader": "^2.1.1", "style-loader": "1.1.3", "terser-webpack-plugin": "2.3.5", @@ -117,7 +117,7 @@ "whatwg-fetch": "^3.0.0" }, "extendedDependencies": { - "@trezor/blockchain-link": "^1.0.9", + "@trezor/blockchain-link": "^1.0.10", "@trezor/rollout": "^1.0.4", "@trezor/utxo-lib": "^0.1.0", "bchaddrjs": "0.4.7", diff --git a/src/js/types/account.js b/src/js/types/account.js index 7d98f17f1..69d2041c3 100644 --- a/src/js/types/account.js +++ b/src/js/types/account.js @@ -122,6 +122,7 @@ export type AccountInfo = { misc?: { // ETH nonce?: string; + erc20Contract?: TokenInfo; // XRP sequence?: number; reserve?: string; diff --git a/src/ts/types/account.d.ts b/src/ts/types/account.d.ts index f06dcfd3f..2128fef97 100644 --- a/src/ts/types/account.d.ts +++ b/src/ts/types/account.d.ts @@ -120,6 +120,7 @@ export interface AccountInfo { misc?: { // ETH nonce?: string; + erc20Contract?: TokenInfo; // XRP sequence?: number; reserve?: string; diff --git a/yarn.lock b/yarn.lock index 33a007233..7c23a89f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1370,10 +1370,10 @@ dependencies: type-detect "4.0.8" -"@trezor/blockchain-link@^1.0.9": - version "1.0.9" - resolved "https://registry.yarnpkg.com/@trezor/blockchain-link/-/blockchain-link-1.0.9.tgz#3993085f9a9b45f358f9212ead2476cae70c91eb" - integrity sha512-VLEnt5QGWPg7/wA4biVZwlryz/E1zY5vOefn47RqsEygz5YVmZT5XjtDEbZzrn2AEKaMynjfz2mu7wiaLUZYuQ== +"@trezor/blockchain-link@^1.0.10": + version "1.0.10" + resolved "https://registry.yarnpkg.com/@trezor/blockchain-link/-/blockchain-link-1.0.10.tgz#3a410612050592c30f7c43988f61155c5cf8ae05" + integrity sha512-EfYQewm+mQXfJkmJNnS0LkIkZc2muCEorzm9I8XcmxcvHdPANhDT5o3gtdyVSsKW9cduvZi1VfOTi+plW4nSHQ== dependencies: es6-promise "^4.2.8" events "^3.1.0" @@ -8524,10 +8524,10 @@ ripple-lib-transactionparser@0.8.2: bignumber.js "^9.0.0" lodash "^4.17.15" -ripple-lib@1.6.4: - version "1.6.4" - resolved "https://registry.yarnpkg.com/ripple-lib/-/ripple-lib-1.6.4.tgz#56458bd08a59b38646c832b9dca3e9c8bb439758" - integrity sha512-6PDooo5b23oY89WVQ+IqTDerG8FXYeu4ZuprrIbqe7/A3Iy6zCGatez9AcNMgUnq+bCk3P/oylJXrBYLqpe3bA== +ripple-lib@1.6.5: + version "1.6.5" + resolved "https://registry.yarnpkg.com/ripple-lib/-/ripple-lib-1.6.5.tgz#df445fb646c4a140869481675b258090ad155c5d" + integrity sha512-151+nWvieqoC3EkN6zT5ehkCedpw70xn1IB6n4HL9qNi3Z9clnWg7bzfqZUuCGlaeusnxv1opbP+W4FTIE+PFA== dependencies: "@types/lodash" "^4.14.136" "@types/ws" "^7.2.0" From 98738c576d4c59a3c557d9e5abd4c147211df69a Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Thu, 2 Apr 2020 10:14:40 +0200 Subject: [PATCH 45/51] filter custom connectSrc (#551) --- src/js/data/ConnectSettings.js | 15 +++- src/js/data/__tests__/ConnectSettings.test.js | 72 +++++++++++++++++++ 2 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 src/js/data/__tests__/ConnectSettings.test.js diff --git a/src/js/data/ConnectSettings.js b/src/js/data/ConnectSettings.js index 2e8c5b4da..8b41f2fc1 100644 --- a/src/js/data/ConnectSettings.js +++ b/src/js/data/ConnectSettings.js @@ -74,6 +74,17 @@ export const getEnv = () => { return 'web'; }; +// Cors validation copied from Trezor Bridge +// see: https://github.com/trezor/trezord-go/blob/05991cea5900d18bcc6ece5ae5e319d138fc5551/server/api/api.go#L229 +// Its pointless to allow `trezor-connect` endpoints { connectSrc } for domains other than listed below +// `trezord` will block communication anyway +export const corsValidator = (url?: string) => { + if (typeof url !== 'string') return; + if (url.match(/^https:\/\/([A-Za-z0-9\-_]+\.)*trezor\.io\//)) return url; + if (url.match(/^https?:\/\/localhost:[58][0-9]{3}\//)) return url; + if (url.match(/^https:\/\/([A-Za-z0-9\-_]+\.)*sldev\.cz\//)) return url; +}; + export const parse = (input: $Shape = {}) => { const settings: ConnectSettings = { ...currentSettings }; if (Object.prototype.hasOwnProperty.call(input, 'debug')) { @@ -91,7 +102,7 @@ export const parse = (input: $Shape = {}) => { } // For debugging purposes `connectSrc` could be defined in `global.__TREZOR_CONNECT_SRC` variable if (typeof global !== 'undefined' && typeof global.__TREZOR_CONNECT_SRC === 'string') { - settings.connectSrc = global.__TREZOR_CONNECT_SRC; + settings.connectSrc = corsValidator(global.__TREZOR_CONNECT_SRC); } // For debugging purposes `connectSrc` could be defined in url query of hosting page. Usage: @@ -101,7 +112,7 @@ export const parse = (input: $Shape = {}) => { const customUrl = vars.find(v => v.indexOf('trezor-connect-src') >= 0); if (customUrl) { const [, connectSrc] = customUrl.split('='); - settings.connectSrc = decodeURIComponent(connectSrc); + settings.connectSrc = corsValidator(decodeURIComponent(connectSrc)); } } const src = settings.connectSrc || DEFAULT_DOMAIN; diff --git a/src/js/data/__tests__/ConnectSettings.test.js b/src/js/data/__tests__/ConnectSettings.test.js new file mode 100644 index 000000000..fb90bfaaa --- /dev/null +++ b/src/js/data/__tests__/ConnectSettings.test.js @@ -0,0 +1,72 @@ +import { corsValidator, parse } from '../ConnectSettings'; + +describe('data/ConnectSettings', () => { + const { location } = window; + beforeAll(() => { + delete window.location; + }); + afterAll(() => { + window.location = location; // restore default + }); + + it('corsValidator', () => { + expect(corsValidator('https://connect.trezor.io/8-beta/')).toBeDefined(); + expect(corsValidator('https://az-AZ_123.trezor.io/')).toBeDefined(); + expect(corsValidator('https://multiple.sub.domain.trezor.io/')).toBeDefined(); + expect(corsValidator('https://trezor.sldev.io/')).not.toBeDefined(); + expect(corsValidator('https://testxtrezor.io/')).not.toBeDefined(); + expect(corsValidator('https://testxtrezorxio/')).not.toBeDefined(); + expect(corsValidator('https://non!alpha*numeric?.trezor.io/')).not.toBeDefined(); + expect(corsValidator('https://connect.trezor.io')).not.toBeDefined(); // missing slash at the end + expect(corsValidator('http://connect.trezor.io/')).not.toBeDefined(); // missing https + expect(corsValidator('https://localhost:8088/')).toBeDefined(); + expect(corsValidator('https://localhost:5088/')).toBeDefined(); + expect(corsValidator('https://localhost:8088/subdir/')).toBeDefined(); + expect(corsValidator('http://localhost:8088/')).toBeDefined(); + expect(corsValidator('https://connect.sldev.cz/')).toBeDefined(); + expect(corsValidator('https://az-AZ_123.sldev.cz/')).toBeDefined(); + expect(corsValidator('https://multiple.sub.domain.sldev.cz/')).toBeDefined(); + expect(corsValidator('https://sldev.trezor.cz/')).not.toBeDefined(); + expect(corsValidator('https://testxsldev.cz/')).not.toBeDefined(); + expect(corsValidator('https://testxsldevxcz/')).not.toBeDefined(); + expect(corsValidator('https://non!alpha*numeric?.sldev.cz/')).not.toBeDefined(); + expect(corsValidator('https://connect.sldev.cz')).not.toBeDefined(); // missing slash at the end + expect(corsValidator('http://connect.sldev.cz/')).not.toBeDefined(); // missing https + expect(corsValidator(null)).not.toBeDefined(); + expect(corsValidator(undefined)).not.toBeDefined(); + expect(corsValidator({})).not.toBeDefined(); + expect(corsValidator(1)).not.toBeDefined(); + expect(corsValidator('https://other-domain.com/connect.trezor.io/8/')).not.toBeDefined(); + }); + + it('parse: custom connect src', () => { + window.location = { search: 'trezor-connect-src=https://connect.trezor.io/beta.1/' }; + expect(parse({}).connectSrc).toEqual('https://connect.trezor.io/beta.1/'); + + window.location = { search: 'foo=bar&trezor-connect-src=https://connect.trezor.io/beta.2/' }; + expect(parse({}).connectSrc).toEqual('https://connect.trezor.io/beta.2/'); + + window.location = { search: 'trezor-connect-src=https://connect.trezor.io/beta.3/&foo=bar' }; + expect(parse({}).connectSrc).toEqual('https://connect.trezor.io/beta.3/'); + + window.location = { search: 'trezor-connect-src=https%3A%2F%2Fconnect.trezor.io%2Fbeta.encoded%2F' }; // encoded + expect(parse({}).connectSrc).toEqual('https://connect.trezor.io/beta.encoded/'); + + window.location = { search: 'trezor-connect-src=https://connect-beta.trezor.oi/beta.3/' }; // invalid domain "io" + expect(parse({}).connectSrc).toEqual(undefined); + + delete window.location.search; // restore + + window.__TREZOR_CONNECT_SRC = 'https://connect.trezor.io/beta.4/'; + expect(parse({}).connectSrc).toEqual('https://connect.trezor.io/beta.4/'); + + window.__TREZOR_CONNECT_SRC = 'https://connect-beta.trezor.oi/beta.4/'; // invalid domain + expect(parse({}).connectSrc).toEqual(undefined); + + delete window.__TREZOR_CONNECT_SRC; // restore + + global.__TREZOR_CONNECT_SRC = 'https://connect.trezor.io/beta.4/'; + expect(parse({}).connectSrc).toEqual('https://connect.trezor.io/beta.4/'); + delete global.__TREZOR_CONNECT_SRC; // restore + }); +}); From 9d1c84c1098e877c5958254d11feae069e654b0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maro=C5=A1?= Date: Fri, 3 Apr 2020 11:10:07 +0200 Subject: [PATCH 46/51] fix BlockchainAccountBalanceHistory type (#552) --- src/js/types/backend/blockchain.js | 2 +- src/ts/types/backend/blockchain.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/types/backend/blockchain.js b/src/js/types/backend/blockchain.js index e99eb3dc6..d0da39e32 100644 --- a/src/js/types/backend/blockchain.js +++ b/src/js/types/backend/blockchain.js @@ -111,7 +111,7 @@ export type BlockchainAccountBalanceHistory = { txs: number; received: string; sent: string; - fiatRate: number; + rates: BlockchainFiatRates; }; export type BlockchainTransactions = Array<{ diff --git a/src/ts/types/backend/blockchain.d.ts b/src/ts/types/backend/blockchain.d.ts index d797ae70f..28f275067 100644 --- a/src/ts/types/backend/blockchain.d.ts +++ b/src/ts/types/backend/blockchain.d.ts @@ -143,7 +143,7 @@ export interface BlockchainAccountBalanceHistory { txs: number; received: string; sent: string; - fiatRate: number; + rates: BlockchainFiatRates; } export interface BlockchainSetCustomBackend { From cc804ce68e15a10fc3ab4ffac26567bdff55177f Mon Sep 17 00:00:00 2001 From: martin <30367552+mroz22@users.noreply.github.com> Date: Mon, 6 Apr 2020 10:11:13 +0200 Subject: [PATCH 47/51] Tests (#553) * wip * try external image * travis and suite-image in gitlab * no gui in ci * docker.sock * gitlab dind service * another try * disable test in gitlab * rewrite some fixtures * comment out not working tests * remove Dockerfile, not needed * cleanup * types and cleanup * remove console.log * trezor-user-env image * some more debugging * despair here, introduce retryability * hm.. * fix types --- .flowconfig | 1 + .gitlab-ci.yml | 18 + .travis.yml | 4 + jest.config.integration.js | 14 + jest.config.js => jest.config.unit.js | 0 package.json | 3 +- src/js/device/DeviceCommands.js | 6 +- src/js/index.js | 4 + src/js/types/api.js | 1 + src/ts/types/__tests__/index.ts | 2 + src/ts/types/api.d.ts | 1 + submodules/trezor-common | 2 +- tests/__fixtures__/applyFlags.js | 17 + tests/__fixtures__/applySettings.js | 30 + tests/__fixtures__/binanceSignTransaction.js | 92 +++ tests/__fixtures__/cardanoGetAddress.js | 42 ++ tests/__fixtures__/cardanoGetPublicKey.js | 42 ++ tests/__fixtures__/cardanoSignTransaction.js | 92 +++ tests/__fixtures__/eosGetPublicKey.js | 64 ++ tests/__fixtures__/eosSignTransaction.js | 611 +++++++++++++++++++ tests/__fixtures__/getAddress.js | 88 +++ tests/__fixtures__/getPublicKey.js | 67 ++ tests/__fixtures__/index.js | 68 +++ tests/__fixtures__/resetDevice.js | 18 + tests/__fixtures__/rippleGetAddress.js | 33 + tests/__fixtures__/signTransaction.js | 169 +++++ tests/__fixtures__/wipeDevice.js | 15 + tests/common.setup.js | 83 +++ tests/device/methods.test.js | 60 ++ tests/jest.setup.js | 5 + tests/run.sh | 58 ++ tests/websocket-client.js | 243 ++++++++ 32 files changed, 1948 insertions(+), 5 deletions(-) create mode 100644 jest.config.integration.js rename jest.config.js => jest.config.unit.js (100%) create mode 100644 tests/__fixtures__/applyFlags.js create mode 100644 tests/__fixtures__/applySettings.js create mode 100644 tests/__fixtures__/binanceSignTransaction.js create mode 100644 tests/__fixtures__/cardanoGetAddress.js create mode 100644 tests/__fixtures__/cardanoGetPublicKey.js create mode 100644 tests/__fixtures__/cardanoSignTransaction.js create mode 100644 tests/__fixtures__/eosGetPublicKey.js create mode 100644 tests/__fixtures__/eosSignTransaction.js create mode 100644 tests/__fixtures__/getAddress.js create mode 100644 tests/__fixtures__/getPublicKey.js create mode 100644 tests/__fixtures__/index.js create mode 100644 tests/__fixtures__/resetDevice.js create mode 100644 tests/__fixtures__/rippleGetAddress.js create mode 100644 tests/__fixtures__/signTransaction.js create mode 100644 tests/__fixtures__/wipeDevice.js create mode 100644 tests/common.setup.js create mode 100644 tests/device/methods.test.js create mode 100755 tests/run.sh create mode 100644 tests/websocket-client.js diff --git a/.flowconfig b/.flowconfig index e729c7922..7e8e1eff6 100644 --- a/.flowconfig +++ b/.flowconfig @@ -9,6 +9,7 @@ .*/npm/.* .*/npm-extended/.* .*/build/.* +.*/tests/* [libs] ./node_modules/trezor-link/flowtype/chrome.js diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8fd58e8b4..5ddf3d737 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,6 +3,7 @@ image: node:12.14.1 stages: - build - deploy + # - test-integration build: stage: build @@ -37,3 +38,20 @@ deploy review: - branches tags: - deploy + +# todo: does not work yet. I would like not to use image with docker installed and rather use +# docker mounted from parent container https://docs.gitlab.com/ee/ci/docker/using_docker_build.html +# but I'd say it is not configured on the runners at the moment +# +# test integration: +# stage: test-integration +# dependencies: +# - deploy review +# variables: +# DOCKER_TLS_CERTDIR: '' +# services: +# - docker:dind +# before_script: +# - docker info +# script: +# - ./tests/run.sh ci \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index ee9847a06..ebc19b499 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,7 @@ script: - yarn lint - yarn test:unit - make build-connect + - ./tests/run.sh 3 ci notifications: webhooks: @@ -20,3 +21,6 @@ notifications: on_success: always on_failure: always on_start: always + +services: + - docker \ No newline at end of file diff --git a/jest.config.integration.js b/jest.config.integration.js new file mode 100644 index 000000000..44e8ed180 --- /dev/null +++ b/jest.config.integration.js @@ -0,0 +1,14 @@ +/* + * Integration tests + */ + +module.exports = { + rootDir: './', + moduleFileExtensions: ['js'], + testMatch: ['**/tests/device/**/*.test.(js)'], + modulePathIgnorePatterns: ['node_modules', '_old', 'src/types', 'src/ui', 'src/utils/ws.ts'], + setupFilesAfterEnv: ['/tests/jest.setup.js', '/tests/common.setup.js'], + transform: { + '^.+\\.js$': 'babel-jest', + }, +}; diff --git a/jest.config.js b/jest.config.unit.js similarity index 100% rename from jest.config.js rename to jest.config.unit.js diff --git a/package.json b/package.json index 21afbe7e7..0eba82931 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,8 @@ "build:npm-extended": "rm -rf npm-extended && babel-node ./scripts/build-npm-extended.js && babel ./npm-extended/lib --out-dir ./npm-extended/lib", "stats": "webpack --config ./webpack/config.prod.babel.js --json > build/stats.json", "test": "bash ./src/__tests__/run.sh", - "test:unit": "jest --verbose -c jest.config.js", + "test:unit": "jest --verbose -c jest.config.unit.js", + "test:integration": "./tests/run.sh", "flow": "flow check src/js", "flow-tests": "flow check src/__tests__", "lint": "eslint src/js", diff --git a/src/js/device/DeviceCommands.js b/src/js/device/DeviceCommands.js index cf18c058c..bfe9369ba 100644 --- a/src/js/device/DeviceCommands.js +++ b/src/js/device/DeviceCommands.js @@ -38,10 +38,10 @@ function assertType(res: DefaultMessageResponse, resType: string) { } function generateEntropy(len: number): Buffer { - if (global.crypto || global.msCrypto) { + try { return randombytes(len); - } else { - throw new Error('Browser does not support crypto random'); + } catch (err) { + throw new Error('Environment does not support crypto random'); } } diff --git a/src/js/index.js b/src/js/index.js index 839825c4a..26d99e73e 100644 --- a/src/js/index.js +++ b/src/js/index.js @@ -29,6 +29,10 @@ const TrezorConnect: API = { eventEmitter.removeListener(type, fn); }, + removeAllListeners: () => { + eventEmitter.removeAllListeners(); + }, + uiResponse, // methods diff --git a/src/js/types/api.js b/src/js/types/api.js index c9eae6fa2..3e962a546 100644 --- a/src/js/types/api.js +++ b/src/js/types/api.js @@ -85,6 +85,7 @@ export type API = { */ on: Emitter; off: Emitter; + removeAllListeners: () => void; uiResponse: (response: Events.UiResponse) => void; diff --git a/src/ts/types/__tests__/index.ts b/src/ts/types/__tests__/index.ts index 491341862..e966f51d1 100644 --- a/src/ts/types/__tests__/index.ts +++ b/src/ts/types/__tests__/index.ts @@ -73,6 +73,8 @@ export const events = async () => { } }); TrezorConnect.off(DEVICE_EVENT, () => {}); + TrezorConnect.removeAllListeners(); + // @ts-ignore TrezorConnect.on('DEVICE-EVENT', () => {}); diff --git a/src/ts/types/api.d.ts b/src/ts/types/api.d.ts index 9c2a2bb9a..ed076686b 100644 --- a/src/ts/types/api.d.ts +++ b/src/ts/types/api.d.ts @@ -64,6 +64,7 @@ export namespace TrezorConnect { function on(type: Events.FirmwareProgress['type'], cb: (event: Events.FirmwareProgress['payload']) => void): void; function on(type: Events.CustomMessageRequest['type'], cb: (event: Events.CustomMessageRequest['payload']) => void): void; function off(type: string, cb: any): void; + function removeAllListeners(): void; function uiResponse(response: Events.UiResponse): void; diff --git a/submodules/trezor-common b/submodules/trezor-common index 669fc83eb..23ee4ad59 160000 --- a/submodules/trezor-common +++ b/submodules/trezor-common @@ -1 +1 @@ -Subproject commit 669fc83eb0fdc8c5aecbfc5a4ae328d1ef66e786 +Subproject commit 23ee4ad593dc52750d0f1f9ab7c66032f10e2c20 diff --git a/tests/__fixtures__/applyFlags.js b/tests/__fixtures__/applyFlags.js new file mode 100644 index 000000000..3af9cfe41 --- /dev/null +++ b/tests/__fixtures__/applyFlags.js @@ -0,0 +1,17 @@ +export default { + method: 'applyFlags', + setup: { + mnemonic: 'mnemonic_12', + }, + tests: [ + { + description: 'Flag 1', + params: { + flags: 1, + }, + result: { + message: 'Flags applied', + }, + }, + ], +}; diff --git a/tests/__fixtures__/applySettings.js b/tests/__fixtures__/applySettings.js new file mode 100644 index 000000000..4c6c313b6 --- /dev/null +++ b/tests/__fixtures__/applySettings.js @@ -0,0 +1,30 @@ +export default { + method: 'applySettings', + setup: { + mnemonic: 'mnemonic_12', + }, + tests: [ + { + description: 'Change label, rotation and passphrase', + params: { + label: 'cool label', + auto_lock_delay: 300, + display_rotation: 90, + use_passphrase: true, + }, + result: { + message: 'Settings applied', + }, + }, + { + description: 'Change auto_lock_delay back', + params: { + auto_lock_delay: 1000, + display_rotation: 0, + }, + result: { + message: 'Settings applied', + }, + }, + ], +}; diff --git a/tests/__fixtures__/binanceSignTransaction.js b/tests/__fixtures__/binanceSignTransaction.js new file mode 100644 index 000000000..92143f61a --- /dev/null +++ b/tests/__fixtures__/binanceSignTransaction.js @@ -0,0 +1,92 @@ +export default { + method: 'binanceSignTransaction', + setup: { + mnemonic: 'offer caution gift cross surge pretty orange during eye soldier popular holiday mention east eight office fashion ill parrot vault rent devote earth cousin', + }, + tests: [ + { + description: 'transfer', + params: { + path: "m/44'/714'/0'/0/0", + transaction: { + chain_id: 'Binance-Chain-Nile', + account_number: 34, + memo: 'test', + sequence: 31, + source: 1, + transfer: { + inputs: [ + { + address: 'tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd', + coins: [ + { amount: 1000000000, denom: 'BNB' }, + ], + }, + ], + outputs: [ + { + address: 'tbnb1ss57e8sa7xnwq030k2ctr775uac9gjzglqhvpy', + coins: [ + { amount: 1000000000, denom: 'BNB' }, + ], + }, + ], + }, + }, + }, + result: { + public_key: '029729a52e4e3c2b4a4e52aa74033eedaf8ba1df5ab6d1f518fd69e67bbd309b0e', + signature: 'faf5b908d6c4ec0c7e2e7d8f7e1b9ca56ac8b1a22b01655813c62ce89bf84a4c7b14f58ce51e85d64c13f47e67d6a9187b8f79f09e0a9b82019f47ae190a4db3', + }, + }, + { + description: 'placeOrder', + params: { + path: "m/44'/714'/0'/0/0", + transaction: { + chain_id: 'Binance-Chain-Nile', + account_number: 34, + memo: '', + sequence: 32, + source: 1, + placeOrder: { + id: 'BA36F0FAD74D8F41045463E4774F328F4AF779E5-33', + ordertype: 2, + price: 100000000, + quantity: 100000000, + sender: 'tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd', + side: 1, + symbol: 'ADA.B-B63_BNB', + timeinforce: 1, + }, + }, + }, + result: { + public_key: '029729a52e4e3c2b4a4e52aa74033eedaf8ba1df5ab6d1f518fd69e67bbd309b0e', + signature: '851fc9542342321af63ecbba7d3ece545f2a42bad01ba32cff5535b18e54b6d3106e10b6a4525993d185a1443d9a125186960e028eabfdd8d76cf70a3a7e3100', + }, + }, + { + description: 'cancelOrder', + params: { + path: "m/44'/714'/0'/0/0", + transaction: { + chain_id: 'Binance-Chain-Nile', + account_number: 34, + memo: '', + sequence: 33, + source: 1, + cancelOrder: { + refid: 'BA36F0FAD74D8F41045463E4774F328F4AF779E5-29', + sender: 'tbnb1hgm0p7khfk85zpz5v0j8wnej3a90w709zzlffd', + symbol: 'BCHSV.B-10F_BNB', + }, + }, + }, + result: { + public_key: '029729a52e4e3c2b4a4e52aa74033eedaf8ba1df5ab6d1f518fd69e67bbd309b0e', + signature: 'd93fb0402b2b30e7ea08e123bb139ad68bf0a1577f38592eb22d11e127f09bbd3380f29b4bf15bdfa973454c5c8ed444f2e256e956fe98cfd21e886a946e21e5', + }, + }, + ], +}; diff --git a/tests/__fixtures__/cardanoGetAddress.js b/tests/__fixtures__/cardanoGetAddress.js new file mode 100644 index 000000000..1d52e3baf --- /dev/null +++ b/tests/__fixtures__/cardanoGetAddress.js @@ -0,0 +1,42 @@ +export default { + method: 'cardanoGetAddress', + setup: { + mnemonic: 'mnemonic_12', + }, + tests: [ + { + description: "m/44'/1815'/0'/0/0", + params: { + path: "m/44'/1815'/0'/0/0", + }, + result: { + address: 'Ae2tdPwUPEZLCq3sFv4wVYxwqjMH2nUzBVt1HFr4v87snYrtYq3d3bq2PUQ', + }, + }, + { + description: "m/44'/1815'", + params: { + path: "m/44'/1815'", + }, + result: false, + }, + { + description: "m/44'/1815'/0'/0/1", + params: { + path: "m/44'/1815'/0'/0/1", + }, + result: { + address: 'Ae2tdPwUPEZEY6pVJoyuNNdLp7VbMB7U7qfebeJ7XGunk5Z2eHarkcN1bHK', + }, + }, + { + description: "m/44'/1815'/0'/0/2", + params: { + path: "m/44'/1815'/0'/0/2", + }, + result: { + address: 'Ae2tdPwUPEZ3gZD1QeUHvAqadAV59Zid6NP9VCR9BG5LLAja9YtBUgr6ttK', + }, + }, + ], +}; diff --git a/tests/__fixtures__/cardanoGetPublicKey.js b/tests/__fixtures__/cardanoGetPublicKey.js new file mode 100644 index 000000000..a3a537e56 --- /dev/null +++ b/tests/__fixtures__/cardanoGetPublicKey.js @@ -0,0 +1,42 @@ +export default { + method: 'cardanoGetPublicKey', + setup: { + mnemonic: 'mnemonic_all', + }, + tests: [ + { + description: "m/44'/1815'/0'/0/0'", + params: { + path: "m/44'/1815'/0'/0/0'", + }, + result: { + publicKey: 'a938c8554ae04616cfaae7cd0eb557475082c4e910242ce774967e0bd7492408cbf6ab47c8eb1a0477fc40b25dbb6c4a99454edb97d6fe5acedd3e238ef46fe0', + }, + }, + { + description: "m/44'/1815'", + params: { + path: "m/44'/1815'", + }, + result: false, + }, + { + description: "m/44'/1815'/0/0/0", + params: { + path: "m/44'/1815'/0/0/0", + }, + result: { + publicKey: '17cc0bf978756d0d5c76f931629036a810c61801b78beecb44555773d13e3791646ac4a6295326bae6831be05921edfbcb362de48dfd37b12e74c227dfad768d', + }, + }, + { + description: "m/44'/1815'/0'/0/0", + params: { + path: "m/44'/1815'/0'/0/0", + }, + result: { + publicKey: 'b90fb812a2268e9569ff1172e8daed1da3dc7e72c7bded7c5bcb7282039f90d5fd8e71c1543de2cdc7f7623130c5f2cceb53549055fa1f5bc88199989e08cce7', + }, + }, + ], +}; diff --git a/tests/__fixtures__/cardanoSignTransaction.js b/tests/__fixtures__/cardanoSignTransaction.js new file mode 100644 index 000000000..eb6ea6a46 --- /dev/null +++ b/tests/__fixtures__/cardanoSignTransaction.js @@ -0,0 +1,92 @@ +// vectors from https://github.com/trezor/trezor-firmware/tree/master/python/trezorlib/tests/device_tests/test_msg_cardano_sign_transaction.py + +export default { + method: 'cardanoSignTransaction', + setup: { + mnemonic: 'mnemonic_all', + }, + tests: [ + { + description: 'signMainnetNoChange', + params: { + inputs: [{ + prev_hash: '1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc', + path: "m/44'/1815'/0'/0/1", + prev_index: 0, + type: 0, + }], + outputs: [ + { + address: 'Ae2tdPwUPEZCanmBz5g2GEwFqKTKpNJcGYPKfDxoNeKZ8bRHr8366kseiK2', + amount: '3003112', + }, + ], + transactions: [ + '839f8200d818582482582008abb575fac4c39d5bf80683f7f0c37e48f4e3d96e37d1f6611919a7241b456600ff9f8282d818582183581cda4da43db3fca93695e71dab839e72271204d28b9d964d306b8800a8a0001a7a6916a51a00305becffa0', + ], + protocol_magic: 764824073, + }, + result: { + hash: '799c65e8a2c0b1dc4232611728c09d3f3eb0d811c077f8e9798f84605ef1b23d', + body: '82839f8200d81858248258201af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc00ff9f8282d818582183581c9e1c71de652ec8b85fec296f0685ca3988781c94a2e1a5d89d92f45fa0001a0d0c25611a002dd2e8ffa0818200d818588582584089053545a6c254b0d9b1464e48d2b5fcf91d4e25c128afb1fcfc61d0843338ea26308151516f3b0e02bb1638142747863c520273ce9bd3e5cd91e1d46fe2a6355840312c01c27317415b0b8acc86aa789da877fe7e15c65b7ea4c4565d8739117f5f6d9d38bf5d058f7be809b2b9b06c1d79fc6b20f9a4d76d8c89bae333edf5680c', + }, + }, + + { + description: 'signMainnetChange', + params: { + inputs: [{ + prev_hash: '1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc', + path: "m/44'/1815'/0'/0/1", + prev_index: 0, + type: 0, + }], + outputs: [ + { + address: 'Ae2tdPwUPEZCanmBz5g2GEwFqKTKpNJcGYPKfDxoNeKZ8bRHr8366kseiK2', + amount: '3003112', + }, + { + path: "m/44'/1815'/0'/0/1", + amount: '1000000', + }, + ], + transactions: [ + '839f8200d818582482582008abb575fac4c39d5bf80683f7f0c37e48f4e3d96e37d1f6611919a7241b456600ff9f8282d818582183581cda4da43db3fca93695e71dab839e72271204d28b9d964d306b8800a8a0001a7a6916a51a00305becffa0', + ], + protocol_magic: 764824073, + }, + result: { + hash: '40bf94518f31aba7779dd99aa71fe867887bcb3e0bac2c6dc33d3f20ec74a6b1', + body: '82839f8200d81858248258201af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc00ff9f8282d818582183581c9e1c71de652ec8b85fec296f0685ca3988781c94a2e1a5d89d92f45fa0001a0d0c25611a002dd2e88282d818582183581cda4da43db3fca93695e71dab839e72271204d28b9d964d306b8800a8a0001a7a6916a51a000f4240ffa0818200d818588582584089053545a6c254b0d9b1464e48d2b5fcf91d4e25c128afb1fcfc61d0843338ea26308151516f3b0e02bb1638142747863c520273ce9bd3e5cd91e1d46fe2a63558400b47193163462023bdb72f03b2f6afc8e3645dbc9252cb70f7516da402ce3b8468e4a60929674de5862d6253315008e07b60aa189f5c455dd272ff1c84c89d0c', + }, + }, + + { + description: 'signTestnet', + params: { + inputs: [{ + prev_hash: '1af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc', + path: "m/44'/1815'/0'/0/1", + prev_index: 0, + type: 0, + }], + outputs: [ + { + address: 'Ae2tdPwUPEZCanmBz5g2GEwFqKTKpNJcGYPKfDxoNeKZ8bRHr8366kseiK2', + amount: '3003112', + }, + ], + transactions: [ + '839f8200d818582482582008abb575fac4c39d5bf80683f7f0c37e48f4e3d96e37d1f6611919a7241b456600ff9f8282d818582183581cda4da43db3fca93695e71dab839e72271204d28b9d964d306b8800a8a0001a7a6916a51a00305becffa0', + ], + protocol_magic: 1097911063, + }, + result: { + hash: '799c65e8a2c0b1dc4232611728c09d3f3eb0d811c077f8e9798f84605ef1b23d', + body: '82839f8200d81858248258201af8fa0b754ff99253d983894e63a2b09cbb56c833ba18c3384210163f63dcfc00ff9f8282d818582183581c9e1c71de652ec8b85fec296f0685ca3988781c94a2e1a5d89d92f45fa0001a0d0c25611a002dd2e8ffa0818200d818588582584089053545a6c254b0d9b1464e48d2b5fcf91d4e25c128afb1fcfc61d0843338ea26308151516f3b0e02bb1638142747863c520273ce9bd3e5cd91e1d46fe2a63558403594ee7e2bfe4c84f886a8336cecb7c42983ce9a057345ebb6294a436087d8db93ca78cf514c7c48edff4c8435f690a5817951e2b55d2db729875ee7cc0f7d08', + }, + }, + + ], +}; diff --git a/tests/__fixtures__/eosGetPublicKey.js b/tests/__fixtures__/eosGetPublicKey.js new file mode 100644 index 000000000..215a6bf54 --- /dev/null +++ b/tests/__fixtures__/eosGetPublicKey.js @@ -0,0 +1,64 @@ +export default { + method: 'eosGetPublicKey', + setup: { + mnemonic: 'mnemonic_abandon', + }, + tests: [ + { + description: "m/44'/194'/0'/0/0", + params: { + path: "m/44'/194'/0'/0/0", + }, + result: { + wifPublicKey: 'EOS6zpSNY1YoLxNt2VsvJjoDfBueU6xC1M1ERJw1UoekL1NHn8KNA', + rawPublicKey: '0315c358024ce46767102578947584c4342a6982b922d454f63588effa34597197', + }, + }, + { + description: "[2147483692, 2147483842, 2147483648, 0, 1]", + params: { + path: [2147483692, 2147483842, 2147483648, 0, 1], + }, + result: { + wifPublicKey: 'EOS62cPUiWnLqbUjiBMxbEU4pm4Hp5X3RGk4KMTadvZNygjX72yHW', + rawPublicKey: '029622eff7248c4d298fe28f2df19ee0d5f7674f678844e05c31d1a5632412869e', + }, + }, + { + description: "m/44'/194'", + params: { + path: "m/44'/194'", + }, + }, + { + description: "[-1]", + params: { + path: [-1], + } + }, + { + description: "m/44'/194'/0'/0/0'", + params: { + bundle: [ + { path: "m/44'/194'/0'/0/0" }, + { path: "m/44'/194'/0'/0/1" }, + { path: "m/44'/194'/0'/0/0'" }, + ], + }, + result: [ + { + wifPublicKey: 'EOS6zpSNY1YoLxNt2VsvJjoDfBueU6xC1M1ERJw1UoekL1NHn8KNA', + rawPublicKey: '0315c358024ce46767102578947584c4342a6982b922d454f63588effa34597197', + }, + { + wifPublicKey: 'EOS62cPUiWnLqbUjiBMxbEU4pm4Hp5X3RGk4KMTadvZNygjX72yHW', + rawPublicKey: '029622eff7248c4d298fe28f2df19ee0d5f7674f678844e05c31d1a5632412869e', + }, + { + wifPublicKey: 'EOS7n7TXwR4Y3DtPt2ji6akhQi5uw4SruuPArvoNJso84vhwPQt1G', + rawPublicKey: '037c9b7d24d42589941cca3f4debc75b37c0e7b881e6eb00d2e674958debe3bbc3', + }, + ], + }, + ], +}; diff --git a/tests/__fixtures__/eosSignTransaction.js b/tests/__fixtures__/eosSignTransaction.js new file mode 100644 index 000000000..4746e26a0 --- /dev/null +++ b/tests/__fixtures__/eosSignTransaction.js @@ -0,0 +1,611 @@ +export default { + method: 'eosSignTransaction', + setup: { + mnemonic: 'mnemonic_12', + }, + tests: [ + { + description: "transfer", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [{ + account: 'eosio.token', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'transfer', + data: { + from: 'miniminimini', + to: 'maximaximaxi', + quantity: '1.0000 EOS', + memo: 'testtest', + }, + }], + }, + }, + result: { + signature: 'SIG_K1_JveDuew7oyKjgLmApra3NmKArx3QH6HVmatgkLYeUYWv7aGaoQPFyjBwAdcxuo2Skq9wRgsizos92h9iq9i5JbeHh7zNuo', + }, + }, + { + description: "delegate", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [{ + account: 'eosio', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'delegatebw', + data: { + from: 'miniminimini', + receiver: 'maximaximaxi', + stake_net_quantity: '1.0000 EOS', + stake_cpu_quantity: '1.0000 EOS', + transfer: true, + }, + }], + }, + }, + result: { + signature: 'SIG_K1_Juju8Wjzyn38nuvgS1KT3koKQLHxMMfqVHrp5jMjv4QLU2pUG6EbiJD7D1EHE6xP8DRuwFLVUNR38nTyUKC1Eiz33WocUE', + }, + }, + { + description: "undelegate", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [{ + account: 'eosio', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'undelegatebw', + data: { + from: 'miniminimini', + receiver: 'maximaximaxi', + unstake_net_quantity: '1.0000 EOS', + unstake_cpu_quantity: '1.0000 EOS', + }, + }], + }, + }, + result: { + signature: 'SIG_K1_K3XXUzCUkT2HEdrJTz1CdDDKZbLMShmyEjknQozGhy4F21yUetr1nEe2vUgmGebk2nyYe49R5nkA155J5yFBBaLsTcSdBL', + }, + }, + { + description: "buyRam", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [{ + account: 'eosio', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'buyram', + data: { + payer: 'miniminimini', + receiver: 'miniminimini', + quant: '1000000000.0000 EOS', + }, + }], + }, + }, + result: { + signature: 'SIG_K1_K4gU5S9g7rS6MojaPwWppEBCBbPrJm1pyJtVR9mts1sBq5xyN7nJv3FGnrBR7ByjanboCtK4ogY35sNPFX1F5qoZW7BkF9', + }, + }, + { + description: "buyRamBytes", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [{ + account: 'eosio', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'buyrambytes', + data: { + payer: 'miniminimini', + receiver: 'miniminimini', + bytes: 1023, + }, + }], + }, + }, + result: { + signature: 'SIG_K1_K618wK9f27YxHoPG9hoUCsazZXzxumBj3V9MqcTUh9yCocvP1uFZQAmGmZLhsAtuC2TRR4gtqbeQj57FniYd5i4faQCb6t', + }, + }, + { + description: "sellRam", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [{ + account: 'eosio', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'sellram', + data: { + account: 'miniminimini', + bytes: 1024, + }, + }], + }, + }, + result: { + signature: 'SIG_K1_JusrCS7H5DR53qke7edoWvJuLiQS2VQ84CsN5NWmWYVa7wmJVjh3Hcg5hH42zF8KjAmmvHtaJZ3wkortTW9eds1eoiKsrj', + }, + }, + { + description: "voteProducer", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [{ + account: 'eosio', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'voteproducer', + data: { + voter: 'miniminimini', + proxy: '', + producers: [ + 'argentinaeos', + 'bitfinexeos1', + 'cryptolions1', + 'eos42freedom', + 'eosamsterdam', + 'eosasia11111', + 'eosauthority', + 'eosbeijingbp', + 'eosbixinboot', + 'eoscafeblock', + 'eoscanadacom', + 'eoscannonchn', + 'eoscleanerbp', + 'eosdacserver', + 'eosfishrocks', + 'eosflytomars', + 'eoshuobipool', + 'eosisgravity', + 'eoslaomaocom', + 'eosliquideos', + 'eosnewyorkio', + 'eosriobrazil', + 'eosswedenorg', + 'eostribeprod', + 'helloeoscnbp', + 'jedaaaaaaaaa', + 'libertyblock', + 'starteosiobp', + 'teamgreymass', + ], + }, + }], + }, + }, + result: { + signature: 'SIG_K1_JxgVhc6ExoTHee3Djrciwmmf2Xck7NLgvAtC2gfgV4Wj2AqMXEb6aKMhpUcTV59VTR1DdnPF1XbiCcJViJiU3zsk1kQz89', + }, + }, + { + description: "refund", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [{ + account: 'eosio', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'refund', + data: { + owner: 'miniminimini', + }, + }], + }, + }, + result: { + signature: 'SIG_K1_JwWZSSKQZL1hCdMmwEAKjs3r15kau5gaBrQczKy65QANANzovV6U4XbVUZQkZzaQrNGYAtgxrU1WJ1smWgXZNqtKVQUZqc', + }, + }, + { + description: "updateAuth", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [{ + account: 'eosio', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'updateauth', + data: { + account: 'miniminimini', + permission: 'active', + parent: 'owner', + auth: { + threshold: 1, + keys: [ + { + weight: 1, + key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', + }, + { + weight: 2, + key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', + }, + ], + accounts: [{ + permission: { + actor: 'miniminimini', + permission: 'active', + }, + weight: 3, + }], + waits: [ + { + wait_sec: 55, + weight: 4, + }, + ], + }, + }, + }], + }, + }, + result: { + signature: 'SIG_K1_JuNuwmJm7nLfpxbCqXZMxZoU56TzBh8F5PH7ZyPvQMti6QxJbErDGbKCAaHhoRxwWKzv5kj6kX3WyWys6jAzVe9pDhXB1k', + }, + }, + { + description: "deleteAuth", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [{ + account: 'eosio', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'deleteauth', + data: { + account: 'maximaximaxi', + permission: 'active', + }, + }], + }, + }, + result: { + signature: 'SIG_K1_KjPTp8jCtgBKQWqsndhrH4pdCGiks76Q1qBt9e8MtexW6FQg3FzfVFKDU4SvyVDyFs3worn6RyW6WYavw76ACNqcqkCYjf', + }, + }, + { + description: "linkAuth", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [{ + account: 'eosio', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'linkauth', + data: { + account: 'maximaximaxi', + code: 'eosbet', + type: 'whatever', + requirement: 'active', + }, + }], + }, + }, + result: { + signature: 'SIG_K1_Kgs3JdLNqTyGz7uyNiuYLK8sy5qhVQWozrBY7bJWKsjrWAxNyDQUKqHsHmTom5rGY21vYdXmCpi4msU6XeMgWvi4bsBxTx', + }, + }, + { + description: "unlinkAuth", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [{ + account: 'eosio', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'unlinkauth', + data: { + account: 'miniminimini', + code: 'eosbet', + type: 'whatever', + }, + }], + }, + }, + result: { + signature: 'SIG_K1_K1ioB5KMRC2mmTwYsGwsFU51ENp1XdSBUrb4bxUCLYhoq7Y733WaLZ4Soq9fdrkaJS8uJ3R7Z1ZjyEKRHU8HU4s4MA86zB', + }, + }, + { + description: "newAccount", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [ + { + account: 'eosio', + authorization: [{ + actor: 'miniminimini', + permission: 'active', + }], + name: 'newaccount', + data: { + creator: 'miniminimini', + name: 'maximaximaxi', + owner: { + threshold: 1, + keys: [ + { + key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', + weight: 1, + }, + ], + accounts: [], + waits: [], + }, + active: { + threshold: 1, + keys: [ + { + key: 'EOS8Dkj827FpinZBGmhTM28B85H9eXiFH5XzvLoeukCJV5sKfLc6K', + weight: 1, + }, + ], + accounts: [], + waits: [], + }, + }, + }, + { + account: 'eosio', + name: 'buyrambytes', + authorization: [ + {actor: 'miniminimini', permission: 'active'}, + ], + data: { + payer: 'miniminimini', + receiver: 'maximaximaxi', + bytes: 4096, + }, + }, + { + account: 'eosio', + name: 'delegatebw', + authorization: [ + {actor: 'miniminimini', permission: 'active'}, + ], + data: { + from: 'miniminimini', + receiver: 'maximaximaxi', + stake_net_quantity: '1.0000 EOS', + stake_cpu_quantity: '1.0000 EOS', + transfer: true, + }, + }, + ], + }, + }, + result: { + signature: 'SIG_K1_KhjdS1gKUHR4jKbN3YSdNbPbEqnUVM1Nt6ybdzEAwsUtfbCRJDwpQwPRuEau48CyvhYC5fKo5BiWMPQJbQPrg5ErHThieU', + }, + }, + { + description: "setContract", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-06-19T13:29:53', + refBlockNum: 30587, + refBlockPrefix: 338239089, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [ + { + account: 'eosio1', + name: 'setcode', + authorization: [ + {'actor': 'ednazztokens', 'permission': 'active'}, + ], + data: '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', + }, + { + account: 'eosio1', + name: 'setabi', + authorization: [ + {'actor': 'ednazztokens', 'permission': 'active'}, + ], + data: '00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', + }, + ], + }, + }, + result: { + signature: 'SIG_K1_KiG8c8t2SQkSfrEbD9BwJoYT133BPFLx3gu8sAzJadXyFk1EXKYAsgx4tkjt79G6ofuaQzJPAfDqy1FSpgLRbhbeFH9omd', + }, + }, + { + description: "unknown", + params: { + path: "m/44'/194'/0'/0/0", + transaction: { + chainId: 'cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f', + header: { + expiration: '2018-07-14T10:43:28', + refBlockNum: 6439, + refBlockPrefix: 2995713264, + maxNetUsageWords: 0, + maxCpuUsageMs: 0, + delaySec: 0, + }, + actions: [ + { + 'account': 'foocontract', + 'name': 'baraction', + 'authorization': [ + {'actor': 'miniminimini', 'permission': 'active'}, + ], + 'data': 'deadbeef', + }, + ], + }, + }, + result: { + signature: 'SIG_K1_JvoJtrHpQJjHAZzEBhiQm75iimYabcAVNDvz8mkempLh6avSJgnXm5JzCCUEBjDtW3syByfXknmgr93Sw3P9RNLnwySmv6', + }, + }, + ], +}; diff --git a/tests/__fixtures__/getAddress.js b/tests/__fixtures__/getAddress.js new file mode 100644 index 000000000..182a6fe5d --- /dev/null +++ b/tests/__fixtures__/getAddress.js @@ -0,0 +1,88 @@ +export default { + method: 'getAddress', + setup: { + mnemonic: 'mnemonic_12', + }, + tests: [ + { + description: 'Bitcoin bech32 first address', + params: { + path: "m/84'/0'/0'/0/0", + coin: 'btc', + }, + result: { + address: 'bc1qkkr2uvry034tsj4p52za2pg42ug4pxg5qfxyfa', + }, + }, + { + description: 'Bitcoin p2sh first address', + params: { + path: "m/49'/0'/0'/0/0", + coin: 'btc', + }, + result: { + address: '3AnYTd2FGxJLNKL1AzxfW3FJMntp9D2KKX', + }, + }, + { + description: 'Bitcoin p2sh first address (path as array)', + params: { + path: [2147483697, 2147483648, 2147483648, 0, 0], + coin: 'Bitcoin', + }, + result: { + address: '3AnYTd2FGxJLNKL1AzxfW3FJMntp9D2KKX', + }, + }, + { + description: 'Bitcoin p2sh first change address', + params: { + path: "m/49'/0'/0'/1/0", + coin: 'btc', + }, + result: { + address: '3DDuECA7AomS7GSf5G2NAF6djKEqF2qma5', + }, + }, + { + description: 'Bitcoin p2pkh first address', + params: { + path: "m/44'/0'/0'/0/0", + coin: 'btc', + }, + result: { + address: '1FH6ehAd5ZFXCM1cLGzHxK1s4dGdq1JusM', + }, + }, + { + description: 'Litecoin p2sh first address', + params: { + path: "m/49'/2'/0'/0/0", + coin: 'ltc', + }, + result: { + address: 'MFoQRU1KQq365Sy3cXhix3ygycEU4YWB1V', + }, + }, + { + description: 'Testnet p2sh first address', + params: { + path: "m/49'/1'/0'/0/0", + coin: 'tbtc', + }, + result: { + address: '2N4dH9yn4eYnnjHTYpN9xDmuMRS2k1AHWd8', + }, + }, + { + description: 'Bitcoin Cash first address', + params: { + path: "m/44'/145'/0'/0/0", + coin: 'bcash', + }, + result: { + address: 'bitcoincash:qzqxk2q6rhy3j9fnnc00m08g4n5dm827xv2dmtjzzp', + }, + }, + ], +}; diff --git a/tests/__fixtures__/getPublicKey.js b/tests/__fixtures__/getPublicKey.js new file mode 100644 index 000000000..06fcecf2f --- /dev/null +++ b/tests/__fixtures__/getPublicKey.js @@ -0,0 +1,67 @@ +export default { + method: 'getPublicKey', + setup: { + mnemonic: 'mnemonic_12', + }, + tests: [ + { + description: 'Bitcoin bech32 first account', + params: { + path: "m/84'/0'/0'", + coin: 'btc', + }, + result: { + xpub: 'xpub6Bmuozp73G1Ng4FtB1dzVJ9WGg6BcMn5xgUd7rQ8NybSHytQjkyfqMZfJ635zoHMYZoMuS4uCEz86SPLpvfFQxQe1acY5U7FzX9yL5DyRAe', + xpubSegwit: 'zpub6qSSRL9wLd6LNee7qjDEuULWccP5Vbm5nuX4geBu8zMCQBWsF5Jo5UswLVxFzcbCMr2yQPG27ZhDs1cUGKVH1RmqkG1PFHkEXyHG7EV3ogY', + }, + }, + { + description: 'Bitcoin p2sh first account', + params: { + path: "m/49'/0'/0'", + coin: 'btc', + }, + result: { + xpub: 'xpub6DExuxjQ16sWy5TF4KkLV65YGqCJ5pyv7Ej7d9yJNAXz7C1M9intqszXfaNZG99KsDJdQ29wUKBTZHZFXUaPbKTZ5Z6f4yowNvAQ8fEJw2G', + xpubSegwit: 'ypub6Y5EDdQK9nQzpNeMtgXxhBB3SoLk2SyR2MFLQYsBkAusAHpaQNxTTwefgnL9G3oFGrRS9VkVvyY1SaApFAzQPZ99wto5etdReeE3XFkkMZt', + }, + }, + { + description: 'Bitcoin p2sh first account (path as array)', + params: { + path: [2147483697, 2147483648, 2147483648], + coin: 'Bitcoin', + }, + result: { + xpub: 'xpub6DExuxjQ16sWy5TF4KkLV65YGqCJ5pyv7Ej7d9yJNAXz7C1M9intqszXfaNZG99KsDJdQ29wUKBTZHZFXUaPbKTZ5Z6f4yowNvAQ8fEJw2G', + xpubSegwit: 'ypub6Y5EDdQK9nQzpNeMtgXxhBB3SoLk2SyR2MFLQYsBkAusAHpaQNxTTwefgnL9G3oFGrRS9VkVvyY1SaApFAzQPZ99wto5etdReeE3XFkkMZt', + }, + }, + { + description: 'Bitcoin p2pkh first account', + params: { + path: "m/44'/0'/0'", + coin: 'bitcoin', + }, + result: { + xpub: 'xpub6D1weXBcFAo8CqBbpP4TbH5sxQH8ZkqC5pDEvJ95rNNBZC9zrKmZP2fXMuve7ZRBe18pWQQsGg68jkq24mZchHwYENd8cCiSb71u3KD4AFH', + }, + }, + { + description: 'Invalid path', + params: { + path: [-1], + coin: 'ltc', + }, + result: false, + }, + { + description: 'Invalid path (too short)', + params: { + path: [0, 1], + coin: 'Litecoin', + }, + result: false, + }, + ], +}; diff --git a/tests/__fixtures__/index.js b/tests/__fixtures__/index.js new file mode 100644 index 000000000..e0f5f60cc --- /dev/null +++ b/tests/__fixtures__/index.js @@ -0,0 +1,68 @@ +import applyFlags from './applyFlags'; +import applySettings from './applySettings'; +import getAddress from './getAddress'; +import getPublicKey from './getPublicKey'; +import signTransaction from './signTransaction'; +import rippleGetAddress from './rippleGetAddress'; +import binanceSignTransaction from './binanceSignTransaction'; +// import wipeDevice from './wipeDevice'; +// import resetDevice from './resetDevice'; +import cardanoGetAddress from './cardanoGetAddress'; +import cardanoGetPublicKey from './cardanoGetPublicKey'; +import cardanoSignTransaction from './cardanoSignTransaction'; +import eosGetPublicKey from './eosGetPublicKey'; +import eosSignTransaction from './eosSignTransaction'; + +export default [ + applyFlags, + applySettings, + // // BackupDevice.js + // // BinanceGetAddress.js + // // BinanceGetPublicKey.js + binanceSignTransaction, + cardanoGetAddress, + cardanoGetPublicKey, + cardanoSignTransaction, + // // ChangePin.js + // // CipherKeyValue.js + // // ComposeTransaction.js + // // CustomMessage.js + eosGetPublicKey, + eosSignTransaction, + // // EthereumGetAddress.js + // // EthereumGetPublicKey.js + // // EthereumSignMessage.js + // // EthereumSignTransaction.js + // // EthereumVerifyMessage.js + // // FirmwareUpdate.js + // // GetAccountInfo.js + getAddress, + // // GetDeviceState.js + // // GetFeatures.js + getPublicKey, + // // GetSettings.js + // // LiskGetAddress.js + // // LiskGetPublicKey.js + // // LiskSignMessage.js + // // LiskSignTransaction.js + // // LiskVerifyMessage.js + // // LoadDevice.js + // // NEMGetAddress.js + // // NEMSignTransaction.js + // // PushTransaction.js + // // RecoveryDevice.js + // // RequestLogin.js + // // ResetDevice.js + rippleGetAddress, + // // RippleSignTransaction.js + // // SignMessage.js + signTransaction, + // // StellarGetAddress.js + // // StellarSignTransaction.js + // // TezosGetAddress.js + // // TezosGetPublicKey.js + // // TezosSignTransaction.js + // // VerifyMessage.js + // wipeDevice, // some error, will solve later + // // resetDevice, // socket hangup, what? fix +]; diff --git a/tests/__fixtures__/resetDevice.js b/tests/__fixtures__/resetDevice.js new file mode 100644 index 000000000..65b19b39d --- /dev/null +++ b/tests/__fixtures__/resetDevice.js @@ -0,0 +1,18 @@ +export default { + method: 'resetDevice', + setup: { + wipe: true, + }, + // todo: can't run multiple resets, will get already initialized. maybe change beforeAll to beforeEach? + tests: [ + { + description: 'Reset device', + params: { + skipBackup: true, + }, + result: { + message: 'Initialized', + }, + }, + ], +}; diff --git a/tests/__fixtures__/rippleGetAddress.js b/tests/__fixtures__/rippleGetAddress.js new file mode 100644 index 000000000..e42f5f919 --- /dev/null +++ b/tests/__fixtures__/rippleGetAddress.js @@ -0,0 +1,33 @@ +export default { + method: 'rippleGetAddress', + setup: { + mnemonic: 'mnemonic_12', + }, + tests: [ + { + description: 'first account', + params: { + path: "m/44'/144'/0'/0/0", + }, + result: { + address: 'rh5ZnEVySAy7oGd3nebT3wrohGDrsNS83E', + }, + }, + { + description: 'second account', + params: { + path: "m/44'/144'/1'/0/0", + }, + result: { + address: 'rEpwmtmvx8gkMhX5NLdU3vutQt7dor4MZm', + }, + }, + { + description: 'Forbidden key path', + params: { + path: "m/44'/0'/1'", + }, + result: false, + }, + ], +}; diff --git a/tests/__fixtures__/signTransaction.js b/tests/__fixtures__/signTransaction.js new file mode 100644 index 000000000..686c2e641 --- /dev/null +++ b/tests/__fixtures__/signTransaction.js @@ -0,0 +1,169 @@ +// const lotsOfOutputs = () => { +// const outputs = []; +// const total = 255; +// for (let i = 0; i < total; i++) { +// const output = { +// address: '1NwN6UduuVkJi6sw3gSiKZaCY5rHgVXC2h', +// amount: Math.floor((100000 + 2540000 - 39000) / total).toString(), +// script_type: 'PAYTOADDRESS', +// }; + +// outputs.push(output); +// } +// return outputs; +// }; + +// let serializedTx = '0100000002fb792f470a58993e14964c9bd46cdf37cb4bbc3f61540cb651580c82ed243ec6010000006b483045022100969da46f94a81f34f3717b014e0c3e1826eda1b0022ec2f9ce39f3d750ab9235022026da269770993211a1503413566a339bbb4389a482fffcf8e1f76713fc3b94f5012103477b9f0f34ae85434ce795f0c5e1e90c9420e5b5fad084d7cce9a487b94a7902ffffffffe56582d2119100cb1d3da8232291e053f71e25fb669c87b32a667749959ea239010000006a473044022052e1419bb237b9db400ab5e3df16db6355619d545fde9030924a360763ae9ad40220704beab04d72ecaeb42eca7d98faca7a0941e65f2e1341f183be2b83e6b09e1c012103477b9f0f34ae85434ce795f0c5e1e90c9420e5b5fad084d7cce9a487b94a7902fffffffffdff00'; +// serializedTx = serializedTx + 'd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088ac'.repeat(255); +// serializedTx = serializedTx + '00000000'; + +export default { + method: 'signTransaction', + setup: { + mnemonic: 'mnemonic_12', + }, + tests: [ + { + description: '1 input, 1 output, no change (legacy address_n: [0])', + params: { + inputs: [ + { + address_n: [0], + prev_hash: 'd5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882', + prev_index: 0, + }, + ], + outputs: [ + { + address: '1MJ2tj2ThBE62zXbBYA5ZaN3fdve5CPAz1', + amount: '380000', + script_type: 'PAYTOADDRESS', + }, + ], + coin: 'btc', + }, + result: { + serializedTx: '010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b4830450221009a0b7be0d4ed3146ee262b42202841834698bb3ee39c24e7437df208b8b7077102202b79ab1e7736219387dffe8d615bbdba87e11477104b867ef47afed1a5ede7810121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0160cc0500000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac00000000', + }, + }, + { + description: '1 input, 1 output, 1 change', + params: { + inputs: [ + { + address_n: [44 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 0, 5], + prev_hash: '50f6f1209ca92d7359564be803cb2c932cde7d370f7cee50fd1fad6790f6206d', + prev_index: 1, + }, + ], + outputs: [ + { + address_n: [44 | 0x80000000, 1 | 0x80000000, 0 | 0x80000000, 1, 3], + amount: '30000', + script_type: 'PAYTOADDRESS', + }, + { + address: '1Up15Msx4sbvUCGm8Xgo2Zp5FQim3wE59', + amount: '10000', + script_type: 'PAYTOADDRESS', + }, + ], + coin: 'btc', + }, + result: { + signatures: ['304402200aad33a2fa9994b1aedb062486808b7e85406c2745359a02d57d617cd48298b80220394320f7409359a56061d050eeba0ba27b1ac9e3e0aa4501427f58766381f34d'], + serializedTx: '01000000016d20f69067ad1ffd50ee7c0f377dde2c932ccb03e84b5659732da99c20f1f650010000006a47304402200aad33a2fa9994b1aedb062486808b7e85406c2745359a02d57d617cd48298b80220394320f7409359a56061d050eeba0ba27b1ac9e3e0aa4501427f58766381f34d0121035c85bf271936439f0a25b9ba175593a178fcf7c5476f6c8a4621f50b1de93b3effffffff0230750000000000001976a91489a0db486cbff44de5b4bdf30e04cf66f73224db88ac10270000000000001976a91405427736705cfbfaff76b1cff48283707fb1037088ac00000000', + }, + }, + { + // tx d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882 + description: '1 input, 2 outputs, 1 change', + params: { + inputs: [ + { + address_n: [0], + prev_hash: 'd5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882', + prev_index: 0, + }, + ], + outputs: [ + { + address: '1MJ2tj2ThBE62zXbBYA5ZaN3fdve5CPAz1', + amount: '288000', + script_type: 'PAYTOADDRESS', + }, + { + address: '13uaUYn6XAooo88QvAqAVsiVvr2mAXutqP', + amount: '12000', + script_type: 'PAYTOADDRESS', + }, + { + address_n: [1], + amount: '80000', + script_type: 'PAYTOADDRESS', + }, + ], + coin: 'btc', + }, + result: { + serializedTx: '010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b483045022100e695e2c530c7c0fc32e6b79b7cff56a7f70a8c9da787534f46b4204070f914fc02207b0879a81408a11e23b11d4c7965c62b5fc6d5c2d92340f5ee2da7b40e99314a0121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0300650400000000001976a914de9b2a8da088824e8fe51debea566617d851537888ace02e0000000000001976a9141fe1d337fb81afca42818051e12fd18245d1b17288ac80380100000000001976a9140223b1a09138753c9cb0baf95a0a62c82711567a88ac00000000', + }, + }, + { + description: '2 inputs, 1 output, 1 change', + params: { + inputs: [ + { + address_n: [1], + prev_hash: 'c6be22d34946593bcad1d2b013e12f74159e69574ffea21581dad115572e031c', + prev_index: 1, + }, + { + address_n: [2], + prev_hash: '58497a7757224d1ff1941488d23087071103e5bf855f4c1c44e5c8d9d82ca46e', + prev_index: 1, + }, + ], + outputs: [ + { + address: '15Jvu3nZNP7u2ipw2533Q9VVgEu2Lu9F2B', + amount: '100000', + script_type: 'PAYTOADDRESS', + }, + { + address_n: [3], + amount: '100000', + script_type: 'PAYTOADDRESS', + }, + ], + coin: 'btc', + }, + result: { + serializedTx: '01000000021c032e5715d1da8115a2fe4f57699e15742fe113b0d2d1ca3b594649d322bec6010000006b483045022100f773c403b2f85a5c1d6c9c4ad69c43de66930fff4b1bc818eb257af98305546a0220443bde4be439f276a6ce793664b463580e210ec6c9255d68354449ac0443c76501210338d78612e990f2eea0c426b5e48a8db70b9d7ed66282b3b26511e0b1c75515a6ffffffff6ea42cd8d9c8e5441c4c5f85bfe50311078730d2881494f11f4d2257777a4958010000006b48304502210090cff1c1911e771605358a8cddd5ae94c7b60cc96e50275908d9bf9d6367c79f02202bfa72e10260a146abd59d0526e1335bacfbb2b4401780e9e3a7441b0480c8da0121038caebd6f753bbbd2bb1f3346a43cd32140648583673a31d62f2dfb56ad0ab9e3ffffffff02a0860100000000001976a9142f4490d5263906e4887ca2996b9e207af3e7824088aca0860100000000001976a914812c13d97f9159e54e326b481b8f88a73df8507a88ac00000000', + }, + }, + // { + // description: '2 inputs, 255 outputs', + // customTimeout: 500000, + // params: { + // inputs: [ + // { + // address_n: [3], + // prev_hash: 'c63e24ed820c5851b60c54613fbc4bcb37df6cd49b4c96143e99580a472f79fb', + // prev_index: 1, + // }, + // { + // address_n: [3], + // prev_hash: '39a29e954977662ab3879c66fb251ef753e0912223a83d1dcb009111d28265e5', + // prev_index: 1, + // }, + // ], + // outputs: lotsOfOutputs(), + // coin: 'btc', + // }, + // result: { + // serializedTx: serializedTx, + // }, + // }, + ], +}; diff --git a/tests/__fixtures__/wipeDevice.js b/tests/__fixtures__/wipeDevice.js new file mode 100644 index 000000000..eef43d3a0 --- /dev/null +++ b/tests/__fixtures__/wipeDevice.js @@ -0,0 +1,15 @@ +export default { + method: 'wipeDevice', + setup: { + mnemonic: 'mnemonic_12', + }, + tests: [ + { + description: 'Wipe device', + params: {}, + result: { + message: 'Device wiped', + }, + }, + ], +}; diff --git a/tests/common.setup.js b/tests/common.setup.js new file mode 100644 index 000000000..a13694dc5 --- /dev/null +++ b/tests/common.setup.js @@ -0,0 +1,83 @@ +import Controller from './websocket-client'; +import TrezorConnect, { UI } from '../src/js/index'; + +const MNEMONICS = { + 'mnemonic_all': 'all all all all all all all all all all all all', + 'mnemonic_12': 'alcohol woman abuse must during monitor noble actual mixed trade anger aisle', + 'mnemonic_abandon': 'abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about', +}; + +function sleep(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +const setup = async (controller, options) => { + try { + await controller.connect(); + await controller.send({ type: 'emulator-start', version: '2.2.0' }); + // todo: find a way how to remove these sleeps, but it fails with them as well so we probably don't need + // them. the problem seem to be in the python server and some race condition in it causing it to fail + await controller.send({ type: 'bridge-start' }); + await sleep(501); + if (options.wipe) { + await controller.send({ type: 'emulator-wipe' }); + } else { + const mnemonic = typeof options.mnemonic === 'string' && options.mnemonic.indexOf(' ') > 0 ? options.mnemonic : MNEMONICS[options.mnemonic]; + try { + await controller.send({ + type: 'emulator-setup', + mnemonic, + pin: options.pin || '', + passphrase_protection: false, + label: options.label || 'TrezorT', + backup: false, + options, + }); + } catch (err) { + // just add more error, most of the time it fails here. + throw new Error('controller.emu-setup: ' + err) + } + } + } catch (err) { + // --bail in jest is not enough + process.exit(1) + } +}; + + +const initTrezorConnect = async (controller, options) => { + const onUiRequestConfirmation = () => { + TrezorConnect.uiResponse({ + type: UI.RECEIVE_CONFIRMATION, + payload: true, + }); + } + + const onUiRequestButton = async (event) => { + controller.send({ type: 'emulator-decision' }); + } + + TrezorConnect.removeAllListeners(); + + await TrezorConnect.init({ + manifest: { + appUrl: 'a', + email: 'b', + }, + webusb: false, + debug: false, + popup: false, + ...options, + }); + + TrezorConnect.on(UI.REQUEST_CONFIRMATION, onUiRequestConfirmation); + + TrezorConnect.on(UI.REQUEST_BUTTON, onUiRequestButton); +}; + +global.Trezor = { + setup, + initTrezorConnect, + TrezorConnect, + Controller, +}; diff --git a/tests/device/methods.test.js b/tests/device/methods.test.js new file mode 100644 index 000000000..79ed527c5 --- /dev/null +++ b/tests/device/methods.test.js @@ -0,0 +1,60 @@ +import fixtures from '../__fixtures__'; +const { setup, initTrezorConnect, Controller, TrezorConnect } = global.Trezor; + +let controller; + +fixtures.forEach((testCase, i) => { + describe(`TrezorConnect.${testCase.method}`, () => { + beforeAll(async (done) => { + try { + const c = new Controller({ url: 'ws://localhost:9001/', name: testCase.method }); + await setup(c, testCase.setup); + await initTrezorConnect(c); + c.on('error', () => { + controller = undefined; + console.log("WS error", error) + }); + c.on('disconnect', () => { + controller = undefined; + console.log("WS disco") + }); + controller = c; + done(); + } catch (error) { + console.log("init error", error) + done(error); + } + }, 40000); + + afterAll(async (done) => { + TrezorConnect.dispose(); + if (controller) { + await controller.send({ type: 'bridge-stop' }); + await controller.send({ type: 'emulator-stop' }); + await controller.disconnect(); + controller = undefined; + } + done(); + }); + + testCase.tests.forEach(t => { + it(t.description, async (done) => { + if (t.customTimeout) { + jest.setTimeout(t.customTimeout); + } + if (!controller) { + done('Controller not found'); + return; + } + controller.options.name = t.description; + const result = await TrezorConnect[testCase.method](t.params); + const expected = t.result ? { success: true, payload: t.result } : { success: false }; + expect(result).toMatchObject(expected); + if (t.customTimeout) { + jest.setTimeout(20000); + } + done(); + }); + }); + }); +}); diff --git a/tests/jest.setup.js b/tests/jest.setup.js index e69de29bb..66196e3f0 100644 --- a/tests/jest.setup.js +++ b/tests/jest.setup.js @@ -0,0 +1,5 @@ +jest.setTimeout(20000); + +global.JestMocks = { + +}; diff --git a/tests/run.sh b/tests/run.sh new file mode 100755 index 000000000..c87e9ee70 --- /dev/null +++ b/tests/run.sh @@ -0,0 +1,58 @@ + +function cleanup { + echo "cleanup" + + # print out all docker logs on cleanup + # docker logs $id + + # stop trezor-env container + id=$(docker ps -aqf "name=connect-tests") + echo $id + [ $id ] && docker stop $id + echo "ran ${i} times" +} + +trap cleanup EXIT + +echo "to run in ci use './run.sh ci'" + +i=0 +retry="${1-1}" +echo "retry times if failed: ${retry}" +RET=1 + +until [ $i -eq $retry ]; do + echo "run number: ${i}" + [ $i -gt 0 ] && echo "status code from previous run: ${RET}" + + if [ "$2" = "ci" ] + then + docker run --rm -d \ + --name connect-tests \ + -e SDL_VIDEODRIVER="dummy" \ + --network="host" \ + mroz22/trezor-user-env \ + bash -c "rm -rf /var/tmp/trezor.flash && python3 ./main.py" + + yarn jest --config jest.config.integration.js --verbose --detectOpenHandles --forceExit --runInBand --bail + else + xhost + + docker run --rm -d \ + --name connect-tests \ + --ipc host \ + -e DISPLAY=$DISPLAY \ + -e QT_X11_NO_MITSHM=1 \ + -v /tmp/.X11-unix:/tmp/.X11-unix:rw \ + --network="host" \ + mroz22/trezor-user-env \ + bash -c "rm -rf /var/tmp/trezor.flash && python3 ./main.py" + # todo: all this bash -c part should be moved to COMMAND or ENTRYPOINT command in docker + yarn jest --config jest.config.integration.js --verbose --detectOpenHandles --forceExit --runInBand --bail + fi + RET=$? + ((i+=1)) + [ $RET -eq 0 ] && exit 0 + cleanup +done + +exit 1 \ No newline at end of file diff --git a/tests/websocket-client.js b/tests/websocket-client.js new file mode 100644 index 000000000..c50137471 --- /dev/null +++ b/tests/websocket-client.js @@ -0,0 +1,243 @@ +/* @flow */ + +import WebSocket from 'ws'; +import { EventEmitter } from 'events'; + +const NOT_INITIALIZED = new Error('websocket_not_initialized'); + +export function createDeferred(id: number | string): Deferred { + // intentionally ignore below lines in test coverage, they will be overridden in promise creation + /* istanbul ignore next */ + let localResolve: (t: T) => void = () => {}; + /* istanbul ignore next */ + let localReject: (e?: Error) => void = () => {}; + + const promise: Promise = new Promise(async (resolve, reject) => { + localResolve = resolve; + localReject = reject; + }); + + return { + id, + resolve: localResolve, + reject: localReject, + promise, + }; +} + +const DEFAULT_TIMEOUT = 6000; +// const DEFAULT_PING_TIMEOUT = 50 * 1000; + +export default class Socket extends EventEmitter { + options: any; + ws: WebSocket | undefined; + messageID: number = 0; + messages: Deferred[] = []; + subscriptions: Subscription[] = []; + pingTimeout: ReturnType | undefined; + connectionTimeout: ReturnType | undefined; + disconnectRequest: Deferred | undefined; + + constructor(options: Options) { + super(); + this.setMaxListeners(Infinity); + this.options = options; + } + + setConnectionTimeout() { + this.clearConnectionTimeout(); + this.connectionTimeout = setTimeout( + this.onTimeout.bind(this), + this.options.timeout || DEFAULT_TIMEOUT + ); + } + + clearConnectionTimeout() { + if (this.connectionTimeout) { + clearTimeout(this.connectionTimeout); + this.connectionTimeout = undefined; + } + } + + setPingTimeout() { + // if (this.pingTimeout) { + // clearTimeout(this.pingTimeout); + // } + // this.pingTimeout = setTimeout( + // this.onPing.bind(this), + // this.options.pingTimeout || DEFAULT_PING_TIMEOUT + // ); + } + + onTimeout() { + const { ws } = this; + if (!ws) return; + if (ws.listenerCount('open') > 0) { + ws.emit('error', 'Websocket timeout'); + try { + ws.close(); + } catch (error) { + // empty + } + } else { + this.messages.forEach(m => m.reject(new Error('Websocket timeout ' + this.options.name))); + ws.close(); + } + } + + async onPing() { + // make sure that connection is alive if there are subscriptions + // if (this.ws && this.isConnected()) { + // if (this.subscriptions.length > 0 || this.options.keepAlive) { + // await this.getBlockHash(0); + // } else { + // try { + // this.ws.close(); + // } catch (error) { + // // empty + // } + // } + // } + } + + onError() { + this.dispose(); + } + + send(params) { + const { ws } = this; + if (!ws) throw NOT_INITIALIZED; + const id = this.messageID; + + const dfd = createDeferred(id); + const req = { + id, + ...params, + }; + + this.messageID++; + this.messages.push(dfd); + + this.setConnectionTimeout(); + this.setPingTimeout(); + + ws.send(JSON.stringify(req)); + return dfd.promise; + } + + onmessage(message) { + try { + const resp = JSON.parse(message); + const { id, success } = resp; + const dfd = this.messages.find(m => m.id === id); + if (dfd) { + if (!success) { + dfd.reject(new Error(resp.error)); + } else { + dfd.resolve(resp); + } + this.messages.splice(this.messages.indexOf(dfd), 1); + } + } catch (error) { + // empty + } + + if (this.messages.length === 0) { + this.clearConnectionTimeout(); + } + this.setPingTimeout(); + } + + connect() { + // url validation + let { url } = this.options; + if (typeof url !== 'string') { + throw new Error('websocket_no_url'); + } + + if (url.startsWith('https')) { + url = url.replace('https', 'wss'); + } + if (url.startsWith('http')) { + url = url.replace('http', 'ws'); + } + + // set connection timeout before WebSocket initialization + // it will be be cancelled by this.init or this.dispose after the error + this.setConnectionTimeout(); + + // create deferred promise + const dfd = createDeferred(-1); + + // initialize connection + const ws = new WebSocket(url); + ws.once('error', error => { + this.dispose(); + dfd.reject(error); + }); + ws.on('open', () => { + this.init(); + dfd.resolve(); + }); + + this.ws = ws; + + // wait for onopen event + return dfd.promise; + } + + init() { + const { ws } = this; + if (!ws || !this.isConnected()) { + throw Error('Blockbook websocket init cannot be called'); + } + // clear timeout from this.connect + this.clearConnectionTimeout(); + + // remove previous listeners and add new listeners + ws.removeAllListeners(); + ws.on('error', this.onError.bind(this)); + ws.on('message', this.onmessage.bind(this)); + ws.on('close', () => { + if (this.disconnectRequest) { + this.disconnectRequest.resolve(); + } + this.emit('disconnected'); + this.dispose(); + }); + } + + disconnect() { + if (this.ws) { + this.ws.close(); + } + // this.dispose(); + this.disconnectRequest = createDeferred(0); + return this.disconnectRequest.promise; + } + + isConnected() { + const { ws } = this; + return ws && ws.readyState === WebSocket.OPEN; + } + + dispose() { + if (this.pingTimeout) { + clearTimeout(this.pingTimeout); + } + if (this.connectionTimeout) { + clearTimeout(this.connectionTimeout); + } + + const { ws } = this; + if (this.isConnected()) { + this.disconnect(); + } + if (ws) { + ws.removeAllListeners(); + } + + this.removeAllListeners(); + this.disconnectRequest = undefined; + } +} From a4ca2907a380845108b21fbee8e28bd14fbfb033 Mon Sep 17 00:00:00 2001 From: martin <30367552+mroz22@users.noreply.github.com> Date: Thu, 9 Apr 2020 12:57:34 +0200 Subject: [PATCH 48/51] fw update fix - base url without trailing slash and better error (#557) --- src/js/core/methods/FirmwareUpdate.js | 35 +++++++++++++++------------ 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/src/js/core/methods/FirmwareUpdate.js b/src/js/core/methods/FirmwareUpdate.js index cd0da2b75..ad0402aef 100644 --- a/src/js/core/methods/FirmwareUpdate.js +++ b/src/js/core/methods/FirmwareUpdate.js @@ -42,7 +42,7 @@ export default class FirmwareUpdate extends AbstractMethod { // either receive version and btcOnly version: payload.version, btcOnly: payload.btcOnly, - baseUrl: payload.baseUrl || 'https://wallet.trezor.io/', + baseUrl: payload.baseUrl || 'https://wallet.trezor.io', // or binary binary: payload.binary, }; @@ -73,21 +73,24 @@ export default class FirmwareUpdate extends AbstractMethod { const { device } = this; let binary; - - if (this.params.binary) { - binary = this.params.binary; - } else { - const firmware = await getBinary({ - // features and releases are used for sanity checking inside @trezor/rollout - features: device.features, - releases: DataManager.assets[`firmware-t${device.features.major_version}`], - // version argument is used to find and fetch concrete release from releases list - version: this.params.version, - btcOnly: this.params.btcOnly, - baseUrl: this.params.baseUrl, - baseUrlBeta: 'https://beta-wallet.trezor.io/', - }); - binary = firmware.binary; + try { + if (this.params.binary) { + binary = this.params.binary; + } else { + const firmware = await getBinary({ + // features and releases are used for sanity checking inside @trezor/rollout + features: device.features, + releases: DataManager.assets[`firmware-t${device.features.major_version}`], + // version argument is used to find and fetch concrete release from releases list + version: this.params.version, + btcOnly: this.params.btcOnly, + baseUrl: this.params.baseUrl, + baseUrlBeta: 'https://beta-wallet.trezor.io', + }); + binary = firmware.binary; + } + } catch (err) { + throw new Error('Failed to download firmware binary'); } return uploadFirmware( From 5c8448fb9f77019f0328a6465bac9668837a055f Mon Sep 17 00:00:00 2001 From: martin <30367552+mroz22@users.noreply.github.com> Date: Mon, 13 Apr 2020 17:26:27 +0200 Subject: [PATCH 49/51] empty capabilities if no firmware (#559) * empty capabilities if no firmware * remove deprecated firmware from relases.json --- src/data/firmware/2/releases.json | 13 ------------- src/js/utils/deviceFeaturesUtils.js | 2 +- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/src/data/firmware/2/releases.json b/src/data/firmware/2/releases.json index c86a76c7b..6b9e2cff2 100644 --- a/src/data/firmware/2/releases.json +++ b/src/data/firmware/2/releases.json @@ -1,17 +1,4 @@ [ - { - "required": false, - "version": [2, 2, 0], - "min_bridge_version": [2, 0, 7], - "min_firmware_version": [2, 0, 8], - "min_bootloader_version": [2, 0, 0], - "url": "data/firmware/2/trezor-2.2.0.bin", - "url_bitcoinonly": "data/firmware/2/trezor-2.2.0-bitcoinonly.bin", - "fingerprint": "1df674a59e718199a381cb10885ac4ba4ef580161da4fac3bbd95e989f428b7b", - "fingerprint_bitcoinonly": "f48e49cf3ab6369eeb3fbe4ede008b1ca6becc8f99eac3388111f93dccfc4c43", - "channel": "beta", - "changelog": "* Introduce Wipe code\n* U2F UX improvements\n* Fix continuous display blinking with Android in U2F\n* Rework Recovery persistence internally\n* Add screen for time bounds in Stellar" - }, { "required": false, "version": [2, 1, 8], diff --git a/src/js/utils/deviceFeaturesUtils.js b/src/js/utils/deviceFeaturesUtils.js index ce9ae285f..aacb73f28 100644 --- a/src/js/utils/deviceFeaturesUtils.js +++ b/src/js/utils/deviceFeaturesUtils.js @@ -43,7 +43,7 @@ const DEFAULT_CAPABILITIES_T1 = [1, 2, 5, 7, 8, 10, 12, 14]; const DEFAULT_CAPABILITIES_TT = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]; export const parseCapabilities = (features?: Features): string[] => { - if (!features) return []; // no features - no capabilities + if (!features || features.firmware_present === false) return []; // no features or no firmware - no capabilities // needs to be "any" since Features.capabilities are declared as string[] but in fact it's a number[] const filter = (c: any) => CAPABILITIES[c] || 'Capability_Unknown_trezor-connect'; // fallback for older firmware From 441121db789f3831b95aa39a141ac071b8741390 Mon Sep 17 00:00:00 2001 From: martin <30367552+mroz22@users.noreply.github.com> Date: Tue, 14 Apr 2020 17:19:35 +0200 Subject: [PATCH 50/51] fix unreadable hid device (#558) * fix unreadable hid device * flow 'fix' I don't like very much * trigger ci --- src/js/device/DeviceList.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/device/DeviceList.js b/src/js/device/DeviceList.js index 10aa3a097..da1d08fa0 100644 --- a/src/js/device/DeviceList.js +++ b/src/js/device/DeviceList.js @@ -168,9 +168,9 @@ export default class DeviceList extends EventEmitter { this.stream = stream; if (this.transportPlugin && this.transportPlugin.name === 'WebUsbPlugin') { - const { unreadableHidDevice, unreadableHidDeviceChange } = this.transportPlugin; + const { unreadableHidDeviceChange } = this.transportPlugin; unreadableHidDeviceChange.on('change', async () => { - if (unreadableHidDevice) { + if (this.transportPlugin && this.transportPlugin.unreadableHidDevice) { const device = await this._createUnacquiredDevice({ path: DEVICE.UNREADABLE, session: null, debugSession: null, debug: false }); this.devices[DEVICE.UNREADABLE] = device; this.emit(DEVICE.CONNECT_UNACQUIRED, device.toMessageObject()); From ed42ded092434fd514a3acd732fbc44bbd9fa6d3 Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 15 Apr 2020 09:07:42 +0200 Subject: [PATCH 51/51] update FW releases --- src/data/firmware/1/releases.json | 13 +++++++++++++ src/data/firmware/2/releases.json | 28 ++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/data/firmware/1/releases.json b/src/data/firmware/1/releases.json index 807e9ca7a..f060de600 100644 --- a/src/data/firmware/1/releases.json +++ b/src/data/firmware/1/releases.json @@ -1,4 +1,17 @@ [ + { + "required": false, + "version": [1, 9, 0], + "bootloader_version": [1, 8, 0], + "min_bridge_version": [2, 0, 25], + "min_firmware_version": [1, 6, 2], + "min_bootloader_version": [1, 5, 0], + "url": "data/firmware/1/trezor-1.9.0.bin", + "url_bitcoinonly": "data/firmware/1/trezor-1.9.0-bitcoinonly.bin", + "fingerprint": "1f40d1e68f9d182888b5b60da5209eff047ec68fcc96a5c9b61b0e55dd07d458", + "fingerprint_bitcoinonly": "93a670dd20d044bf76cfce6eecd2a85918acdebe616229dbb31250fd03a33870", + "changelog": "*Introduce Wipe Code\n* Introduce passphrase cache" + }, { "required": false, "version": [1, 8, 3], diff --git a/src/data/firmware/2/releases.json b/src/data/firmware/2/releases.json index 6b9e2cff2..378bf9885 100644 --- a/src/data/firmware/2/releases.json +++ b/src/data/firmware/2/releases.json @@ -1,10 +1,22 @@ [ + { + "required": false, + "version": [2, 3, 0], + "min_bridge_version": [2, 0, 7], + "min_firmware_version": [2, 0, 8], + "min_bootloader_version": [2, 0, 0], + "url": "data/firmware/2/trezor-2.3.0.bin", + "url_bitcoinonly": "data/firmware/2/trezor-2.3.0-bitcoinonly.bin", + "fingerprint": "212929f63fe1393e2ff57e06537a38cff281e3cfb3a4e17235079e2f08871e6c", + "fingerprint_bitcoinonly": "bddc0fd3b52fd32d94b776048f62b3d03dcb6ab90140e482a042a2863093115f", + "changelog": "* Introduce Wipe code\n* Introduce SD card protection\n* Introduce passphrase cache\n* U2F UX improvements\n* Security fixes" + }, { "required": false, "version": [2, 1, 8], "min_bridge_version": [2, 0, 7], - "min_firmware_version": [2, 1, 0], - "min_bootloader_version": [2, 0, 3], + "min_firmware_version": [2, 0, 8], + "min_bootloader_version": [2, 0, 0], "url": "data/firmware/2/trezor-2.1.8.bin", "url_bitcoinonly": "data/firmware/2/trezor-2.1.8-bitcoinonly.bin", "fingerprint": "8a5fa12132651b6e33344fd025d0d90885f5cc1c342427ebcea4f0ae98b50d8c", @@ -15,8 +27,8 @@ "required": false, "version": [2, 1, 7], "min_bridge_version": [2, 0, 7], - "min_firmware_version": [2, 1, 0], - "min_bootloader_version": [2, 0, 3], + "min_firmware_version": [2, 0, 8], + "min_bootloader_version": [2, 0, 0], "url": "data/firmware/2/trezor-2.1.7.bin", "url_bitcoinonly": "data/firmware/2/trezor-2.1.7-bitcoinonly.bin", "fingerprint": "acf1b4c6fec3624a8fc53f9130ff53d690c3fa1c134bd4ca3e58ee7b5a0441d8", @@ -27,8 +39,8 @@ "required": false, "version": [2, 1, 6], "min_bridge_version": [2, 0, 7], - "min_firmware_version": [2, 1, 0], - "min_bootloader_version": [2, 0, 3], + "min_firmware_version": [2, 0, 8], + "min_bootloader_version": [2, 0, 0], "url": "data/firmware/2/trezor-2.1.6.bin", "url_bitcoinonly": "data/firmware/2/trezor-2.1.6-bitcoinonly.bin", "fingerprint": "e2032ad84108a85d4014d477b955b9181a1a56e6f222ef21bb7d47b503a02f0b", @@ -40,7 +52,7 @@ "version": [2, 1, 5], "min_bridge_version": [2, 0, 7], "min_firmware_version": [2, 1, 0], - "min_bootloader_version": [2, 0, 3], + "min_bootloader_version": [2, 0, 0], "url": "data/firmware/2/trezor-2.1.5.bin", "url_bitcoinonly": "data/firmware/2/trezor-2.1.5-bitcoinonly.bin", "fingerprint": "40e4bfaf3c5ec77872c1aaaac085aafcc443f60279ca2bb38d29c669233fdf62", @@ -52,7 +64,7 @@ "version": [2, 1, 4], "min_bridge_version": [2, 0, 7], "min_firmware_version": [2, 1, 0], - "min_bootloader_version": [2, 0, 3], + "min_bootloader_version": [2, 0, 0], "url": "data/firmware/2/trezor-2.1.4.bin", "fingerprint": "820611a92605b1ccc612b9bf8550617aec6962bd2484fcb6ae4792bc498654e4", "changelog": "* Shamir Backup with Recovery persistence\n* Touchscreen freeze fix\n* Fix display of non-divisible OMNI amounts"