From b822369827351dd3932a62d1a957dddd3a973d0e Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Wed, 23 Feb 2022 12:50:16 +0100 Subject: [PATCH 01/17] added roller api stub --- cmds/l2.js | 6 + cmds/l2_cmds/test.js | 31 + package-lock.json | 1760 ++++++++++++++++++------------------------ package.json | 5 +- utils/index.js | 4 +- utils/roller-api.js | 38 + 6 files changed, 814 insertions(+), 1030 deletions(-) create mode 100644 cmds/l2.js create mode 100644 cmds/l2_cmds/test.js create mode 100644 utils/roller-api.js diff --git a/cmds/l2.js b/cmds/l2.js new file mode 100644 index 0000000..4891419 --- /dev/null +++ b/cmds/l2.js @@ -0,0 +1,6 @@ +exports.command = 'l2 ' +exports.desc = 'Azimuth Layer 2 Commands' +exports.builder = function (yargs) { + return yargs.commandDir('l2_cmds') +} +exports.handler = function (argv) {} \ No newline at end of file diff --git a/cmds/l2_cmds/test.js b/cmds/l2_cmds/test.js new file mode 100644 index 0000000..eaac07d --- /dev/null +++ b/cmds/l2_cmds/test.js @@ -0,0 +1,31 @@ +const ajs = require('azimuth-js') +const ob = require('urbit-ob') +const {validate, eth, rollerApi} = require('../../utils') + +exports.command = 'test' +exports.desc = 'L2 workbench command.' +exports.builder = (yargs) =>{ +} + +exports.handler = async function (argv) { + + const p = Number(ob.patp2dec("~sardys")); + + const rollerClient = rollerApi.createClient(); + var pointInfo = await rollerApi.getPoint(rollerClient, "~sardys"); + console.log(pointInfo); + + console.log("Done"); + + //const point = await roller.getPoint(p); + //console.log(point); + + // Signing: + //const hash = roller.prepareForSigning(12,...) + //or + // const hash = await roller.getUnsignedTx(nonce, from, type, data); + // // const sig = await signTransactionHash(hash, wallet.privateKey); //see authToken.ts + + // console.log(resp); + // console.log("Here"); +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index a0f01c5..58648f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -341,9 +341,9 @@ "dev": true }, "@babel/runtime": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz", - "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==", + "version": "7.17.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.17.2.tgz", + "integrity": "sha512-hzeyJyMA1YGdJTuWU0e/j4wKXrU4OMFvY2MSlaI9B7VQb0r5cxTE3EAIS2Q7Tn2RIcDkRvTA/v2JsAEhxe99uw==", "requires": { "regenerator-runtime": "^0.13.4" }, @@ -677,57 +677,58 @@ } }, "@graphql-tools/batch-execute": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@graphql-tools/batch-execute/-/batch-execute-8.3.1.tgz", - "integrity": "sha512-63kHY8ZdoO5FoeDXYHnAak1R3ysMViMPwWC2XUblFckuVLMUPmB2ONje8rjr2CvzWBHAW8c1Zsex+U3xhKtGIA==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/@graphql-tools/batch-execute/-/batch-execute-8.3.2.tgz", + "integrity": "sha512-ICWqM+MvEkIPHm18Q0cmkvm134zeQMomBKmTRxyxMNhL/ouz6Nqld52/brSlaHnzA3fczupeRJzZ0YatruGBcQ==", "optional": true, "requires": { - "@graphql-tools/utils": "^8.5.1", + "@graphql-tools/utils": "^8.6.2", "dataloader": "2.0.0", "tslib": "~2.3.0", "value-or-promise": "1.0.11" } }, "@graphql-tools/delegate": { - "version": "8.4.3", - "resolved": "https://registry.npmjs.org/@graphql-tools/delegate/-/delegate-8.4.3.tgz", - "integrity": "sha512-hKTJdJXJnKL0+2vpU+Kt7OHQTIXZ9mBmNBwHsYiG5WNArz/vNI7910r6TC2XMf/e7zhyyK+mXxMDBmDQkkJagA==", + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/@graphql-tools/delegate/-/delegate-8.5.1.tgz", + "integrity": "sha512-/YPmVxitt57F8sH50pnfXASzOOjEfaUDkX48eF5q6f16+JBncej2zeu+Zm2c68q8MbIxhPlEGfpd0QZeqTvAxw==", "optional": true, "requires": { - "@graphql-tools/batch-execute": "^8.3.1", - "@graphql-tools/schema": "^8.3.1", - "@graphql-tools/utils": "^8.5.4", + "@graphql-tools/batch-execute": "^8.3.2", + "@graphql-tools/schema": "^8.3.2", + "@graphql-tools/utils": "^8.6.2", "dataloader": "2.0.0", + "graphql-executor": "0.0.18", "tslib": "~2.3.0", "value-or-promise": "1.0.11" } }, "@graphql-tools/merge": { - "version": "8.2.1", - "resolved": "https://registry.npmjs.org/@graphql-tools/merge/-/merge-8.2.1.tgz", - "integrity": "sha512-Q240kcUszhXiAYudjuJgNuLgy9CryDP3wp83NOZQezfA6h3ByYKU7xI6DiKrdjyVaGpYN3ppUmdj0uf5GaXzMA==", + "version": "8.2.3", + "resolved": "https://registry.npmjs.org/@graphql-tools/merge/-/merge-8.2.3.tgz", + "integrity": "sha512-XCSmL6/Xg8259OTWNp69B57CPWiVL69kB7pposFrufG/zaAlI9BS68dgzrxmmSqZV5ZHU4r/6Tbf6fwnEJGiSw==", "optional": true, "requires": { - "@graphql-tools/utils": "^8.5.1", + "@graphql-tools/utils": "^8.6.2", "tslib": "~2.3.0" } }, "@graphql-tools/schema": { - "version": "8.3.1", - "resolved": "https://registry.npmjs.org/@graphql-tools/schema/-/schema-8.3.1.tgz", - "integrity": "sha512-3R0AJFe715p4GwF067G5i0KCr/XIdvSfDLvTLEiTDQ8V/hwbOHEKHKWlEBHGRQwkG5lwFQlW1aOn7VnlPERnWQ==", + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/@graphql-tools/schema/-/schema-8.3.2.tgz", + "integrity": "sha512-77feSmIuHdoxMXRbRyxE8rEziKesd/AcqKV6fmxe7Zt+PgIQITxNDew2XJJg7qFTMNM43W77Ia6njUSBxNOkwg==", "optional": true, "requires": { - "@graphql-tools/merge": "^8.2.1", - "@graphql-tools/utils": "^8.5.1", + "@graphql-tools/merge": "^8.2.3", + "@graphql-tools/utils": "^8.6.2", "tslib": "~2.3.0", "value-or-promise": "1.0.11" } }, "@graphql-tools/utils": { - "version": "8.6.1", - "resolved": "https://registry.npmjs.org/@graphql-tools/utils/-/utils-8.6.1.tgz", - "integrity": "sha512-uxcfHCocp4ENoIiovPxUWZEHOnbXqj3ekWc0rm7fUhW93a1xheARNHcNKhwMTR+UKXVJbTFQdGI1Rl5XdyvDBg==", + "version": "8.6.2", + "resolved": "https://registry.npmjs.org/@graphql-tools/utils/-/utils-8.6.2.tgz", + "integrity": "sha512-x1DG0cJgpJtImUlNE780B/dfp8pxvVxOD6UeykFH5rHes26S4kGokbgU8F1IgrJ1vAPm/OVBHtd2kicTsPfwdA==", "optional": true, "requires": { "tslib": "~2.3.0" @@ -741,42 +742,6 @@ "requires": { "normalize-path": "^2.0.1", "through2": "^2.0.3" - }, - "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "optional": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - } } }, "@improbable-eng/grpc-web": { @@ -1115,14 +1080,6 @@ "requires": { "uint8arrays": "^3.0.0", "varint": "^6.0.0" - }, - "dependencies": { - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true - } } }, "multihashes": { @@ -1134,6 +1091,14 @@ "multibase": "^4.0.1", "uint8arrays": "^3.0.0", "varint": "^5.0.2" + }, + "dependencies": { + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", + "optional": true + } } }, "uint8arrays": { @@ -1144,6 +1109,12 @@ "requires": { "multiformats": "^9.4.2" } + }, + "varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "optional": true } } }, @@ -1270,9 +1241,9 @@ }, "dependencies": { "ws": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.6.tgz", - "integrity": "sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA==", + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz", + "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==", "optional": true } } @@ -1360,6 +1331,12 @@ "requires": { "browser-headers": "^0.4.0" } + }, + "event-iterator": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/event-iterator/-/event-iterator-2.0.0.tgz", + "integrity": "sha512-KGft0ldl31BZVV//jj+IAIGCxkvvUkkON+ScH6zfoX+l+omX6001ggyRSpI0Io2Hlro0ThXotswCtfzS8UkIiQ==", + "optional": true } } }, @@ -1453,9 +1430,9 @@ } }, "@textile/threads-client-grpc": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@textile/threads-client-grpc/-/threads-client-grpc-1.1.2.tgz", - "integrity": "sha512-LPL6+skRww44VPuqJz8qXOHBkwPlL7+zUKfndjo2duOq+RZilDm40uLXwnM1/eVmAo1A7mb9XIJAo0u7qYtmCg==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/@textile/threads-client-grpc/-/threads-client-grpc-1.1.3.tgz", + "integrity": "sha512-wOTZ0c42igugZ6I2DvJ6xY0oZhF5k3oOCS6mOy9aN0VXEWFNe+JbXf/aeLw2BWhY6JI6lp6KnJfMmP08aq7yYg==", "optional": true, "requires": { "@improbable-eng/grpc-web": "^0.14.0", @@ -1523,6 +1500,14 @@ "@textile/users-grpc": "2.6.6", "event-iterator": "^2.0.0", "loglevel": "^1.7.0" + }, + "dependencies": { + "event-iterator": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/event-iterator/-/event-iterator-2.0.0.tgz", + "integrity": "sha512-KGft0ldl31BZVV//jj+IAIGCxkvvUkkON+ScH6zfoX+l+omX6001ggyRSpI0Io2Hlro0ThXotswCtfzS8UkIiQ==", + "optional": true + } } }, "@textile/users-grpc": { @@ -1537,9 +1522,9 @@ } }, "@truffle/abi-utils": { - "version": "0.2.7", - "resolved": "https://registry.npmjs.org/@truffle/abi-utils/-/abi-utils-0.2.7.tgz", - "integrity": "sha512-q3RTGAyCnNgf9oG70pvd747SxJcUcgxUcqdlwPREordd3NlWWIC7ijiI7RXOL8okXHihPlt1VqODIKaDciGgcw==", + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/@truffle/abi-utils/-/abi-utils-0.2.9.tgz", + "integrity": "sha512-Nv4MGsA2vdI7G34nI0DfR/eSd5pbAUu+5EafYNqzgrS46y0LWhbIrSZ1NcM7cbhIrkpUn6OfNk49AjNM67TkSg==", "requires": { "change-case": "3.0.2", "faker": "^5.3.1", @@ -1547,20 +1532,20 @@ } }, "@truffle/code-utils": { - "version": "1.2.31", - "resolved": "https://registry.npmjs.org/@truffle/code-utils/-/code-utils-1.2.31.tgz", - "integrity": "sha512-yntIyUhm8ASba8+z3iLkyI5Xk9+VE8MjgIhz5SQNdSC8wuVHk+bj6ZXD2awVUHc5VtvdVEdgMz4DFoJ7T8+Iig==", + "version": "1.2.32", + "resolved": "https://registry.npmjs.org/@truffle/code-utils/-/code-utils-1.2.32.tgz", + "integrity": "sha512-OUP1zO8kkIGt+PhCfLZqai8K9Kel5eDYKvr/Z3ubt4RyTSb1rNwtnmJbiEszVhdsO7/Qi/w/vbW0ebS0clcjyg==", "requires": { "cbor": "^5.1.0" } }, "@truffle/codec": { - "version": "0.11.24", - "resolved": "https://registry.npmjs.org/@truffle/codec/-/codec-0.11.24.tgz", - "integrity": "sha512-r7wGVDIdF+r68EE7WHDRhiAh/OhQtXZRMUzwGyghjGM3Xt1Weyf9I8zN+EvnN/4ipnHJMyAc2XcHdnP24C82FA==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@truffle/codec/-/codec-0.12.0.tgz", + "integrity": "sha512-DE/26w5jtBPPqVBseLX1cL0i3b3IUnHaHtKmQvqkEatd6T+uZfPIaiI15ru8cynR7KrYNhuSfeq9k8/N+OFN1Q==", "requires": { - "@truffle/abi-utils": "^0.2.7", - "@truffle/compile-common": "^0.7.25", + "@truffle/abi-utils": "^0.2.9", + "@truffle/compile-common": "^0.7.28", "big.js": "^5.2.2", "bn.js": "^5.1.3", "cbor": "^5.1.0", @@ -1590,43 +1575,41 @@ } }, "@truffle/compile-common": { - "version": "0.7.25", - "resolved": "https://registry.npmjs.org/@truffle/compile-common/-/compile-common-0.7.25.tgz", - "integrity": "sha512-larNO2GEAQhdoak8+Mby1JEEKVHLUbKvIfpT0g3V1C97RCXyuUv82ceSPvqhaqEp37cPeIBTAmiQtGLJ4tjaPg==", + "version": "0.7.28", + "resolved": "https://registry.npmjs.org/@truffle/compile-common/-/compile-common-0.7.28.tgz", + "integrity": "sha512-mZCEQ6fkOqbKYCJDT82q0vZCxOEsKRQ0zrPfKuSJEb0gF9DXIQcnMkyJpBSWzmyvien9/A7/jPiGQoC7PmNEUg==", "requires": { - "@truffle/error": "^0.0.15", + "@truffle/error": "^0.1.0", "colors": "1.4.0" } }, "@truffle/config": { - "version": "1.3.16", - "resolved": "https://registry.npmjs.org/@truffle/config/-/config-1.3.16.tgz", - "integrity": "sha512-CeK6Yku1HPX+xKjP9SZ21/Cd9UsS6J5bo0wwDSofYRElOkLV5iRUUFSoVjBLWS9rO11IISfE7hkwG8+IsBFXmw==", + "version": "1.3.20", + "resolved": "https://registry.npmjs.org/@truffle/config/-/config-1.3.20.tgz", + "integrity": "sha512-yZ2Qb15GHTDcRLgn2smYkXGh1beWrbfor2t9P14RxCGZ64VvaATZDXn615EImGrMbmVCG+R35zeo8wfNZOHAgg==", "optional": true, "requires": { - "@truffle/error": "^0.0.15", - "@truffle/events": "^0.0.18", - "@truffle/provider": "^0.2.44", + "@truffle/error": "^0.1.0", + "@truffle/events": "^0.1.1", + "@truffle/provider": "^0.2.47", "conf": "^10.0.2", "find-up": "^2.1.0", - "lodash.assignin": "^4.2.0", "lodash.merge": "^4.6.2", - "lodash.pick": "^4.4.0", "module": "^1.2.5", "original-require": "^1.0.1" } }, "@truffle/db": { - "version": "0.5.49", - "resolved": "https://registry.npmjs.org/@truffle/db/-/db-0.5.49.tgz", - "integrity": "sha512-+iD39divG4QlT48mripYZrpws3cw8LKy4mDpWYLy2zK0x3t4BDvyHk9MqBXFYRZl1r7Zv79tp+6ZcVJX9DPc0w==", + "version": "0.5.54", + "resolved": "https://registry.npmjs.org/@truffle/db/-/db-0.5.54.tgz", + "integrity": "sha512-+3ssdO34mwiu3Ha2a38+nm+5d/pMZiDVfVLUNZIjB8rZXgtVVTnrK/7+IYXNLJZFulAVgpDS/iALXfxo0+mDwg==", "optional": true, "requires": { "@graphql-tools/delegate": "^8.4.3", "@graphql-tools/schema": "^8.3.1", - "@truffle/abi-utils": "^0.2.7", - "@truffle/code-utils": "^1.2.31", - "@truffle/config": "^1.3.16", + "@truffle/abi-utils": "^0.2.9", + "@truffle/code-utils": "^1.2.32", + "@truffle/config": "^1.3.20", "apollo-server": "^2.18.2", "debug": "^4.3.1", "fs-extra": "^9.1.0", @@ -1662,21 +1645,21 @@ } }, "@truffle/db-loader": { - "version": "0.0.28", - "resolved": "https://registry.npmjs.org/@truffle/db-loader/-/db-loader-0.0.28.tgz", - "integrity": "sha512-bHMKGNfnMk4PAxysgXuECOF/J8vPLv3LoA+3PGNSUL5BAZkzxGHZ6/1w6HU/oRT67c6fCxcrH/zErud4b9mOhQ==", + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/@truffle/db-loader/-/db-loader-0.1.4.tgz", + "integrity": "sha512-jRiRUftZB7XOtU3TRDZJ0ViPDBIsOrlu8WCt5rq27rvknsDoXES8f0g7UdBiusl44DT4T+G6uRYvUFZmBua9Lw==", "requires": { - "@truffle/db": "^0.5.49" + "@truffle/db": "^0.5.54" } }, "@truffle/debugger": { - "version": "9.2.13", - "resolved": "https://registry.npmjs.org/@truffle/debugger/-/debugger-9.2.13.tgz", - "integrity": "sha512-BJMQg/OLDBdZxiLcDdhUP/FIK+t55Tql0rKgnAUcxRRP9/DG3fNnXHOLhor8xXumWeYuYNUd79uHph1df6LYqA==", + "version": "9.2.18", + "resolved": "https://registry.npmjs.org/@truffle/debugger/-/debugger-9.2.18.tgz", + "integrity": "sha512-R3o4pGMKdi3ZbCdQdmrmWHFeLyHmf3L4IF+hv3K+g5/AeOP1E+6u4q+bPOwsuriRjAyTSTg4j5wfAsuF3Nbh/A==", "requires": { - "@truffle/abi-utils": "^0.2.7", - "@truffle/codec": "^0.11.24", - "@truffle/source-map-utils": "^1.3.68", + "@truffle/abi-utils": "^0.2.9", + "@truffle/codec": "^0.12.0", + "@truffle/source-map-utils": "^1.3.72", "bn.js": "^5.1.3", "debug": "^4.3.1", "json-pointer": "^0.6.1", @@ -1958,24 +1941,25 @@ } }, "@truffle/error": { - "version": "0.0.15", - "resolved": "https://registry.npmjs.org/@truffle/error/-/error-0.0.15.tgz", - "integrity": "sha512-keiYGlVAH7GLggqMpB+XorT7NkOlr3qeBc56thI2WP0eas3qstlyrc0WvckXJ2LXrOfcR2uH6f0Nk6FIxaKXSA==" + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@truffle/error/-/error-0.1.0.tgz", + "integrity": "sha512-RbUfp5VreNhsa2Q4YbBjz18rOQI909pG32bghl1hulO7IpvcqTS+C3Ge5cNbiWQ1WGzy1wIeKLW0tmQtHFB7qg==" }, "@truffle/events": { - "version": "0.0.18", - "resolved": "https://registry.npmjs.org/@truffle/events/-/events-0.0.18.tgz", - "integrity": "sha512-U+8pKyBlEDOUPo43/A6zh5Yw4Q/ZFOA6b5d54EPhqN/C+39LDhUPSI8PI7KmdY4HfUy/ZhMEdh59F34rGRTUYg==", + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/@truffle/events/-/events-0.1.1.tgz", + "integrity": "sha512-nO6ltXo9jS2c9/xgXj+gqZREWmIQ7ZCCL0/UzeAuyVn14qkbK7fcWO4hKiXk5Z2PZYdhehGo+viTVXDxwlzW4A==", "optional": true, "requires": { "emittery": "^0.4.1", - "ora": "^3.4.0" + "ora": "^3.4.0", + "web3-utils": "1.5.3" } }, "@truffle/interface-adapter": { - "version": "0.5.10", - "resolved": "https://registry.npmjs.org/@truffle/interface-adapter/-/interface-adapter-0.5.10.tgz", - "integrity": "sha512-Hb4vjv+hMCfzhUUKIy4hFzAmLoZMHBFF9I8AawEwUa3896kB5iRDNxyoPXXsb1di87ZYDUdtaX6ACWzNaiVdlg==", + "version": "0.5.11", + "resolved": "https://registry.npmjs.org/@truffle/interface-adapter/-/interface-adapter-0.5.11.tgz", + "integrity": "sha512-HXLm+r1KdT8nHzJht1iK6EnHBKIjSYHdDfebBMCqmRCsMoUXvUJ0KsIxvDG758MafB12pjx5gsNn4XzzfksSBQ==", "optional": true, "requires": { "bn.js": "^5.1.3", @@ -2259,36 +2243,36 @@ } }, "@truffle/preserve": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@truffle/preserve/-/preserve-0.2.5.tgz", - "integrity": "sha512-5wkXVWinN5/D0MGpEIae93nefQeTBcqJ/WjTASRQuL3oT03QJs8Izj3Sa/UORQFjMV+Qz7WpxPyNeVc2Se9SAQ==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@truffle/preserve/-/preserve-0.2.6.tgz", + "integrity": "sha512-ipyLNwbhAIIxdf48fUXrpNdgJ/kmmT9U/cvGfjw8GUTAl455K99Fbv+ZZloyQ4Tuuy3THOPQsQ+6ClI6QW8aiw==", "optional": true, "requires": { "spinnies": "^0.5.1" } }, "@truffle/preserve-fs": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@truffle/preserve-fs/-/preserve-fs-0.2.5.tgz", - "integrity": "sha512-Rx3Gi7y/RCS+0NzKScxVgK3MIJRdGxlkoi/xESRqvZQVB3KU3iwJ6NuHu17DgvplIme+eVQlbUBML/NE1AfnQw==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/@truffle/preserve-fs/-/preserve-fs-0.2.6.tgz", + "integrity": "sha512-NEf92IYPRknv8BB13S2Y6UR6whYxNS0gxYyHayBTUttvAVGBz8TnWvtRxPMNiDx5Ui6pbNL3hGL7M46TG1GL1A==", "optional": true, "requires": { - "@truffle/preserve": "^0.2.5" + "@truffle/preserve": "^0.2.6" } }, "@truffle/preserve-to-buckets": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/@truffle/preserve-to-buckets/-/preserve-to-buckets-0.2.5.tgz", - "integrity": "sha512-+1zTnQbUsKPQXtwDuS8Bak2T0xSbSAWrC3sbozo7BL+lsUCE51RZtcpmFw61t2G4WvVUVd6Xi67FCteCmHZQ8Q==", + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@truffle/preserve-to-buckets/-/preserve-to-buckets-0.2.7.tgz", + "integrity": "sha512-CBH3qRVRrzrAbmCCW8AkoI3FzLpmJ/cPCqHKn+Lk7AuA+i/QuwVbyUL6Jvgz2B0kU3bUqf9uxOMdhPbOBufISA==", "optional": true, "requires": { "@textile/hub": "^6.0.2", - "@truffle/preserve": "^0.2.5", + "@truffle/preserve": "^0.2.6", "cids": "^1.1.5", "ipfs-http-client": "^48.2.2", "isomorphic-ws": "^4.0.1", "iter-tools": "^7.0.2", - "ws": "^7.4.3" + "ws": "^7.2.0" }, "dependencies": { "cids": { @@ -2320,14 +2304,6 @@ "requires": { "uint8arrays": "^3.0.0", "varint": "^6.0.0" - }, - "dependencies": { - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true - } } }, "multihashes": { @@ -2339,6 +2315,14 @@ "multibase": "^4.0.1", "uint8arrays": "^3.0.0", "varint": "^5.0.2" + }, + "dependencies": { + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", + "optional": true + } } }, "uint8arrays": { @@ -2350,21 +2334,27 @@ "multiformats": "^9.4.2" } }, + "varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "optional": true + }, "ws": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.6.tgz", - "integrity": "sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA==", + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz", + "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==", "optional": true } } }, "@truffle/preserve-to-filecoin": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/@truffle/preserve-to-filecoin/-/preserve-to-filecoin-0.2.6.tgz", - "integrity": "sha512-xzXwjTGGmd9gfuua8D7khiqB9wZM+G2nG65IqDjPQUnMsUlxRgUb0AkO12gxkzlXorQ7ZE9+BacMnIh7SrrbCA==", + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@truffle/preserve-to-filecoin/-/preserve-to-filecoin-0.2.7.tgz", + "integrity": "sha512-hQBCvcvgnSsKGKS3RZaFSHKFjP6553HATNaw3ee55Pgyp+Qzy2c+d6x34Mu23A+6qsfeVoGJ2BoPGwT4JSJkrA==", "optional": true, "requires": { - "@truffle/preserve": "^0.2.5", + "@truffle/preserve": "^0.2.6", "cids": "^1.1.5", "delay": "^5.0.0", "filecoin.js": "^0.0.5-alpha" @@ -2399,14 +2389,6 @@ "requires": { "uint8arrays": "^3.0.0", "varint": "^6.0.0" - }, - "dependencies": { - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true - } } }, "multihashes": { @@ -2418,6 +2400,14 @@ "multibase": "^4.0.1", "uint8arrays": "^3.0.0", "varint": "^5.0.2" + }, + "dependencies": { + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", + "optional": true + } } }, "uint8arrays": { @@ -2428,28 +2418,34 @@ "requires": { "multiformats": "^9.4.2" } + }, + "varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "optional": true } } }, "@truffle/preserve-to-ipfs": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/@truffle/preserve-to-ipfs/-/preserve-to-ipfs-0.2.6.tgz", - "integrity": "sha512-rik1+0pqW0NjME29GrXRb32U30+5WBJy6aGOtdnHq80lNmFDHpxsU9cWr6r1SpbQO9UoLTT1q8TVtm83rpBpUg==", + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@truffle/preserve-to-ipfs/-/preserve-to-ipfs-0.2.7.tgz", + "integrity": "sha512-gAf73biK/OX3+MoA092tKrw7r398v05q7yTJ85P2sQdN2Mj9dmiIZ7iDOccu47LtrYFAbar9NWBllDx1kqK3zQ==", "optional": true, "requires": { - "@truffle/preserve": "^0.2.5", + "@truffle/preserve": "^0.2.6", "ipfs-http-client": "^48.2.2", "iter-tools": "^7.0.2" } }, "@truffle/provider": { - "version": "0.2.44", - "resolved": "https://registry.npmjs.org/@truffle/provider/-/provider-0.2.44.tgz", - "integrity": "sha512-hwQyu4u2a8J4nRLFlLrVA/m+Wa71F8ZXX4wlmzxVBc3svTEnsyg3cYLmM2NVIL/ZT5Hdz/bGkkyXLvWDsHbXlA==", + "version": "0.2.47", + "resolved": "https://registry.npmjs.org/@truffle/provider/-/provider-0.2.47.tgz", + "integrity": "sha512-Y9VRLsdMcfEicZjxxcwA0y9pqnwJx0JX/UDeHDHZmymx3KIJwI3VpxRPighfHAmvDRksic6Yj4iL0CmiEDR5kg==", "optional": true, "requires": { - "@truffle/error": "^0.0.15", - "@truffle/interface-adapter": "^0.5.10", + "@truffle/error": "^0.1.0", + "@truffle/interface-adapter": "^0.5.11", "web3": "1.5.3" }, "dependencies": { @@ -2719,12 +2715,12 @@ } }, "@truffle/source-map-utils": { - "version": "1.3.68", - "resolved": "https://registry.npmjs.org/@truffle/source-map-utils/-/source-map-utils-1.3.68.tgz", - "integrity": "sha512-1fm73MIW5RfGwgtMUow/XuXGvd/deHlB8v33AcCWvfBhpk+2PyQusDTlsklAG0zFlh+Kh5ztbnn5MAB96RpgbA==", + "version": "1.3.72", + "resolved": "https://registry.npmjs.org/@truffle/source-map-utils/-/source-map-utils-1.3.72.tgz", + "integrity": "sha512-YvvDkwQJY/3WWllsuHpeKsNeeIP26AUAKct1gDEqd6YVezB87z2d4l3Td8SLkT0QjdryOyXhLnp0rMW8mFHtEg==", "requires": { - "@truffle/code-utils": "^1.2.31", - "@truffle/codec": "^0.11.24", + "@truffle/code-utils": "^1.2.32", + "@truffle/codec": "^0.12.0", "debug": "^4.3.1", "json-pointer": "^0.6.1", "node-interval-tree": "^1.3.3", @@ -3045,6 +3041,15 @@ "event-target-shim": "^5.0.0" } }, + "abstract-leveldown": { + "version": "2.7.2", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.7.2.tgz", + "integrity": "sha512-+OVvxH2rHVEhWLdbudP6p0+dNMXu8JA1CbhP19T8paTYAcX7oJ4OVjT+ZUVpv7mITxXHqDMej+GdqXBmXkw09w==", + "optional": true, + "requires": { + "xtend": "~4.0.0" + } + }, "accepts": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz", @@ -3114,9 +3119,9 @@ }, "dependencies": { "ajv": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.9.0.tgz", - "integrity": "sha512-qOKJyNj/h+OWx7s5DePL6Zu1KeM9jPZhwBqs+7DzP6bGOvqzVCSf0xueYmVuaC/oQ/VtS2zLMLHdQFbkka+XDQ==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", + "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", "optional": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -3288,6 +3293,14 @@ "sha.js": "^2.4.11", "subscriptions-transport-ws": "^0.9.19", "uuid": "^8.0.0" + }, + "dependencies": { + "uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "optional": true + } } }, "apollo-server-env": { @@ -3298,6 +3311,17 @@ "requires": { "node-fetch": "^2.6.1", "util.promisify": "^1.0.0" + }, + "dependencies": { + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "optional": true, + "requires": { + "whatwg-url": "^5.0.0" + } + } } }, "apollo-server-errors": { @@ -3429,6 +3453,12 @@ "readable-stream": "^2.0.6" }, "dependencies": { + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "optional": true + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -3624,9 +3654,9 @@ } }, "azimuth-js": { - "version": "0.22.2", - "resolved": "https://registry.npmjs.org/azimuth-js/-/azimuth-js-0.22.2.tgz", - "integrity": "sha512-Gx6OxfNnLs6+YiAi0OUp9Tfub8Vj1OnlFWoyLe76NJaOUNx+VRh8huA3beXz3mqNoFMOnKEoYrftiiSRjxRP8w==", + "version": "0.23.0", + "resolved": "https://registry.npmjs.org/azimuth-js/-/azimuth-js-0.23.0.tgz", + "integrity": "sha512-XClTNrvZg684ghyUb4JpHiYvx6/0hlxb5jlARnwI1w9aNTyMF02cH1eF0O8FUN9qk3wb0ZL95SvYU2cZS9adtA==", "requires": { "azimuth-solidity": "^1.2.3", "ethereumjs-util": "^7.1.3", @@ -4730,12 +4760,6 @@ "typedarray": "~0.0.5" }, "dependencies": { - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "optional": true - }, "readable-stream": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", @@ -4777,9 +4801,9 @@ }, "dependencies": { "ajv": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.9.0.tgz", - "integrity": "sha512-qOKJyNj/h+OWx7s5DePL6Zu1KeM9jPZhwBqs+7DzP6bGOvqzVCSf0xueYmVuaC/oQ/VtS2zLMLHdQFbkka+XDQ==", + "version": "8.10.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.10.0.tgz", + "integrity": "sha512-bzqAEZOjkrUMl2afH8dknrq5KEk2SrwdBROR+vH1EKVQTqaUbJVPdc/gEdggTMM0Se+s+Ja4ju4TlNcStKl2Hw==", "optional": true, "requires": { "fast-deep-equal": "^3.1.1", @@ -4793,6 +4817,21 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "optional": true + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "optional": true + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "optional": true, + "requires": { + "mimic-fn": "^2.1.0" + } } } }, @@ -4870,9 +4909,9 @@ "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==" }, "core-js-pure": { - "version": "3.20.3", - "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.20.3.tgz", - "integrity": "sha512-Q2H6tQ5MtPtcC7f3HxJ48i4Q7T9ybPKgvWyuH7JXIoNa2pm0KuBnycsET/qw1SLLZYfbsbrZQNMeIOClb+6WIA==", + "version": "3.21.1", + "resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.21.1.tgz", + "integrity": "sha512-12VZfFIu+wyVbBebyHmRTuEE/tZrB4tJToWcwAMcsp3h4+sHR+fMJWbKpYiCRWlhFBq+KNyO8rIV9rTkeVmznQ==", "optional": true }, "core-util-is": { @@ -5074,6 +5113,14 @@ "optional": true, "requires": { "mimic-fn": "^3.0.0" + }, + "dependencies": { + "mimic-fn": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-3.1.0.tgz", + "integrity": "sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ==", + "optional": true + } } }, "debug": { @@ -5173,30 +5220,27 @@ "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==" }, "deferred-leveldown": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.0.1.tgz", - "integrity": "sha512-BXohsvTedWOLkj2n/TY+yqVlrCWa2Zs8LSxh3uCAgFOru7/pjxKyZAexGa1j83BaKloER4PqUyQ9rGPJLt9bqA==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz", + "integrity": "sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw==", "optional": true, "requires": { - "abstract-leveldown": "~6.0.0", + "abstract-leveldown": "~6.2.1", "inherits": "^2.0.3" }, "dependencies": { "abstract-leveldown": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.0.3.tgz", - "integrity": "sha512-jzewKKpZbaYUa6HTThnrl+GrJhzjEAeuc7hTVpZdzg7kupXZFoqQDFwyOwLNbmJKJlmzw8yiipMPkDiuKkT06Q==", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", + "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", "optional": true, "requires": { + "buffer": "^5.5.0", + "immediate": "^3.2.3", "level-concat-iterator": "~2.0.0", + "level-supports": "~1.0.0", "xtend": "~4.0.0" } - }, - "level-concat-iterator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", - "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", - "optional": true } } }, @@ -5332,12 +5376,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "optional": true - }, - "native-fetch": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/native-fetch/-/native-fetch-3.0.0.tgz", - "integrity": "sha512-G3Z7vx0IFb/FQ4JxvtqGABsOTIqRWvgQz6e+erkB+JJD6LrszQtMozEHI4EkmgZQvnGHrpLVzUWk7t4sJCIkVw==", - "optional": true } } }, @@ -5427,6 +5465,12 @@ "stream-shift": "^1.0.0" }, "dependencies": { + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "optional": true + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -5590,21 +5634,6 @@ "level-supports": "~1.0.0", "xtend": "~4.0.0" } - }, - "level-concat-iterator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", - "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", - "optional": true - }, - "level-supports": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", - "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", - "optional": true, - "requires": { - "xtend": "^4.0.2" - } } } }, @@ -5987,12 +6016,6 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==", "optional": true - }, - "uuid": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", - "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=", - "optional": true } } }, @@ -6013,9 +6036,9 @@ } }, "event-iterator": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/event-iterator/-/event-iterator-2.0.0.tgz", - "integrity": "sha512-KGft0ldl31BZVV//jj+IAIGCxkvvUkkON+ScH6zfoX+l+omX6001ggyRSpI0Io2Hlro0ThXotswCtfzS8UkIiQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/event-iterator/-/event-iterator-1.2.0.tgz", + "integrity": "sha512-Daq7YUl0Mv1i4QEgzGQlz0jrx7hUFNyLGbiF+Ap7NCMCjDLCCnolyj6s0TAc6HmrBziO5rNVHsPwGMp7KdRPvw==", "optional": true }, "event-target-shim": { @@ -6168,9 +6191,9 @@ "integrity": "sha512-wLTv2a28wjUyWkbnX7u/ABZBkUkIF2fCd73V6P2oFqEGEktDfzWx4UxrSqtPRw0xPRAcjeAOIiJWqZm3pP4u3g==" }, "fast-check": { - "version": "2.21.0", - "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-2.21.0.tgz", - "integrity": "sha512-hkTRytqMceXfnSwPnryIqKkxKJjfcvtVqJrWRb8tgmfyUsGajIgQqDFxCJ+As+l9VLUCcmx6XIYoXeQe2Ih0UA==", + "version": "2.22.0", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-2.22.0.tgz", + "integrity": "sha512-Yrx1E8fZk6tfSqYaNkwnxj/lOk+vj2KTbbpHDtYoK9MrrL/D204N/rCtcaVSz5bE29g6gW4xj0byresjlFyybg==", "requires": { "pure-rand": "^5.0.0" } @@ -6255,6 +6278,15 @@ "ws": "^7.3.1" }, "dependencies": { + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "optional": true, + "requires": { + "whatwg-url": "^5.0.0" + } + }, "tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", @@ -6262,9 +6294,9 @@ "optional": true }, "ws": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.6.tgz", - "integrity": "sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA==", + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz", + "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==", "optional": true } } @@ -6370,6 +6402,13 @@ "integrity": "sha512-FmTtBsHskrU6FJ2VxCnsDb84wu9zhmO3cUX2kGFb5tuwhfXxGciiT0oRY+cck35QmG+NmGh5eLz6lLCpWTqwpA==", "requires": { "is-buffer": "~2.0.3" + }, + "dependencies": { + "is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==" + } } }, "follow-redirects": { @@ -7796,6 +7835,12 @@ "integrity": "sha512-5gghUc24tP9HRznNpV2+FIoq3xKkj5dTQqf4v0CpdPbFVwFkWoxOM+o+2OC9ZSvjEMTjfmG9QT+gcvggTwW1zw==", "optional": true }, + "graphql-executor": { + "version": "0.0.18", + "resolved": "https://registry.npmjs.org/graphql-executor/-/graphql-executor-0.0.18.tgz", + "integrity": "sha512-upUSl7tfZCZ5dWG1XkOvpG70Yk3duZKcCoi/uJso4WxJVT6KIrcK4nZ4+2X/hzx46pL8wAukgYHY6iNmocRN+g==", + "optional": true + }, "graphql-extensions": { "version": "0.15.0", "resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.15.0.tgz", @@ -7870,45 +7915,11 @@ "vinyl": "1.X" }, "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "optional": true - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "optional": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } } } }, @@ -8359,14 +8370,6 @@ "requires": { "uint8arrays": "^3.0.0", "varint": "^6.0.0" - }, - "dependencies": { - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true - } } }, "multihashes": { @@ -8378,9 +8381,17 @@ "multibase": "^4.0.1", "uint8arrays": "^3.0.0", "varint": "^5.0.2" - } - }, - "uint8arrays": { + }, + "dependencies": { + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", + "optional": true + } + } + }, + "uint8arrays": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.0.0.tgz", "integrity": "sha512-HRCx0q6O9Bfbp+HHSfQQKD7wU70+lydKVt4EghkdOvlK/NlrF90z+eXV34mUd48rNvVJXwkrMSPpCATkct8fJA==", @@ -8388,6 +8399,12 @@ "requires": { "multiformats": "^9.4.2" } + }, + "varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "optional": true } } }, @@ -8464,12 +8481,6 @@ "requires": { "multiformats": "^9.4.2" } - }, - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true } } }, @@ -8492,8 +8503,20 @@ "requires": { "multiformats": "^9.4.2" } + }, + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", + "optional": true } } + }, + "varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "optional": true } } }, @@ -8560,14 +8583,6 @@ "requires": { "uint8arrays": "^3.0.0", "varint": "^6.0.0" - }, - "dependencies": { - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true - } } }, "multihashes": { @@ -8579,6 +8594,14 @@ "multibase": "^4.0.1", "uint8arrays": "^3.0.0", "varint": "^5.0.2" + }, + "dependencies": { + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", + "optional": true + } } }, "uint8arrays": { @@ -8636,14 +8659,6 @@ "requires": { "uint8arrays": "1.1.0", "varint": "^6.0.0" - }, - "dependencies": { - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true - } } }, "multihashes": { @@ -8665,12 +8680,6 @@ "requires": { "multiformats": "^9.4.2" } - }, - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true } } }, @@ -8682,6 +8691,12 @@ "requires": { "globalthis": "^1.0.1" } + }, + "varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "optional": true } } }, @@ -8727,6 +8742,24 @@ "requires": { "globalthis": "^1.0.1" } + }, + "native-fetch": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/native-fetch/-/native-fetch-2.0.1.tgz", + "integrity": "sha512-gv4Bea+ga9QdXINurpkEqun3ap3vnB+WYoe4c8ddqUYEH7B2h6iD39RF8uVN7OwmSfMY3RDxkvBnoI4e2/vLXQ==", + "optional": true, + "requires": { + "globalthis": "^1.0.1" + } + }, + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "optional": true, + "requires": { + "whatwg-url": "^5.0.0" + } } } }, @@ -8768,14 +8801,6 @@ "requires": { "uint8arrays": "^3.0.0", "varint": "^6.0.0" - }, - "dependencies": { - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true - } } }, "multihashes": { @@ -8787,6 +8812,14 @@ "multibase": "^4.0.1", "uint8arrays": "^3.0.0", "varint": "^5.0.2" + }, + "dependencies": { + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", + "optional": true + } } }, "uint8arrays": { @@ -8797,6 +8830,12 @@ "requires": { "multiformats": "^9.4.2" } + }, + "varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "optional": true } } }, @@ -8864,12 +8903,6 @@ "requires": { "multiformats": "^9.4.2" } - }, - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true } } }, @@ -8892,6 +8925,12 @@ "requires": { "multiformats": "^9.4.2" } + }, + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", + "optional": true } } }, @@ -8903,6 +8942,12 @@ "requires": { "multiformats": "^9.4.2" } + }, + "varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "optional": true } } }, @@ -8953,12 +8998,6 @@ "requires": { "multiformats": "^9.4.2" } - }, - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true } } }, @@ -8979,14 +9018,6 @@ "requires": { "uint8arrays": "1.1.0", "varint": "^6.0.0" - }, - "dependencies": { - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true - } } }, "multihashes": { @@ -9008,8 +9039,20 @@ "requires": { "multiformats": "^9.4.2" } + }, + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", + "optional": true } } + }, + "varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "optional": true } } }, @@ -9045,21 +9088,6 @@ "uint8arrays": "^3.0.0", "varint": "^6.0.0" } - }, - "uint8arrays": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.0.0.tgz", - "integrity": "sha512-HRCx0q6O9Bfbp+HHSfQQKD7wU70+lydKVt4EghkdOvlK/NlrF90z+eXV34mUd48rNvVJXwkrMSPpCATkct8fJA==", - "optional": true, - "requires": { - "multiformats": "^9.4.2" - } - }, - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true } } }, @@ -9082,11 +9110,25 @@ "varint": "^6.0.0" }, "dependencies": { - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true + "multibase": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/multibase/-/multibase-3.1.2.tgz", + "integrity": "sha512-bpklWHs70LO3smJUHOjcnzGceJJvn9ui0Vau6Za0B/GBepaXswmW8Ufea0uD9pROf/qCQ4N4lZ3sf3U+SNf0tw==", + "optional": true, + "requires": { + "@multiformats/base-x": "^4.0.1", + "web-encoding": "^1.0.6" + } + }, + "uint8arrays": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-1.1.0.tgz", + "integrity": "sha512-cLdlZ6jnFczsKf5IH1gPHTtcHtPGho5r4CvctohmQjw8K7Q3gFdfIGHxSTdTaCKrL4w09SsPRJTqRS0drYeszA==", + "optional": true, + "requires": { + "multibase": "^3.0.0", + "web-encoding": "^1.0.2" + } } } }, @@ -9101,16 +9143,28 @@ "varint": "^5.0.2" }, "dependencies": { - "uint8arrays": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.0.0.tgz", - "integrity": "sha512-HRCx0q6O9Bfbp+HHSfQQKD7wU70+lydKVt4EghkdOvlK/NlrF90z+eXV34mUd48rNvVJXwkrMSPpCATkct8fJA==", - "optional": true, - "requires": { - "multiformats": "^9.4.2" - } + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", + "optional": true } } + }, + "uint8arrays": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/uint8arrays/-/uint8arrays-3.0.0.tgz", + "integrity": "sha512-HRCx0q6O9Bfbp+HHSfQQKD7wU70+lydKVt4EghkdOvlK/NlrF90z+eXV34mUd48rNvVJXwkrMSPpCATkct8fJA==", + "optional": true, + "requires": { + "multiformats": "^9.4.2" + } + }, + "varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "optional": true } } }, @@ -9154,9 +9208,10 @@ } }, "is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==" + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", + "optional": true }, "is-callable": { "version": "1.2.4", @@ -9777,9 +9832,9 @@ } }, "iter-tools": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/iter-tools/-/iter-tools-7.2.0.tgz", - "integrity": "sha512-wU0BpT8CaJCvXuhBy3WvshLhDwrsrrxWv77B4cSECnqWRm0tv2ozQRQm7M5dCkzoaQCLyRmGO0P2jDVSw5Hjvw==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/iter-tools/-/iter-tools-7.2.2.tgz", + "integrity": "sha512-4PFLfSmndJgzA5wmyAZTJmgrJiDlQK2cGFdfEu9QPzzAnjY59yTbSnzFM/6sclMRQ+Y1MbdhLcVl74djK8PCVQ==", "optional": true, "requires": { "@babel/runtime": "^7.12.1" @@ -9894,13 +9949,18 @@ "dev": true }, "json-pointer": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/json-pointer/-/json-pointer-0.6.1.tgz", - "integrity": "sha512-3OvjqKdCBvH41DLpV4iSt6v2XhZXV1bPB4OROuknvUXI7ZQNofieCPkmE26stEJ9zdQuvIxDHCuYhfgxFAAs+Q==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/json-pointer/-/json-pointer-0.6.2.tgz", + "integrity": "sha512-vLWcKbOaXlO+jvRy4qNd+TI1QUPZzfJj1tpJ3vAXDych5XJf93ftpUKe5pKCrzyIIwgBJcOcCVRUfqQP25afBw==", "requires": { "foreach": "^2.0.4" } }, + "json-rpc-2.0": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/json-rpc-2.0/-/json-rpc-2.0-1.1.0.tgz", + "integrity": "sha512-A4v62rLgwC2U+G3hA1PKRgAXKS55ItTtjUJVbIq68yccD+AUJZSdjayxd0PLQD8i3ustyLvvaYKW6+DglScrjA==" + }, "json-schema": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", @@ -10040,14 +10100,6 @@ "optional": true, "requires": { "is-buffer": "^1.1.5" - }, - "dependencies": { - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "optional": true - } } }, "lazy-debug-legacy": { @@ -10065,6 +10117,12 @@ "readable-stream": "^2.0.5" }, "dependencies": { + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "optional": true + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -10128,6 +10186,12 @@ "integrity": "sha512-ajFP0kJ+nyq4i6kptSM+mAvJKLOg1X5FiFPtLG9M5gCEZyBmgDi3FkDrvlMkEzrUn1cWxtvVmrvoS4ASyO/q+Q==", "optional": true }, + "level-concat-iterator": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", + "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", + "optional": true + }, "level-errors": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/level-errors/-/level-errors-2.0.1.tgz", @@ -10176,12 +10240,6 @@ "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.2.3.tgz", "integrity": "sha1-0UD6j2FGWb1lQSMwl92qwlzdmRw=", "optional": true - }, - "level-concat-iterator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", - "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", - "optional": true } } }, @@ -10195,44 +10253,6 @@ "levelup": "^4.3.2" }, "dependencies": { - "abstract-leveldown": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", - "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", - "optional": true, - "requires": { - "buffer": "^5.5.0", - "immediate": "^3.2.3", - "level-concat-iterator": "~2.0.0", - "level-supports": "~1.0.0", - "xtend": "~4.0.0" - } - }, - "deferred-leveldown": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz", - "integrity": "sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw==", - "optional": true, - "requires": { - "abstract-leveldown": "~6.2.1", - "inherits": "^2.0.3" - } - }, - "level-concat-iterator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", - "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", - "optional": true - }, - "level-supports": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", - "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", - "optional": true, - "requires": { - "xtend": "^4.0.2" - } - }, "levelup": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/levelup/-/levelup-4.4.0.tgz", @@ -10248,6 +10268,15 @@ } } }, + "level-supports": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", + "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", + "optional": true, + "requires": { + "xtend": "^4.0.2" + } + }, "level-write-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/level-write-stream/-/level-write-stream-1.0.0.tgz", @@ -10279,12 +10308,6 @@ "xtend": "~4.0.0" } }, - "level-concat-iterator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", - "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", - "optional": true - }, "node-gyp-build": { "version": "3.8.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-3.8.0.tgz", @@ -10303,21 +10326,43 @@ "level-errors": "~2.0.0", "level-iterator-stream": "~4.0.0", "xtend": "~4.0.0" - } - }, - "levn": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", - "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", - "optional": true, - "requires": { - "prelude-ls": "~1.1.2", - "type-check": "~0.3.2" - } - }, - "libp2p-crypto": { - "version": "0.19.7", - "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.19.7.tgz", + }, + "dependencies": { + "abstract-leveldown": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.0.3.tgz", + "integrity": "sha512-jzewKKpZbaYUa6HTThnrl+GrJhzjEAeuc7hTVpZdzg7kupXZFoqQDFwyOwLNbmJKJlmzw8yiipMPkDiuKkT06Q==", + "optional": true, + "requires": { + "level-concat-iterator": "~2.0.0", + "xtend": "~4.0.0" + } + }, + "deferred-leveldown": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.0.1.tgz", + "integrity": "sha512-BXohsvTedWOLkj2n/TY+yqVlrCWa2Zs8LSxh3uCAgFOru7/pjxKyZAexGa1j83BaKloER4PqUyQ9rGPJLt9bqA==", + "optional": true, + "requires": { + "abstract-leveldown": "~6.0.0", + "inherits": "^2.0.3" + } + } + } + }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "optional": true, + "requires": { + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2" + } + }, + "libp2p-crypto": { + "version": "0.19.7", + "resolved": "https://registry.npmjs.org/libp2p-crypto/-/libp2p-crypto-0.19.7.tgz", "integrity": "sha512-Qb5o/3WFKF2j6mYSt4UBPyi2kbKl3jYV0podBJoJCw70DlpM5Xc+oh3fFY9ToSunu8aSQQ5GY8nutjXgX/uGRA==", "optional": true, "requires": { @@ -10395,12 +10440,6 @@ "integrity": "sha1-DZnzzNem0mHRm9rrkkUAXShYCOc=", "optional": true }, - "lodash.assignin": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz", - "integrity": "sha1-uo31+4QesKPoBEIysOJjqNxqKKI=", - "optional": true - }, "lodash.assigninwith": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/lodash.assigninwith/-/lodash.assigninwith-4.2.0.tgz", @@ -10460,12 +10499,6 @@ "resolved": "https://registry.npmjs.org/lodash.partition/-/lodash.partition-4.6.0.tgz", "integrity": "sha1-o45GtzRp4EILDaEhLmbUFL42S6Q=" }, - "lodash.pick": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", - "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=", - "optional": true - }, "lodash.rest": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/lodash.rest/-/lodash.rest-4.0.5.tgz", @@ -10689,17 +10722,6 @@ "inherits": "~2.0.1", "ltgt": "~2.2.0", "safe-buffer": "~5.1.1" - }, - "dependencies": { - "abstract-leveldown": { - "version": "2.7.2", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-2.7.2.tgz", - "integrity": "sha512-+OVvxH2rHVEhWLdbudP6p0+dNMXu8JA1CbhP19T8paTYAcX7oJ4OVjT+ZUVpv7mITxXHqDMej+GdqXBmXkw09w==", - "optional": true, - "requires": { - "xtend": "~4.0.0" - } - } } }, "memorystream": { @@ -10739,6 +10761,12 @@ "readable-stream": "^2.0.1" }, "dependencies": { + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "optional": true + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -10843,9 +10871,9 @@ } }, "mimic-fn": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-3.1.0.tgz", - "integrity": "sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", "optional": true }, "mimic-response": { @@ -11538,9 +11566,9 @@ } }, "multiformats": { - "version": "9.6.2", - "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.6.2.tgz", - "integrity": "sha512-1dKng7RkBelbEZQQD2zvdzYKgUmtggpWl+GXQBYhnEGGkV6VIYfWgV3VSeyhcUFFEelI5q4D0etCJZ7fbuiamQ==", + "version": "9.6.4", + "resolved": "https://registry.npmjs.org/multiformats/-/multiformats-9.6.4.tgz", + "integrity": "sha512-fCCB6XMrr6CqJiHNjfFNGT0v//dxOBMrOMqUIzpPc/mmITweLEyhvMpY9bF+jZ9z3vaMAau5E8B68DW77QMXkg==", "optional": true }, "multihashes": { @@ -11655,13 +11683,10 @@ "optional": true }, "native-fetch": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/native-fetch/-/native-fetch-2.0.1.tgz", - "integrity": "sha512-gv4Bea+ga9QdXINurpkEqun3ap3vnB+WYoe4c8ddqUYEH7B2h6iD39RF8uVN7OwmSfMY3RDxkvBnoI4e2/vLXQ==", - "optional": true, - "requires": { - "globalthis": "^1.0.1" - } + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/native-fetch/-/native-fetch-3.0.0.tgz", + "integrity": "sha512-G3Z7vx0IFb/FQ4JxvtqGABsOTIqRWvgQz6e+erkB+JJD6LrszQtMozEHI4EkmgZQvnGHrpLVzUWk7t4sJCIkVw==", + "optional": true }, "needle": { "version": "2.9.1", @@ -11720,15 +11745,6 @@ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "optional": true, - "requires": { - "whatwg-url": "^5.0.0" - } - }, "node-forge": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", @@ -12325,20 +12341,12 @@ } }, "onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", "optional": true, "requires": { - "mimic-fn": "^2.1.0" - }, - "dependencies": { - "mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "optional": true - } + "mimic-fn": "^1.0.0" } }, "opencollective-postinstall": { @@ -12431,6 +12439,12 @@ "readable-stream": "^2.0.1" }, "dependencies": { + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "optional": true + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -12582,14 +12596,6 @@ "optional": true, "requires": { "event-iterator": "^1.0.0" - }, - "dependencies": { - "event-iterator": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/event-iterator/-/event-iterator-1.2.0.tgz", - "integrity": "sha512-Daq7YUl0Mv1i4QEgzGQlz0jrx7hUFNyLGbiF+Ap7NCMCjDLCCnolyj6s0TAc6HmrBziO5rNVHsPwGMp7KdRPvw==", - "optional": true - } } }, "parse-asn1": { @@ -12809,12 +12815,6 @@ "requires": { "multiformats": "^9.4.2" } - }, - "varint": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", - "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", - "optional": true } } }, @@ -12837,6 +12837,12 @@ "requires": { "multiformats": "^9.4.2" } + }, + "varint": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/varint/-/varint-5.0.2.tgz", + "integrity": "sha512-lKxKYG6H03yCZUpAGOPOsMcGxd1RHCu1iKvEHYDPmTyq2HueGhD73ssNBqqQWfvYs04G9iUFRvmAVLW20Jw6ow==", + "optional": true } } }, @@ -12848,6 +12854,12 @@ "requires": { "multiformats": "^9.4.2" } + }, + "varint": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz", + "integrity": "sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==", + "optional": true } } }, @@ -13070,12 +13082,49 @@ "string_decoder": "~0.10.x" } }, + "safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "optional": true + }, "string_decoder": { "version": "0.10.31", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", "optional": true }, + "through2": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz", + "integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==", + "optional": true, + "requires": { + "readable-stream": "2 || 3" + }, + "dependencies": { + "readable-stream": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", + "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", + "optional": true, + "requires": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + } + }, + "string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "optional": true, + "requires": { + "safe-buffer": "~5.2.0" + } + } + } + }, "uuid": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", @@ -13085,89 +13134,19 @@ } }, "pouchdb-abstract-mapreduce": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-abstract-mapreduce/-/pouchdb-abstract-mapreduce-7.0.0.tgz", - "integrity": "sha512-C1sb9AIJYTFOUPtuPaAYBCfd09DK82LmeYEtM4h1Z+wG76zj9U1NEg8T+CwxcpOF7eX3ZN5EmSfa3k/ZlyMUgQ==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/pouchdb-abstract-mapreduce/-/pouchdb-abstract-mapreduce-7.2.2.tgz", + "integrity": "sha512-7HWN/2yV2JkwMnGnlp84lGvFtnm0Q55NiBUdbBcaT810+clCGKvhssBCrXnmwShD1SXTwT83aszsgiSfW+SnBA==", "optional": true, "requires": { - "pouchdb-binary-utils": "7.0.0", - "pouchdb-collate": "7.0.0", - "pouchdb-collections": "7.0.0", - "pouchdb-errors": "7.0.0", - "pouchdb-fetch": "7.0.0", - "pouchdb-mapreduce-utils": "7.0.0", - "pouchdb-md5": "7.0.0", - "pouchdb-utils": "7.0.0" - }, - "dependencies": { - "immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=", - "optional": true - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "optional": true - }, - "pouchdb-binary-utils": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-binary-utils/-/pouchdb-binary-utils-7.0.0.tgz", - "integrity": "sha512-yUktdOPIPvOVouCjJN3uop+bCcpdPwePrLm9eUAZNgEYnUFu0njdx7Q0WRsZ7UJ6l75HinL5ZHk4bnvEt86FLw==", - "optional": true, - "requires": { - "buffer-from": "1.1.0" - } - }, - "pouchdb-collections": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-collections/-/pouchdb-collections-7.0.0.tgz", - "integrity": "sha512-DaoUr/vU24Q3gM6ghj0va9j/oBanPwkbhkvnqSyC3Dm5dgf5pculNxueLF9PKMo3ycApoWzHMh6N2N8KJbDU2Q==", - "optional": true - }, - "pouchdb-errors": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-errors/-/pouchdb-errors-7.0.0.tgz", - "integrity": "sha512-dTusY8nnTw4HIztCrNl7AoGgwvS1bVf/3/97hDaGc4ytn72V9/4dK8kTqlimi3UpaurohYRnqac0SGXYP8vgXA==", - "optional": true, - "requires": { - "inherits": "2.0.3" - } - }, - "pouchdb-md5": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-md5/-/pouchdb-md5-7.0.0.tgz", - "integrity": "sha512-yaSJKhLA3QlgloKUQeb2hLdT3KmUmPfoYdryfwHZuPTpXIRKTnMQTR9qCIRUszc0ruBpDe53DRslCgNUhAyTNQ==", - "optional": true, - "requires": { - "pouchdb-binary-utils": "7.0.0", - "spark-md5": "3.0.0" - } - }, - "pouchdb-utils": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-utils/-/pouchdb-utils-7.0.0.tgz", - "integrity": "sha512-1bnoX1KdZYHv9wicDIFdO0PLiVIMzNDUBUZ/yOJZ+6LW6niQCB8aCv09ZztmKfSQcU5nnN3fe656tScBgP6dOQ==", - "optional": true, - "requires": { - "argsarray": "0.0.1", - "clone-buffer": "1.0.0", - "immediate": "3.0.6", - "inherits": "2.0.3", - "pouchdb-collections": "7.0.0", - "pouchdb-errors": "7.0.0", - "pouchdb-md5": "7.0.0", - "uuid": "3.2.1" - } - }, - "uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", - "optional": true - } + "pouchdb-binary-utils": "7.2.2", + "pouchdb-collate": "7.2.2", + "pouchdb-collections": "7.2.2", + "pouchdb-errors": "7.2.2", + "pouchdb-fetch": "7.2.2", + "pouchdb-mapreduce-utils": "7.2.2", + "pouchdb-md5": "7.2.2", + "pouchdb-utils": "7.2.2" } }, "pouchdb-adapter-leveldb-core": { @@ -13192,50 +13171,12 @@ "through2": "3.0.2" }, "dependencies": { - "abstract-leveldown": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz", - "integrity": "sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ==", - "optional": true, - "requires": { - "buffer": "^5.5.0", - "immediate": "^3.2.3", - "level-concat-iterator": "~2.0.0", - "level-supports": "~1.0.0", - "xtend": "~4.0.0" - } - }, "buffer-from": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", "optional": true }, - "deferred-leveldown": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz", - "integrity": "sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw==", - "optional": true, - "requires": { - "abstract-leveldown": "~6.2.1", - "inherits": "^2.0.3" - } - }, - "level-concat-iterator": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz", - "integrity": "sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw==", - "optional": true - }, - "level-supports": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-1.0.1.tgz", - "integrity": "sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg==", - "optional": true, - "requires": { - "xtend": "^4.0.2" - } - }, "levelup": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/levelup/-/levelup-4.4.0.tgz", @@ -13499,9 +13440,9 @@ } }, "pouchdb-collate": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-collate/-/pouchdb-collate-7.0.0.tgz", - "integrity": "sha512-0O67rnNGVD9OUbDx+6DLPcE3zz7w6gieNCvrbvaI5ibIXuLpyMyLjD6OdRe/19LbstEfZaOp+SYUhQs+TP8Plg==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/pouchdb-collate/-/pouchdb-collate-7.2.2.tgz", + "integrity": "sha512-/SMY9GGasslknivWlCVwXMRMnQ8myKHs4WryQ5535nq1Wj/ehpqWloMwxEQGvZE1Sda3LOm7/5HwLTcB8Our+w==", "optional": true }, "pouchdb-collections": { @@ -13522,209 +13463,87 @@ "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "optional": true, - "requires": { - "ms": "2.0.0" - } - } - } - }, - "pouchdb-errors": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/pouchdb-errors/-/pouchdb-errors-7.2.2.tgz", - "integrity": "sha512-6GQsiWc+7uPfgEHeavG+7wuzH3JZW29Dnrvz8eVbDFE50kVFxNDVm3EkYHskvo5isG7/IkOx7PV7RPTA3keG3g==", - "optional": true, - "requires": { - "inherits": "2.0.4" - } - }, - "pouchdb-fetch": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-fetch/-/pouchdb-fetch-7.0.0.tgz", - "integrity": "sha512-9XGEogHQcYZCJp2PvLE7oDgGzIsBy4Vh28EhDS26iJFwtDVpHYm7fIzJ//SDGcUNjnlR9WKTegFLg9p7jYIQWQ==", - "optional": true, - "requires": { - "fetch-cookie": "0.7.0", - "node-fetch": "^2.0.0" - } - }, - "pouchdb-find": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-find/-/pouchdb-find-7.0.0.tgz", - "integrity": "sha512-nqAdnbmmxcIrWF//k5LKDGXaDZScgvhqVoyGjXhiUan35ASI0KYn1R8Z0nGsl0PD/DRK1kveQjbC9+50QgdTRg==", - "optional": true, - "requires": { - "pouchdb-abstract-mapreduce": "7.0.0", - "pouchdb-collate": "7.0.0", - "pouchdb-errors": "7.0.0", - "pouchdb-fetch": "7.0.0", - "pouchdb-md5": "7.0.0", - "pouchdb-selector-core": "7.0.0", - "pouchdb-utils": "7.0.0" - }, - "dependencies": { - "immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=", - "optional": true - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "optional": true - }, - "pouchdb-binary-utils": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-binary-utils/-/pouchdb-binary-utils-7.0.0.tgz", - "integrity": "sha512-yUktdOPIPvOVouCjJN3uop+bCcpdPwePrLm9eUAZNgEYnUFu0njdx7Q0WRsZ7UJ6l75HinL5ZHk4bnvEt86FLw==", - "optional": true, - "requires": { - "buffer-from": "1.1.0" - } - }, - "pouchdb-collections": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-collections/-/pouchdb-collections-7.0.0.tgz", - "integrity": "sha512-DaoUr/vU24Q3gM6ghj0va9j/oBanPwkbhkvnqSyC3Dm5dgf5pculNxueLF9PKMo3ycApoWzHMh6N2N8KJbDU2Q==", - "optional": true - }, - "pouchdb-errors": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-errors/-/pouchdb-errors-7.0.0.tgz", - "integrity": "sha512-dTusY8nnTw4HIztCrNl7AoGgwvS1bVf/3/97hDaGc4ytn72V9/4dK8kTqlimi3UpaurohYRnqac0SGXYP8vgXA==", - "optional": true, - "requires": { - "inherits": "2.0.3" - } - }, - "pouchdb-md5": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-md5/-/pouchdb-md5-7.0.0.tgz", - "integrity": "sha512-yaSJKhLA3QlgloKUQeb2hLdT3KmUmPfoYdryfwHZuPTpXIRKTnMQTR9qCIRUszc0ruBpDe53DRslCgNUhAyTNQ==", - "optional": true, - "requires": { - "pouchdb-binary-utils": "7.0.0", - "spark-md5": "3.0.0" - } - }, - "pouchdb-utils": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-utils/-/pouchdb-utils-7.0.0.tgz", - "integrity": "sha512-1bnoX1KdZYHv9wicDIFdO0PLiVIMzNDUBUZ/yOJZ+6LW6niQCB8aCv09ZztmKfSQcU5nnN3fe656tScBgP6dOQ==", - "optional": true, - "requires": { - "argsarray": "0.0.1", - "clone-buffer": "1.0.0", - "immediate": "3.0.6", - "inherits": "2.0.3", - "pouchdb-collections": "7.0.0", - "pouchdb-errors": "7.0.0", - "pouchdb-md5": "7.0.0", - "uuid": "3.2.1" - } - }, - "uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", - "optional": true - } - } - }, - "pouchdb-json": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/pouchdb-json/-/pouchdb-json-7.2.2.tgz", - "integrity": "sha512-3b2S2ynN+aoB7aCNyDZc/4c0IAdx/ir3nsHB+/RrKE9cM3QkQYbnnE3r/RvOD1Xvr6ji/KOCBie+Pz/6sxoaug==", - "optional": true, - "requires": { - "vuvuzela": "1.0.3" - } - }, - "pouchdb-mapreduce-utils": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-mapreduce-utils/-/pouchdb-mapreduce-utils-7.0.0.tgz", - "integrity": "sha512-kj74SpirbQAC7BSlBpPO42RBbUw8XmxbkLCnHyL7CVktyEn24VHbCoirutUI2mRPii7MAVHtleGKXRijR5QIpw==", - "optional": true, - "requires": { - "argsarray": "0.0.1", - "inherits": "2.0.3", - "pouchdb-collections": "7.0.0", - "pouchdb-utils": "7.0.0" - }, - "dependencies": { - "immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=", - "optional": true - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "optional": true - }, - "pouchdb-binary-utils": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-binary-utils/-/pouchdb-binary-utils-7.0.0.tgz", - "integrity": "sha512-yUktdOPIPvOVouCjJN3uop+bCcpdPwePrLm9eUAZNgEYnUFu0njdx7Q0WRsZ7UJ6l75HinL5ZHk4bnvEt86FLw==", - "optional": true, - "requires": { - "buffer-from": "1.1.0" - } - }, - "pouchdb-collections": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-collections/-/pouchdb-collections-7.0.0.tgz", - "integrity": "sha512-DaoUr/vU24Q3gM6ghj0va9j/oBanPwkbhkvnqSyC3Dm5dgf5pculNxueLF9PKMo3ycApoWzHMh6N2N8KJbDU2Q==", - "optional": true - }, - "pouchdb-errors": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-errors/-/pouchdb-errors-7.0.0.tgz", - "integrity": "sha512-dTusY8nnTw4HIztCrNl7AoGgwvS1bVf/3/97hDaGc4ytn72V9/4dK8kTqlimi3UpaurohYRnqac0SGXYP8vgXA==", - "optional": true, - "requires": { - "inherits": "2.0.3" - } - }, - "pouchdb-md5": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-md5/-/pouchdb-md5-7.0.0.tgz", - "integrity": "sha512-yaSJKhLA3QlgloKUQeb2hLdT3KmUmPfoYdryfwHZuPTpXIRKTnMQTR9qCIRUszc0ruBpDe53DRslCgNUhAyTNQ==", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "optional": true, "requires": { - "pouchdb-binary-utils": "7.0.0", - "spark-md5": "3.0.0" + "ms": "2.0.0" } - }, - "pouchdb-utils": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-utils/-/pouchdb-utils-7.0.0.tgz", - "integrity": "sha512-1bnoX1KdZYHv9wicDIFdO0PLiVIMzNDUBUZ/yOJZ+6LW6niQCB8aCv09ZztmKfSQcU5nnN3fe656tScBgP6dOQ==", + } + } + }, + "pouchdb-errors": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/pouchdb-errors/-/pouchdb-errors-7.2.2.tgz", + "integrity": "sha512-6GQsiWc+7uPfgEHeavG+7wuzH3JZW29Dnrvz8eVbDFE50kVFxNDVm3EkYHskvo5isG7/IkOx7PV7RPTA3keG3g==", + "optional": true, + "requires": { + "inherits": "2.0.4" + } + }, + "pouchdb-fetch": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/pouchdb-fetch/-/pouchdb-fetch-7.2.2.tgz", + "integrity": "sha512-lUHmaG6U3zjdMkh8Vob9GvEiRGwJfXKE02aZfjiVQgew+9SLkuOxNw3y2q4d1B6mBd273y1k2Lm0IAziRNxQnA==", + "optional": true, + "requires": { + "abort-controller": "3.0.0", + "fetch-cookie": "0.10.1", + "node-fetch": "2.6.0" + }, + "dependencies": { + "fetch-cookie": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/fetch-cookie/-/fetch-cookie-0.10.1.tgz", + "integrity": "sha512-beB+VEd4cNeVG1PY+ee74+PkuCQnik78pgLi5Ah/7qdUfov8IctU0vLUbBT8/10Ma5GMBeI4wtxhGrEfKNYs2g==", "optional": true, "requires": { - "argsarray": "0.0.1", - "clone-buffer": "1.0.0", - "immediate": "3.0.6", - "inherits": "2.0.3", - "pouchdb-collections": "7.0.0", - "pouchdb-errors": "7.0.0", - "pouchdb-md5": "7.0.0", - "uuid": "3.2.1" + "tough-cookie": "^2.3.3 || ^3.0.1 || ^4.0.0" } }, - "uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==", "optional": true } } }, + "pouchdb-find": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/pouchdb-find/-/pouchdb-find-7.2.2.tgz", + "integrity": "sha512-BmFeFVQ0kHmDehvJxNZl9OmIztCjPlZlVSdpijuFbk/Fi1EFPU1BAv3kLC+6DhZuOqU/BCoaUBY9sn66pPY2ag==", + "optional": true, + "requires": { + "pouchdb-abstract-mapreduce": "7.2.2", + "pouchdb-collate": "7.2.2", + "pouchdb-errors": "7.2.2", + "pouchdb-fetch": "7.2.2", + "pouchdb-md5": "7.2.2", + "pouchdb-selector-core": "7.2.2", + "pouchdb-utils": "7.2.2" + } + }, + "pouchdb-json": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/pouchdb-json/-/pouchdb-json-7.2.2.tgz", + "integrity": "sha512-3b2S2ynN+aoB7aCNyDZc/4c0IAdx/ir3nsHB+/RrKE9cM3QkQYbnnE3r/RvOD1Xvr6ji/KOCBie+Pz/6sxoaug==", + "optional": true, + "requires": { + "vuvuzela": "1.0.3" + } + }, + "pouchdb-mapreduce-utils": { + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/pouchdb-mapreduce-utils/-/pouchdb-mapreduce-utils-7.2.2.tgz", + "integrity": "sha512-rAllb73hIkU8rU2LJNbzlcj91KuulpwQu804/F6xF3fhZKC/4JQMClahk+N/+VATkpmLxp1zWmvmgdlwVU4HtQ==", + "optional": true, + "requires": { + "argsarray": "0.0.1", + "inherits": "2.0.4", + "pouchdb-collections": "7.2.2", + "pouchdb-utils": "7.2.2" + } + }, "pouchdb-md5": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/pouchdb-md5/-/pouchdb-md5-7.2.2.tgz", @@ -13750,83 +13569,13 @@ "optional": true }, "pouchdb-selector-core": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-selector-core/-/pouchdb-selector-core-7.0.0.tgz", - "integrity": "sha512-8Lpa8S7TCRGUEy3aEMd+Zy85IU4KwCVNf3TT+HJ8XAKICtmgArPrQGimIXFOHoyjRSpCXtByzEriP8CBCUjp7g==", + "version": "7.2.2", + "resolved": "https://registry.npmjs.org/pouchdb-selector-core/-/pouchdb-selector-core-7.2.2.tgz", + "integrity": "sha512-XYKCNv9oiNmSXV5+CgR9pkEkTFqxQGWplnVhO3W9P154H08lU0ZoNH02+uf+NjZ2kjse7Q1fxV4r401LEcGMMg==", "optional": true, "requires": { - "pouchdb-collate": "7.0.0", - "pouchdb-utils": "7.0.0" - }, - "dependencies": { - "immediate": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz", - "integrity": "sha1-nbHb0Pr43m++D13V5Wu2BigN5ps=", - "optional": true - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "optional": true - }, - "pouchdb-binary-utils": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-binary-utils/-/pouchdb-binary-utils-7.0.0.tgz", - "integrity": "sha512-yUktdOPIPvOVouCjJN3uop+bCcpdPwePrLm9eUAZNgEYnUFu0njdx7Q0WRsZ7UJ6l75HinL5ZHk4bnvEt86FLw==", - "optional": true, - "requires": { - "buffer-from": "1.1.0" - } - }, - "pouchdb-collections": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-collections/-/pouchdb-collections-7.0.0.tgz", - "integrity": "sha512-DaoUr/vU24Q3gM6ghj0va9j/oBanPwkbhkvnqSyC3Dm5dgf5pculNxueLF9PKMo3ycApoWzHMh6N2N8KJbDU2Q==", - "optional": true - }, - "pouchdb-errors": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-errors/-/pouchdb-errors-7.0.0.tgz", - "integrity": "sha512-dTusY8nnTw4HIztCrNl7AoGgwvS1bVf/3/97hDaGc4ytn72V9/4dK8kTqlimi3UpaurohYRnqac0SGXYP8vgXA==", - "optional": true, - "requires": { - "inherits": "2.0.3" - } - }, - "pouchdb-md5": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-md5/-/pouchdb-md5-7.0.0.tgz", - "integrity": "sha512-yaSJKhLA3QlgloKUQeb2hLdT3KmUmPfoYdryfwHZuPTpXIRKTnMQTR9qCIRUszc0ruBpDe53DRslCgNUhAyTNQ==", - "optional": true, - "requires": { - "pouchdb-binary-utils": "7.0.0", - "spark-md5": "3.0.0" - } - }, - "pouchdb-utils": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pouchdb-utils/-/pouchdb-utils-7.0.0.tgz", - "integrity": "sha512-1bnoX1KdZYHv9wicDIFdO0PLiVIMzNDUBUZ/yOJZ+6LW6niQCB8aCv09ZztmKfSQcU5nnN3fe656tScBgP6dOQ==", - "optional": true, - "requires": { - "argsarray": "0.0.1", - "clone-buffer": "1.0.0", - "immediate": "3.0.6", - "inherits": "2.0.3", - "pouchdb-collections": "7.0.0", - "pouchdb-errors": "7.0.0", - "pouchdb-md5": "7.0.0", - "uuid": "3.2.1" - } - }, - "uuid": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz", - "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA==", - "optional": true - } + "pouchdb-collate": "7.2.2", + "pouchdb-utils": "7.2.2" } }, "pouchdb-utils": { @@ -13886,9 +13635,9 @@ "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" }, "process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", "optional": true }, "process-on-spawn": { @@ -13934,9 +13683,9 @@ }, "dependencies": { "@types/node": { - "version": "17.0.13", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.13.tgz", - "integrity": "sha512-Y86MAxASe25hNzlDbsviXl8jQHb0RDvKt4c40ZJQ1Don0AAL0STLZSs4N+6gLEO55pedy7r2cLwS+ZDxPm/2Bw==", + "version": "17.0.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz", + "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==", "optional": true } } @@ -14411,23 +14160,6 @@ "requires": { "onetime": "^2.0.0", "signal-exit": "^3.0.2" - }, - "dependencies": { - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "optional": true - }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "optional": true, - "requires": { - "mimic-fn": "^1.0.0" - } - } } }, "retimer": { @@ -14926,6 +14658,21 @@ "restore-cursor": "^3.1.0" } }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "optional": true + }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "optional": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, "restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", @@ -15192,9 +14939,9 @@ "optional": true }, "ws": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.6.tgz", - "integrity": "sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA==", + "version": "7.5.7", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.7.tgz", + "integrity": "sha512-KMvVuFzpKBuiIXW3E4u3mySRO2/mCHSyZDJQM5NQ9Q9KHWHWh0NHgfbRMLLrceUK5qAL4ytALJbpRMjixFZh8A==", "optional": true } } @@ -15368,24 +15115,21 @@ } }, "through2": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/through2/-/through2-3.0.1.tgz", - "integrity": "sha512-M96dvTalPT3YbYLaKaCuwu+j06D/8Jfib0o/PxbVt6Amhv3dUAtW6rTV1jPgJSBG83I/e04Y6xkVdVhSRhi0ww==", - "optional": true, - "requires": { - "readable-stream": "2 || 3" - } - }, - "through2-filter": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-2.0.0.tgz", - "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", "optional": true, "requires": { - "through2": "~2.0.0", - "xtend": "~4.0.0" + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" }, "dependencies": { + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "optional": true + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -15409,19 +15153,19 @@ "requires": { "safe-buffer": "~5.1.0" } - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "optional": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } } } }, + "through2-filter": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-2.0.0.tgz", + "integrity": "sha1-YLxVoNrLdghdsfna6Zq0P4PWIuw=", + "optional": true, + "requires": { + "through2": "~2.0.0", + "xtend": "~4.0.0" + } + }, "tildify": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/tildify/-/tildify-1.2.0.tgz", @@ -15560,17 +15304,17 @@ "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=" }, "truffle": { - "version": "5.4.31", - "resolved": "https://registry.npmjs.org/truffle/-/truffle-5.4.31.tgz", - "integrity": "sha512-qUzLgo9jkI4d9O7fUEQHNXGWSjPjLsN03E2n50pwbAU0XBkOv4vSN+iQTX9QMfk/XBjOf6YN/BnAMubqznxOZg==", - "requires": { - "@truffle/db": "^0.5.49", - "@truffle/db-loader": "^0.0.28", - "@truffle/debugger": "^9.2.13", - "@truffle/preserve-fs": "^0.2.5", - "@truffle/preserve-to-buckets": "^0.2.5", - "@truffle/preserve-to-filecoin": "^0.2.6", - "@truffle/preserve-to-ipfs": "^0.2.6", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/truffle/-/truffle-5.5.2.tgz", + "integrity": "sha512-c+L7vhuKvwl+A1YRysMbGRuDvr2MyzYLWv0zHCiT4kGHqvmo8+i9hUUjfgyY5v/9yoMUD5HEiv8OGArfK/v37Q==", + "requires": { + "@truffle/db": "^0.5.54", + "@truffle/db-loader": "^0.1.4", + "@truffle/debugger": "^9.2.18", + "@truffle/preserve-fs": "^0.2.6", + "@truffle/preserve-to-buckets": "^0.2.7", + "@truffle/preserve-to-filecoin": "^0.2.7", + "@truffle/preserve-to-ipfs": "^0.2.7", "app-module-path": "^2.2.0", "ganache": "7.0.1", "mocha": "8.1.2", @@ -15582,6 +15326,14 @@ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==" }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -15783,14 +15535,6 @@ "strip-ansi": "^5.0.0" }, "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "requires": { - "color-convert": "^1.9.0" - } - }, "string-width": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", @@ -16050,40 +15794,6 @@ "through2-filter": "^3.0.0" }, "dependencies": { - "readable-stream": { - "version": "2.3.7", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", - "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==", - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "optional": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } - }, "through2-filter": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/through2-filter/-/through2-filter-3.0.0.tgz", @@ -16353,9 +16063,9 @@ "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz", + "integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=", "optional": true }, "vali-date": { @@ -16435,6 +16145,12 @@ "vinyl": "^1.0.0" }, "dependencies": { + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", + "optional": true + }, "readable-stream": { "version": "2.3.7", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz", @@ -16458,16 +16174,6 @@ "requires": { "safe-buffer": "~5.1.0" } - }, - "through2": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", - "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", - "optional": true, - "requires": { - "readable-stream": "~2.3.6", - "xtend": "~4.0.1" - } } } }, diff --git a/package.json b/package.json index f15468b..020d9da 100644 --- a/package.json +++ b/package.json @@ -41,10 +41,11 @@ }, "dependencies": { "axios": "^0.25.0", - "azimuth-js": "0.22.2", + "azimuth-js": "^0.23.0", "chalk": "^4.1.2", - "lodash": "^4.17.21", "hdkey": "2.0.1", + "json-rpc-2.0": "^1.1.0", + "lodash": "^4.17.21", "up8-ticket": "^0.2.0", "urbit-key-generation": "^0.20.1", "urbit-ob": "^5.0.1", diff --git a/utils/index.js b/utils/index.js index 483beaa..a668025 100644 --- a/utils/index.js +++ b/utils/index.js @@ -3,11 +3,13 @@ const validate = require("./validate"); const eth = require("./eth"); const azimuth = require("./azimuth"); const findPoints = require("./find-points"); +const rollerApi = require("./roller-api"); module.exports = { files, validate, eth, azimuth, - findPoints + findPoints, + rollerApi } \ No newline at end of file diff --git a/utils/roller-api.js b/utils/roller-api.js new file mode 100644 index 0000000..7181636 --- /dev/null +++ b/utils/roller-api.js @@ -0,0 +1,38 @@ +const ob = require('urbit-ob') +const axios = require('axios') +const {JSONRPCClient } = require('json-rpc-2.0') + +let requestCounter = 0; + +function nextId(){ + requestCounter++; + return requestCounter.toString(); //the roller rpc need a string ID, otherwise it does it does not work +} + +function createClient(){ + var client = new JSONRPCClient(async function (jsonRPCRequest) + { + //TODO: add try catch, check for 200 response (see https://www.npmjs.com/package/json-rpc-2.0) + + //console.log(JSON.stringify(jsonRPCRequest)); + var response = await axios.post("http://localhost:8080/v1/roller", JSON.stringify(jsonRPCRequest)); + const jsonRPCResponse = response.data; + //console.log(jsonRPCResponse) + client.receive(jsonRPCResponse) + }, nextId); + return client; +} + +// Roller JSON-RPC API documentation: +// https://documenter.getpostman.com/view/16338962/Tzm3nx7x + +function getPoint(client, point){ + return client.request("getPoint", { ship: point }) +} + + +module.exports = { + createClient, + getPoint +} + From d2c059decf305f965f3a8d6bf91d848f380473a0 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Sat, 26 Feb 2022 23:50:49 +0100 Subject: [PATCH 02/17] added spawn to roller api --- cmds/l2.js | 5 +++ cmds/l2_cmds/test.js | 29 +++++++------- utils/roller-api.js | 95 +++++++++++++++++++++++++++++++++++++++++--- 3 files changed, 110 insertions(+), 19 deletions(-) diff --git a/cmds/l2.js b/cmds/l2.js index 4891419..54f53c4 100644 --- a/cmds/l2.js +++ b/cmds/l2.js @@ -1,6 +1,11 @@ exports.command = 'l2 ' exports.desc = 'Azimuth Layer 2 Commands' exports.builder = function (yargs) { + yargs.option('private-key',{ + alias: 'k', + describe: 'The private key that signs the transaction. Must be the key of the owner or proxy address.', + type: 'string', + }); return yargs.commandDir('l2_cmds') } exports.handler = function (argv) {} \ No newline at end of file diff --git a/cmds/l2_cmds/test.js b/cmds/l2_cmds/test.js index eaac07d..b360641 100644 --- a/cmds/l2_cmds/test.js +++ b/cmds/l2_cmds/test.js @@ -5,27 +5,28 @@ const {validate, eth, rollerApi} = require('../../utils') exports.command = 'test' exports.desc = 'L2 workbench command.' exports.builder = (yargs) =>{ + yargs.demandOption('private-key'); } exports.handler = async function (argv) { - const p = Number(ob.patp2dec("~sardys")); + const privateKey = await eth.getPrivateKey(argv); const rollerClient = rollerApi.createClient(); - var pointInfo = await rollerApi.getPoint(rollerClient, "~sardys"); - console.log(pointInfo); - - console.log("Done"); - //const point = await roller.getPoint(p); - //console.log(point); + // const p = Number(ob.patp2dec("~sardys")); + + // + // var pointInfo = await rollerApi.getPoint(rollerClient, "~sardys"); + // console.log(pointInfo); + + // console.log("Get point, done"); - // Signing: - //const hash = roller.prepareForSigning(12,...) - //or - // const hash = await roller.getUnsignedTx(nonce, from, type, data); - // // const sig = await signTransactionHash(hash, wallet.privateKey); //see authToken.ts - // console.log(resp); - // console.log("Here"); + var spawnedPoint = await rollerApi.spawn( + rollerClient, "~sardys", "~ripwyt-rilfep", + "0x1234", "0x1234", + privateKey); + console.log(spawnedPoint); + console.log("Spawn, done"); } \ No newline at end of file diff --git a/utils/roller-api.js b/utils/roller-api.js index 7181636..ad6b642 100644 --- a/utils/roller-api.js +++ b/utils/roller-api.js @@ -1,6 +1,11 @@ const ob = require('urbit-ob') +const ajsUtils = require('azimuth-js').utils; const axios = require('axios') const {JSONRPCClient } = require('json-rpc-2.0') +const validate = require('./validate') + +const { hexToBytes } = require('web3-utils'); +const { ecdsaSign } = require('secp256k1'); let requestCounter = 0; @@ -12,27 +17,107 @@ function nextId(){ function createClient(){ var client = new JSONRPCClient(async function (jsonRPCRequest) { - //TODO: add try catch, check for 200 response (see https://www.npmjs.com/package/json-rpc-2.0) + //TODO: add try catch, check for 200 response (see https://www.npmjs.com/package/json-rpc-2.0), show error codes - //console.log(JSON.stringify(jsonRPCRequest)); + console.log(JSON.stringify(jsonRPCRequest)); var response = await axios.post("http://localhost:8080/v1/roller", JSON.stringify(jsonRPCRequest)); const jsonRPCResponse = response.data; - //console.log(jsonRPCResponse) + console.log(jsonRPCResponse) client.receive(jsonRPCResponse) }, nextId); return client; } +function signTransactionHash(msg, pk) { + const pkBuffer = Buffer.from(pk, 'hex'); + if(!ajsUtils.isValidPrivate(pkBuffer)) + throw 'pk is not valid'; + + // msg is a keccak-256 hash + // + const hashed = Buffer.from(hexToBytes(msg)); + const { signature, recid } = ecdsaSign(hashed, pkBuffer); + // add key recovery parameter + const ethSignature = new Uint8Array(65); + ethSignature.set(signature); + ethSignature[64] = recid; + return `0x${Buffer.from(ethSignature).toString('hex')}`; +} + +function getNonce(client, params){ + const ship = params.from.ship; + const nonceParams = { + from: params.from + }; + return client.request("getNonce", nonceParams); +} + +//use this if signing via metamask or wallet connect +async function prepareForSigning(client, method, params){ + const nonce = await getNonce(client, params); + const hashParams = { + tx: method, + nonce: nonce, + from: params.from, + data: params.data + } + return await client.request("prepareForSigning", hashParams); +} + +//use this if singing directly with pk +async function getUnsignedTx(client, method, params){ + const nonce = await getNonce(client, params); + const hashParams = { + tx: method, + nonce: nonce, + from: params.from, + data: params.data + } + var res = await client.request("getUnsignedTx", hashParams); + console.log("RESULT: "+res); + return res; +} + +async function addSignature(client, method, params, privateKey){ + const hash = await getUnsignedTx(client, method, params); + const sig = signTransactionHash(hash, privateKey); + params["sig"] = sig; + return params; +} + // Roller JSON-RPC API documentation: // https://documenter.getpostman.com/view/16338962/Tzm3nx7x function getPoint(client, point){ - return client.request("getPoint", { ship: point }) + return client.request("getPoint", { ship: point }); +} + +async function spawn(client, parentPoint, spawnPoint, newOwnerAddress, signingAddress, privateKey){ + const parentPatp = ob.patp(validate.point(parentPoint, true)); + const spawnPatp = ob.patp(validate.point(spawnPoint, true)); + const newOwnerAddressValid = validate.address(newOwnerAddress, true); + const signingAddressValid = validate.address(signingAddress, true); + + let params = { + address: signingAddressValid, + from: { + ship: parentPatp, + proxy: "own" + }, + data: { + ship: spawnPatp, + address: newOwnerAddressValid, + } + }; + const method = "spawn"; + params = await addSignature(client, method, params, privateKey); + return await client.request(method, params); } module.exports = { createClient, - getPoint + getPoint, + spawn } From da2e4962b8f26a33a3fd06cb4c36eb4bfa857c23 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Sun, 27 Feb 2022 11:15:26 +0100 Subject: [PATCH 03/17] added L2 list and spawn command --- cmds/l2.js | 11 --- cmds/l2_cmds/test.js | 32 ------ cmds/list-l2.js | 6 ++ cmds/list-l2_cmds/children.js | 44 +++++++++ cmds/list-l2_cmds/details.js | 20 ++++ cmds/list-l2_cmds/owner.js | 21 ++++ cmds/list-l2_cmds/pending.js | 16 +++ cmds/list-l2_cmds/roller-info.js | 23 +++++ cmds/modify-l2.js | 72 ++++++++++++++ cmds/modify-l2_cmds/spawn.js | 51 ++++++++++ utils/roller-api.js | 163 +++++++++++++++++++++++++++++-- 11 files changed, 410 insertions(+), 49 deletions(-) delete mode 100644 cmds/l2.js delete mode 100644 cmds/l2_cmds/test.js create mode 100644 cmds/list-l2.js create mode 100644 cmds/list-l2_cmds/children.js create mode 100644 cmds/list-l2_cmds/details.js create mode 100644 cmds/list-l2_cmds/owner.js create mode 100644 cmds/list-l2_cmds/pending.js create mode 100644 cmds/list-l2_cmds/roller-info.js create mode 100644 cmds/modify-l2.js create mode 100644 cmds/modify-l2_cmds/spawn.js diff --git a/cmds/l2.js b/cmds/l2.js deleted file mode 100644 index 54f53c4..0000000 --- a/cmds/l2.js +++ /dev/null @@ -1,11 +0,0 @@ -exports.command = 'l2 ' -exports.desc = 'Azimuth Layer 2 Commands' -exports.builder = function (yargs) { - yargs.option('private-key',{ - alias: 'k', - describe: 'The private key that signs the transaction. Must be the key of the owner or proxy address.', - type: 'string', - }); - return yargs.commandDir('l2_cmds') -} -exports.handler = function (argv) {} \ No newline at end of file diff --git a/cmds/l2_cmds/test.js b/cmds/l2_cmds/test.js deleted file mode 100644 index b360641..0000000 --- a/cmds/l2_cmds/test.js +++ /dev/null @@ -1,32 +0,0 @@ -const ajs = require('azimuth-js') -const ob = require('urbit-ob') -const {validate, eth, rollerApi} = require('../../utils') - -exports.command = 'test' -exports.desc = 'L2 workbench command.' -exports.builder = (yargs) =>{ - yargs.demandOption('private-key'); -} - -exports.handler = async function (argv) { - - const privateKey = await eth.getPrivateKey(argv); - - const rollerClient = rollerApi.createClient(); - - // const p = Number(ob.patp2dec("~sardys")); - - // - // var pointInfo = await rollerApi.getPoint(rollerClient, "~sardys"); - // console.log(pointInfo); - - // console.log("Get point, done"); - - - var spawnedPoint = await rollerApi.spawn( - rollerClient, "~sardys", "~ripwyt-rilfep", - "0x1234", "0x1234", - privateKey); - console.log(spawnedPoint); - console.log("Spawn, done"); -} \ No newline at end of file diff --git a/cmds/list-l2.js b/cmds/list-l2.js new file mode 100644 index 0000000..3091231 --- /dev/null +++ b/cmds/list-l2.js @@ -0,0 +1,6 @@ +exports.command = 'list-l2 ' +exports.desc = 'Azimuth layer 2 commands for retriving infromation about points, addresses, and roller.' +exports.builder = function (yargs) { + return yargs.commandDir('list-l2_cmds') +} +exports.handler = function (argv) {} \ No newline at end of file diff --git a/cmds/list-l2_cmds/children.js b/cmds/list-l2_cmds/children.js new file mode 100644 index 0000000..ee1ab84 --- /dev/null +++ b/cmds/list-l2_cmds/children.js @@ -0,0 +1,44 @@ +const ob = require('urbit-ob') +const {validate, eth, azimuth, rollerApi} = require('../../utils') + +exports.command = 'children ' +exports.desc = 'List all children for , where is patp or p.' +exports.builder = (yargs) =>{ + yargs.option('unspawned',{ + alias: 'u', + describe: 'Only include unspawned points.', + type: 'boolean', + conflicts: 'spawned' + }); + yargs.option('spawned',{ + alias: 's', + describe: 'Only include spawned points.', + type: 'boolean', + conflicts: 'unspawned' + }); +} + +exports.handler = async function (argv) { + const point = validate.point(argv.point, true); + const rollerClient = rollerApi.createClient(); + + let childPoints = null; + if(argv.spawned){ + childPoints = await rollerApi.getSpawned(rollerClient, point); + } + else if(argv.unspawned){ + childPoints = await rollerApi.getUnspawned(rollerClient, point); + } + else{ + childPoints = azimuth.getChildren(point); + } + + console.log(`listing ${childPoints.length} children under ${ob.patp(point)} (${point}):`); + for(const p of childPoints) + { + const patp = ob.patp(p); + console.log(`${patp} (${p})`); + } +} + + diff --git a/cmds/list-l2_cmds/details.js b/cmds/list-l2_cmds/details.js new file mode 100644 index 0000000..d3395cf --- /dev/null +++ b/cmds/list-l2_cmds/details.js @@ -0,0 +1,20 @@ +const ob = require('urbit-ob') +const {validate, rollerApi} = require('../../utils') + +exports.command = 'details ' +exports.desc = 'Outputs various information about a retrieved from a roller.' +exports.builder = (yargs) =>{ +} + +exports.handler = async function (argv) { + const p = validate.point(argv.point, true); + const patp = ob.patp(p); + console.log(`urbit ID (patp): ${patp}`); + console.log(`urbit ID number (p): ${p}`); + + const rollerClient = rollerApi.createClient(); + const pointInfo = await rollerApi.getPoint(rollerClient, p); + console.log(`data from roller:`); + console.log(JSON.stringify(pointInfo, null, 2)); + +} \ No newline at end of file diff --git a/cmds/list-l2_cmds/owner.js b/cmds/list-l2_cmds/owner.js new file mode 100644 index 0000000..d1071de --- /dev/null +++ b/cmds/list-l2_cmds/owner.js @@ -0,0 +1,21 @@ +const ob = require('urbit-ob') +const {validate, eth, rollerApi} = require('../../utils') + +exports.command = 'owner ' +exports.desc = 'List points of which the is owner.' +exports.builder = (yargs) =>{ + yargs.positional('addr', {type: 'string'}) +} + +exports.handler = async function (argv) { + let addr = validate.address(argv.addr, true); + const rollerClient = rollerApi.createClient(); + + let points = await rollerApi.getShips(rollerClient, addr); + console.log(`listing ${points.length} owned points by ${addr}:`); + for(const p of points) + { + const patp = ob.patp(p); + console.log(`${patp}, ${p}`); + } +} \ No newline at end of file diff --git a/cmds/list-l2_cmds/pending.js b/cmds/list-l2_cmds/pending.js new file mode 100644 index 0000000..e5454b0 --- /dev/null +++ b/cmds/list-l2_cmds/pending.js @@ -0,0 +1,16 @@ +const ob = require('urbit-ob') +const {validate, rollerApi} = require('../../utils') + +exports.command = 'pending' +exports.desc = 'Outputs the pending roller transactions.' +exports.builder = (yargs) =>{ +} + +exports.handler = async function (argv) { + + const rollerClient = rollerApi.createClient(); + const data = await rollerApi.getAllPending(rollerClient); + console.log(`data from roller:`); + console.log(JSON.stringify(data, null, 2)); + +} \ No newline at end of file diff --git a/cmds/list-l2_cmds/roller-info.js b/cmds/list-l2_cmds/roller-info.js new file mode 100644 index 0000000..67504bd --- /dev/null +++ b/cmds/list-l2_cmds/roller-info.js @@ -0,0 +1,23 @@ +const {rollerApi} = require('../../utils') + +exports.command = 'roller-info' +exports.desc = 'Outputs information about the roller, including next batch time.' +exports.builder = (yargs) =>{ +} + +exports.handler = async function (argv) { + + const rollerClient = rollerApi.createClient(); + + const rollerConfig = await rollerApi.getRollerConfig(rollerClient); + console.log(`roller config:`); + console.log(JSON.stringify(rollerConfig, null, 2)); + + + var date = new Date(rollerConfig.nextBatch * 1000); + var hours = date.getHours(); + var minutes = "0" + date.getMinutes(); + var seconds = "0" + date.getSeconds(); + var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2); + console.log(`next batch: ${formattedTime} GMT`); +} \ No newline at end of file diff --git a/cmds/modify-l2.js b/cmds/modify-l2.js new file mode 100644 index 0000000..6156498 --- /dev/null +++ b/cmds/modify-l2.js @@ -0,0 +1,72 @@ +exports.command = 'modify-l2 ' +exports.desc = 'Make changes to a L2 point.' +exports.builder = function (yargs) { + + yargs.demandOption('d'); + + yargs.option('signing-address',{ + alias: 's', + describe: 'The originator address of the operation that signs the request, such as the owner or spawn proxy of the point.', + type: 'string', + }); + + yargs.option('address',{ + alias: 'a', + describe: 'The target address of the operation (spawn to, transfer to, etc.).', + type: 'string', + }); + + yargs.option('private-key',{ + alias: 'k', + describe: 'The private key that signs the transaction. Must be the key of the owner or proxy address.', + type: 'string', + conflicts: ['private-key-file', 'private-key-wallet-file', 'private-key-ticket'] + }); + yargs.option('private-key-file',{ + describe: 'A file that contains the private key that signs the transaction. Must be the key of the owner or proxy address.', + type: 'string', + conflicts: ['private-key', 'private-key-wallet-file', 'private-key-ticket'] + }); + yargs.option('private-key-wallet-file',{ + describe: 'A wallet JSON file that contains the private key that signs the transaction. Must be the key of the owner or proxy address.', + type: 'string', + conflicts: ['private-key', 'private-key-file', 'private-key-ticket'] + }); + yargs.option('private-key-ticket',{ + describe: 'A UP8 ticket to derrive the private key that signs the transaction. Must be the key of the owner or proxy address.', + type: 'string', + conflicts: ['private-key', 'private-key-file', 'private-key-wallet-file'] + }); + + + yargs.check(argv => { + if (!argv.privateKey && !argv.privateKeyFile && !argv.privateKeyWalletFile && !argv.privateKeyTicket) + throw new Error('You must provide either --private-key, --private-key-file, --private-key-wallet-file, or --private-key-ticket that signs the transaction.') + return true + }); + + yargs.option('points-file',{ + describe: `A file containing the points, with each point on a separate line, can be p or patp.`, + type: 'string', + conflicts: ['points', 'use-wallet-files'] + }); + yargs.option('points',{ + alias: ['p', 'point'], + describe: `One or more points, can be p or patp.`, + type: 'array', + conflicts: ['points-file', 'use-wallet-files'] + }); + yargs.option('use-wallet-files',{ + describe: `Use the wallet JSON files in the current work directory as the points.`, + type: 'boolean', + conflicts: ['points-file', 'points'] + }); + yargs.check(argv => { + if (!argv.pointsFile && !argv.points && !argv.useWalletFiles) throw new Error('You must provide either --points-file, --points, or --use-wallet-files.') + if(!argv.useWalletFiles && !argv.address) throw new Error('You must provide either --address or --use-wallet-files, or both.') + return true + }); + + return yargs.commandDir('modify-l2_cmds', {exclude:'common'} ) +} +exports.handler = function (argv) {} \ No newline at end of file diff --git a/cmds/modify-l2_cmds/spawn.js b/cmds/modify-l2_cmds/spawn.js new file mode 100644 index 0000000..52c41ea --- /dev/null +++ b/cmds/modify-l2_cmds/spawn.js @@ -0,0 +1,51 @@ +const ob = require('urbit-ob') +const _ = require('lodash') +const {files, validate, eth, findPoints, rollerApi} = require('../../utils') + +exports.command = 'spawn' +exports.desc = 'Spawn one or more points on L2, where the points are patp or p. Can also provide the points to spawn via files. See options.' + +exports.builder = function(yargs) { + yargs.demandOption('address'); + yargs.demandOption('signing-address'); +} + +exports.handler = async function (argv) +{ + const workDir = files.ensureWorkDir(argv.workDir); + const privateKey = await eth.getPrivateKey(argv); + + const rollerClient = rollerApi.createClient(); + + const wallets = argv.useWalletFiles ? findPoints.getWallets(workDir) : null; + const points = findPoints.getPoints(argv, workDir, wallets); + + const signingAddress = validate.address(argv.signingAddress, true); + //for spawning points, we do not allow it to be spawned directly to the ownership address of the master ticket, even if useWalletFiles is set. + // .. at least not yet + const targetAddress = validate.address(argv.address, true); + + console.log(`Will spawn ${points.length} points`); + for (const p of points) + { + const patp = ob.patp(p); + console.log(`Trying to spawn ${patp} (${p}).`); + + const parentPoint = ob.sein(patp); + // console.log("parent p: "+parentPoint); + // console.log("p to spawn: "+p); + // console.log("targetAddress: "+targetAddress); + // console.log("signingAddress: "+signingAddress); + // console.log("privateKey: "+privateKey); + var transactioHash = await rollerApi.spawn(rollerClient, parentPoint, patp, targetAddress, signingAddress, privateKey); + console.log("hash: "+transactioHash); + } //end for each point + + process.exit(0); +}; + + + + + + diff --git a/utils/roller-api.js b/utils/roller-api.js index ad6b642..72d152d 100644 --- a/utils/roller-api.js +++ b/utils/roller-api.js @@ -19,10 +19,10 @@ function createClient(){ { //TODO: add try catch, check for 200 response (see https://www.npmjs.com/package/json-rpc-2.0), show error codes - console.log(JSON.stringify(jsonRPCRequest)); + //console.log(JSON.stringify(jsonRPCRequest)); var response = await axios.post("http://localhost:8080/v1/roller", JSON.stringify(jsonRPCRequest)); const jsonRPCResponse = response.data; - console.log(jsonRPCResponse) + //console.log(jsonRPCResponse) client.receive(jsonRPCResponse) }, nextId); return client; @@ -54,7 +54,8 @@ function getNonce(client, params){ //use this if signing via metamask or wallet connect async function prepareForSigning(client, method, params){ - const nonce = await getNonce(client, params); + let nonce = await getNonce(client, params); + nonce++;//TODO: is this correct? const hashParams = { tx: method, nonce: nonce, @@ -74,7 +75,7 @@ async function getUnsignedTx(client, method, params){ data: params.data } var res = await client.request("getUnsignedTx", hashParams); - console.log("RESULT: "+res); + //console.log("RESULT: "+res); return res; } @@ -88,8 +89,41 @@ async function addSignature(client, method, params, privateKey){ // Roller JSON-RPC API documentation: // https://documenter.getpostman.com/view/16338962/Tzm3nx7x +function getRollerConfig(client){ + return client.request("getRollerConfig", { }); +} + +function getAllPending(client){ + return client.request("getAllPending", { }); +} + +function getPendingByAddress(client, address){ + return client.request("getPendingByAddress", { address: address }); +} + +function whenNextBatch(client){ + return client.request("whenNextBatch", { }); +} + + + function getPoint(client, point){ - return client.request("getPoint", { ship: point }); + const patp = ob.patp(validate.point(point, true)); + return client.request("getPoint", { ship: patp }); +} + +function getShips(client, address){ + return client.request("getShips", { address: address }); +} + +function getSpawned(client, point){ + const patp = ob.patp(validate.point(point, true)); + return client.request("getSpawned", { ship: patp }); +} + +function getUnspawned(client, point){ + const patp = ob.patp(validate.point(point, true)); + return client.request("getUnspawned", { ship: patp }); } async function spawn(client, parentPoint, spawnPoint, newOwnerAddress, signingAddress, privateKey){ @@ -114,10 +148,127 @@ async function spawn(client, parentPoint, spawnPoint, newOwnerAddress, signingAd return await client.request(method, params); } +async function transferPoint(client, point, reset, newOwnerAddress, signingAddress, privateKey){ + const patp = ob.patp(validate.point(point, true)); + const newOwnerAddressValid = validate.address(newOwnerAddress, true); + const signingAddressValid = validate.address(signingAddress, true); + + let params = { + address: signingAddressValid, + from: { + ship: patp, + proxy: "transfer" + }, + data: { + reset: reset, + address: newOwnerAddressValid, + } + }; + const method = "transferPoint"; + params = await addSignature(client, method, params, privateKey); + return await client.request(method, params); +} + +async function setManagementProxy(client, point, managementProxyAddress, signingAddress, privateKey){ + const patp = ob.patp(validate.point(point, true)); + const targetAddress = validate.address(managementProxyAddress, true); + const signingAddressValid = validate.address(signingAddress, true); + + let params = { + address: signingAddressValid, + from: { + ship: patp, + proxy: "own" + }, + data: { + address: targetAddress, + } + }; + const method = "setManagementProxy"; + params = await addSignature(client, method, params, privateKey); + return await client.request(method, params); +} + +async function setSpawnProxy(client, point, spawnProxyAddress, signingAddress, privateKey){ + const patp = ob.patp(validate.point(point, true)); + const targetAddress = validate.address(spawnProxyAddress, true); + const signingAddressValid = validate.address(signingAddress, true); + + let params = { + address: signingAddressValid, + from: { + ship: patp, + proxy: "own" + }, + data: { + address: targetAddress, + } + }; + const method = "setSpawnProxy"; + params = await addSignature(client, method, params, privateKey); + return await client.request(method, params); +} + +async function setTransferProxy(client, point, transferProxyAddress, signingAddress, privateKey){ + const patp = ob.patp(validate.point(point, true)); + const targetAddress = validate.address(transferProxyAddress, true); + const signingAddressValid = validate.address(signingAddress, true); + + let params = { + address: signingAddressValid, + from: { + ship: patp, + proxy: "own" + }, + data: { + address: targetAddress, + } + }; + const method = "setTransferProxy"; + params = await addSignature(client, method, params, privateKey); + return await client.request(method, params); +} + +async function configureKeys(client, point, encryptPublic, authPublic, breach, signingAddress, privateKey){ + const patp = ob.patp(validate.point(point, true)); + const signingAddressValid = validate.address(signingAddress, true); + + let params = { + address: signingAddressValid, + from: { + ship: patp, + proxy: "own" + }, + data: { + encrypt: encryptPublic, + auth: authPublic, + cryptoSuite: 0, + breach: breach + } + }; + const method = "configureKeys"; + params = await addSignature(client, method, params, privateKey); + return await client.request(method, params); +} + module.exports = { + getRollerConfig, createClient, + getAllPending, + getPendingByAddress, + whenNextBatch, + getPoint, - spawn + getShips, + getSpawned, + getUnspawned, + + spawn, + transferPoint, + setManagementProxy, + setTransferProxy, + setSpawnProxy, + configureKeys } From efd70102f242289f1250fdaadce351b46584fb6b Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Sun, 27 Feb 2022 11:30:30 +0100 Subject: [PATCH 04/17] added L2 list and spawn command --- cli-config.json | 6 ++++-- cli.js | 6 ++++++ cmds/list-l2_cmds/children.js | 2 +- cmds/list-l2_cmds/details.js | 2 +- cmds/list-l2_cmds/owner.js | 2 +- cmds/list-l2_cmds/pending.js | 2 +- cmds/list-l2_cmds/roller-info.js | 2 +- cmds/modify-l2_cmds/spawn.js | 2 +- utils/roller-api.js | 14 ++++++++++++-- 9 files changed, 28 insertions(+), 10 deletions(-) diff --git a/cli-config.json b/cli-config.json index f5365dc..43150f1 100644 --- a/cli-config.json +++ b/cli-config.json @@ -1,5 +1,7 @@ { - "ethProviderGanache": "'http://localhost:8545'", + "ethProviderGanache": "http://localhost:8545", "ethProviderRopsten": "https://ropsten.infura.io/v3/f23d3259814348dbb693726415858db8", - "ethProviderMainnet": "https://mainnet.infura.io/v3/f23d3259814348dbb693726415858db8" + "ethProviderMainnet": "https://mainnet.infura.io/v3/f23d3259814348dbb693726415858db8", + "rollerLocal": "http://localhost:8080/v1/roller", + "rollerUrbit": "https://roller.urbit.org/v1/roller" } \ No newline at end of file diff --git a/cli.js b/cli.js index 3ef372c..e369001 100755 --- a/cli.js +++ b/cli.js @@ -26,6 +26,12 @@ function getUniversalOptions() choices: ['ganache', 'ropsten', 'mainnet'], type: 'string' }, + 'roller-provider':{ + describe: 'What L2 roller provider to use.', + default: 'local', + choices: ['local', 'urbit'], + type: 'string' + }, 'config-file':{ describe: 'What config file to use.', default: files.ensureDefaultConfigFilePath(), diff --git a/cmds/list-l2_cmds/children.js b/cmds/list-l2_cmds/children.js index ee1ab84..4fe2002 100644 --- a/cmds/list-l2_cmds/children.js +++ b/cmds/list-l2_cmds/children.js @@ -20,7 +20,7 @@ exports.builder = (yargs) =>{ exports.handler = async function (argv) { const point = validate.point(argv.point, true); - const rollerClient = rollerApi.createClient(); + const rollerClient = rollerApi.createClient(argv); let childPoints = null; if(argv.spawned){ diff --git a/cmds/list-l2_cmds/details.js b/cmds/list-l2_cmds/details.js index d3395cf..4c600cb 100644 --- a/cmds/list-l2_cmds/details.js +++ b/cmds/list-l2_cmds/details.js @@ -12,7 +12,7 @@ exports.handler = async function (argv) { console.log(`urbit ID (patp): ${patp}`); console.log(`urbit ID number (p): ${p}`); - const rollerClient = rollerApi.createClient(); + const rollerClient = rollerApi.createClient(argv); const pointInfo = await rollerApi.getPoint(rollerClient, p); console.log(`data from roller:`); console.log(JSON.stringify(pointInfo, null, 2)); diff --git a/cmds/list-l2_cmds/owner.js b/cmds/list-l2_cmds/owner.js index d1071de..7fe95d2 100644 --- a/cmds/list-l2_cmds/owner.js +++ b/cmds/list-l2_cmds/owner.js @@ -9,7 +9,7 @@ exports.builder = (yargs) =>{ exports.handler = async function (argv) { let addr = validate.address(argv.addr, true); - const rollerClient = rollerApi.createClient(); + const rollerClient = rollerApi.createClient(argv); let points = await rollerApi.getShips(rollerClient, addr); console.log(`listing ${points.length} owned points by ${addr}:`); diff --git a/cmds/list-l2_cmds/pending.js b/cmds/list-l2_cmds/pending.js index e5454b0..494751c 100644 --- a/cmds/list-l2_cmds/pending.js +++ b/cmds/list-l2_cmds/pending.js @@ -8,7 +8,7 @@ exports.builder = (yargs) =>{ exports.handler = async function (argv) { - const rollerClient = rollerApi.createClient(); + const rollerClient = rollerApi.createClient(argv); const data = await rollerApi.getAllPending(rollerClient); console.log(`data from roller:`); console.log(JSON.stringify(data, null, 2)); diff --git a/cmds/list-l2_cmds/roller-info.js b/cmds/list-l2_cmds/roller-info.js index 67504bd..083d8a4 100644 --- a/cmds/list-l2_cmds/roller-info.js +++ b/cmds/list-l2_cmds/roller-info.js @@ -7,7 +7,7 @@ exports.builder = (yargs) =>{ exports.handler = async function (argv) { - const rollerClient = rollerApi.createClient(); + const rollerClient = rollerApi.createClient(argv); const rollerConfig = await rollerApi.getRollerConfig(rollerClient); console.log(`roller config:`); diff --git a/cmds/modify-l2_cmds/spawn.js b/cmds/modify-l2_cmds/spawn.js index 52c41ea..b4bccdc 100644 --- a/cmds/modify-l2_cmds/spawn.js +++ b/cmds/modify-l2_cmds/spawn.js @@ -15,7 +15,7 @@ exports.handler = async function (argv) const workDir = files.ensureWorkDir(argv.workDir); const privateKey = await eth.getPrivateKey(argv); - const rollerClient = rollerApi.createClient(); + const rollerClient = rollerApi.createClient(argv); const wallets = argv.useWalletFiles ? findPoints.getWallets(workDir) : null; const points = findPoints.getPoints(argv, workDir, wallets); diff --git a/utils/roller-api.js b/utils/roller-api.js index 72d152d..6cd81ff 100644 --- a/utils/roller-api.js +++ b/utils/roller-api.js @@ -14,13 +14,23 @@ function nextId(){ return requestCounter.toString(); //the roller rpc need a string ID, otherwise it does it does not work } -function createClient(){ +function createClient(argv){ + let rollerUrl = + argv.rollerProvider == 'local' + ? argv.rollerLocal + : argv.rollerProvider == 'urbit' + ? argv.rollerUrbit + : null; + //console.log(rollerUrl); + if(rollerUrl == null){ + rollerUrl = "http://localhost:8080/v1/roller"; + } var client = new JSONRPCClient(async function (jsonRPCRequest) { //TODO: add try catch, check for 200 response (see https://www.npmjs.com/package/json-rpc-2.0), show error codes //console.log(JSON.stringify(jsonRPCRequest)); - var response = await axios.post("http://localhost:8080/v1/roller", JSON.stringify(jsonRPCRequest)); + var response = await axios.post(rollerUrl, JSON.stringify(jsonRPCRequest)); const jsonRPCResponse = response.data; //console.log(jsonRPCResponse) client.receive(jsonRPCResponse) From 329621dc1b3b2a6993bc0522c566b549161de604 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Mon, 28 Feb 2022 11:47:50 +0100 Subject: [PATCH 05/17] added L2 modify commands --- cmds/modify-l2.js | 6 -- cmds/modify-l2_cmds/management-proxy.js | 64 +++++++++++++++++++ cmds/modify-l2_cmds/network-key.js | 85 +++++++++++++++++++++++++ cmds/modify-l2_cmds/spawn.js | 11 ++-- cmds/modify-l2_cmds/transfer.js | 70 ++++++++++++++++++++ utils/roller-api.js | 70 +++++++++++++++++--- 6 files changed, 285 insertions(+), 21 deletions(-) create mode 100644 cmds/modify-l2_cmds/management-proxy.js create mode 100644 cmds/modify-l2_cmds/network-key.js create mode 100644 cmds/modify-l2_cmds/transfer.js diff --git a/cmds/modify-l2.js b/cmds/modify-l2.js index 6156498..c5c2f5f 100644 --- a/cmds/modify-l2.js +++ b/cmds/modify-l2.js @@ -4,12 +4,6 @@ exports.builder = function (yargs) { yargs.demandOption('d'); - yargs.option('signing-address',{ - alias: 's', - describe: 'The originator address of the operation that signs the request, such as the owner or spawn proxy of the point.', - type: 'string', - }); - yargs.option('address',{ alias: 'a', describe: 'The target address of the operation (spawn to, transfer to, etc.).', diff --git a/cmds/modify-l2_cmds/management-proxy.js b/cmds/modify-l2_cmds/management-proxy.js new file mode 100644 index 0000000..5b263b5 --- /dev/null +++ b/cmds/modify-l2_cmds/management-proxy.js @@ -0,0 +1,64 @@ +const ob = require('urbit-ob') +const _ = require('lodash') +const ajsUtils = require('azimuth-js').utils; +var Accounts = require('web3-eth-accounts'); +const {files, validate, eth, findPoints, rollerApi} = require('../../utils') + +exports.command = 'management-proxy' +exports.desc = 'Set the management proxy of one or more L2 points.' + +exports.builder = function(yargs) { +} + +exports.handler = async function (argv) +{ + const rollerClient = rollerApi.createClient(argv); + const workDir = files.ensureWorkDir(argv.workDir); + const privateKey = await eth.getPrivateKey(argv); + const account = new Accounts().privateKeyToAccount(privateKey); + const signingAddress = account.address; + + const wallets = argv.useWalletFiles ? findPoints.getWallets(workDir) : null; + const points = findPoints.getPoints(argv, workDir, wallets); + + console.log(`Will set mgmt. proxy for ${points.length} points`); + for (const p of points) + { + let patp = ob.patp(p); + console.log(`Trying to set mgmt. proxy for ${patp} (${p}).`); + + let wallet = argv.useWalletFiles ? wallets[patp] : null; + let targetAddress = + argv.address != undefined + ? argv.address + : argv.useWalletFiles + ? wallet.management.keys.address : + null; //fail + targetAddress = validate.address(targetAddress, true); + + let pointInfo = rollerApi.getPoint(rollerClient, patp); + if(ajsUtils.addressEquals(pointInfo.ownership.managementProxy.address, targetAddress)){ + console.log(`Target address ${targetAddress} is already mgmt. proxy for ${patp}.`); + continue; + } + + //todo: this is not correct: only owner can set management proxy + if(!(await rollerApi.getManagementProxy(rollerClient, patp, signingAddress))){ + console.log(`Cannot set mgmt. proxy for ${patp}, must be owner.`); + continue; + } + + //create and send tx + var transactioHash = await rollerApi.setManagementProxy(rollerClient, patp, targetAddress, signingAddress, privateKey); + console.log("tx hash: "+transactioHash); + } //end for each point + + process.exit(0); +}; + + + + + + + diff --git a/cmds/modify-l2_cmds/network-key.js b/cmds/modify-l2_cmds/network-key.js new file mode 100644 index 0000000..b68f85c --- /dev/null +++ b/cmds/modify-l2_cmds/network-key.js @@ -0,0 +1,85 @@ +const ob = require('urbit-ob') +const _ = require('lodash') +const ajsUtils = require('azimuth-js').utils; +var Accounts = require('web3-eth-accounts'); +const {files, validate, eth, findPoints, rollerApi} = require('../../utils') + +exports.command = 'network-key' +exports.desc = 'Set the network key for one or more L2 points.' + +exports.builder = function(yargs) { + yargs.option('breach',{ + describe: 'Do a factory reset of the ship.', + default: false, + type: 'boolean', + }); +} + +exports.handler = async function (argv) +{ + const rollerClient = rollerApi.createClient(argv); + const workDir = files.ensureWorkDir(argv.workDir); + const privateKey = await eth.getPrivateKey(argv); + const account = new Accounts().privateKeyToAccount(privateKey); + const signingAddress = account.address; + + const wallets = argv.useWalletFiles ? findPoints.getWallets(workDir) : null; + const points = findPoints.getPoints(argv, workDir, wallets); + + console.log(`Will set network keys for ${points.length} points`); + for (const p of points) + { + let patp = ob.patp(p); + console.log(`Trying to set network key for ${patp} (${p}).`); + + const pointInfo = rollerApi.getPoint(rollerClient, patp); + const currentKeys = pointInfo.network.keys; + + //retrieve the network keypair + let wallet = argv.useWalletFiles ? wallets[patp] : null; + const currentRevision = currentKeys.life; //network key revision number == life. + const revision = currentRevision+1; + const keysFileName = `${patp.substring(1)}-networkkeys-${revision}.json`; + + let networkKeyPair = null; + if(wallet){ + networkKeyPair = wallet.network.keys; + } + else if(files.fileExists(workDir, keysFileName)){ + networkKeyPair = files.readJsonObject(workDir, keysFileName); + } + else{ + console.error(`Could not find network keys for ${patp}: provide them either via wallet or network key file.`); + process.exit(1); + } + + if(!(await rollerApi.getManagementProxy(rollerClient, patp, signingAddress))){ + console.log(`Cannot set network keys for ${patp}, must be owner or management proxy.`); + continue; + } + + //we are using the public keys because in the contract only the public keys should be visible, the private keys are used to generate the arvo key file + var publicCrypt = ajsUtils.addHexPrefix(networkKeyPair.crypt.public); + var publicAuth = ajsUtils.addHexPrefix(networkKeyPair.auth.public); + + if(currentKeys.crypt == publicCrypt && currentKeys.auth == publicAuth) + { + console.log(`The network key is already set for ${patp}`); + // console.log(JSON.stringify(networkKeyPair, null, 2)); + // console.log(JSON.stringify(currentKeys, null, 2)); + continue; + } + + var transactioHash = await rollerApi.configureKeys(rollerClient, patp, publicCrypt, publicAuth, argv.breach, signingAddress, privateKey); + console.log("tx hash: "+transactioHash); + } //end for each point + + process.exit(0); +}; + + + + + + + diff --git a/cmds/modify-l2_cmds/spawn.js b/cmds/modify-l2_cmds/spawn.js index b4bccdc..465f451 100644 --- a/cmds/modify-l2_cmds/spawn.js +++ b/cmds/modify-l2_cmds/spawn.js @@ -1,5 +1,6 @@ const ob = require('urbit-ob') const _ = require('lodash') +var Accounts = require('web3-eth-accounts'); const {files, validate, eth, findPoints, rollerApi} = require('../../utils') exports.command = 'spawn' @@ -7,20 +8,20 @@ exports.desc = 'Spawn one or more points on L2, where the points are patp or p. exports.builder = function(yargs) { yargs.demandOption('address'); - yargs.demandOption('signing-address'); + //yargs.demandOption('signing-address'); } exports.handler = async function (argv) { + const rollerClient = rollerApi.createClient(argv); const workDir = files.ensureWorkDir(argv.workDir); const privateKey = await eth.getPrivateKey(argv); - - const rollerClient = rollerApi.createClient(argv); + const account = new Accounts().privateKeyToAccount(privateKey); + const signingAddress = account.address; const wallets = argv.useWalletFiles ? findPoints.getWallets(workDir) : null; const points = findPoints.getPoints(argv, workDir, wallets); - const signingAddress = validate.address(argv.signingAddress, true); //for spawning points, we do not allow it to be spawned directly to the ownership address of the master ticket, even if useWalletFiles is set. // .. at least not yet const targetAddress = validate.address(argv.address, true); @@ -38,7 +39,7 @@ exports.handler = async function (argv) // console.log("signingAddress: "+signingAddress); // console.log("privateKey: "+privateKey); var transactioHash = await rollerApi.spawn(rollerClient, parentPoint, patp, targetAddress, signingAddress, privateKey); - console.log("hash: "+transactioHash); + console.log("tx hash: "+transactioHash); } //end for each point process.exit(0); diff --git a/cmds/modify-l2_cmds/transfer.js b/cmds/modify-l2_cmds/transfer.js new file mode 100644 index 0000000..be942d6 --- /dev/null +++ b/cmds/modify-l2_cmds/transfer.js @@ -0,0 +1,70 @@ +const ob = require('urbit-ob') +const _ = require('lodash') +const ajsUtils = require('azimuth-js').utils; +const {files, validate, eth, findPoints, rollerApi} = require('../../utils') + +exports.command = 'transfer' +exports.desc = 'Transfer one or more L2 points, either to the wallet address or to the provided target addess.' + +exports.builder = function(yargs) { + yargs.option('reset',{ + describe: 'If the network keys and proxies should be reset in the process of the transfer. Do not set to true when moving to a HD wallet address.', + default: false, + type: 'boolean', + }); +} + +exports.handler = async function (argv) +{ + const rollerClient = rollerApi.createClient(argv); + const workDir = files.ensureWorkDir(argv.workDir); + const privateKey = await eth.getPrivateKey(argv); + const account = new Accounts().privateKeyToAccount(privateKey); + const signingAddress = account.address; + + const wallets = argv.useWalletFiles ? findPoints.getWallets(workDir) : null; + const points = findPoints.getPoints(argv, workDir, wallets); + + console.log(`Will transfer ${points.length} points`); + for (const p of points) + { + let patp = ob.patp(p); + console.log(`Trying to transfer ${patp} (${p}).`); + + let wallet = argv.useWalletFiles ? wallets[patp] : null; + let targetAddress = + argv.address != undefined + ? argv.address + : argv.useWalletFiles + ? wallet.ownership.keys.address : + null; //fail + targetAddress = validate.address(targetAddress, true); + + let pointInfo = rollerApi.getPoint(rollerClient, patp); + if(ajsUtils.addressEquals(pointInfo.ownership.owner.address, targetAddress)){ + console.log(`Target address ${targetAddress} is already owner of ${patp}.`); + continue; + } + + //use the transfer proxy check to see if the singing address is either owner or transfer proxy + if(!(await rollerApi.getTransferProxy(rollerClient, patp, signingAddress))){ + console.log(`Signing address ${signingAddress} must be owner or transfer proxy.`); + continue; + } + + //create and send tx + var transactioHash = await rollerApi.transferPoint(rollerClient, patp, argv.reset, targetAddress, signingAddress, privateKey); + console.log("tx hash: "+transactioHash); + + } //end for each point + + process.exit(0); +}; + + + + + + + + diff --git a/utils/roller-api.js b/utils/roller-api.js index 6cd81ff..f5818ce 100644 --- a/utils/roller-api.js +++ b/utils/roller-api.js @@ -64,8 +64,7 @@ function getNonce(client, params){ //use this if signing via metamask or wallet connect async function prepareForSigning(client, method, params){ - let nonce = await getNonce(client, params); - nonce++;//TODO: is this correct? + const nonce = await getNonce(client, params); const hashParams = { tx: method, nonce: nonce, @@ -96,6 +95,10 @@ async function addSignature(client, method, params, privateKey){ return params; } + +//============================================ +// API +//============================================ // Roller JSON-RPC API documentation: // https://documenter.getpostman.com/view/16338962/Tzm3nx7x @@ -116,7 +119,6 @@ function whenNextBatch(client){ } - function getPoint(client, point){ const patp = ob.patp(validate.point(point, true)); return client.request("getPoint", { ship: patp }); @@ -141,12 +143,14 @@ async function spawn(client, parentPoint, spawnPoint, newOwnerAddress, signingAd const spawnPatp = ob.patp(validate.point(spawnPoint, true)); const newOwnerAddressValid = validate.address(newOwnerAddress, true); const signingAddressValid = validate.address(signingAddress, true); + const proxy = await getSpawnProxy(client, parentPatp, signingAddress); + //console.log("Proxy: "+proxy); let params = { address: signingAddressValid, from: { ship: parentPatp, - proxy: "own" + proxy: proxy }, data: { ship: spawnPatp, @@ -162,12 +166,13 @@ async function transferPoint(client, point, reset, newOwnerAddress, signingAddre const patp = ob.patp(validate.point(point, true)); const newOwnerAddressValid = validate.address(newOwnerAddress, true); const signingAddressValid = validate.address(signingAddress, true); + const proxy = await getTransferProxy(client, parentPatp, signingAddress); let params = { address: signingAddressValid, from: { ship: patp, - proxy: "transfer" + proxy: proxy }, data: { reset: reset, @@ -183,12 +188,13 @@ async function setManagementProxy(client, point, managementProxyAddress, signing const patp = ob.patp(validate.point(point, true)); const targetAddress = validate.address(managementProxyAddress, true); const signingAddressValid = validate.address(signingAddress, true); + const proxy = "own"; //only the owner can set the management proxy let params = { address: signingAddressValid, from: { ship: patp, - proxy: "own" + proxy: proxy }, data: { address: targetAddress, @@ -203,12 +209,13 @@ async function setSpawnProxy(client, point, spawnProxyAddress, signingAddress, p const patp = ob.patp(validate.point(point, true)); const targetAddress = validate.address(spawnProxyAddress, true); const signingAddressValid = validate.address(signingAddress, true); + const proxy = "own"; //only the owner can set the spawn proxy let params = { address: signingAddressValid, from: { ship: patp, - proxy: "own" + proxy: proxy }, data: { address: targetAddress, @@ -223,12 +230,13 @@ async function setTransferProxy(client, point, transferProxyAddress, signingAddr const patp = ob.patp(validate.point(point, true)); const targetAddress = validate.address(transferProxyAddress, true); const signingAddressValid = validate.address(signingAddress, true); + const proxy = "own"; //only the owner can set the transfer proxy let params = { address: signingAddressValid, from: { ship: patp, - proxy: "own" + proxy: proxy }, data: { address: targetAddress, @@ -242,12 +250,13 @@ async function setTransferProxy(client, point, transferProxyAddress, signingAddr async function configureKeys(client, point, encryptPublic, authPublic, breach, signingAddress, privateKey){ const patp = ob.patp(validate.point(point, true)); const signingAddressValid = validate.address(signingAddress, true); + const proxy = await getManagementProxy(client, parentPatp, signingAddress); //either the owner or the manage proxy can set the keys let params = { address: signingAddressValid, from: { ship: patp, - proxy: "own" + proxy: proxy }, data: { encrypt: encryptPublic, @@ -262,6 +271,43 @@ async function configureKeys(client, point, encryptPublic, authPublic, breach, s } + +async function getManagementProxy(client, point, signingAddress){ + const pointInfo = await getPoint(client, point); + if(ajsUtils.addressEquals(pointInfo.ownership.owner.address, signingAddress)) + return 'own'; + else if(ajsUtils.addressEquals(pointInfo.ownership.managementProxy.address, signingAddress)) + return 'manage'; + return undefined; +} + +async function getSpawnProxy(client, point, signingAddress){ + const pointInfo = await getPoint(client, point); + if(ajsUtils.addressEquals(pointInfo.ownership.owner.address, signingAddress)) + return 'own'; + else if(ajsUtils.addressEquals(pointInfo.ownership.spawnProxy.address, signingAddress)) + return 'spawn'; + return undefined; +} + +async function getTransferProxy(client, point, signingAddress){ + const pointInfo = await getPoint(client, point); + if(ajsUtils.addressEquals(pointInfo.ownership.owner.address, signingAddress)) + return 'own'; + else if(ajsUtils.addressEquals(pointInfo.ownership.transferProxy.address, signingAddress)) + return 'transfer'; + return undefined; +} + +//TODO: add +// isOwner +// isManagementProxy +// isSpawnProxy +// isTransferProxy +// canConfigureKeys (either owner or management proxy) +// canTransfer (either owner or transfer proxy) +// [-> then replace checks in modify-l2 commands to use these functions] + module.exports = { getRollerConfig, createClient, @@ -279,6 +325,10 @@ module.exports = { setManagementProxy, setTransferProxy, setSpawnProxy, - configureKeys + configureKeys, + + getManagementProxy, + getSpawnProxy, + getTransferProxy } From 618540f8238d34637d685058b0963ef9a7db0acf Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Mon, 28 Feb 2022 19:56:48 +0100 Subject: [PATCH 06/17] fixes to L2 modify commands --- cmds/modify-l2_cmds/management-proxy.js | 2 +- cmds/modify-l2_cmds/network-key.js | 2 +- cmds/modify-l2_cmds/transfer.js | 3 ++- utils/roller-api.js | 7 ++++--- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cmds/modify-l2_cmds/management-proxy.js b/cmds/modify-l2_cmds/management-proxy.js index 5b263b5..a7f9a7b 100644 --- a/cmds/modify-l2_cmds/management-proxy.js +++ b/cmds/modify-l2_cmds/management-proxy.js @@ -36,7 +36,7 @@ exports.handler = async function (argv) null; //fail targetAddress = validate.address(targetAddress, true); - let pointInfo = rollerApi.getPoint(rollerClient, patp); + let pointInfo = await rollerApi.getPoint(rollerClient, patp); if(ajsUtils.addressEquals(pointInfo.ownership.managementProxy.address, targetAddress)){ console.log(`Target address ${targetAddress} is already mgmt. proxy for ${patp}.`); continue; diff --git a/cmds/modify-l2_cmds/network-key.js b/cmds/modify-l2_cmds/network-key.js index b68f85c..b8917c4 100644 --- a/cmds/modify-l2_cmds/network-key.js +++ b/cmds/modify-l2_cmds/network-key.js @@ -32,7 +32,7 @@ exports.handler = async function (argv) let patp = ob.patp(p); console.log(`Trying to set network key for ${patp} (${p}).`); - const pointInfo = rollerApi.getPoint(rollerClient, patp); + const pointInfo = await rollerApi.getPoint(rollerClient, patp); const currentKeys = pointInfo.network.keys; //retrieve the network keypair diff --git a/cmds/modify-l2_cmds/transfer.js b/cmds/modify-l2_cmds/transfer.js index be942d6..aad66f8 100644 --- a/cmds/modify-l2_cmds/transfer.js +++ b/cmds/modify-l2_cmds/transfer.js @@ -1,6 +1,7 @@ const ob = require('urbit-ob') const _ = require('lodash') const ajsUtils = require('azimuth-js').utils; +var Accounts = require('web3-eth-accounts'); const {files, validate, eth, findPoints, rollerApi} = require('../../utils') exports.command = 'transfer' @@ -40,7 +41,7 @@ exports.handler = async function (argv) null; //fail targetAddress = validate.address(targetAddress, true); - let pointInfo = rollerApi.getPoint(rollerClient, patp); + let pointInfo = await rollerApi.getPoint(rollerClient, patp); if(ajsUtils.addressEquals(pointInfo.ownership.owner.address, targetAddress)){ console.log(`Target address ${targetAddress} is already owner of ${patp}.`); continue; diff --git a/utils/roller-api.js b/utils/roller-api.js index f5818ce..a5ce9fe 100644 --- a/utils/roller-api.js +++ b/utils/roller-api.js @@ -7,6 +7,7 @@ const validate = require('./validate') const { hexToBytes } = require('web3-utils'); const { ecdsaSign } = require('secp256k1'); +const CRYPTO_SUITE_VERSION = 1; let requestCounter = 0; function nextId(){ @@ -166,7 +167,7 @@ async function transferPoint(client, point, reset, newOwnerAddress, signingAddre const patp = ob.patp(validate.point(point, true)); const newOwnerAddressValid = validate.address(newOwnerAddress, true); const signingAddressValid = validate.address(signingAddress, true); - const proxy = await getTransferProxy(client, parentPatp, signingAddress); + const proxy = await getTransferProxy(client, patp, signingAddress); let params = { address: signingAddressValid, @@ -250,7 +251,7 @@ async function setTransferProxy(client, point, transferProxyAddress, signingAddr async function configureKeys(client, point, encryptPublic, authPublic, breach, signingAddress, privateKey){ const patp = ob.patp(validate.point(point, true)); const signingAddressValid = validate.address(signingAddress, true); - const proxy = await getManagementProxy(client, parentPatp, signingAddress); //either the owner or the manage proxy can set the keys + const proxy = await getManagementProxy(client, patp, signingAddress); //either the owner or the manage proxy can set the keys let params = { address: signingAddressValid, @@ -261,7 +262,7 @@ async function configureKeys(client, point, encryptPublic, authPublic, breach, s data: { encrypt: encryptPublic, auth: authPublic, - cryptoSuite: 0, + cryptoSuite: CRYPTO_SUITE_VERSION.toString(), breach: breach } }; From eb2b2de90859b09a7b256132b5db7e42df45dc32 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Mon, 28 Feb 2022 22:58:01 +0100 Subject: [PATCH 07/17] added L2 instructions --- README.md | 3 + cmds/generate_cmds/spawn-list.js | 21 ++++-- docs/roller.md | 109 +++++++++++++++++++++++++++++++ 3 files changed, 129 insertions(+), 4 deletions(-) create mode 100644 docs/roller.md diff --git a/README.md b/README.md index 8f73232..394bbbe 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,9 @@ To run the tests: ## Usage + +*Note: Using the CLI with a L2 roller is WIP, see [here for instructions](docs/roller.md).* + After installing the npm package, just type `azimuth-cli` in the command line to see the options. You can also use `azi` for short. There are three main types of commands: `list`, `generate`, and `modify`. First, the `list` commands do not make any changes, they just print information to the command line. But `generate` commands usually save something to the current work directory; use this, for example, to generate HD wallets. The `modify` commands actually change the blockchain and usually require the private key of the address that owns the urbit point you are making a change to. The `modify` commands also save data to the work directory, such as Ethereum transaction receipts. diff --git a/cmds/generate_cmds/spawn-list.js b/cmds/generate_cmds/spawn-list.js index f5e536a..5b26c6b 100644 --- a/cmds/generate_cmds/spawn-list.js +++ b/cmds/generate_cmds/spawn-list.js @@ -1,8 +1,7 @@ const ob = require('urbit-ob') const ajs = require('azimuth-js') const _ = require('lodash') - -const {files, validate, eth} = require('../../utils') +const {files, validate, eth, rollerApi} = require('../../utils') exports.command = 'spawn-list ' exports.desc = 'Create a list of child points to spawn from . If the file already exists, this command will be a no-op.' @@ -32,6 +31,13 @@ exports.builder = (yargs) =>{ default: 'random', type: 'string', }); + + //todo: remove this and figure out the dominion pased on the parent point + yargs.option('use-roller',{ + alias: 'l2', + describe: 'Connect to a roller to get the unspawned points instead of azimuth.', + type: 'boolean', + }); } exports.handler = async function (argv) @@ -45,8 +51,15 @@ exports.handler = async function (argv) return; } - const ctx = await eth.createContext(argv); - var childPoints = await ajs.azimuth.getUnspawnedChildren(ctx.contracts, point); + let childPoints = []; + if(!argv.useRoller){ + const ctx = await eth.createContext(argv); + childPoints = await ajs.azimuth.getUnspawnedChildren(ctx.contracts, point); + } + else{ + const rollerClient = rollerApi.createClient(argv); + childPoints = await rollerApi.getUnspawned(rollerClient, point); + } var spawnList = pickChildPoints(childPoints, argv.count, argv.pick); var spawnListPatp = _.map(spawnList, p => ob.patp(p)); diff --git a/docs/roller.md b/docs/roller.md new file mode 100644 index 0000000..06dfd12 --- /dev/null +++ b/docs/roller.md @@ -0,0 +1,109 @@ +# Using the Azimuth-CLI with your own L2 Roller + +The [Layer 2 (L2) scaling solution](https://urbit.org/docs/azimuth/l2/layer2) was introduced in early 2022 as an alternative way to manage Urbit IDs, to aleviate the problem of high transaction costs on Ethereum. Before L2, each Urbit ID transaction had to be executed on the Ethereum blockchain, with costs per transaction ranging from $20-$100. + +The offcial Urbit roller (running here: https://roller.urbit.org/v1/roller) has quite a low quota of transaction per ship. If you want to, say, spawn 100 planets, you need to run your own roller. + +## Setting Up Ethereum Accounts + +Before you can start, you need a few Ethereum accounts. We will assume you have a star that wants to spawn and manage planets, but the setup would work similarly in other scenarios too. + +Use something like MetaMask to manage your accounts. The nice thing is, once your star is migrated to L2, most of the accounts listed here do not need any ETH to work. The roller will pay for the transactions. + +To indicate what address and private key is referd to later, we'll give each an alias here, e.g., 0xOwner, 0xOwnerKey. Of course, they should be substituted by the actual Ethereum address and private key. + +To get the private key in MetaMask, click on an account, select "Account Details" and then "Export Private Key". + +### 1) Transfer Star or Spawn to L2 +Assuming you own a star, log in to [Bridge](https://bridge.urbit.org/) and migrate your star or the spawn capability of your star to L2 (I recommend that you only move the ability to spwan). This is an L1 transaction and the account needs ETH. + +`0xOwner`, `0xOwnerKey` + +### 2) Create Spawn Proxy Account and Configure Star (Optional) +Create a new account that will act as the L2 spawn proxy for your planets. In Bridge, once the migration to L2 has completed, set the spawn proxy to this address. + +`0xSpawnProxy`, `0xSpawnProxyKey` + +### 2) Create Management Proxy Account (Optional) +This is only needed if you plan to host the planets, because you'll want to be able to transfer ownership while remaining management proxy of the planets, which is needed to set and reset the network keys. + +Create a new account that will act as the L2 management proxy for your planets. + +`0xManagementProxy` + +### 2) Create Roller Account +The roller needs access to ETH. Create an account to which you can transfer some ETH. I recommend to transfer first $100 or so while testing. This should allow to spawn at least 50 planets. + +`0xRoller`, `0xRollerKey` + +## Setting Up the Roller + +### Preliminaries + +*This is based on this tutorial: https://pastebin.com/wQDw7nHv* + +Make sure you have Urbit v1.8 or later [installed](https://urbit.org/getting-started/cli). + +Create an account with [Infura](https://infura.io/) and make sure to copy the infura URL, something like: `https://mainnet.infura.io/v3/YOURSPECIALKEY`. Alternatively you can also use your own Ethereum node, but we will assume you are using Infura. + +### Configure a Roller +1) Boot a fakezod: `./urbit -F zod` +2) Once booted, set the Ethereum node: `:azimuth|watch 'https://mainnet.infura.io/v3/YOURSPECIALKEY' %default` +3) Make sure the subscription works: `:azimuth %resub` +4) Start roller agents: `|rein %base [& %roller] [& %roller-rpc] [& %azimuth-rpc]` +5) Set roller Ethereum node: `:roller|endpoint 'https://mainnet.infura.io/v3/YOURSPECIALKEY' %mainnet` +6) Give the roller access to your "Roller Account" (see above): `:roller|setkey '0xRollerKey'` +7) Increase the quota, so you can do larger batches: `:roller|quota 100` +8) If you want to also connect via a local Brige instance, also set this: `|cors-approve 'http://localhost:3000'` + +To test, you can now do requests via command line: +``` +curl --location --request POST 'http://localhost:8080/v1/roller' --header 'Content-Type: application/json' --data-raw '{ + "jsonrpc": "2.0", + "method": "getPoint", + "params": { + "ship": "~sampel" + }, + "id": "1234" +}' +``` +Replace `~sampel` with your star name. It should show dominion as `l2` or `spawn`. + +For a more cURL examples, [see here](https://documenter.getpostman.com/view/16338962/Tzm3nx7x). + +### Helpful Dojo Commands + + * Send the current batch to the blockchain (by default, the batch is sent on the hour, every hour): `:roller|commit` + * Check if there is any Ethereum state pending (it should return 0): `:eth-watcher +dbug [%state '(lent pending-logs:(~(got by dogs) /azimuth))']` + * See how many azimuth logs there are: `:azimuth +dbug [%state '(lent logs)']` + +## Spawn Planets Using the Azimuth-CLI + +Clone the latest version from from `https://github.com/lukebuehler/azimuth-cli` and switch to the `l2` branch (`git checkout l2`). Follow the development install instructions in the readme. You should be able to type `azi` in the command line and see the azimuth-cli options, including `list-l2` and `modify-l2`. Make sure you are on node version 14.x.x. + +If you don't see the l2 commands, you are not on the right version. Maybe you have the cli already installed globally? Do `npm uninstall -g azimuth-cli` first and then install again. + +Copy one line after the other to the command line. This will just spawn two random planets, you can change the `spawn-list.txt` file however you want. + +``` +azi generate spawn-list ~sampel --count=2 --pick=random --use-roller + +azi generate wallet --points-file=spawn-list.txt + +azi generate network-key --use-wallet-files + +azi modify-l2 spawn --use-wallet-files --address=0xSpawnProxy --private-key=0xSpawnProxyKey + +azi modify-l2 management-proxy --use-wallet-files --address=0xManagementProxy --private-key=0xSpawnProxyKey + +azi modify-l2 network-key --use-wallet-files --private-key=0xSpawnProxyKey + +azi modify-l2 transfer --use-wallet-files --private-key=0xSpawnProxyKey +``` + + + + + + + From dc100e4e9012a3e933dbe83fe04c4dbb24b1ca42 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Fri, 20 May 2022 01:23:44 +0200 Subject: [PATCH 08/17] working on l2 --- cmds/generate_cmds/report.js | 81 +++- cmds/modify-l2_cmds/management-proxy.js | 7 +- cmds/modify-l2_cmds/network-key.js | 7 +- cmds/modify-l2_cmds/spawn.js | 7 +- cmds/modify-l2_cmds/transfer.js | 6 +- package-lock.json | 488 ++++++++++++------------ test/test.js | 10 +- utils/eth.js | 4 +- utils/find-points.js | 2 +- utils/roller-api.js | 25 +- 10 files changed, 343 insertions(+), 294 deletions(-) diff --git a/cmds/generate_cmds/report.js b/cmds/generate_cmds/report.js index dcdd71b..4af4cce 100644 --- a/cmds/generate_cmds/report.js +++ b/cmds/generate_cmds/report.js @@ -2,7 +2,7 @@ const ob = require('urbit-ob') const kg = require('urbit-key-generation'); const ticket = require('up8-ticket'); const _ = require('lodash') -const {files, validate, eth, findPoints} = require('../../utils') +const {files, validate, eth, findPoints, rollerApi} = require('../../utils') const ajs = require('azimuth-js') exports.command = 'report' @@ -36,27 +36,42 @@ exports.builder = (yargs) =>{ if (!argv.pointsFile && !argv.points && !argv.useWalletFiles) throw new Error('You must provide either --points-file, --points, or --use-wallet-files') return true }); + + //todo: remove this and figure out the dominion pased on the parent point + yargs.option('use-roller',{ + alias: 'l2', + describe: 'Connect to a roller to get the unspawned points instead of azimuth.', + type: 'boolean', + }); } exports.handler = async function (argv) { const workDir = files.ensureWorkDir(argv.workDir); - const ctx = await eth.createContext(argv); + let ctx = null; + let rollerClient = null; + if(!argv.useRoller){ + ctx = await eth.createContext(argv); + } + else{ + rollerClient = rollerApi.createClient(argv); + } const wallets = argv.useWalletFiles ? findPoints.getWallets(workDir) : null; const points = findPoints.getPoints(argv, workDir, wallets); const csvHeader = - 'patp,p,ship_type,master_ticket,network_keyfile,' + - 'owner_address,proxy_address,' + //management_address is omitted because there is currently no API to retrieve the management proxy address + 'patp,p,ship_type,parent_patp,master_ticket,network_keyfile,' + + 'dominion,owner_address,spawn_proxy_address,management_proxy_address,' + 'spawn_transaction,management_proxy_transaction,spawn_proxy_transaction,network_key_transaction,transfer_transaction'; let csvLines = [csvHeader]; console.log(`Will process ${points.length} points for the report.`); for (const p of points) { const patp = ob.patp(p); + const patpParent = ob.sein(patp); const shipType = ob.clan(patp); - let csvLine = `${patp},${p},${shipType},`; + let csvLine = `${patp},${p},${shipType},${patpParent},`; //see if we have a wallet to get the master from let masterTicket = ''; @@ -73,19 +88,41 @@ exports.handler = async function (argv) } csvLine += `${masterTicket},${networkKeyfileContents},`; - //get the addresses - const ownerAddress = await ajs.azimuth.getOwner(ctx.contracts, p); - const spawnProxyAddress = await ajs.azimuth.getSpawnProxy(ctx.contracts, p); - csvLine += `${ownerAddress},${spawnProxyAddress},`; - - //try to get the transaction reciepts - let spawnTransaction = tryGetTransactionHash(patp, workDir, 'spawn'); - let managementProxyTransaction = tryGetTransactionHash(patp, workDir, 'managementproxy'); - let spawnProxyTransaction = tryGetTransactionHash(patp, workDir, 'spawnproxy'); - let networkkeyTransaction = tryGetTransactionHash(patp, workDir, 'networkkey'); - let transferTransaction = tryGetTransactionHash(patp, workDir, 'transfer'); - csvLine += `${spawnTransaction},${managementProxyTransaction},${spawnProxyTransaction},${networkkeyTransaction},${transferTransaction}`; + //use azimuth + if(!argv.useRoller){ + //get the addresses + const dominion = 'L1'; //todo: try to get the dominion via ajs + const ownerAddress = await ajs.azimuth.getOwner(ctx.contracts, p); + const spawnProxyAddress = await ajs.azimuth.getSpawnProxy(ctx.contracts, p); + const managementProxyAddress = ''; //does not work yet: await ajs.azimuth.getManagementProxy(ctx.contracts, p); + csvLine += `${dominion},${ownerAddress},${spawnProxyAddress},${managementProxyAddress},`; + + //try to get the transaction receipts + let spawnTransaction = tryGetTransactionHash(patp, workDir, 'spawn'); + let managementProxyTransaction = tryGetTransactionHash(patp, workDir, 'managementproxy'); + let spawnProxyTransaction = tryGetTransactionHash(patp, workDir, 'spawnproxy'); + let networkkeyTransaction = tryGetTransactionHash(patp, workDir, 'networkkey'); + let transferTransaction = tryGetTransactionHash(patp, workDir, 'transfer'); + csvLine += `${spawnTransaction},${managementProxyTransaction},${spawnProxyTransaction},${networkkeyTransaction},${transferTransaction}`; + } + //L2 roller + else{ + //get the addresses + const pointInfo = await rollerApi.getPoint(rollerClient, p); + const dominion = pointInfo.dominion; + const ownerAddress = pointInfo.ownership.owner.address; + const spawnProxyAddress = pointInfo.ownership.spawnProxy.address; + const managementProxyAddress = pointInfo.ownership.managementProxy.address; + csvLine += `${dominion},${ownerAddress},${spawnProxyAddress},${managementProxyAddress},`; + //try to get the transaction receipts + let spawnTransaction = tryGetTransactionHashL2(patp, workDir, 'spawn'); + let managementProxyTransaction = tryGetTransactionHashL2(patp, workDir, 'setManagementProxy'); + let spawnProxyTransaction = tryGetTransactionHashL2(patp, workDir, 'setSpawnProxy'); + let networkkeyTransaction = tryGetTransactionHashL2(patp, workDir, 'configureKeys'); + let transferTransaction = tryGetTransactionHashL2(patp, workDir, 'transferPoint'); + csvLine += `${spawnTransaction},${managementProxyTransaction},${spawnProxyTransaction},${networkkeyTransaction},${transferTransaction}`; + } csvLines.push(csvLine); } @@ -95,11 +132,19 @@ exports.handler = async function (argv) } function tryGetTransactionHash(patp, workDir, operationPostfix){ - const transactionFile = `${patp.substring(1)}-reciept-${operationPostfix}.json`; + const transactionFile = `${patp.substring(1)}-receipt-${operationPostfix}.json`; if(files.fileExists(workDir, transactionFile)){ return files.readJsonObject(workDir, transactionFile).transactionHash; } return ''; } +function tryGetTransactionHashL2(patp, workDir, method){ + const transactionFile = `${patp.substring(1)}-receipt-L2-${method}.json`; + if(files.fileExists(workDir, transactionFile)){ + return files.readJsonObject(workDir, transactionFile).hash; + } + return ''; +} + const DEFAULT_REVISION = 1; diff --git a/cmds/modify-l2_cmds/management-proxy.js b/cmds/modify-l2_cmds/management-proxy.js index a7f9a7b..6337932 100644 --- a/cmds/modify-l2_cmds/management-proxy.js +++ b/cmds/modify-l2_cmds/management-proxy.js @@ -49,8 +49,11 @@ exports.handler = async function (argv) } //create and send tx - var transactioHash = await rollerApi.setManagementProxy(rollerClient, patp, targetAddress, signingAddress, privateKey); - console.log("tx hash: "+transactioHash); + var receipt = await rollerApi.setManagementProxy(rollerClient, patp, targetAddress, signingAddress, privateKey); + console.log("tx hash: "+receipt.hash); + + let receiptFileName = patp.substring(1)+`-receipt-L2-${receipt.type}.json`; + files.writeFile(workDir, receiptFileName, receipt); } //end for each point process.exit(0); diff --git a/cmds/modify-l2_cmds/network-key.js b/cmds/modify-l2_cmds/network-key.js index b8917c4..da46f9f 100644 --- a/cmds/modify-l2_cmds/network-key.js +++ b/cmds/modify-l2_cmds/network-key.js @@ -70,8 +70,11 @@ exports.handler = async function (argv) continue; } - var transactioHash = await rollerApi.configureKeys(rollerClient, patp, publicCrypt, publicAuth, argv.breach, signingAddress, privateKey); - console.log("tx hash: "+transactioHash); + var receipt = await rollerApi.configureKeys(rollerClient, patp, publicCrypt, publicAuth, argv.breach, signingAddress, privateKey); + console.log("tx hash: "+receipt.hash); + + let receiptFileName = patp.substring(1)+`-receipt-L2-${receipt.type}.json`; + files.writeFile(workDir, receiptFileName, receipt); } //end for each point process.exit(0); diff --git a/cmds/modify-l2_cmds/spawn.js b/cmds/modify-l2_cmds/spawn.js index 465f451..5f83487 100644 --- a/cmds/modify-l2_cmds/spawn.js +++ b/cmds/modify-l2_cmds/spawn.js @@ -38,8 +38,11 @@ exports.handler = async function (argv) // console.log("targetAddress: "+targetAddress); // console.log("signingAddress: "+signingAddress); // console.log("privateKey: "+privateKey); - var transactioHash = await rollerApi.spawn(rollerClient, parentPoint, patp, targetAddress, signingAddress, privateKey); - console.log("tx hash: "+transactioHash); + var receipt = await rollerApi.spawn(rollerClient, parentPoint, patp, targetAddress, signingAddress, privateKey); + console.log("tx hash: "+receipt.hash); + + let receiptFileName = patp.substring(1)+`-receipt-L2-${receipt.type}.json`; + files.writeFile(workDir, receiptFileName, receipt); } //end for each point process.exit(0); diff --git a/cmds/modify-l2_cmds/transfer.js b/cmds/modify-l2_cmds/transfer.js index aad66f8..a60c454 100644 --- a/cmds/modify-l2_cmds/transfer.js +++ b/cmds/modify-l2_cmds/transfer.js @@ -54,9 +54,11 @@ exports.handler = async function (argv) } //create and send tx - var transactioHash = await rollerApi.transferPoint(rollerClient, patp, argv.reset, targetAddress, signingAddress, privateKey); - console.log("tx hash: "+transactioHash); + var receipt = await rollerApi.transferPoint(rollerClient, patp, argv.reset, targetAddress, signingAddress, privateKey); + console.log("tx hash: "+receipt.hash); + let receiptFileName = patp.substring(1)+`-receipt-L2-${receipt.type}.json`; + files.writeFile(workDir, receiptFileName, receipt); } //end for each point process.exit(0); diff --git a/package-lock.json b/package-lock.json index 58648f2..fa32301 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1430,9 +1430,9 @@ } }, "@textile/threads-client-grpc": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@textile/threads-client-grpc/-/threads-client-grpc-1.1.3.tgz", - "integrity": "sha512-wOTZ0c42igugZ6I2DvJ6xY0oZhF5k3oOCS6mOy9aN0VXEWFNe+JbXf/aeLw2BWhY6JI6lp6KnJfMmP08aq7yYg==", + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/@textile/threads-client-grpc/-/threads-client-grpc-1.1.4.tgz", + "integrity": "sha512-Z/dpkVV6gOqYsI5k+DDzzkeFxTtMy5FqE2edyhfjyCVcQAD9tamTfGYDDu2AZO8Njgiunp7pecLPvrvUu7P0iA==", "optional": true, "requires": { "@improbable-eng/grpc-web": "^0.14.0", @@ -2987,8 +2987,8 @@ } }, "@zondax/filecoin-signing-tools": { - "version": "git+ssh://git@github.com/Digital-MOB-Filecoin/filecoin-signing-tools-js.git#8f8e92157cac2556d35cab866779e9a8ea8a4e25", - "from": "@zondax/filecoin-signing-tools@github:Digital-MOB-Filecoin/filecoin-signing-tools-js", + "version": "github:Digital-MOB-Filecoin/filecoin-signing-tools-js#8f8e92157cac2556d35cab866779e9a8ea8a4e25", + "from": "github:Digital-MOB-Filecoin/filecoin-signing-tools-js", "optional": true, "requires": { "axios": "^0.20.0", @@ -3311,17 +3311,6 @@ "requires": { "node-fetch": "^2.6.1", "util.promisify": "^1.0.0" - }, - "dependencies": { - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "optional": true, - "requires": { - "whatwg-url": "^5.0.0" - } - } } }, "apollo-server-errors": { @@ -6262,7 +6251,7 @@ "@ledgerhq/hw-transport-webusb": "^5.22.0", "@nodefactory/filsnap-adapter": "^0.2.1", "@nodefactory/filsnap-types": "^0.2.1", - "@zondax/filecoin-signing-tools": "@zondax/filecoin-signing-tools@github:Digital-MOB-Filecoin/filecoin-signing-tools-js", + "@zondax/filecoin-signing-tools": "github:Digital-MOB-Filecoin/filecoin-signing-tools-js", "bignumber.js": "^9.0.0", "bitcore-lib": "^8.22.2", "bitcore-mnemonic": "^8.22.2", @@ -6278,15 +6267,6 @@ "ws": "^7.3.1" }, "dependencies": { - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "optional": true, - "requires": { - "whatwg-url": "^5.0.0" - } - }, "tweetnacl": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz", @@ -6586,225 +6566,6 @@ "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", "optional": true }, - "ganache": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/ganache/-/ganache-7.0.1.tgz", - "integrity": "sha512-P3mw+O23fD7BuWTdhr0WweOrTJCBRBFX22nMpmQDZgb1vmcYEv7PzNiKIfsI6PGOLh7PO8GuoRiMYBF+SlFikg==", - "requires": { - "@trufflesuite/bigint-buffer": "1.1.9", - "bufferutil": "4.0.5", - "emittery": "0.10.0", - "keccak": "3.0.1", - "leveldown": "6.1.0", - "secp256k1": "4.0.2", - "utf-8-validate": "5.0.7" - }, - "dependencies": { - "@trufflesuite/bigint-buffer": { - "version": "1.1.9", - "resolved": "https://registry.npmjs.org/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.9.tgz", - "integrity": "sha512-bdM5cEGCOhDSwminryHJbRmXc1x7dPKg6Pqns3qyTwFlxsqUgxE29lsERS3PlIW1HTjoIGMUqsk1zQQwST1Yxw==", - "requires": { - "node-gyp-build": "4.3.0" - } - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" - }, - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "requires": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "bufferutil": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", - "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", - "optional": true, - "requires": { - "node-gyp-build": "^4.3.0" - } - }, - "catering": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.0.tgz", - "integrity": "sha512-M5imwzQn6y+ODBfgi+cfgZv2hIUI6oYU/0f35Mdb1ujGeqeoI5tOnl9Q13DTH7LW+7er+NYq8stNOKZD/Z3U/A==", - "requires": { - "queue-tick": "^1.0.0" - } - }, - "elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "requires": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "emittery": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.0.tgz", - "integrity": "sha512-AGvFfs+d0JKCJQ4o01ASQLGPmSCxgfU9RFXvzPvZdjKK8oscynksuJhWrSTSw7j7Ep/sZct5b5ZhYCi8S/t0HQ==" - }, - "hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "is-buffer": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", - "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==" - }, - "keccak": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.1.tgz", - "integrity": "sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA==", - "requires": { - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0" - } - }, - "leveldown": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-6.1.0.tgz", - "integrity": "sha512-8C7oJDT44JXxh04aSSsfcMI8YiaGRhOFI9/pMEL7nWJLVsWajDPTRxsSHTM2WcTVY5nXM+SuRHzPPi0GbnDX+w==", - "requires": { - "abstract-leveldown": "^7.2.0", - "napi-macros": "~2.0.0", - "node-gyp-build": "^4.3.0" - }, - "dependencies": { - "abstract-leveldown": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", - "integrity": "sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ==", - "requires": { - "buffer": "^6.0.3", - "catering": "^2.0.0", - "is-buffer": "^2.0.5", - "level-concat-iterator": "^3.0.0", - "level-supports": "^2.0.1", - "queue-microtask": "^1.2.3" - } - }, - "level-concat-iterator": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", - "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", - "requires": { - "catering": "^2.1.0" - } - }, - "level-supports": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", - "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==" - } - } - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, - "napi-macros": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", - "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==" - }, - "node-addon-api": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", - "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" - }, - "node-gyp-build": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.3.0.tgz", - "integrity": "sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==" - }, - "queue-microtask": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", - "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" - }, - "queue-tick": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.0.tgz", - "integrity": "sha512-ULWhjjE8BmiICGn3G8+1L9wFpERNxkf8ysxkAer4+TFdRefDaXOCV5m92aMB9FtBVmn/8sETXLXY6BfW7hyaWQ==" - }, - "secp256k1": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz", - "integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==", - "requires": { - "elliptic": "^6.5.2", - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0" - } - }, - "utf-8-validate": { - "version": "5.0.7", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", - "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", - "optional": true, - "requires": { - "node-gyp-build": "^4.3.0" - } - } - } - }, "ganache-cli": { "version": "6.12.2", "resolved": "https://registry.npmjs.org/ganache-cli/-/ganache-cli-6.12.2.tgz", @@ -8751,15 +8512,6 @@ "requires": { "globalthis": "^1.0.1" } - }, - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "optional": true, - "requires": { - "whatwg-url": "^5.0.0" - } } } }, @@ -11745,6 +11497,15 @@ "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" }, + "node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "optional": true, + "requires": { + "whatwg-url": "^5.0.0" + } + }, "node-forge": { "version": "0.10.0", "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", @@ -15383,6 +15144,225 @@ "path-exists": "^4.0.0" } }, + "ganache": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/ganache/-/ganache-7.0.1.tgz", + "integrity": "sha512-P3mw+O23fD7BuWTdhr0WweOrTJCBRBFX22nMpmQDZgb1vmcYEv7PzNiKIfsI6PGOLh7PO8GuoRiMYBF+SlFikg==", + "requires": { + "@trufflesuite/bigint-buffer": "1.1.9", + "bufferutil": "4.0.5", + "emittery": "0.10.0", + "keccak": "3.0.1", + "leveldown": "6.1.0", + "secp256k1": "4.0.2", + "utf-8-validate": "5.0.7" + }, + "dependencies": { + "@trufflesuite/bigint-buffer": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@trufflesuite/bigint-buffer/-/bigint-buffer-1.1.9.tgz", + "integrity": "sha512-bdM5cEGCOhDSwminryHJbRmXc1x7dPKg6Pqns3qyTwFlxsqUgxE29lsERS3PlIW1HTjoIGMUqsk1zQQwST1Yxw==", + "requires": { + "node-gyp-build": "4.3.0" + } + }, + "base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" + }, + "bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" + }, + "buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "requires": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, + "bufferutil": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.5.tgz", + "integrity": "sha512-HTm14iMQKK2FjFLRTM5lAVcyaUzOnqbPtesFIvREgXpJHdQm8bWS+GkQgIkfaBYRHuCnea7w8UVNfwiAQhlr9A==", + "optional": true, + "requires": { + "node-gyp-build": "^4.3.0" + } + }, + "catering": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/catering/-/catering-2.1.0.tgz", + "integrity": "sha512-M5imwzQn6y+ODBfgi+cfgZv2hIUI6oYU/0f35Mdb1ujGeqeoI5tOnl9Q13DTH7LW+7er+NYq8stNOKZD/Z3U/A==", + "requires": { + "queue-tick": "^1.0.0" + } + }, + "elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "requires": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "emittery": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.10.0.tgz", + "integrity": "sha512-AGvFfs+d0JKCJQ4o01ASQLGPmSCxgfU9RFXvzPvZdjKK8oscynksuJhWrSTSw7j7Ep/sZct5b5ZhYCi8S/t0HQ==" + }, + "hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==" + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-buffer": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.5.tgz", + "integrity": "sha512-i2R6zNFDwgEHJyQUtJEk0XFi1i0dPFn/oqjK3/vPCcDeJvW5NQ83V8QbicfF1SupOaB0h8ntgBC2YiE7dfyctQ==" + }, + "keccak": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.1.tgz", + "integrity": "sha512-epq90L9jlFWCW7+pQa6JOnKn2Xgl2mtI664seYR6MHskvI9agt7AnDqmAlp9TqU4/caMYbA08Hi5DMZAl5zdkA==", + "requires": { + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + } + }, + "leveldown": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/leveldown/-/leveldown-6.1.0.tgz", + "integrity": "sha512-8C7oJDT44JXxh04aSSsfcMI8YiaGRhOFI9/pMEL7nWJLVsWajDPTRxsSHTM2WcTVY5nXM+SuRHzPPi0GbnDX+w==", + "requires": { + "abstract-leveldown": "^7.2.0", + "napi-macros": "~2.0.0", + "node-gyp-build": "^4.3.0" + }, + "dependencies": { + "abstract-leveldown": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz", + "integrity": "sha512-DnhQwcFEaYsvYDnACLZhMmCWd3rkOeEvglpa4q5i/5Jlm3UIsWaxVzuXvDLFCSCWRO3yy2/+V/G7FusFgejnfQ==", + "requires": { + "buffer": "^6.0.3", + "catering": "^2.0.0", + "is-buffer": "^2.0.5", + "level-concat-iterator": "^3.0.0", + "level-supports": "^2.0.1", + "queue-microtask": "^1.2.3" + } + }, + "level-concat-iterator": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/level-concat-iterator/-/level-concat-iterator-3.1.0.tgz", + "integrity": "sha512-BWRCMHBxbIqPxJ8vHOvKUsaO0v1sLYZtjN3K2iZJsRBYtp+ONsY6Jfi6hy9K3+zolgQRryhIn2NRZjZnWJ9NmQ==", + "requires": { + "catering": "^2.1.0" + } + }, + "level-supports": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/level-supports/-/level-supports-2.1.0.tgz", + "integrity": "sha512-E486g1NCjW5cF78KGPrMDRBYzPuueMZ6VBXHT6gC7A8UYWGiM14fGgp+s/L1oFfDWSPV/+SFkYCmZ0SiESkRKA==" + } + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" + }, + "napi-macros": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/napi-macros/-/napi-macros-2.0.0.tgz", + "integrity": "sha512-A0xLykHtARfueITVDernsAWdtIMbOJgKgcluwENp3AlsKN/PloyO10HtmoqnFAQAcxPkgZN7wdfPfEd0zNGxbg==" + }, + "node-addon-api": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz", + "integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA==" + }, + "node-gyp-build": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.3.0.tgz", + "integrity": "sha512-iWjXZvmboq0ja1pUGULQBexmxq8CV4xBhX7VDOTbL7ZR4FOowwY/VOtRxBN/yKxmdGoIp4j5ysNT4u3S2pDQ3Q==" + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "queue-tick": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/queue-tick/-/queue-tick-1.0.0.tgz", + "integrity": "sha512-ULWhjjE8BmiICGn3G8+1L9wFpERNxkf8ysxkAer4+TFdRefDaXOCV5m92aMB9FtBVmn/8sETXLXY6BfW7hyaWQ==" + }, + "secp256k1": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz", + "integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==", + "requires": { + "elliptic": "^6.5.2", + "node-addon-api": "^2.0.0", + "node-gyp-build": "^4.2.0" + } + }, + "utf-8-validate": { + "version": "5.0.7", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.7.tgz", + "integrity": "sha512-vLt1O5Pp+flcArHGIyKEQq883nBt8nN8tVBcoL0qUXj2XT1n7p70yGIq2VK98I5FdZ1YHc0wk/koOnHjnXWk1Q==", + "optional": true, + "requires": { + "node-gyp-build": "^4.3.0" + } + } + } + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", diff --git a/test/test.js b/test/test.js index 6e768dd..b04c041 100644 --- a/test/test.js +++ b/test/test.js @@ -265,14 +265,14 @@ describe('#modify', async function() { it('should set the network keys for zod', async function() { //this also allows us to use zod to spawn further points, only booted points can spawn let lines = await execCliAndGetLines('modify', 'network-key', `--points=${galaxy}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc0); - assert.isTrue(files.fileExists(testWorkDir, 'zod-reciept-networkkey.json')); + assert.isTrue(files.fileExists(testWorkDir, 'zod-receipt-networkkey.json')); }); }); describe('spawn --points=marzod', async function() { it('should spawn the first star under zod', async function() { let lines = await execCliAndGetLines('modify', 'spawn', `--points=${star1}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc0); - assert.isTrue(files.fileExists(testWorkDir, 'marzod-reciept-spawn.json')); + assert.isTrue(files.fileExists(testWorkDir, 'marzod-receipt-spawn.json')); let children = await execCliAndGetLines('list', 'children', 'zod', '--spawned', ...baseArgs); children.shift();//starts with a header string @@ -283,21 +283,21 @@ describe('#modify', async function() { describe('management-proxy --points=marzod', async function() { it('should set the management proxy of marzod', async function() { let lines = await execCliAndGetLines('modify', 'management-proxy', `--points=${star1}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc1); - assert.isTrue(files.fileExists(testWorkDir, 'marzod-reciept-managementproxy.json')); + assert.isTrue(files.fileExists(testWorkDir, 'marzod-receipt-managementproxy.json')); }); }); describe('spawn-proxy --points=marzod', async function() { it('should set the spawn proxy of marzod', async function() { let lines = await execCliAndGetLines('modify', 'spawn-proxy', `--points=${star1}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc1); - assert.isTrue(files.fileExists(testWorkDir, 'marzod-reciept-spawnproxy.json')); + assert.isTrue(files.fileExists(testWorkDir, 'marzod-receipt-spawnproxy.json')); }); }); describe('transfer --points=marzod', async function() { it('should transfer marzod to acc2', async function() { let lines = await execCliAndGetLines('modify', 'transfer', `--points=${star1}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc2); - assert.isTrue(files.fileExists(testWorkDir, 'marzod-reciept-transfer.json')); + assert.isTrue(files.fileExists(testWorkDir, 'marzod-receipt-transfer.json')); //ac2 should have one child now let children = await execCliAndGetLines('list', 'owner', ac2, ...baseArgs); diff --git a/utils/eth.js b/utils/eth.js index 72c09c5..f367a4a 100644 --- a/utils/eth.js +++ b/utils/eth.js @@ -158,10 +158,10 @@ async function setGasSignSendAndSaveTransaction(ctx, tx, privateKey, argv, workD process.exit(1); } let receipt = await waitForTransactionReceipt(ctx.web3, signedTx); - //save the reciept if the transacation was accepted + //save the receipt if the transacation was accepted // status will be false if the blockchain rejected the transaction if(receipt != null && receipt.status){ - let receiptFileName = patp.substring(1)+`-reciept-${actionName}.json`; + let receiptFileName = patp.substring(1)+`-receipt-${actionName}.json`; files.writeFile(workDir, receiptFileName, receipt); console.error("Transaction accepted by the blockchain.") } diff --git a/utils/find-points.js b/utils/find-points.js index f3f4fd7..7d3abe6 100644 --- a/utils/find-points.js +++ b/utils/find-points.js @@ -26,7 +26,7 @@ function getPoints(argv, workDir, wallets){ //wallets is an object with the keys being the p pointsRaw = Object.keys(wallets); } - console.log(pointsRaw) + //console.log(pointsRaw) let points = _(pointsRaw) .map(p => validate.point(p, false)) .reject(_.isNull) diff --git a/utils/roller-api.js b/utils/roller-api.js index a5ce9fe..813cd89 100644 --- a/utils/roller-api.js +++ b/utils/roller-api.js @@ -96,6 +96,13 @@ async function addSignature(client, method, params, privateKey){ return params; } +function createTransactionReceipt(method, params, txHash){ + return { + sig: params.sig, + hash: txHash, + type: method + } +} //============================================ // API @@ -160,7 +167,8 @@ async function spawn(client, parentPoint, spawnPoint, newOwnerAddress, signingAd }; const method = "spawn"; params = await addSignature(client, method, params, privateKey); - return await client.request(method, params); + var tx = await client.request(method, params); + return createTransactionReceipt(method, params, tx); } async function transferPoint(client, point, reset, newOwnerAddress, signingAddress, privateKey){ @@ -182,7 +190,8 @@ async function transferPoint(client, point, reset, newOwnerAddress, signingAddre }; const method = "transferPoint"; params = await addSignature(client, method, params, privateKey); - return await client.request(method, params); + var tx = await client.request(method, params); + return createTransactionReceipt(method, params, tx); } async function setManagementProxy(client, point, managementProxyAddress, signingAddress, privateKey){ @@ -203,7 +212,8 @@ async function setManagementProxy(client, point, managementProxyAddress, signing }; const method = "setManagementProxy"; params = await addSignature(client, method, params, privateKey); - return await client.request(method, params); + var tx = await client.request(method, params); + return createTransactionReceipt(method, params, tx); } async function setSpawnProxy(client, point, spawnProxyAddress, signingAddress, privateKey){ @@ -224,7 +234,8 @@ async function setSpawnProxy(client, point, spawnProxyAddress, signingAddress, p }; const method = "setSpawnProxy"; params = await addSignature(client, method, params, privateKey); - return await client.request(method, params); + var tx = await client.request(method, params); + return createTransactionReceipt(method, params, tx); } async function setTransferProxy(client, point, transferProxyAddress, signingAddress, privateKey){ @@ -245,7 +256,8 @@ async function setTransferProxy(client, point, transferProxyAddress, signingAddr }; const method = "setTransferProxy"; params = await addSignature(client, method, params, privateKey); - return await client.request(method, params); + var tx = await client.request(method, params); + return createTransactionReceipt(method, params, tx); } async function configureKeys(client, point, encryptPublic, authPublic, breach, signingAddress, privateKey){ @@ -268,7 +280,8 @@ async function configureKeys(client, point, encryptPublic, authPublic, breach, s }; const method = "configureKeys"; params = await addSignature(client, method, params, privateKey); - return await client.request(method, params); + var tx = await client.request(method, params); + return createTransactionReceipt(method, params, tx); } From cb06f385a499e3d32381e515251e748547a059d9 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Fri, 20 May 2022 02:51:49 +0200 Subject: [PATCH 09/17] cleaned up l2 modify commands --- cmds/modify-l2_cmds/management-proxy.js | 14 ++++++++++---- cmds/modify-l2_cmds/network-key.js | 9 +++++++-- cmds/modify-l2_cmds/spawn.js | 9 ++++++++- cmds/modify-l2_cmds/transfer.js | 9 +++++++-- docs/grant.md | 16 +++++++++++----- utils/azimuth.js | 25 +++++++++++++++++++++---- utils/roller-api.js | 20 +++++++++----------- 7 files changed, 73 insertions(+), 29 deletions(-) diff --git a/cmds/modify-l2_cmds/management-proxy.js b/cmds/modify-l2_cmds/management-proxy.js index 6337932..e635a85 100644 --- a/cmds/modify-l2_cmds/management-proxy.js +++ b/cmds/modify-l2_cmds/management-proxy.js @@ -27,6 +27,12 @@ exports.handler = async function (argv) let patp = ob.patp(p); console.log(`Trying to set mgmt. proxy for ${patp} (${p}).`); + const pointInfo = await rollerApi.getPoint(rollerClient, patp); + if(pointInfo.dominion != 'l2'){ + console.log(`This point in not on L2, please use the L1 modify command.`); + continue; + } + let wallet = argv.useWalletFiles ? wallets[patp] : null; let targetAddress = argv.address != undefined @@ -36,21 +42,21 @@ exports.handler = async function (argv) null; //fail targetAddress = validate.address(targetAddress, true); - let pointInfo = await rollerApi.getPoint(rollerClient, patp); if(ajsUtils.addressEquals(pointInfo.ownership.managementProxy.address, targetAddress)){ console.log(`Target address ${targetAddress} is already mgmt. proxy for ${patp}.`); continue; } - //todo: this is not correct: only owner can set management proxy - if(!(await rollerApi.getManagementProxy(rollerClient, patp, signingAddress))){ + //the proxy type must be 'own', indicating that the signing address is the same as the point owner, + // bc only the point owner can set the mgmt proxy + if((await rollerApi.getManagementProxyType(rollerClient, patp, signingAddress)) != 'own'){ console.log(`Cannot set mgmt. proxy for ${patp}, must be owner.`); continue; } //create and send tx var receipt = await rollerApi.setManagementProxy(rollerClient, patp, targetAddress, signingAddress, privateKey); - console.log("tx hash: "+receipt.hash); + console.log("Tx hash: "+receipt.hash); let receiptFileName = patp.substring(1)+`-receipt-L2-${receipt.type}.json`; files.writeFile(workDir, receiptFileName, receipt); diff --git a/cmds/modify-l2_cmds/network-key.js b/cmds/modify-l2_cmds/network-key.js index da46f9f..88d84ea 100644 --- a/cmds/modify-l2_cmds/network-key.js +++ b/cmds/modify-l2_cmds/network-key.js @@ -33,6 +33,11 @@ exports.handler = async function (argv) console.log(`Trying to set network key for ${patp} (${p}).`); const pointInfo = await rollerApi.getPoint(rollerClient, patp); + if(pointInfo.dominion != 'l2'){ + console.log(`This point in not on L2, please use the L1 modify command.`); + continue; + } + const currentKeys = pointInfo.network.keys; //retrieve the network keypair @@ -53,7 +58,7 @@ exports.handler = async function (argv) process.exit(1); } - if(!(await rollerApi.getManagementProxy(rollerClient, patp, signingAddress))){ + if(!(await rollerApi.getManagementProxyType(rollerClient, patp, signingAddress))){ console.log(`Cannot set network keys for ${patp}, must be owner or management proxy.`); continue; } @@ -71,7 +76,7 @@ exports.handler = async function (argv) } var receipt = await rollerApi.configureKeys(rollerClient, patp, publicCrypt, publicAuth, argv.breach, signingAddress, privateKey); - console.log("tx hash: "+receipt.hash); + console.log("Tx hash: "+receipt.hash); let receiptFileName = patp.substring(1)+`-receipt-L2-${receipt.type}.json`; files.writeFile(workDir, receiptFileName, receipt); diff --git a/cmds/modify-l2_cmds/spawn.js b/cmds/modify-l2_cmds/spawn.js index 5f83487..4cd0b92 100644 --- a/cmds/modify-l2_cmds/spawn.js +++ b/cmds/modify-l2_cmds/spawn.js @@ -33,13 +33,20 @@ exports.handler = async function (argv) console.log(`Trying to spawn ${patp} (${p}).`); const parentPoint = ob.sein(patp); + + const parentPointInfo = await rollerApi.getPoint(rollerClient, parentPoint); + if(parentPointInfo.dominion == 'l1'){ + console.log(`The parent, ${parentPoint}, of this point, ${patp}, cannont spawn on L2, please transfer it to L2 or set the spawn proxy to L2.`); + continue; + } + // console.log("parent p: "+parentPoint); // console.log("p to spawn: "+p); // console.log("targetAddress: "+targetAddress); // console.log("signingAddress: "+signingAddress); // console.log("privateKey: "+privateKey); var receipt = await rollerApi.spawn(rollerClient, parentPoint, patp, targetAddress, signingAddress, privateKey); - console.log("tx hash: "+receipt.hash); + console.log("Tx hash: "+receipt.hash); let receiptFileName = patp.substring(1)+`-receipt-L2-${receipt.type}.json`; files.writeFile(workDir, receiptFileName, receipt); diff --git a/cmds/modify-l2_cmds/transfer.js b/cmds/modify-l2_cmds/transfer.js index a60c454..e6c74e1 100644 --- a/cmds/modify-l2_cmds/transfer.js +++ b/cmds/modify-l2_cmds/transfer.js @@ -42,20 +42,25 @@ exports.handler = async function (argv) targetAddress = validate.address(targetAddress, true); let pointInfo = await rollerApi.getPoint(rollerClient, patp); + if(pointInfo.dominion != 'l2'){ + console.log(`This point in not on L2, please use the L1 modify command.`); + continue; + } + if(ajsUtils.addressEquals(pointInfo.ownership.owner.address, targetAddress)){ console.log(`Target address ${targetAddress} is already owner of ${patp}.`); continue; } //use the transfer proxy check to see if the singing address is either owner or transfer proxy - if(!(await rollerApi.getTransferProxy(rollerClient, patp, signingAddress))){ + if(!(await rollerApi.getTransferProxyType(rollerClient, patp, signingAddress))){ console.log(`Signing address ${signingAddress} must be owner or transfer proxy.`); continue; } //create and send tx var receipt = await rollerApi.transferPoint(rollerClient, patp, argv.reset, targetAddress, signingAddress, privateKey); - console.log("tx hash: "+receipt.hash); + console.log("Tx hash: "+receipt.hash); let receiptFileName = patp.substring(1)+`-receipt-L2-${receipt.type}.json`; files.writeFile(workDir, receiptFileName, receipt); diff --git a/docs/grant.md b/docs/grant.md index 812cb58..d4c8977 100644 --- a/docs/grant.md +++ b/docs/grant.md @@ -133,11 +133,17 @@ As soon as the Layer 2 solution is released, the CLI should also support actions Deliverables: - Move points that are on Azimuth to L2, or move just the spawn proxy of stars. -- Connect to a Roller instead of an ETH node -- Spawn points on L2 -- Set Network Keys on L2 -- Set Proxies on L2 -- Transfer points on L2 +- (DONE) Connect to a Roller instead of an ETH node +- (DONE) Spawn points on L2 +- (DONE) Set Network Keys on L2 +- (DONE) Set Proxies on L2 +- (DONE) Transfer points on L2 +- (DONE) Ensure that L2 operations are on an l2 point, and L1s on a L1 point +- combine l1 and l2 list commands +- rename 'list' to 'get' (breaking change) +- rename 'modify' to 'modify-l1' +- merge documentation +- better error when roller is not available and l2 is needed (in modify and get) ### Milestone 4 - Additional Features diff --git a/utils/azimuth.js b/utils/azimuth.js index 7ad61d0..595be4a 100644 --- a/utils/azimuth.js +++ b/utils/azimuth.js @@ -17,14 +17,31 @@ function getChildren(point) { async function isManagementProxy(contracts, point, address) { - if(!ajs.utils.isValidAddress(address)) throw 'address not valid'; + if(!ajs.utils.isValidAddress(address)) throw 'address not valid'; - managedPoints = await ajs.azimuth.getManagerFor(contracts, address); - return _.includes(managedPoints, point.toString()); + managedPoints = await ajs.azimuth.getManagerFor(contracts, address); + return _.includes(managedPoints, point.toString()); +} + +async function getDominion(contracts, point) +{ + //if the ownership or spawn proxy address is set to 0x111...111 on azimuth, then the point is on l2 + const l2address = '0x1111111111111111111111111111111111111111' + + var ownerAddress = await ajs.azimuth.getOwner(contracts, point); + if(ajs.utils.addressEquals(ownerAddress, l2address)) + return 'l2' + + var spawnProxyAddress = await ajs.azimuth.getSpawnProxy(contracts, point); + if(ajs.utils.addressEquals(spawnProxyAddress, l2address)) + return 'spawn' + + return 'l1' } module.exports = { getChildren, - isManagementProxy + isManagementProxy, + getDominion } diff --git a/utils/roller-api.js b/utils/roller-api.js index 813cd89..7546747 100644 --- a/utils/roller-api.js +++ b/utils/roller-api.js @@ -151,7 +151,7 @@ async function spawn(client, parentPoint, spawnPoint, newOwnerAddress, signingAd const spawnPatp = ob.patp(validate.point(spawnPoint, true)); const newOwnerAddressValid = validate.address(newOwnerAddress, true); const signingAddressValid = validate.address(signingAddress, true); - const proxy = await getSpawnProxy(client, parentPatp, signingAddress); + const proxy = await getSpawnProxyType(client, parentPatp, signingAddress); //console.log("Proxy: "+proxy); let params = { @@ -175,7 +175,7 @@ async function transferPoint(client, point, reset, newOwnerAddress, signingAddre const patp = ob.patp(validate.point(point, true)); const newOwnerAddressValid = validate.address(newOwnerAddress, true); const signingAddressValid = validate.address(signingAddress, true); - const proxy = await getTransferProxy(client, patp, signingAddress); + const proxy = await getTransferProxyType(client, patp, signingAddress); let params = { address: signingAddressValid, @@ -263,7 +263,7 @@ async function setTransferProxy(client, point, transferProxyAddress, signingAddr async function configureKeys(client, point, encryptPublic, authPublic, breach, signingAddress, privateKey){ const patp = ob.patp(validate.point(point, true)); const signingAddressValid = validate.address(signingAddress, true); - const proxy = await getManagementProxy(client, patp, signingAddress); //either the owner or the manage proxy can set the keys + const proxy = await getManagementProxyType(client, patp, signingAddress); //either the owner or the manage proxy can set the keys let params = { address: signingAddressValid, @@ -284,9 +284,7 @@ async function configureKeys(client, point, encryptPublic, authPublic, breach, s return createTransactionReceipt(method, params, tx); } - - -async function getManagementProxy(client, point, signingAddress){ +async function getManagementProxyType(client, point, signingAddress){ const pointInfo = await getPoint(client, point); if(ajsUtils.addressEquals(pointInfo.ownership.owner.address, signingAddress)) return 'own'; @@ -295,7 +293,7 @@ async function getManagementProxy(client, point, signingAddress){ return undefined; } -async function getSpawnProxy(client, point, signingAddress){ +async function getSpawnProxyType(client, point, signingAddress){ const pointInfo = await getPoint(client, point); if(ajsUtils.addressEquals(pointInfo.ownership.owner.address, signingAddress)) return 'own'; @@ -304,7 +302,7 @@ async function getSpawnProxy(client, point, signingAddress){ return undefined; } -async function getTransferProxy(client, point, signingAddress){ +async function getTransferProxyType(client, point, signingAddress){ const pointInfo = await getPoint(client, point); if(ajsUtils.addressEquals(pointInfo.ownership.owner.address, signingAddress)) return 'own'; @@ -341,8 +339,8 @@ module.exports = { setSpawnProxy, configureKeys, - getManagementProxy, - getSpawnProxy, - getTransferProxy + getManagementProxyType, + getSpawnProxyType, + getTransferProxyType } From 19330047beb9b249410a05798a0d67cb26df1a13 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Fri, 20 May 2022 08:18:07 +0200 Subject: [PATCH 10/17] renamed list to get --- cmds/list.js | 6 ----- cmds/list_cmds/children.js | 45 -------------------------------- cmds/list_cmds/details.js | 52 ------------------------------------- cmds/list_cmds/gas-price.js | 12 --------- cmds/list_cmds/owner.js | 21 --------------- 5 files changed, 136 deletions(-) delete mode 100644 cmds/list.js delete mode 100644 cmds/list_cmds/children.js delete mode 100644 cmds/list_cmds/details.js delete mode 100644 cmds/list_cmds/gas-price.js delete mode 100644 cmds/list_cmds/owner.js diff --git a/cmds/list.js b/cmds/list.js deleted file mode 100644 index 2cb3539..0000000 --- a/cmds/list.js +++ /dev/null @@ -1,6 +0,0 @@ -exports.command = 'list ' -exports.desc = 'List Azimuth points' -exports.builder = function (yargs) { - return yargs.commandDir('list_cmds') -} -exports.handler = function (argv) {} \ No newline at end of file diff --git a/cmds/list_cmds/children.js b/cmds/list_cmds/children.js deleted file mode 100644 index 7965ccd..0000000 --- a/cmds/list_cmds/children.js +++ /dev/null @@ -1,45 +0,0 @@ -const ob = require('urbit-ob') -const ajs = require('azimuth-js') -const {validate, eth, azimuth} = require('../../utils') - -exports.command = 'children ' -exports.desc = 'List all children for , where is patp or p.' -exports.builder = (yargs) =>{ - yargs.option('unspawned',{ - alias: 'u', - describe: 'Only include unspawned points.', - type: 'boolean', - conflicts: 'spawned' - }); - yargs.option('spawned',{ - alias: 's', - describe: 'Only include spawned points.', - type: 'boolean', - conflicts: 'unspawned' - }); -} - -exports.handler = async function (argv) { - const point = validate.point(argv.point, true); - const ctx = await eth.createContext(argv); - - let childPoints = null; - if(argv.spawned){ - childPoints = await ajs.azimuth.getSpawned(ctx.contracts, point); - } - else if(argv.unspawned){ - childPoints = await ajs.azimuth.getUnspawnedChildren(ctx.contracts, point); - } - else{ - childPoints = azimuth.getChildren(point); - } - - console.log(`listing ${childPoints.length} children under ${ob.patp(point)} (${point}):`); - for(const p of childPoints) - { - const patp = ob.patp(p); - console.log(`${patp} (${p})`); - } -} - - diff --git a/cmds/list_cmds/details.js b/cmds/list_cmds/details.js deleted file mode 100644 index 1dc1171..0000000 --- a/cmds/list_cmds/details.js +++ /dev/null @@ -1,52 +0,0 @@ -const ob = require('urbit-ob') -const ajs = require('azimuth-js') -const {validate, eth} = require('../../utils') - -exports.command = 'details ' -exports.desc = 'Outputs various information about a . Such as owner and proxy addresses.' -exports.builder = (yargs) =>{ -} - -exports.handler = async function (argv) { - const ctx = await eth.createContext(argv); - const p = validate.point(argv.point, true); - const patp = ob.patp(p); - console.log(`urbit ID (patp): ${patp}`); - console.log(`urbit ID number (p): ${p}`); - - const shipType = ob.clan(patp); - console.log(`ship type: ${shipType}`); - - const parentPatp = ob.sein(patp); - const parentP = ob.patp2dec(parentPatp); - console.log(`parent: ${parentPatp}`); - - const sponsorP = await ajs.azimuth.getSponsor(ctx.contracts, p); - const sponsorPatp = ob.patp(sponsorP); - const hasSponsor = await ajs.azimuth.hasSponsor(ctx.contracts, p); - console.log(`sponsor: ${hasSponsor ? sponsorPatp : 'null'}`); - - const ownerAddress = sanitizeAddress(await ajs.azimuth.getOwner(ctx.contracts, p)); - console.log(`owner address: ${ownerAddress}`); - - const spawnProxyAddress = sanitizeAddress(await ajs.azimuth.getSpawnProxy(ctx.contracts, p)); - console.log(`spawn proxy address: ${spawnProxyAddress}`); - - const networkKeysSet = await ajs.azimuth.hasBeenLinked(ctx.contracts, p); - console.log(`network keys set: ${networkKeysSet}`); - const networkKeysRevision = await ajs.azimuth.getKeyRevisionNumber(ctx.contracts, p); - console.log(`network keys revision: ${networkKeysRevision}`); - - const continuityNumber = await ajs.azimuth.getContinuityNumber(ctx.contracts, p); - console.log(`continuity number: ${continuityNumber}`); - - const spawnedChildrenCount = await ajs.azimuth.getSpawnCount(ctx.contracts, p); - console.log(`spawned children: ${spawnedChildrenCount}`); -} - -function sanitizeAddress(address){ - if(address && !ajs.utils.addressEquals('0x0000000000000000000000000000000000000000', address)){ - return address.toLowerCase(); - } - return null; -} \ No newline at end of file diff --git a/cmds/list_cmds/gas-price.js b/cmds/list_cmds/gas-price.js deleted file mode 100644 index 406b0e1..0000000 --- a/cmds/list_cmds/gas-price.js +++ /dev/null @@ -1,12 +0,0 @@ -const ajs = require('azimuth-js') -const {validate, eth} = require('../../utils') - -exports.command = 'gas-price' -exports.desc = 'Lists the current ethereum gas prices computed by etherscan.io. These can be used to set the max-fee in the modify commands. API is rate limited.' -exports.builder = (yargs) =>{ -} - -exports.handler = async function (argv) { - var gasPrices = await eth.getCurrentGasPrices(); - console.log(JSON.stringify(gasPrices, null, 2)); -} \ No newline at end of file diff --git a/cmds/list_cmds/owner.js b/cmds/list_cmds/owner.js deleted file mode 100644 index b61519f..0000000 --- a/cmds/list_cmds/owner.js +++ /dev/null @@ -1,21 +0,0 @@ -const ob = require('urbit-ob') -const ajs = require('azimuth-js') -const {validate, eth} = require('../../utils') - -exports.command = 'owner ' -exports.desc = 'List points of which the is owner.' -exports.builder = (yargs) =>{ - yargs.positional('addr', {type: 'string'}) -} - -exports.handler = async function (argv) { - let addr = validate.address(argv.addr, true); - const ctx = await eth.createContext(argv); - let points = await ajs.azimuth.getOwnedPoints(ctx.contracts, addr); - console.log(`listing ${points.length} owned points by ${addr}:`); - for(const p of points) - { - const patp = ob.patp(p); - console.log(`${patp}, ${p}`); - } -} \ No newline at end of file From 7268b11d4f76c8d1717e15c07c783f87dd232825 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Fri, 20 May 2022 08:18:21 +0200 Subject: [PATCH 11/17] renamed list to get --- cmds/get.js | 6 +++++ cmds/get_cmds/children.js | 45 +++++++++++++++++++++++++++++++++ cmds/get_cmds/details.js | 52 ++++++++++++++++++++++++++++++++++++++ cmds/get_cmds/gas-price.js | 12 +++++++++ cmds/get_cmds/owner.js | 21 +++++++++++++++ 5 files changed, 136 insertions(+) create mode 100644 cmds/get.js create mode 100644 cmds/get_cmds/children.js create mode 100644 cmds/get_cmds/details.js create mode 100644 cmds/get_cmds/gas-price.js create mode 100644 cmds/get_cmds/owner.js diff --git a/cmds/get.js b/cmds/get.js new file mode 100644 index 0000000..322b09f --- /dev/null +++ b/cmds/get.js @@ -0,0 +1,6 @@ +exports.command = 'get ' +exports.desc = 'Get information about Urbit points.' +exports.builder = function (yargs) { + return yargs.commandDir('get_cmds') +} +exports.handler = function (argv) {} \ No newline at end of file diff --git a/cmds/get_cmds/children.js b/cmds/get_cmds/children.js new file mode 100644 index 0000000..7965ccd --- /dev/null +++ b/cmds/get_cmds/children.js @@ -0,0 +1,45 @@ +const ob = require('urbit-ob') +const ajs = require('azimuth-js') +const {validate, eth, azimuth} = require('../../utils') + +exports.command = 'children ' +exports.desc = 'List all children for , where is patp or p.' +exports.builder = (yargs) =>{ + yargs.option('unspawned',{ + alias: 'u', + describe: 'Only include unspawned points.', + type: 'boolean', + conflicts: 'spawned' + }); + yargs.option('spawned',{ + alias: 's', + describe: 'Only include spawned points.', + type: 'boolean', + conflicts: 'unspawned' + }); +} + +exports.handler = async function (argv) { + const point = validate.point(argv.point, true); + const ctx = await eth.createContext(argv); + + let childPoints = null; + if(argv.spawned){ + childPoints = await ajs.azimuth.getSpawned(ctx.contracts, point); + } + else if(argv.unspawned){ + childPoints = await ajs.azimuth.getUnspawnedChildren(ctx.contracts, point); + } + else{ + childPoints = azimuth.getChildren(point); + } + + console.log(`listing ${childPoints.length} children under ${ob.patp(point)} (${point}):`); + for(const p of childPoints) + { + const patp = ob.patp(p); + console.log(`${patp} (${p})`); + } +} + + diff --git a/cmds/get_cmds/details.js b/cmds/get_cmds/details.js new file mode 100644 index 0000000..1dc1171 --- /dev/null +++ b/cmds/get_cmds/details.js @@ -0,0 +1,52 @@ +const ob = require('urbit-ob') +const ajs = require('azimuth-js') +const {validate, eth} = require('../../utils') + +exports.command = 'details ' +exports.desc = 'Outputs various information about a . Such as owner and proxy addresses.' +exports.builder = (yargs) =>{ +} + +exports.handler = async function (argv) { + const ctx = await eth.createContext(argv); + const p = validate.point(argv.point, true); + const patp = ob.patp(p); + console.log(`urbit ID (patp): ${patp}`); + console.log(`urbit ID number (p): ${p}`); + + const shipType = ob.clan(patp); + console.log(`ship type: ${shipType}`); + + const parentPatp = ob.sein(patp); + const parentP = ob.patp2dec(parentPatp); + console.log(`parent: ${parentPatp}`); + + const sponsorP = await ajs.azimuth.getSponsor(ctx.contracts, p); + const sponsorPatp = ob.patp(sponsorP); + const hasSponsor = await ajs.azimuth.hasSponsor(ctx.contracts, p); + console.log(`sponsor: ${hasSponsor ? sponsorPatp : 'null'}`); + + const ownerAddress = sanitizeAddress(await ajs.azimuth.getOwner(ctx.contracts, p)); + console.log(`owner address: ${ownerAddress}`); + + const spawnProxyAddress = sanitizeAddress(await ajs.azimuth.getSpawnProxy(ctx.contracts, p)); + console.log(`spawn proxy address: ${spawnProxyAddress}`); + + const networkKeysSet = await ajs.azimuth.hasBeenLinked(ctx.contracts, p); + console.log(`network keys set: ${networkKeysSet}`); + const networkKeysRevision = await ajs.azimuth.getKeyRevisionNumber(ctx.contracts, p); + console.log(`network keys revision: ${networkKeysRevision}`); + + const continuityNumber = await ajs.azimuth.getContinuityNumber(ctx.contracts, p); + console.log(`continuity number: ${continuityNumber}`); + + const spawnedChildrenCount = await ajs.azimuth.getSpawnCount(ctx.contracts, p); + console.log(`spawned children: ${spawnedChildrenCount}`); +} + +function sanitizeAddress(address){ + if(address && !ajs.utils.addressEquals('0x0000000000000000000000000000000000000000', address)){ + return address.toLowerCase(); + } + return null; +} \ No newline at end of file diff --git a/cmds/get_cmds/gas-price.js b/cmds/get_cmds/gas-price.js new file mode 100644 index 0000000..406b0e1 --- /dev/null +++ b/cmds/get_cmds/gas-price.js @@ -0,0 +1,12 @@ +const ajs = require('azimuth-js') +const {validate, eth} = require('../../utils') + +exports.command = 'gas-price' +exports.desc = 'Lists the current ethereum gas prices computed by etherscan.io. These can be used to set the max-fee in the modify commands. API is rate limited.' +exports.builder = (yargs) =>{ +} + +exports.handler = async function (argv) { + var gasPrices = await eth.getCurrentGasPrices(); + console.log(JSON.stringify(gasPrices, null, 2)); +} \ No newline at end of file diff --git a/cmds/get_cmds/owner.js b/cmds/get_cmds/owner.js new file mode 100644 index 0000000..b61519f --- /dev/null +++ b/cmds/get_cmds/owner.js @@ -0,0 +1,21 @@ +const ob = require('urbit-ob') +const ajs = require('azimuth-js') +const {validate, eth} = require('../../utils') + +exports.command = 'owner ' +exports.desc = 'List points of which the is owner.' +exports.builder = (yargs) =>{ + yargs.positional('addr', {type: 'string'}) +} + +exports.handler = async function (argv) { + let addr = validate.address(argv.addr, true); + const ctx = await eth.createContext(argv); + let points = await ajs.azimuth.getOwnedPoints(ctx.contracts, addr); + console.log(`listing ${points.length} owned points by ${addr}:`); + for(const p of points) + { + const patp = ob.patp(p); + console.log(`${patp}, ${p}`); + } +} \ No newline at end of file From 5577eeb20b5726a00b1531e638fa42630451f951 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Fri, 20 May 2022 08:51:55 +0200 Subject: [PATCH 12/17] combined get commands --- cmds/get.js | 2 +- cmds/get_cmds/children.js | 43 +++++++++---- cmds/get_cmds/details.js | 61 ++++++++++++++++++- cmds/get_cmds/gas-price.js | 2 +- cmds/get_cmds/owner.js | 10 ++- .../{list-l2_cmds => get_cmds}/roller-info.js | 7 ++- .../pending.js => get_cmds/roller-pending.js} | 4 +- cmds/list-l2.js | 6 -- cmds/list-l2_cmds/children.js | 44 ------------- cmds/list-l2_cmds/details.js | 20 ------ cmds/list-l2_cmds/owner.js | 21 ------- docs/grant.md | 6 +- 12 files changed, 112 insertions(+), 114 deletions(-) rename cmds/{list-l2_cmds => get_cmds}/roller-info.js (80%) rename cmds/{list-l2_cmds/pending.js => get_cmds/roller-pending.js} (92%) delete mode 100644 cmds/list-l2.js delete mode 100644 cmds/list-l2_cmds/children.js delete mode 100644 cmds/list-l2_cmds/details.js delete mode 100644 cmds/list-l2_cmds/owner.js diff --git a/cmds/get.js b/cmds/get.js index 322b09f..cdb6789 100644 --- a/cmds/get.js +++ b/cmds/get.js @@ -1,5 +1,5 @@ exports.command = 'get ' -exports.desc = 'Get information about Urbit points.' +exports.desc = 'Retrieve information about Urbit points, L2 rollers, and Ethereum gas prices.' exports.builder = function (yargs) { return yargs.commandDir('get_cmds') } diff --git a/cmds/get_cmds/children.js b/cmds/get_cmds/children.js index 7965ccd..1960dca 100644 --- a/cmds/get_cmds/children.js +++ b/cmds/get_cmds/children.js @@ -1,6 +1,6 @@ const ob = require('urbit-ob') const ajs = require('azimuth-js') -const {validate, eth, azimuth} = require('../../utils') +const {validate, eth, azimuth, rollerApi} = require('../../utils') exports.command = 'children ' exports.desc = 'List all children for , where is patp or p.' @@ -22,23 +22,44 @@ exports.builder = (yargs) =>{ exports.handler = async function (argv) { const point = validate.point(argv.point, true); const ctx = await eth.createContext(argv); - - let childPoints = null; + const dominion = await azimuth.getDominion(ctx.contracts, point); + + let childPoints = + dominion == 'l1' + ? (await getchildPointsFromL1(argv, ctx, point)) + : (await getchildPointsFromL2(argv, point)); + + console.log(`listing ${childPoints.length} children under ${ob.patp(point)} (${point}):`); + for(const p of childPoints) + { + const patp = ob.patp(p); + console.log(`${patp} (${p})`); + } +} + + +async function getchildPointsFromL1(argv, ctx, point){ if(argv.spawned){ - childPoints = await ajs.azimuth.getSpawned(ctx.contracts, point); + return await ajs.azimuth.getSpawned(ctx.contracts, point); } else if(argv.unspawned){ - childPoints = await ajs.azimuth.getUnspawnedChildren(ctx.contracts, point); + return await ajs.azimuth.getUnspawnedChildren(ctx.contracts, point); } else{ - childPoints = azimuth.getChildren(point); + return azimuth.getChildren(point); } +} - console.log(`listing ${childPoints.length} children under ${ob.patp(point)} (${point}):`); - for(const p of childPoints) - { - const patp = ob.patp(p); - console.log(`${patp} (${p})`); +async function getchildPointsFromL2(argv, point){ + const rollerClient = rollerApi.createClient(argv); + if(argv.spawned){ + return await rollerApi.getSpawned(rollerClient, point); + } + else if(argv.unspawned){ + return await rollerApi.getUnspawned(rollerClient, point); + } + else{ + return azimuth.getChildren(point); } } diff --git a/cmds/get_cmds/details.js b/cmds/get_cmds/details.js index 1dc1171..d79fc74 100644 --- a/cmds/get_cmds/details.js +++ b/cmds/get_cmds/details.js @@ -1,6 +1,6 @@ const ob = require('urbit-ob') const ajs = require('azimuth-js') -const {validate, eth} = require('../../utils') +const {validate, eth, azimuth, rollerApi} = require('../../utils') exports.command = 'details ' exports.desc = 'Outputs various information about a . Such as owner and proxy addresses.' @@ -17,6 +17,22 @@ exports.handler = async function (argv) { const shipType = ob.clan(patp); console.log(`ship type: ${shipType}`); + const dominion = await azimuth.getDominion(ctx.contracts, p); + console.log(`dominion: ${dominion}`); + + //Careful !!: you cannot check the dominion on l1, because points that are spawned on l2, do not show as spawned at all on l1, + // you have to ask the roller api to see it as l2 + // example: azi get details bicsev-havwer + + //TODO: show dominion, and start branching based on dominion + // add command that forces the use of the roller + + // const rollerClient = rollerApi.createClient(argv); + // const pointInfo = await rollerApi.getPoint(rollerClient, p); + // console.log(`data from roller:`); + // console.log(JSON.stringify(pointInfo, null, 2)); + + const parentPatp = ob.sein(patp); const parentP = ob.patp2dec(parentPatp); console.log(`parent: ${parentPatp}`); @@ -49,4 +65,45 @@ function sanitizeAddress(address){ return address.toLowerCase(); } return null; -} \ No newline at end of file +} + + +// data from roller: +// { +// "dominion": "l1", +// "ownership": { +// "transferProxy": { +// "address": "0x0000000000000000000000000000000000000000", +// "nonce": 0 +// }, +// "votingProxy": { +// "address": "0xb73532b04fb598f5d719ec40be68db02f798bcf3", +// "nonce": 0 +// }, +// "spawnProxy": { +// "address": "0x9f57c77b1095bd5db0558b9cb9b8e6fc67375e3c", +// "nonce": 0 +// }, +// "managementProxy": { +// "address": "0x5eb03d359e6815d6407771ab69e80af5644104b9", +// "nonce": 0 +// }, +// "owner": { +// "address": "0x9f57c77b1095bd5db0558b9cb9b8e6fc67375e3c", +// "nonce": 0 +// } +// }, +// "network": { +// "keys": { +// "life": "6", +// "suite": "1", +// "auth": "0xbd44cee24b74632e65d842ce0fc0bf6e109675e6aca4a9d94c33657e1cc24231", +// "crypt": "0xa5f1a3a6662b675c109be8ce642c1b4add53df18609738b8d59bbc1d8d508831" +// }, +// "sponsor": { +// "has": true, +// "who": 0 +// }, +// "rift": "2" +// } +// } \ No newline at end of file diff --git a/cmds/get_cmds/gas-price.js b/cmds/get_cmds/gas-price.js index 406b0e1..dcef2f7 100644 --- a/cmds/get_cmds/gas-price.js +++ b/cmds/get_cmds/gas-price.js @@ -2,7 +2,7 @@ const ajs = require('azimuth-js') const {validate, eth} = require('../../utils') exports.command = 'gas-price' -exports.desc = 'Lists the current ethereum gas prices computed by etherscan.io. These can be used to set the max-fee in the modify commands. API is rate limited.' +exports.desc = 'Lists the current Ethereum gas prices computed by etherscan.io. These can be used to set the max-fee in the modify commands. API is rate limited.' exports.builder = (yargs) =>{ } diff --git a/cmds/get_cmds/owner.js b/cmds/get_cmds/owner.js index b61519f..ce33266 100644 --- a/cmds/get_cmds/owner.js +++ b/cmds/get_cmds/owner.js @@ -1,6 +1,6 @@ const ob = require('urbit-ob') const ajs = require('azimuth-js') -const {validate, eth} = require('../../utils') +const {validate, eth, rollerApi} = require('../../utils') exports.command = 'owner ' exports.desc = 'List points of which the is owner.' @@ -11,7 +11,13 @@ exports.builder = (yargs) =>{ exports.handler = async function (argv) { let addr = validate.address(argv.addr, true); const ctx = await eth.createContext(argv); - let points = await ajs.azimuth.getOwnedPoints(ctx.contracts, addr); + const dominion = await azimuth.getDominion(ctx.contracts, point); + + let points = + dominion == 'l1' + ? (await ajs.azimuth.getOwnedPoints(ctx.contracts, addr)) + : (await rollerApi.getShips(rollerApi.createClient(argv), addr)); + console.log(`listing ${points.length} owned points by ${addr}:`); for(const p of points) { diff --git a/cmds/list-l2_cmds/roller-info.js b/cmds/get_cmds/roller-info.js similarity index 80% rename from cmds/list-l2_cmds/roller-info.js rename to cmds/get_cmds/roller-info.js index 083d8a4..89e32d8 100644 --- a/cmds/list-l2_cmds/roller-info.js +++ b/cmds/get_cmds/roller-info.js @@ -6,18 +6,21 @@ exports.builder = (yargs) =>{ } exports.handler = async function (argv) { - const rollerClient = rollerApi.createClient(argv); const rollerConfig = await rollerApi.getRollerConfig(rollerClient); console.log(`roller config:`); console.log(JSON.stringify(rollerConfig, null, 2)); + const nextBatchTime = getNextBatchTime(rollerConfig); + console.log(`next batch: ${nextBatchTime} GMT`); +} +function getNextBatchTime(rollerConfig){ var date = new Date(rollerConfig.nextBatch * 1000); var hours = date.getHours(); var minutes = "0" + date.getMinutes(); var seconds = "0" + date.getSeconds(); var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2); - console.log(`next batch: ${formattedTime} GMT`); + return formattedTime; } \ No newline at end of file diff --git a/cmds/list-l2_cmds/pending.js b/cmds/get_cmds/roller-pending.js similarity index 92% rename from cmds/list-l2_cmds/pending.js rename to cmds/get_cmds/roller-pending.js index 494751c..454d1b1 100644 --- a/cmds/list-l2_cmds/pending.js +++ b/cmds/get_cmds/roller-pending.js @@ -1,16 +1,14 @@ const ob = require('urbit-ob') const {validate, rollerApi} = require('../../utils') -exports.command = 'pending' +exports.command = 'roller-pending' exports.desc = 'Outputs the pending roller transactions.' exports.builder = (yargs) =>{ } exports.handler = async function (argv) { - const rollerClient = rollerApi.createClient(argv); const data = await rollerApi.getAllPending(rollerClient); console.log(`data from roller:`); console.log(JSON.stringify(data, null, 2)); - } \ No newline at end of file diff --git a/cmds/list-l2.js b/cmds/list-l2.js deleted file mode 100644 index 3091231..0000000 --- a/cmds/list-l2.js +++ /dev/null @@ -1,6 +0,0 @@ -exports.command = 'list-l2 ' -exports.desc = 'Azimuth layer 2 commands for retriving infromation about points, addresses, and roller.' -exports.builder = function (yargs) { - return yargs.commandDir('list-l2_cmds') -} -exports.handler = function (argv) {} \ No newline at end of file diff --git a/cmds/list-l2_cmds/children.js b/cmds/list-l2_cmds/children.js deleted file mode 100644 index 4fe2002..0000000 --- a/cmds/list-l2_cmds/children.js +++ /dev/null @@ -1,44 +0,0 @@ -const ob = require('urbit-ob') -const {validate, eth, azimuth, rollerApi} = require('../../utils') - -exports.command = 'children ' -exports.desc = 'List all children for , where is patp or p.' -exports.builder = (yargs) =>{ - yargs.option('unspawned',{ - alias: 'u', - describe: 'Only include unspawned points.', - type: 'boolean', - conflicts: 'spawned' - }); - yargs.option('spawned',{ - alias: 's', - describe: 'Only include spawned points.', - type: 'boolean', - conflicts: 'unspawned' - }); -} - -exports.handler = async function (argv) { - const point = validate.point(argv.point, true); - const rollerClient = rollerApi.createClient(argv); - - let childPoints = null; - if(argv.spawned){ - childPoints = await rollerApi.getSpawned(rollerClient, point); - } - else if(argv.unspawned){ - childPoints = await rollerApi.getUnspawned(rollerClient, point); - } - else{ - childPoints = azimuth.getChildren(point); - } - - console.log(`listing ${childPoints.length} children under ${ob.patp(point)} (${point}):`); - for(const p of childPoints) - { - const patp = ob.patp(p); - console.log(`${patp} (${p})`); - } -} - - diff --git a/cmds/list-l2_cmds/details.js b/cmds/list-l2_cmds/details.js deleted file mode 100644 index 4c600cb..0000000 --- a/cmds/list-l2_cmds/details.js +++ /dev/null @@ -1,20 +0,0 @@ -const ob = require('urbit-ob') -const {validate, rollerApi} = require('../../utils') - -exports.command = 'details ' -exports.desc = 'Outputs various information about a retrieved from a roller.' -exports.builder = (yargs) =>{ -} - -exports.handler = async function (argv) { - const p = validate.point(argv.point, true); - const patp = ob.patp(p); - console.log(`urbit ID (patp): ${patp}`); - console.log(`urbit ID number (p): ${p}`); - - const rollerClient = rollerApi.createClient(argv); - const pointInfo = await rollerApi.getPoint(rollerClient, p); - console.log(`data from roller:`); - console.log(JSON.stringify(pointInfo, null, 2)); - -} \ No newline at end of file diff --git a/cmds/list-l2_cmds/owner.js b/cmds/list-l2_cmds/owner.js deleted file mode 100644 index 7fe95d2..0000000 --- a/cmds/list-l2_cmds/owner.js +++ /dev/null @@ -1,21 +0,0 @@ -const ob = require('urbit-ob') -const {validate, eth, rollerApi} = require('../../utils') - -exports.command = 'owner ' -exports.desc = 'List points of which the is owner.' -exports.builder = (yargs) =>{ - yargs.positional('addr', {type: 'string'}) -} - -exports.handler = async function (argv) { - let addr = validate.address(argv.addr, true); - const rollerClient = rollerApi.createClient(argv); - - let points = await rollerApi.getShips(rollerClient, addr); - console.log(`listing ${points.length} owned points by ${addr}:`); - for(const p of points) - { - const patp = ob.patp(p); - console.log(`${patp}, ${p}`); - } -} \ No newline at end of file diff --git a/docs/grant.md b/docs/grant.md index d4c8977..5864b25 100644 --- a/docs/grant.md +++ b/docs/grant.md @@ -140,10 +140,14 @@ Deliverables: - (DONE) Transfer points on L2 - (DONE) Ensure that L2 operations are on an l2 point, and L1s on a L1 point - combine l1 and l2 list commands -- rename 'list' to 'get' (breaking change) + -> TODO: solve how to select roller or azimuth to get data? see problem in details.js for more info + prob best to just try the roller and if not avail, fall back to azimuth. +- review generate commands for roller compat +- (DONE) rename 'list' to 'get' (breaking change) - rename 'modify' to 'modify-l1' - merge documentation - better error when roller is not available and l2 is needed (in modify and get) +- make sure the default settings files gets reset ### Milestone 4 - Additional Features From 15f8313945e65296b15ef46256230722eae1483b Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Sun, 22 May 2022 21:58:50 +0200 Subject: [PATCH 13/17] get commands now support switching between azimuth and roller --- cmds/get_cmds/children.js | 25 +++++-- cmds/get_cmds/details.js | 134 ++++++++++++++++++++----------------- cmds/get_cmds/gas-price.js | 3 +- cmds/get_cmds/owner.js | 32 +++++++-- docs/grant.md | 4 +- docs/links.md | 3 +- utils/roller-api.js | 25 ++++++- 7 files changed, 143 insertions(+), 83 deletions(-) diff --git a/cmds/get_cmds/children.js b/cmds/get_cmds/children.js index 1960dca..31c64e5 100644 --- a/cmds/get_cmds/children.js +++ b/cmds/get_cmds/children.js @@ -17,16 +17,28 @@ exports.builder = (yargs) =>{ type: 'boolean', conflicts: 'unspawned' }); + + yargs.option('use-roller',{ + alias: 'l2', + describe: 'Enforce using the roller (L2) for all data and do not allow fallback to azimuth (L1).', + type: 'boolean', + conflicts: 'use-azimuth' + }); + yargs.option('use-azimuth',{ + alias: 'l1', + describe: 'Enforce using azimuth (L1) for all data and do not allow fallback to the roller (L2).', + type: 'boolean', + conflicts: 'use-roller' + }); } exports.handler = async function (argv) { const point = validate.point(argv.point, true); - const ctx = await eth.createContext(argv); - const dominion = await azimuth.getDominion(ctx.contracts, point); + const source = await rollerApi.selectDataSource(argv); let childPoints = - dominion == 'l1' - ? (await getchildPointsFromL1(argv, ctx, point)) + source == 'azimuth' + ? (await getchildPointsFromL1(argv, point)) : (await getchildPointsFromL2(argv, point)); console.log(`listing ${childPoints.length} children under ${ob.patp(point)} (${point}):`); @@ -37,8 +49,8 @@ exports.handler = async function (argv) { } } - -async function getchildPointsFromL1(argv, ctx, point){ +async function getchildPointsFromL1(argv, point){ + const ctx = await eth.createContext(argv); if(argv.spawned){ return await ajs.azimuth.getSpawned(ctx.contracts, point); } @@ -52,6 +64,7 @@ async function getchildPointsFromL1(argv, ctx, point){ async function getchildPointsFromL2(argv, point){ const rollerClient = rollerApi.createClient(argv); + console.log('here') if(argv.spawned){ return await rollerApi.getSpawned(rollerClient, point); } diff --git a/cmds/get_cmds/details.js b/cmds/get_cmds/details.js index d79fc74..d494257 100644 --- a/cmds/get_cmds/details.js +++ b/cmds/get_cmds/details.js @@ -5,43 +5,61 @@ const {validate, eth, azimuth, rollerApi} = require('../../utils') exports.command = 'details ' exports.desc = 'Outputs various information about a . Such as owner and proxy addresses.' exports.builder = (yargs) =>{ + yargs.option('use-roller',{ + alias: 'l2', + describe: 'Enforce using the roller (L2) for all data and do not allow fallback to azimuth (L1).', + type: 'boolean', + conflicts: 'use-azimuth' + }); + yargs.option('use-azimuth',{ + alias: 'l1', + describe: 'Enforce using azimuth (L1) for all data and do not allow fallback to the roller (L2).', + type: 'boolean', + conflicts: 'use-roller' + }); } exports.handler = async function (argv) { - const ctx = await eth.createContext(argv); const p = validate.point(argv.point, true); + const source = await rollerApi.selectDataSource(argv); + + //print some info that does not require a connection to azimuth or the roller const patp = ob.patp(p); console.log(`urbit ID (patp): ${patp}`); console.log(`urbit ID number (p): ${p}`); - const shipType = ob.clan(patp); console.log(`ship type: ${shipType}`); - - const dominion = await azimuth.getDominion(ctx.contracts, p); - console.log(`dominion: ${dominion}`); - - //Careful !!: you cannot check the dominion on l1, because points that are spawned on l2, do not show as spawned at all on l1, - // you have to ask the roller api to see it as l2 - // example: azi get details bicsev-havwer - - //TODO: show dominion, and start branching based on dominion - // add command that forces the use of the roller - - // const rollerClient = rollerApi.createClient(argv); - // const pointInfo = await rollerApi.getPoint(rollerClient, p); - // console.log(`data from roller:`); - // console.log(JSON.stringify(pointInfo, null, 2)); - - const parentPatp = ob.sein(patp); const parentP = ob.patp2dec(parentPatp); console.log(`parent: ${parentPatp}`); + //depending on the data source, print info from azimuth or the roller + if(source == 'azimuth'){ + await printDetailsFromL1(argv, p); + } + else{ + await printDetailsFromL2(argv, p); + } +} + +function sanitizeAddress(address){ + if(address && !ajs.utils.addressEquals('0x0000000000000000000000000000000000000000', address)){ + return address.toLowerCase(); + } + return null; +} + +async function printDetailsFromL1(argv, p){ + const ctx = await eth.createContext(argv); + const sponsorP = await ajs.azimuth.getSponsor(ctx.contracts, p); const sponsorPatp = ob.patp(sponsorP); const hasSponsor = await ajs.azimuth.hasSponsor(ctx.contracts, p); console.log(`sponsor: ${hasSponsor ? sponsorPatp : 'null'}`); + const dominion = await azimuth.getDominion(ctx.contracts, p); + console.log(`dominion: ${dominion}`); + const ownerAddress = sanitizeAddress(await ajs.azimuth.getOwner(ctx.contracts, p)); console.log(`owner address: ${ownerAddress}`); @@ -60,50 +78,40 @@ exports.handler = async function (argv) { console.log(`spawned children: ${spawnedChildrenCount}`); } -function sanitizeAddress(address){ - if(address && !ajs.utils.addressEquals('0x0000000000000000000000000000000000000000', address)){ - return address.toLowerCase(); +async function printDetailsFromL2(argv, p){ + const rollerClient = rollerApi.createClient(argv); + + let pointInfo = null + try{ + pointInfo = await rollerApi.getPoint(rollerClient, p); } - return null; -} + catch(error){ + if(error.message.includes('Resource not found')){ + console.log('planet does not exist on L2, please try again with the --use-azimuth option.') + } + else{ + console.log(error); + } + return; + } + + const sponsorP = Number(pointInfo.network.sponsor.who); + const sponsorPatp = ob.patp(sponsorP); + const hasSponsor = pointInfo.network.sponsor.has; + console.log(`sponsor: ${hasSponsor ? sponsorPatp : 'null'}`); + + console.log(`dominion: ${pointInfo.dominion}`); + + console.log(`owner address: ${pointInfo.ownership.owner.address}`); + console.log(`spawn proxy address: ${pointInfo.ownership.spawnProxy.address}`); + console.log(`management proxy address: ${pointInfo.ownership.managementProxy.address}`); + console.log(`transfer proxy address: ${pointInfo.ownership.transferProxy.address}`); + console.log(`network keys set: ${pointInfo.network.keys.auth ? 'true' : 'false'}`); + console.log(`network keys revision (life): ${pointInfo.network.keys.life}`); + + console.log(`continuity number (rift): ${pointInfo.network.rift}`); -// data from roller: -// { -// "dominion": "l1", -// "ownership": { -// "transferProxy": { -// "address": "0x0000000000000000000000000000000000000000", -// "nonce": 0 -// }, -// "votingProxy": { -// "address": "0xb73532b04fb598f5d719ec40be68db02f798bcf3", -// "nonce": 0 -// }, -// "spawnProxy": { -// "address": "0x9f57c77b1095bd5db0558b9cb9b8e6fc67375e3c", -// "nonce": 0 -// }, -// "managementProxy": { -// "address": "0x5eb03d359e6815d6407771ab69e80af5644104b9", -// "nonce": 0 -// }, -// "owner": { -// "address": "0x9f57c77b1095bd5db0558b9cb9b8e6fc67375e3c", -// "nonce": 0 -// } -// }, -// "network": { -// "keys": { -// "life": "6", -// "suite": "1", -// "auth": "0xbd44cee24b74632e65d842ce0fc0bf6e109675e6aca4a9d94c33657e1cc24231", -// "crypt": "0xa5f1a3a6662b675c109be8ce642c1b4add53df18609738b8d59bbc1d8d508831" -// }, -// "sponsor": { -// "has": true, -// "who": 0 -// }, -// "rift": "2" -// } -// } \ No newline at end of file + const spawnedChildren = await rollerApi.getSpawned(rollerClient, p); + console.log(`spawned children: ${spawnedChildren.length}`); +} \ No newline at end of file diff --git a/cmds/get_cmds/gas-price.js b/cmds/get_cmds/gas-price.js index dcef2f7..2fbead0 100644 --- a/cmds/get_cmds/gas-price.js +++ b/cmds/get_cmds/gas-price.js @@ -1,5 +1,4 @@ -const ajs = require('azimuth-js') -const {validate, eth} = require('../../utils') +const {eth} = require('../../utils') exports.command = 'gas-price' exports.desc = 'Lists the current Ethereum gas prices computed by etherscan.io. These can be used to set the max-fee in the modify commands. API is rate limited.' diff --git a/cmds/get_cmds/owner.js b/cmds/get_cmds/owner.js index ce33266..15bb63b 100644 --- a/cmds/get_cmds/owner.js +++ b/cmds/get_cmds/owner.js @@ -5,18 +5,36 @@ const {validate, eth, rollerApi} = require('../../utils') exports.command = 'owner ' exports.desc = 'List points of which the is owner.' exports.builder = (yargs) =>{ - yargs.positional('addr', {type: 'string'}) + yargs.positional('addr', {type: 'string'}); + + yargs.option('use-roller',{ + alias: 'l2', + describe: 'Enforce using the roller (L2) for all data and do not allow fallback to azimuth (L1).', + type: 'boolean', + conflicts: 'use-azimuth' + }); + yargs.option('use-azimuth',{ + alias: 'l1', + describe: 'Enforce using azimuth (L1) for all data and do not allow fallback to the roller (L2).', + type: 'boolean', + conflicts: 'use-roller' + }); } exports.handler = async function (argv) { let addr = validate.address(argv.addr, true); - const ctx = await eth.createContext(argv); - const dominion = await azimuth.getDominion(ctx.contracts, point); - let points = - dominion == 'l1' - ? (await ajs.azimuth.getOwnedPoints(ctx.contracts, addr)) - : (await rollerApi.getShips(rollerApi.createClient(argv), addr)); + let points = []; + const source = await rollerApi.selectDataSource(argv); + if(source == 'roller'){ + let rollerClient = rollerApi.createClient(argv); + points = await rollerApi.getShips(rollerClient, addr); + } + else + { + const ctx = await eth.createContext(argv); + points = await ajs.azimuth.getOwnedPoints(ctx.contracts, addr); + } console.log(`listing ${points.length} owned points by ${addr}:`); for(const p of points) diff --git a/docs/grant.md b/docs/grant.md index 5864b25..6eec98f 100644 --- a/docs/grant.md +++ b/docs/grant.md @@ -139,9 +139,7 @@ Deliverables: - (DONE) Set Proxies on L2 - (DONE) Transfer points on L2 - (DONE) Ensure that L2 operations are on an l2 point, and L1s on a L1 point -- combine l1 and l2 list commands - -> TODO: solve how to select roller or azimuth to get data? see problem in details.js for more info - prob best to just try the roller and if not avail, fall back to azimuth. +- (DONE) combine l1 and l2 list commands - review generate commands for roller compat - (DONE) rename 'list' to 'get' (breaking change) - rename 'modify' to 'modify-l1' diff --git a/docs/links.md b/docs/links.md index 0a15fc9..dfbeb58 100644 --- a/docs/links.md +++ b/docs/links.md @@ -2,7 +2,8 @@ ## Urbit Docs * azimuth-js docs https://github.com/urbit/azimuth-js/blob/master/docs/api.md - + * roller tutorial: https://urbit.org/docs/azimuth/l2/roller-tutorial + ## yargs Links * Main site: http://yargs.js.org/ diff --git a/utils/roller-api.js b/utils/roller-api.js index 7546747..c654386 100644 --- a/utils/roller-api.js +++ b/utils/roller-api.js @@ -10,6 +10,28 @@ const { ecdsaSign } = require('secp256k1'); const CRYPTO_SUITE_VERSION = 1; let requestCounter = 0; +async function selectDataSource(argv){ + if(argv.useRoller){ + return 'roller'; + } + else if(argv.useAzimuth){ + return 'azimuth'; + } + else{ + //check if the roller client is available; + // if yes, use the roller, otherwise use azimuth + try{ + await getRollerConfig(createClient(argv)); //will throw a connection refused error if not available + return 'roller'; + } + catch(error){ + console.log('Roller not available, falling back to using azimuth, information might not be correct.'); + return 'azimuth'; + } + } + throw 'could not determine data source'; +} + function nextId(){ requestCounter++; return requestCounter.toString(); //the roller rpc need a string ID, otherwise it does it does not work @@ -321,8 +343,9 @@ async function getTransferProxyType(client, point, signingAddress){ // [-> then replace checks in modify-l2 commands to use these functions] module.exports = { - getRollerConfig, + selectDataSource, createClient, + getRollerConfig, getAllPending, getPendingByAddress, whenNextBatch, From 19daf89928f82a2104b89c5b96939e9dcb8ee053 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Sun, 22 May 2022 22:37:50 +0200 Subject: [PATCH 14/17] cleanup --- cli.js | 2 +- cmds/generate_cmds/report.js | 17 +++++++++++------ cmds/generate_cmds/spawn-list.js | 15 ++++++++++----- cmds/get_cmds/children.js | 2 -- cmds/get_cmds/details.js | 2 -- cmds/get_cmds/owner.js | 2 -- cmds/{modify.js => modify-l1.js} | 4 ++-- .../management-proxy.js | 0 .../network-key.js | 0 .../spawn-proxy.js | 0 cmds/{modify_cmds => modify-l1_cmds}/spawn.js | 0 .../{modify_cmds => modify-l1_cmds}/transfer.js | 0 cmds/modify-l2.js | 2 +- docs/grant.md | 8 ++++---- utils/roller-api.js | 8 +++++++- 15 files changed, 36 insertions(+), 26 deletions(-) rename cmds/{modify.js => modify-l1.js} (96%) rename cmds/{modify_cmds => modify-l1_cmds}/management-proxy.js (100%) rename cmds/{modify_cmds => modify-l1_cmds}/network-key.js (100%) rename cmds/{modify_cmds => modify-l1_cmds}/spawn-proxy.js (100%) rename cmds/{modify_cmds => modify-l1_cmds}/spawn.js (100%) rename cmds/{modify_cmds => modify-l1_cmds}/transfer.js (100%) diff --git a/cli.js b/cli.js index e369001..2b515b7 100755 --- a/cli.js +++ b/cli.js @@ -28,7 +28,7 @@ function getUniversalOptions() }, 'roller-provider':{ describe: 'What L2 roller provider to use.', - default: 'local', + default: 'urbit', choices: ['local', 'urbit'], type: 'string' }, diff --git a/cmds/generate_cmds/report.js b/cmds/generate_cmds/report.js index 4af4cce..ee13002 100644 --- a/cmds/generate_cmds/report.js +++ b/cmds/generate_cmds/report.js @@ -37,26 +37,31 @@ exports.builder = (yargs) =>{ return true }); - //todo: remove this and figure out the dominion pased on the parent point yargs.option('use-roller',{ - alias: 'l2', - describe: 'Connect to a roller to get the unspawned points instead of azimuth.', + describe: 'Enforce using the roller (L2) for all data and do not allow fallback to azimuth (L1).', type: 'boolean', + conflicts: 'use-azimuth' + }); + yargs.option('use-azimuth',{ + describe: 'Enforce using azimuth (L1) for all data and do not allow fallback to the roller (L2).', + type: 'boolean', + conflicts: 'use-roller' }); } exports.handler = async function (argv) { - const workDir = files.ensureWorkDir(argv.workDir); + const source = await rollerApi.selectDataSource(argv); let ctx = null; let rollerClient = null; - if(!argv.useRoller){ + if(source == 'azimuth'){ ctx = await eth.createContext(argv); } else{ rollerClient = rollerApi.createClient(argv); } + const workDir = files.ensureWorkDir(argv.workDir); const wallets = argv.useWalletFiles ? findPoints.getWallets(workDir) : null; const points = findPoints.getPoints(argv, workDir, wallets); @@ -89,7 +94,7 @@ exports.handler = async function (argv) csvLine += `${masterTicket},${networkKeyfileContents},`; //use azimuth - if(!argv.useRoller){ + if(source == 'azimuth'){ //get the addresses const dominion = 'L1'; //todo: try to get the dominion via ajs const ownerAddress = await ajs.azimuth.getOwner(ctx.contracts, p); diff --git a/cmds/generate_cmds/spawn-list.js b/cmds/generate_cmds/spawn-list.js index 5b26c6b..2e98a78 100644 --- a/cmds/generate_cmds/spawn-list.js +++ b/cmds/generate_cmds/spawn-list.js @@ -32,27 +32,32 @@ exports.builder = (yargs) =>{ type: 'string', }); - //todo: remove this and figure out the dominion pased on the parent point yargs.option('use-roller',{ - alias: 'l2', - describe: 'Connect to a roller to get the unspawned points instead of azimuth.', + describe: 'Enforce using the roller (L2) for all data and do not allow fallback to azimuth (L1).', type: 'boolean', + conflicts: 'use-azimuth' + }); + yargs.option('use-azimuth',{ + describe: 'Enforce using azimuth (L1) for all data and do not allow fallback to the roller (L2).', + type: 'boolean', + conflicts: 'use-roller' }); } exports.handler = async function (argv) { const point = validate.point(argv.point, true); + const workDir = files.ensureWorkDir(argv.workDir); - if(files.fileExists(workDir, argv.output) && !argv.force) { console.log('Spawn list file already exists, will not recreate it.'); return; } + const source = await rollerApi.selectDataSource(argv); let childPoints = []; - if(!argv.useRoller){ + if(source == 'azimuth'){ const ctx = await eth.createContext(argv); childPoints = await ajs.azimuth.getUnspawnedChildren(ctx.contracts, point); } diff --git a/cmds/get_cmds/children.js b/cmds/get_cmds/children.js index 31c64e5..b39eaaa 100644 --- a/cmds/get_cmds/children.js +++ b/cmds/get_cmds/children.js @@ -19,13 +19,11 @@ exports.builder = (yargs) =>{ }); yargs.option('use-roller',{ - alias: 'l2', describe: 'Enforce using the roller (L2) for all data and do not allow fallback to azimuth (L1).', type: 'boolean', conflicts: 'use-azimuth' }); yargs.option('use-azimuth',{ - alias: 'l1', describe: 'Enforce using azimuth (L1) for all data and do not allow fallback to the roller (L2).', type: 'boolean', conflicts: 'use-roller' diff --git a/cmds/get_cmds/details.js b/cmds/get_cmds/details.js index d494257..eaece12 100644 --- a/cmds/get_cmds/details.js +++ b/cmds/get_cmds/details.js @@ -6,13 +6,11 @@ exports.command = 'details ' exports.desc = 'Outputs various information about a . Such as owner and proxy addresses.' exports.builder = (yargs) =>{ yargs.option('use-roller',{ - alias: 'l2', describe: 'Enforce using the roller (L2) for all data and do not allow fallback to azimuth (L1).', type: 'boolean', conflicts: 'use-azimuth' }); yargs.option('use-azimuth',{ - alias: 'l1', describe: 'Enforce using azimuth (L1) for all data and do not allow fallback to the roller (L2).', type: 'boolean', conflicts: 'use-roller' diff --git a/cmds/get_cmds/owner.js b/cmds/get_cmds/owner.js index 15bb63b..6f2c9e8 100644 --- a/cmds/get_cmds/owner.js +++ b/cmds/get_cmds/owner.js @@ -8,13 +8,11 @@ exports.builder = (yargs) =>{ yargs.positional('addr', {type: 'string'}); yargs.option('use-roller',{ - alias: 'l2', describe: 'Enforce using the roller (L2) for all data and do not allow fallback to azimuth (L1).', type: 'boolean', conflicts: 'use-azimuth' }); yargs.option('use-azimuth',{ - alias: 'l1', describe: 'Enforce using azimuth (L1) for all data and do not allow fallback to the roller (L2).', type: 'boolean', conflicts: 'use-roller' diff --git a/cmds/modify.js b/cmds/modify-l1.js similarity index 96% rename from cmds/modify.js rename to cmds/modify-l1.js index fc718ac..b100581 100644 --- a/cmds/modify.js +++ b/cmds/modify-l1.js @@ -1,5 +1,5 @@ -exports.command = 'modify ' -exports.desc = 'Make changes to the on-chain state on Azimuth.' +exports.command = 'modify-l1 ' +exports.desc = 'Make changes to the on-chain state on Azimuth (Layer 1).' exports.builder = function (yargs) { yargs.option('address',{ diff --git a/cmds/modify_cmds/management-proxy.js b/cmds/modify-l1_cmds/management-proxy.js similarity index 100% rename from cmds/modify_cmds/management-proxy.js rename to cmds/modify-l1_cmds/management-proxy.js diff --git a/cmds/modify_cmds/network-key.js b/cmds/modify-l1_cmds/network-key.js similarity index 100% rename from cmds/modify_cmds/network-key.js rename to cmds/modify-l1_cmds/network-key.js diff --git a/cmds/modify_cmds/spawn-proxy.js b/cmds/modify-l1_cmds/spawn-proxy.js similarity index 100% rename from cmds/modify_cmds/spawn-proxy.js rename to cmds/modify-l1_cmds/spawn-proxy.js diff --git a/cmds/modify_cmds/spawn.js b/cmds/modify-l1_cmds/spawn.js similarity index 100% rename from cmds/modify_cmds/spawn.js rename to cmds/modify-l1_cmds/spawn.js diff --git a/cmds/modify_cmds/transfer.js b/cmds/modify-l1_cmds/transfer.js similarity index 100% rename from cmds/modify_cmds/transfer.js rename to cmds/modify-l1_cmds/transfer.js diff --git a/cmds/modify-l2.js b/cmds/modify-l2.js index c5c2f5f..85a91ca 100644 --- a/cmds/modify-l2.js +++ b/cmds/modify-l2.js @@ -1,5 +1,5 @@ exports.command = 'modify-l2 ' -exports.desc = 'Make changes to a L2 point.' +exports.desc = 'Make changes to a point via a roller (Layer 2).' exports.builder = function (yargs) { yargs.demandOption('d'); diff --git a/docs/grant.md b/docs/grant.md index 6eec98f..1986d8e 100644 --- a/docs/grant.md +++ b/docs/grant.md @@ -140,11 +140,11 @@ Deliverables: - (DONE) Transfer points on L2 - (DONE) Ensure that L2 operations are on an l2 point, and L1s on a L1 point - (DONE) combine l1 and l2 list commands -- review generate commands for roller compat +- (DONE) review generate commands for roller compat - (DONE) rename 'list' to 'get' (breaking change) -- rename 'modify' to 'modify-l1' -- merge documentation -- better error when roller is not available and l2 is needed (in modify and get) +- (DONE) better error when roller is not available and l2 is needed (in modify and get) +- (DONE) rename 'modify' to 'modify-l1' +- merge documentation, and update documentation - make sure the default settings files gets reset ### Milestone 4 - Additional Features diff --git a/utils/roller-api.js b/utils/roller-api.js index c654386..1d4b9c1 100644 --- a/utils/roller-api.js +++ b/utils/roller-api.js @@ -12,7 +12,13 @@ let requestCounter = 0; async function selectDataSource(argv){ if(argv.useRoller){ - return 'roller'; + try{ + await getRollerConfig(createClient(argv)); //will throw a connection refused error if not available + return 'roller'; + } + catch(error){ + throw 'Roller not available. You required the usage of the roller, please ensure it is running and can be reached.' + } } else if(argv.useAzimuth){ return 'azimuth'; From 344a9b69d7e30207f057a4c3a53d287a1eae5784 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Mon, 23 May 2022 13:25:10 +0200 Subject: [PATCH 15/17] updated the documentation --- README.md | 62 +++++++++++++++++++++++++++++++++++++++----------- docs/grant.md | 2 +- docs/roller.md | 27 ++-------------------- 3 files changed, 52 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 394bbbe..d3d6cf5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ # azimuth-cli -The azimuth-cli is "Bridge for the command line." It should allow ship owners and operators to do the same things that they can in [Bridge](https://bridge.urbit.org/) but via the command line, and in batch mode. -The primary usage of the cli is to query and modify the [azimuth contracts](https://github.com/urbit/azimuth) on Ethereum. +This is a command line tool to work with Urbit ID, which is the idenity layer behind [Urbit](https://urbit.org/) and is managed as a set of NFTs on the Ethereum blockchain. + +The azimuth-cli is "Bridge for the command line." It should allow Urbit ship owners and operators to do the same things that they can in [Bridge](https://bridge.urbit.org/) but via the command line, and in batch mode. + +The primary functionality of the cli is to query and modify the [azimuth contracts](https://github.com/urbit/azimuth) on Ethereum. ## Install @@ -29,9 +32,14 @@ To run the tests: After installing the npm package, just type `azimuth-cli` in the command line to see the options. You can also use `azi` for short. -There are three main types of commands: `list`, `generate`, and `modify`. First, the `list` commands do not make any changes, they just print information to the command line. But `generate` commands usually save something to the current work directory; use this, for example, to generate HD wallets. The `modify` commands actually change the blockchain and usually require the private key of the address that owns the urbit point you are making a change to. The `modify` commands also save data to the work directory, such as Ethereum transaction receipts. +There are three main types of commands: `get`, `generate`, and `modify`. First, the `get` commands do not make any changes, they just print information to the command line. But `generate` commands usually save something to the current work directory; use this, for example, to generate HD wallets. + +The `modify` commands actually change the blockchain and usually require the private key of the address that owns the urbit point you are making a change to. The `modify` commands have two versions: `modify-l1` and `modify-l2`. This is because Urbit IDs can either be modified directly through an Ethereum smart contract called Azimuth, aka "L1", or via a Layer 2 solution that is cheaper, which uses a "roller" that gathers transactions that modify Urbit IDs and then submits them as one batch to Ethereum, and is called the "L2" solution. The `modify` commands also save data to the work directory, such as Ethereum or roller transaction receipts. -More complicated operations--such as spawning ships, keying them, and transfering them to master tickets--cannot be executed in a single command. Multiple commands need to be called in order (see the example below). +More complicated operations--such as spawning ships, keying them, and transfering them to master tickets--cannot be executed in a single command. Multiple commands need to be called in order (see the examples below). + +### Setting Up Your Own Layer 2 Roller +If you want to modify large batches of points in one go--for example spawn 200 planets--then you need to [run your own roller](docs/roller.md). By default, the CLI points to the official roller run by Urbit. See the `--roller-provider` option in the CLI. ### Work Directory & Idempotent Commands Many commands, especially the `generate` and `modify` ones, need a work directory to fulfill their function. The reason for this is that a command may be called multiple times, but the end effect needs to always be the same. For example, if you call `azi generate spawn-list --count=10` multiple times, the resulting `spawn-list.txt` file will only be created once, and will not change in subsequent calls (unless the `--force` option is provided). The same goes for the `modify` commands. @@ -45,35 +53,43 @@ The work directory is the current folder or can be supplied with the `--work-dir For the full documentation, please install the cli and explore the commands and sub-commands with the `--help` option. `aimuth-cli` - * `list` - Prints azimuth data to the console. + * `get` - Retrieves data about points, rollers, and azimuth, and prints it to the console. By default, uses a L2 roller to get the information. * `children ` - Lists all child points of a certain Urbit point. * `owner
` - Lists all points owned by that Ethereum address. * `details ` - Prints details about the point. - * `gas-price` - Outputs the current Etherum gas prices. This is helpful if you want to provide a gas limit in the `modify` commands. + * `gas-price` - Outputs the current Etherum gas prices. This is helpful if you want to provide a gas limit in the `modify-l1` commands. + * `roller-info` - Prints details about the L2 roller. + * `roller-info` - Prints pending roller transactions. * `generate` - Generates various files that can be used in the `modify` commands. * `spawn-list ` - Creates a `spawn-list.txt` file that contains a number of points that can be spawned under the provided point. * `wallet` - Generates an HD wallet for each provided point and saves each wallet in JSON format in the current work directory. Use this especially if you plan to give the points away. Then, in subsequent commands, supply the `--use-wallet-files` option. * `network-keys` - Creates the network keyfile for each supplied point, and either creates a JSON file with the private and public network keys or uses the network keys from the walled files. * `report` - Generates a CSV report for the provided points, containing patp, p, ticket, network keys, addresses, and transactions executed so far. - * `modify` - Modifies the state of one or more points on the Ethereum blockchain (the azimuth contracts). For many of these commands to work, other files will have to have been generated with the `generate` commands. + * `modify-l1` - Modifies the state of one or more points on the Ethereum blockchain (the azimuth contracts). For many of these commands to work, other files will have to have been generated with the `generate` commands. * `spawn` - Spawns multiple points to the supplied address * `management-proxy` - Sets the management proxy address for the points. * `spawn-proxy` - Sets the spawn-proxy address for the points. * `network-key` - Sets the network keys for the points, which is required to be able to boot the Urbit. * `transfer` - Transfers the point to a target address or the wallet files. - + * `modify-l2` - Modifies the state of one or more points via a L2 roller. The roller then submits the changes to the L2 Ethereum contract. Any point modified via this command, needs to be on L2. + * `spawn` - Spawns multiple points to the supplied address. The galaxy or star that spawns needs to be on L2 or the spawn proxy needs to be on L2. + * `management-proxy` - Sets the management proxy address for the points. + * `network-key` - Sets the network keys for the points, which is required to be able to boot the Urbit. + * `transfer` - Transfers the point to a target address or the wallet files. ### Examples -#### Spawn, Set Network Keys, and Transfer to Master Ticket +#### Spawn, Set Network Keys, and Transfer to Master Ticket on Azimuth (L1) This is an example of spawning planets and creating a master ticket for them. You would do this if you want to give some planets away to friends. It is similar to what you can do in Bridge, but we do it for 5 planets in one go. Generating a master ticket itself is not enough, though. Ownership needs to be transferred to the owner address that is associated with the master ticket. But for the master ticket to be usable, networking keys need to be set. Hence, we first spawn to a temporary address (usually the same as the owner or spawn-proxy of the star, here ~sardys), then set the keys, and only then move the planet to its own address--that of the HD wallet. +The star you are spawning from needs to be on L1! + ``` # create a directory for your work mkdir spawn-planets cd spawn-planets # pick 5 random, unspawned planets under ~sardys and save them in a file -azi generate spawn-list ~sardys --count=5 --pick=random +azi generate spawn-list ~sardys --count=5 --pick=random --use-azimuth # now, generate HD wallet files based on the previous list azi generate wallet --points-file=spawn-list.txt @@ -85,15 +101,35 @@ azi generate network-key --use-wallet-files # spawn the 5 planets that can be found in the wallet files, # providing the PK of the wallet that owns ~sardys, or is the spawn proxy -azi modify spawn --use-wallet-files --address=0xSardysOwnershipAddress --private-key=0x1234567890 +azi modify-l1 spawn --use-wallet-files --address=0xSardysOwnershipAddress --private-key=0x1234567890 # set the network keys on the blockchain -azi modify network-key --use-wallet-files --private-key=0x1234567890 +azi modify-l1 network-key --use-wallet-files --private-key=0x1234567890 # transfer each planet ownership to the address of the wallet -azi modify transfer --use-wallet-files --private-key=0x1234567890 +azi modify-l1 transfer --use-wallet-files --private-key=0x1234567890 ``` +#### Spawn, Set Network Keys, and Transfer to Master Ticket on Azimuth (L2) + +This is the same example as above but using a roller to spawn the planets. + +The star you are spawning from needs to be on L2 or have the spawn proxy set to L2! Here is more info about the [Layer 2 solution](https://urbit.org/docs/azimuth/l2/layer2). +``` +azi generate spawn-list ~sampel --count=2 --pick=random --use-roller + +azi generate wallet --points-file=spawn-list.txt + +azi generate network-key --use-wallet-files + +azi modify-l2 spawn --use-wallet-files --address=0xSpawnProxy --private-key=0xSpawnProxyKey + +azi modify-l2 management-proxy --use-wallet-files --address=0xManagementProxy --private-key=0xSpawnProxyKey + +azi modify-l2 network-key --use-wallet-files --private-key=0xSpawnProxyKey + +azi modify-l2 transfer --use-wallet-files --private-key=0xSpawnProxyKey +``` diff --git a/docs/grant.md b/docs/grant.md index 1986d8e..a956714 100644 --- a/docs/grant.md +++ b/docs/grant.md @@ -144,7 +144,7 @@ Deliverables: - (DONE) rename 'list' to 'get' (breaking change) - (DONE) better error when roller is not available and l2 is needed (in modify and get) - (DONE) rename 'modify' to 'modify-l1' -- merge documentation, and update documentation +- (DONE) merge documentation, and update documentation - make sure the default settings files gets reset ### Milestone 4 - Additional Features diff --git a/docs/roller.md b/docs/roller.md index 06dfd12..74beca2 100644 --- a/docs/roller.md +++ b/docs/roller.md @@ -77,31 +77,8 @@ For a more cURL examples, [see here](https://documenter.getpostman.com/view/1633 * Check if there is any Ethereum state pending (it should return 0): `:eth-watcher +dbug [%state '(lent pending-logs:(~(got by dogs) /azimuth))']` * See how many azimuth logs there are: `:azimuth +dbug [%state '(lent logs)']` -## Spawn Planets Using the Azimuth-CLI - -Clone the latest version from from `https://github.com/lukebuehler/azimuth-cli` and switch to the `l2` branch (`git checkout l2`). Follow the development install instructions in the readme. You should be able to type `azi` in the command line and see the azimuth-cli options, including `list-l2` and `modify-l2`. Make sure you are on node version 14.x.x. - -If you don't see the l2 commands, you are not on the right version. Maybe you have the cli already installed globally? Do `npm uninstall -g azimuth-cli` first and then install again. - -Copy one line after the other to the command line. This will just spawn two random planets, you can change the `spawn-list.txt` file however you want. - -``` -azi generate spawn-list ~sampel --count=2 --pick=random --use-roller - -azi generate wallet --points-file=spawn-list.txt - -azi generate network-key --use-wallet-files - -azi modify-l2 spawn --use-wallet-files --address=0xSpawnProxy --private-key=0xSpawnProxyKey - -azi modify-l2 management-proxy --use-wallet-files --address=0xManagementProxy --private-key=0xSpawnProxyKey - -azi modify-l2 network-key --use-wallet-files --private-key=0xSpawnProxyKey - -azi modify-l2 transfer --use-wallet-files --private-key=0xSpawnProxyKey -``` - - +### Using the Local Roller in the CLI +When you use `modify-l1` commands, make sure you include the following option: `--roller-provider=local`. Otherwise, the CLI will use the official Urbit roller. From 424f9c416ec533d63a478dbf21b64a9fd0c252a5 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Mon, 23 May 2022 13:26:53 +0200 Subject: [PATCH 16/17] updated version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 020d9da..f1d6f81 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "azimuth-cli", - "version": "0.1.3", + "version": "1.0.0", "description": "Urbit Bridge for the command line", "main": "index.js", "bin": { From 57a2322ff36d9f5640c1a5792f7c3f4120c0d284 Mon Sep 17 00:00:00 2001 From: lukebuehler Date: Mon, 23 May 2022 13:57:27 +0200 Subject: [PATCH 17/17] fixed tests --- README.md | 2 ++ cmds/modify-l1.js | 2 +- docs/grant.md | 7 +++---- test/test.js | 30 +++++++++++++++--------------- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index d3d6cf5..fff599f 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ Due to an issues when building the azimuth-js package (as described [here](https Simply install the npm package globally: `npm install -g azimuth-cli` +**When Upgrading to the L2 version:** Make sure to delete the `cli-config.json` file in your home directory, usually in a folder called `.azimuth/`. + ### Development or Manual Install 1) Clone this [repo](https://github.com/lukebuehler/azimuth-cli) 1) run `npm install` diff --git a/cmds/modify-l1.js b/cmds/modify-l1.js index b100581..0444a5c 100644 --- a/cmds/modify-l1.js +++ b/cmds/modify-l1.js @@ -80,6 +80,6 @@ exports.builder = function (yargs) { return true }); - return yargs.commandDir('modify_cmds', {exclude:'common'} ) + return yargs.commandDir('modify-l1_cmds', {exclude:'common'} ) } exports.handler = function (argv) {} \ No newline at end of file diff --git a/docs/grant.md b/docs/grant.md index a956714..35a1b39 100644 --- a/docs/grant.md +++ b/docs/grant.md @@ -132,7 +132,6 @@ As soon as the Layer 2 solution is released, the CLI should also support actions Deliverables: -- Move points that are on Azimuth to L2, or move just the spawn proxy of stars. - (DONE) Connect to a Roller instead of an ETH node - (DONE) Spawn points on L2 - (DONE) Set Network Keys on L2 @@ -145,7 +144,6 @@ Deliverables: - (DONE) better error when roller is not available and l2 is needed (in modify and get) - (DONE) rename 'modify' to 'modify-l1' - (DONE) merge documentation, and update documentation -- make sure the default settings files gets reset ### Milestone 4 - Additional Features @@ -157,9 +155,10 @@ Adding a set of features that will make the CLI much more usable and secure Deliverables: +- Move points that are on Azimuth to L2, or move just the spawn proxy of stars. - Hardware Wallet support (signing transactions on the wallet not using the web3 lib) - Retrieving private keys from key-chains, at least MacOS or Linux -- More point list/search functionality +- (DONE) More point list/search functionality - Search for unspawned planets (for example, by English language worlds, like Venetia, or custom strings) -- Query Azimuth (and L2) for ship state: is it spawned, is it keyed, etc. (this is helpful to check if, say, a galaxy is likely to be alive when buying a star). +- (DONE) Query Azimuth (and L2) for ship state: is it spawned, is it keyed, etc. (this is helpful to check if, say, a galaxy is likely to be alive when buying a star). - Utils (p to patp) \ No newline at end of file diff --git a/test/test.js b/test/test.js index b04c041..7935973 100644 --- a/test/test.js +++ b/test/test.js @@ -87,7 +87,7 @@ fs.mkdirSync(testWorkDir, { recursive: true }); console.log('Test work directory is: '+testWorkDir); -const baseArgs = ['--eth-provider=ganache', `--work-dir=${testWorkDir}`]; +const baseArgs = ['--eth-provider=ganache', `--work-dir=${testWorkDir}`, '--use-azimuth']; // accounts const mnemonic = 'benefit crew supreme gesture quantum web media hazard theory mercy wing kitten'; @@ -176,11 +176,11 @@ it('prepare the environment', async function() { // planet1d = planet1d + galaxy; }); -describe('#list', async function() { +describe('#get', async function() { describe('children 0', async function() { it('should list all children of zod', async function() { - let children = await execCliAndGetLines('list', 'children', '0', ...baseArgs); + let children = await execCliAndGetLines('get', 'children', '0', ...baseArgs); children.shift();//starts with a header string expect(children).to.have.lengthOf(255); }); @@ -188,7 +188,7 @@ describe('#list', async function() { describe('children 0 --spawned', async function() { it('should list all spawned children of zod', async function() { - let children = await execCliAndGetLines('list', 'children', '0', '--spawned', ...baseArgs); + let children = await execCliAndGetLines('get', 'children', '0', '--spawned', ...baseArgs); children.shift();//starts with a header string expect(children).to.have.lengthOf(0); }); @@ -196,7 +196,7 @@ describe('#list', async function() { describe('children 0 --unspawned', async function() { it('should list all unspawned children of zod', async function() { - let children = await execCliAndGetLines('list', 'children', '0', '--unspawned', ...baseArgs); + let children = await execCliAndGetLines('get', 'children', '0', '--unspawned', ...baseArgs); children.shift();//starts with a header string expect(children).to.have.lengthOf(255); expect(children).to.have.lengthOf.at.most(255); @@ -205,7 +205,7 @@ describe('#list', async function() { describe('owner zodAddr', async function() { it('should list owner of two galaxies', async function() { - let children = await execCliAndGetLines('list', 'owner', ac0, ...baseArgs); + let children = await execCliAndGetLines('get', 'owner', ac0, ...baseArgs); children.shift();//starts with a header string expect(children).to.have.lengthOf(2); }); @@ -213,7 +213,7 @@ describe('#list', async function() { describe('details zod', async function() { it('should list details about zod', async function() { - let output = await execCliAndGetLines('list', 'details', galaxy, ...baseArgs); + let output = await execCliAndGetLines('get', 'details', galaxy, ...baseArgs); expect(output).to.have.lengthOf.at.least(10); }); }); @@ -258,23 +258,23 @@ describe('#generate', async function() { }); -describe('#modify', async function() { +describe('#modify-l1', async function() { this.timeout(10000); describe('network-key --points=zod', async function() { it('should set the network keys for zod', async function() { //this also allows us to use zod to spawn further points, only booted points can spawn - let lines = await execCliAndGetLines('modify', 'network-key', `--points=${galaxy}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc0); + let lines = await execCliAndGetLines('modify-l1', 'network-key', `--points=${galaxy}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc0); assert.isTrue(files.fileExists(testWorkDir, 'zod-receipt-networkkey.json')); }); }); describe('spawn --points=marzod', async function() { it('should spawn the first star under zod', async function() { - let lines = await execCliAndGetLines('modify', 'spawn', `--points=${star1}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc0); + let lines = await execCliAndGetLines('modify-l1', 'spawn', `--points=${star1}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc0); assert.isTrue(files.fileExists(testWorkDir, 'marzod-receipt-spawn.json')); - let children = await execCliAndGetLines('list', 'children', 'zod', '--spawned', ...baseArgs); + let children = await execCliAndGetLines('get', 'children', 'zod', '--spawned', ...baseArgs); children.shift();//starts with a header string expect(children).to.have.lengthOf.at.least(1); }); @@ -282,25 +282,25 @@ describe('#modify', async function() { describe('management-proxy --points=marzod', async function() { it('should set the management proxy of marzod', async function() { - let lines = await execCliAndGetLines('modify', 'management-proxy', `--points=${star1}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc1); + let lines = await execCliAndGetLines('modify-l1', 'management-proxy', `--points=${star1}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc1); assert.isTrue(files.fileExists(testWorkDir, 'marzod-receipt-managementproxy.json')); }); }); describe('spawn-proxy --points=marzod', async function() { it('should set the spawn proxy of marzod', async function() { - let lines = await execCliAndGetLines('modify', 'spawn-proxy', `--points=${star1}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc1); + let lines = await execCliAndGetLines('modify-l1', 'spawn-proxy', `--points=${star1}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc1); assert.isTrue(files.fileExists(testWorkDir, 'marzod-receipt-spawnproxy.json')); }); }); describe('transfer --points=marzod', async function() { it('should transfer marzod to acc2', async function() { - let lines = await execCliAndGetLines('modify', 'transfer', `--points=${star1}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc2); + let lines = await execCliAndGetLines('modify-l1', 'transfer', `--points=${star1}`, ...baseArgs, ...modifyBaseArgsFromAc0ToAc2); assert.isTrue(files.fileExists(testWorkDir, 'marzod-receipt-transfer.json')); //ac2 should have one child now - let children = await execCliAndGetLines('list', 'owner', ac2, ...baseArgs); + let children = await execCliAndGetLines('get', 'owner', ac2, ...baseArgs); children.shift();//starts with a header string expect(children).to.have.lengthOf(1); });