diff --git a/lib/index.js b/lib/index.js index 7df0c8b..5eb6dd0 100644 --- a/lib/index.js +++ b/lib/index.js @@ -8,14 +8,14 @@ var _yargs = _interopRequireDefault(require("yargs")); var _nodePty = require("node-pty"); -var _nknMulticlient = _interopRequireDefault(require("nkn-multiclient")); - -var _nknWallet = _interopRequireDefault(require("nkn-wallet")); +var _nknSdk = _interopRequireDefault(require("nkn-sdk")); var _crypto = require("crypto"); var _child_process = require("child_process"); +var _isomorphicWs = _interopRequireDefault(require("isomorphic-ws")); + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } let argv = _yargs.default.command('$0', 'start nshd').command('addr', 'show addr').option('base-dir', { @@ -105,7 +105,9 @@ try { } try { - wallet = _nknWallet.default.loadJsonWallet(walletJson, password); + wallet = _nknSdk.default.Wallet.fromJSON(walletJson, { + password + }); } catch (e) { console.error('Parse wallet error:', e); process.exit(1); @@ -123,9 +125,11 @@ try { console.log('Create password and save to file', passwordFile); } - wallet = _nknWallet.default.newWallet(password); + wallet = new _nknSdk.default.Wallet({ + password + }); - _fs.default.writeFileSync(walletFile, wallet.toJSON()); + _fs.default.writeFileSync(walletFile, JSON.stringify(wallet)); console.log('Create wallet and save to file', walletFile); } @@ -213,7 +217,7 @@ function getAuthorizedUser(src) { return null; } -const client = (0, _nknMulticlient.default)({ +const client = new _nknSdk.default.MultiClient({ seed: wallet.getSeed(), identifier: identifier }); @@ -239,19 +243,16 @@ class Session { delete sessions[this.remoteAddr]; }); - this.flushSession = () => { + this.flushSession = async () => { if (this.outputBuffer.length > 0) { - let res = { - stdout: this.outputBuffer - }; - this.outputBuffer = ''; - try { - this.client.send(this.remoteAddr, JSON.stringify(res), { - msgHoldingSeconds: 0 - }).catch(e => { - console.error("Send msg error:", e); + let res = { + stdout: this.outputBuffer + }; + await this.client.send(this.remoteAddr, JSON.stringify(res), { + noReply: true }); + this.outputBuffer = ''; } catch (e) { console.error("Send msg error:", e); } @@ -280,14 +281,13 @@ class Session { } let sessions = {}; -client.on('connect', () => { +client.onConnect(() => { console.log('Listening at', client.addr); - for (let i = 0, length = client.clients.length; i < length; i++) { - let c = client.clients[i]; + for (let c of Object.values(client.clients)) { setInterval(function () { try { - c.ws && c.ws.ping && c.ws.ping(); + c.ws && c.ws.readyState === _isomorphicWs.default.OPEN && c.ws.ping && c.ws.ping(); } catch (e) { console.warn('Websocket ping error:', e); } @@ -297,9 +297,7 @@ client.on('connect', () => { let lastUpdateTime = new Date(); setInterval(async function () { try { - await client.send(client.addr, '', { - msgHoldingSeconds: 0 - }); + await client.send(client.addr, ''); lastUpdateTime = new Date(); } catch (e) { console.warn('Multiclient ping error:', e); @@ -307,15 +305,20 @@ client.on('connect', () => { if (new Date().getTime() - lastUpdateTime.getTime() > pingInterval * 3) { console.log('Multiclient keepalive timeout, trying to reconnect...'); - for (let i = 0, length = client.clients.length; i < length; i++) { - client.clients[i].reconnect(); + for (let c of Object.values(client.clients)) { + c.reconnect(); } } } }, pingInterval); }); -client.on('message', async (src, payload, payloadType, encrypt) => { - if (!encrypt) { +client.onMessage(async ({ + src, + payload, + payloadType, + isEncrypted +}) => { + if (!isEncrypted) { console.log('Received unencrypted msg from', src); return false; } @@ -331,7 +334,7 @@ client.on('message', async (src, payload, payloadType, encrypt) => { return false; } - if (payloadType === _nknMulticlient.default.PayloadType.BINARY) { + if (payloadType !== _nknSdk.default.pb.payloads.PayloadType.TEXT) { console.log('Received msg with wrong payload type from', src); return false; } @@ -408,7 +411,7 @@ client.on('message', async (src, payload, payloadType, encrypt) => { try { await client.send(src, JSON.stringify(res), { - msgHoldingSeconds: 0 + noReply: true }); } catch (e) { console.error("Send msg error:", e); diff --git a/package.json b/package.json index ef34490..b765d8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nkn-shell-daemon", - "version": "1.0.6", + "version": "1.0.7", "description": "NKN Shell Daemon", "main": "nshd.js", "bin": { @@ -28,8 +28,7 @@ }, "homepage": "https://nkn.org", "dependencies": { - "nkn-multiclient": "^0.0.8", - "nkn-wallet": "^0.4.7", + "nkn-sdk": "^1.1.1", "node-pty": "^0.9.0", "yargs": "^14.2.0" }, diff --git a/src/index.js b/src/index.js index bb105a5..13f4170 100644 --- a/src/index.js +++ b/src/index.js @@ -2,10 +2,10 @@ import fs from 'fs' import os from 'os' import yargs from 'yargs' import { spawn } from 'node-pty' -import nknClient from 'nkn-multiclient' -import nknWallet from 'nkn-wallet' +import nkn from 'nkn-sdk' import { randomBytes } from 'crypto' import { exec, execSync } from 'child_process' +import WebSocket from 'isomorphic-ws' let argv = yargs .command('$0', 'start nshd') @@ -107,7 +107,7 @@ try { process.exit(1) } try { - wallet = nknWallet.loadJsonWallet(walletJson, password) + wallet = nkn.Wallet.fromJSON(walletJson, { password }) } catch (e) { console.error('Parse wallet error:', e) process.exit(1) @@ -121,8 +121,8 @@ try { fs.writeFileSync(passwordFile, password) console.log('Create password and save to file', passwordFile) } - wallet = nknWallet.newWallet(password) - fs.writeFileSync(walletFile, wallet.toJSON()) + wallet = new nkn.Wallet({ password }) + fs.writeFileSync(walletFile, JSON.stringify(wallet)) console.log('Create wallet and save to file', walletFile) } if (showAddr) { @@ -199,7 +199,7 @@ function getAuthorizedUser(src) { return null } -const client = nknClient({ +const client = new nkn.MultiClient({ seed: wallet.getSeed(), identifier: identifier, }) @@ -227,16 +227,14 @@ class Session { delete sessions[this.remoteAddr] }) - this.flushSession = () => { + this.flushSession = async () => { if (this.outputBuffer.length > 0) { - let res = { - stdout: this.outputBuffer - } - this.outputBuffer = '' try { - this.client.send(this.remoteAddr, JSON.stringify(res), { msgHoldingSeconds: 0 }).catch(e => { - console.error("Send msg error:", e) - }); + let res = { + stdout: this.outputBuffer + }; + await this.client.send(this.remoteAddr, JSON.stringify(res), { noReply: true }) + this.outputBuffer = '' } catch (e) { console.error("Send msg error:", e) } @@ -264,14 +262,13 @@ class Session { let sessions = {} -client.on('connect', () => { +client.onConnect(() => { console.log('Listening at', client.addr) - for (let i = 0, length = client.clients.length; i < length; i++) { - let c = client.clients[i] + for (let c of Object.values(client.clients)) { setInterval(function () { try { - c.ws && c.ws.ping && c.ws.ping() + c.ws && c.ws.readyState === WebSocket.OPEN && c.ws.ping && c.ws.ping() } catch (e) { console.warn('Websocket ping error:', e) } @@ -281,22 +278,22 @@ client.on('connect', () => { let lastUpdateTime = new Date() setInterval(async function () { try { - await client.send(client.addr, '', { msgHoldingSeconds: 0 }) + await client.send(client.addr, '') lastUpdateTime = new Date() } catch (e) { console.warn('Multiclient ping error:', e) if (new Date().getTime() - lastUpdateTime.getTime() > pingInterval * 3) { console.log('Multiclient keepalive timeout, trying to reconnect...') - for (let i = 0, length = client.clients.length; i < length; i++) { - client.clients[i].reconnect() + for (let c of Object.values(client.clients)) { + c.reconnect() } } } }, pingInterval) }) -client.on('message', async (src, payload, payloadType, encrypt) => { - if (!encrypt) { +client.onMessage(async ({ src, payload, payloadType, isEncrypted }) => { + if (!isEncrypted) { console.log('Received unencrypted msg from', src) return false } @@ -311,7 +308,7 @@ client.on('message', async (src, payload, payloadType, encrypt) => { return false } - if (payloadType === nknClient.PayloadType.BINARY) { + if (payloadType !== nkn.pb.payloads.PayloadType.TEXT) { console.log('Received msg with wrong payload type from', src) return false } @@ -378,7 +375,7 @@ client.on('message', async (src, payload, payloadType, encrypt) => { } } try { - await client.send(src, JSON.stringify(res), { msgHoldingSeconds: 0 }) + await client.send(src, JSON.stringify(res), { noReply: true }) } catch (e) { console.error("Send msg error:", e) } diff --git a/yarn.lock b/yarn.lock index 61f96cf..13a90e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -686,6 +686,23 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@nkn/ncp@^1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@nkn/ncp/-/ncp-1.0.6.tgz#74b6f0a9ea02803a5d0c2a4b48bff6784b409e9a" + integrity sha512-qMFNZ9eN9z+lWEonyJ2V60y5mQeUxhUl4KBGiqhgBquY11RObEmWuUZ7GS5+N6AeJ7N1uMQQCFb2m8EKKNAuqw== + dependencies: + "@nodeguy/channel" "^0.6.6" + core-js-pure "^3.6.4" + google-protobuf "^3.11.2" + heap "^0.2.6" + +"@nodeguy/channel@^0.6.6": + version "0.6.6" + resolved "https://registry.yarnpkg.com/@nodeguy/channel/-/channel-0.6.6.tgz#21e6c6402533f047ef511b838d3ee94813a36bc6" + integrity sha512-5azDfNQk/XlZg9NpDw5LI8TQi2yvktPvxaE/4NXS4c941paVVES44Kzwqx3bhAU3hYMfLlhrW0RCGdEGGeZ7dQ== + dependencies: + setimmediate "1.0.5" + "@types/yargs-parser@*": version "13.1.0" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.1.0.tgz#c563aa192f39350a1d18da36c5a8da382bbd8228" @@ -776,23 +793,17 @@ async-each@^1.0.1: resolved "https://registry.yarnpkg.com/async-each/-/async-each-1.0.3.tgz#b727dbf87d7651602f06f4d4ac387f47d91b0cbf" integrity sha512-z/WhQ5FPySLdvREByI2vZiTWwCnF0moMJ1hK9YQwDTHKh6I7/uSckMetoRGb5UBZPC1z0jlw+n/XCgjeH7y1AQ== -async-limiter@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/async-limiter/-/async-limiter-1.0.1.tgz#dd379e94f0db8310b08291f9d64c3209766617fd" - integrity sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ== - atob@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -axios@>=0.18.1: - version "0.19.0" - resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.0.tgz#8e09bff3d9122e133f7b8101c8fbdd00ed3d2ab8" - integrity sha512-1uvKqKQta3KBxIz14F2v06AEHZ/dIoeKfbTRkK1E5oqjDnuEerLmYTgJB5AiQZHJcljpg1TuRzdjDR06qNk0DQ== +axios@^0.19.2: + version "0.19.2" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.19.2.tgz#3ea36c5d8818d0d5f8a8a97a6d36b86cdc00cb27" + integrity sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA== dependencies: follow-redirects "1.5.10" - is-buffer "^2.0.2" babel-plugin-dynamic-import-node@^2.3.0: version "2.3.0" @@ -806,10 +817,10 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= -base-x@3.0.4: - version "3.0.4" - resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.4.tgz#94c1788736da065edb1d68808869e357c977fa77" - integrity sha512-UYOadoSIkEI/VrRGSG6qp93rp2WdokiAiNYDfGW5qURAY8GiAQkvMbwNNSDYiVJopqv4gCna7xqf4rrNGp+5AA== +base-x@^3.0.7: + version "3.0.8" + resolved "https://registry.yarnpkg.com/base-x/-/base-x-3.0.8.tgz#1e1106c2537f0162e8b52474a557ebb09000018d" + integrity sha512-Rl/1AWP4J/zRrk54hhlxH4drNxPJXYUaKffODVI53/dAsV4t9fBxyxYKAVPU1XBHxYwOWP9h9H0hM2MVw4YfJA== dependencies: safe-buffer "^5.0.1" @@ -874,10 +885,10 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== -buffer@^5.2.1: - version "5.4.2" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.4.2.tgz#2012872776206182480eccb2c0fba5f672a2efef" - integrity sha512-iy9koArjAFCzGnx3ZvNA6Z0clIbbFgbdWQ0mKD3hO0krOrZh8UgA6qMKcZvwLJxS+D6iVR76+5/pV56yMNYTag== +buffer@^5.4.3: + version "5.5.0" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.5.0.tgz#9c3caa3d623c33dd1c7ef584b89b88bf9c9bc1ce" + integrity sha512-9FTEDjLjwoAkEwyMGDjYJQN2gfRgOKBKRfiglhvibGbpeeU/pQn1bJxQqm32OD/AIeEuHxU9roxXxg34Byp/Ww== dependencies: base64-js "^1.0.2" ieee754 "^1.1.4" @@ -994,11 +1005,6 @@ commondir@^1.0.1: resolved "https://registry.yarnpkg.com/commondir/-/commondir-1.0.1.tgz#ddd800da0c66127393cca5950ea968a3aaf1253b" integrity sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs= -complex.js@2.0.10: - version "2.0.10" - resolved "https://registry.yarnpkg.com/complex.js/-/complex.js-2.0.10.tgz#afac74e4fb9131e8709f9c300420ce58fa36f18d" - integrity sha512-PsT3WqpnTjS2ijoMM8XodCi/BYO04vkS8kBg1YXcqf5KcnKVV6uXUc1eeLHhBksj8i7Vu9iQF2/6ZG9gqI6CPQ== - component-emitter@^1.2.1: version "1.3.0" resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" @@ -1034,6 +1040,11 @@ core-js-compat@^3.1.1: browserslist "^4.7.1" semver "^6.3.0" +core-js-pure@^3.6.4: + version "3.6.5" + resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.6.5.tgz#c79e75f5e38dbc85a662d91eea52b8256d53b813" + integrity sha512-lacdXOimsiD0QyNf9BC/mxivNJ/ybBGJXQFKzRekp1WTHoVUWsUHEn+2T8GJAzzIhyOuXA+gOxCVN3l+5PLPUA== + core-js@^2.6.5: version "2.6.10" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.10.tgz#8a5b8391f8cc7013da703411ce5b585706300d7f" @@ -1049,18 +1060,10 @@ core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -cross-fetch@^2.2.2: - version "2.2.3" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-2.2.3.tgz#e8a0b3c54598136e037f8650f8e823ccdfac198e" - integrity sha512-PrWWNH3yL2NYIb/7WF/5vFG3DCQiXDOVf8k3ijatbrtnwNuhMWLC7YF7uqf53tbTFDzHIUD8oITw4Bxt8ST3Nw== - dependencies: - node-fetch "2.1.2" - whatwg-fetch "2.0.4" - -crypto-js@3.1.9-1, crypto-js@^3.1.9-1: - version "3.1.9-1" - resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-3.1.9-1.tgz#fda19e761fc077e01ffbfdc6e9fdfc59e8806cd8" - integrity sha1-/aGedh/Ad+Af+/3G6f38WeiAbNg= +crypto-js@^3.1.9-1: + version "3.3.0" + resolved "https://registry.yarnpkg.com/crypto-js/-/crypto-js-3.3.0.tgz#846dd1cce2f68aacfa156c8578f926a609b7976b" + integrity sha512-DIT51nX0dCfKltpRiXV+/TVZq+Qq2NgF4644+K7Ttnla7zEzqc+kjJyiB96BHNyUTBxyjzRcZYpUdZa+QAqi6Q== debug@=3.1.0: version "3.1.0" @@ -1095,15 +1098,10 @@ decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha1-9lNNFRSCabIDUue+4m9QH5oZEpA= -decimal.js@10.0.1: - version "10.0.1" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.0.1.tgz#d04b16b277f0f9af09671cee225c4882e8857c58" - integrity sha512-vklWB5C4Cj423xnaOtsUmAv0/7GqlXIgDv2ZKDyR64OV3OSzGHNx2mk4p/1EKnB5s70k73cIOOEcG9YzF0q4Lw== - -decimal.js@9.0.1: - version "9.0.1" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-9.0.1.tgz#1cc8b228177da7ab6498c1cc06eb130a290e6e1e" - integrity sha512-2h0iKbJwnImBk4TGk7CG1xadoA0g3LDPlQhQzbZ221zvG0p2YVUedbKIPsOZXKZGx6YmZMJKYOalpCMxSdDqTQ== +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" @@ -1154,12 +1152,12 @@ detect-libc@^1.0.2: resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b" integrity sha1-+hN8S9aY7fVc1c0CrFWfkaTEups= -ed2curve@^0.2.1: - version "0.2.1" - resolved "https://registry.yarnpkg.com/ed2curve/-/ed2curve-0.2.1.tgz#22e6aaa3569e3c4dbf4eefa29612ec329e58190c" - integrity sha1-Iuaqo1aePE2/Tu+ilhLsMp5YGQw= +ed2curve@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/ed2curve/-/ed2curve-0.3.0.tgz#322b575152a45305429d546b071823a93129a05d" + integrity sha512-8w2fmmq3hv9rCrcI7g9hms2pMunQr1JINfcjwR9tAyZqhtyaMN991lF/ZfHfr5tzZQ8c7y7aBgZbjfbd0fjFwQ== dependencies: - tweetnacl "0.x.x" + tweetnacl "1.x.x" electron-to-chromium@^1.3.284: version "1.3.293" @@ -1196,21 +1194,6 @@ es-to-primitive@^1.2.0: is-date-object "^1.0.1" is-symbol "^1.0.2" -es6-promise@4.2.4: - version "4.2.4" - resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-4.2.4.tgz#dc4221c2b16518760bd8c39a52d8f356fc00ed29" - integrity sha512-/NdNZVJg+uZgtm9eS3O6lrOLYmQag2DjdEXuPaHlZ6RuVqgqaVZfgYCepEIKsLqwdQArOPtC3XzRLqGGfT8KQQ== - -es6-promise@^4.2.4: - 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== - -escape-latex@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/escape-latex/-/escape-latex-1.0.3.tgz#1b9085e3e66570faabe21f05655643f64e78717a" - integrity sha512-GfKaG/7FOKdIdciylIzgaShBTPjdGQ5LJ2EcKLKXPLpcMO1MvCEVotkhydEShwCINRacZr2r3fk5A1PwZ4e5sA== - escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -1301,11 +1284,6 @@ for-in@^1.0.2: resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= -fraction.js@4.0.8: - version "4.0.8" - resolved "https://registry.yarnpkg.com/fraction.js/-/fraction.js-4.0.8.tgz#e53618112e3b36b348c61a81323173bceb01e418" - integrity sha512-8Jx2AkFIFQtFaF8wP7yUIW+lnCgzPbxsholryMZ+oPK6kKjY/nUrvMKtq1+A8aSAeFau7+G/zfO8aGk2Aw1wCA== - fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" @@ -1392,10 +1370,10 @@ globals@^11.1.0: resolved "https://registry.yarnpkg.com/globals/-/globals-11.12.0.tgz#ab8795338868a0babd8525758018c2a7eb95c42e" integrity sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA== -google-protobuf@^3.6.1, google-protobuf@^3.7.1: - version "3.9.1" - resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.9.1.tgz#87e6a16b7fb16405b515a6c6622d5ace45578d86" - integrity sha512-tkz7SVwBktFbqFK3teXFUY/VM57+mbUgV9bSD+sZH1ocHJ7uk7BfEWMRdU24dd0ciUDokreA7ghH2fYFIczQdw== +google-protobuf@^3.11.2: + version "3.11.4" + resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.11.4.tgz#598ca405a3cfa917a2132994d008b5932ef42014" + integrity sha512-lL6b04rDirurUBOgsY2+LalI6Evq8eH5TcNzi7TYQ3BsIWelT0KSOQSBsXuavEkNf+odQU6c0lgz3UsZXeNX9Q== graceful-fs@^4.1.11: version "4.2.2" @@ -1455,6 +1433,11 @@ has@^1.0.1, has@^1.0.3: dependencies: function-bind "^1.1.1" +heap@^0.2.6: + version "0.2.6" + resolved "https://registry.yarnpkg.com/heap/-/heap-0.2.6.tgz#087e1f10b046932fc8594dd9e6d378afc9d1e5ac" + integrity sha1-CH4fELBGky/IWU3Z5tN4r8nR5aw= + homedir-polyfill@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz#743298cef4e5af3e194161fbadcc2151d3a058e8" @@ -1532,11 +1515,6 @@ is-buffer@^1.1.5: resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== -is-buffer@^2.0.2: - version "2.0.3" - resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-2.0.3.tgz#4ecf3fcf749cbd1e472689e109ac66261a25e725" - integrity sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw== - is-callable@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" @@ -1660,16 +1638,6 @@ is-windows@^1.0.2: resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== -is@3.2.1: - version "3.2.1" - resolved "https://registry.yarnpkg.com/is/-/is-3.2.1.tgz#d0ac2ad55eb7b0bec926a5266f6c662aaa83dca5" - integrity sha1-0Kwq1V63sL7JJqUmb2xmKqqD3KU= - -is@^3.2.1: - version "3.3.0" - resolved "https://registry.yarnpkg.com/is/-/is-3.3.0.tgz#61cff6dd3c4193db94a3d62582072b44e5645d79" - integrity sha512-nW24QBoPcFGGHJGUwnfpI7Yc5CdqWNdsyHQszVE/z2pKHXzh7FZ5GWhJqSyaQ9wMkQnsTx+kAI8bHlCX4tKdbg== - isarray@1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" @@ -1692,11 +1660,6 @@ isomorphic-ws@^4.0.1: resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz#55fd4cd6c5e6491e76dc125938dd863f5cd4f2dc" integrity sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w== -javascript-natural-sort@0.7.1: - version "0.7.1" - resolved "https://registry.yarnpkg.com/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz#f9e2303d4507f6d74355a73664d1440fb5a0ef59" - integrity sha1-+eIwPUUH9tdDVac2ZNFED7Wg71k= - js-levenshtein@^1.1.3: version "1.1.6" resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" @@ -1748,6 +1711,18 @@ kind-of@^6.0.0, kind-of@^6.0.2: resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== +libsodium-wrappers@^0.7.6: + version "0.7.6" + resolved "https://registry.yarnpkg.com/libsodium-wrappers/-/libsodium-wrappers-0.7.6.tgz#baed4c16d4bf9610104875ad8a8e164d259d48fb" + integrity sha512-OUO2CWW5bHdLr6hkKLHIKI4raEkZrf3QHkhXsJ1yCh6MZ3JDA7jFD3kCATNquuGSG6MjjPHQIQms0y0gBDzjQg== + dependencies: + libsodium "0.7.6" + +libsodium@0.7.6: + version "0.7.6" + resolved "https://registry.yarnpkg.com/libsodium/-/libsodium-0.7.6.tgz#018b80c5728054817845fbffa554274441bda277" + integrity sha512-hPb/04sEuLcTRdWDtd+xH3RXBihpmbPCsKW/Jtf4PsvdyKh+D6z2D2gvp/5BfoxseP+0FCOg66kE+0oGUE/loQ== + locate-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-3.0.0.tgz#dbec3b3ab759758071b58fe59fc41871af21400e" @@ -1788,20 +1763,6 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" -mathjs@^4.4.2: - version "4.4.2" - resolved "https://registry.yarnpkg.com/mathjs/-/mathjs-4.4.2.tgz#79a5c8ad92a6434e22dbfac13e223a9bd62d6981" - integrity sha512-T5zGIbDT/JGmzIu2Bocq4U8gbcmQVCyZaJbBCHKmJkLMQoWuh1SOuFH98doj1JEQwjpKkq3rqdUCuy3vLlBZOA== - dependencies: - complex.js "2.0.10" - decimal.js "9.0.1" - escape-latex "1.0.3" - fraction.js "4.0.8" - javascript-natural-sort "0.7.1" - seed-random "2.2.0" - tiny-emitter "2.0.2" - typed-function "1.0.3" - memory-cache@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/memory-cache/-/memory-cache-0.2.0.tgz#7890b01d52c00c8ebc9d533e1f8eb17e3034871a" @@ -1873,11 +1834,6 @@ mkdirp@^0.5.0, mkdirp@^0.5.1: dependencies: minimist "0.0.8" -moment@^2.22.1: - version "2.24.0" - resolved "https://registry.yarnpkg.com/moment/-/moment-2.24.0.tgz#0d055d53f5052aa653c9f6eb68bb5d12bf5c2b5b" - integrity sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg== - ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -1919,46 +1875,28 @@ needle@^2.2.1: iconv-lite "^0.4.4" sax "^1.2.4" -nkn-client@^0.6.7: - version "0.6.7" - resolved "https://registry.yarnpkg.com/nkn-client/-/nkn-client-0.6.7.tgz#21e59bb412043a22352774c3426022c6fa13d5aa" - integrity sha512-Rfv6GCuO3VV2pnVgl2LV6gEFp8EivRv2Gk6aZhpJ0EsPdHpO6nEOuhzEHJJXYDEPdJVcLTxU/TRuSjdUKp+LQQ== - dependencies: - buffer "^5.2.1" - cross-fetch "^2.2.2" +nkn-sdk@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/nkn-sdk/-/nkn-sdk-1.1.1.tgz#07012a85b46cacc856073b053db1561c56858b1e" + integrity sha512-GgsYtMFBiyLnSbVc4hH5pl9u91SzHRncbphhsAW/Yq+mah0oOlOnze/ImyeQSLw8yzrBBPoXKX84PfS2qkPynw== + dependencies: + "@nkn/ncp" "^1.0.6" + axios "^0.19.2" + base-x "^3.0.7" + buffer "^5.4.3" + core-js-pure "^3.6.4" crypto-js "^3.1.9-1" - ed2curve "^0.2.1" - es6-promise "^4.2.4" - google-protobuf "^3.6.1" - is "^3.2.1" + decimal.js "^10.2.0" + ed2curve "^0.3.0" + google-protobuf "^3.11.2" + heap "^0.2.6" isomorphic-ws "^4.0.1" - mathjs "^4.4.2" - moment "^2.22.1" - tweetnacl "^1.0.1" - ws "^5.2.0" - -nkn-multiclient@^0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/nkn-multiclient/-/nkn-multiclient-0.0.8.tgz#6060f01c268f3984b8e7c1bf1dba19ff4cf78db6" - integrity sha512-rykrutCYaRRhh7OgVdgtB+7BcLKIWroHMib7KFIA83gA6eXOmKvjfyPm3l9hw4x9ihoI+FBBj0lqHocT8lPGlA== - dependencies: + libsodium-wrappers "^0.7.6" memory-cache "^0.2.0" - nkn-client "^0.6.7" - -nkn-wallet@^0.4.7: - version "0.4.7" - resolved "https://registry.yarnpkg.com/nkn-wallet/-/nkn-wallet-0.4.7.tgz#d209f54135f3dcba8226f22644b7c1e54bbd1516" - integrity sha512-b02TULD+qnYULHJ4fXF8SX2N8YGQ2feXvyYgFXFdhlQlujmpVkOV9HleTbyxexNqbggxbpLH/1xZ5M81DFoDxA== - dependencies: - axios ">=0.18.1" - base-x "3.0.4" - buffer "^5.2.1" - crypto-js "3.1.9-1" - decimal.js "10.0.1" - es6-promise "4.2.4" - google-protobuf "^3.7.1" - is "3.2.1" - tweetnacl "^1.0.1" + pako "^1.0.11" + tweetnacl "^1.0.3" + webworkify "^1.5.0" + ws "^7.2.3" node-environment-flags@^1.0.5: version "1.0.6" @@ -1968,11 +1906,6 @@ node-environment-flags@^1.0.5: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" -node-fetch@2.1.2: - version "2.1.2" - resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.1.2.tgz#ab884e8e7e57e38a944753cec706f788d1768bb5" - integrity sha1-q4hOjn5X44qUR1POxwb3iNF2i7U= - node-modules-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/node-modules-regexp/-/node-modules-regexp-1.0.0.tgz#8d9dbe28964a4ac5712e9131642107c71e90ec40" @@ -2165,6 +2098,11 @@ p-try@^2.0.0: resolved "https://registry.yarnpkg.com/p-try/-/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6" integrity sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ== +pako@^1.0.11: + version "1.0.11" + resolved "https://registry.yarnpkg.com/pako/-/pako-1.0.11.tgz#6c9599d340d54dfd3946380252a35705a6b992bf" + integrity sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw== + parse-passwd@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/parse-passwd/-/parse-passwd-1.0.0.tgz#6d5b934a456993b23d37f40a382d6f1666a8e5c6" @@ -2393,11 +2331,6 @@ sax@^1.2.4: resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== -seed-random@2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/seed-random/-/seed-random-2.2.0.tgz#2a9b19e250a817099231a5b99a4daf80b7fbed54" - integrity sha1-KpsZ4lCoFwmSMaW5mk2vgLf77VQ= - semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0, semver@^5.7.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" @@ -2423,6 +2356,11 @@ set-value@^2.0.0, set-value@^2.0.1: is-plain-object "^2.0.3" split-string "^3.0.1" +setimmediate@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285" + integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU= + signal-exit@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -2607,11 +2545,6 @@ tar@^4: safe-buffer "^5.1.2" yallist "^3.0.3" -tiny-emitter@2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/tiny-emitter/-/tiny-emitter-2.0.2.tgz#82d27468aca5ade8e5fd1e6d22b57dd43ebdfb7c" - integrity sha512-2NM0auVBGft5tee/OxP4PI3d8WItkDM+fPnaRAVo6xTDI2knbz9eC5ArWGqtGlYqiH3RU5yMpdyTTO7MguC4ow== - to-fast-properties@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e" @@ -2642,20 +2575,10 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" -tweetnacl@0.x.x: - version "0.14.5" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-0.14.5.tgz#5ae68177f192d4456269d108afa93ff8743f4f64" - integrity sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q= - -tweetnacl@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.1.tgz#2594d42da73cd036bd0d2a54683dd35a6b55ca17" - integrity sha512-kcoMoKTPYnoeS50tzoqjPY3Uv9axeuuFAZY9M/9zFnhoVvRfxz9K29IMPD7jGmt2c8SW7i3gT9WqDl2+nV7p4A== - -typed-function@1.0.3: +tweetnacl@1.x.x, tweetnacl@^1.0.3: version "1.0.3" - resolved "https://registry.yarnpkg.com/typed-function/-/typed-function-1.0.3.tgz#57026246214b664a5af45ef0a06679f4453bd090" - integrity sha512-sVC/1pm70oELDFMdYtFXMFqyawenLoaDiAXA3QvOAwKF/WvFNTSJN23cY2lFNL8iP0kh3T0PPKewrboO8XUVGQ== + resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596" + integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw== unicode-canonical-property-names-ecmascript@^1.0.4: version "1.0.4" @@ -2725,10 +2648,10 @@ v8flags@^3.1.1: dependencies: homedir-polyfill "^1.0.1" -whatwg-fetch@2.0.4: - version "2.0.4" - resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f" - integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng== +webworkify@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/webworkify/-/webworkify-1.5.0.tgz#734ad87a774de6ebdd546e1d3e027da5b8f4a42c" + integrity sha512-AMcUeyXAhbACL8S2hqqdqOLqvJ8ylmIbNwUIqQujRSouf4+eUFaXbG6F1Rbu+srlJMmxQWsiU7mOJi0nMBfM1g== which-module@^2.0.0: version "2.0.0" @@ -2756,12 +2679,10 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= -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@^7.2.3: + version "7.2.3" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.2.3.tgz#a5411e1fb04d5ed0efee76d26d5c46d830c39b46" + integrity sha512-HTDl9G9hbkNDk98naoR/cHDws7+EyYMOdL1BmjsZXRUjf7d+MficC4B7HLUPlSiho0vg+CWKrGIt/VJBd1xunQ== y18n@^4.0.0: version "4.0.0"