diff --git a/.pnp.cjs b/.pnp.cjs index b4b0556d510..21b097cd040 100755 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -3092,6 +3092,38 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["@eslint-community/eslint-utils", [\ + ["npm:4.2.0", {\ + "packageLocation": "./.yarn/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-82fdd1cc2a.zip/node_modules/@eslint-community/eslint-utils/",\ + "packageDependencies": [\ + ["@eslint-community/eslint-utils", "npm:4.2.0"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:67e332304c8830574d5d9be2a388885a47a9962cf1d2441a6ada47207b10c98d9a1a1914d73816338b986563032864745d812b3a7df145ee8f3bb51baa4027e5#npm:4.2.0", {\ + "packageLocation": "./.yarn/__virtual__/@eslint-community-eslint-utils-virtual-2b1bb414c3/0/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-82fdd1cc2a.zip/node_modules/@eslint-community/eslint-utils/",\ + "packageDependencies": [\ + ["@eslint-community/eslint-utils", "virtual:67e332304c8830574d5d9be2a388885a47a9962cf1d2441a6ada47207b10c98d9a1a1914d73816338b986563032864745d812b3a7df145ee8f3bb51baa4027e5#npm:4.2.0"],\ + ["@types/eslint", null],\ + ["eslint", "npm:7.32.0"],\ + ["eslint-visitor-keys", "npm:3.3.0"]\ + ],\ + "packagePeers": [\ + "@types/eslint",\ + "eslint"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["@eslint-community/regexpp", [\ + ["npm:4.4.0", {\ + "packageLocation": "./.yarn/cache/@eslint-community-regexpp-npm-4.4.0-6bee7b2314-2d127af0c7.zip/node_modules/@eslint-community/regexpp/",\ + "packageDependencies": [\ + ["@eslint-community/regexpp", "npm:4.4.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["@eslint/eslintrc", [\ ["npm:0.4.3", {\ "packageLocation": "./.yarn/cache/@eslint-eslintrc-npm-0.4.3-ee1bbcab87-03a7704150.zip/node_modules/@eslint/eslintrc/",\ @@ -4231,6 +4263,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["@types/json-schema", [\ + ["npm:7.0.11", {\ + "packageLocation": "./.yarn/cache/@types-json-schema-npm-7.0.11-79462ae5ca-527bddfe62.zip/node_modules/@types/json-schema/",\ + "packageDependencies": [\ + ["@types/json-schema", "npm:7.0.11"]\ + ],\ + "linkType": "HARD"\ + }],\ ["npm:7.0.9", {\ "packageLocation": "./.yarn/cache/@types-json-schema-npm-7.0.9-361918cff3-259d0e25f1.zip/node_modules/@types/json-schema/",\ "packageDependencies": [\ @@ -4418,6 +4457,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["@types/semver", [\ + ["npm:7.3.13", {\ + "packageLocation": "./.yarn/cache/@types-semver-npm-7.3.13-56212b60da-00c0724d54.zip/node_modules/@types/semver/",\ + "packageDependencies": [\ + ["@types/semver", "npm:7.3.13"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["@types/sinon", [\ ["npm:10.0.6", {\ "packageLocation": "./.yarn/cache/@types-sinon-npm-10.0.6-3a1b027ac2-1c2ae7daa8.zip/node_modules/@types/sinon/",\ @@ -4505,6 +4553,216 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["@typescript-eslint/eslint-plugin", [\ + ["npm:5.55.0", {\ + "packageLocation": "./.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.55.0-16386bf9af-e3239ec601.zip/node_modules/@typescript-eslint/eslint-plugin/",\ + "packageDependencies": [\ + ["@typescript-eslint/eslint-plugin", "npm:5.55.0"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0", {\ + "packageLocation": "./.yarn/__virtual__/@typescript-eslint-eslint-plugin-virtual-0e22d802b6/0/cache/@typescript-eslint-eslint-plugin-npm-5.55.0-16386bf9af-e3239ec601.zip/node_modules/@typescript-eslint/eslint-plugin/",\ + "packageDependencies": [\ + ["@typescript-eslint/eslint-plugin", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0"],\ + ["@eslint-community/regexpp", "npm:4.4.0"],\ + ["@types/eslint", null],\ + ["@types/typescript", null],\ + ["@types/typescript-eslint__parser", null],\ + ["@typescript-eslint/parser", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0"],\ + ["@typescript-eslint/scope-manager", "npm:5.55.0"],\ + ["@typescript-eslint/type-utils", "virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:5.55.0"],\ + ["@typescript-eslint/utils", "virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:5.55.0"],\ + ["debug", "virtual:c2bff3e67180802999655a22d390062982690e911b9d9225c258f3b25e7409f3867b2682c16232b77415f560a09d05a95042dc512a5b8c566c42bbbed88b0bbc#npm:4.3.4"],\ + ["eslint", "npm:7.32.0"],\ + ["grapheme-splitter", "npm:1.0.4"],\ + ["ignore", "npm:5.2.0"],\ + ["natural-compare-lite", "npm:1.4.0"],\ + ["semver", "npm:7.3.8"],\ + ["tsutils", "virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:3.21.0"],\ + ["typescript", "patch:typescript@npm%3A3.9.10#~builtin::version=3.9.10&hash=3bd3d3"]\ + ],\ + "packagePeers": [\ + "@types/eslint",\ + "@types/typescript-eslint__parser",\ + "@types/typescript",\ + "@typescript-eslint/parser",\ + "eslint",\ + "typescript"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["@typescript-eslint/parser", [\ + ["npm:5.55.0", {\ + "packageLocation": "./.yarn/cache/@typescript-eslint-parser-npm-5.55.0-ee38253ad6-48a20dc7e6.zip/node_modules/@typescript-eslint/parser/",\ + "packageDependencies": [\ + ["@typescript-eslint/parser", "npm:5.55.0"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0", {\ + "packageLocation": "./.yarn/__virtual__/@typescript-eslint-parser-virtual-2089cd6370/0/cache/@typescript-eslint-parser-npm-5.55.0-ee38253ad6-48a20dc7e6.zip/node_modules/@typescript-eslint/parser/",\ + "packageDependencies": [\ + ["@typescript-eslint/parser", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0"],\ + ["@types/eslint", null],\ + ["@types/typescript", null],\ + ["@typescript-eslint/scope-manager", "npm:5.55.0"],\ + ["@typescript-eslint/types", "npm:5.55.0"],\ + ["@typescript-eslint/typescript-estree", "virtual:0c2ac79ebf72f4493d7516f3ee57421c8337be2bdf9498590055ee112e7fdf62dd0b817c13f6c8a030baf64dbe843920deec4c3c8ea8bd6888b7baf950492c3a#npm:5.55.0"],\ + ["debug", "virtual:c2bff3e67180802999655a22d390062982690e911b9d9225c258f3b25e7409f3867b2682c16232b77415f560a09d05a95042dc512a5b8c566c42bbbed88b0bbc#npm:4.3.4"],\ + ["eslint", "npm:7.32.0"],\ + ["typescript", "patch:typescript@npm%3A3.9.10#~builtin::version=3.9.10&hash=3bd3d3"]\ + ],\ + "packagePeers": [\ + "@types/eslint",\ + "@types/typescript",\ + "eslint",\ + "typescript"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["@typescript-eslint/scope-manager", [\ + ["npm:5.55.0", {\ + "packageLocation": "./.yarn/cache/@typescript-eslint-scope-manager-npm-5.55.0-d7744f8a94-f253db88f6.zip/node_modules/@typescript-eslint/scope-manager/",\ + "packageDependencies": [\ + ["@typescript-eslint/scope-manager", "npm:5.55.0"],\ + ["@typescript-eslint/types", "npm:5.55.0"],\ + ["@typescript-eslint/visitor-keys", "npm:5.55.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["@typescript-eslint/type-utils", [\ + ["npm:5.55.0", {\ + "packageLocation": "./.yarn/cache/@typescript-eslint-type-utils-npm-5.55.0-333e5c4b16-5c60d44135.zip/node_modules/@typescript-eslint/type-utils/",\ + "packageDependencies": [\ + ["@typescript-eslint/type-utils", "npm:5.55.0"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:5.55.0", {\ + "packageLocation": "./.yarn/__virtual__/@typescript-eslint-type-utils-virtual-0c2ac79ebf/0/cache/@typescript-eslint-type-utils-npm-5.55.0-333e5c4b16-5c60d44135.zip/node_modules/@typescript-eslint/type-utils/",\ + "packageDependencies": [\ + ["@typescript-eslint/type-utils", "virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:5.55.0"],\ + ["@types/eslint", null],\ + ["@types/typescript", null],\ + ["@typescript-eslint/typescript-estree", "virtual:0c2ac79ebf72f4493d7516f3ee57421c8337be2bdf9498590055ee112e7fdf62dd0b817c13f6c8a030baf64dbe843920deec4c3c8ea8bd6888b7baf950492c3a#npm:5.55.0"],\ + ["@typescript-eslint/utils", "virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:5.55.0"],\ + ["debug", "virtual:c2bff3e67180802999655a22d390062982690e911b9d9225c258f3b25e7409f3867b2682c16232b77415f560a09d05a95042dc512a5b8c566c42bbbed88b0bbc#npm:4.3.4"],\ + ["eslint", "npm:7.32.0"],\ + ["tsutils", "virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:3.21.0"],\ + ["typescript", "patch:typescript@npm%3A3.9.10#~builtin::version=3.9.10&hash=3bd3d3"]\ + ],\ + "packagePeers": [\ + "@types/eslint",\ + "@types/typescript",\ + "eslint",\ + "typescript"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["@typescript-eslint/types", [\ + ["npm:5.55.0", {\ + "packageLocation": "./.yarn/cache/@typescript-eslint-types-npm-5.55.0-694e3d296a-7d851f09a2.zip/node_modules/@typescript-eslint/types/",\ + "packageDependencies": [\ + ["@typescript-eslint/types", "npm:5.55.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["@typescript-eslint/typescript-estree", [\ + ["npm:5.55.0", {\ + "packageLocation": "./.yarn/cache/@typescript-eslint-typescript-estree-npm-5.55.0-aefc08af17-d24a11aee3.zip/node_modules/@typescript-eslint/typescript-estree/",\ + "packageDependencies": [\ + ["@typescript-eslint/typescript-estree", "npm:5.55.0"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:0c2ac79ebf72f4493d7516f3ee57421c8337be2bdf9498590055ee112e7fdf62dd0b817c13f6c8a030baf64dbe843920deec4c3c8ea8bd6888b7baf950492c3a#npm:5.55.0", {\ + "packageLocation": "./.yarn/__virtual__/@typescript-eslint-typescript-estree-virtual-891ed1ca66/0/cache/@typescript-eslint-typescript-estree-npm-5.55.0-aefc08af17-d24a11aee3.zip/node_modules/@typescript-eslint/typescript-estree/",\ + "packageDependencies": [\ + ["@typescript-eslint/typescript-estree", "virtual:0c2ac79ebf72f4493d7516f3ee57421c8337be2bdf9498590055ee112e7fdf62dd0b817c13f6c8a030baf64dbe843920deec4c3c8ea8bd6888b7baf950492c3a#npm:5.55.0"],\ + ["@types/typescript", null],\ + ["@typescript-eslint/types", "npm:5.55.0"],\ + ["@typescript-eslint/visitor-keys", "npm:5.55.0"],\ + ["debug", "virtual:c2bff3e67180802999655a22d390062982690e911b9d9225c258f3b25e7409f3867b2682c16232b77415f560a09d05a95042dc512a5b8c566c42bbbed88b0bbc#npm:4.3.4"],\ + ["globby", "npm:11.1.0"],\ + ["is-glob", "npm:4.0.3"],\ + ["semver", "npm:7.3.8"],\ + ["tsutils", "virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:3.21.0"],\ + ["typescript", "patch:typescript@npm%3A3.9.10#~builtin::version=3.9.10&hash=3bd3d3"]\ + ],\ + "packagePeers": [\ + "@types/typescript",\ + "typescript"\ + ],\ + "linkType": "HARD"\ + }],\ + ["virtual:67e332304c8830574d5d9be2a388885a47a9962cf1d2441a6ada47207b10c98d9a1a1914d73816338b986563032864745d812b3a7df145ee8f3bb51baa4027e5#npm:5.55.0", {\ + "packageLocation": "./.yarn/__virtual__/@typescript-eslint-typescript-estree-virtual-ad07d3460a/0/cache/@typescript-eslint-typescript-estree-npm-5.55.0-aefc08af17-d24a11aee3.zip/node_modules/@typescript-eslint/typescript-estree/",\ + "packageDependencies": [\ + ["@typescript-eslint/typescript-estree", "virtual:67e332304c8830574d5d9be2a388885a47a9962cf1d2441a6ada47207b10c98d9a1a1914d73816338b986563032864745d812b3a7df145ee8f3bb51baa4027e5#npm:5.55.0"],\ + ["@types/typescript", null],\ + ["@typescript-eslint/types", "npm:5.55.0"],\ + ["@typescript-eslint/visitor-keys", "npm:5.55.0"],\ + ["debug", "virtual:c2bff3e67180802999655a22d390062982690e911b9d9225c258f3b25e7409f3867b2682c16232b77415f560a09d05a95042dc512a5b8c566c42bbbed88b0bbc#npm:4.3.4"],\ + ["globby", "npm:11.1.0"],\ + ["is-glob", "npm:4.0.3"],\ + ["semver", "npm:7.3.8"],\ + ["tsutils", "virtual:ad07d3460ae416a99f304e6734121d5396603792c47f7c9a1b9c5c798d407da37779ac7289222241db922614d91f9d569b0f43bc10c027fcc720138b2f32e9fc#npm:3.21.0"],\ + ["typescript", null]\ + ],\ + "packagePeers": [\ + "@types/typescript",\ + "typescript"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["@typescript-eslint/utils", [\ + ["npm:5.55.0", {\ + "packageLocation": "./.yarn/cache/@typescript-eslint-utils-npm-5.55.0-6a927fceb5-368cfc3fb9.zip/node_modules/@typescript-eslint/utils/",\ + "packageDependencies": [\ + ["@typescript-eslint/utils", "npm:5.55.0"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:5.55.0", {\ + "packageLocation": "./.yarn/__virtual__/@typescript-eslint-utils-virtual-67e332304c/0/cache/@typescript-eslint-utils-npm-5.55.0-6a927fceb5-368cfc3fb9.zip/node_modules/@typescript-eslint/utils/",\ + "packageDependencies": [\ + ["@typescript-eslint/utils", "virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:5.55.0"],\ + ["@eslint-community/eslint-utils", "virtual:67e332304c8830574d5d9be2a388885a47a9962cf1d2441a6ada47207b10c98d9a1a1914d73816338b986563032864745d812b3a7df145ee8f3bb51baa4027e5#npm:4.2.0"],\ + ["@types/eslint", null],\ + ["@types/json-schema", "npm:7.0.11"],\ + ["@types/semver", "npm:7.3.13"],\ + ["@typescript-eslint/scope-manager", "npm:5.55.0"],\ + ["@typescript-eslint/types", "npm:5.55.0"],\ + ["@typescript-eslint/typescript-estree", "virtual:67e332304c8830574d5d9be2a388885a47a9962cf1d2441a6ada47207b10c98d9a1a1914d73816338b986563032864745d812b3a7df145ee8f3bb51baa4027e5#npm:5.55.0"],\ + ["eslint", "npm:7.32.0"],\ + ["eslint-scope", "npm:5.1.1"],\ + ["semver", "npm:7.3.8"]\ + ],\ + "packagePeers": [\ + "@types/eslint",\ + "eslint"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["@typescript-eslint/visitor-keys", [\ + ["npm:5.55.0", {\ + "packageLocation": "./.yarn/cache/@typescript-eslint-visitor-keys-npm-5.55.0-7f3c07beeb-0b24c72dff.zip/node_modules/@typescript-eslint/visitor-keys/",\ + "packageDependencies": [\ + ["@typescript-eslint/visitor-keys", "npm:5.55.0"],\ + ["@typescript-eslint/types", "npm:5.55.0"],\ + ["eslint-visitor-keys", "npm:3.3.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["@ungap/promise-all-settled", [\ ["npm:1.1.2", {\ "packageLocation": "./.yarn/cache/@ungap-promise-all-settled-npm-1.1.2-c0f42e147b-08d37fdfa2.zip/node_modules/@ungap/promise-all-settled/",\ @@ -5472,6 +5730,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["array-buffer-byte-length", [\ + ["npm:1.0.0", {\ + "packageLocation": "./.yarn/cache/array-buffer-byte-length-npm-1.0.0-331671f28a-044e101ce1.zip/node_modules/array-buffer-byte-length/",\ + "packageDependencies": [\ + ["array-buffer-byte-length", "npm:1.0.0"],\ + ["call-bind", "npm:1.0.2"],\ + ["is-array-buffer", "npm:3.0.2"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["array-differ", [\ ["npm:3.0.0", {\ "packageLocation": "./.yarn/cache/array-differ-npm-3.0.0-ddc0d89007-117edd9df5.zip/node_modules/array-differ/",\ @@ -7647,6 +7916,8 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["@types/node", "npm:14.17.34"],\ ["@types/sinon", "npm:9.0.11"],\ ["@types/sinon-chai", "npm:3.2.5"],\ + ["@typescript-eslint/eslint-plugin", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0"],\ + ["@typescript-eslint/parser", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0"],\ ["assert", "npm:2.0.0"],\ ["browserify-zlib", "npm:0.2.0"],\ ["bs58", "npm:4.0.1"],\ @@ -7656,6 +7927,10 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["crypto-browserify", "npm:3.12.0"],\ ["dirty-chai", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:2.0.1"],\ ["dotenv-safe", "npm:8.2.0"],\ + ["eslint", "npm:7.32.0"],\ + ["eslint-config-airbnb-base", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:14.2.1"],\ + ["eslint-config-airbnb-typescript", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:17.0.0"],\ + ["eslint-plugin-import", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:2.25.3"],\ ["events", "npm:3.3.0"],\ ["https-browserify", "npm:1.0.0"],\ ["karma", "npm:6.4.1"],\ @@ -8049,6 +8324,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["object-keys", "npm:1.1.1"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.2.0", {\ + "packageLocation": "./.yarn/cache/define-properties-npm-1.2.0-3547cd0fd2-e60aee6a19.zip/node_modules/define-properties/",\ + "packageDependencies": [\ + ["define-properties", "npm:1.2.0"],\ + ["has-property-descriptors", "npm:1.0.0"],\ + ["object-keys", "npm:1.1.1"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["delay", [\ @@ -8616,6 +8900,47 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["unbox-primitive", "npm:1.0.1"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.21.2", {\ + "packageLocation": "./.yarn/cache/es-abstract-npm-1.21.2-f4ebace1ab-037f55ee5e.zip/node_modules/es-abstract/",\ + "packageDependencies": [\ + ["es-abstract", "npm:1.21.2"],\ + ["array-buffer-byte-length", "npm:1.0.0"],\ + ["available-typed-arrays", "npm:1.0.5"],\ + ["call-bind", "npm:1.0.2"],\ + ["es-set-tostringtag", "npm:2.0.1"],\ + ["es-to-primitive", "npm:1.2.1"],\ + ["function.prototype.name", "npm:1.1.5"],\ + ["get-intrinsic", "npm:1.2.0"],\ + ["get-symbol-description", "npm:1.0.0"],\ + ["globalthis", "npm:1.0.3"],\ + ["gopd", "npm:1.0.1"],\ + ["has", "npm:1.0.3"],\ + ["has-property-descriptors", "npm:1.0.0"],\ + ["has-proto", "npm:1.0.1"],\ + ["has-symbols", "npm:1.0.3"],\ + ["internal-slot", "npm:1.0.5"],\ + ["is-array-buffer", "npm:3.0.2"],\ + ["is-callable", "npm:1.2.7"],\ + ["is-negative-zero", "npm:2.0.2"],\ + ["is-regex", "npm:1.1.4"],\ + ["is-shared-array-buffer", "npm:1.0.2"],\ + ["is-string", "npm:1.0.7"],\ + ["is-typed-array", "npm:1.1.10"],\ + ["is-weakref", "npm:1.0.2"],\ + ["object-inspect", "npm:1.12.3"],\ + ["object-keys", "npm:1.1.1"],\ + ["object.assign", "npm:4.1.4"],\ + ["regexp.prototype.flags", "npm:1.4.3"],\ + ["safe-regex-test", "npm:1.0.0"],\ + ["string.prototype.trim", "npm:1.2.7"],\ + ["string.prototype.trimend", "npm:1.0.6"],\ + ["string.prototype.trimstart", "npm:1.0.6"],\ + ["typed-array-length", "npm:1.0.4"],\ + ["unbox-primitive", "npm:1.0.2"],\ + ["which-typed-array", "npm:1.1.9"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["es-module-lexer", [\ @@ -8627,6 +8952,18 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["es-set-tostringtag", [\ + ["npm:2.0.1", {\ + "packageLocation": "./.yarn/cache/es-set-tostringtag-npm-2.0.1-c87b5de872-ec416a1294.zip/node_modules/es-set-tostringtag/",\ + "packageDependencies": [\ + ["es-set-tostringtag", "npm:2.0.1"],\ + ["get-intrinsic", "npm:1.2.0"],\ + ["has", "npm:1.0.3"],\ + ["has-tostringtag", "npm:1.0.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["es-to-primitive", [\ ["npm:1.2.1", {\ "packageLocation": "./.yarn/cache/es-to-primitive-npm-1.2.1-b7a7eac6c5-4ead6671a2.zip/node_modules/es-to-primitive/",\ @@ -8797,6 +9134,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ],\ "linkType": "SOFT"\ }],\ + ["npm:15.0.0", {\ + "packageLocation": "./.yarn/cache/eslint-config-airbnb-base-npm-15.0.0-802837dd26-38626bad2c.zip/node_modules/eslint-config-airbnb-base/",\ + "packageDependencies": [\ + ["eslint-config-airbnb-base", "npm:15.0.0"]\ + ],\ + "linkType": "SOFT"\ + }],\ ["virtual:12a596dc9572e25ce715d3736dc74b317c5ca5cfb3b4f67864b1e76b3a401006f84d381aaf975bb5b4da9cafac5125e6869fc78d5202f4c95780c81479112f32#npm:14.2.1", {\ "packageLocation": "./.yarn/__virtual__/eslint-config-airbnb-base-virtual-13e91749d9/0/cache/eslint-config-airbnb-base-npm-14.2.1-50131c00fb-858bea748a.zip/node_modules/eslint-config-airbnb-base/",\ "packageDependencies": [\ @@ -8816,6 +9160,82 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "eslint"\ ],\ "linkType": "HARD"\ + }],\ + ["virtual:6af0d12a158a5376029b6f93868ad76c8cef559d686712b5fdba042f7ad0c5dda2a26841fa0c3de4742b982bbf3adffd70106d2304236284de339051257ae8c1#npm:15.0.0", {\ + "packageLocation": "./.yarn/__virtual__/eslint-config-airbnb-base-virtual-f7322ec32f/0/cache/eslint-config-airbnb-base-npm-15.0.0-802837dd26-38626bad2c.zip/node_modules/eslint-config-airbnb-base/",\ + "packageDependencies": [\ + ["eslint-config-airbnb-base", "virtual:6af0d12a158a5376029b6f93868ad76c8cef559d686712b5fdba042f7ad0c5dda2a26841fa0c3de4742b982bbf3adffd70106d2304236284de339051257ae8c1#npm:15.0.0"],\ + ["@types/eslint", null],\ + ["@types/eslint-plugin-import", null],\ + ["confusing-browser-globals", "npm:1.0.10"],\ + ["eslint", "npm:7.32.0"],\ + ["eslint-plugin-import", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:2.25.3"],\ + ["object.assign", "npm:4.1.2"],\ + ["object.entries", "npm:1.1.6"],\ + ["semver", "npm:6.3.0"]\ + ],\ + "packagePeers": [\ + "@types/eslint-plugin-import",\ + "@types/eslint",\ + "eslint-plugin-import",\ + "eslint"\ + ],\ + "linkType": "HARD"\ + }],\ + ["virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:14.2.1", {\ + "packageLocation": "./.yarn/__virtual__/eslint-config-airbnb-base-virtual-768b93baf9/0/cache/eslint-config-airbnb-base-npm-14.2.1-50131c00fb-858bea748a.zip/node_modules/eslint-config-airbnb-base/",\ + "packageDependencies": [\ + ["eslint-config-airbnb-base", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:14.2.1"],\ + ["@types/eslint", null],\ + ["@types/eslint-plugin-import", null],\ + ["confusing-browser-globals", "npm:1.0.10"],\ + ["eslint", "npm:7.32.0"],\ + ["eslint-plugin-import", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:2.25.3"],\ + ["object.assign", "npm:4.1.2"],\ + ["object.entries", "npm:1.1.5"]\ + ],\ + "packagePeers": [\ + "@types/eslint-plugin-import",\ + "@types/eslint",\ + "eslint-plugin-import",\ + "eslint"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["eslint-config-airbnb-typescript", [\ + ["npm:17.0.0", {\ + "packageLocation": "./.yarn/cache/eslint-config-airbnb-typescript-npm-17.0.0-e1f8a377d2-e598ae7bcc.zip/node_modules/eslint-config-airbnb-typescript/",\ + "packageDependencies": [\ + ["eslint-config-airbnb-typescript", "npm:17.0.0"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:17.0.0", {\ + "packageLocation": "./.yarn/__virtual__/eslint-config-airbnb-typescript-virtual-6af0d12a15/0/cache/eslint-config-airbnb-typescript-npm-17.0.0-e1f8a377d2-e598ae7bcc.zip/node_modules/eslint-config-airbnb-typescript/",\ + "packageDependencies": [\ + ["eslint-config-airbnb-typescript", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:17.0.0"],\ + ["@types/eslint", null],\ + ["@types/eslint-plugin-import", null],\ + ["@types/typescript-eslint__eslint-plugin", null],\ + ["@types/typescript-eslint__parser", null],\ + ["@typescript-eslint/eslint-plugin", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0"],\ + ["@typescript-eslint/parser", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0"],\ + ["eslint", "npm:7.32.0"],\ + ["eslint-config-airbnb-base", "virtual:6af0d12a158a5376029b6f93868ad76c8cef559d686712b5fdba042f7ad0c5dda2a26841fa0c3de4742b982bbf3adffd70106d2304236284de339051257ae8c1#npm:15.0.0"],\ + ["eslint-plugin-import", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:2.25.3"]\ + ],\ + "packagePeers": [\ + "@types/eslint-plugin-import",\ + "@types/eslint",\ + "@types/typescript-eslint__eslint-plugin",\ + "@types/typescript-eslint__parser",\ + "@typescript-eslint/eslint-plugin",\ + "@typescript-eslint/parser",\ + "eslint-plugin-import",\ + "eslint"\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["eslint-import-resolver-node", [\ @@ -8827,25 +9247,53 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["resolve", "patch:resolve@npm%3A1.22.0#~builtin::version=1.22.0&hash=c3c19d"]\ ],\ "linkType": "HARD"\ - }]\ - ]],\ - ["eslint-module-utils", [\ - ["npm:2.7.1", {\ - "packageLocation": "./.yarn/cache/eslint-module-utils-npm-2.7.1-2b7798b493-c30dfa125a.zip/node_modules/eslint-module-utils/",\ - "packageDependencies": [\ - ["eslint-module-utils", "npm:2.7.1"]\ - ],\ - "linkType": "SOFT"\ + }]\ + ]],\ + ["eslint-module-utils", [\ + ["npm:2.7.1", {\ + "packageLocation": "./.yarn/cache/eslint-module-utils-npm-2.7.1-2b7798b493-c30dfa125a.zip/node_modules/eslint-module-utils/",\ + "packageDependencies": [\ + ["eslint-module-utils", "npm:2.7.1"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:0684f4c444aee59cc66233fcce3e4e9a25ed7e35886aed11393a5d4d03c3e7ec6f43fe70e91d783fa0717aa30724ce3a9a32ae0cd75006d103d8f81d5b9758c1#npm:2.7.1", {\ + "packageLocation": "./.yarn/__virtual__/eslint-module-utils-virtual-21cd1c1e4f/0/cache/eslint-module-utils-npm-2.7.1-2b7798b493-c30dfa125a.zip/node_modules/eslint-module-utils/",\ + "packageDependencies": [\ + ["eslint-module-utils", "virtual:0684f4c444aee59cc66233fcce3e4e9a25ed7e35886aed11393a5d4d03c3e7ec6f43fe70e91d783fa0717aa30724ce3a9a32ae0cd75006d103d8f81d5b9758c1#npm:2.7.1"],\ + ["@types/eslint-import-resolver-node", null],\ + ["@types/eslint-import-resolver-typescript", null],\ + ["@types/eslint-import-resolver-webpack", null],\ + ["@types/typescript-eslint__parser", null],\ + ["@typescript-eslint/parser", null],\ + ["debug", "virtual:d9426786c635bc4b52511d6cc4b56156f50d780a698c0e20fc6caf10d3be51cbf176e79cff882f4d42a23ff4d0f89fe94222849578214e7fbae0f2754c82af02#npm:3.2.7"],\ + ["eslint-import-resolver-node", "npm:0.3.6"],\ + ["eslint-import-resolver-typescript", null],\ + ["eslint-import-resolver-webpack", null],\ + ["find-up", "npm:2.1.0"],\ + ["pkg-dir", "npm:2.0.0"]\ + ],\ + "packagePeers": [\ + "@types/eslint-import-resolver-node",\ + "@types/eslint-import-resolver-typescript",\ + "@types/eslint-import-resolver-webpack",\ + "@types/typescript-eslint__parser",\ + "@typescript-eslint/parser",\ + "eslint-import-resolver-node",\ + "eslint-import-resolver-typescript",\ + "eslint-import-resolver-webpack"\ + ],\ + "linkType": "HARD"\ }],\ - ["virtual:0684f4c444aee59cc66233fcce3e4e9a25ed7e35886aed11393a5d4d03c3e7ec6f43fe70e91d783fa0717aa30724ce3a9a32ae0cd75006d103d8f81d5b9758c1#npm:2.7.1", {\ - "packageLocation": "./.yarn/__virtual__/eslint-module-utils-virtual-21cd1c1e4f/0/cache/eslint-module-utils-npm-2.7.1-2b7798b493-c30dfa125a.zip/node_modules/eslint-module-utils/",\ + ["virtual:c35e0ef15e09d951132a1d1de0f686a9b852da3009392a39bfdef5e548591355b594808c6c5c6c2baa4339946ff8c9883343770439fdd88cdf8d08a9cc9843db#npm:2.7.1", {\ + "packageLocation": "./.yarn/__virtual__/eslint-module-utils-virtual-0844582a1f/0/cache/eslint-module-utils-npm-2.7.1-2b7798b493-c30dfa125a.zip/node_modules/eslint-module-utils/",\ "packageDependencies": [\ - ["eslint-module-utils", "virtual:0684f4c444aee59cc66233fcce3e4e9a25ed7e35886aed11393a5d4d03c3e7ec6f43fe70e91d783fa0717aa30724ce3a9a32ae0cd75006d103d8f81d5b9758c1#npm:2.7.1"],\ + ["eslint-module-utils", "virtual:c35e0ef15e09d951132a1d1de0f686a9b852da3009392a39bfdef5e548591355b594808c6c5c6c2baa4339946ff8c9883343770439fdd88cdf8d08a9cc9843db#npm:2.7.1"],\ ["@types/eslint-import-resolver-node", null],\ ["@types/eslint-import-resolver-typescript", null],\ ["@types/eslint-import-resolver-webpack", null],\ ["@types/typescript-eslint__parser", null],\ - ["@typescript-eslint/parser", null],\ + ["@typescript-eslint/parser", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0"],\ ["debug", "virtual:d9426786c635bc4b52511d6cc4b56156f50d780a698c0e20fc6caf10d3be51cbf176e79cff882f4d42a23ff4d0f89fe94222849578214e7fbae0f2754c82af02#npm:3.2.7"],\ ["eslint-import-resolver-node", "npm:0.3.6"],\ ["eslint-import-resolver-typescript", null],\ @@ -8903,6 +9351,36 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "eslint"\ ],\ "linkType": "HARD"\ + }],\ + ["virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:2.25.3", {\ + "packageLocation": "./.yarn/__virtual__/eslint-plugin-import-virtual-c35e0ef15e/0/cache/eslint-plugin-import-npm-2.25.3-f5faefaae3-8bdf4b1faf.zip/node_modules/eslint-plugin-import/",\ + "packageDependencies": [\ + ["eslint-plugin-import", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:2.25.3"],\ + ["@types/eslint", null],\ + ["@types/typescript-eslint__parser", null],\ + ["@typescript-eslint/parser", "virtual:ad53cff31b1dbd4927a99e71702e3b8b10338636eaff010987c27c9ccea2d52af36900a9e36a4231cbb6e5464248ccc9c1da5d1d24d9b0f4f95660296b1060a6#npm:5.55.0"],\ + ["array-includes", "npm:3.1.4"],\ + ["array.prototype.flat", "npm:1.2.5"],\ + ["debug", "virtual:0684f4c444aee59cc66233fcce3e4e9a25ed7e35886aed11393a5d4d03c3e7ec6f43fe70e91d783fa0717aa30724ce3a9a32ae0cd75006d103d8f81d5b9758c1#npm:2.6.9"],\ + ["doctrine", "npm:2.1.0"],\ + ["eslint", "npm:7.32.0"],\ + ["eslint-import-resolver-node", "npm:0.3.6"],\ + ["eslint-module-utils", "virtual:c35e0ef15e09d951132a1d1de0f686a9b852da3009392a39bfdef5e548591355b594808c6c5c6c2baa4339946ff8c9883343770439fdd88cdf8d08a9cc9843db#npm:2.7.1"],\ + ["has", "npm:1.0.3"],\ + ["is-core-module", "npm:2.8.1"],\ + ["is-glob", "npm:4.0.3"],\ + ["minimatch", "npm:3.1.2"],\ + ["object.values", "npm:1.1.5"],\ + ["resolve", "patch:resolve@npm%3A1.22.0#~builtin::version=1.22.0&hash=c3c19d"],\ + ["tsconfig-paths", "npm:3.12.0"]\ + ],\ + "packagePeers": [\ + "@types/eslint",\ + "@types/typescript-eslint__parser",\ + "@typescript-eslint/parser",\ + "eslint"\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["eslint-plugin-jsdoc", [\ @@ -8976,6 +9454,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["eslint-visitor-keys", "npm:3.1.0"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:3.3.0", {\ + "packageLocation": "./.yarn/cache/eslint-visitor-keys-npm-3.3.0-d329af7c8c-d59e68a7c5.zip/node_modules/eslint-visitor-keys/",\ + "packageDependencies": [\ + ["eslint-visitor-keys", "npm:3.3.0"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["espree", [\ @@ -9519,6 +10004,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["for-each", [\ + ["npm:0.3.3", {\ + "packageLocation": "./.yarn/cache/for-each-npm-0.3.3-0010ca8cdd-6c48ff2bc6.zip/node_modules/for-each/",\ + "packageDependencies": [\ + ["for-each", "npm:0.3.3"],\ + ["is-callable", "npm:1.2.7"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["foreach", [\ ["npm:2.0.5", {\ "packageLocation": "./.yarn/cache/foreach-npm-2.0.5-9fbfc73114-dab4fbfef0.zip/node_modules/foreach/",\ @@ -9627,6 +10122,19 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["function.prototype.name", [\ + ["npm:1.1.5", {\ + "packageLocation": "./.yarn/cache/function.prototype.name-npm-1.1.5-e776a642bb-acd21d733a.zip/node_modules/function.prototype.name/",\ + "packageDependencies": [\ + ["function.prototype.name", "npm:1.1.5"],\ + ["call-bind", "npm:1.0.2"],\ + ["define-properties", "npm:1.1.3"],\ + ["es-abstract", "npm:1.19.1"],\ + ["functions-have-names", "npm:1.2.3"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["functional-red-black-tree", [\ ["npm:1.0.1", {\ "packageLocation": "./.yarn/cache/functional-red-black-tree-npm-1.0.1-ccfe924dcd-ca6c170f37.zip/node_modules/functional-red-black-tree/",\ @@ -9636,6 +10144,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["functions-have-names", [\ + ["npm:1.2.3", {\ + "packageLocation": "./.yarn/cache/functions-have-names-npm-1.2.3-e5cf1e2208-c3f1f5ba20.zip/node_modules/functions-have-names/",\ + "packageDependencies": [\ + ["functions-have-names", "npm:1.2.3"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["gauge", [\ ["npm:2.7.4", {\ "packageLocation": "./.yarn/cache/gauge-npm-2.7.4-2189a73529-a89b53cee6.zip/node_modules/gauge/",\ @@ -9722,6 +10239,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["has-symbols", "npm:1.0.2"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.2.0", {\ + "packageLocation": "./.yarn/cache/get-intrinsic-npm-1.2.0-eb08ea9b1d-78fc0487b7.zip/node_modules/get-intrinsic/",\ + "packageDependencies": [\ + ["get-intrinsic", "npm:1.2.0"],\ + ["function-bind", "npm:1.1.1"],\ + ["has", "npm:1.0.3"],\ + ["has-symbols", "npm:1.0.3"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["get-package-type", [\ @@ -9943,6 +10470,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["globalthis", [\ + ["npm:1.0.3", {\ + "packageLocation": "./.yarn/cache/globalthis-npm-1.0.3-96cd56020d-fbd7d760dc.zip/node_modules/globalthis/",\ + "packageDependencies": [\ + ["globalthis", "npm:1.0.3"],\ + ["define-properties", "npm:1.1.3"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["globby", [\ ["npm:11.1.0", {\ "packageLocation": "./.yarn/cache/globby-npm-11.1.0-bdcdf20c71-b4be8885e0.zip/node_modules/globby/",\ @@ -9976,6 +10513,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["gopd", [\ + ["npm:1.0.1", {\ + "packageLocation": "./.yarn/cache/gopd-npm-1.0.1-10c1d0b534-a5ccfb8806.zip/node_modules/gopd/",\ + "packageDependencies": [\ + ["gopd", "npm:1.0.1"],\ + ["get-intrinsic", "npm:1.2.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["got", [\ ["npm:11.8.6", {\ "packageLocation": "./.yarn/cache/got-npm-11.8.6-89e7cd5d67-bbc783578a.zip/node_modules/got/",\ @@ -10025,6 +10572,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["grapheme-splitter", [\ + ["npm:1.0.4", {\ + "packageLocation": "./.yarn/cache/grapheme-splitter-npm-1.0.4-648f2bf509-0c22ec54de.zip/node_modules/grapheme-splitter/",\ + "packageDependencies": [\ + ["grapheme-splitter", "npm:1.0.4"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["grouped-queue", [\ ["npm:2.0.0", {\ "packageLocation": "./.yarn/cache/grouped-queue-npm-2.0.0-81fdc84ef7-be5c6cfac0.zip/node_modules/grouped-queue/",\ @@ -10093,6 +10649,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["has-bigints", "npm:1.0.1"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.0.2", {\ + "packageLocation": "./.yarn/cache/has-bigints-npm-1.0.2-52732e614d-390e31e7be.zip/node_modules/has-bigints/",\ + "packageDependencies": [\ + ["has-bigints", "npm:1.0.2"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["has-flag", [\ @@ -10111,6 +10674,25 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["has-property-descriptors", [\ + ["npm:1.0.0", {\ + "packageLocation": "./.yarn/cache/has-property-descriptors-npm-1.0.0-56289b918d-a6d3f0a266.zip/node_modules/has-property-descriptors/",\ + "packageDependencies": [\ + ["has-property-descriptors", "npm:1.0.0"],\ + ["get-intrinsic", "npm:1.1.1"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ + ["has-proto", [\ + ["npm:1.0.1", {\ + "packageLocation": "./.yarn/cache/has-proto-npm-1.0.1-631ea9d820-febc5b5b53.zip/node_modules/has-proto/",\ + "packageDependencies": [\ + ["has-proto", "npm:1.0.1"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["has-symbols", [\ ["npm:1.0.2", {\ "packageLocation": "./.yarn/cache/has-symbols-npm-1.0.2-50e53af115-2309c42607.zip/node_modules/has-symbols/",\ @@ -10118,6 +10700,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["has-symbols", "npm:1.0.2"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.0.3", {\ + "packageLocation": "./.yarn/cache/has-symbols-npm-1.0.3-1986bff2c4-a054c40c63.zip/node_modules/has-symbols/",\ + "packageDependencies": [\ + ["has-symbols", "npm:1.0.3"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["has-tostringtag", [\ @@ -10614,6 +11203,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["side-channel", "npm:1.0.4"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.0.5", {\ + "packageLocation": "./.yarn/cache/internal-slot-npm-1.0.5-a2241f3e66-97e84046bf.zip/node_modules/internal-slot/",\ + "packageDependencies": [\ + ["internal-slot", "npm:1.0.5"],\ + ["get-intrinsic", "npm:1.2.0"],\ + ["has", "npm:1.0.3"],\ + ["side-channel", "npm:1.0.4"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["interpret", [\ @@ -10661,6 +11260,18 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["is-array-buffer", [\ + ["npm:3.0.2", {\ + "packageLocation": "./.yarn/cache/is-array-buffer-npm-3.0.2-0dec897785-dcac9dda66.zip/node_modules/is-array-buffer/",\ + "packageDependencies": [\ + ["is-array-buffer", "npm:3.0.2"],\ + ["call-bind", "npm:1.0.2"],\ + ["get-intrinsic", "npm:1.2.0"],\ + ["is-typed-array", "npm:1.1.10"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["is-arrayish", [\ ["npm:0.2.1", {\ "packageLocation": "./.yarn/cache/is-arrayish-npm-0.2.1-23927dfb15-eef4417e3c.zip/node_modules/is-arrayish/",\ @@ -10715,6 +11326,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["is-callable", "npm:1.2.4"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.2.7", {\ + "packageLocation": "./.yarn/cache/is-callable-npm-1.2.7-808a303e61-61fd57d03b.zip/node_modules/is-callable/",\ + "packageDependencies": [\ + ["is-callable", "npm:1.2.7"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["is-core-module", [\ @@ -10845,6 +11463,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["is-negative-zero", "npm:2.0.1"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:2.0.2", {\ + "packageLocation": "./.yarn/cache/is-negative-zero-npm-2.0.2-0adac91f15-f3232194c4.zip/node_modules/is-negative-zero/",\ + "packageDependencies": [\ + ["is-negative-zero", "npm:2.0.2"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["is-number", [\ @@ -10945,6 +11570,14 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["is-shared-array-buffer", "npm:1.0.1"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.0.2", {\ + "packageLocation": "./.yarn/cache/is-shared-array-buffer-npm-1.0.2-32e4181fcd-9508929cf1.zip/node_modules/is-shared-array-buffer/",\ + "packageDependencies": [\ + ["is-shared-array-buffer", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.2"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["is-stream", [\ @@ -10987,6 +11620,18 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { }]\ ]],\ ["is-typed-array", [\ + ["npm:1.1.10", {\ + "packageLocation": "./.yarn/cache/is-typed-array-npm-1.1.10-fe4ef83cdc-aac6ecb59d.zip/node_modules/is-typed-array/",\ + "packageDependencies": [\ + ["is-typed-array", "npm:1.1.10"],\ + ["available-typed-arrays", "npm:1.0.5"],\ + ["call-bind", "npm:1.0.2"],\ + ["for-each", "npm:0.3.3"],\ + ["gopd", "npm:1.0.1"],\ + ["has-tostringtag", "npm:1.0.0"]\ + ],\ + "linkType": "HARD"\ + }],\ ["npm:1.1.8", {\ "packageLocation": "./.yarn/cache/is-typed-array-npm-1.1.8-147f090d0d-aa0f9f0716.zip/node_modules/is-typed-array/",\ "packageDependencies": [\ @@ -11035,6 +11680,14 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["call-bind", "npm:1.0.2"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.0.2", {\ + "packageLocation": "./.yarn/cache/is-weakref-npm-1.0.2-ff80e8c314-95bd9a57cd.zip/node_modules/is-weakref/",\ + "packageDependencies": [\ + ["is-weakref", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.2"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["is-windows", [\ @@ -13130,6 +13783,15 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["natural-compare-lite", [\ + ["npm:1.4.0", {\ + "packageLocation": "./.yarn/cache/natural-compare-lite-npm-1.4.0-12b6b308ed-5222ac3986.zip/node_modules/natural-compare-lite/",\ + "packageDependencies": [\ + ["natural-compare-lite", "npm:1.4.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["natural-orderby", [\ ["npm:2.0.3", {\ "packageLocation": "./.yarn/cache/natural-orderby-npm-2.0.3-e519eaa77c-039be7f0b6.zip/node_modules/natural-orderby/",\ @@ -13671,6 +14333,13 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["object-inspect", "npm:1.11.0"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.12.3", {\ + "packageLocation": "./.yarn/cache/object-inspect-npm-1.12.3-1e7d20f5ff-dabfd824d9.zip/node_modules/object-inspect/",\ + "packageDependencies": [\ + ["object-inspect", "npm:1.12.3"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["object-is", [\ @@ -13713,6 +14382,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["object-keys", "npm:1.1.1"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:4.1.4", {\ + "packageLocation": "./.yarn/cache/object.assign-npm-4.1.4-fb3deb1c3a-76cab513a5.zip/node_modules/object.assign/",\ + "packageDependencies": [\ + ["object.assign", "npm:4.1.4"],\ + ["call-bind", "npm:1.0.2"],\ + ["define-properties", "npm:1.2.0"],\ + ["has-symbols", "npm:1.0.3"],\ + ["object-keys", "npm:1.1.1"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["object.entries", [\ @@ -13725,6 +14405,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["es-abstract", "npm:1.19.1"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.1.6", {\ + "packageLocation": "./.yarn/cache/object.entries-npm-1.1.6-5f9ba14b46-0f8c47517e.zip/node_modules/object.entries/",\ + "packageDependencies": [\ + ["object.entries", "npm:1.1.6"],\ + ["call-bind", "npm:1.0.2"],\ + ["define-properties", "npm:1.2.0"],\ + ["es-abstract", "npm:1.21.2"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["object.values", [\ @@ -15040,6 +15730,18 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["regexp.prototype.flags", [\ + ["npm:1.4.3", {\ + "packageLocation": "./.yarn/cache/regexp.prototype.flags-npm-1.4.3-df1c08b65d-51228bae73.zip/node_modules/regexp.prototype.flags/",\ + "packageDependencies": [\ + ["regexp.prototype.flags", "npm:1.4.3"],\ + ["call-bind", "npm:1.0.2"],\ + ["define-properties", "npm:1.1.3"],\ + ["functions-have-names", "npm:1.2.3"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["regexpp", [\ ["npm:3.2.0", {\ "packageLocation": "./.yarn/cache/regexpp-npm-3.2.0-2513f32cfc-a78dc5c715.zip/node_modules/regexpp/",\ @@ -15359,6 +16061,18 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["safe-regex-test", [\ + ["npm:1.0.0", {\ + "packageLocation": "./.yarn/cache/safe-regex-test-npm-1.0.0-e94a09b84e-bc566d8beb.zip/node_modules/safe-regex-test/",\ + "packageDependencies": [\ + ["safe-regex-test", "npm:1.0.0"],\ + ["call-bind", "npm:1.0.2"],\ + ["get-intrinsic", "npm:1.2.0"],\ + ["is-regex", "npm:1.1.4"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["safe-regex2", [\ ["npm:2.0.0", {\ "packageLocation": "./.yarn/cache/safe-regex2-npm-2.0.0-eadecc9909-f5e182fca0.zip/node_modules/safe-regex2/",\ @@ -16213,6 +16927,18 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["string.prototype.trim", [\ + ["npm:1.2.7", {\ + "packageLocation": "./.yarn/cache/string.prototype.trim-npm-1.2.7-3fbaf3b9d2-05b7b2d6af.zip/node_modules/string.prototype.trim/",\ + "packageDependencies": [\ + ["string.prototype.trim", "npm:1.2.7"],\ + ["call-bind", "npm:1.0.2"],\ + ["define-properties", "npm:1.2.0"],\ + ["es-abstract", "npm:1.21.2"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["string.prototype.trimend", [\ ["npm:1.0.4", {\ "packageLocation": "./.yarn/cache/string.prototype.trimend-npm-1.0.4-a656b8fe24-17e5aa45c3.zip/node_modules/string.prototype.trimend/",\ @@ -16222,6 +16948,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["define-properties", "npm:1.1.3"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.0.6", {\ + "packageLocation": "./.yarn/cache/string.prototype.trimend-npm-1.0.6-304246ecc1-0fdc34645a.zip/node_modules/string.prototype.trimend/",\ + "packageDependencies": [\ + ["string.prototype.trimend", "npm:1.0.6"],\ + ["call-bind", "npm:1.0.2"],\ + ["define-properties", "npm:1.2.0"],\ + ["es-abstract", "npm:1.21.2"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["string.prototype.trimstart", [\ @@ -16233,6 +16969,16 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["define-properties", "npm:1.1.3"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.0.6", {\ + "packageLocation": "./.yarn/cache/string.prototype.trimstart-npm-1.0.6-0926caea6c-89080feef4.zip/node_modules/string.prototype.trimstart/",\ + "packageDependencies": [\ + ["string.prototype.trimstart", "npm:1.0.6"],\ + ["call-bind", "npm:1.0.2"],\ + ["define-properties", "npm:1.2.0"],\ + ["es-abstract", "npm:1.21.2"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["string_decoder", [\ @@ -17218,6 +17964,43 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["tsutils", [\ + ["npm:3.21.0", {\ + "packageLocation": "./.yarn/cache/tsutils-npm-3.21.0-347e6636c5-1843f4c1b2.zip/node_modules/tsutils/",\ + "packageDependencies": [\ + ["tsutils", "npm:3.21.0"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:3.21.0", {\ + "packageLocation": "./.yarn/__virtual__/tsutils-virtual-32b99c9531/0/cache/tsutils-npm-3.21.0-347e6636c5-1843f4c1b2.zip/node_modules/tsutils/",\ + "packageDependencies": [\ + ["tsutils", "virtual:0e22d802b65219681b64a9f99af596d56d444fb6f03cdf776b56a06fb9ddeefe4b0a611780f0b0eea0b47a1f1fba5a366d19cd6561bbc1e55271f08c190cd76f#npm:3.21.0"],\ + ["@types/typescript", null],\ + ["tslib", "npm:1.14.1"],\ + ["typescript", "patch:typescript@npm%3A3.9.10#~builtin::version=3.9.10&hash=3bd3d3"]\ + ],\ + "packagePeers": [\ + "@types/typescript",\ + "typescript"\ + ],\ + "linkType": "HARD"\ + }],\ + ["virtual:ad07d3460ae416a99f304e6734121d5396603792c47f7c9a1b9c5c798d407da37779ac7289222241db922614d91f9d569b0f43bc10c027fcc720138b2f32e9fc#npm:3.21.0", {\ + "packageLocation": "./.yarn/__virtual__/tsutils-virtual-5e94504d8c/0/cache/tsutils-npm-3.21.0-347e6636c5-1843f4c1b2.zip/node_modules/tsutils/",\ + "packageDependencies": [\ + ["tsutils", "virtual:ad07d3460ae416a99f304e6734121d5396603792c47f7c9a1b9c5c798d407da37779ac7289222241db922614d91f9d569b0f43bc10c027fcc720138b2f32e9fc#npm:3.21.0"],\ + ["@types/typescript", null],\ + ["tslib", "npm:1.14.1"],\ + ["typescript", null]\ + ],\ + "packagePeers": [\ + "@types/typescript",\ + "typescript"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["tunnel-agent", [\ ["npm:0.6.0", {\ "packageLocation": "./.yarn/cache/tunnel-agent-npm-0.6.0-64345ab7eb-05f6510358.zip/node_modules/tunnel-agent/",\ @@ -17319,6 +18102,18 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { "linkType": "HARD"\ }]\ ]],\ + ["typed-array-length", [\ + ["npm:1.0.4", {\ + "packageLocation": "./.yarn/cache/typed-array-length-npm-1.0.4-92771b81fc-2228febc93.zip/node_modules/typed-array-length/",\ + "packageDependencies": [\ + ["typed-array-length", "npm:1.0.4"],\ + ["call-bind", "npm:1.0.2"],\ + ["for-each", "npm:0.3.3"],\ + ["is-typed-array", "npm:1.1.10"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["typed-function", [\ ["npm:2.1.0", {\ "packageLocation": "./.yarn/cache/typed-function-npm-2.1.0-de442ec721-168c2c8f76.zip/node_modules/typed-function/",\ @@ -17419,6 +18214,17 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["which-boxed-primitive", "npm:1.0.2"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.0.2", {\ + "packageLocation": "./.yarn/cache/unbox-primitive-npm-1.0.2-cb56a05066-b7a1cf5862.zip/node_modules/unbox-primitive/",\ + "packageDependencies": [\ + ["unbox-primitive", "npm:1.0.2"],\ + ["call-bind", "npm:1.0.2"],\ + ["has-bigints", "npm:1.0.2"],\ + ["has-symbols", "npm:1.0.3"],\ + ["which-boxed-primitive", "npm:1.0.2"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["undefsafe", [\ @@ -18355,6 +19161,19 @@ function $$SETUP_STATE(hydrateRuntimeState, basePath) { ["is-typed-array", "npm:1.1.8"]\ ],\ "linkType": "HARD"\ + }],\ + ["npm:1.1.9", {\ + "packageLocation": "./.yarn/cache/which-typed-array-npm-1.1.9-9559c95dfc-fe0178ca44.zip/node_modules/which-typed-array/",\ + "packageDependencies": [\ + ["which-typed-array", "npm:1.1.9"],\ + ["available-typed-arrays", "npm:1.0.5"],\ + ["call-bind", "npm:1.0.2"],\ + ["for-each", "npm:0.3.3"],\ + ["gopd", "npm:1.0.1"],\ + ["has-tostringtag", "npm:1.0.0"],\ + ["is-typed-array", "npm:1.1.10"]\ + ],\ + "linkType": "HARD"\ }]\ ]],\ ["wide-align", [\ diff --git a/.yarn/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-82fdd1cc2a.zip b/.yarn/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-82fdd1cc2a.zip new file mode 100644 index 00000000000..39c9fa566c4 Binary files /dev/null and b/.yarn/cache/@eslint-community-eslint-utils-npm-4.2.0-434cf92d50-82fdd1cc2a.zip differ diff --git a/.yarn/cache/@eslint-community-regexpp-npm-4.4.0-6bee7b2314-2d127af0c7.zip b/.yarn/cache/@eslint-community-regexpp-npm-4.4.0-6bee7b2314-2d127af0c7.zip new file mode 100644 index 00000000000..4eb4565a1c6 Binary files /dev/null and b/.yarn/cache/@eslint-community-regexpp-npm-4.4.0-6bee7b2314-2d127af0c7.zip differ diff --git a/.yarn/cache/@types-json-schema-npm-7.0.11-79462ae5ca-527bddfe62.zip b/.yarn/cache/@types-json-schema-npm-7.0.11-79462ae5ca-527bddfe62.zip new file mode 100644 index 00000000000..7843ecde462 Binary files /dev/null and b/.yarn/cache/@types-json-schema-npm-7.0.11-79462ae5ca-527bddfe62.zip differ diff --git a/.yarn/cache/@types-semver-npm-7.3.13-56212b60da-00c0724d54.zip b/.yarn/cache/@types-semver-npm-7.3.13-56212b60da-00c0724d54.zip new file mode 100644 index 00000000000..d1a5b0a5b7e Binary files /dev/null and b/.yarn/cache/@types-semver-npm-7.3.13-56212b60da-00c0724d54.zip differ diff --git a/.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.55.0-16386bf9af-e3239ec601.zip b/.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.55.0-16386bf9af-e3239ec601.zip new file mode 100644 index 00000000000..08ce4ed0d2e Binary files /dev/null and b/.yarn/cache/@typescript-eslint-eslint-plugin-npm-5.55.0-16386bf9af-e3239ec601.zip differ diff --git a/.yarn/cache/@typescript-eslint-parser-npm-5.55.0-ee38253ad6-48a20dc7e6.zip b/.yarn/cache/@typescript-eslint-parser-npm-5.55.0-ee38253ad6-48a20dc7e6.zip new file mode 100644 index 00000000000..be83176e156 Binary files /dev/null and b/.yarn/cache/@typescript-eslint-parser-npm-5.55.0-ee38253ad6-48a20dc7e6.zip differ diff --git a/.yarn/cache/@typescript-eslint-scope-manager-npm-5.55.0-d7744f8a94-f253db88f6.zip b/.yarn/cache/@typescript-eslint-scope-manager-npm-5.55.0-d7744f8a94-f253db88f6.zip new file mode 100644 index 00000000000..bac00c9dc9f Binary files /dev/null and b/.yarn/cache/@typescript-eslint-scope-manager-npm-5.55.0-d7744f8a94-f253db88f6.zip differ diff --git a/.yarn/cache/@typescript-eslint-type-utils-npm-5.55.0-333e5c4b16-5c60d44135.zip b/.yarn/cache/@typescript-eslint-type-utils-npm-5.55.0-333e5c4b16-5c60d44135.zip new file mode 100644 index 00000000000..b59690ca41f Binary files /dev/null and b/.yarn/cache/@typescript-eslint-type-utils-npm-5.55.0-333e5c4b16-5c60d44135.zip differ diff --git a/.yarn/cache/@typescript-eslint-types-npm-5.55.0-694e3d296a-7d851f09a2.zip b/.yarn/cache/@typescript-eslint-types-npm-5.55.0-694e3d296a-7d851f09a2.zip new file mode 100644 index 00000000000..118aac3b7f6 Binary files /dev/null and b/.yarn/cache/@typescript-eslint-types-npm-5.55.0-694e3d296a-7d851f09a2.zip differ diff --git a/.yarn/cache/@typescript-eslint-typescript-estree-npm-5.55.0-aefc08af17-d24a11aee3.zip b/.yarn/cache/@typescript-eslint-typescript-estree-npm-5.55.0-aefc08af17-d24a11aee3.zip new file mode 100644 index 00000000000..511fbe85a42 Binary files /dev/null and b/.yarn/cache/@typescript-eslint-typescript-estree-npm-5.55.0-aefc08af17-d24a11aee3.zip differ diff --git a/.yarn/cache/@typescript-eslint-utils-npm-5.55.0-6a927fceb5-368cfc3fb9.zip b/.yarn/cache/@typescript-eslint-utils-npm-5.55.0-6a927fceb5-368cfc3fb9.zip new file mode 100644 index 00000000000..56efe67b2c7 Binary files /dev/null and b/.yarn/cache/@typescript-eslint-utils-npm-5.55.0-6a927fceb5-368cfc3fb9.zip differ diff --git a/.yarn/cache/@typescript-eslint-visitor-keys-npm-5.55.0-7f3c07beeb-0b24c72dff.zip b/.yarn/cache/@typescript-eslint-visitor-keys-npm-5.55.0-7f3c07beeb-0b24c72dff.zip new file mode 100644 index 00000000000..40644fa045f Binary files /dev/null and b/.yarn/cache/@typescript-eslint-visitor-keys-npm-5.55.0-7f3c07beeb-0b24c72dff.zip differ diff --git a/.yarn/cache/array-buffer-byte-length-npm-1.0.0-331671f28a-044e101ce1.zip b/.yarn/cache/array-buffer-byte-length-npm-1.0.0-331671f28a-044e101ce1.zip new file mode 100644 index 00000000000..d2d609a6675 Binary files /dev/null and b/.yarn/cache/array-buffer-byte-length-npm-1.0.0-331671f28a-044e101ce1.zip differ diff --git a/.yarn/cache/define-properties-npm-1.2.0-3547cd0fd2-e60aee6a19.zip b/.yarn/cache/define-properties-npm-1.2.0-3547cd0fd2-e60aee6a19.zip new file mode 100644 index 00000000000..bcbfcf6e68f Binary files /dev/null and b/.yarn/cache/define-properties-npm-1.2.0-3547cd0fd2-e60aee6a19.zip differ diff --git a/.yarn/cache/es-abstract-npm-1.21.2-f4ebace1ab-037f55ee5e.zip b/.yarn/cache/es-abstract-npm-1.21.2-f4ebace1ab-037f55ee5e.zip new file mode 100644 index 00000000000..c0767ddd9ff Binary files /dev/null and b/.yarn/cache/es-abstract-npm-1.21.2-f4ebace1ab-037f55ee5e.zip differ diff --git a/.yarn/cache/es-set-tostringtag-npm-2.0.1-c87b5de872-ec416a1294.zip b/.yarn/cache/es-set-tostringtag-npm-2.0.1-c87b5de872-ec416a1294.zip new file mode 100644 index 00000000000..af638f13cd5 Binary files /dev/null and b/.yarn/cache/es-set-tostringtag-npm-2.0.1-c87b5de872-ec416a1294.zip differ diff --git a/.yarn/cache/eslint-config-airbnb-base-npm-15.0.0-802837dd26-38626bad2c.zip b/.yarn/cache/eslint-config-airbnb-base-npm-15.0.0-802837dd26-38626bad2c.zip new file mode 100644 index 00000000000..d8e7f9ea15f Binary files /dev/null and b/.yarn/cache/eslint-config-airbnb-base-npm-15.0.0-802837dd26-38626bad2c.zip differ diff --git a/.yarn/cache/eslint-config-airbnb-typescript-npm-17.0.0-e1f8a377d2-e598ae7bcc.zip b/.yarn/cache/eslint-config-airbnb-typescript-npm-17.0.0-e1f8a377d2-e598ae7bcc.zip new file mode 100644 index 00000000000..2b67e09b430 Binary files /dev/null and b/.yarn/cache/eslint-config-airbnb-typescript-npm-17.0.0-e1f8a377d2-e598ae7bcc.zip differ diff --git a/.yarn/cache/eslint-visitor-keys-npm-3.3.0-d329af7c8c-d59e68a7c5.zip b/.yarn/cache/eslint-visitor-keys-npm-3.3.0-d329af7c8c-d59e68a7c5.zip new file mode 100644 index 00000000000..a46738b25f1 Binary files /dev/null and b/.yarn/cache/eslint-visitor-keys-npm-3.3.0-d329af7c8c-d59e68a7c5.zip differ diff --git a/.yarn/cache/for-each-npm-0.3.3-0010ca8cdd-6c48ff2bc6.zip b/.yarn/cache/for-each-npm-0.3.3-0010ca8cdd-6c48ff2bc6.zip new file mode 100644 index 00000000000..7ba7b1639b1 Binary files /dev/null and b/.yarn/cache/for-each-npm-0.3.3-0010ca8cdd-6c48ff2bc6.zip differ diff --git a/.yarn/cache/function.prototype.name-npm-1.1.5-e776a642bb-acd21d733a.zip b/.yarn/cache/function.prototype.name-npm-1.1.5-e776a642bb-acd21d733a.zip new file mode 100644 index 00000000000..ac0af539ea9 Binary files /dev/null and b/.yarn/cache/function.prototype.name-npm-1.1.5-e776a642bb-acd21d733a.zip differ diff --git a/.yarn/cache/functions-have-names-npm-1.2.3-e5cf1e2208-c3f1f5ba20.zip b/.yarn/cache/functions-have-names-npm-1.2.3-e5cf1e2208-c3f1f5ba20.zip new file mode 100644 index 00000000000..931661976f6 Binary files /dev/null and b/.yarn/cache/functions-have-names-npm-1.2.3-e5cf1e2208-c3f1f5ba20.zip differ diff --git a/.yarn/cache/get-intrinsic-npm-1.2.0-eb08ea9b1d-78fc0487b7.zip b/.yarn/cache/get-intrinsic-npm-1.2.0-eb08ea9b1d-78fc0487b7.zip new file mode 100644 index 00000000000..2ed7c8918fb Binary files /dev/null and b/.yarn/cache/get-intrinsic-npm-1.2.0-eb08ea9b1d-78fc0487b7.zip differ diff --git a/.yarn/cache/globalthis-npm-1.0.3-96cd56020d-fbd7d760dc.zip b/.yarn/cache/globalthis-npm-1.0.3-96cd56020d-fbd7d760dc.zip new file mode 100644 index 00000000000..b82d79dbac2 Binary files /dev/null and b/.yarn/cache/globalthis-npm-1.0.3-96cd56020d-fbd7d760dc.zip differ diff --git a/.yarn/cache/gopd-npm-1.0.1-10c1d0b534-a5ccfb8806.zip b/.yarn/cache/gopd-npm-1.0.1-10c1d0b534-a5ccfb8806.zip new file mode 100644 index 00000000000..cafca677588 Binary files /dev/null and b/.yarn/cache/gopd-npm-1.0.1-10c1d0b534-a5ccfb8806.zip differ diff --git a/.yarn/cache/grapheme-splitter-npm-1.0.4-648f2bf509-0c22ec54de.zip b/.yarn/cache/grapheme-splitter-npm-1.0.4-648f2bf509-0c22ec54de.zip new file mode 100644 index 00000000000..1eb26cc6a98 Binary files /dev/null and b/.yarn/cache/grapheme-splitter-npm-1.0.4-648f2bf509-0c22ec54de.zip differ diff --git a/.yarn/cache/has-bigints-npm-1.0.2-52732e614d-390e31e7be.zip b/.yarn/cache/has-bigints-npm-1.0.2-52732e614d-390e31e7be.zip new file mode 100644 index 00000000000..bc0b5ffd549 Binary files /dev/null and b/.yarn/cache/has-bigints-npm-1.0.2-52732e614d-390e31e7be.zip differ diff --git a/.yarn/cache/has-property-descriptors-npm-1.0.0-56289b918d-a6d3f0a266.zip b/.yarn/cache/has-property-descriptors-npm-1.0.0-56289b918d-a6d3f0a266.zip new file mode 100644 index 00000000000..46eaa4fd050 Binary files /dev/null and b/.yarn/cache/has-property-descriptors-npm-1.0.0-56289b918d-a6d3f0a266.zip differ diff --git a/.yarn/cache/has-proto-npm-1.0.1-631ea9d820-febc5b5b53.zip b/.yarn/cache/has-proto-npm-1.0.1-631ea9d820-febc5b5b53.zip new file mode 100644 index 00000000000..78afc3de429 Binary files /dev/null and b/.yarn/cache/has-proto-npm-1.0.1-631ea9d820-febc5b5b53.zip differ diff --git a/.yarn/cache/has-symbols-npm-1.0.3-1986bff2c4-a054c40c63.zip b/.yarn/cache/has-symbols-npm-1.0.3-1986bff2c4-a054c40c63.zip new file mode 100644 index 00000000000..d07bbd4967b Binary files /dev/null and b/.yarn/cache/has-symbols-npm-1.0.3-1986bff2c4-a054c40c63.zip differ diff --git a/.yarn/cache/internal-slot-npm-1.0.5-a2241f3e66-97e84046bf.zip b/.yarn/cache/internal-slot-npm-1.0.5-a2241f3e66-97e84046bf.zip new file mode 100644 index 00000000000..18fccd3ac20 Binary files /dev/null and b/.yarn/cache/internal-slot-npm-1.0.5-a2241f3e66-97e84046bf.zip differ diff --git a/.yarn/cache/is-array-buffer-npm-3.0.2-0dec897785-dcac9dda66.zip b/.yarn/cache/is-array-buffer-npm-3.0.2-0dec897785-dcac9dda66.zip new file mode 100644 index 00000000000..7556381d456 Binary files /dev/null and b/.yarn/cache/is-array-buffer-npm-3.0.2-0dec897785-dcac9dda66.zip differ diff --git a/.yarn/cache/is-callable-npm-1.2.7-808a303e61-61fd57d03b.zip b/.yarn/cache/is-callable-npm-1.2.7-808a303e61-61fd57d03b.zip new file mode 100644 index 00000000000..0e383ae51f0 Binary files /dev/null and b/.yarn/cache/is-callable-npm-1.2.7-808a303e61-61fd57d03b.zip differ diff --git a/.yarn/cache/is-negative-zero-npm-2.0.2-0adac91f15-f3232194c4.zip b/.yarn/cache/is-negative-zero-npm-2.0.2-0adac91f15-f3232194c4.zip new file mode 100644 index 00000000000..06b47fde5a0 Binary files /dev/null and b/.yarn/cache/is-negative-zero-npm-2.0.2-0adac91f15-f3232194c4.zip differ diff --git a/.yarn/cache/is-shared-array-buffer-npm-1.0.2-32e4181fcd-9508929cf1.zip b/.yarn/cache/is-shared-array-buffer-npm-1.0.2-32e4181fcd-9508929cf1.zip new file mode 100644 index 00000000000..af3ad4f0000 Binary files /dev/null and b/.yarn/cache/is-shared-array-buffer-npm-1.0.2-32e4181fcd-9508929cf1.zip differ diff --git a/.yarn/cache/is-typed-array-npm-1.1.10-fe4ef83cdc-aac6ecb59d.zip b/.yarn/cache/is-typed-array-npm-1.1.10-fe4ef83cdc-aac6ecb59d.zip new file mode 100644 index 00000000000..b3a4495f94e Binary files /dev/null and b/.yarn/cache/is-typed-array-npm-1.1.10-fe4ef83cdc-aac6ecb59d.zip differ diff --git a/.yarn/cache/is-weakref-npm-1.0.2-ff80e8c314-95bd9a57cd.zip b/.yarn/cache/is-weakref-npm-1.0.2-ff80e8c314-95bd9a57cd.zip new file mode 100644 index 00000000000..a798b0183b2 Binary files /dev/null and b/.yarn/cache/is-weakref-npm-1.0.2-ff80e8c314-95bd9a57cd.zip differ diff --git a/.yarn/cache/natural-compare-lite-npm-1.4.0-12b6b308ed-5222ac3986.zip b/.yarn/cache/natural-compare-lite-npm-1.4.0-12b6b308ed-5222ac3986.zip new file mode 100644 index 00000000000..6f588b83160 Binary files /dev/null and b/.yarn/cache/natural-compare-lite-npm-1.4.0-12b6b308ed-5222ac3986.zip differ diff --git a/.yarn/cache/object-inspect-npm-1.12.3-1e7d20f5ff-dabfd824d9.zip b/.yarn/cache/object-inspect-npm-1.12.3-1e7d20f5ff-dabfd824d9.zip new file mode 100644 index 00000000000..ec58095dc8f Binary files /dev/null and b/.yarn/cache/object-inspect-npm-1.12.3-1e7d20f5ff-dabfd824d9.zip differ diff --git a/.yarn/cache/object.assign-npm-4.1.4-fb3deb1c3a-76cab513a5.zip b/.yarn/cache/object.assign-npm-4.1.4-fb3deb1c3a-76cab513a5.zip new file mode 100644 index 00000000000..8a1fef05570 Binary files /dev/null and b/.yarn/cache/object.assign-npm-4.1.4-fb3deb1c3a-76cab513a5.zip differ diff --git a/.yarn/cache/object.entries-npm-1.1.6-5f9ba14b46-0f8c47517e.zip b/.yarn/cache/object.entries-npm-1.1.6-5f9ba14b46-0f8c47517e.zip new file mode 100644 index 00000000000..a0a3207428a Binary files /dev/null and b/.yarn/cache/object.entries-npm-1.1.6-5f9ba14b46-0f8c47517e.zip differ diff --git a/.yarn/cache/regexp.prototype.flags-npm-1.4.3-df1c08b65d-51228bae73.zip b/.yarn/cache/regexp.prototype.flags-npm-1.4.3-df1c08b65d-51228bae73.zip new file mode 100644 index 00000000000..9e56b1a48bb Binary files /dev/null and b/.yarn/cache/regexp.prototype.flags-npm-1.4.3-df1c08b65d-51228bae73.zip differ diff --git a/.yarn/cache/safe-regex-test-npm-1.0.0-e94a09b84e-bc566d8beb.zip b/.yarn/cache/safe-regex-test-npm-1.0.0-e94a09b84e-bc566d8beb.zip new file mode 100644 index 00000000000..9e9dbfc6376 Binary files /dev/null and b/.yarn/cache/safe-regex-test-npm-1.0.0-e94a09b84e-bc566d8beb.zip differ diff --git a/.yarn/cache/string.prototype.trim-npm-1.2.7-3fbaf3b9d2-05b7b2d6af.zip b/.yarn/cache/string.prototype.trim-npm-1.2.7-3fbaf3b9d2-05b7b2d6af.zip new file mode 100644 index 00000000000..ee6a456c050 Binary files /dev/null and b/.yarn/cache/string.prototype.trim-npm-1.2.7-3fbaf3b9d2-05b7b2d6af.zip differ diff --git a/.yarn/cache/string.prototype.trimend-npm-1.0.6-304246ecc1-0fdc34645a.zip b/.yarn/cache/string.prototype.trimend-npm-1.0.6-304246ecc1-0fdc34645a.zip new file mode 100644 index 00000000000..c28cc815b20 Binary files /dev/null and b/.yarn/cache/string.prototype.trimend-npm-1.0.6-304246ecc1-0fdc34645a.zip differ diff --git a/.yarn/cache/string.prototype.trimstart-npm-1.0.6-0926caea6c-89080feef4.zip b/.yarn/cache/string.prototype.trimstart-npm-1.0.6-0926caea6c-89080feef4.zip new file mode 100644 index 00000000000..6203bec399b Binary files /dev/null and b/.yarn/cache/string.prototype.trimstart-npm-1.0.6-0926caea6c-89080feef4.zip differ diff --git a/.yarn/cache/tsutils-npm-3.21.0-347e6636c5-1843f4c1b2.zip b/.yarn/cache/tsutils-npm-3.21.0-347e6636c5-1843f4c1b2.zip new file mode 100644 index 00000000000..38d2b345ee4 Binary files /dev/null and b/.yarn/cache/tsutils-npm-3.21.0-347e6636c5-1843f4c1b2.zip differ diff --git a/.yarn/cache/typed-array-length-npm-1.0.4-92771b81fc-2228febc93.zip b/.yarn/cache/typed-array-length-npm-1.0.4-92771b81fc-2228febc93.zip new file mode 100644 index 00000000000..f68a3c2c967 Binary files /dev/null and b/.yarn/cache/typed-array-length-npm-1.0.4-92771b81fc-2228febc93.zip differ diff --git a/.yarn/cache/unbox-primitive-npm-1.0.2-cb56a05066-b7a1cf5862.zip b/.yarn/cache/unbox-primitive-npm-1.0.2-cb56a05066-b7a1cf5862.zip new file mode 100644 index 00000000000..7230bc69278 Binary files /dev/null and b/.yarn/cache/unbox-primitive-npm-1.0.2-cb56a05066-b7a1cf5862.zip differ diff --git a/.yarn/cache/which-typed-array-npm-1.1.9-9559c95dfc-fe0178ca44.zip b/.yarn/cache/which-typed-array-npm-1.1.9-9559c95dfc-fe0178ca44.zip new file mode 100644 index 00000000000..e7e7d548deb Binary files /dev/null and b/.yarn/cache/which-typed-array-npm-1.1.9-9559c95dfc-fe0178ca44.zip differ diff --git a/packages/js-dash-sdk/.eslintrc.js b/packages/js-dash-sdk/.eslintrc.js new file mode 100644 index 00000000000..de152233f59 --- /dev/null +++ b/packages/js-dash-sdk/.eslintrc.js @@ -0,0 +1,83 @@ +// A set of rules to easen misuse in the existing codebase +// We should fix these warnigns when possible +const warnRules = { + 'import/prefer-default-export': 'warn', + 'no-param-reassign': 'warn', + 'import/no-cycle': 'warn', + 'import/no-named-default': 'warn', + 'import/no-named-as-default': 'warn', +}; + +// A set of common rules applicable to both JS and TS files +const commonRules = { + 'no-await-in-loop': 'off', +}; + +module.exports = { + extends: [ + 'airbnb-base', + ], + root: true, + env: { + node: true, + mocha: true, + }, + rules: { + ...warnRules, + ...commonRules, + }, + overrides: [ + // TypeScript + { + files: [ + '**/*.ts', + ], + extends: [ + 'airbnb-base', + 'airbnb-typescript/base', + ], + parserOptions: { + project: './tsconfig.json', + }, + rules: { + '@typescript-eslint/return-await': 'warn', + ...warnRules, + ...commonRules, + }, + }, + // TypeScript tests + { + files: [ + 'src/**/*.spec.ts', + 'src/test/**/*.ts', + 'tests/**/*.ts', + ], + rules: { + // Ignore dirty-chai errors + '@typescript-eslint/no-unused-expressions': 0, + // Ignore require('dev-dependency') errors for tests and mocks + 'import/no-extraneous-dependencies': 0, + }, + }, + // JS tests + { + files: [ + 'src/test/**/*.js', + 'tests/**/*.js', + '*.config.js', + ], + rules: { + // Ignore dirty-chai errors + 'no-unused-expressions': 0, + // Ignore require('dev-dependency') errors for tests and mocks + 'import/no-extraneous-dependencies': 0, + }, + }, + ], + ignorePatterns: [ + // TODO: why do we have d.ts files in typescript project at all? + '*.d.ts', + 'build', + 'dist', + ], +}; diff --git a/packages/js-dash-sdk/build-utils/ws.js b/packages/js-dash-sdk/build-utils/ws.js index 826317a3a0a..39078b3c9db 100644 --- a/packages/js-dash-sdk/build-utils/ws.js +++ b/packages/js-dash-sdk/build-utils/ws.js @@ -1,8 +1,10 @@ +/* eslint-disable no-undef */ + /** * WebSocket shim for webpack browser builds */ -var ws; +let ws; if (typeof WebSocket !== 'undefined') { ws = WebSocket; diff --git a/packages/js-dash-sdk/karma.conf.js b/packages/js-dash-sdk/karma.conf.js index 2c78530ba1d..e5f4e122692 100644 --- a/packages/js-dash-sdk/karma.conf.js +++ b/packages/js-dash-sdk/karma.conf.js @@ -2,13 +2,12 @@ const webpack = require('webpack'); const dotenvResult = require('dotenv-safe').config(); -const webpackBaseConfig = require("./webpack.base.config"); - const karmaMocha = require('karma-mocha'); const karmaMochaReporter = require('karma-mocha-reporter'); const karmaChai = require('karma-chai'); const karmaChromeLauncher = require('karma-chrome-launcher'); const karmaWebpack = require('karma-webpack'); +const webpackBaseConfig = require('./webpack.base.config'); if (dotenvResult.error) { throw dotenvResult.error; @@ -42,7 +41,7 @@ module.exports = (config) => { colors: true, logLevel: config.LOG_INFO, autoWatch: false, - browsers: [ 'chromeWithoutSecurity'], + browsers: ['chromeWithoutSecurity'], singleRun: false, concurrency: Infinity, browserNoActivityTimeout: 7 * 60 * 1000, // 30000 default diff --git a/packages/js-dash-sdk/package.json b/packages/js-dash-sdk/package.json index 96543e7494f..7e6b2077816 100644 --- a/packages/js-dash-sdk/package.json +++ b/packages/js-dash-sdk/package.json @@ -11,7 +11,8 @@ "start:ts": "tsc --watch", "build": "yarn run build:ts && webpack --stats-error-details", "build:ts": "tsc", - "lint": "", + "lint": "eslint .", + "lint:fix": "eslint . --fix", "test": "yarn run test:unit && yarn run test:functional && yarn run test:browsers", "test:browsers": "karma start ./karma.conf.js --single-run", "test:unit": "TS_NODE_COMPILER_OPTIONS={\"target\":\"es6\"} ts-mocha \"src/**/*.spec.ts\"", @@ -55,6 +56,8 @@ "@types/node": "^14.6.0", "@types/sinon": "^9.0.4", "@types/sinon-chai": "^3.2.4", + "@typescript-eslint/eslint-plugin": "^5.55.0", + "@typescript-eslint/parser": "^5.55.0", "assert": "^2.0.0", "browserify-zlib": "^0.2.0", "buffer": "^6.0.3", @@ -63,6 +66,10 @@ "crypto-browserify": "^3.12.0", "dirty-chai": "^2.0.1", "dotenv-safe": "^8.2.0", + "eslint": "^7.32.0", + "eslint-config-airbnb-base": "^14.2.1", + "eslint-config-airbnb-typescript": "^17.0.0", + "eslint-plugin-import": "^2.24.2", "events": "^3.3.0", "https-browserify": "^1.0.0", "karma": "^6.4.1", diff --git a/packages/js-dash-sdk/src/SDK/Client/Client.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Client.spec.ts index dfec199d1d1..b5846aed7ae 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Client.spec.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Client.spec.ts @@ -1,21 +1,24 @@ import { expect } from 'chai'; +import { Transaction, BlockHeader } from '@dashevo/dashcore-lib'; +import stateTransitionTypes from '@dashevo/dpp/lib/stateTransition/stateTransitionTypes'; import getResponseMetadataFixture from '../../test/fixtures/getResponseMetadataFixture'; -import { Client } from "./index"; +import { Client } from './index'; import 'mocha'; -import { Transaction, BlockHeader } from "@dashevo/dashcore-lib"; -import { createFakeInstantLock } from "../../utils/createFakeIntantLock"; -import stateTransitionTypes from '@dashevo/dpp/lib/stateTransition/stateTransitionTypes'; + +import { createFakeInstantLock } from '../../utils/createFakeIntantLock'; + import { StateTransitionBroadcastError } from '../../errors/StateTransitionBroadcastError'; +import { createIdentityFixtureInAccount } from '../../test/fixtures/createIdentityFixtureInAccount'; + +import { createAndAttachTransportMocksToClient } from '../../test/mocks/createAndAttachTransportMocksToClient'; +import { createTransactionInAccount } from '../../test/fixtures/createTransactionFixtureInAccount'; + // @ts-ignore const getDocumentsFixture = require('@dashevo/dpp/lib/test/fixtures/getDocumentsFixture'); // @ts-ignore const getDataContractFixture = require('@dashevo/dpp/lib/test/fixtures/getDataContractFixture'); -const GetDataContractResponse = require("@dashevo/dapi-client/lib/methods/platform/getDataContract/GetDataContractResponse"); - -import { createIdentityFixtureInAccount } from '../../test/fixtures/createIdentityFixtureInAccount'; -import { createTransactionInAccount } from '../../test/fixtures/createTransactionFixtureInAccount'; -import { createAndAttachTransportMocksToClient } from '../../test/mocks/createAndAttachTransportMocksToClient'; +const GetDataContractResponse = require('@dashevo/dapi-client/lib/methods/platform/getDataContract/GetDataContractResponse'); const blockHeaderFixture = '00000020e2bddfb998d7be4cc4c6b126f04d6e4bd201687523ded527987431707e0200005520320b4e263bec33e08944656f7ce17efbc2c60caab7c8ed8a73d413d02d3a169d555ecdd6021e56d000000203000500010000000000000000000000000000000000000000000000000000000000000000ffffffff050219250102ffffffff0240c3609a010000001976a914ecfd5aaebcbb8f4791e716e188b20d4f0183265c88ac40c3609a010000001976a914ecfd5aaebcbb8f4791e716e188b20d4f0183265c88ac0000000046020019250000476416132511031b71167f4bb7658eab5c3957d79636767f83e0e18e2b9ed7f8000000000000000000000000000000000000000000000000000000000000000003000600000000000000fd4901010019250000010001d02e9ee1b14c022ad6895450f3375a8e9a87f214912d4332fa997996d2000000320000000000000032000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'; @@ -23,12 +26,10 @@ describe('Dash - Client', function suite() { this.timeout(30000); let testMnemonic; - let txStreamMock; let transportMock; let testHDKey; let client; let account; - let walletTransaction; let dapiClientMock; let identityFixture; let documentsFixture; @@ -36,20 +37,23 @@ describe('Dash - Client', function suite() { beforeEach(async function beforeEach() { testMnemonic = 'agree country attract master mimic ball load beauty join gentle turtle hover'; - testHDKey = "tprv8ZgxMBicQKsPeGi4CikhacVPz6UmErenu1PoD3S4XcEDSPP8auRaS8hG3DQtsQ2i9HACgohHwF5sgMVJNksoKqYoZbis8o75Pp1koCme2Yo"; + testHDKey = 'tprv8ZgxMBicQKsPeGi4CikhacVPz6UmErenu1PoD3S4XcEDSPP8auRaS8hG3DQtsQ2i9HACgohHwF5sgMVJNksoKqYoZbis8o75Pp1koCme2Yo'; client = new Client({ wallet: { HDPrivateKey: testHDKey, - } + }, }); - ({ txStreamMock, transportMock, dapiClientMock } = await createAndAttachTransportMocksToClient(client, this.sinon)); + ({ + transportMock, + dapiClientMock, + } = await createAndAttachTransportMocksToClient(client, this.sinon)); account = await client.getWalletAccount(); // add fake tx to the wallet so it will be able to create transactions - walletTransaction = await createTransactionInAccount(account); + await createTransactionInAccount(account); // create an identity in the account so we can sign state transitions identityFixture = createIdentityFixtureInAccount(account); dataContractFixture = getDataContractFixture(); @@ -65,34 +69,38 @@ describe('Dash - Client', function suite() { }); transportMock.getBlockHeaderByHash - .returns(BlockHeader.fromString(blockHeaderFixture)); + .returns(BlockHeader.fromString(blockHeaderFixture)); - dapiClientMock.platform.getDataContract.resolves(new GetDataContractResponse(dataContractFixture.toBuffer(), getResponseMetadataFixture())); + dapiClientMock.platform.getDataContract + .resolves(new GetDataContractResponse( + dataContractFixture.toBuffer(), + getResponseMetadataFixture(), + )); }); - it('should provide expected class', function () { + it('should provide expected class', () => { expect(Client.name).to.be.equal('Client'); expect(Client.constructor.name).to.be.equal('Function'); }); - it('should be instantiable', function () { - const client = new Client(); + it('should be instantiable', () => { + client = new Client(); expect(client).to.exist; expect(client.network).to.be.equal('testnet'); expect(client.getDAPIClient().constructor.name).to.be.equal('DAPIClient'); }); - it('should not initiate wallet lib without mnemonic', function () { - const client = new Client(); + it('should not initiate wallet lib without mnemonic', () => { + client = new Client(); expect(client.wallet).to.be.equal(undefined); }); - it('should initiate wallet-lib with a mnemonic', async ()=>{ - const client = new Client({ + it('should initiate wallet-lib with a mnemonic', async () => { + client = new Client({ wallet: { mnemonic: testMnemonic, offlineMode: true, - } + }, }); expect(client.wallet).to.exist; expect(client.wallet!.offlineMode).to.be.equal(true); @@ -100,12 +108,13 @@ describe('Dash - Client', function suite() { await client.wallet?.storage.stopWorker(); await client.wallet?.disconnect(); - const account = await client.getWalletAccount(); + account = await client.getWalletAccount(); await account.disconnect(); }); it('should throw an error if client and wallet have different networks', async () => { try { + // eslint-disable-next-line new Client({ network: 'testnet', wallet: { @@ -130,7 +139,8 @@ describe('Dash - Client', function suite() { expect(identity).to.be.not.null; const serializedSt = dapiClientMock.platform.broadcastStateTransition.getCall(0).args[0]; - const interceptedIdentityStateTransition = await client.platform.dpp.stateTransition.createFromBuffer(serializedSt); + const interceptedIdentityStateTransition = await client + .platform.dpp.stateTransition.createFromBuffer(serializedSt); const interceptedAssetLockProof = interceptedIdentityStateTransition.getAssetLockProof(); const transaction = new Transaction(transportMock.sendTransaction.getCall(0).args[0]); @@ -143,7 +153,8 @@ describe('Dash - Client', function suite() { const importedIdentityIds = account.identities.getIdentityIds(); // Check that we've imported identities properly expect(importedIdentityIds.length).to.be.equal(accountIdentitiesCountBeforeTest + 1); - expect(importedIdentityIds[1]).to.be.equal(interceptedIdentityStateTransition.getIdentityId().toString()); + expect(importedIdentityIds[1]).to.be + .equal(interceptedIdentityStateTransition.getIdentityId().toString()); }); it('should throw TransitionBroadcastError when transport resolves error', async () => { @@ -152,9 +163,9 @@ describe('Dash - Client', function suite() { const errorResponse = { error: { code: 2, - message: "Error happened", + message: 'Error happened', data: {}, - } + }, }; dapiClientMock.platform.waitForStateTransitionResult.resolves(errorResponse); @@ -186,10 +197,12 @@ describe('Dash - Client', function suite() { expect(identity).to.be.not.null; const serializedSt = dapiClientMock.platform.broadcastStateTransition.getCall(1).args[0]; - const interceptedIdentityStateTransition = await client.platform.dpp.stateTransition.createFromBuffer(serializedSt); + const interceptedIdentityStateTransition = await client + .platform.dpp.stateTransition.createFromBuffer(serializedSt); const interceptedAssetLockProof = interceptedIdentityStateTransition.getAssetLockProof(); - expect(interceptedIdentityStateTransition.getType()).to.be.equal(stateTransitionTypes.IDENTITY_TOP_UP); + expect(interceptedIdentityStateTransition.getType()) + .to.be.equal(stateTransitionTypes.IDENTITY_TOP_UP); const transaction = new Transaction(transportMock.sendTransaction.getCall(1).args[0]); const isLock = createFakeInstantLock(transaction.hash); @@ -205,9 +218,9 @@ describe('Dash - Client', function suite() { const errorResponse = { error: { code: 2, - message: "Error happened", + message: 'Error happened', data: {}, - } + }, }; dapiClientMock.platform.waitForStateTransitionResult.resolves(errorResponse); @@ -231,9 +244,9 @@ describe('Dash - Client', function suite() { const errorResponse = { error: { code: 2, - message: "Error happened", + message: 'Error happened', data: {}, - } + }, }; dapiClientMock.platform.waitForStateTransitionResult.resolves(errorResponse); @@ -254,8 +267,8 @@ describe('Dash - Client', function suite() { it('should broadcast documents', async () => { const proofResponse = { - proof: { } - } + proof: { }, + }; dapiClientMock.platform.waitForStateTransitionResult.resolves(proofResponse); @@ -264,10 +277,13 @@ describe('Dash - Client', function suite() { }, identityFixture); const serializedSt = dapiClientMock.platform.broadcastStateTransition.getCall(0).args[0]; - const interceptedSt = await client.platform.dpp.stateTransition.createFromBuffer(serializedSt); + const interceptedSt = await client + .platform.dpp.stateTransition.createFromBuffer(serializedSt); // .to.be.true() doesn't work after TS compilation in Chrome - expect(await interceptedSt.verifySignature(identityFixture.getPublicKeyById(1))).to.be.equal(true); + expect(await interceptedSt.verifySignature( + identityFixture.getPublicKeyById(1), + )).to.be.equal(true); const documentTransitions = interceptedSt.getTransitions(); @@ -281,9 +297,9 @@ describe('Dash - Client', function suite() { const errorResponse = { error: { code: 2, - message: "Error happened", + message: 'Error happened', data: {}, - } + }, }; dapiClientMock.platform.waitForStateTransitionResult.resolves(errorResponse); @@ -302,18 +318,22 @@ describe('Dash - Client', function suite() { it('should broadcast data contract', async () => { dapiClientMock.platform.waitForStateTransitionResult.resolves({ - proof: { } + proof: { }, }); await client.platform.contracts.publish(dataContractFixture, identityFixture); const serializedSt = dapiClientMock.platform.broadcastStateTransition.getCall(0).args[0]; - const interceptedSt = await client.platform.dpp.stateTransition.createFromBuffer(serializedSt); + const interceptedSt = await client + .platform.dpp.stateTransition.createFromBuffer(serializedSt); // .to.be.true() doesn't work after TS compilation in Chrome - expect(await interceptedSt.verifySignature(identityFixture.getPublicKeyById(1))).to.be.equal(true); + expect(await interceptedSt.verifySignature( + identityFixture.getPublicKeyById(1), + )).to.be.equal(true); expect(interceptedSt.getEntropy()).to.be.deep.equal(dataContractFixture.entropy); - expect(interceptedSt.getDataContract().toObject()).to.be.deep.equal(dataContractFixture.toObject()); + expect(interceptedSt.getDataContract().toObject()) + .to.be.deep.equal(dataContractFixture.toObject()); }); }); }); diff --git a/packages/js-dash-sdk/src/SDK/Client/Client.ts b/packages/js-dash-sdk/src/SDK/Client/Client.ts index 03c4811f523..323b29b7167 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Client.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Client.ts @@ -1,16 +1,16 @@ import { EventEmitter } from 'events'; -import { Account, Wallet } from "@dashevo/wallet-lib"; -import DAPIClientTransport from "@dashevo/wallet-lib/src/transport/DAPIClientTransport/DAPIClientTransport" +import { Account, Wallet } from '@dashevo/wallet-lib'; +import DAPIClientTransport from '@dashevo/wallet-lib/src/transport/DAPIClientTransport/DAPIClientTransport'; +import { Network } from '@dashevo/dashcore-lib'; +import DAPIClient from '@dashevo/dapi-client'; +import { contractId as dpnsContractId } from '@dashevo/dpns-contract/lib/systemIds'; +import { contractId as dashpayContractId } from '@dashevo/dashpay-contract/lib/systemIds'; +import { contractId as masternodeRewardSharesContractId } from '@dashevo/masternode-reward-shares-contract/lib/systemIds'; import { Platform } from './Platform'; -import { Network } from "@dashevo/dashcore-lib"; -import DAPIClient from "@dashevo/dapi-client"; -import { contractId as dpnsContractId } from "@dashevo/dpns-contract/lib/systemIds"; -import { contractId as dashpayContractId } from "@dashevo/dashpay-contract/lib/systemIds"; -import { contractId as masternodeRewardSharesContractId } from "@dashevo/masternode-reward-shares-contract/lib/systemIds"; -import { ClientApps, ClientAppsOptions } from "./ClientApps"; +import { ClientApps, ClientAppsOptions } from './ClientApps'; export interface WalletOptions extends Wallet.IWalletOptions { - defaultAccountIndex?: number; + defaultAccountIndex?: number; } /** @@ -27,147 +27,158 @@ export interface WalletOptions extends Wallet.IWalletOptions { * @param {number} [baseBanTime=60000] */ export interface ClientOpts { - apps?: ClientAppsOptions, - wallet?: WalletOptions, - dapiAddressProvider?: any, - dapiAddresses?: any[], - seeds?: any[], - network?: Network | string, - timeout?: number, - retries?: number, - baseBanTime?: number, - driveProtocolVersion?: number, + apps?: ClientAppsOptions, + wallet?: WalletOptions, + dapiAddressProvider?: any, + dapiAddresses?: any[], + seeds?: any[], + network?: Network | string, + timeout?: number, + retries?: number, + baseBanTime?: number, + driveProtocolVersion?: number, } /** - * Client class that wraps all components together to allow integrated payments on both the Dash Network (layer 1) + * Client class that wraps all components together + * to allow integrated payments on both the Dash Network (layer 1) * and the Dash Platform (layer 2). */ export class Client extends EventEmitter { - public network: string = 'testnet'; - public wallet: Wallet | undefined; - public account: Account | undefined; - public platform: Platform; - public defaultAccountIndex: number | undefined = 0; - private readonly dapiClient: DAPIClient; - private readonly apps: ClientApps; - private options: ClientOpts; - - /** + public network: string = 'testnet'; + + public wallet: Wallet | undefined; + + public account: Account | undefined; + + public platform: Platform; + + public defaultAccountIndex: number | undefined = 0; + + private readonly dapiClient: DAPIClient; + + private readonly apps: ClientApps; + + private options: ClientOpts; + + /** * Construct some instance of SDK Client * * @param {ClientOpts} [options] - options for SDK Client */ - constructor(options: ClientOpts = {}) { - super(); - - this.options = options; - - this.network = this.options.network ? this.options.network.toString() : 'testnet'; - - // Initialize DAPI Client - const dapiClientOptions = { - network: this.network, - }; - - [ - 'dapiAddressProvider', - 'dapiAddresses', - 'seeds', - 'timeout', - 'retries', - 'baseBanTime', - 'blockHeadersProviderOptions', - 'blockHeadersProvider' - ].forEach((optionName) => { - if (this.options.hasOwnProperty(optionName)) { - dapiClientOptions[optionName] = this.options[optionName]; - } - }); - - this.dapiClient = new DAPIClient(dapiClientOptions); - - // Initialize a wallet if `wallet` option is preset - if (this.options.wallet !== undefined) { - if (this.options.wallet.network !== undefined && this.options.wallet.network !== this.network) { - throw new Error('Wallet and Client networks are different'); - } - - const transport = new DAPIClientTransport(this.dapiClient); - - this.wallet = new Wallet({ - transport, - network: this.network, - ...this.options.wallet, - }); - - // @ts-ignore - this.wallet.on('error', (error, context) => ( - this.emit('error', error, { wallet: context }) - )); - } - - // @ts-ignore - this.defaultAccountIndex = this.options.wallet?.defaultAccountIndex || 0; - - this.apps = new ClientApps(Object.assign({ - dpns: { - contractId: dpnsContractId, - }, - dashpay: { - contractId: dashpayContractId, - }, - masternodeRewardShares: { - contractId: masternodeRewardSharesContractId, - } - }, this.options.apps)); - - this.platform = new Platform({ - client: this, - network: this.network, - driveProtocolVersion: this.options.driveProtocolVersion, - }); + constructor(options: ClientOpts = {}) { + super(); + + this.options = options; + + this.network = this.options.network ? this.options.network.toString() : 'testnet'; + + // Initialize DAPI Client + const dapiClientOptions = { + network: this.network, + }; + + [ + 'dapiAddressProvider', + 'dapiAddresses', + 'seeds', + 'timeout', + 'retries', + 'baseBanTime', + 'blockHeadersProviderOptions', + 'blockHeadersProvider', + ].forEach((optionName) => { + // eslint-disable-next-line + if (this.options.hasOwnProperty(optionName)) { + dapiClientOptions[optionName] = this.options[optionName]; + } + }); + + this.dapiClient = new DAPIClient(dapiClientOptions); + + // Initialize a wallet if `wallet` option is preset + if (this.options.wallet !== undefined) { + if (this.options.wallet.network !== undefined + && this.options.wallet.network !== this.network) { + throw new Error('Wallet and Client networks are different'); + } + + const transport = new DAPIClientTransport(this.dapiClient); + + this.wallet = new Wallet({ + transport, + network: this.network, + ...this.options.wallet, + }); + + // @ts-ignore + this.wallet.on('error', (error, context) => ( + this.emit('error', error, { wallet: context }) + )); } - /** + // @ts-ignore + this.defaultAccountIndex = this.options.wallet?.defaultAccountIndex || 0; + + this.apps = new ClientApps({ + dpns: { + contractId: dpnsContractId, + }, + dashpay: { + contractId: dashpayContractId, + }, + masternodeRewardShares: { + contractId: masternodeRewardSharesContractId, + }, + ...this.options.apps, + }); + + this.platform = new Platform({ + client: this, + network: this.network, + driveProtocolVersion: this.options.driveProtocolVersion, + }); + } + + /** * Get Wallet account * * @param {Account.Options} [options] * @returns {Promise} */ - async getWalletAccount(options: Account.Options = {}) : Promise { - if (!this.wallet) { - throw new Error('Wallet is not initialized, pass `wallet` option to Client'); - } + async getWalletAccount(options: Account.Options = {}) : Promise { + if (!this.wallet) { + throw new Error('Wallet is not initialized, pass `wallet` option to Client'); + } - options = { - index: this.defaultAccountIndex, - ...options, - } + options = { + index: this.defaultAccountIndex, + ...options, + }; - return this.wallet.getAccount(options); - } + return this.wallet.getAccount(options); + } - /** + /** * disconnect wallet from Dapi * @returns {void} */ - async disconnect() { - if (this.wallet) { - await this.wallet.disconnect(); - } + async disconnect() { + if (this.wallet) { + await this.wallet.disconnect(); } + } - /** + /** * Get DAPI Client instance * * @returns {DAPIClient} */ - getDAPIClient() : DAPIClient { - return this.dapiClient; - } + getDAPIClient() : DAPIClient { + return this.dapiClient; + } - /** + /** * fetch list of applications * * @remarks @@ -175,9 +186,9 @@ export class Client extends EventEmitter { * * @returns {ClientApps} applications list */ - getApps(): ClientApps { - return this.apps; - } + getApps(): ClientApps { + return this.apps; + } } export default Client; diff --git a/packages/js-dash-sdk/src/SDK/Client/ClientApps.spec.ts b/packages/js-dash-sdk/src/SDK/Client/ClientApps.spec.ts index a361457ecbe..b5a49b597eb 100644 --- a/packages/js-dash-sdk/src/SDK/Client/ClientApps.spec.ts +++ b/packages/js-dash-sdk/src/SDK/Client/ClientApps.spec.ts @@ -1,46 +1,39 @@ -import Identifier from "@dashevo/dpp/lib/Identifier"; -import {expect} from 'chai'; -import {ClientApps} from "./ClientApps"; +import Identifier from '@dashevo/dpp/lib/Identifier'; +import { expect } from 'chai'; +import { ClientApps } from './ClientApps'; import 'mocha'; describe('ClientApps', () => { - let apps; - let appsFromProps; - it('constructor', function () { - apps = new ClientApps(); - expect(apps.apps).to.deep.equal({}); - appsFromProps = new ClientApps({ - "dpns": { - contractId: '3VvS19qomuGSbEYWbTsRzeuRgawU3yK4fPMzLrbV62u8', - contract: null, - } - }); + let apps; + it('constructor', () => { + apps = new ClientApps(); + expect(apps.apps).to.deep.equal({}); + }); + it('.set', () => { + apps.set('dpns', { + contractId: '3VvS19qomuGSbEYWbTsRzeuRgawU3yK4fPMzLrbV62u8', + contract: { someField: true }, }); - it('.set', function () { - apps.set('dpns', { - contractId: '3VvS19qomuGSbEYWbTsRzeuRgawU3yK4fPMzLrbV62u8', - contract: { someField: true } - }); - apps.set('tutorialContract', { - contractId: '3VvS19qomuGSbEYWbTsRzeuRgawU3yK4fPMzLrbV62u8', - contract: { someField: true } - }); + apps.set('tutorialContract', { + contractId: '3VvS19qomuGSbEYWbTsRzeuRgawU3yK4fPMzLrbV62u8', + contract: { someField: true }, }); - it('should get', function () { - const getByName = apps.get('dpns'); - expect(getByName).to.deep.equal({ - "contractId": Identifier.from("3VvS19qomuGSbEYWbTsRzeuRgawU3yK4fPMzLrbV62u8"), - "contract": { someField: true } - }) + }); + it('should get', () => { + const getByName = apps.get('dpns'); + expect(getByName).to.deep.equal({ + contractId: Identifier.from('3VvS19qomuGSbEYWbTsRzeuRgawU3yK4fPMzLrbV62u8'), + contract: { someField: true }, }); + }); - it('should .getNames()', function () { - const names = apps.getNames(); - expect(names).to.deep.equal(['dpns', 'tutorialContract']); - }); - it('should .has', function () { - expect(apps.has('dpns')).to.equal(true); - expect(apps.has('tutorialContract')).to.equal(true); - expect(apps.has('tutorialContractt')).to.equal(false); - }); + it('should .getNames()', () => { + const names = apps.getNames(); + expect(names).to.deep.equal(['dpns', 'tutorialContract']); + }); + it('should .has', () => { + expect(apps.has('dpns')).to.equal(true); + expect(apps.has('tutorialContract')).to.equal(true); + expect(apps.has('tutorialContractt')).to.equal(false); + }); }); diff --git a/packages/js-dash-sdk/src/SDK/Client/ClientApps.ts b/packages/js-dash-sdk/src/SDK/Client/ClientApps.ts index 533d10741d6..99f784011f3 100644 --- a/packages/js-dash-sdk/src/SDK/Client/ClientApps.ts +++ b/packages/js-dash-sdk/src/SDK/Client/ClientApps.ts @@ -1,73 +1,73 @@ -import Identifier from "@dashevo/dpp/lib/Identifier"; +import Identifier from '@dashevo/dpp/lib/Identifier'; /** * Interface for ClientApps */ export interface ClientAppsOptions { - [name: string]: ClientAppDefinitionOptions, + [name: string]: ClientAppDefinitionOptions, } interface ClientAppDefinitionOptions { - contractId: Identifier|string, - contract?: any + contractId: Identifier | string, + contract?: any } interface ClientAppDefinition { - contractId: Identifier, - contract?: any + contractId: Identifier, + contract?: any } type ClientAppsList = Record; export class ClientApps { - private apps: ClientAppsList = {}; + private apps: ClientAppsList = {}; - constructor(apps: ClientAppsOptions = {}) { - Object.entries(apps).forEach(([name, definition]) => this.set(name, definition)); - } + constructor(apps: ClientAppsOptions = {}) { + Object.entries(apps).forEach(([name, definition]) => this.set(name, definition)); + } - /** + /** * Set app * * @param {string} name * @param {ClientAppDefinitionOptions} definition */ - set(name: string, definition: ClientAppDefinitionOptions) { - definition.contractId = Identifier.from(definition.contractId); + set(name: string, definition: ClientAppDefinitionOptions) { + definition.contractId = Identifier.from(definition.contractId); - this.apps[name] = definition; - } + this.apps[name] = definition; + } - /** + /** * Get app definition by name * * @param {string} name * @return {ClientAppDefinition} */ - get(name: string): ClientAppDefinition { - if (!this.has(name)) { - throw new Error(`Application with name ${name} is not defined`); - } - - return this.apps[name]; + get(name: string): ClientAppDefinition { + if (!this.has(name)) { + throw new Error(`Application with name ${name} is not defined`); } - /** + return this.apps[name]; + } + + /** * Check if app is defined * * @param {string} name * @return {boolean} */ - has(name: string): boolean { - return Boolean(this.apps[name]); - } + has(name: string): boolean { + return Boolean(this.apps[name]); + } - /** + /** * Get all apps * * @return {ClientAppsList} */ - getNames(): Array { - return Object.keys(this.apps); - } + getNames(): Array { + return Object.keys(this.apps); + } } diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/IPlatformStateProof.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/IPlatformStateProof.ts index 158216bb3be..89216b71652 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/IPlatformStateProof.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/IPlatformStateProof.ts @@ -1,3 +1,3 @@ export interface IPlatformStateProof { - merkleProof: Buffer, + merkleProof: Buffer, } diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/IStateTransitionResult.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/IStateTransitionResult.ts index 92529ad2085..ce464f641f4 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/IStateTransitionResult.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/IStateTransitionResult.ts @@ -1,10 +1,10 @@ -import { IPlatformStateProof } from "./IPlatformStateProof"; +import { IPlatformStateProof } from './IPlatformStateProof'; export interface IStateTransitionResult { - proof?: IPlatformStateProof, - error?: { - code: number, - message: string, - data: any, - } + proof?: IPlatformStateProof, + error?: { + code: number, + message: string, + data: any, + } } diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.spec.ts index fa321b2c854..c1be262c0f3 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.spec.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.spec.ts @@ -1,14 +1,13 @@ import { expect } from 'chai'; -import { Platform } from "./index"; +import { latestVersion as latestProtocolVersion } from '@dashevo/dpp/lib/version/protocolVersion'; +import { Platform } from './index'; import 'mocha'; import Client from '../Client'; -import { latestVersion as latestProtocolVersion } from "@dashevo/dpp/lib/version/protocolVersion"; describe('Dash - Platform', () => { - - it('should provide expected class', function () { - expect(Platform.name).to.be.equal('Platform') - expect(Platform.constructor.name).to.be.equal('Function') + it('should provide expected class', () => { + expect(Platform.name).to.be.equal('Platform'); + expect(Platform.constructor.name).to.be.equal('Function'); }); it('should set protocol version for DPP though options', () => { diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.ts index 65c949a4ff2..12538f85bf0 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/Platform.ts @@ -1,38 +1,38 @@ // @ts-ignore -import DashPlatformProtocol from "@dashevo/dpp"; +import DashPlatformProtocol from '@dashevo/dpp'; -import Client from "../Client"; +import { latestVersion as latestProtocolVersion } from '@dashevo/dpp/lib/version/protocolVersion'; +import Client from '../Client'; import { IStateTransitionResult } from './IStateTransitionResult'; -import createAssetLockTransaction from "./createAssetLockTransaction"; - -import broadcastDocument from "./methods/documents/broadcast"; -import createDocument from "./methods/documents/create"; -import getDocument from "./methods/documents/get"; - -import publishContract from "./methods/contracts/publish"; -import updateContract from "./methods/contracts/update"; -import createContract from "./methods/contracts/create"; -import getContract from "./methods/contracts/get"; - -import getIdentity from "./methods/identities/get"; -import registerIdentity from "./methods/identities/register"; -import topUpIdentity from "./methods/identities/topUp"; -import updateIdentity from "./methods/identities/update"; -import createIdentityCreateTransition from "./methods/identities/internal/createIdentityCreateTransition"; -import createIdentityTopUpTransition from "./methods/identities/internal/createIdnetityTopUpTransition"; -import createAssetLockProof from "./methods/identities/internal/createAssetLockProof"; -import waitForCoreChainLockedHeight from "./methods/identities/internal/waitForCoreChainLockedHeight"; - -import registerName from "./methods/names/register"; -import resolveName from "./methods/names/resolve"; -import resolveNameByRecord from "./methods/names/resolveByRecord"; -import searchName from "./methods/names/search"; -import broadcastStateTransition from "./broadcastStateTransition"; +import createAssetLockTransaction from './createAssetLockTransaction'; + +import broadcastDocument from './methods/documents/broadcast'; +import createDocument from './methods/documents/create'; +import getDocument from './methods/documents/get'; + +import publishContract from './methods/contracts/publish'; +import updateContract from './methods/contracts/update'; +import createContract from './methods/contracts/create'; +import getContract from './methods/contracts/get'; + +import getIdentity from './methods/identities/get'; +import registerIdentity from './methods/identities/register'; +import topUpIdentity from './methods/identities/topUp'; +import updateIdentity from './methods/identities/update'; +import createIdentityCreateTransition from './methods/identities/internal/createIdentityCreateTransition'; +import createIdentityTopUpTransition from './methods/identities/internal/createIdnetityTopUpTransition'; +import createAssetLockProof from './methods/identities/internal/createAssetLockProof'; +import waitForCoreChainLockedHeight from './methods/identities/internal/waitForCoreChainLockedHeight'; + +import registerName from './methods/names/register'; +import resolveName from './methods/names/resolve'; +import resolveNameByRecord from './methods/names/resolveByRecord'; +import searchName from './methods/names/search'; +import broadcastStateTransition from './broadcastStateTransition'; import StateRepository from './StateRepository'; -import { latestVersion as latestProtocolVersion } from "@dashevo/dpp/lib/version/protocolVersion"; -import logger, { ConfigurableLogger } from "../../../logger" +import logger, { ConfigurableLogger } from '../../../logger'; /** * Interface for PlatformOpts @@ -41,9 +41,9 @@ import logger, { ConfigurableLogger } from "../../../logger" * required parameters include { client, apps } */ export interface PlatformOpts { - client: Client, - network: string, - driveProtocolVersion?: number, + client: Client, + network: string, + driveProtocolVersion?: number, } /** @@ -52,9 +52,9 @@ export interface PlatformOpts { * @param {Function} get - get records from the platform */ interface Records { - broadcast: Function, - create: Function, - get: Function, + broadcast: Function, + create: Function, + get: Function, } /** @@ -64,31 +64,31 @@ interface Records { * @param {Function} search - search domain */ interface DomainNames { - register: Function, - resolve: Function, - resolveByRecord: Function, - search: Function, + register: Function, + resolve: Function, + resolveByRecord: Function, + search: Function, } interface Identities { - get: Function, - register: Function, - topUp: Function, - update: Function, - utils: { - createAssetLockTransaction: Function - createAssetLockProof: Function - createIdentityCreateTransition: Function - createIdentityTopUpTransition: Function - waitForCoreChainLockedHeight: Function - } + get: Function, + register: Function, + topUp: Function, + update: Function, + utils: { + createAssetLockTransaction: Function + createAssetLockProof: Function + createIdentityCreateTransition: Function + createIdentityTopUpTransition: Function + waitForCoreChainLockedHeight: Function + } } interface DataContracts { - update: Function, - publish: Function, - create: Function, - get: Function, + update: Function, + publish: Function, + create: Function, + get: Function, } /** @@ -100,105 +100,108 @@ interface DataContracts { * @param contracts - contracts */ export class Platform { - dpp: DashPlatformProtocol; + dpp: DashPlatformProtocol; - public documents: Records; - /** + public documents: Records; + + /** * @param {Function} get - get identities from the platform * @param {Function} register - register identities on the platform */ - public identities: Identities; - /** + public identities: Identities; + + /** * @param {Function} get - get names from the platform * @param {Function} register - register names on the platform */ - public names: DomainNames; - /** + public names: DomainNames; + + /** * @param {Function} get - get contracts from the platform * @param {Function} create - create contracts which can be broadcasted * @param {Function} register - register contracts on the platform */ - public contracts: DataContracts; + public contracts: DataContracts; - public logger: ConfigurableLogger; + public logger: ConfigurableLogger; - /** + /** * Broadcasts state transition * @param {Object} stateTransition */ - public broadcastStateTransition(stateTransition: any): Promise { - return broadcastStateTransition(this, stateTransition); - }; + public broadcastStateTransition(stateTransition: any): Promise { + return broadcastStateTransition(this, stateTransition); + } - client: Client; + client: Client; - private static readonly networkToProtocolVersion: Map = new Map([ - ['testnet', 1], - ]); + private static readonly networkToProtocolVersion: Map = new Map([ + ['testnet', 1], + ]); - /** + /** * Construct some instance of Platform * * @param {PlatformOpts} options - options for Platform */ - constructor(options: PlatformOpts) { - this.documents = { - broadcast: broadcastDocument.bind(this), - create: createDocument.bind(this), - get: getDocument.bind(this), - }; - this.contracts = { - publish: publishContract.bind(this), - update: updateContract.bind(this), - create: createContract.bind(this), - get: getContract.bind(this), - }; - this.names = { - register: registerName.bind(this), - resolve: resolveName.bind(this), - resolveByRecord: resolveNameByRecord.bind(this), - search: searchName.bind(this), - }; - this.identities = { - register: registerIdentity.bind(this), - get: getIdentity.bind(this), - topUp: topUpIdentity.bind(this), - update: updateIdentity.bind(this), - utils: { - createAssetLockProof: createAssetLockProof.bind(this), - createAssetLockTransaction: createAssetLockTransaction.bind(this), - createIdentityCreateTransition: createIdentityCreateTransition.bind(this), - createIdentityTopUpTransition: createIdentityTopUpTransition.bind(this), - waitForCoreChainLockedHeight: waitForCoreChainLockedHeight.bind(this), - } - }; - - this.client = options.client; - const walletId = this.client.wallet ? this.client.wallet.walletId : 'noid' - this.logger = logger.getForId(walletId) - - const mappedProtocolVersion = Platform.networkToProtocolVersion.get( - options.network, - ); - - // use protocol version from options if set - // use mapped one otherwise - // fallback to one that set in dpp as the last option - const driveProtocolVersion = options.driveProtocolVersion !== undefined - ? options.driveProtocolVersion - : (mappedProtocolVersion !== undefined ? mappedProtocolVersion : latestProtocolVersion); - - const stateRepository = new StateRepository(this.client); - - this.dpp = new DashPlatformProtocol({ - stateRepository, - protocolVersion: driveProtocolVersion, - ...options, - }); - } - - async initialize() { - await this.dpp.initialize(); - } -} + constructor(options: PlatformOpts) { + this.documents = { + broadcast: broadcastDocument.bind(this), + create: createDocument.bind(this), + get: getDocument.bind(this), + }; + this.contracts = { + publish: publishContract.bind(this), + update: updateContract.bind(this), + create: createContract.bind(this), + get: getContract.bind(this), + }; + this.names = { + register: registerName.bind(this), + resolve: resolveName.bind(this), + resolveByRecord: resolveNameByRecord.bind(this), + search: searchName.bind(this), + }; + this.identities = { + register: registerIdentity.bind(this), + get: getIdentity.bind(this), + topUp: topUpIdentity.bind(this), + update: updateIdentity.bind(this), + utils: { + createAssetLockProof: createAssetLockProof.bind(this), + createAssetLockTransaction: createAssetLockTransaction.bind(this), + createIdentityCreateTransition: createIdentityCreateTransition.bind(this), + createIdentityTopUpTransition: createIdentityTopUpTransition.bind(this), + waitForCoreChainLockedHeight: waitForCoreChainLockedHeight.bind(this), + }, + }; + this.client = options.client; + const walletId = this.client.wallet ? this.client.wallet.walletId : 'noid'; + this.logger = logger.getForId(walletId); + + const mappedProtocolVersion = Platform.networkToProtocolVersion.get( + options.network, + ); + + // use protocol version from options if set + // use mapped one otherwise + // fallback to one that set in dpp as the last option + // eslint-disable-next-line + const driveProtocolVersion = options.driveProtocolVersion !== undefined + ? options.driveProtocolVersion + : (mappedProtocolVersion !== undefined ? mappedProtocolVersion : latestProtocolVersion); + + const stateRepository = new StateRepository(this.client); + + this.dpp = new DashPlatformProtocol({ + stateRepository, + protocolVersion: driveProtocolVersion, + ...options, + }); + } + + async initialize() { + await this.dpp.initialize(); + } +} diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/StateRepository.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/StateRepository.ts index d663d03fa9e..334aeee344c 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/StateRepository.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/StateRepository.ts @@ -1,6 +1,6 @@ -import DataContract from "@dashevo/dpp/lib/dataContract/DataContract"; -import Identity from "@dashevo/dpp/lib/identity/Identity"; -import Identifier from "@dashevo/dpp/lib/Identifier"; +import DataContract from '@dashevo/dpp/lib/dataContract/DataContract'; +import Identity from '@dashevo/dpp/lib/identity/Identity'; +import Identifier from '@dashevo/dpp/lib/Identifier'; import Client from '../Client'; class StateRepository { @@ -10,14 +10,15 @@ class StateRepository { this.client = client; } - async fetchIdentity(id: Identifier|string): Promise { + async fetchIdentity(id: Identifier | string): Promise { return this.client.platform.identities.get(id); } - async fetchDataContract(identifier: Identifier|string): Promise { + async fetchDataContract(identifier: Identifier | string): Promise { return this.client.platform.contracts.get(identifier); } + // eslint-disable-next-line async isAssetLockTransactionOutPointAlreadyUsed(): Promise { // This check still exists on the client side, however there's no need to // perform the check as in this client we always use a new transaction @@ -25,6 +26,7 @@ class StateRepository { return false; } + // eslint-disable-next-line async verifyInstantLock(): Promise { // verification will be implemented later with DAPI SPV functionality return true; @@ -38,12 +40,13 @@ class StateRepository { return { // @ts-ignore data: transaction.toBuffer(), - // we don't have transaction heights atm and it will be implemented later with DAPI SPV functionality + // we don't have transaction heights atm + // and it will be implemented later with DAPI SPV functionality height: 1, }; } - async fetchLatestPlatformCoreChainLockedHeight(id: string): Promise { + async fetchLatestPlatformCoreChainLockedHeight(): Promise { return this.client.wallet!.transport.getBestBlockHeight(); } } diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/broadcastStateTransition.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/broadcastStateTransition.ts index c3e7aa0c1fd..431cffff2e0 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/broadcastStateTransition.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/broadcastStateTransition.ts @@ -1,7 +1,7 @@ -import crypto from "crypto"; -import { Platform } from "./Platform"; -import { StateTransitionBroadcastError } from "../../../errors/StateTransitionBroadcastError"; -import { IStateTransitionResult } from "./IStateTransitionResult"; +import crypto from 'crypto'; +import { Platform } from './Platform'; +import { StateTransitionBroadcastError } from '../../../errors/StateTransitionBroadcastError'; +import { IStateTransitionResult } from './IStateTransitionResult'; const ResponseError = require('@dashevo/dapi-client/lib/transport/errors/response/ResponseError'); const InvalidRequestDPPError = require('@dashevo/dapi-client/lib/transport/errors/response/InvalidRequestDPPError'); @@ -21,80 +21,81 @@ export default async function broadcastStateTransition( platform: Platform, stateTransition: any, options: { skipValidation?: boolean; } = {}, -): Promise { - const { client, dpp } = platform; +): Promise { + const { client, dpp } = platform; - if (!options.skipValidation) { - const result = await dpp.stateTransition.validateBasic(stateTransition); + if (!options.skipValidation) { + const result = await dpp.stateTransition.validateBasic(stateTransition); - if (!result.isValid()) { - const consensusError = result.getFirstError(); + if (!result.isValid()) { + const consensusError = result.getFirstError(); - throw new StateTransitionBroadcastError( - consensusError.getCode(), - consensusError.message, - consensusError, - ); - } + throw new StateTransitionBroadcastError( + consensusError.getCode(), + consensusError.message, + consensusError, + ); } + } + + // Subscribing to future result + const hash = crypto.createHash('sha256') + .update(stateTransition.toBuffer()) + .digest(); + + const serializedStateTransition = stateTransition.toBuffer(); + + try { + await client.getDAPIClient().platform.broadcastStateTransition(serializedStateTransition); + } catch (error) { + if (error instanceof ResponseError) { + let cause = error; + + // Pass DPP consensus error directly to avoid + // additional wrappers + if (cause instanceof InvalidRequestDPPError) { + cause = cause.getConsensusError(); + } - // Subscribing to future result - const hash = crypto.createHash('sha256') - .update(stateTransition.toBuffer()) - .digest(); - - const serializedStateTransition = stateTransition.toBuffer(); - - try { - await client.getDAPIClient().platform.broadcastStateTransition(serializedStateTransition); - } catch (error) { - if (error instanceof ResponseError) { - let cause = error; - - // Pass DPP consensus error directly to avoid - // additional wrappers - if (cause instanceof InvalidRequestDPPError) { - cause = cause.getConsensusError(); - } - - throw new StateTransitionBroadcastError( - cause.getCode(), - cause.message, - cause, - ); - } - - throw error; + throw new StateTransitionBroadcastError( + cause.getCode(), + cause.message, + cause, + ); } - // Waiting for result to return - const stateTransitionResult: IStateTransitionResult = await client.getDAPIClient().platform.waitForStateTransitionResult(hash, { prove: true }); - - let { error } = stateTransitionResult; - - if (error) { - // Create DAPI response error from gRPC error passed as gRPC response - const grpcError = new GrpcError(error.code, error.message); - // It is important to assign metadata to the error object - // instead of passing it as GrpcError constructor argument - // Otherwise it will be converted to grpc-js metadata - // Which is not compatible with web - grpcError.metadata = error.data; - - let cause = createGrpcTransportError(grpcError); - - // Pass DPP consensus error directly to avoid - // additional wrappers - if (cause instanceof InvalidRequestDPPError) { - cause = cause.getConsensusError(); - } - - throw new StateTransitionBroadcastError( - cause.getCode(), - cause.message, - cause, - ); + throw error; + } + + // Waiting for result to return + const stateTransitionResult: IStateTransitionResult = await client + .getDAPIClient().platform.waitForStateTransitionResult(hash, { prove: true }); + + const { error } = stateTransitionResult; + + if (error) { + // Create DAPI response error from gRPC error passed as gRPC response + const grpcError = new GrpcError(error.code, error.message); + // It is important to assign metadata to the error object + // instead of passing it as GrpcError constructor argument + // Otherwise it will be converted to grpc-js metadata + // Which is not compatible with web + grpcError.metadata = error.data; + + let cause = createGrpcTransportError(grpcError); + + // Pass DPP consensus error directly to avoid + // additional wrappers + if (cause instanceof InvalidRequestDPPError) { + cause = cause.getConsensusError(); } - return stateTransitionResult; + throw new StateTransitionBroadcastError( + cause.getCode(), + cause.message, + cause, + ); + } + + return stateTransitionResult; } diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/createAssetLockTransaction.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/createAssetLockTransaction.ts index a0985c879eb..27c73fb82ea 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/createAssetLockTransaction.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/createAssetLockTransaction.ts @@ -1,66 +1,72 @@ -import { PrivateKey, Transaction } from "@dashevo/dashcore-lib"; -import { utils } from "@dashevo/wallet-lib"; -import { Platform } from "./Platform"; +import { PrivateKey, Transaction } from '@dashevo/dashcore-lib'; +import { utils } from '@dashevo/wallet-lib'; +import { Platform } from './Platform'; // We're creating a new transaction every time and the index is always 0 const ASSET_LOCK_OUTPUT_INDEX = 0; /** - * Creates a funding transaction for the platform identity and returns one-time key to sign the state transition + * Creates a funding transaction for the platform identity + * and returns one-time key to sign the state transition * @param {Platform} this * @param {number} fundingAmount - amount of dash to fund the identity's credits - * @return {Promise<{transaction: Transaction, privateKey: PrivateKey}>} - transaction and one time private key + * @return {Promise<{transaction: Transaction, privateKey: PrivateKey}>} + * - transaction and one time private key * that can be used to sign registration/top-up state transition */ -export async function createAssetLockTransaction(this : Platform, fundingAmount): Promise<{ transaction: Transaction, privateKey: PrivateKey, outputIndex: number }> { - const platform = this; - const account = await platform.client.getWalletAccount(); +export async function createAssetLockTransaction( + this : Platform, + fundingAmount, +): Promise<{ transaction: Transaction, privateKey: PrivateKey, outputIndex: number }> { + const platform = this; + const account = await platform.client.getWalletAccount(); - // @ts-ignore - const assetLockOneTimePrivateKey = new PrivateKey(); - const assetLockOneTimePublicKey = assetLockOneTimePrivateKey.toPublicKey(); + // @ts-ignore + const assetLockOneTimePrivateKey = new PrivateKey(); + const assetLockOneTimePublicKey = assetLockOneTimePrivateKey.toPublicKey(); - const identityAddress = assetLockOneTimePublicKey.toAddress(platform.client.network).toString(); + const identityAddress = assetLockOneTimePublicKey.toAddress(platform.client.network).toString(); - const changeAddress = account.getUnusedAddress('internal').address; + const changeAddress = account.getUnusedAddress('internal').address; - const lockTransaction = new Transaction(undefined); + const lockTransaction = new Transaction(undefined); - const output = { - satoshis: fundingAmount, - address: identityAddress - }; + const output = { + satoshis: fundingAmount, + address: identityAddress, + }; - const utxos = account.getUTXOS(); - const balance = account.getTotalBalance(); + const utxos = account.getUTXOS(); + const balance = account.getTotalBalance(); - if (balance < output.satoshis) { - throw new Error(`Not enough balance (${balance}) to cover burn amount of ${fundingAmount}`); - } + if (balance < output.satoshis) { + throw new Error(`Not enough balance (${balance}) to cover burn amount of ${fundingAmount}`); + } - const selection = utils.coinSelection(utxos, [output]); + const selection = utils.coinSelection(utxos, [output]); - lockTransaction - .from(selection.utxos) - // @ts-ignore - .addBurnOutput(output.satoshis, assetLockOneTimePublicKey._getID()) - .change(changeAddress); + lockTransaction + .from(selection.utxos) + // @ts-ignore + // eslint-disable-next-line + .addBurnOutput(output.satoshis, assetLockOneTimePublicKey._getID()) + .change(changeAddress); - const utxoAddresses = selection.utxos.map((utxo: any) => utxo.address.toString()); + const utxoAddresses = selection.utxos.map((utxo: any) => utxo.address.toString()); - // @ts-ignore - const utxoHDPrivateKey = account.getPrivateKeys(utxoAddresses); + // @ts-ignore + const utxoHDPrivateKey = account.getPrivateKeys(utxoAddresses); - // @ts-ignore - const signingKeys = utxoHDPrivateKey.map((hdprivateKey) => hdprivateKey.privateKey); + // @ts-ignore + const signingKeys = utxoHDPrivateKey.map((hdprivateKey) => hdprivateKey.privateKey); - const transaction = lockTransaction.sign(signingKeys); + const transaction = lockTransaction.sign(signingKeys); - return { - transaction, - privateKey: assetLockOneTimePrivateKey, - outputIndex: ASSET_LOCK_OUTPUT_INDEX, - }; + return { + transaction, + privateKey: assetLockOneTimePrivateKey, + outputIndex: ASSET_LOCK_OUTPUT_INDEX, + }; } export default createAssetLockTransaction; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/create.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/create.ts index 34d78dcccdf..03c04b88d8f 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/create.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/create.ts @@ -1,4 +1,4 @@ -import {Platform} from "../../Platform"; +import { Platform } from '../../Platform'; /** * Create and prepare contracts for the platform @@ -8,10 +8,14 @@ import {Platform} from "../../Platform"; * @param identity - identity * @returns created contracts */ -export async function create(this: Platform, contractDefinitions: any, identity: any): Promise { - await this.initialize(); +export async function create( + this: Platform, + contractDefinitions: any, + identity: any, +): Promise { + await this.initialize(); - return this.dpp.dataContract.create(identity.getId(), contractDefinitions); + return this.dpp.dataContract.create(identity.getId(), contractDefinitions); } export default create; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/get.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/get.spec.ts index d1d868e7efd..b32d03e9264 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/get.spec.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/get.spec.ts @@ -1,32 +1,32 @@ -import {expect} from 'chai'; +import { expect } from 'chai'; +import DataContractFactory from '@dashevo/dpp/lib/dataContract/DataContractFactory'; +import ValidationResult from '@dashevo/dpp/lib/validation/ValidationResult'; +import Identifier from '@dashevo/dpp/lib/Identifier'; import getResponseMetadataFixture from '../../../../../test/fixtures/getResponseMetadataFixture'; -import get from "./get"; -import identitiesFixtures from "../../../../../../tests/fixtures/identities.json"; -import contractsFixtures from "../../../../../../tests/fixtures/contracts.json"; -import DataContractFactory from "@dashevo/dpp/lib/dataContract/DataContractFactory"; -import ValidationResult from "@dashevo/dpp/lib/validation/ValidationResult"; -import Identifier from "@dashevo/dpp/lib/Identifier"; +import get from './get'; +import identitiesFixtures from '../../../../../../tests/fixtures/identities.json'; +import contractsFixtures from '../../../../../../tests/fixtures/contracts.json'; import 'mocha'; -import { ClientApps } from "../../../ClientApps"; -const GetDataContractResponse = require("@dashevo/dapi-client/lib/methods/platform/getDataContract/GetDataContractResponse"); +import { ClientApps } from '../../../ClientApps'; + +const GetDataContractResponse = require('@dashevo/dapi-client/lib/methods/platform/getDataContract/GetDataContractResponse'); const NotFoundError = require('@dashevo/dapi-client/lib/transport/GrpcTransport/errors/NotFoundError'); const factory = new DataContractFactory( - undefined, - () => { - return new ValidationResult(); - }, - () => [42, contractsFixtures.ratePlatform]); + undefined, + () => new ValidationResult(), + () => [42, contractsFixtures.ratePlatform], +); const dpp = { - dataContract: factory, - getProtocolVersion: () => 42, -} + dataContract: factory, + getProtocolVersion: () => 42, +}; factory.dpp = dpp; const apps = new ClientApps({ - ratePlatform: { - contractId: contractsFixtures.ratePlatform.$id - }, + ratePlatform: { + contractId: contractsFixtures.ratePlatform.$id, + }, }); let client; let askedFromDapi; @@ -34,67 +34,72 @@ let initialize; let metadataFixture; describe('Client - Platform - Contracts - .get()', () => { - before(function before() { - metadataFixture = getResponseMetadataFixture(); - askedFromDapi = 0; - const getDataContract = async (id) => { - const fixtureIdentifier = Identifier.from(contractsFixtures.ratePlatform.$id); - askedFromDapi += 1; - - if (id.equals(fixtureIdentifier)) { - const contract = await dpp.dataContract.createFromObject(contractsFixtures.ratePlatform); - return new GetDataContractResponse(contract.toBuffer(), metadataFixture); - } + before(function before() { + metadataFixture = getResponseMetadataFixture(); + askedFromDapi = 0; + const getDataContract = async (id) => { + const fixtureIdentifier = Identifier.from(contractsFixtures.ratePlatform.$id); + askedFromDapi += 1; - throw new NotFoundError(); - }; + if (id.equals(fixtureIdentifier)) { + const contract = await dpp.dataContract.createFromObject(contractsFixtures.ratePlatform); + return new GetDataContractResponse(contract.toBuffer(), metadataFixture); + } - client = { - getDAPIClient: () => { - return { - platform: { - getDataContract - } - }; - }, - getApps(): ClientApps { - return apps - } - }; + throw new NotFoundError(); + }; - initialize = this.sinon.stub(); - }); + client = { + getDAPIClient: () => ({ + platform: { + getDataContract, + }, + }), + getApps(): ClientApps { + return apps; + }, + }; - describe('get a contract from string', () => { - it('should get from DAPIClient if there is none locally', async function () { + initialize = this.sinon.stub(); + }); - // @ts-ignore - const contract = await get.call({apps, dpp, client, initialize}, contractsFixtures.ratePlatform.$id); - expect(contract.toJSON()).to.deep.equal(contractsFixtures.ratePlatform); - expect(contract.getMetadata().getBlockHeight()).to.equal(10); - expect(contract.getMetadata().getCoreChainLockedHeight()).to.equal(42); - expect(contract.getMetadata().getTimeMs()).to.equal(metadataFixture.getTimeMs()); - expect(contract.getMetadata().getProtocolVersion()).to.equal(metadataFixture.getProtocolVersion()); - expect(askedFromDapi).to.equal(1); - }); + describe('get a contract from string', () => { + it('should get from DAPIClient if there is none locally', async () => { + const contract = await get.call({ + // @ts-ignore + apps, dpp, client, initialize, + }, contractsFixtures.ratePlatform.$id); + expect(contract.toJSON()).to.deep.equal(contractsFixtures.ratePlatform); + expect(contract.getMetadata().getBlockHeight()).to.equal(10); + expect(contract.getMetadata().getCoreChainLockedHeight()).to.equal(42); + expect(contract.getMetadata().getTimeMs()).to.equal(metadataFixture.getTimeMs()); + expect(contract.getMetadata().getProtocolVersion()) + .to.equal(metadataFixture.getProtocolVersion()); + expect(askedFromDapi).to.equal(1); + }); - it('should get from local when already fetched once', async function () { - // @ts-ignore - const contract = await get.call({apps, dpp, client, initialize}, contractsFixtures.ratePlatform.$id); - expect(contract.toJSON()).to.deep.equal(contractsFixtures.ratePlatform); - expect(contract.getMetadata().getBlockHeight()).to.equal(10); - expect(contract.getMetadata().getCoreChainLockedHeight()).to.equal(42); - expect(contract.getMetadata().getTimeMs()).to.equal(metadataFixture.getTimeMs()); - expect(contract.getMetadata().getProtocolVersion()).to.equal(metadataFixture.getProtocolVersion()); - expect(askedFromDapi).to.equal(1); - }); - }) + it('should get from local when already fetched once', async () => { + const contract = await get.call({ + // @ts-ignore + apps, dpp, client, initialize, + }, contractsFixtures.ratePlatform.$id); + expect(contract.toJSON()).to.deep.equal(contractsFixtures.ratePlatform); + expect(contract.getMetadata().getBlockHeight()).to.equal(10); + expect(contract.getMetadata().getCoreChainLockedHeight()).to.equal(42); + expect(contract.getMetadata().getTimeMs()).to.equal(metadataFixture.getTimeMs()); + expect(contract.getMetadata().getProtocolVersion()) + .to.equal(metadataFixture.getProtocolVersion()); + expect(askedFromDapi).to.equal(1); + }); + }); - describe('other conditions', () => { - it('should deal when contract do not exist', async function () { - // @ts-ignore - const contract = await get.call({apps, dpp, client, initialize}, identitiesFixtures.bob.id); - expect(contract).to.equal(null); - }); + describe('other conditions', () => { + it('should deal when contract do not exist', async () => { + const contract = await get.call({ + // @ts-ignore + apps, dpp, client, initialize, + }, identitiesFixtures.bob.id); + expect(contract).to.equal(null); }); + }); }); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/get.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/get.ts index 3fa63b86b6a..0fc1679940b 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/get.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/get.ts @@ -1,8 +1,8 @@ -import {Platform} from "../../Platform"; - // @ts-ignore -import Identifier from "@dashevo/dpp/lib/Identifier"; -import Metadata from "@dashevo/dpp/lib/Metadata"; +import Identifier from '@dashevo/dpp/lib/Identifier'; +import Metadata from '@dashevo/dpp/lib/Metadata'; +import { Platform } from '../../Platform'; + const NotFoundError = require('@dashevo/dapi-client/lib/transport/GrpcTransport/errors/NotFoundError'); declare type ContractIdentifier = string | Identifier; @@ -15,54 +15,56 @@ declare type ContractIdentifier = string | Identifier; * @returns contracts */ export async function get(this: Platform, identifier: ContractIdentifier): Promise { - await this.initialize(); + await this.initialize(); - const contractId : Identifier = Identifier.from(identifier); + const contractId : Identifier = Identifier.from(identifier); - // Try to get contract from the cache - for (const appName of this.client.getApps().getNames()) { - const appDefinition = this.client.getApps().get(appName); - if (appDefinition.contractId.equals(contractId) && appDefinition.contract) { - return appDefinition.contract; - } + // Try to get contract from the cache + // eslint-disable-next-line + for (const appName of this.client.getApps().getNames()) { + const appDefinition = this.client.getApps().get(appName); + if (appDefinition.contractId.equals(contractId) && appDefinition.contract) { + return appDefinition.contract; } + } - // Fetch contract otherwise - let dataContractResponse; - try { - dataContractResponse = await this.client.getDAPIClient().platform.getDataContract(contractId); - } catch (e) { - if (e instanceof NotFoundError) { - return null; - } - - throw e; + // Fetch contract otherwise + let dataContractResponse; + try { + dataContractResponse = await this.client.getDAPIClient().platform.getDataContract(contractId); + } catch (e) { + if (e instanceof NotFoundError) { + return null; } - const contract = await this.dpp.dataContract.createFromBuffer(dataContractResponse.getDataContract()); + throw e; + } - let metadata = null; - const responseMetadata = dataContractResponse.getMetadata(); - if (responseMetadata) { - metadata = new Metadata({ - blockHeight: responseMetadata.getHeight(), - coreChainLockedHeight: responseMetadata.getCoreChainLockedHeight(), - timeMs: responseMetadata.getTimeMs(), - protocolVersion: responseMetadata.getProtocolVersion(), - }); - } - contract.setMetadata(metadata); + const contract = await this.dpp.dataContract + .createFromBuffer(dataContractResponse.getDataContract()); - // Store contract to the cache + let metadata = null; + const responseMetadata = dataContractResponse.getMetadata(); + if (responseMetadata) { + metadata = new Metadata({ + blockHeight: responseMetadata.getHeight(), + coreChainLockedHeight: responseMetadata.getCoreChainLockedHeight(), + timeMs: responseMetadata.getTimeMs(), + protocolVersion: responseMetadata.getProtocolVersion(), + }); + } + contract.setMetadata(metadata); - for (const appName of this.client.getApps().getNames()) { - const appDefinition = this.client.getApps().get(appName); - if (appDefinition.contractId.equals(contractId)) { - appDefinition.contract = contract; - } + // Store contract to the cache + // eslint-disable-next-line + for (const appName of this.client.getApps().getNames()) { + const appDefinition = this.client.getApps().get(appName); + if (appDefinition.contractId.equals(contractId)) { + appDefinition.contract = contract; } + } - return contract; + return contract; } export default get; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/publish.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/publish.ts index 0c788fbacbf..5adc34a586b 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/publish.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/publish.ts @@ -1,6 +1,6 @@ -import { Platform } from "../../Platform"; -import broadcastStateTransition from "../../broadcastStateTransition"; -import { signStateTransition } from "../../signStateTransition"; +import { Platform } from '../../Platform'; +import broadcastStateTransition from '../../broadcastStateTransition'; +import { signStateTransition } from '../../signStateTransition'; /** * Publish contract onto the platform @@ -10,15 +10,20 @@ import { signStateTransition } from "../../signStateTransition"; * @param identity - identity * @return {DataContractCreateTransition} */ -export default async function publish(this: Platform, dataContract: any, identity: any): Promise { - await this.initialize(); +export default async function publish( + this: Platform, + dataContract: any, + identity: any, +): Promise { + await this.initialize(); - const { dpp } = this; + const { dpp } = this; - const dataContractCreateTransition = dpp.dataContract.createDataContractCreateTransition(dataContract); + const dataContractCreateTransition = dpp.dataContract + .createDataContractCreateTransition(dataContract); - await signStateTransition(this, dataContractCreateTransition, identity, 1); - await broadcastStateTransition(this, dataContractCreateTransition); + await signStateTransition(this, dataContractCreateTransition, identity, 1); + await broadcastStateTransition(this, dataContractCreateTransition); - return dataContractCreateTransition; + return dataContractCreateTransition; } diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/update.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/update.ts index 37be2e94b45..30796dfd472 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/update.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/contracts/update.ts @@ -1,6 +1,6 @@ -import { Platform } from "../../Platform"; -import broadcastStateTransition from "../../broadcastStateTransition"; -import { signStateTransition } from "../../signStateTransition"; +import { Platform } from '../../Platform'; +import broadcastStateTransition from '../../broadcastStateTransition'; +import { signStateTransition } from '../../signStateTransition'; /** * Publish contract onto the platform @@ -10,7 +10,11 @@ import { signStateTransition } from "../../signStateTransition"; * @param identity - identity * @return {DataContractUpdateTransition} */ -export default async function update(this: Platform, dataContract: any, identity: any): Promise { +export default async function update( + this: Platform, + dataContract: any, + identity: any, +): Promise { await this.initialize(); const { dpp } = this; @@ -22,12 +26,14 @@ export default async function update(this: Platform, dataContract: any, identity updatedDataContract.incrementVersion(); - const dataContractUpdateTransition = dpp.dataContract.createDataContractUpdateTransition(updatedDataContract); + const dataContractUpdateTransition = dpp.dataContract + .createDataContractUpdateTransition(updatedDataContract); await signStateTransition(this, dataContractUpdateTransition, identity, 1); await broadcastStateTransition(this, dataContractUpdateTransition); // Update app with updated data contract if available + // eslint-disable-next-line for (const appName of this.client.getApps().getNames()) { const appDefinition = this.client.getApps().get(appName); if (appDefinition.contractId.equals(updatedDataContract.getId()) && appDefinition.contract) { diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/broadcast.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/broadcast.ts index aef6f48734d..1dc9d773a8c 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/broadcast.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/broadcast.ts @@ -1,7 +1,7 @@ -import { Platform } from "../../Platform"; -import broadcastStateTransition from '../../broadcastStateTransition'; import Document from '@dashevo/dpp/lib/document/Document'; -import { signStateTransition } from "../../signStateTransition"; +import { Platform } from '../../Platform'; +import broadcastStateTransition from '../../broadcastStateTransition'; +import { signStateTransition } from '../../signStateTransition'; /** * Broadcast document onto the platform @@ -13,17 +13,21 @@ import { signStateTransition } from "../../signStateTransition"; * @param {Document[]} [documents.delete] * @param identity - identity */ -export default async function broadcast(this: Platform, documents: { create?: Document[], replace?: Document[], delete?: Document[]}, identity: any): Promise { - await this.initialize(); +export default async function broadcast( + this: Platform, + documents: { create?: Document[], replace?: Document[], delete?: Document[] }, + identity: any, +): Promise { + await this.initialize(); - const { dpp } = this; + const { dpp } = this; - const documentsBatchTransition = dpp.document.createStateTransition(documents); + const documentsBatchTransition = dpp.document.createStateTransition(documents); - await signStateTransition(this, documentsBatchTransition, identity, 1); + await signStateTransition(this, documentsBatchTransition, identity, 1); - // Broadcast state transition also wait for the result to be obtained - await broadcastStateTransition(this, documentsBatchTransition); + // Broadcast state transition also wait for the result to be obtained + await broadcastStateTransition(this, documentsBatchTransition); - return documentsBatchTransition; + return documentsBatchTransition; } diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/create.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/create.ts index 3a1883ca9e7..527ce19aa75 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/create.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/create.ts @@ -1,7 +1,7 @@ -import {Platform} from "../../Platform"; +import { Platform } from '../../Platform'; -declare interface createOpts { - [name:string]: any; +declare interface CreateOpts { + [name:string]: any; } /** @@ -12,30 +12,36 @@ declare interface createOpts { * @param identity - identity * @param {Object} [data] - options */ -export async function create(this: Platform, typeLocator: string, identity: any, data: createOpts = {}): Promise { - await this.initialize(); +export async function create( + this: Platform, + typeLocator: string, + identity: any, + data: CreateOpts = {}, +): Promise { + await this.initialize(); - const { dpp } = this; + const { dpp } = this; - const appNames = this.client.getApps().getNames(); + const appNames = this.client.getApps().getNames(); - //We can either provide of type `dashpay.profile` or if only one schema provided, of type `profile`. - const [appName, fieldType] = (typeLocator.includes('.')) ? typeLocator.split('.') : [appNames[0], typeLocator]; + // We can either provide of type `dashpay.profile` + // or if only one schema provided, of type `profile`. + const [appName, fieldType] = (typeLocator.includes('.')) ? typeLocator.split('.') : [appNames[0], typeLocator]; - const { contractId } = this.client.getApps().get(appName); + const { contractId } = this.client.getApps().get(appName); - const dataContract = await this.contracts.get(contractId); + const dataContract = await this.contracts.get(contractId); - if (dataContract === null) { - throw new Error(`Contract ${appName} not found. Ensure contractId ${contractId} is correct.`) - } + if (dataContract === null) { + throw new Error(`Contract ${appName} not found. Ensure contractId ${contractId} is correct.`); + } - return dpp.document.create( - dataContract, - identity.getId(), - fieldType, - data, - ); + return dpp.document.create( + dataContract, + identity.getId(), + fieldType, + data, + ); } export default create; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/get.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/get.spec.ts index 71174e85905..b8d145d9f49 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/get.spec.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/get.spec.ts @@ -2,11 +2,12 @@ import getDataContractFixture from '@dashevo/dpp/lib/test/fixtures/getDataContra import generateRandomIdentifier from '@dashevo/dpp/lib/test/utils/generateRandomIdentifier'; import createDPPMock from '@dashevo/dpp/lib/test/mocks/createDPPMock'; import getDocumentsFixture from '@dashevo/dpp/lib/test/fixtures/getDocumentsFixture'; +import { expect } from 'chai'; import getResponseMetadataFixture from '../../../../../test/fixtures/getResponseMetadataFixture'; -const GetDocumentsResponse = require("@dashevo/dapi-client/lib/methods/platform/getDocuments/GetDocumentsResponse"); import get from './get'; -import { expect } from 'chai'; + +const GetDocumentsResponse = require('@dashevo/dapi-client/lib/methods/platform/getDocuments/GetDocumentsResponse'); describe('Client - Platform - Documents - .get()', () => { let platform; @@ -23,7 +24,8 @@ describe('Client - Platform - Documents - .get()', () => { contract: dataContract, }; - getDocumentsMock = this.sinon.stub().resolves(new GetDocumentsResponse([], getResponseMetadataFixture())); + getDocumentsMock = this.sinon.stub() + .resolves(new GetDocumentsResponse([], getResponseMetadataFixture())); appsGetMock = this.sinon.stub().returns(appDefinition); platform = { @@ -37,7 +39,7 @@ describe('Client - Platform - Documents - .get()', () => { platform: { getDocuments: getDocumentsMock, }, - }) + }), }, initialize: this.sinon.stub(), }; @@ -129,9 +131,9 @@ describe('Client - Platform - Documents - .get()', () => { type: 'object', properties: { idField: { - type: "array", + type: 'array', byteArray: true, - contentMediaType: "application/x.dash.dpp.identifier", + contentMediaType: 'application/x.dash.dpp.identifier', minItems: 32, maxItems: 32, }, @@ -139,9 +141,9 @@ describe('Client - Platform - Documents - .get()', () => { type: 'object', properties: { anotherIdField: { - type: "array", + type: 'array', byteArray: true, - contentMediaType: "application/x.dash.dpp.identifier", + contentMediaType: 'application/x.dash.dpp.identifier', minItems: 32, maxItems: 32, }, @@ -161,7 +163,7 @@ describe('Client - Platform - Documents - .get()', () => { await get.call(platform, 'app.withByteArrays', { where: [ ['nestedObject', 'elementMatch', ['idField', '==', id.toString()]], - ['nestedObject', 'elementMatch', ['anotherNested', 'elementMatch', ['anotherIdField', '==', id.toString()]]] + ['nestedObject', 'elementMatch', ['anotherNested', 'elementMatch', ['anotherIdField', '==', id.toString()]]], ], }); @@ -171,7 +173,7 @@ describe('Client - Platform - Documents - .get()', () => { { where: [ ['nestedObject', 'elementMatch', ['idField', '==', id]], - ['nestedObject', 'elementMatch', ['anotherNested', 'elementMatch', ['anotherIdField', '==', id]]] + ['nestedObject', 'elementMatch', ['anotherNested', 'elementMatch', ['anotherIdField', '==', id]]], ], }, ]); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/get.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/get.ts index a6b125dc92f..d1a59000617 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/get.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/documents/get.ts @@ -1,8 +1,8 @@ import Identifier from '@dashevo/dpp/lib/Identifier'; -import Metadata from "@dashevo/dpp/lib/Metadata"; +import Metadata from '@dashevo/dpp/lib/Metadata'; import Document from '@dashevo/dpp/lib/document/Document'; -import {Platform} from "../../Platform"; +import { Platform } from '../../Platform'; /** * @param {WhereCondition[]} [where] - where @@ -11,24 +11,24 @@ import {Platform} from "../../Platform"; * @param {string|Buffer|Document|Identifier} [startAt] - start value (included) * @param {string|Buffer|Document|Identifier} [startAfter] - start value (not included) */ -declare interface fetchOpts { - where?: WhereCondition[]; - orderBy?: OrderByCondition[]; - limit?: number; - startAt?: string|Buffer|Document|Identifier; - startAfter?: string|Buffer|Document|Identifier; +declare interface FetchOpts { + where?: WhereCondition[]; + orderBy?: OrderByCondition[]; + limit?: number; + startAt?: string | Buffer | Document | Identifier; + startAfter?: string | Buffer | Document | Identifier; } type OrderByCondition = [ - string, - 'asc' | 'desc', + string, + 'asc' | 'desc', ]; type WhereCondition = [ - string, - '<' | '<=' | '==' | '>' | '>=' | 'in' | 'startsWith' | 'elementMatch' | 'length' | 'contains', - WhereCondition|any, -] + string, + '<' | '<=' | '==' | '>' | '>=' | 'in' | 'startsWith' | 'elementMatch' | 'length' | 'contains', + WhereCondition | any, +]; /** * Prefetch contract @@ -37,14 +37,14 @@ type WhereCondition = [ * @param {string} appName of the contract to fetch */ const ensureAppContractFetched = async function (this: Platform, appName) { - if (this.client.getApps().has(appName)) { - const appDefinition = this.client.getApps().get(appName); + if (this.client.getApps().has(appName)) { + const appDefinition = this.client.getApps().get(appName); - if (!appDefinition.contract) { - await this.contracts.get(appDefinition.contractId); - } + if (!appDefinition.contract) { + await this.contracts.get(appDefinition.contractId); } -} + } +}; /** * Convert where condition identifier properties @@ -55,35 +55,39 @@ const ensureAppContractFetched = async function (this: Platform, appName) { * * @return {WhereCondition} */ -function convertIdentifierProperties(whereCondition: WhereCondition, binaryProperties: Record, parentProperty: null|string = null) { - const [propertyName, operator, propertyValue] = whereCondition; - - const fullPropertyName = parentProperty ? `${parentProperty}.${propertyName}`: propertyName; - - if (operator === 'elementMatch') { - return [ - propertyName, - operator, - convertIdentifierProperties( - propertyValue, - binaryProperties, - fullPropertyName, - ), - ]; - } - - let convertedPropertyValue = propertyValue; - - const property = binaryProperties[fullPropertyName]; - - const isPropertyIdentifier = property && property.contentMediaType === Identifier.MEDIA_TYPE; - const isSystemIdentifier = ['$id', '$ownerId'].includes(propertyName); - - if (isSystemIdentifier || (isPropertyIdentifier && typeof propertyValue === 'string')) { - convertedPropertyValue = Identifier.from(propertyValue); - } - - return [propertyName, operator, convertedPropertyValue]; +function convertIdentifierProperties( + whereCondition: WhereCondition, + binaryProperties: Record, + parentProperty: null | string = null, +) { + const [propertyName, operator, propertyValue] = whereCondition; + + const fullPropertyName = parentProperty ? `${parentProperty}.${propertyName}` : propertyName; + + if (operator === 'elementMatch') { + return [ + propertyName, + operator, + convertIdentifierProperties( + propertyValue, + binaryProperties, + fullPropertyName, + ), + ]; + } + + let convertedPropertyValue = propertyValue; + + const property = binaryProperties[fullPropertyName]; + + const isPropertyIdentifier = property && property.contentMediaType === Identifier.MEDIA_TYPE; + const isSystemIdentifier = ['$id', '$ownerId'].includes(propertyName); + + if (isSystemIdentifier || (isPropertyIdentifier && typeof propertyValue === 'string')) { + convertedPropertyValue = Identifier.from(propertyValue); + } + + return [propertyName, operator, convertedPropertyValue]; } /** @@ -91,77 +95,80 @@ function convertIdentifierProperties(whereCondition: WhereCondition, binaryPrope * * @param {Platform} this bound instance class * @param {string} typeLocator type locator - * @param {fetchOpts} opts - MongoDB style query + * @param {FetchOpts} opts - MongoDB style query * @returns documents */ -export async function get(this: Platform, typeLocator: string, opts: fetchOpts): Promise { - if (!typeLocator.includes('.')) throw new Error('Accessing to field is done using format: appName.fieldName'); - - await this.initialize(); - - // locator is of `dashpay.profile` with dashpay the app and profile the field. - const [appName, fieldType] = typeLocator.split('.'); - // FIXME: we may later want a hashmap of schemas and contract IDs - - if (!this.client.getApps().has(appName)) { - throw new Error(`No app named ${appName} specified.`) - } - - const appDefinition = this.client.getApps().get(appName); - - if (!appDefinition.contractId) { - throw new Error(`Missing contract ID for ${appName}`) - } - - // If not present, will fetch contract based on appName and contractId store in this.apps. - await ensureAppContractFetched.call(this, appName); - - if (opts.where) { - const binaryProperties = appDefinition.contract.getBinaryProperties(fieldType); - - opts.where = opts.where.map((whereCondition) => convertIdentifierProperties(whereCondition, binaryProperties)); - } - - if (opts.startAt instanceof Document) { - opts.startAt = opts.startAt.getId(); - } else if (typeof opts.startAt === 'string') { - opts.startAt = Identifier.from(opts.startAt); - } - - if (opts.startAfter instanceof Document) { - opts.startAfter = opts.startAfter.getId(); - } else if (typeof opts.startAfter === 'string') { - opts.startAfter = Identifier.from(opts.startAfter); - } - - // @ts-ignore - const documentsResponse = await this.client.getDAPIClient().platform.getDocuments( - appDefinition.contractId, - fieldType, - opts - ); - - const rawDocuments = documentsResponse.getDocuments(); - - return Promise.all( - rawDocuments.map(async (rawDocument) => { - const document = await this.dpp.document.createFromBuffer(rawDocument); - - let metadata = null; - const responseMetadata = documentsResponse.getMetadata(); - if (responseMetadata) { - metadata = new Metadata({ - blockHeight: responseMetadata.getHeight(), - coreChainLockedHeight: responseMetadata.getCoreChainLockedHeight(), - timeMs: responseMetadata.getTimeMs(), - protocolVersion: responseMetadata.getProtocolVersion(), - }); - } - document.setMetadata(metadata); - - return document; - }), - ); +export async function get(this: Platform, typeLocator: string, opts: FetchOpts): Promise { + if (!typeLocator.includes('.')) throw new Error('Accessing to field is done using format: appName.fieldName'); + + await this.initialize(); + + // locator is of `dashpay.profile` with dashpay the app and profile the field. + const [appName, fieldType] = typeLocator.split('.'); + // FIXME: we may later want a hashmap of schemas and contract IDs + + if (!this.client.getApps().has(appName)) { + throw new Error(`No app named ${appName} specified.`); + } + + const appDefinition = this.client.getApps().get(appName); + + if (!appDefinition.contractId) { + throw new Error(`Missing contract ID for ${appName}`); + } + + // If not present, will fetch contract based on appName and contractId store in this.apps. + await ensureAppContractFetched.call(this, appName); + + if (opts.where) { + const binaryProperties = appDefinition.contract.getBinaryProperties(fieldType); + + opts.where = opts.where + .map((whereCondition) => convertIdentifierProperties( + whereCondition, binaryProperties, + )); + } + + if (opts.startAt instanceof Document) { + opts.startAt = opts.startAt.getId(); + } else if (typeof opts.startAt === 'string') { + opts.startAt = Identifier.from(opts.startAt); + } + + if (opts.startAfter instanceof Document) { + opts.startAfter = opts.startAfter.getId(); + } else if (typeof opts.startAfter === 'string') { + opts.startAfter = Identifier.from(opts.startAfter); + } + + // @ts-ignore + const documentsResponse = await this.client.getDAPIClient().platform.getDocuments( + appDefinition.contractId, + fieldType, + opts, + ); + + const rawDocuments = documentsResponse.getDocuments(); + + return Promise.all( + rawDocuments.map(async (rawDocument) => { + const document = await this.dpp.document.createFromBuffer(rawDocument); + + let metadata = null; + const responseMetadata = documentsResponse.getMetadata(); + if (responseMetadata) { + metadata = new Metadata({ + blockHeight: responseMetadata.getHeight(), + coreChainLockedHeight: responseMetadata.getCoreChainLockedHeight(), + timeMs: responseMetadata.getTimeMs(), + protocolVersion: responseMetadata.getProtocolVersion(), + }); + } + document.setMetadata(metadata); + + return document; + }), + ); } export default get; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/get.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/get.ts index b83f647e172..ac2c7181982 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/get.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/get.ts @@ -1,7 +1,8 @@ -import {Platform} from "../../Platform"; // @ts-ignore -import Identifier from "@dashevo/dpp/lib/Identifier"; -import Metadata from "@dashevo/dpp/lib/Metadata"; +import Identifier from '@dashevo/dpp/lib/Identifier'; +import Metadata from '@dashevo/dpp/lib/Metadata'; +import { Platform } from '../../Platform'; + const NotFoundError = require('@dashevo/dapi-client/lib/transport/GrpcTransport/errors/NotFoundError'); /** @@ -11,38 +12,38 @@ const NotFoundError = require('@dashevo/dapi-client/lib/transport/GrpcTransport/ * @param {string|Identifier} id - id * @returns Identity */ -export async function get(this: Platform, id: Identifier|string): Promise { - await this.initialize(); - - const identifier = Identifier.from(id); +export async function get(this: Platform, id: Identifier | string): Promise { + await this.initialize(); - let identityResponse; - try { - identityResponse = await this.client.getDAPIClient().platform.getIdentity(identifier); - } catch (e) { - if (e instanceof NotFoundError) { - return null; - } + const identifier = Identifier.from(id); - throw e; + let identityResponse; + try { + identityResponse = await this.client.getDAPIClient().platform.getIdentity(identifier); + } catch (e) { + if (e instanceof NotFoundError) { + return null; } - const identity = this.dpp.identity.createFromBuffer(identityResponse.getIdentity()); - - let metadata = null; - const responseMetadata = identityResponse.getMetadata(); - if (responseMetadata) { - metadata = new Metadata({ - blockHeight: responseMetadata.getHeight(), - coreChainLockedHeight: responseMetadata.getCoreChainLockedHeight(), - timeMs: responseMetadata.getTimeMs(), - protocolVersion: responseMetadata.getProtocolVersion(), - }); - } + throw e; + } + + const identity = this.dpp.identity.createFromBuffer(identityResponse.getIdentity()); + + let metadata = null; + const responseMetadata = identityResponse.getMetadata(); + if (responseMetadata) { + metadata = new Metadata({ + blockHeight: responseMetadata.getHeight(), + coreChainLockedHeight: responseMetadata.getCoreChainLockedHeight(), + timeMs: responseMetadata.getTimeMs(), + protocolVersion: responseMetadata.getProtocolVersion(), + }); + } - identity.setMetadata(metadata); + identity.setMetadata(metadata); - return identity; + return identity; } export default get; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.ts index 4f9ffa321de..d88513567ec 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.ts @@ -1,123 +1,127 @@ -import { Transaction } from "@dashevo/dashcore-lib"; -import { Platform } from "../../../Platform"; +import { Transaction } from '@dashevo/dashcore-lib'; +import { Platform } from '../../../Platform'; const { InstantLockTimeoutError, TxMetadataTimeoutError } = require('@dashevo/wallet-lib/src/errors'); /** - * Creates a funding transaction for the platform identity and returns one-time key to sign the state transition + * Creates a funding transaction for the platform identity + * and returns one-time key to sign the state transition * @param {Platform} this * @param {Transaction} assetLockTransaction * @param {number} outputIndex - index of the funding output in the asset lock transaction * @return {AssetLockProof} - asset lock proof to be used in the state transition * that can be used to sign registration/top-up state transition */ -export async function createAssetLockProof(this : Platform, assetLockTransaction: Transaction, outputIndex: number): Promise { - const platform = this; - await platform.initialize(); - - const account = await platform.client.getWalletAccount(); - const { dpp } = platform; - - // Create poof that the transaction won't be double spend - - const { - promise: instantLockPromise, - cancel: cancelInstantLock - } = account.waitForInstantLock(assetLockTransaction.hash); - - const { - promise: txMetadataPromise, - cancel: cancelTxMetadata, - } = account.waitForTxMetadata(assetLockTransaction.hash); - - let cancelObtainCoreChainLockedHeight; - - let rejectTimer; - - // @ts-ignore - const rejectionTimeout = account.waitForTxMetadataTimeout > account.waitForInstantLockTimeout - // @ts-ignore - ? account.waitForTxMetadataTimeout + 360000 // wait for platform to sync core chain locked height +export async function createAssetLockProof( + this : Platform, + assetLockTransaction: Transaction, + outputIndex: number, +): Promise { + const platform = this; + await platform.initialize(); + + const account = await platform.client.getWalletAccount(); + const { dpp } = platform; + + // Create poof that the transaction won't be double spend + + const { + promise: instantLockPromise, + cancel: cancelInstantLock, + } = account.waitForInstantLock(assetLockTransaction.hash); + + const { + promise: txMetadataPromise, + cancel: cancelTxMetadata, + } = account.waitForTxMetadata(assetLockTransaction.hash); + + let cancelObtainCoreChainLockedHeight; + + let rejectTimer; + + // @ts-ignore + const rejectionTimeout = account.waitForTxMetadataTimeout > account.waitForInstantLockTimeout + // wait for platform to sync core chain locked height + // @ts-ignore + ? account.waitForTxMetadataTimeout + 360000 + // @ts-ignore + : account.waitForInstantLockTimeout; + + return Promise.race([ + // Wait for Instant Lock + instantLockPromise + .then((instantLock) => { + clearTimeout(rejectTimer); + + cancelTxMetadata(); + + if (cancelObtainCoreChainLockedHeight) { + cancelObtainCoreChainLockedHeight(); + } + + // @ts-ignore + return dpp.identity.createInstantAssetLockProof( + instantLock, + assetLockTransaction, + outputIndex, + ); + }) + .catch((error) => { + if (error instanceof InstantLockTimeoutError) { + // Instant Lock is timed out. + // Allow chain proof to win the race + return new Promise(() => {}); + } + + return Promise.reject(error); + }), + + // Wait for transaction is mined and platform chain synced core height to the transaction height + txMetadataPromise + .then((assetLockMetadata) => platform.identities.utils // @ts-ignore - : account.waitForInstantLockTimeout; + .waitForCoreChainLockedHeight(assetLockMetadata.height) + .then(({ promise, cancel }) => { + cancelObtainCoreChainLockedHeight = cancel; - return Promise.race([ - // Wait for Instant Lock - instantLockPromise - .then((instantLock) => { + return promise; + }) + .then(() => { clearTimeout(rejectTimer); - - cancelTxMetadata(); - - if (cancelObtainCoreChainLockedHeight) { - cancelObtainCoreChainLockedHeight(); - } + cancelInstantLock(); // @ts-ignore - return dpp.identity.createInstantAssetLockProof( - instantLock, - assetLockTransaction, - outputIndex, - ); - }) - .catch((error) => { - if (error instanceof InstantLockTimeoutError) { - // Instant Lock is timed out. - // Allow chain proof to win the race - return new Promise(() => {}); - } - - return Promise.reject(error); - }), - - // Wait for transaction is mined and platform chain synced core height to the transaction height - txMetadataPromise - .then((assetLockMetadata) => { - return platform.identities.utils + return dpp.identity.createChainAssetLockProof( // @ts-ignore - .waitForCoreChainLockedHeight(assetLockMetadata.height) - .then(({ promise, cancel }) => { - cancelObtainCoreChainLockedHeight = cancel; - - return promise; - }) - .then(() => { - clearTimeout(rejectTimer); - cancelInstantLock(); - - // @ts-ignore - return dpp.identity.createChainAssetLockProof( - // @ts-ignore - assetLockMetadata.height, - assetLockTransaction.getOutPointBuffer(outputIndex), - ); - }) - }) - .catch((error) => { - if (error instanceof TxMetadataTimeoutError) { - // Instant Lock is timed out. - // Allow instant proof to win the race - return new Promise(() => {}); - } - - return Promise.reject(error); - }), - - // Common timeout for getting proofs - new Promise((_, reject) => { - rejectTimer = setTimeout(() => { - cancelTxMetadata(); - - if (cancelObtainCoreChainLockedHeight) { - cancelObtainCoreChainLockedHeight(); - } - - cancelInstantLock(); - - reject(new Error('Asset Lock Proof creation timeout')); - }, rejectionTimeout) - }) - ]); + assetLockMetadata.height, + assetLockTransaction.getOutPointBuffer(outputIndex), + ); + })) + .catch((error) => { + if (error instanceof TxMetadataTimeoutError) { + // Instant Lock is timed out. + // Allow instant proof to win the race + return new Promise(() => {}); + } + + return Promise.reject(error); + }), + + // Common timeout for getting proofs + new Promise((_, reject) => { + rejectTimer = setTimeout(() => { + cancelTxMetadata(); + + if (cancelObtainCoreChainLockedHeight) { + cancelObtainCoreChainLockedHeight(); + } + + cancelInstantLock(); + + reject(new Error('Asset Lock Proof creation timeout')); + }, rejectionTimeout); + }), + ]); } export default createAssetLockProof; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts index 12e539da74a..a9b0fc7d42a 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts @@ -1,78 +1,89 @@ -import { PrivateKey } from "@dashevo/dashcore-lib"; -import { Platform } from "../../../Platform"; -import IdentityPublicKey from "@dashevo/dpp/lib/identity/IdentityPublicKey" +import { PrivateKey } from '@dashevo/dashcore-lib'; +import IdentityPublicKey from '@dashevo/dpp/lib/identity/IdentityPublicKey'; +import { Platform } from '../../../Platform'; /** - * Creates a funding transaction for the platform identity and returns one-time key to sign the state transition + * Creates a funding transaction for the platform identity + * and returns one-time key to sign the state transition * @param {Platform} this - * @param {AssetLockProof} assetLockProof - asset lock transaction proof for the identity create transition + * @param {AssetLockProof} assetLockProof - asset lock transaction proof + * for the identity create transition * @param {PrivateKey} assetLockPrivateKey - private key used in asset lock - * @return {{identity: Identity, identityCreateTransition: IdentityCreateTransition}} - identity, state transition and index of the key used to create it + * @return {{identity: Identity, identityCreateTransition: IdentityCreateTransition}} + * - identity, state transition and index of the key used to create it * that can be used to sign registration/top-up state transition */ -export async function createIdentityCreateTransition(this : Platform, assetLockProof: any, assetLockPrivateKey: PrivateKey): Promise<{ identity: any, identityCreateTransition: any, identityIndex: number }> { - const platform = this; - await platform.initialize(); +export async function createIdentityCreateTransition( + this : Platform, + assetLockProof: any, + assetLockPrivateKey: PrivateKey, +): Promise<{ identity: any, identityCreateTransition: any, identityIndex: number }> { + const platform = this; + await platform.initialize(); + + const account = await platform.client.getWalletAccount(); + const { dpp } = platform; + + const identityIndex = await account.getUnusedIdentityIndex(); + + // @ts-ignore + const { privateKey: identityMasterPrivateKey } = account.identities + .getIdentityHDKeyByIndex(identityIndex, 0); + const identityMasterPublicKey = identityMasterPrivateKey.toPublicKey(); + + const { privateKey: identitySecondPrivateKey } = account.identities + .getIdentityHDKeyByIndex(identityIndex, 1); + const identitySecondPublicKey = identitySecondPrivateKey.toPublicKey(); + + // Create Identity + // @ts-ignore + const identity = dpp.identity.create( + assetLockProof, [{ + key: identityMasterPublicKey, + purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, + securityLevel: IdentityPublicKey.SECURITY_LEVELS.MASTER, + }, + { + key: identitySecondPublicKey, + purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, + securityLevel: IdentityPublicKey.SECURITY_LEVELS.HIGH, + }, + ], + ); + + // Create ST + const identityCreateTransition = dpp.identity.createIdentityCreateTransition(identity); + + // Create key proofs + + const [masterKey, secondKey] = identityCreateTransition.getPublicKeys(); + + await identityCreateTransition + .signByPrivateKey(identityMasterPrivateKey, IdentityPublicKey.TYPES.ECDSA_SECP256K1); + + masterKey.setSignature(identityCreateTransition.getSignature()); - const account = await platform.client.getWalletAccount(); - const { dpp } = platform; - - const identityIndex = await account.getUnusedIdentityIndex(); - - // @ts-ignore - const { privateKey: identityMasterPrivateKey } = account.identities.getIdentityHDKeyByIndex(identityIndex, 0); - const identityMasterPublicKey = identityMasterPrivateKey.toPublicKey(); - - const { privateKey: identitySecondPrivateKey } = account.identities.getIdentityHDKeyByIndex(identityIndex, 1); - const identitySecondPublicKey = identitySecondPrivateKey.toPublicKey(); - - // Create Identity - // @ts-ignore - const identity = dpp.identity.create( - assetLockProof, [{ - key: identityMasterPublicKey, - purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, - securityLevel: IdentityPublicKey.SECURITY_LEVELS.MASTER - }, - { - key: identitySecondPublicKey, - purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, - securityLevel: IdentityPublicKey.SECURITY_LEVELS.HIGH - } - ] - ); - - // Create ST - const identityCreateTransition = dpp.identity.createIdentityCreateTransition(identity); - - // Create key proofs - - const [masterKey, secondKey] = identityCreateTransition.getPublicKeys(); - - await identityCreateTransition.signByPrivateKey(identityMasterPrivateKey, IdentityPublicKey.TYPES.ECDSA_SECP256K1); - - masterKey.setSignature(identityCreateTransition.getSignature()); - - identityCreateTransition.setSignature(undefined); + identityCreateTransition.setSignature(undefined); - await identityCreateTransition.signByPrivateKey(identitySecondPrivateKey, IdentityPublicKey.TYPES.ECDSA_SECP256K1); + await identityCreateTransition + .signByPrivateKey(identitySecondPrivateKey, IdentityPublicKey.TYPES.ECDSA_SECP256K1); secondKey.setSignature(identityCreateTransition.getSignature()); identityCreateTransition.setSignature(undefined); - // Sign and validate state transition - await identityCreateTransition.signByPrivateKey(assetLockPrivateKey, IdentityPublicKey.TYPES.ECDSA_SECP256K1); + await identityCreateTransition + .signByPrivateKey(assetLockPrivateKey, IdentityPublicKey.TYPES.ECDSA_SECP256K1); - const result = await dpp.stateTransition.validateBasic(identityCreateTransition); + const result = await dpp.stateTransition.validateBasic(identityCreateTransition); - if (!result.isValid()) { - throw new Error(`StateTransition is invalid - ${JSON.stringify(result.getErrors())}`); - } + if (!result.isValid()) { + throw new Error(`StateTransition is invalid - ${JSON.stringify(result.getErrors())}`); + } - return { identity, identityCreateTransition, identityIndex }; + return { identity, identityCreateTransition, identityIndex }; } export default createIdentityCreateTransition; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.ts index 3a3d8ac71c9..8379a03a864 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.ts @@ -1,36 +1,45 @@ -import { PrivateKey } from "@dashevo/dashcore-lib"; -import { Platform } from "../../../Platform"; -import IdentityPublicKey from "@dashevo/dpp/lib/identity/IdentityPublicKey" +import { PrivateKey } from '@dashevo/dashcore-lib'; +import IdentityPublicKey from '@dashevo/dpp/lib/identity/IdentityPublicKey'; +import { Platform } from '../../../Platform'; /** - * Creates a funding transaction for the platform identity and returns one-time key to sign the state transition + * Creates a funding transaction for the platform identity + * and returns one-time key to sign the state transition * @param {Platform} this - * @param {AssetLockProof} assetLockProof - asset lock transaction proof for the identity create transition + * @param {AssetLockProof} assetLockProof - asset lock transaction proof + * for the identity create transition * @param {PrivateKey} assetLockPrivateKey - private key used in asset lock * @param {string|Buffer|Identifier} identityId - * @return {{identity: Identity, identityCreateTransition: IdentityCreateTransition}} - identity, state transition and index of the key used to create it + * @return {{identity: Identity, identityCreateTransition: IdentityCreateTransition}} + * - identity, state transition and index of the key used to create it * that can be used to sign registration/top-up state transition */ -export async function createIdentityTopUpTransition(this : Platform, assetLockProof: any, assetLockPrivateKey: PrivateKey, identityId: any): Promise { - const platform = this; - await platform.initialize(); +export async function createIdentityTopUpTransition( + this : Platform, + assetLockProof: any, + assetLockPrivateKey: PrivateKey, + identityId: any, +): Promise { + const platform = this; + await platform.initialize(); - const { dpp } = platform; + const { dpp } = platform; - // @ts-ignore - const identityTopUpTransition = dpp.identity.createIdentityTopUpTransition( - identityId, assetLockProof - ); + // @ts-ignore + const identityTopUpTransition = dpp.identity.createIdentityTopUpTransition( + identityId, assetLockProof, + ); - await identityTopUpTransition.signByPrivateKey(assetLockPrivateKey, IdentityPublicKey.TYPES.ECDSA_SECP256K1); + await identityTopUpTransition + .signByPrivateKey(assetLockPrivateKey, IdentityPublicKey.TYPES.ECDSA_SECP256K1); - const result = await dpp.stateTransition.validateBasic(identityTopUpTransition); + const result = await dpp.stateTransition.validateBasic(identityTopUpTransition); - if (!result.isValid()) { - throw new Error(`StateTransition is invalid - ${JSON.stringify(result.getErrors())}`); - } + if (!result.isValid()) { + throw new Error(`StateTransition is invalid - ${JSON.stringify(result.getErrors())}`); + } - return identityTopUpTransition; + return identityTopUpTransition; } export default createIdentityTopUpTransition; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts index 33c426427b6..b147e32b20c 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts @@ -1,6 +1,5 @@ -import { Platform } from "../../../Platform"; - -import { ownerId as dpnsOwnerId } from "@dashevo/dpns-contract/lib/systemIds"; +import { ownerId as dpnsOwnerId } from '@dashevo/dpns-contract/lib/systemIds'; +import { Platform } from '../../../Platform'; export async function waitForCoreChainLockedHeight( this : Platform, @@ -23,9 +22,9 @@ export async function waitForCoreChainLockedHeight( const identityResponse = await platform.identities.get(dpnsOwnerId); if (!identityResponse) { - reject(new Error('Identity using to obtain core chain locked height is not present')); + reject(new Error('Identity using to obtain core chain locked height is not present')); - return; + return; } const metadata = identityResponse.getMetadata(); @@ -62,9 +61,7 @@ export async function waitForCoreChainLockedHeight( return { promise, cancel, - } + }; } export default waitForCoreChainLockedHeight; - - diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/register.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/register.ts index 236588dfa78..669ec1785d5 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/register.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/register.ts @@ -1,6 +1,6 @@ -import { Platform } from "../../Platform"; -import broadcastStateTransition from "../../broadcastStateTransition"; -import {wait} from "../../../../../utils/wait"; +import { Platform } from '../../Platform'; +import broadcastStateTransition from '../../broadcastStateTransition'; +import { wait } from '../../../../../utils/wait'; /** * Register identities to the platform @@ -10,68 +10,68 @@ import {wait} from "../../../../../utils/wait"; */ export default async function register( this: Platform, - fundingAmount : number = 1000000 + fundingAmount : number = 1000000, ): Promise { - this.logger.debug(`[Identity#register] Register identity with funding amount ${fundingAmount}`); - await this.initialize(); + this.logger.debug(`[Identity#register] Register identity with funding amount ${fundingAmount}`); + await this.initialize(); - const { client } = this; + const { client } = this; - const account = await client.getWalletAccount(); + const account = await client.getWalletAccount(); - const { - transaction: assetLockTransaction, - privateKey: assetLockPrivateKey, - outputIndex: assetLockOutputIndex - } = await this.identities.utils.createAssetLockTransaction(fundingAmount); + const { + transaction: assetLockTransaction, + privateKey: assetLockPrivateKey, + outputIndex: assetLockOutputIndex, + } = await this.identities.utils.createAssetLockTransaction(fundingAmount); - this.logger.silly(`[Identity#register] Broadcast asset lock transaction "${assetLockTransaction.hash}"`); - // Broadcast Asset Lock transaction - await account.broadcastTransaction(assetLockTransaction); + this.logger.silly(`[Identity#register] Broadcast asset lock transaction "${assetLockTransaction.hash}"`); + // Broadcast Asset Lock transaction + await account.broadcastTransaction(assetLockTransaction); - this.logger.silly(`[Identity#register] Wait for asset lock proof "${assetLockTransaction.hash}"`); - const assetLockProof = await this.identities.utils - .createAssetLockProof(assetLockTransaction, assetLockOutputIndex); + this.logger.silly(`[Identity#register] Wait for asset lock proof "${assetLockTransaction.hash}"`); + const assetLockProof = await this.identities.utils + .createAssetLockProof(assetLockTransaction, assetLockOutputIndex); - const { identity, identityCreateTransition, identityIndex } = await this.identities.utils - .createIdentityCreateTransition(assetLockProof, assetLockPrivateKey); + const { identity, identityCreateTransition, identityIndex } = await this.identities.utils + .createIdentityCreateTransition(assetLockProof, assetLockPrivateKey); - this.logger.silly(`[Identity#register] Broadcast identity create ST"`); - await broadcastStateTransition(this, identityCreateTransition); + this.logger.silly('[Identity#register] Broadcast identity create ST"'); + await broadcastStateTransition(this, identityCreateTransition); - // If state transition was broadcast without any errors, import identity to the account - account.storage + // If state transition was broadcast without any errors, import identity to the account + account.storage .getWalletStore(account.walletId) .insertIdentityIdAtIndex( identity.getId().toString(), identityIndex, ); - // Fetch identity from the network because the current identity object - // doesn't have metadata and balance information. Due to replication lag - // some nodes couldn't have it yet, so we need to try multiple times - const maxAttempts = 20; - let attempt = 0; - let registeredIdentity: any = null; // We don't have Identity type yet + // Fetch identity from the network because the current identity object + // doesn't have metadata and balance information. Due to replication lag + // some nodes couldn't have it yet, so we need to try multiple times + const maxAttempts = 20; + let attempt = 0; + let registeredIdentity: any = null; // We don't have Identity type yet - while (registeredIdentity === null && attempt < maxAttempts) { - await wait(100); + while (registeredIdentity === null && attempt < maxAttempts) { + await wait(100); - registeredIdentity = await this.identities.get(identity.getId()); - attempt++; - } + registeredIdentity = await this.identities.get(identity.getId()); + attempt += 1; + } - if (registeredIdentity === null) { - throw new Error(`Can't fetch created identity with id ${identity.getId()}`); - } + if (registeredIdentity === null) { + throw new Error(`Can't fetch created identity with id ${identity.getId()}`); + } - // We cannot just return registeredIdentity as we want to - // keep additional information (assetLockProof and transaction) instance - identity.setMetadata(registeredIdentity.getMetadata()); - identity.setBalance(registeredIdentity.getBalance()); - identity.setPublicKeys(registeredIdentity.getPublicKeys()); + // We cannot just return registeredIdentity as we want to + // keep additional information (assetLockProof and transaction) instance + identity.setMetadata(registeredIdentity.getMetadata()); + identity.setBalance(registeredIdentity.getBalance()); + identity.setPublicKeys(registeredIdentity.getPublicKeys()); - this.logger.debug(`[Identity#register] Registered identity "${identity.getId()}"`); + this.logger.debug(`[Identity#register] Registered identity "${identity.getId()}"`); - return identity; + return identity; } diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/topUp.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/topUp.ts index c4d76a45e5f..dbfb68f5d56 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/topUp.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/topUp.ts @@ -1,7 +1,7 @@ -import Identifier from "@dashevo/dpp/lib/Identifier"; -import {Platform} from "../../Platform"; +import Identifier from '@dashevo/dpp/lib/Identifier'; +import { Platform } from '../../Platform'; -import broadcastStateTransition from "../../broadcastStateTransition"; +import broadcastStateTransition from '../../broadcastStateTransition'; /** * Register identities to the platform @@ -11,34 +11,38 @@ import broadcastStateTransition from "../../broadcastStateTransition"; * @param {number} amount - amount to top up in duffs * @returns {boolean} */ -export async function topUp(this: Platform, identityId: Identifier | string, amount: number): Promise { - await this.initialize(); +export async function topUp( + this: Platform, + identityId: Identifier | string, + amount: number, +): Promise { + await this.initialize(); - const { client } = this; + const { client } = this; - identityId = Identifier.from(identityId); + identityId = Identifier.from(identityId); - const account = await client.getWalletAccount(); + const account = await client.getWalletAccount(); - const { - transaction: assetLockTransaction, - privateKey: assetLockPrivateKey, - outputIndex: assetLockOutputIndex - } = await this.identities.utils.createAssetLockTransaction(amount); + const { + transaction: assetLockTransaction, + privateKey: assetLockPrivateKey, + outputIndex: assetLockOutputIndex, + } = await this.identities.utils.createAssetLockTransaction(amount); - // Broadcast Asset Lock transaction - await account.broadcastTransaction(assetLockTransaction); - // Create a proof for the asset lock transaction - const assetLockProof = await this.identities.utils - .createAssetLockProof(assetLockTransaction, assetLockOutputIndex); + // Broadcast Asset Lock transaction + await account.broadcastTransaction(assetLockTransaction); + // Create a proof for the asset lock transaction + const assetLockProof = await this.identities.utils + .createAssetLockProof(assetLockTransaction, assetLockOutputIndex); - const identityTopUpTransition = await this.identities.utils - .createIdentityTopUpTransition(assetLockProof, assetLockPrivateKey, identityId); + const identityTopUpTransition = await this.identities.utils + .createIdentityTopUpTransition(assetLockProof, assetLockPrivateKey, identityId); - // Broadcast ST - await broadcastStateTransition(this, identityTopUpTransition); + // Broadcast ST + await broadcastStateTransition(this, identityTopUpTransition); - return true; + return true; } export default topUp; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/update.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/update.ts index 29621afab82..75baf20ad7f 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/update.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/identities/update.ts @@ -1,9 +1,9 @@ -import Identity from "@dashevo/dpp/lib/identity/Identity"; -import { Platform } from "../../Platform"; -import IdentityPublicKey from "@dashevo/dpp/lib/identity/IdentityPublicKey" +import Identity from '@dashevo/dpp/lib/identity/Identity'; +import IdentityPublicKey from '@dashevo/dpp/lib/identity/IdentityPublicKey'; +import { Platform } from '../../Platform'; import { signStateTransition } from '../../signStateTransition'; -import broadcastStateTransition from "../../broadcastStateTransition"; +import broadcastStateTransition from '../../broadcastStateTransition'; /** * Update platform identities @@ -20,7 +20,7 @@ export async function update( identity: Identity, publicKeys: { add?: IdentityPublicKey[]; disable?: IdentityPublicKey[] }, privateKeys: { string, any }, - ): Promise { +): Promise { await this.initialize(); const { dpp } = this; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.spec.ts index eab823e77dd..f7ef69a06d0 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.spec.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.spec.ts @@ -1,126 +1,126 @@ import { expect } from 'chai'; import { ImportMock } from 'ts-mock-imports'; -import generateRandomIdentifier from "@dashevo/dpp/lib/test/utils/generateRandomIdentifier" +import generateRandomIdentifier from '@dashevo/dpp/lib/test/utils/generateRandomIdentifier'; import cryptoModule from 'crypto'; import register from './register'; -import {ClientApps} from "../../../ClientApps"; +import { ClientApps } from '../../../ClientApps'; describe('Platform', () => { - let randomBytesMock; - - before(() => { - randomBytesMock = ImportMock.mockFunction(cryptoModule, 'randomBytes', Buffer.alloc(32)); - }); - after(() => { - randomBytesMock.restore(); - }); - - describe('Names', () => { - describe('#register', () => { - let platformMock; - let identityMock; - - beforeEach(async function beforeEach() { - platformMock = { - client: { - getApps() { - return new ClientApps({ - dpns: { - contractId: generateRandomIdentifier(), - } - }); - } - }, - documents: { - create: this.sinon.stub(), - broadcast: this.sinon.stub(), - }, - initialize: this.sinon.stub(), - }; - - identityMock = { - getId: this.sinon.stub(), - getPublicKeyById: this.sinon.stub(), - }; - }); - - it('register top level domain', async () => { - const identityId = generateRandomIdentifier(); - identityMock.getId.returns(identityId); - - await register.call(platformMock, 'Dash', { - dashUniqueIdentityId: identityId, - }, identityMock); - - expect(platformMock.documents.create.getCall(0).args[0]).to.deep.equal('dpns.preorder'); - expect(platformMock.documents.create.getCall(0).args[1]).to.deep.equal(identityMock); - expect(platformMock.documents.create.getCall(0).args[2].saltedDomainHash.toString('hex')).to.deep.equal( - 'df46c47179745ea18c0fdc95910372dca8810127acc9afe3c9b326b07555e6b4', - ); - - expect(platformMock.documents.create.getCall(1).args).to.have.deep.members([ - 'dpns.domain', - identityMock, - { - 'label': 'Dash', - 'normalizedLabel': 'dash', - 'normalizedParentDomainName': '', - 'preorderSalt': Buffer.alloc(32), - 'records': { - 'dashUniqueIdentityId': identityId, - }, - 'subdomainRules': { - 'allowSubdomains': true, - }, - } - ]); - }); - - it('should register second level domain', async () => { - const identityId = generateRandomIdentifier(); - identityMock.getId.returns(identityId); - - await register.call(platformMock, 'User.dash', { - dashAliasIdentityId: identityId, - }, identityMock); - - expect(platformMock.documents.create.getCall(0).args[0]).to.deep.equal('dpns.preorder'); - expect(platformMock.documents.create.getCall(0).args[1]).to.deep.equal(identityMock); - expect(platformMock.documents.create.getCall(0).args[2].saltedDomainHash.toString('hex')).to.deep.equal( - '04a52b75ca842ee9fb14f2cdd27aa0982b9b2cfb2c0e95f640ca3f0c24f1bb9a', - ); - - expect(platformMock.documents.create.getCall(1).args).to.have.deep.members([ - 'dpns.domain', - identityMock, - { - 'label': 'User', - 'normalizedLabel': 'user', - 'normalizedParentDomainName': 'dash', - 'preorderSalt': Buffer.alloc(32), - 'records': { - 'dashAliasIdentityId': identityId, - }, - 'subdomainRules': { - 'allowSubdomains': false, - }, - } - ]); - }); - - it('should fail if DPNS app have no contract set up', async () => { - delete platformMock.client.getApps().get('dpns').contractId; - - try { - await register.call(platformMock, 'user.dash', { - dashUniqueIdentityId: generateRandomIdentifier(), - }, identityMock); - } catch (e) { - expect(e.message).to.equal('DPNS is required to register a new name.'); - } - }); - }); + let randomBytesMock; + + before(() => { + randomBytesMock = ImportMock.mockFunction(cryptoModule, 'randomBytes', Buffer.alloc(32)); + }); + after(() => { + randomBytesMock.restore(); + }); + + describe('Names', () => { + describe('#register', () => { + let platformMock; + let identityMock; + + beforeEach(async function beforeEach() { + platformMock = { + client: { + getApps() { + return new ClientApps({ + dpns: { + contractId: generateRandomIdentifier(), + }, + }); + }, + }, + documents: { + create: this.sinon.stub(), + broadcast: this.sinon.stub(), + }, + initialize: this.sinon.stub(), + }; + + identityMock = { + getId: this.sinon.stub(), + getPublicKeyById: this.sinon.stub(), + }; + }); + + it('register top level domain', async () => { + const identityId = generateRandomIdentifier(); + identityMock.getId.returns(identityId); + + await register.call(platformMock, 'Dash', { + dashUniqueIdentityId: identityId, + }, identityMock); + + expect(platformMock.documents.create.getCall(0).args[0]).to.deep.equal('dpns.preorder'); + expect(platformMock.documents.create.getCall(0).args[1]).to.deep.equal(identityMock); + expect(platformMock.documents.create.getCall(0).args[2].saltedDomainHash.toString('hex')).to.deep.equal( + 'df46c47179745ea18c0fdc95910372dca8810127acc9afe3c9b326b07555e6b4', + ); + + expect(platformMock.documents.create.getCall(1).args).to.have.deep.members([ + 'dpns.domain', + identityMock, + { + label: 'Dash', + normalizedLabel: 'dash', + normalizedParentDomainName: '', + preorderSalt: Buffer.alloc(32), + records: { + dashUniqueIdentityId: identityId, + }, + subdomainRules: { + allowSubdomains: true, + }, + }, + ]); + }); + + it('should register second level domain', async () => { + const identityId = generateRandomIdentifier(); + identityMock.getId.returns(identityId); + + await register.call(platformMock, 'User.dash', { + dashAliasIdentityId: identityId, + }, identityMock); + + expect(platformMock.documents.create.getCall(0).args[0]).to.deep.equal('dpns.preorder'); + expect(platformMock.documents.create.getCall(0).args[1]).to.deep.equal(identityMock); + expect(platformMock.documents.create.getCall(0).args[2].saltedDomainHash.toString('hex')).to.deep.equal( + '04a52b75ca842ee9fb14f2cdd27aa0982b9b2cfb2c0e95f640ca3f0c24f1bb9a', + ); + + expect(platformMock.documents.create.getCall(1).args).to.have.deep.members([ + 'dpns.domain', + identityMock, + { + label: 'User', + normalizedLabel: 'user', + normalizedParentDomainName: 'dash', + preorderSalt: Buffer.alloc(32), + records: { + dashAliasIdentityId: identityId, + }, + subdomainRules: { + allowSubdomains: false, + }, + }, + ]); + }); + + it('should fail if DPNS app have no contract set up', async () => { + delete platformMock.client.getApps().get('dpns').contractId; + + try { + await register.call(platformMock, 'user.dash', { + dashUniqueIdentityId: generateRandomIdentifier(), + }, identityMock); + } catch (e) { + expect(e.message).to.equal('DPNS is required to register a new name.'); + } + }); }); + }); }); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.ts index f664266a3ec..86f872edc56 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/register.ts @@ -1,5 +1,5 @@ -import {Platform} from "../../Platform"; -import Identifier from "@dashevo/dpp/lib/Identifier"; +import Identifier from '@dashevo/dpp/lib/Identifier'; +import { Platform } from '../../Platform'; const { hash } = require('@dashevo/dpp/lib/util/hash'); const crypto = require('crypto'); @@ -17,96 +17,95 @@ const crypto = require('crypto'); * @returns registered domain document */ export async function register(this: Platform, - name: string, - records: { - dashUniqueIdentityId?: Identifier|string, - dashAliasIdentityId?: Identifier|string, - }, - identity: { - getId(): Identifier; - getPublicKeyById(number: number):any; - }, -): Promise { + name: string, + records: { + dashUniqueIdentityId?: Identifier | string, + dashAliasIdentityId?: Identifier | string, + }, + identity: { + getId(): Identifier; + getPublicKeyById(number: number):any; + }): Promise { await this.initialize(); if (records.dashUniqueIdentityId) { - records.dashUniqueIdentityId = Identifier.from(records.dashUniqueIdentityId); - } - - if (records.dashAliasIdentityId) { - records.dashAliasIdentityId = Identifier.from(records.dashAliasIdentityId); - } - - const nameLabels = name.split('.'); - - const normalizedParentDomainName = nameLabels - .slice(1) - .join('.') - .toLowerCase(); - - const [label] = nameLabels; - const normalizedLabel = label.toLowerCase(); - - const preorderSalt = crypto.randomBytes(32); - - const isSecondLevelDomain = normalizedParentDomainName.length > 0; - - const fullDomainName = isSecondLevelDomain - ? `${normalizedLabel}.${normalizedParentDomainName}` - : normalizedLabel; - - const saltedDomainHash = hash( - Buffer.concat([ - preorderSalt, - Buffer.from(fullDomainName), - ]), - ); - - if (!this.client.getApps().has('dpns')) { - throw new Error('DPNS is required to register a new name.'); - } - - // 1. Create preorder document - const preorderDocument = await this.documents.create( - 'dpns.preorder', - identity, - { - saltedDomainHash, - }, - ); - - await this.documents.broadcast( - { - create: [preorderDocument], - }, - identity, - ); - - // 3. Create domain document - const domainDocument = await this.documents.create( - 'dpns.domain', - identity, - { - label, - normalizedLabel, - normalizedParentDomainName, - preorderSalt, - records, - subdomainRules: { - allowSubdomains: !isSecondLevelDomain, - }, - }, - ); - - // 4. Create and send domain state transition - await this.documents.broadcast( - { - create: [domainDocument], - }, - identity, - ); - - return domainDocument; + records.dashUniqueIdentityId = Identifier.from(records.dashUniqueIdentityId); + } + + if (records.dashAliasIdentityId) { + records.dashAliasIdentityId = Identifier.from(records.dashAliasIdentityId); + } + + const nameLabels = name.split('.'); + + const normalizedParentDomainName = nameLabels + .slice(1) + .join('.') + .toLowerCase(); + + const [label] = nameLabels; + const normalizedLabel = label.toLowerCase(); + + const preorderSalt = crypto.randomBytes(32); + + const isSecondLevelDomain = normalizedParentDomainName.length > 0; + + const fullDomainName = isSecondLevelDomain + ? `${normalizedLabel}.${normalizedParentDomainName}` + : normalizedLabel; + + const saltedDomainHash = hash( + Buffer.concat([ + preorderSalt, + Buffer.from(fullDomainName), + ]), + ); + + if (!this.client.getApps().has('dpns')) { + throw new Error('DPNS is required to register a new name.'); + } + + // 1. Create preorder document + const preorderDocument = await this.documents.create( + 'dpns.preorder', + identity, + { + saltedDomainHash, + }, + ); + + await this.documents.broadcast( + { + create: [preorderDocument], + }, + identity, + ); + + // 3. Create domain document + const domainDocument = await this.documents.create( + 'dpns.domain', + identity, + { + label, + normalizedLabel, + normalizedParentDomainName, + preorderSalt, + records, + subdomainRules: { + allowSubdomains: !isSecondLevelDomain, + }, + }, + ); + + // 4. Create and send domain state transition + await this.documents.broadcast( + { + create: [domainDocument], + }, + identity, + ); + + return domainDocument; } export default register; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolve.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolve.spec.ts index 38447320ccc..59c9d0ada05 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolve.spec.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolve.spec.ts @@ -3,65 +3,63 @@ import { expect } from 'chai'; import resolve from './resolve'; describe('Platform', () => { - describe('Names', () => { - describe('#resolve', () => { - let platformMock; - let parentDomainDocument; - let childDomainDocument; + describe('Names', () => { + describe('#resolve', () => { + let platformMock; + let parentDomainDocument; - beforeEach(async function beforeEach() { - parentDomainDocument = { label: 'parent' }; - childDomainDocument = { label: 'child.parent' }; + beforeEach(async function beforeEach() { + parentDomainDocument = { label: 'parent' }; - platformMock = { - documents: { - get: this.sinon.stub(), - }, - initialize: this.sinon.stub(), - }; - }); + platformMock = { + documents: { + get: this.sinon.stub(), + }, + initialize: this.sinon.stub(), + }; + }); - it('should resolve domain by it\'s name', async () => { - platformMock.documents.get.resolves([parentDomainDocument]); + it('should resolve domain by it\'s name', async () => { + platformMock.documents.get.resolves([parentDomainDocument]); - const receivedDocument = await resolve.call(platformMock, 'parent'); + const receivedDocument = await resolve.call(platformMock, 'parent'); - expect(platformMock.documents.get.callCount).to.equal(1); - expect(platformMock.documents.get.getCall(0).args).to.deep.equal( - [ - 'dpns.domain', - { - where: [ - ['normalizedParentDomainName', '==', ''], - ['normalizedLabel', '==', 'parent'], - ], - }, - ], - ); + expect(platformMock.documents.get.callCount).to.equal(1); + expect(platformMock.documents.get.getCall(0).args).to.deep.equal( + [ + 'dpns.domain', + { + where: [ + ['normalizedParentDomainName', '==', ''], + ['normalizedLabel', '==', 'parent'], + ], + }, + ], + ); - expect(receivedDocument).to.deep.equal(parentDomainDocument); - }); + expect(receivedDocument).to.deep.equal(parentDomainDocument); + }); - it('should return null if domain was not found', async () => { - platformMock.documents.get.resolves([]); + it('should return null if domain was not found', async () => { + platformMock.documents.get.resolves([]); - const receivedDocument = await resolve.call(platformMock, 'otherName.parent'); + const receivedDocument = await resolve.call(platformMock, 'otherName.parent'); - expect(platformMock.documents.get.callCount).to.equal(1); - expect(platformMock.documents.get.getCall(0).args).to.deep.equal( - [ - 'dpns.domain', - { - where: [ - ['normalizedParentDomainName', '==', 'parent'], - ['normalizedLabel', '==', 'othername'] - ], - }, - ], - ); + expect(platformMock.documents.get.callCount).to.equal(1); + expect(platformMock.documents.get.getCall(0).args).to.deep.equal( + [ + 'dpns.domain', + { + where: [ + ['normalizedParentDomainName', '==', 'parent'], + ['normalizedLabel', '==', 'othername'], + ], + }, + ], + ); - expect(receivedDocument).to.be.null; - }); - }); + expect(receivedDocument).to.be.null; + }); }); + }); }); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolve.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolve.ts index a40a830d895..45616a02fd5 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolve.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolve.ts @@ -1,4 +1,4 @@ -import { Platform } from "../../Platform"; +import { Platform } from '../../Platform'; /** * This method will allow you to resolve a DPNS record from its humanized name. @@ -6,29 +6,29 @@ import { Platform } from "../../Platform"; * @returns {Document} document */ export async function resolve(this: Platform, name: string): Promise { - await this.initialize(); + await this.initialize(); - // setting up variables in case of TLD registration - let normalizedLabel = name.toLowerCase(); - let normalizedParentDomainName = ''; + // setting up variables in case of TLD registration + let normalizedLabel = name.toLowerCase(); + let normalizedParentDomainName = ''; - // in case of subdomain registration - // we should split label and parent domain name - if (name.includes('.')) { - const segments = name.toLowerCase().split('.'); + // in case of subdomain registration + // we should split label and parent domain name + if (name.includes('.')) { + const segments = name.toLowerCase().split('.'); - normalizedLabel = segments[0]; - normalizedParentDomainName = segments.slice(1).join('.'); - } + [normalizedLabel] = segments; + normalizedParentDomainName = segments.slice(1).join('.'); + } - const [document] = await this.documents.get('dpns.domain', { - where: [ - ['normalizedParentDomainName', '==', normalizedParentDomainName], - ['normalizedLabel', '==', normalizedLabel], - ], - }); + const [document] = await this.documents.get('dpns.domain', { + where: [ + ['normalizedParentDomainName', '==', normalizedParentDomainName], + ['normalizedLabel', '==', normalizedLabel], + ], + }); - return document === undefined ? null : document; + return document === undefined ? null : document; } export default resolve; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolveByRecord.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolveByRecord.spec.ts index dba1fb0e64d..8a534e42714 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolveByRecord.spec.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolveByRecord.spec.ts @@ -3,60 +3,58 @@ import { expect } from 'chai'; import resolveByRecord from './resolveByRecord'; describe('Platform', () => { - describe('Names', () => { - describe('#resolveByRecord', () => { - let platformMock; - let parentDomainDocument; - let childDomainDocument; - - beforeEach(async function beforeEach() { - parentDomainDocument = { label: 'parent' }; - childDomainDocument = { label: 'child.parent' }; - - platformMock = { - documents: { - get: this.sinon.stub(), - }, - initialize: this.sinon.stub(), - }; - }); - - it('should resolve domain by it\'s record', async () => { - platformMock.documents.get.resolves([parentDomainDocument]); - - const receivedDocuments = await resolveByRecord.call( - platformMock, 'recordName', 'recordValue', - ); - - expect(platformMock.documents.get.callCount).to.equal(1); - expect(platformMock.documents.get.getCall(0).args).to.deep.equal([ - 'dpns.domain', - { - where: [['records.recordName', '==', 'recordValue']], - }, - ]); - - expect(receivedDocuments).to.deep.equal([parentDomainDocument]); - }); - - it('should return null if domain was not found', async () => { - platformMock.documents.get.resolves([]); - - const receivedDocuments = await resolveByRecord.call( - platformMock, 'recordName', 'recordValue', - ); - - expect(platformMock.documents.get.callCount).to.equal(1); - expect(platformMock.documents.get.getCall(0).args).to.deep.equal([ - 'dpns.domain', - { - where: [['records.recordName', '==', 'recordValue']], - }, - ]); - - expect(receivedDocuments).to.be.an('array'); - expect(receivedDocuments.length).to.equal(0); - }); - }); + describe('Names', () => { + describe('#resolveByRecord', () => { + let platformMock; + let parentDomainDocument; + + beforeEach(async function beforeEach() { + parentDomainDocument = { label: 'parent' }; + + platformMock = { + documents: { + get: this.sinon.stub(), + }, + initialize: this.sinon.stub(), + }; + }); + + it('should resolve domain by it\'s record', async () => { + platformMock.documents.get.resolves([parentDomainDocument]); + + const receivedDocuments = await resolveByRecord.call( + platformMock, 'recordName', 'recordValue', + ); + + expect(platformMock.documents.get.callCount).to.equal(1); + expect(platformMock.documents.get.getCall(0).args).to.deep.equal([ + 'dpns.domain', + { + where: [['records.recordName', '==', 'recordValue']], + }, + ]); + + expect(receivedDocuments).to.deep.equal([parentDomainDocument]); + }); + + it('should return null if domain was not found', async () => { + platformMock.documents.get.resolves([]); + + const receivedDocuments = await resolveByRecord.call( + platformMock, 'recordName', 'recordValue', + ); + + expect(platformMock.documents.get.callCount).to.equal(1); + expect(platformMock.documents.get.getCall(0).args).to.deep.equal([ + 'dpns.domain', + { + where: [['records.recordName', '==', 'recordValue']], + }, + ]); + + expect(receivedDocuments).to.be.an('array'); + expect(receivedDocuments.length).to.equal(0); + }); }); + }); }); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolveByRecord.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolveByRecord.ts index 933d0c2eb87..8e5f1a80917 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolveByRecord.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/resolveByRecord.ts @@ -1,5 +1,5 @@ -import { Platform } from "../../Platform"; -import Identifier from "@dashevo/dpp/lib/Identifier"; +import Identifier from '@dashevo/dpp/lib/Identifier'; +import { Platform } from '../../Platform'; /** * @param record - the exact name of the record to resolve @@ -7,17 +7,17 @@ import Identifier from "@dashevo/dpp/lib/Identifier"; * @returns {Document[]} - Resolved domains */ export async function resolveByRecord(this: Platform, record: string, value: any): Promise { - await this.initialize(); + await this.initialize(); - if (record === 'dashUniqueIdentityId' || record === 'dashAliasIdentityId') { - value = Identifier.from(value); - } + if (record === 'dashUniqueIdentityId' || record === 'dashAliasIdentityId') { + value = Identifier.from(value); + } - return await this.documents.get('dpns.domain', { - where: [ - [`records.${record}`, '==', value], - ], - }); + return await this.documents.get('dpns.domain', { + where: [ + [`records.${record}`, '==', value], + ], + }); } export default resolveByRecord; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/search.spec.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/search.spec.ts index 943a5c31cde..2ea44d057f5 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/search.spec.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/search.spec.ts @@ -3,67 +3,65 @@ import { expect } from 'chai'; import search from './search'; describe('Platform', () => { - describe('Names', () => { - describe('#search', () => { - let platformMock; - let parentDomainDocument; - let childDomainDocument; + describe('Names', () => { + describe('#search', () => { + let platformMock; + let parentDomainDocument; - beforeEach(async function beforeEach() { - parentDomainDocument = { label: 'parent' }; - childDomainDocument = { label: 'child.parent' }; + beforeEach(async function beforeEach() { + parentDomainDocument = { label: 'parent' }; - platformMock = { - documents: { - get: this.sinon.stub(), - }, - initialize: this.sinon.stub(), - }; - }); + platformMock = { + documents: { + get: this.sinon.stub(), + }, + initialize: this.sinon.stub(), + }; + }); - it('should return a list of searched domains', async () => { - platformMock.documents.get.resolves([parentDomainDocument]); + it('should return a list of searched domains', async () => { + platformMock.documents.get.resolves([parentDomainDocument]); - const documentsList = await search.call( - platformMock, 'prefix', 'dash', - ); + const documentsList = await search.call( + platformMock, 'prefix', 'dash', + ); - expect(platformMock.documents.get.callCount).to.equal(1); - expect(platformMock.documents.get.getCall(0).args).to.deep.equal([ - 'dpns.domain', - { - where: [ - ["normalizedParentDomainName", "==", "dash"], - ["normalizedLabel", "startsWith", "prefix"] - ], - orderBy: [['normalizedLabel', 'asc']], - }, - ]); + expect(platformMock.documents.get.callCount).to.equal(1); + expect(platformMock.documents.get.getCall(0).args).to.deep.equal([ + 'dpns.domain', + { + where: [ + ['normalizedParentDomainName', '==', 'dash'], + ['normalizedLabel', 'startsWith', 'prefix'], + ], + orderBy: [['normalizedLabel', 'asc']], + }, + ]); - expect(documentsList).to.have.deep.members([parentDomainDocument]); - }); + expect(documentsList).to.have.deep.members([parentDomainDocument]); + }); - it('should return an empty list if no domains where found', async () => { - platformMock.documents.get.resolves([]); + it('should return an empty list if no domains where found', async () => { + platformMock.documents.get.resolves([]); - const documentsList = await search.call( - platformMock, 'prefix', 'dash', - ); + const documentsList = await search.call( + platformMock, 'prefix', 'dash', + ); - expect(platformMock.documents.get.callCount).to.equal(1); - expect(platformMock.documents.get.getCall(0).args).to.deep.equal([ - 'dpns.domain', - { - where: [ - ["normalizedParentDomainName", "==", "dash"], - ["normalizedLabel", "startsWith", "prefix"] - ], - orderBy: [['normalizedLabel', 'asc']] - }, - ]); + expect(platformMock.documents.get.callCount).to.equal(1); + expect(platformMock.documents.get.getCall(0).args).to.deep.equal([ + 'dpns.domain', + { + where: [ + ['normalizedParentDomainName', '==', 'dash'], + ['normalizedLabel', 'startsWith', 'prefix'], + ], + orderBy: [['normalizedLabel', 'asc']], + }, + ]); - expect(documentsList).to.deep.equal([]); - }); - }); + expect(documentsList).to.deep.equal([]); + }); }); + }); }); diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/search.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/search.ts index 5b8d34197c0..20a59884bd8 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/search.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/methods/names/search.ts @@ -1,4 +1,4 @@ -import {Platform} from "../../Platform"; +import { Platform } from '../../Platform'; /** * @@ -7,22 +7,22 @@ import {Platform} from "../../Platform"; * @returns Documents[] - The array of documents that match the search parameters. */ export async function search(this: Platform, labelPrefix: string, parentDomainName: string = '') { - await this.initialize(); + await this.initialize(); - const normalizedParentDomainName = parentDomainName.toLowerCase(); - const normalizedLabelPrefix = labelPrefix.toLowerCase(); + const normalizedParentDomainName = parentDomainName.toLowerCase(); + const normalizedLabelPrefix = labelPrefix.toLowerCase(); - const documents = await this.documents.get('dpns.domain', { - where: [ - ['normalizedParentDomainName', '==', normalizedParentDomainName], - ['normalizedLabel', 'startsWith', normalizedLabelPrefix], - ], - orderBy: [ - ['normalizedLabel', 'asc'] - ] - }); + const documents = await this.documents.get('dpns.domain', { + where: [ + ['normalizedParentDomainName', '==', normalizedParentDomainName], + ['normalizedLabel', 'startsWith', normalizedLabelPrefix], + ], + orderBy: [ + ['normalizedLabel', 'asc'], + ], + }); - return documents; + return documents; } export default search; diff --git a/packages/js-dash-sdk/src/SDK/Client/Platform/signStateTransition.ts b/packages/js-dash-sdk/src/SDK/Client/Platform/signStateTransition.ts index 90a2a6e0ca6..9b2f514b784 100644 --- a/packages/js-dash-sdk/src/SDK/Client/Platform/signStateTransition.ts +++ b/packages/js-dash-sdk/src/SDK/Client/Platform/signStateTransition.ts @@ -1,4 +1,4 @@ -import {Platform} from "./Platform"; +import { Platform } from './Platform'; /** * @@ -8,21 +8,26 @@ import {Platform} from "./Platform"; * @param {number} [keyIndex] * @return {AbstractStateTransition} */ -export async function signStateTransition(platform: Platform, stateTransition: any, identity: any, keyIndex: number = 0): Promise { - const { client } = platform; +export async function signStateTransition( + platform: Platform, + stateTransition: any, + identity: any, + keyIndex: number = 0, +): Promise { + const { client } = platform; - const account = await client.getWalletAccount(); + const account = await client.getWalletAccount(); - // @ts-ignore - const { privateKey } = account.identities.getIdentityHDKeyById( - identity.getId().toString(), - keyIndex, - ); + // @ts-ignore + const { privateKey } = account.identities.getIdentityHDKeyById( + identity.getId().toString(), + keyIndex, + ); - await stateTransition.sign( - identity.getPublicKeyById(keyIndex), - privateKey, - ); + await stateTransition.sign( + identity.getPublicKeyById(keyIndex), + privateKey, + ); - return stateTransition; + return stateTransition; } diff --git a/packages/js-dash-sdk/src/SDK/Core/Core.ts b/packages/js-dash-sdk/src/SDK/Core/Core.ts index 61b32b6af6e..9c3b61d18ce 100644 --- a/packages/js-dash-sdk/src/SDK/Core/Core.ts +++ b/packages/js-dash-sdk/src/SDK/Core/Core.ts @@ -1,2 +1,3 @@ import * as Core from '@dashevo/dashcore-lib'; + export { Core }; diff --git a/packages/js-dash-sdk/src/SDK/Platform/Platform.ts b/packages/js-dash-sdk/src/SDK/Platform/Platform.ts index 31524ded70b..a61c0ab2998 100644 --- a/packages/js-dash-sdk/src/SDK/Platform/Platform.ts +++ b/packages/js-dash-sdk/src/SDK/Platform/Platform.ts @@ -2,6 +2,6 @@ import { default as _DashPlatformProtocol } from '@dashevo/dpp'; export namespace Platform { - export let DashPlatformProtocol = _DashPlatformProtocol; + export const DashPlatformProtocol = _DashPlatformProtocol; } export { Platform as default }; diff --git a/packages/js-dash-sdk/src/SDK/SDK.spec.ts b/packages/js-dash-sdk/src/SDK/SDK.spec.ts index 02750ee6f26..7ef2680b8bd 100644 --- a/packages/js-dash-sdk/src/SDK/SDK.spec.ts +++ b/packages/js-dash-sdk/src/SDK/SDK.spec.ts @@ -1,12 +1,11 @@ import { expect } from 'chai'; -import SDK from "./index"; +import SDK from './index'; import 'mocha'; describe('Dash', () => { - - it('should provide expected class', function () { + it('should provide expected class', () => { expect(SDK).to.have.property('Client'); - expect(SDK.Client.name).to.be.equal('Client') - expect(SDK.Client.constructor.name).to.be.equal('Function') + expect(SDK.Client.name).to.be.equal('Client'); + expect(SDK.Client.constructor.name).to.be.equal('Function'); }); }); diff --git a/packages/js-dash-sdk/src/SDK/SDK.ts b/packages/js-dash-sdk/src/SDK/SDK.ts index aa0d50b6393..e7c615681db 100644 --- a/packages/js-dash-sdk/src/SDK/SDK.ts +++ b/packages/js-dash-sdk/src/SDK/SDK.ts @@ -1,10 +1,4 @@ -import { Client as _Client } from './Client'; -import { Core as _Core } from './Core'; -import { Platform as _Platform } from './Platform'; import { default as _DAPIClient } from '@dashevo/dapi-client'; - -import { StateTransitionBroadcastError } from '../errors/StateTransitionBroadcastError' - import { Wallet as _Wallet, Account as _Account, @@ -12,38 +6,43 @@ import { CONSTANTS as _WalletLibCONSTANTS, EVENTS as _WalletLibEVENTS, utils as _WalletLibUtils, - plugins as _WalletLibPlugins + plugins as _WalletLibPlugins, } from '@dashevo/wallet-lib'; +import { Client as _Client } from './Client'; +import { Core as _Core } from './Core'; +import { Platform as _Platform } from './Platform'; + +import { StateTransitionBroadcastError } from '../errors/StateTransitionBroadcastError'; export namespace SDK { - export let DAPIClient = _DAPIClient; - export let Client = _Client; + export const DAPIClient = _DAPIClient; + export const Client = _Client; - export let Core = _Core; + export const Core = _Core; // TODO: consider marking as DEPRECATED and use PlatformProtocol below instead - export let Platform = _Platform; + export const Platform = _Platform; // Wallet-lib primitives - export let Wallet = _Wallet; - export let Account = _Account; - export let KeyChain = _KeyChain; + export const Wallet = _Wallet; + export const Account = _Account; + export const KeyChain = _KeyChain; // TODO: consider merging into Wallet above and mark as DEPRECATED - export let WalletLib = { + export const WalletLib = { CONSTANTS: _WalletLibCONSTANTS, EVENTS: _WalletLibEVENTS, plugins: _WalletLibPlugins, utils: _WalletLibUtils, - } + }; - export let PlatformProtocol = Platform.DashPlatformProtocol; + export const PlatformProtocol = Platform.DashPlatformProtocol; - export let Essentials = { + export const Essentials = { Buffer, - } + }; - export let Errors = { - StateTransitionBroadcastError - } + export const Errors = { + StateTransitionBroadcastError, + }; } export { SDK as default }; diff --git a/packages/js-dash-sdk/src/errors/StateTransitionBroadcastError.ts b/packages/js-dash-sdk/src/errors/StateTransitionBroadcastError.ts index 589124a866b..6adeff5a10d 100644 --- a/packages/js-dash-sdk/src/errors/StateTransitionBroadcastError.ts +++ b/packages/js-dash-sdk/src/errors/StateTransitionBroadcastError.ts @@ -1,51 +1,53 @@ export class StateTransitionBroadcastError extends Error { - code: number; - message: string; - cause: Error; + code: number; - /** + message: string; + + cause: Error; + + /** * @param {number} code * @param {string} message * @param {Error} cause */ - constructor(code: number, message: string, cause: Error) { - super(message); + constructor(code: number, message: string, cause: Error) { + super(message); - this.code = code; - this.message = message; - this.cause = cause; + this.code = code; + this.message = message; + this.cause = cause; - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } - - Object.setPrototypeOf(this, StateTransitionBroadcastError.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); } - /** + Object.setPrototypeOf(this, StateTransitionBroadcastError.prototype); + } + + /** * Returns error code * * @return {number} */ - getCode(): number { - return this.code; - } + getCode(): number { + return this.code; + } - /** + /** * Returns error message * * @return {string} */ - getMessage(): string { - return this.message; - } + getMessage(): string { + return this.message; + } - /** + /** * Get error that was a cause * * @return {Error} */ - getCause(): any { - return this.cause; - } + getCause(): any { + return this.cause; + } } diff --git a/packages/js-dash-sdk/src/index.ts b/packages/js-dash-sdk/src/index.ts index ab350feed42..a2f96f0e7f3 100644 --- a/packages/js-dash-sdk/src/index.ts +++ b/packages/js-dash-sdk/src/index.ts @@ -1,2 +1,3 @@ -import SDK from './SDK' +import SDK from './SDK'; + export = SDK; diff --git a/packages/js-dash-sdk/src/logger/index.ts b/packages/js-dash-sdk/src/logger/index.ts index 78be467e4bd..d0b0bd763d9 100644 --- a/packages/js-dash-sdk/src/logger/index.ts +++ b/packages/js-dash-sdk/src/logger/index.ts @@ -1,9 +1,8 @@ -import { Logger, Logform } from "winston"; +import { Logger, Logform } from 'winston'; export type ConfigurableLogger = Logger & { getForId: (id: string) => ConfigurableLogger -} - +}; const util = require('util'); const winston = require('winston'); @@ -41,7 +40,7 @@ const createLogger = (formats: Logform.Format[] = []): ConfigurableLogger => win ), }), ], -}) +}); const logger = createLogger(); diff --git a/packages/js-dash-sdk/src/test/bootstrap.js b/packages/js-dash-sdk/src/test/bootstrap.js index f4fa0533099..be1264309b9 100644 --- a/packages/js-dash-sdk/src/test/bootstrap.js +++ b/packages/js-dash-sdk/src/test/bootstrap.js @@ -3,7 +3,7 @@ const path = require('path'); const sinon = require('sinon'); const sinonChai = require('sinon-chai'); -const { expect, use } = require('chai'); +const { use } = require('chai'); const dirtyChai = require('dirty-chai'); dotenvSafe.config({ @@ -21,7 +21,6 @@ before(function before() { } }); - after(function after() { this.sinon.restore(); }); diff --git a/packages/js-dash-sdk/src/test/fixtures/createIdentityFixtureInAccount.ts b/packages/js-dash-sdk/src/test/fixtures/createIdentityFixtureInAccount.ts index 30d635dc3bd..2e026669966 100644 --- a/packages/js-dash-sdk/src/test/fixtures/createIdentityFixtureInAccount.ts +++ b/packages/js-dash-sdk/src/test/fixtures/createIdentityFixtureInAccount.ts @@ -1,37 +1,39 @@ -import IdentityPublicKey from "@dashevo/dpp/lib/identity/IdentityPublicKey"; +import IdentityPublicKey from '@dashevo/dpp/lib/identity/IdentityPublicKey'; // @ts-ignore const getIdentityFixture = require('@dashevo/dpp/lib/test/fixtures/getIdentityFixture'); export function createIdentityFixtureInAccount(account) { - const identityFixture = getIdentityFixture(); - const identityFixtureIndex = 0; - const { privateKey: identityMasterPrivateKey } = account.identities.getIdentityHDKeyByIndex(identityFixtureIndex, 0); - const { privateKey: identitySecondPrivateKey } = account.identities.getIdentityHDKeyByIndex(identityFixtureIndex, 1); + const identityFixture = getIdentityFixture(); + const identityFixtureIndex = 0; + const { privateKey: identityMasterPrivateKey } = account + .identities.getIdentityHDKeyByIndex(identityFixtureIndex, 0); + const { privateKey: identitySecondPrivateKey } = account + .identities.getIdentityHDKeyByIndex(identityFixtureIndex, 1); - identityFixture.publicKeys[0] = new IdentityPublicKey({ - id: 0, - type: IdentityPublicKey.TYPES.ECDSA_SECP256K1, - data: identityMasterPrivateKey.toPublicKey().toBuffer(), - purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, - securityLevel: IdentityPublicKey.SECURITY_LEVELS.MASTER, - readOnly: false, - }); + identityFixture.publicKeys[0] = new IdentityPublicKey({ + id: 0, + type: IdentityPublicKey.TYPES.ECDSA_SECP256K1, + data: identityMasterPrivateKey.toPublicKey().toBuffer(), + purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, + securityLevel: IdentityPublicKey.SECURITY_LEVELS.MASTER, + readOnly: false, + }); - identityFixture.publicKeys[1] = new IdentityPublicKey({ - id: 1, - type: IdentityPublicKey.TYPES.ECDSA_SECP256K1, - data: identitySecondPrivateKey.toPublicKey().toBuffer(), - purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, - securityLevel: IdentityPublicKey.SECURITY_LEVELS.HIGH, - readOnly: false, - }); + identityFixture.publicKeys[1] = new IdentityPublicKey({ + id: 1, + type: IdentityPublicKey.TYPES.ECDSA_SECP256K1, + data: identitySecondPrivateKey.toPublicKey().toBuffer(), + purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION, + securityLevel: IdentityPublicKey.SECURITY_LEVELS.HIGH, + readOnly: false, + }); - account.storage - .getWalletStore(account.walletId) - .insertIdentityIdAtIndex( - identityFixture.getId().toString(), - identityFixtureIndex, + account.storage + .getWalletStore(account.walletId) + .insertIdentityIdAtIndex( + identityFixture.getId().toString(), + identityFixtureIndex, ); - return identityFixture; + return identityFixture; } diff --git a/packages/js-dash-sdk/src/test/fixtures/createTransactionFixtureInAccount.ts b/packages/js-dash-sdk/src/test/fixtures/createTransactionFixtureInAccount.ts index 0505d5b2182..6eeded0616f 100644 --- a/packages/js-dash-sdk/src/test/fixtures/createTransactionFixtureInAccount.ts +++ b/packages/js-dash-sdk/src/test/fixtures/createTransactionFixtureInAccount.ts @@ -1,17 +1,17 @@ -import { Transaction } from "@dashevo/dashcore-lib"; +import { Transaction } from '@dashevo/dashcore-lib'; export async function createTransactionInAccount(account) { - // add fake tx to the wallet so it will be able to create transactions - const walletTransaction = new Transaction(undefined) - .from([{ - amount: 1500000, - script: '76a914f9996443a7d5e2694560f8715e5e8fe602133c6088ac', - outputIndex: 0, - txid: new Transaction(undefined).hash, - }]) - .to(account.getAddress(10).address, 1000000); + // add fake tx to the wallet so it will be able to create transactions + const walletTransaction = new Transaction(undefined) + .from([{ + amount: 1500000, + script: '76a914f9996443a7d5e2694560f8715e5e8fe602133c6088ac', + outputIndex: 0, + txid: new Transaction(undefined).hash, + }]) + .to(account.getAddress(10).address, 1000000); - await account.importTransactions([[walletTransaction.serialize(true)]]); + await account.importTransactions([[walletTransaction.serialize(true)]]); - return walletTransaction; + return walletTransaction; } diff --git a/packages/js-dash-sdk/src/test/fixtures/getResponseMetadataFixture.ts b/packages/js-dash-sdk/src/test/fixtures/getResponseMetadataFixture.ts index f2b8aaad6c4..801eff19258 100644 --- a/packages/js-dash-sdk/src/test/fixtures/getResponseMetadataFixture.ts +++ b/packages/js-dash-sdk/src/test/fixtures/getResponseMetadataFixture.ts @@ -1,4 +1,4 @@ -const Metadata = require("@dashevo/dapi-client/lib/methods/platform/response/Metadata"); +const Metadata = require('@dashevo/dapi-client/lib/methods/platform/response/Metadata'); function getResponseMetadataFixture() { const metadata = { diff --git a/packages/js-dash-sdk/src/test/mocks/createAndAttachTransportMocksToClient.ts b/packages/js-dash-sdk/src/test/mocks/createAndAttachTransportMocksToClient.ts index a3e68418738..03b309085e7 100644 --- a/packages/js-dash-sdk/src/test/mocks/createAndAttachTransportMocksToClient.ts +++ b/packages/js-dash-sdk/src/test/mocks/createAndAttachTransportMocksToClient.ts @@ -1,14 +1,15 @@ -import { Transaction } from "@dashevo/dashcore-lib"; -import DAPIClient from "@dashevo/dapi-client"; -import stateTransitionTypes from "@dashevo/dpp/lib/stateTransition/stateTransitionTypes"; -import Identity from "@dashevo/dpp/lib/identity/Identity"; +import { Transaction } from '@dashevo/dashcore-lib'; +import DAPIClient from '@dashevo/dapi-client'; +import stateTransitionTypes from '@dashevo/dpp/lib/stateTransition/stateTransitionTypes'; +import Identity from '@dashevo/dpp/lib/identity/Identity'; -import { createFakeInstantLock } from "../../utils/createFakeIntantLock"; +import { createFakeInstantLock } from '../../utils/createFakeIntantLock'; import getResponseMetadataFixture from '../fixtures/getResponseMetadataFixture'; -import { createDapiClientMock } from "./createDapiClientMock"; +import { createDapiClientMock } from './createDapiClientMock'; -import { wait } from "../../utils/wait"; -const GetIdentityResponse = require("@dashevo/dapi-client/lib/methods/platform/getIdentity/GetIdentityResponse"); +import { wait } from '../../utils/wait'; + +const GetIdentityResponse = require('@dashevo/dapi-client/lib/methods/platform/getIdentity/GetIdentityResponse'); // @ts-ignore const TxStreamMock = require('@dashevo/wallet-lib/src/test/mocks/TxStreamMock'); @@ -27,17 +28,17 @@ function makeTxStreamEmitISLocksForTransactions(transportMock, txStreamMock) { txStreamMock.emit( TxStreamMock.EVENTS.data, new TxStreamDataResponseMock( - { instantSendLockMessages: [isLock.toBuffer()] } - ) + { instantSendLockMessages: [isLock.toBuffer()] }, + ), ); - }) + }); // Emit the same transaction back to the client so it will know about the change transaction txStreamMock.emit( TxStreamMock.EVENTS.data, new TxStreamDataResponseMock( - { rawTransactions: [transaction.toBuffer()] } - ) + { rawTransactions: [transaction.toBuffer()] }, + ), ); return transaction.hash; @@ -50,54 +51,58 @@ function makeTxStreamEmitISLocksForTransactions(transportMock, txStreamMock) { * @param dapiClientMock */ function makeGetIdentityRespondWithIdentity(client, dapiClientMock) { - dapiClientMock.platform.broadcastStateTransition.callsFake(async (stBuffer) => { - let interceptedIdentityStateTransition = await client.platform.dpp.stateTransition.createFromBuffer(stBuffer); - - if (interceptedIdentityStateTransition.getType() === stateTransitionTypes.IDENTITY_CREATE) { - - - let identityToResolve = new Identity({ - protocolVersion: interceptedIdentityStateTransition.getProtocolVersion(), - id: interceptedIdentityStateTransition.getIdentityId().toBuffer(), - publicKeys: interceptedIdentityStateTransition.getPublicKeys().map((key) => key.toObject({ skipSignature: true })), - balance: interceptedIdentityStateTransition.getAssetLockProof().getOutput().satoshis, - revision: 0, - }); - dapiClientMock.platform.getIdentity.withArgs(identityToResolve.getId()).resolves(new GetIdentityResponse(identityToResolve.toBuffer(), getResponseMetadataFixture())); - } - }); + dapiClientMock.platform.broadcastStateTransition.callsFake(async (stBuffer) => { + const interceptedIdentityStateTransition = await client + .platform.dpp.stateTransition.createFromBuffer(stBuffer); + + if (interceptedIdentityStateTransition.getType() === stateTransitionTypes.IDENTITY_CREATE) { + const identityToResolve = new Identity({ + protocolVersion: interceptedIdentityStateTransition.getProtocolVersion(), + id: interceptedIdentityStateTransition.getIdentityId().toBuffer(), + publicKeys: interceptedIdentityStateTransition + .getPublicKeys().map((key) => key.toObject({ skipSignature: true })), + balance: interceptedIdentityStateTransition.getAssetLockProof().getOutput().satoshis, + revision: 0, + }); + dapiClientMock.platform.getIdentity.withArgs(identityToResolve.getId()) + .resolves(new GetIdentityResponse( + identityToResolve.toBuffer(), + getResponseMetadataFixture(), + )); + } + }); } export async function createAndAttachTransportMocksToClient(client, sinon) { - const txStreamMock = new TxStreamMock(); - const transportMock = new TransportMock(sinon, txStreamMock); - const dapiClientMock = createDapiClientMock(sinon); + const txStreamMock = new TxStreamMock(); + const transportMock = new TransportMock(sinon, txStreamMock); + const dapiClientMock = createDapiClientMock(sinon); - // Mock wallet-lib transport to intercept transactions - client.wallet.transport = transportMock; - // Mock dapi client for platform endpoints - client.dapiClient = dapiClientMock; + // Mock wallet-lib transport to intercept transactions + client.wallet.transport = transportMock; + // Mock dapi client for platform endpoints + client.dapiClient = dapiClientMock; - // Starting account sync - const accountPromise = client.wallet.getAccount(); - // Breaking the event loop to emit an event - await wait(0); + // Starting account sync + const accountPromise = client.wallet.getAccount(); + // Breaking the event loop to emit an event + await wait(0); - // Simulate headers sync finish - const { blockHeadersProvider } = client.wallet.transport.client; - blockHeadersProvider.emit(DAPIClient.BlockHeadersProvider.EVENTS.HISTORICAL_DATA_OBTAINED) - await wait(0); + // Simulate headers sync finish + const { blockHeadersProvider } = client.wallet.transport.client; + blockHeadersProvider.emit(DAPIClient.BlockHeadersProvider.EVENTS.HISTORICAL_DATA_OBTAINED); + await wait(0); - // Emitting TX stream end event to mark finish of the tx sync - txStreamMock.emit(TxStreamMock.EVENTS.end); + // Emitting TX stream end event to mark finish of the tx sync + txStreamMock.emit(TxStreamMock.EVENTS.end); - // Wait for account to resolve - await accountPromise; + // Wait for account to resolve + await accountPromise; - // Putting data in transport stubs - transportMock.getIdentitiesByPublicKeyHashes.resolves([]); - makeTxStreamEmitISLocksForTransactions(transportMock, txStreamMock); - makeGetIdentityRespondWithIdentity(client, dapiClientMock); + // Putting data in transport stubs + transportMock.getIdentitiesByPublicKeyHashes.resolves([]); + makeTxStreamEmitISLocksForTransactions(transportMock, txStreamMock); + makeGetIdentityRespondWithIdentity(client, dapiClientMock); - return { txStreamMock, transportMock, dapiClientMock }; + return { txStreamMock, transportMock, dapiClientMock }; } diff --git a/packages/js-dash-sdk/src/test/mocks/createDapiClientMock.ts b/packages/js-dash-sdk/src/test/mocks/createDapiClientMock.ts index e01783f6bb4..b5242efd843 100644 --- a/packages/js-dash-sdk/src/test/mocks/createDapiClientMock.ts +++ b/packages/js-dash-sdk/src/test/mocks/createDapiClientMock.ts @@ -1,12 +1,12 @@ -import { SinonSandbox } from "sinon"; +import { SinonSandbox } from 'sinon'; export function createDapiClientMock(sinon: SinonSandbox) { - return { - platform: { - broadcastStateTransition: sinon.stub(), - getIdentity: sinon.stub(), - waitForStateTransitionResult: sinon.stub().resolves({}), - getDataContract: sinon.stub(), - } - } + return { + platform: { + broadcastStateTransition: sinon.stub(), + getIdentity: sinon.stub(), + waitForStateTransitionResult: sinon.stub().resolves({}), + getDataContract: sinon.stub(), + }, + }; } diff --git a/packages/js-dash-sdk/src/utils/createFakeIntantLock.ts b/packages/js-dash-sdk/src/utils/createFakeIntantLock.ts index c10aee58d75..ade82da25c6 100644 --- a/packages/js-dash-sdk/src/utils/createFakeIntantLock.ts +++ b/packages/js-dash-sdk/src/utils/createFakeIntantLock.ts @@ -1,16 +1,16 @@ -import { InstantLock } from "@dashevo/dashcore-lib"; +import { InstantLock } from '@dashevo/dashcore-lib'; export function createFakeInstantLock(transactionHash: string): InstantLock { - return new InstantLock({ - version: 1, - txid: transactionHash, - signature: Buffer.alloc(96).toString('hex'), - cyclehash: '0dc8d0df62b076a7757ab5ca07dde0f1e2bfaf83f94299fd9a77577e6cc7022e', - inputs: [ - { - outpointHash: '6e200d059fb567ba19e92f5c2dcd3dde522fd4e0a50af223752db16158dabb1d', - outpointIndex: 0, - }, - ], - }); + return new InstantLock({ + version: 1, + txid: transactionHash, + signature: Buffer.alloc(96).toString('hex'), + cyclehash: '0dc8d0df62b076a7757ab5ca07dde0f1e2bfaf83f94299fd9a77577e6cc7022e', + inputs: [ + { + outpointHash: '6e200d059fb567ba19e92f5c2dcd3dde522fd4e0a50af223752db16158dabb1d', + outpointIndex: 0, + }, + ], + }); } diff --git a/packages/js-dash-sdk/src/utils/wait.ts b/packages/js-dash-sdk/src/utils/wait.ts index 4b4e13f1c43..8be693e0625 100644 --- a/packages/js-dash-sdk/src/utils/wait.ts +++ b/packages/js-dash-sdk/src/utils/wait.ts @@ -6,5 +6,5 @@ * @returns {Promise} The promise to await on. */ export async function wait(ms): Promise { - return new Promise((resolve) => setTimeout(resolve, ms)); + return new Promise((resolve) => setTimeout(resolve, ms)); } diff --git a/packages/js-dash-sdk/tests/functional/sdk.js b/packages/js-dash-sdk/tests/functional/sdk.js index d0a7e83f8b0..9673ef6facd 100644 --- a/packages/js-dash-sdk/tests/functional/sdk.js +++ b/packages/js-dash-sdk/tests/functional/sdk.js @@ -6,6 +6,7 @@ const { Networks, } = require('@dashevo/dashcore-lib'); +// eslint-disable-next-line const Dash = require(typeof process === 'undefined' ? '../../src/index.ts' : '../../'); describe('SDK', function suite() { @@ -27,8 +28,8 @@ describe('SDK', function suite() { apps: { dpns: { contractId: dpnsContractId, - } - } + }, + }, }; clientInstance = new Dash.Client(clientOpts); @@ -58,12 +59,13 @@ describe('SDK', function suite() { account = await clientInstance.getWalletAccount(); expect(account.index).to.equal(0); - }) + }); - it('should sign and verify a message', async function () { + it('should sign and verify a message', async () => { const idKey = account.identities.getIdentityHDKeyByIndex(0, 0); // This transforms from a Wallet-Lib.PrivateKey to a Dashcore-lib.PrivateKey. - // It will quickly be annoying to perform this, and we therefore need to find a better solution for that. + // It will quickly be annoying to perform this, + // and we therefore need to find a better solution for that. const privateKey = Dash.Core.PrivateKey(idKey.privateKey); const message = Dash.Core.Message('hello, world'); const signed = message.sign(privateKey); @@ -71,7 +73,7 @@ describe('SDK', function suite() { expect(verify).to.equal(true); }); - it('should disconnect', async function () { + it('should disconnect', async () => { await clientInstance.disconnect(); }); }); diff --git a/packages/js-dash-sdk/webpack.base.config.js b/packages/js-dash-sdk/webpack.base.config.js index 792f16f9de3..05486edfcea 100644 --- a/packages/js-dash-sdk/webpack.base.config.js +++ b/packages/js-dash-sdk/webpack.base.config.js @@ -1,6 +1,6 @@ const path = require('path'); const webpack = require('webpack'); -const TerserPlugin = require("terser-webpack-plugin"); +const TerserPlugin = require('terser-webpack-plugin'); const baseConfig = { entry: './src/index.ts', @@ -18,8 +18,8 @@ const baseConfig = { minimize: true, minimizer: [new TerserPlugin({ terserOptions: { - keep_classnames: true // fixes empty string in `object.constructor.name` - } + keep_classnames: true, // fixes empty string in `object.constructor.name` + }, })], }, resolve: { @@ -54,5 +54,5 @@ const baseConfig = { output: { path: path.resolve(__dirname, 'dist'), }, -} +}; module.exports = baseConfig; diff --git a/packages/js-dash-sdk/webpack.config.js b/packages/js-dash-sdk/webpack.config.js index 0e19cf8a788..4dd12faecdb 100644 --- a/packages/js-dash-sdk/webpack.config.js +++ b/packages/js-dash-sdk/webpack.config.js @@ -1,7 +1,7 @@ const path = require('path'); -const webpackBaseConfig = require("./webpack.base.config"); +const webpackBaseConfig = require('./webpack.base.config'); -const webConfig = { +const webConfig = { ...webpackBaseConfig, entry: './build/src/index.js', devtool: 'source-map', @@ -11,12 +11,12 @@ const webConfig = { path: path.resolve(__dirname, 'dist'), library: { name: 'Dash', - type: 'umd' + type: 'umd', }, filename: 'dash.min.js', // fixes ReferenceError: window is not defined - globalObject: "(typeof self !== 'undefined' ? self : this)" + globalObject: "(typeof self !== 'undefined' ? self : this)", }, -} +}; module.exports = [webConfig]; diff --git a/yarn.lock b/yarn.lock index f800fb655d6..fec9754b744 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2042,6 +2042,24 @@ __metadata: languageName: node linkType: hard +"@eslint-community/eslint-utils@npm:^4.2.0": + version: 4.2.0 + resolution: "@eslint-community/eslint-utils@npm:4.2.0" + dependencies: + eslint-visitor-keys: ^3.3.0 + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + checksum: 82fdd1cc2a5d169def0e665ec790580ef708e7df9c91f20006595dc90e3bd42ec31c8976a2eeccd336286301a72e937c0ddf3ab4b7377d7014997c36333a7d22 + languageName: node + linkType: hard + +"@eslint-community/regexpp@npm:^4.4.0": + version: 4.4.0 + resolution: "@eslint-community/regexpp@npm:4.4.0" + checksum: 2d127af0c752b80e8a782eacfe996a86925d21de92da3ffc6f9e615e701145e44a62e26bdd88bfac2cd76779c39ba8d9875a91046ec5e7e5f23cb647c247ea6a + languageName: node + linkType: hard + "@eslint/eslintrc@npm:^0.4.3": version: 0.4.3 resolution: "@eslint/eslintrc@npm:0.4.3" @@ -3016,6 +3034,13 @@ __metadata: languageName: node linkType: hard +"@types/json-schema@npm:^7.0.9": + version: 7.0.11 + resolution: "@types/json-schema@npm:7.0.11" + checksum: 527bddfe62db9012fccd7627794bd4c71beb77601861055d87e3ee464f2217c85fca7a4b56ae677478367bbd248dbde13553312b7d4dbc702a2f2bbf60c4018d + languageName: node + linkType: hard + "@types/json5@npm:^0.0.29": version: 0.0.29 resolution: "@types/json5@npm:0.0.29" @@ -3170,6 +3195,13 @@ __metadata: languageName: node linkType: hard +"@types/semver@npm:^7.3.12": + version: 7.3.13 + resolution: "@types/semver@npm:7.3.13" + checksum: 00c0724d54757c2f4bc60b5032fe91cda6410e48689633d5f35ece8a0a66445e3e57fa1d6e07eb780f792e82ac542948ec4d0b76eb3484297b79bd18b8cf1cb0 + languageName: node + linkType: hard + "@types/sinon-chai@npm:^3.2.4": version: 3.2.5 resolution: "@types/sinon-chai@npm:3.2.5" @@ -3247,6 +3279,127 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/eslint-plugin@npm:^5.55.0": + version: 5.55.0 + resolution: "@typescript-eslint/eslint-plugin@npm:5.55.0" + dependencies: + "@eslint-community/regexpp": ^4.4.0 + "@typescript-eslint/scope-manager": 5.55.0 + "@typescript-eslint/type-utils": 5.55.0 + "@typescript-eslint/utils": 5.55.0 + debug: ^4.3.4 + grapheme-splitter: ^1.0.4 + ignore: ^5.2.0 + natural-compare-lite: ^1.4.0 + semver: ^7.3.7 + tsutils: ^3.21.0 + peerDependencies: + "@typescript-eslint/parser": ^5.0.0 + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: e3239ec6016eeb73b8b4d8310581978e28b8d3378140a8eb70bd8e33ffd332266020c19d493e0ccae4edfd4abd6097608718c50308fe6288f4ffeb8e4784efd9 + languageName: node + linkType: hard + +"@typescript-eslint/parser@npm:^5.55.0": + version: 5.55.0 + resolution: "@typescript-eslint/parser@npm:5.55.0" + dependencies: + "@typescript-eslint/scope-manager": 5.55.0 + "@typescript-eslint/types": 5.55.0 + "@typescript-eslint/typescript-estree": 5.55.0 + debug: ^4.3.4 + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 48a20dc7e67960b5168b77bfb9d11d053a21d57bb83cf7b59f750191cbca5eea3b4636a8e6e75cc0aca5a84cdef91fed5440934fc2935f8c6fa71630a253a50c + languageName: node + linkType: hard + +"@typescript-eslint/scope-manager@npm:5.55.0": + version: 5.55.0 + resolution: "@typescript-eslint/scope-manager@npm:5.55.0" + dependencies: + "@typescript-eslint/types": 5.55.0 + "@typescript-eslint/visitor-keys": 5.55.0 + checksum: f253db88f69a29e4abe2f567d0a611cc3e7fb1a911a2cc54a2f6baf16e3de4d1883b3f8e45ee61b3db9fa5543dda0fd7b608de9d28ba6173ab49bfd17ff90cad + languageName: node + linkType: hard + +"@typescript-eslint/type-utils@npm:5.55.0": + version: 5.55.0 + resolution: "@typescript-eslint/type-utils@npm:5.55.0" + dependencies: + "@typescript-eslint/typescript-estree": 5.55.0 + "@typescript-eslint/utils": 5.55.0 + debug: ^4.3.4 + tsutils: ^3.21.0 + peerDependencies: + eslint: "*" + peerDependenciesMeta: + typescript: + optional: true + checksum: 5c60d441355b51f96b596324068c10605c74abb46748c0bbc6d8f7f2ea40acb6b4bda3b537105fa189172324c56d18bd88e7102e67f99f8c03bc05c6d0e2023d + languageName: node + linkType: hard + +"@typescript-eslint/types@npm:5.55.0": + version: 5.55.0 + resolution: "@typescript-eslint/types@npm:5.55.0" + checksum: 7d851f09a2106514d3a9c7164d34758f30abfe554e3c7a02be75cdc7e16644e23ca32840a8f39a0321bc509927fb4d98ce91b22b21e8544ac56cef33b815a864 + languageName: node + linkType: hard + +"@typescript-eslint/typescript-estree@npm:5.55.0": + version: 5.55.0 + resolution: "@typescript-eslint/typescript-estree@npm:5.55.0" + dependencies: + "@typescript-eslint/types": 5.55.0 + "@typescript-eslint/visitor-keys": 5.55.0 + debug: ^4.3.4 + globby: ^11.1.0 + is-glob: ^4.0.3 + semver: ^7.3.7 + tsutils: ^3.21.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: d24a11aee3d01067018d99804f420aecb8af88e43bf170d5d14f6480bd378c0a81ce49a37f5d6c36e5f0f319e3fa8b099720f295f2767338be1a4f7e9a5323e1 + languageName: node + linkType: hard + +"@typescript-eslint/utils@npm:5.55.0": + version: 5.55.0 + resolution: "@typescript-eslint/utils@npm:5.55.0" + dependencies: + "@eslint-community/eslint-utils": ^4.2.0 + "@types/json-schema": ^7.0.9 + "@types/semver": ^7.3.12 + "@typescript-eslint/scope-manager": 5.55.0 + "@typescript-eslint/types": 5.55.0 + "@typescript-eslint/typescript-estree": 5.55.0 + eslint-scope: ^5.1.1 + semver: ^7.3.7 + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 + checksum: 368cfc3fb9d6af6901e739e2e41c3f7f1c1244576607445f4f59d95eccb237f73e1a75e7f0816ec9a32a0f1ec6bb4a3602a99e17e70fe184e62f7c69dcbe4b8d + languageName: node + linkType: hard + +"@typescript-eslint/visitor-keys@npm:5.55.0": + version: 5.55.0 + resolution: "@typescript-eslint/visitor-keys@npm:5.55.0" + dependencies: + "@typescript-eslint/types": 5.55.0 + eslint-visitor-keys: ^3.3.0 + checksum: 0b24c72dff99dd2cf41c19d20067f8ab20a38aa2e82c79c5530bec7cf651031e95c80702fc21c813c9b94e5f3d4cd210f13967b2966ef38abe548cb5f05848a3 + languageName: node + linkType: hard + "@ungap/promise-all-settled@npm:1.1.2": version: 1.1.2 resolution: "@ungap/promise-all-settled@npm:1.1.2" @@ -3859,6 +4012,16 @@ __metadata: languageName: node linkType: hard +"array-buffer-byte-length@npm:^1.0.0": + version: 1.0.0 + resolution: "array-buffer-byte-length@npm:1.0.0" + dependencies: + call-bind: ^1.0.2 + is-array-buffer: ^3.0.1 + checksum: 044e101ce150f4804ad19c51d6c4d4cfa505c5b2577bd179256e4aa3f3f6a0a5e9874c78cd428ee566ac574c8a04d7ce21af9fe52e844abfdccb82b33035a7c3 + languageName: node + linkType: hard + "array-differ@npm:^3.0.0": version: 3.0.0 resolution: "array-differ@npm:3.0.0" @@ -5712,6 +5875,8 @@ __metadata: "@types/node": ^14.6.0 "@types/sinon": ^9.0.4 "@types/sinon-chai": ^3.2.4 + "@typescript-eslint/eslint-plugin": ^5.55.0 + "@typescript-eslint/parser": ^5.55.0 assert: ^2.0.0 browserify-zlib: ^0.2.0 bs58: ^4.0.1 @@ -5721,6 +5886,10 @@ __metadata: crypto-browserify: ^3.12.0 dirty-chai: ^2.0.1 dotenv-safe: ^8.2.0 + eslint: ^7.32.0 + eslint-config-airbnb-base: ^14.2.1 + eslint-config-airbnb-typescript: ^17.0.0 + eslint-plugin-import: ^2.24.2 events: ^3.3.0 https-browserify: ^1.0.0 karma: ^6.4.1 @@ -6019,6 +6188,16 @@ __metadata: languageName: node linkType: hard +"define-properties@npm:^1.1.4": + version: 1.2.0 + resolution: "define-properties@npm:1.2.0" + dependencies: + has-property-descriptors: ^1.0.0 + object-keys: ^1.1.1 + checksum: e60aee6a19b102df4e2b1f301816804e81ab48bb91f00d0d935f269bf4b3f79c88b39e4f89eaa132890d23267335fd1140dfcd8d5ccd61031a0a2c41a54e33a6 + languageName: node + linkType: hard + "delay@npm:^5.0.0": version: 5.0.0 resolution: "delay@npm:5.0.0" @@ -6499,6 +6678,48 @@ __metadata: languageName: node linkType: hard +"es-abstract@npm:^1.20.4": + version: 1.21.2 + resolution: "es-abstract@npm:1.21.2" + dependencies: + array-buffer-byte-length: ^1.0.0 + available-typed-arrays: ^1.0.5 + call-bind: ^1.0.2 + es-set-tostringtag: ^2.0.1 + es-to-primitive: ^1.2.1 + function.prototype.name: ^1.1.5 + get-intrinsic: ^1.2.0 + get-symbol-description: ^1.0.0 + globalthis: ^1.0.3 + gopd: ^1.0.1 + has: ^1.0.3 + has-property-descriptors: ^1.0.0 + has-proto: ^1.0.1 + has-symbols: ^1.0.3 + internal-slot: ^1.0.5 + is-array-buffer: ^3.0.2 + is-callable: ^1.2.7 + is-negative-zero: ^2.0.2 + is-regex: ^1.1.4 + is-shared-array-buffer: ^1.0.2 + is-string: ^1.0.7 + is-typed-array: ^1.1.10 + is-weakref: ^1.0.2 + object-inspect: ^1.12.3 + object-keys: ^1.1.1 + object.assign: ^4.1.4 + regexp.prototype.flags: ^1.4.3 + safe-regex-test: ^1.0.0 + string.prototype.trim: ^1.2.7 + string.prototype.trimend: ^1.0.6 + string.prototype.trimstart: ^1.0.6 + typed-array-length: ^1.0.4 + unbox-primitive: ^1.0.2 + which-typed-array: ^1.1.9 + checksum: 037f55ee5e1cdf2e5edbab5524095a4f97144d95b94ea29e3611b77d852fd8c8a40e7ae7101fa6a759a9b9b1405f188c3c70928f2d3cd88d543a07fc0d5ad41a + languageName: node + linkType: hard + "es-module-lexer@npm:^0.9.0": version: 0.9.3 resolution: "es-module-lexer@npm:0.9.3" @@ -6506,6 +6727,17 @@ __metadata: languageName: node linkType: hard +"es-set-tostringtag@npm:^2.0.1": + version: 2.0.1 + resolution: "es-set-tostringtag@npm:2.0.1" + dependencies: + get-intrinsic: ^1.1.3 + has: ^1.0.3 + has-tostringtag: ^1.0.0 + checksum: ec416a12948cefb4b2a5932e62093a7cf36ddc3efd58d6c58ca7ae7064475ace556434b869b0bbeb0c365f1032a8ccd577211101234b69837ad83ad204fff884 + languageName: node + linkType: hard + "es-to-primitive@npm:^1.2.1": version: 1.2.1 resolution: "es-to-primitive@npm:1.2.1" @@ -6622,6 +6854,35 @@ __metadata: languageName: node linkType: hard +"eslint-config-airbnb-base@npm:^15.0.0": + version: 15.0.0 + resolution: "eslint-config-airbnb-base@npm:15.0.0" + dependencies: + confusing-browser-globals: ^1.0.10 + object.assign: ^4.1.2 + object.entries: ^1.1.5 + semver: ^6.3.0 + peerDependencies: + eslint: ^7.32.0 || ^8.2.0 + eslint-plugin-import: ^2.25.2 + checksum: 38626bad2ce2859fccac86b30cd2b86c9b7d8d71d458331860861dc05290a5b198bded2f4fb89efcb9046ec48f8ab4c4fb00365ba8916f27b172671da28b93ea + languageName: node + linkType: hard + +"eslint-config-airbnb-typescript@npm:^17.0.0": + version: 17.0.0 + resolution: "eslint-config-airbnb-typescript@npm:17.0.0" + dependencies: + eslint-config-airbnb-base: ^15.0.0 + peerDependencies: + "@typescript-eslint/eslint-plugin": ^5.13.0 + "@typescript-eslint/parser": ^5.0.0 + eslint: ^7.32.0 || ^8.2.0 + eslint-plugin-import: ^2.25.3 + checksum: e598ae7bcc3629bbc847a749f8c1ad69e6ef111335b60d88bde91d1bb335077b06688868257fe2fcc95c3687a0d6e3e1f91e0534cc633f5a118239e52bb05a54 + languageName: node + linkType: hard + "eslint-import-resolver-node@npm:^0.3.6": version: 0.3.6 resolution: "eslint-import-resolver-node@npm:0.3.6" @@ -6723,6 +6984,13 @@ __metadata: languageName: node linkType: hard +"eslint-visitor-keys@npm:^3.3.0": + version: 3.3.0 + resolution: "eslint-visitor-keys@npm:3.3.0" + checksum: d59e68a7c5a6d0146526b0eec16ce87fbf97fe46b8281e0d41384224375c4e52f5ffb9e16d48f4ea50785cde93f766b0c898e31ab89978d88b0e1720fbfb7808 + languageName: node + linkType: hard + "eslint@npm:^7.32.0": version: 7.32.0 resolution: "eslint@npm:7.32.0" @@ -7246,6 +7514,15 @@ __metadata: languageName: node linkType: hard +"for-each@npm:^0.3.3": + version: 0.3.3 + resolution: "for-each@npm:0.3.3" + dependencies: + is-callable: ^1.1.3 + checksum: 6c48ff2bc63362319c65e2edca4a8e1e3483a2fabc72fbe7feaf8c73db94fc7861bd53bc02c8a66a0c1dd709da6b04eec42e0abdd6b40ce47305ae92a25e5d28 + languageName: node + linkType: hard + "foreach@npm:^2.0.4, foreach@npm:^2.0.5": version: 2.0.5 resolution: "foreach@npm:2.0.5" @@ -7349,6 +7626,18 @@ fsevents@~2.3.2: languageName: node linkType: hard +"function.prototype.name@npm:^1.1.5": + version: 1.1.5 + resolution: "function.prototype.name@npm:1.1.5" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.3 + es-abstract: ^1.19.0 + functions-have-names: ^1.2.2 + checksum: acd21d733a9b649c2c442f067567743214af5fa248dbeee69d8278ce7df3329ea5abac572be9f7470b4ec1cd4d8f1040e3c5caccf98ebf2bf861a0deab735c27 + languageName: node + linkType: hard + "functional-red-black-tree@npm:^1.0.1, functional-red-black-tree@npm:~1.0.1": version: 1.0.1 resolution: "functional-red-black-tree@npm:1.0.1" @@ -7356,6 +7645,13 @@ fsevents@~2.3.2: languageName: node linkType: hard +"functions-have-names@npm:^1.2.2": + version: 1.2.3 + resolution: "functions-have-names@npm:1.2.3" + checksum: c3f1f5ba20f4e962efb71344ce0a40722163e85bee2101ce25f88214e78182d2d2476aa85ef37950c579eb6cf6ee811c17b3101bb84004bb75655f3e33f3fdb5 + languageName: node + linkType: hard + "gauge@npm:^3.0.0": version: 3.0.2 resolution: "gauge@npm:3.0.2" @@ -7438,6 +7734,17 @@ fsevents@~2.3.2: languageName: node linkType: hard +"get-intrinsic@npm:^1.1.3, get-intrinsic@npm:^1.2.0": + version: 1.2.0 + resolution: "get-intrinsic@npm:1.2.0" + dependencies: + function-bind: ^1.1.1 + has: ^1.0.3 + has-symbols: ^1.0.3 + checksum: 78fc0487b783f5c58cf2dccafc3ae656ee8d2d8062a8831ce4a95e7057af4587a1d4882246c033aca0a7b4965276f4802b45cc300338d1b77a73d3e3e3f4877d + languageName: node + linkType: hard + "get-package-type@npm:^0.1.0": version: 0.1.0 resolution: "get-package-type@npm:0.1.0" @@ -7644,6 +7951,15 @@ fsevents@~2.3.2: languageName: node linkType: hard +"globalthis@npm:^1.0.3": + version: 1.0.3 + resolution: "globalthis@npm:1.0.3" + dependencies: + define-properties: ^1.1.3 + checksum: fbd7d760dc464c886d0196166d92e5ffb4c84d0730846d6621a39fbbc068aeeb9c8d1421ad330e94b7bca4bb4ea092f5f21f3d36077812af5d098b4dc006c998 + languageName: node + linkType: hard + "globby@npm:^11, globby@npm:^11.0.1, globby@npm:^11.0.3, globby@npm:^11.1.0": version: 11.1.0 resolution: "globby@npm:11.1.0" @@ -7672,6 +7988,15 @@ fsevents@~2.3.2: languageName: node linkType: hard +"gopd@npm:^1.0.1": + version: 1.0.1 + resolution: "gopd@npm:1.0.1" + dependencies: + get-intrinsic: ^1.1.3 + checksum: a5ccfb8806e0917a94e0b3de2af2ea4979c1da920bc381667c260e00e7cafdbe844e2cb9c5bcfef4e5412e8bf73bab837285bc35c7ba73aaaf0134d4583393a6 + languageName: node + linkType: hard + "got@npm:^11": version: 11.8.6 resolution: "got@npm:11.8.6" @@ -7717,6 +8042,13 @@ fsevents@~2.3.2: languageName: node linkType: hard +"grapheme-splitter@npm:^1.0.4": + version: 1.0.4 + resolution: "grapheme-splitter@npm:1.0.4" + checksum: 0c22ec54dee1b05cd480f78cf14f732cb5b108edc073572c4ec205df4cd63f30f8db8025afc5debc8835a8ddeacf648a1c7992fe3dcd6ad38f9a476d84906620 + languageName: node + linkType: hard + "grouped-queue@npm:^2.0.0": version: 2.0.0 resolution: "grouped-queue@npm:2.0.0" @@ -7772,6 +8104,13 @@ fsevents@~2.3.2: languageName: node linkType: hard +"has-bigints@npm:^1.0.2": + version: 1.0.2 + resolution: "has-bigints@npm:1.0.2" + checksum: 390e31e7be7e5c6fe68b81babb73dfc35d413604d7ee5f56da101417027a4b4ce6a27e46eff97ad040c835b5d228676eae99a9b5c3bc0e23c8e81a49241ff45b + languageName: node + linkType: hard + "has-flag@npm:^3.0.0": version: 3.0.0 resolution: "has-flag@npm:3.0.0" @@ -7786,6 +8125,22 @@ fsevents@~2.3.2: languageName: node linkType: hard +"has-property-descriptors@npm:^1.0.0": + version: 1.0.0 + resolution: "has-property-descriptors@npm:1.0.0" + dependencies: + get-intrinsic: ^1.1.1 + checksum: a6d3f0a266d0294d972e354782e872e2fe1b6495b321e6ef678c9b7a06a40408a6891817350c62e752adced73a94ac903c54734fee05bf65b1905ee1368194bb + languageName: node + linkType: hard + +"has-proto@npm:^1.0.1": + version: 1.0.1 + resolution: "has-proto@npm:1.0.1" + checksum: febc5b5b531de8022806ad7407935e2135f1cc9e64636c3916c6842bd7995994ca3b29871ecd7954bd35f9e2986c17b3b227880484d22259e2f8e6ce63fd383e + languageName: node + linkType: hard + "has-symbols@npm:^1.0.1, has-symbols@npm:^1.0.2": version: 1.0.2 resolution: "has-symbols@npm:1.0.2" @@ -7793,6 +8148,13 @@ fsevents@~2.3.2: languageName: node linkType: hard +"has-symbols@npm:^1.0.3": + version: 1.0.3 + resolution: "has-symbols@npm:1.0.3" + checksum: a054c40c631c0d5741a8285010a0777ea0c068f99ed43e5d6eb12972da223f8af553a455132fdb0801bdcfa0e0f443c0c03a68d8555aa529b3144b446c3f2410 + languageName: node + linkType: hard + "has-tostringtag@npm:^1.0.0": version: 1.0.0 resolution: "has-tostringtag@npm:1.0.0" @@ -8250,6 +8612,17 @@ fsevents@~2.3.2: languageName: node linkType: hard +"internal-slot@npm:^1.0.5": + version: 1.0.5 + resolution: "internal-slot@npm:1.0.5" + dependencies: + get-intrinsic: ^1.2.0 + has: ^1.0.3 + side-channel: ^1.0.4 + checksum: 97e84046bf9e7574d0956bd98d7162313ce7057883b6db6c5c7b5e5f05688864b0978ba07610c726d15d66544ffe4b1050107d93f8a39ebc59b15d8b429b497a + languageName: node + linkType: hard + "interpret@npm:^1.0.0": version: 1.4.0 resolution: "interpret@npm:1.4.0" @@ -8288,6 +8661,17 @@ fsevents@~2.3.2: languageName: node linkType: hard +"is-array-buffer@npm:^3.0.1, is-array-buffer@npm:^3.0.2": + version: 3.0.2 + resolution: "is-array-buffer@npm:3.0.2" + dependencies: + call-bind: ^1.0.2 + get-intrinsic: ^1.2.0 + is-typed-array: ^1.1.10 + checksum: dcac9dda66ff17df9cabdc58214172bf41082f956eab30bb0d86bc0fab1e44b690fc8e1f855cf2481245caf4e8a5a006a982a71ddccec84032ed41f9d8da8c14 + languageName: node + linkType: hard + "is-arrayish@npm:^0.2.1": version: 0.2.1 resolution: "is-arrayish@npm:0.2.1" @@ -8330,6 +8714,13 @@ fsevents@~2.3.2: languageName: node linkType: hard +"is-callable@npm:^1.1.3, is-callable@npm:^1.2.7": + version: 1.2.7 + resolution: "is-callable@npm:1.2.7" + checksum: 61fd57d03b0d984e2ed3720fb1c7a897827ea174bd44402878e059542ea8c4aeedee0ea0985998aa5cc2736b2fa6e271c08587addb5b3959ac52cf665173d1ac + languageName: node + linkType: hard + "is-callable@npm:^1.1.4, is-callable@npm:^1.2.4": version: 1.2.4 resolution: "is-callable@npm:1.2.4" @@ -8452,6 +8843,13 @@ fsevents@~2.3.2: languageName: node linkType: hard +"is-negative-zero@npm:^2.0.2": + version: 2.0.2 + resolution: "is-negative-zero@npm:2.0.2" + checksum: f3232194c47a549da60c3d509c9a09be442507616b69454716692e37ae9f37c4dea264fb208ad0c9f3efd15a796a46b79df07c7e53c6227c32170608b809149a + languageName: node + linkType: hard + "is-number-object@npm:^1.0.4": version: 1.0.6 resolution: "is-number-object@npm:1.0.6" @@ -8538,6 +8936,15 @@ fsevents@~2.3.2: languageName: node linkType: hard +"is-shared-array-buffer@npm:^1.0.2": + version: 1.0.2 + resolution: "is-shared-array-buffer@npm:1.0.2" + dependencies: + call-bind: ^1.0.2 + checksum: 9508929cf14fdc1afc9d61d723c6e8d34f5e117f0bffda4d97e7a5d88c3a8681f633a74f8e3ad1fe92d5113f9b921dc5ca44356492079612f9a247efbce7032a + languageName: node + linkType: hard + "is-stream@npm:^2.0.0": version: 2.0.1 resolution: "is-stream@npm:2.0.1" @@ -8572,6 +8979,19 @@ fsevents@~2.3.2: languageName: node linkType: hard +"is-typed-array@npm:^1.1.10, is-typed-array@npm:^1.1.9": + version: 1.1.10 + resolution: "is-typed-array@npm:1.1.10" + dependencies: + available-typed-arrays: ^1.0.5 + call-bind: ^1.0.2 + for-each: ^0.3.3 + gopd: ^1.0.1 + has-tostringtag: ^1.0.0 + checksum: aac6ecb59d4c56a1cdeb69b1f129154ef462bbffe434cb8a8235ca89b42f258b7ae94073c41b3cb7bce37f6a1733ad4499f07882d5d5093a7ba84dfc4ebb8017 + languageName: node + linkType: hard + "is-typed-array@npm:^1.1.3, is-typed-array@npm:^1.1.7": version: 1.1.8 resolution: "is-typed-array@npm:1.1.8" @@ -8615,6 +9035,15 @@ fsevents@~2.3.2: languageName: node linkType: hard +"is-weakref@npm:^1.0.2": + version: 1.0.2 + resolution: "is-weakref@npm:1.0.2" + dependencies: + call-bind: ^1.0.2 + checksum: 95bd9a57cdcb58c63b1c401c60a474b0f45b94719c30f548c891860f051bc2231575c290a6b420c6bc6e7ed99459d424c652bd5bf9a1d5259505dc35b4bf83de + languageName: node + linkType: hard + "is-windows@npm:^1.0.2": version: 1.0.2 resolution: "is-windows@npm:1.0.2" @@ -10350,6 +10779,13 @@ fsevents@~2.3.2: languageName: node linkType: hard +"natural-compare-lite@npm:^1.4.0": + version: 1.4.0 + resolution: "natural-compare-lite@npm:1.4.0" + checksum: 5222ac3986a2b78dd6069ac62cbb52a7bf8ffc90d972ab76dfe7b01892485d229530ed20d0c62e79a6b363a663b273db3bde195a1358ce9e5f779d4453887225 + languageName: node + linkType: hard + "natural-compare@npm:^1.4.0": version: 1.4.0 resolution: "natural-compare@npm:1.4.0" @@ -10866,6 +11302,13 @@ fsevents@~2.3.2: languageName: node linkType: hard +"object-inspect@npm:^1.12.3": + version: 1.12.3 + resolution: "object-inspect@npm:1.12.3" + checksum: dabfd824d97a5f407e6d5d24810d888859f6be394d8b733a77442b277e0808860555176719c5905e765e3743a7cada6b8b0a3b85e5331c530fd418cc8ae991db + languageName: node + linkType: hard + "object-is@npm:^1.0.1": version: 1.1.5 resolution: "object-is@npm:1.1.5" @@ -10902,6 +11345,18 @@ fsevents@~2.3.2: languageName: node linkType: hard +"object.assign@npm:^4.1.4": + version: 4.1.4 + resolution: "object.assign@npm:4.1.4" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.4 + has-symbols: ^1.0.3 + object-keys: ^1.1.1 + checksum: 76cab513a5999acbfe0ff355f15a6a125e71805fcf53de4e9d4e082e1989bdb81d1e329291e1e4e0ae7719f0e4ef80e88fb2d367ae60500d79d25a6224ac8864 + languageName: node + linkType: hard + "object.entries@npm:^1.1.2": version: 1.1.5 resolution: "object.entries@npm:1.1.5" @@ -10913,6 +11368,17 @@ fsevents@~2.3.2: languageName: node linkType: hard +"object.entries@npm:^1.1.5": + version: 1.1.6 + resolution: "object.entries@npm:1.1.6" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.4 + es-abstract: ^1.20.4 + checksum: 0f8c47517e6a9a980241eafe3b73de11e59511883173c2b93d67424a008e47e11b77c80e431ad1d8a806f6108b225a1cab9223e53e555776c612a24297117d28 + languageName: node + linkType: hard + "object.values@npm:^1.1.5": version: 1.1.5 resolution: "object.values@npm:1.1.5" @@ -12081,6 +12547,17 @@ fsevents@~2.3.2: languageName: node linkType: hard +"regexp.prototype.flags@npm:^1.4.3": + version: 1.4.3 + resolution: "regexp.prototype.flags@npm:1.4.3" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.3 + functions-have-names: ^1.2.2 + checksum: 51228bae732592adb3ededd5e15426be25f289e9c4ef15212f4da73f4ec3919b6140806374b8894036a86020d054a8d2657d3fee6bb9b4d35d8939c20030b7a6 + languageName: node + linkType: hard + "regexpp@npm:^3.1.0": version: 3.2.0 resolution: "regexpp@npm:3.2.0" @@ -12377,6 +12854,17 @@ fsevents@~2.3.2: languageName: node linkType: hard +"safe-regex-test@npm:^1.0.0": + version: 1.0.0 + resolution: "safe-regex-test@npm:1.0.0" + dependencies: + call-bind: ^1.0.2 + get-intrinsic: ^1.1.3 + is-regex: ^1.1.4 + checksum: bc566d8beb8b43c01b94e67de3f070fd2781685e835959bbbaaec91cc53381145ca91f69bd837ce6ec244817afa0a5e974fc4e40a2957f0aca68ac3add1ddd34 + languageName: node + linkType: hard + "safe-regex2@npm:^2.0.0": version: 2.0.0 resolution: "safe-regex2@npm:2.0.0" @@ -13129,6 +13617,17 @@ fsevents@~2.3.2: languageName: node linkType: hard +"string.prototype.trim@npm:^1.2.7": + version: 1.2.7 + resolution: "string.prototype.trim@npm:1.2.7" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.4 + es-abstract: ^1.20.4 + checksum: 05b7b2d6af63648e70e44c4a8d10d8cc457536df78b55b9d6230918bde75c5987f6b8604438c4c8652eb55e4fc9725d2912789eb4ec457d6995f3495af190c09 + languageName: node + linkType: hard + "string.prototype.trimend@npm:^1.0.4": version: 1.0.4 resolution: "string.prototype.trimend@npm:1.0.4" @@ -13139,6 +13638,17 @@ fsevents@~2.3.2: languageName: node linkType: hard +"string.prototype.trimend@npm:^1.0.6": + version: 1.0.6 + resolution: "string.prototype.trimend@npm:1.0.6" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.4 + es-abstract: ^1.20.4 + checksum: 0fdc34645a639bd35179b5a08227a353b88dc089adf438f46be8a7c197fc3f22f8514c1c9be4629b3cd29c281582730a8cbbad6466c60f76b5f99cf2addb132e + languageName: node + linkType: hard + "string.prototype.trimstart@npm:^1.0.4": version: 1.0.4 resolution: "string.prototype.trimstart@npm:1.0.4" @@ -13149,6 +13659,17 @@ fsevents@~2.3.2: languageName: node linkType: hard +"string.prototype.trimstart@npm:^1.0.6": + version: 1.0.6 + resolution: "string.prototype.trimstart@npm:1.0.6" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.4 + es-abstract: ^1.20.4 + checksum: 89080feef416621e6ef1279588994305477a7a91648d9436490d56010a1f7adc39167cddac7ce0b9884b8cdbef086987c4dcb2960209f2af8bac0d23ceff4f41 + languageName: node + linkType: hard + "string_decoder@npm:^1.1.1, string_decoder@npm:^1.3.0": version: 1.3.0 resolution: "string_decoder@npm:1.3.0" @@ -13831,7 +14352,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"tslib@npm:^1.9.0": +"tslib@npm:^1.8.1, tslib@npm:^1.9.0": version: 1.14.1 resolution: "tslib@npm:1.14.1" checksum: dbe628ef87f66691d5d2959b3e41b9ca0045c3ee3c7c7b906cc1e328b39f199bb1ad9e671c39025bd56122ac57dfbf7385a94843b1cc07c60a4db74795829acd @@ -13845,6 +14366,17 @@ fsevents@~2.3.2: languageName: node linkType: hard +"tsutils@npm:^3.21.0": + version: 3.21.0 + resolution: "tsutils@npm:3.21.0" + dependencies: + tslib: ^1.8.1 + peerDependencies: + typescript: ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + checksum: 1843f4c1b2e0f975e08c4c21caa4af4f7f65a12ac1b81b3b8489366826259323feb3fc7a243123453d2d1a02314205a7634e048d4a8009921da19f99755cdc48 + languageName: node + linkType: hard + "tunnel-agent@npm:^0.6.0": version: 0.6.0 resolution: "tunnel-agent@npm:0.6.0" @@ -13938,6 +14470,17 @@ fsevents@~2.3.2: languageName: node linkType: hard +"typed-array-length@npm:^1.0.4": + version: 1.0.4 + resolution: "typed-array-length@npm:1.0.4" + dependencies: + call-bind: ^1.0.2 + for-each: ^0.3.3 + is-typed-array: ^1.1.9 + checksum: 2228febc93c7feff142b8c96a58d4a0d7623ecde6c7a24b2b98eb3170e99f7c7eff8c114f9b283085cd59dcd2bd43aadf20e25bba4b034a53c5bb292f71f8956 + languageName: node + linkType: hard + "typed-function@npm:^2.1.0": version: 2.1.0 resolution: "typed-function@npm:2.1.0" @@ -14044,6 +14587,18 @@ typescript@^3.9.5: languageName: node linkType: hard +"unbox-primitive@npm:^1.0.2": + version: 1.0.2 + resolution: "unbox-primitive@npm:1.0.2" + dependencies: + call-bind: ^1.0.2 + has-bigints: ^1.0.2 + has-symbols: ^1.0.3 + which-boxed-primitive: ^1.0.2 + checksum: b7a1cf5862b5e4b5deb091672ffa579aa274f648410009c81cca63fed3b62b610c4f3b773f912ce545bb4e31edc3138975b5bc777fc6e4817dca51affb6380e9 + languageName: node + linkType: hard + "undefsafe@npm:^2.0.5": version: 2.0.5 resolution: "undefsafe@npm:2.0.5" @@ -14528,6 +15083,20 @@ typescript@^3.9.5: languageName: node linkType: hard +"which-typed-array@npm:^1.1.9": + version: 1.1.9 + resolution: "which-typed-array@npm:1.1.9" + dependencies: + available-typed-arrays: ^1.0.5 + call-bind: ^1.0.2 + for-each: ^0.3.3 + gopd: ^1.0.1 + has-tostringtag: ^1.0.0 + is-typed-array: ^1.1.10 + checksum: fe0178ca44c57699ca2c0e657b64eaa8d2db2372a4e2851184f568f98c478ae3dc3fdb5f7e46c384487046b0cf9e23241423242b277e03e8ba3dabc7c84c98ef + languageName: node + linkType: hard + "which@npm:2.0.2, which@npm:^2.0.1, which@npm:^2.0.2": version: 2.0.2 resolution: "which@npm:2.0.2"