diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml index b923345..d59d6a4 100644 --- a/.github/workflows/main_ci.yml +++ b/.github/workflows/main_ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [14, 'lts/*'] + node-version: [20, 'lts/*'] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2 @@ -30,7 +30,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [14, 'lts/*'] + node-version: [20, 'lts/*'] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2 @@ -46,7 +46,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node-version: [14, 'lts/*'] + node-version: [20, 'lts/*'] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2 diff --git a/.github/workflows/package-publish.yml b/.github/workflows/package-publish.yml new file mode 100644 index 0000000..bcff4b4 --- /dev/null +++ b/.github/workflows/package-publish.yml @@ -0,0 +1,26 @@ +name: NPM Package Publish + +on: + workflow_dispatch: + release: + types: [created] + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + run: npm ci + + - name: Publish to NPM + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: npm publish --access public diff --git a/package-lock.json b/package-lock.json index 34eb651..909c4f3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,40 +1,81 @@ { - "name": "coinselect", + "name": "@onekeyfe/coinselect", "version": "3.1.13", - "lockfileVersion": 1, + "lockfileVersion": 3, "requires": true, - "dependencies": { - "@ampproject/remapping": { + "packages": { + "": { + "name": "@onekeyfe/coinselect", + "version": "3.1.13", + "license": "MIT", + "dependencies": { + "bchaddrjs": "^0.5.2", + "bech32": "^2.0.0", + "bignumber.js": "9.1.2", + "bip66": "^2.0.0", + "bitcoin-ops": "^1.4.1", + "blake-hash": "^2.0.0", + "blakejs": "^1.2.1", + "bn.js": "^5.2.1", + "bs58": "^6.0.0", + "bs58check": "^4.0.0", + "create-hmac": "^1.1.7", + "int64-buffer": "^1.0.1", + "pushdata-bitcoin": "^1.0.1", + "tiny-secp256k1": "^1.1.6", + "typeforce": "^1.18.0", + "varuint-bitcoin": "2.0.0", + "wif": "^5.0.0" + }, + "devDependencies": { + "nyc": "^15.0.0", + "standard": "^14.3.4", + "tape": "^4.5.1" + }, + "peerDependencies": { + "tslib": "^2.6.2" + } + }, + "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", "dev": true, - "requires": { + "dependencies": { "@jridgewell/gen-mapping": "^0.1.0", "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" } }, - "@babel/code-frame": { + "node_modules/@babel/code-frame": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", "dev": true, - "requires": { + "dependencies": { "@babel/highlight": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" } }, - "@babel/compat-data": { + "node_modules/@babel/compat-data": { "version": "7.18.5", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.18.5.tgz", "integrity": "sha512-BxhE40PVCBxVEJsSBhB6UWyAuqJRxGsAw8BdHMJ3AKGydcwuWW4kOO3HmqBQAdcq/OP+/DlTVxLvsCzRTnZuGg==", - "dev": true + "dev": true, + "engines": { + "node": ">=6.9.0" + } }, - "@babel/core": { + "node_modules/@babel/core": { "version": "7.18.5", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.18.5.tgz", "integrity": "sha512-MGY8vg3DxMnctw0LdvSEojOsumc70g0t18gNyUdAZqB1Rpd1Bqo/svHGvt+UJ6JcGX+DIekGFDxxIWofBxLCnQ==", "dev": true, - "requires": { + "dependencies": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.16.7", "@babel/generator": "^7.18.2", @@ -50,65 +91,88 @@ "gensync": "^1.0.0-beta.2", "json5": "^2.2.1", "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" } }, - "@babel/generator": { + "node_modules/@babel/generator": { "version": "7.18.2", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.18.2.tgz", "integrity": "sha512-W1lG5vUwFvfMd8HVXqdfbuG7RuaSrTCCD8cl8fP8wOivdbtbIg2Db3IWUcgvfxKbbn6ZBGYRW/Zk1MIwK49mgw==", "dev": true, - "requires": { + "dependencies": { "@babel/types": "^7.18.2", "@jridgewell/gen-mapping": "^0.3.0", "jsesc": "^2.5.1" }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/generator/node_modules/@jridgewell/gen-mapping": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz", + "integrity": "sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg==", + "dev": true, "dependencies": { - "@jridgewell/gen-mapping": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz", - "integrity": "sha512-GcHwniMlA2z+WFPWuY8lp3fsza0I8xPFMWL5+n8LYyP6PSvPrXf4+n8stDHZY2DM0zy9sVkRDy1jDI4XGzYVqg==", - "dev": true, - "requires": { - "@jridgewell/set-array": "^1.0.0", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - } - } + "@jridgewell/set-array": "^1.0.0", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" } }, - "@babel/helper-compilation-targets": { + "node_modules/@babel/helper-compilation-targets": { "version": "7.18.2", "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.18.2.tgz", "integrity": "sha512-s1jnPotJS9uQnzFtiZVBUxe67CuBa679oWFHpxYYnTpRL/1ffhyX44R9uYiXoa/pLXcY9H2moJta0iaanlk/rQ==", "dev": true, - "requires": { + "dependencies": { "@babel/compat-data": "^7.17.10", "@babel/helper-validator-option": "^7.16.7", "browserslist": "^4.20.2", "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" } }, - "@babel/helper-environment-visitor": { + "node_modules/@babel/helper-environment-visitor": { "version": "7.18.2", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.2.tgz", "integrity": "sha512-14GQKWkX9oJzPiQQ7/J36FTXcD4kSp8egKjO9nINlSKiHITRA9q/R74qu8S9xlc/b/yjsJItQUeeh3xnGN0voQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=6.9.0" + } }, - "@babel/helper-module-imports": { + "node_modules/@babel/helper-module-imports": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.7.tgz", "integrity": "sha512-LVtS6TqjJHFc+nYeITRo6VLXve70xmq7wPhWTqDJusJEgGmkAACWwMiTNrvfoQo6hEhFwAIixNkvB0jPXDL8Wg==", "dev": true, - "requires": { + "dependencies": { "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" } }, - "@babel/helper-module-transforms": { + "node_modules/@babel/helper-module-transforms": { "version": "7.18.0", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.18.0.tgz", "integrity": "sha512-kclUYSUBIjlvnzN2++K9f2qzYKFgjmnmjwL4zlmU5f8ZtzgWe8s0rUPSTGy2HmK4P8T52MQsS+HTQAgZd3dMEA==", "dev": true, - "requires": { + "dependencies": { "@babel/helper-environment-visitor": "^7.16.7", "@babel/helper-module-imports": "^7.16.7", "@babel/helper-simple-access": "^7.17.7", @@ -117,89 +181,122 @@ "@babel/template": "^7.16.7", "@babel/traverse": "^7.18.0", "@babel/types": "^7.18.0" + }, + "engines": { + "node": ">=6.9.0" } }, - "@babel/helper-simple-access": { + "node_modules/@babel/helper-simple-access": { "version": "7.18.2", "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.18.2.tgz", "integrity": "sha512-7LIrjYzndorDY88MycupkpQLKS1AFfsVRm2k/9PtKScSy5tZq0McZTj+DiMRynboZfIqOKvo03pmhTaUgiD6fQ==", "dev": true, - "requires": { + "dependencies": { "@babel/types": "^7.18.2" + }, + "engines": { + "node": ">=6.9.0" } }, - "@babel/helper-split-export-declaration": { + "node_modules/@babel/helper-split-export-declaration": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.7.tgz", "integrity": "sha512-xbWoy/PFoxSWazIToT9Sif+jJTlrMcndIsaOKvTA6u7QEo7ilkRZpjew18/W3c7nm8fXdUDXh02VXTbZ0pGDNw==", "dev": true, - "requires": { + "dependencies": { "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" } }, - "@babel/helper-string-parser": { + "node_modules/@babel/helper-string-parser": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", - "dev": true + "dev": true, + "engines": { + "node": ">=6.9.0" + } }, - "@babel/helper-validator-identifier": { + "node_modules/@babel/helper-validator-identifier": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", - "dev": true + "dev": true, + "engines": { + "node": ">=6.9.0" + } }, - "@babel/helper-validator-option": { + "node_modules/@babel/helper-validator-option": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.16.7.tgz", "integrity": "sha512-TRtenOuRUVo9oIQGPC5G9DgK4743cdxvtOw0weQNpZXaS16SCBi5MNjZF8vba3ETURjZpTbVn7Vvcf2eAwFozQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=6.9.0" + } }, - "@babel/helpers": { + "node_modules/@babel/helpers": { "version": "7.18.2", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.18.2.tgz", "integrity": "sha512-j+d+u5xT5utcQSzrh9p+PaJX94h++KN+ng9b9WEJq7pkUPAd61FGqhjuUEdfknb3E/uDBb7ruwEeKkIxNJPIrg==", "dev": true, - "requires": { + "dependencies": { "@babel/template": "^7.16.7", "@babel/traverse": "^7.18.2", "@babel/types": "^7.18.2" + }, + "engines": { + "node": ">=6.9.0" } }, - "@babel/highlight": { + "node_modules/@babel/highlight": { "version": "7.17.12", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.17.12.tgz", "integrity": "sha512-7yykMVF3hfZY2jsHZEEgLc+3x4o1O+fYyULu11GynEUQNwB6lua+IIQn1FiJxNucd5UlyJryrwsOh8PL9Sn8Qg==", "dev": true, - "requires": { + "dependencies": { "@babel/helper-validator-identifier": "^7.16.7", "chalk": "^2.0.0", "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" } }, - "@babel/parser": { + "node_modules/@babel/parser": { "version": "7.18.5", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.5.tgz", "integrity": "sha512-YZWVaglMiplo7v8f1oMQ5ZPQr0vn7HPeZXxXWsxXJRjGVrzUFn9OxFQl1sb5wzfootjA/yChhW84BV+383FSOw==", - "dev": true + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } }, - "@babel/template": { + "node_modules/@babel/template": { "version": "7.16.7", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.7.tgz", "integrity": "sha512-I8j/x8kHUrbYRTUxXrrMbfCa7jxkE7tZre39x3kjr9hvI82cK1FfqLygotcWN5kdPGWcLdWMHpSBavse5tWw3w==", "dev": true, - "requires": { + "dependencies": { "@babel/code-frame": "^7.16.7", "@babel/parser": "^7.16.7", "@babel/types": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" } }, - "@babel/traverse": { + "node_modules/@babel/traverse": { "version": "7.23.2", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.2.tgz", "integrity": "sha512-azpe59SQ48qG6nu2CzcMLbxUudtN+dOM9kDbUqGq3HXUJRlo7i8fvPoxQUzYgLZ4cMVmuZgm8vvBpNeRhd6XSw==", "dev": true, - "requires": { + "dependencies": { "@babel/code-frame": "^7.22.13", "@babel/generator": "^7.23.0", "@babel/helper-environment-visitor": "^7.22.20", @@ -211,625 +308,1083 @@ "debug": "^4.1.0", "globals": "^11.1.0" }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/code-frame": { + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", + "dev": true, "dependencies": { - "@babel/code-frame": { - "version": "7.22.13", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", - "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", - "dev": true, - "requires": { - "@babel/highlight": "^7.22.13", - "chalk": "^2.4.2" - } - }, - "@babel/generator": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", - "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", - "dev": true, - "requires": { - "@babel/types": "^7.23.0", - "@jridgewell/gen-mapping": "^0.3.2", - "@jridgewell/trace-mapping": "^0.3.17", - "jsesc": "^2.5.1" - } - }, - "@babel/helper-environment-visitor": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", - "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", - "dev": true - }, - "@babel/helper-function-name": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", - "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", - "dev": true, - "requires": { - "@babel/template": "^7.22.15", - "@babel/types": "^7.23.0" - } - }, - "@babel/helper-hoist-variables": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", - "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", - "dev": true, - "requires": { - "@babel/types": "^7.22.5" - } - }, - "@babel/helper-split-export-declaration": { - "version": "7.22.6", - "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", - "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", - "dev": true, - "requires": { - "@babel/types": "^7.22.5" - } - }, - "@babel/helper-validator-identifier": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", - "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", - "dev": true - }, - "@babel/highlight": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", - "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", - "dev": true, - "requires": { - "@babel/helper-validator-identifier": "^7.22.20", - "chalk": "^2.4.2", - "js-tokens": "^4.0.0" - } - }, - "@babel/parser": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", - "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", - "dev": true - }, - "@babel/template": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", - "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.22.13", - "@babel/parser": "^7.22.15", - "@babel/types": "^7.22.15" - } - }, - "@babel/types": { - "version": "7.23.0", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", - "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", - "dev": true, - "requires": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.20", - "to-fast-properties": "^2.0.0" - } - }, - "@jridgewell/gen-mapping": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", - "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", - "dev": true, - "requires": { - "@jridgewell/set-array": "^1.0.1", - "@jridgewell/sourcemap-codec": "^1.4.10", - "@jridgewell/trace-mapping": "^0.3.9" - } - }, - "@jridgewell/resolve-uri": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", - "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", - "dev": true - }, - "@jridgewell/trace-mapping": { - "version": "0.3.20", - "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", - "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", - "dev": true, - "requires": { - "@jridgewell/resolve-uri": "^3.1.0", - "@jridgewell/sourcemap-codec": "^1.4.14" - }, - "dependencies": { - "@jridgewell/sourcemap-codec": { - "version": "1.4.15", - "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", - "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", - "dev": true - } - } - } + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" + }, + "engines": { + "node": ">=6.9.0" } }, - "@babel/types": { + "node_modules/@babel/traverse/node_modules/@babel/generator": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", + "dev": true, + "dependencies": { + "@babel/types": "^7.23.0", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/helper-environment-visitor": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/helper-function-name": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", + "dev": true, + "dependencies": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/highlight": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/parser": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/template": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@babel/types": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse/node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/traverse/node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/traverse/node_modules/@jridgewell/trace-mapping": { + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@babel/traverse/node_modules/@jridgewell/trace-mapping/node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@babel/types": { "version": "7.18.4", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.18.4.tgz", "integrity": "sha512-ThN1mBcMq5pG/Vm2IcBmPPfyPXbd8S02rS+OBIDENdufvqC7Z/jHPCv9IcP01277aKtDI8g/2XysBN4hA8niiw==", "dev": true, - "requires": { + "dependencies": { "@babel/helper-validator-identifier": "^7.16.7", "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" } }, - "@istanbuljs/load-nyc-config": { + "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", "dev": true, - "requires": { + "dependencies": { "camelcase": "^5.3.1", "find-up": "^4.1.0", "get-package-type": "^0.1.0", "js-yaml": "^3.13.1", "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" } }, - "@istanbuljs/schema": { + "node_modules/@istanbuljs/schema": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "@jridgewell/gen-mapping": { + "node_modules/@jridgewell/gen-mapping": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", "dev": true, - "requires": { + "dependencies": { "@jridgewell/set-array": "^1.0.0", "@jridgewell/sourcemap-codec": "^1.4.10" + }, + "engines": { + "node": ">=6.0.0" } }, - "@jridgewell/resolve-uri": { + "node_modules/@jridgewell/resolve-uri": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.0.7.tgz", "integrity": "sha512-8cXDaBBHOr2pQ7j77Y6Vp5VDT2sIqWyWQ56TjEq4ih/a4iST3dItRe8Q9fp0rrIl9DoKhWQtUQz/YpOxLkXbNA==", - "dev": true + "dev": true, + "engines": { + "node": ">=6.0.0" + } }, - "@jridgewell/set-array": { + "node_modules/@jridgewell/set-array": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.1.tgz", "integrity": "sha512-Ct5MqZkLGEXTVmQYbGtx9SVqD2fqwvdubdps5D3djjAkgkKwT918VNOz65pEHFaYTeWcukmJmH5SwsA9Tn2ObQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=6.0.0" + } }, - "@jridgewell/sourcemap-codec": { + "node_modules/@jridgewell/sourcemap-codec": { "version": "1.4.13", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz", "integrity": "sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w==", "dev": true }, - "@jridgewell/trace-mapping": { + "node_modules/@jridgewell/trace-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.13.tgz", "integrity": "sha512-o1xbKhp9qnIAoHJSWd6KlCZfqslL4valSF81H8ImioOAxluWYWOpWkpyktY2vnt4tbrX9XYaxovq6cgowaJp2w==", "dev": true, - "requires": { + "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" } }, - "acorn": { + "node_modules/@noble/hashes": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.6.1.tgz", + "integrity": "sha512-pq5D8h10hHBjyqX+cfBm0i8JUXJ0UhczFc4r74zbuT9XgewFo2E3J1cOaGtdZynILNmQ685YWGzGE1Zv6io50w==", + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", "integrity": "sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==", - "dev": true + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } }, - "acorn-jsx": { + "node_modules/acorn-jsx": { "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } }, - "aggregate-error": { + "node_modules/aggregate-error": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-3.1.0.tgz", "integrity": "sha512-4I7Td01quW/RpocfNayFdFVk1qSuoh0E7JrbRJ16nH01HhKFQ88INq9Sd+nd72zqRySlr9BmDA8xlEJ6vJMrYA==", "dev": true, - "requires": { + "dependencies": { "clean-stack": "^2.0.0", "indent-string": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "ajv": { + "node_modules/ajv": { "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, - "requires": { + "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "ansi-escapes": { + "node_modules/ansi-escapes": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", "dev": true, - "requires": { + "dependencies": { "type-fest": "^0.21.3" }, - "dependencies": { - "type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true - } + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-escapes/node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "ansi-regex": { + "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "ansi-styles": { + "node_modules/ansi-styles": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, - "requires": { + "dependencies": { "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" } }, - "append-transform": { + "node_modules/append-transform": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/append-transform/-/append-transform-2.0.0.tgz", "integrity": "sha512-7yeyCEurROLQJFv5Xj4lEGTy0borxepjFv1g22oAdqFu//SrAlDl1O1Nxx15SH1RoliUml6p8dwJW9jvZughhg==", "dev": true, - "requires": { + "dependencies": { "default-require-extensions": "^3.0.0" + }, + "engines": { + "node": ">=8" } }, - "archy": { + "node_modules/archy": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", "integrity": "sha512-Xg+9RwCg/0p32teKdGMPTPnVXKD0w3DfHnFTficozsAgsvq2XenPJq/MYpzzQ/v8zrOyJn6Ds39VA4JIDwFfqw==", "dev": true }, - "argparse": { + "node_modules/argparse": { "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, - "requires": { + "dependencies": { "sprintf-js": "~1.0.2" } }, - "array-includes": { + "node_modules/array-includes": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz", "integrity": "sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", "es-abstract": "^1.19.5", "get-intrinsic": "^1.1.1", "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "astral-regex": { + "node_modules/astral-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", "integrity": "sha512-+Ryf6g3BKoRc7jfp7ad8tM4TtMiaWvbF/1/sQcZPkkS7ag3D5nMBCe2UfOTONtAkaG0tO0ij3C5Lwmf1EiyjHg==", - "dev": true + "dev": true, + "engines": { + "node": ">=4" + } }, - "balanced-match": { + "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "brace-expansion": { + "node_modules/base-x": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-5.0.0.tgz", + "integrity": "sha512-sMW3VGSX1QWVFA6l8U62MLKz29rRfpTlYdCqLdpLo1/Yd4zZwSbnUaDfciIAowAqvq7YFnWq9hrhdg1KYgc1lQ==" + }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/bchaddrjs": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/bchaddrjs/-/bchaddrjs-0.5.2.tgz", + "integrity": "sha512-OO7gIn3m7ea4FVx4cT8gdlWQR2+++EquhdpWQJH9BQjK63tJJ6ngB3QMZDO6DiBoXiIGUsTPHjlrHVxPGcGxLQ==", + "dependencies": { + "bs58check": "2.1.2", + "buffer": "^6.0.3", + "cashaddrjs": "0.4.4", + "stream-browserify": "^3.0.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/bchaddrjs/node_modules/base-x": { + "version": "3.0.10", + "resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.10.tgz", + "integrity": "sha512-7d0s06rR9rYaIWHkpfLIFICM/tkSVdoPC9qYAQRpxn9DdKNWNsKC0uk++akckyLq16Tx2WIinnZ6WRriAt6njQ==", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/bchaddrjs/node_modules/bs58": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz", + "integrity": "sha512-Ok3Wdf5vOIlBrgCvTq96gBkJw+JUEzdBgyaza5HLtPm7yTHkjRy8+JzNyHF7BHa0bNWOQIp3m5YF0nnFcOIKLw==", + "dependencies": { + "base-x": "^3.0.2" + } + }, + "node_modules/bchaddrjs/node_modules/bs58check": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz", + "integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==", + "dependencies": { + "bs58": "^4.0.0", + "create-hash": "^1.1.0", + "safe-buffer": "^5.1.2" + } + }, + "node_modules/bech32": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-2.0.0.tgz", + "integrity": "sha512-LcknSilhIGatDAsY1ak2I8VtGaHNhgMSYVxFrGLXv+xLHytaKZKcaUJJUE7qmBr7h33o5YQwP55pMI0xmkpJwg==" + }, + "node_modules/big-integer": { + "version": "1.6.36", + "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.36.tgz", + "integrity": "sha512-t70bfa7HYEA1D9idDbmuv7YbsbVkQ+Hp+8KFSul4aE5e/i1bjCNIRYJZlA8Q8p0r9T8cF/RVvwUgRA//FydEyg==", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/bignumber.js": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", + "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==", + "engines": { + "node": "*" + } + }, + "node_modules/bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dependencies": { + "file-uri-to-path": "1.0.0" + } + }, + "node_modules/bip66": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/bip66/-/bip66-2.0.0.tgz", + "integrity": "sha512-kBG+hSpgvZBrkIm9dt5T1Hd/7xGCPEX2npoxAWZfsK1FvjgaxySEh2WizjyIstWXriKo9K9uJ4u0OnsyLDUPXQ==" + }, + "node_modules/bitcoin-ops": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/bitcoin-ops/-/bitcoin-ops-1.4.1.tgz", + "integrity": "sha512-pef6gxZFztEhaE9RY9HmWVmiIHqCb2OyS4HPKkpc6CIiiOa3Qmuoylxc5P2EkU3w+5eTSifI9SEZC88idAIGow==" + }, + "node_modules/blake-hash": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/blake-hash/-/blake-hash-2.0.0.tgz", + "integrity": "sha512-Igj8YowDu1PRkRsxZA7NVkdFNxH5rKv5cpLxQ0CVXSIA77pVYwCPRQJ2sMew/oneUpfuYRyjG6r8SmmmnbZb1w==", + "hasInstallScript": true, + "dependencies": { + "node-addon-api": "^3.0.0", + "node-gyp-build": "^4.2.2", + "readable-stream": "^3.6.0" + }, + "engines": { + "node": ">= 10" + } + }, + "node_modules/blakejs": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", + "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" + }, + "node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, + "node_modules/brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, - "requires": { + "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, - "browserslist": { + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, + "node_modules/browserslist": { "version": "4.20.4", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.20.4.tgz", "integrity": "sha512-ok1d+1WpnU24XYN7oC3QWgTyMhY/avPJ/r9T00xxvUOIparA/gc+UPUMaod3i+G6s+nI2nUb9xZ5k794uIwShw==", "dev": true, - "requires": { + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + } + ], + "dependencies": { "caniuse-lite": "^1.0.30001349", "electron-to-chromium": "^1.4.147", "escalade": "^3.1.1", "node-releases": "^2.0.5", "picocolors": "^1.0.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/bs58": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/bs58/-/bs58-6.0.0.tgz", + "integrity": "sha512-PD0wEnEYg6ijszw/u8s+iI3H17cTymlrwkKhDhPZq+Sokl3AU4htyBFTjAeNAlCCmg0f53g6ih3jATyCKftTfw==", + "dependencies": { + "base-x": "^5.0.0" + } + }, + "node_modules/bs58check": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/bs58check/-/bs58check-4.0.0.tgz", + "integrity": "sha512-FsGDOnFg9aVI9erdriULkd/JjEWONV/lQE5aYziB5PoBsXRind56lh8doIZIc9X4HoxT5x4bLjMWN1/NB8Zp5g==", + "dependencies": { + "@noble/hashes": "^1.2.0", + "bs58": "^6.0.0" + } + }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" } }, - "caching-transform": { + "node_modules/caching-transform": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/caching-transform/-/caching-transform-4.0.0.tgz", "integrity": "sha512-kpqOvwXnjjN44D89K5ccQC+RUrsy7jB/XLlRrx0D7/2HNcTPqzsb6XgYoErwko6QsV184CA2YgS1fxDiiDZMWA==", "dev": true, - "requires": { + "dependencies": { "hasha": "^5.0.0", "make-dir": "^3.0.0", "package-hash": "^4.0.0", "write-file-atomic": "^3.0.0" + }, + "engines": { + "node": ">=8" } }, - "call-bind": { + "node_modules/call-bind": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", "dev": true, - "requires": { + "dependencies": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "callsites": { + "node_modules/callsites": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "camelcase": { + "node_modules/camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "caniuse-lite": { + "node_modules/caniuse-lite": { "version": "1.0.30001352", "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001352.tgz", "integrity": "sha512-GUgH8w6YergqPQDGWhJGt8GDRnY0L/iJVQcU3eJ46GYf52R8tk0Wxp0PymuFVZboJYXGiCqwozAYZNRjVj6IcA==", - "dev": true + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + } + ] }, - "chalk": { + "node_modules/cashaddrjs": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/cashaddrjs/-/cashaddrjs-0.4.4.tgz", + "integrity": "sha512-xZkuWdNOh0uq/mxJIng6vYWfTowZLd9F4GMAlp2DwFHlcCqCm91NtuAc47RuV4L7r4PYcY5p6Cr2OKNb4hnkWA==", + "dependencies": { + "big-integer": "1.6.36" + } + }, + "node_modules/chalk": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", "dev": true, - "requires": { + "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" } }, - "chardet": { + "node_modules/chardet": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, - "clean-stack": { + "node_modules/cipher-base": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.6.tgz", + "integrity": "sha512-3Ek9H3X6pj5TgenXYtNWdaBon1tgYCaebd+XPg0keyjEbEfkD4KkmAxkQ/i1vYvxdcT5nscLBfq9VJRmCBcFSw==", + "dependencies": { + "inherits": "^2.0.4", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/cipher-base/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/clean-stack": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-2.2.0.tgz", "integrity": "sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "cli-cursor": { + "node_modules/cli-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", "dev": true, - "requires": { + "dependencies": { "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" } }, - "cli-width": { + "node_modules/cli-width": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", - "dev": true + "dev": true, + "engines": { + "node": ">= 10" + } }, - "cliui": { + "node_modules/cliui": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", "dev": true, - "requires": { + "dependencies": { "string-width": "^4.2.0", "strip-ansi": "^6.0.0", "wrap-ansi": "^6.2.0" } }, - "color-convert": { + "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", "dev": true, - "requires": { + "dependencies": { "color-name": "1.1.3" } }, - "color-name": { + "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, - "commondir": { + "node_modules/commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==", "dev": true }, - "concat-map": { + "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, - "contains-path": { + "node_modules/contains-path": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", "integrity": "sha512-OKZnPGeMQy2RPaUIBPFFd71iNf4791H12MCRuVQDnzGRwCYNYmTDy5pdafo2SLAcEMKzTOQnLWG4QdcjeJUMEg==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "convert-source-map": { + "node_modules/convert-source-map": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", "dev": true, - "requires": { + "dependencies": { "safe-buffer": "~5.1.1" } }, - "cross-spawn": { + "node_modules/create-hash": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dependencies": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "node_modules/create-hmac": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dependencies": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", "dev": true, - "requires": { + "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" } }, - "debug": { + "node_modules/debug": { "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, - "requires": { + "dependencies": { "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "debug-log": { + "node_modules/debug-log": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/debug-log/-/debug-log-1.0.1.tgz", "integrity": "sha512-gV/pe1YIaKNgLYnd1g9VNW80tcb7oV5qvNUxG7NM8rbDpnl6RGunzlAtlGSb0wEs3nesu2vHNiX9TSsZ+Y+RjA==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "decamelize": { + "node_modules/decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "deep-equal": { + "node_modules/deep-equal": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.1.tgz", "integrity": "sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==", "dev": true, - "requires": { + "dependencies": { "is-arguments": "^1.0.4", "is-date-object": "^1.0.1", "is-regex": "^1.0.4", "object-is": "^1.0.1", "object-keys": "^1.1.1", "regexp.prototype.flags": "^1.2.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "deep-is": { + "node_modules/deep-is": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true }, - "default-require-extensions": { + "node_modules/default-require-extensions": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/default-require-extensions/-/default-require-extensions-3.0.0.tgz", "integrity": "sha512-ek6DpXq/SCpvjhpFsLFRVtIxJCRw6fUR42lYMVZuUMK7n8eMz4Uh5clckdBjEpLhn/gEBZo7hDJnJcwdKLKQjg==", "dev": true, - "requires": { + "dependencies": { "strip-bom": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "define-properties": { + "node_modules/define-properties": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", "dev": true, - "requires": { + "dependencies": { "has-property-descriptors": "^1.0.0", "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "defined": { + "node_modules/defined": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", "integrity": "sha512-Y2caI5+ZwS5c3RiNDJ6u53VhQHv+hHKwhkI1iHvceKUHw9Df6EK2zRLfjejRgMuCuxK7PfSWIMwWecceVvThjQ==", "dev": true }, - "deglob": { + "node_modules/deglob": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/deglob/-/deglob-4.0.1.tgz", "integrity": "sha512-/g+RDZ7yf2HvoW+E5Cy+K94YhgcFgr6C8LuHZD1O5HoNPkf3KY6RfXJ0DBGlB/NkLi5gml+G9zqRzk9S0mHZCg==", "dev": true, - "requires": { + "dependencies": { "find-root": "^1.0.0", "glob": "^7.0.5", "ignore": "^5.0.0", "pkg-config": "^1.1.0", "run-parallel": "^1.1.2", "uniq": "^1.0.1" - }, - "dependencies": { - "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", - "dev": true - } } }, - "doctrine": { + "node_modules/deglob/node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", "dev": true, - "requires": { + "dependencies": { "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" } }, - "dotignore": { + "node_modules/dotignore": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/dotignore/-/dotignore-0.1.2.tgz", "integrity": "sha512-UGGGWfSauusaVJC+8fgV+NVvBXkCTmVv7sk6nojDZZvuOUNGUy0Zk4UpHQD6EDjS0jpBwcACvH4eofvyzBcRDw==", "dev": true, - "requires": { + "dependencies": { "minimatch": "^3.0.4" + }, + "bin": { + "ignored": "bin/ignored" } }, - "electron-to-chromium": { + "node_modules/electron-to-chromium": { "version": "1.4.153", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.153.tgz", "integrity": "sha512-57AV9DNW1R52HjOqnGOCCTLHMHItLTGu/WjB1KYIa4BQ7p0u8J0j8N78akPcOBStKE801xcMjTpmbAylflfIYQ==", "dev": true }, - "emoji-regex": { + "node_modules/elliptic": { + "version": "6.6.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.6.1.tgz", + "integrity": "sha512-RaddvvMatK2LJHqFJ+YA4WysVN5Ita9E35botqIYspQ4TkRAlCicdzKOjlyv/1Za5RyTNn7di//eEV0uTAfe3g==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", + "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==" + }, + "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, - "error-ex": { + "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", "dev": true, - "requires": { + "dependencies": { "is-arrayish": "^0.2.1" } }, - "es-abstract": { + "node_modules/es-abstract": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.1.tgz", "integrity": "sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "es-to-primitive": "^1.2.1", "function-bind": "^1.1.1", @@ -853,43 +1408,62 @@ "string.prototype.trimend": "^1.0.5", "string.prototype.trimstart": "^1.0.5", "unbox-primitive": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "es-to-primitive": { + "node_modules/es-to-primitive": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", "dev": true, - "requires": { + "dependencies": { "is-callable": "^1.1.4", "is-date-object": "^1.0.1", "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "es6-error": { + "node_modules/es6-error": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz", "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==", "dev": true }, - "escalade": { + "node_modules/escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "escape-string-regexp": { + "node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.8.0" + } }, - "eslint": { + "node_modules/eslint": { "version": "6.8.0", "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.8.0.tgz", "integrity": "sha512-K+Iayyo2LtyYhDSYwz5D5QdWw0hCacNzyq1Y821Xna2xSJj7cijoLLYmLxTQgcgZ9mC61nryMy9S7GRbYpI5Ig==", + "deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.", "dev": true, - "requires": { + "dependencies": { "@babel/code-frame": "^7.0.0", "ajv": "^6.10.0", "chalk": "^2.1.0", @@ -928,211 +1502,181 @@ "text-table": "^0.2.0", "v8-compile-cache": "^2.0.3" }, - "dependencies": { - "ansi-regex": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "dev": true - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } - } - }, - "globals": { - "version": "12.4.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", - "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", - "dev": true, - "requires": { - "type-fest": "^0.8.1" - } - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", - "dev": true, - "requires": { - "shebang-regex": "^1.0.0" - } - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", - "dev": true - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - } + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^8.10.0 || ^10.13.0 || >=11.10.1" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "eslint-config-standard": { + "node_modules/eslint-config-standard": { "version": "14.1.1", "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-14.1.1.tgz", "integrity": "sha512-Z9B+VR+JIXRxz21udPTL9HpFMyoMUEeX1G251EQ6e05WD9aPVtVBn09XUmZ259wCMlCDmYDSZG62Hhm+ZTJcUg==", - "dev": true + "dev": true, + "peerDependencies": { + "eslint": ">=6.2.2", + "eslint-plugin-import": ">=2.18.0", + "eslint-plugin-node": ">=9.1.0", + "eslint-plugin-promise": ">=4.2.1", + "eslint-plugin-standard": ">=4.0.0" + } }, - "eslint-config-standard-jsx": { + "node_modules/eslint-config-standard-jsx": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-8.1.0.tgz", "integrity": "sha512-ULVC8qH8qCqbU792ZOO6DaiaZyHNS/5CZt3hKqHkEhVlhPEPN3nfBqqxJCyp59XrjIBZPu1chMYe9T2DXZ7TMw==", - "dev": true + "dev": true, + "peerDependencies": { + "eslint": ">=6.2.2", + "eslint-plugin-react": ">=7.14.2" + } }, - "eslint-import-resolver-node": { + "node_modules/eslint-import-resolver-node": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", "dev": true, - "requires": { + "dependencies": { "debug": "^3.2.7", "resolve": "^1.20.0" - }, + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - } + "ms": "^2.1.1" } }, - "eslint-module-utils": { + "node_modules/eslint-module-utils": { "version": "2.7.3", "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz", "integrity": "sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==", "dev": true, - "requires": { + "dependencies": { "debug": "^3.2.7", "find-up": "^2.1.0" }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, "dependencies": { - "debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true - } + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils/node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true, + "engines": { + "node": ">=4" } }, - "eslint-plugin-es": { + "node_modules/eslint-module-utils/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-plugin-es": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-2.0.0.tgz", "integrity": "sha512-f6fceVtg27BR02EYnBhgWLFQfK6bN4Ll0nQFrBHOlCsAyxeZkn0NHns5O0YZOPrV1B3ramd6cgFwaoFLcSkwEQ==", "dev": true, - "requires": { + "dependencies": { "eslint-utils": "^1.4.2", "regexpp": "^3.0.0" }, - "dependencies": { - "regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true - } + "engines": { + "node": ">=8.10.0" + }, + "peerDependencies": { + "eslint": ">=4.19.1" } }, - "eslint-plugin-import": { + "node_modules/eslint-plugin-es/node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-plugin-import": { "version": "2.18.2", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz", "integrity": "sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ==", "dev": true, - "requires": { + "dependencies": { "array-includes": "^3.0.3", "contains-path": "^0.1.0", "debug": "^2.6.9", @@ -1145,40 +1689,47 @@ "read-pkg-up": "^2.0.0", "resolve": "^1.11.0" }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "2.x - 6.x" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha512-lsGyRuYr4/PIB0txi+Fy2xOMI2dGaTguCaotzFGkVZuKR5usKfcRWIFKNM3QNrU7hh/+w2bwTW+ZeXPK5l8uVg==", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - } + "ms": "2.0.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha512-lsGyRuYr4/PIB0txi+Fy2xOMI2dGaTguCaotzFGkVZuKR5usKfcRWIFKNM3QNrU7hh/+w2bwTW+ZeXPK5l8uVg==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2", + "isarray": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" } }, - "eslint-plugin-node": { + "node_modules/eslint-plugin-import/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", + "dev": true + }, + "node_modules/eslint-plugin-node": { "version": "10.0.0", "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-10.0.0.tgz", "integrity": "sha512-1CSyM/QCjs6PXaT18+zuAXsjXGIGo5Rw630rSKwokSs2jrYURQc4R5JZpoanNCqwNmepg+0eZ9L7YiRUJb8jiQ==", "dev": true, - "requires": { + "dependencies": { "eslint-plugin-es": "^2.0.0", "eslint-utils": "^1.4.2", "ignore": "^5.1.1", @@ -1186,27 +1737,37 @@ "resolve": "^1.10.1", "semver": "^6.1.0" }, - "dependencies": { - "ignore": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", - "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", - "dev": true - } + "engines": { + "node": ">=8.10.0" + }, + "peerDependencies": { + "eslint": ">=5.16.0" + } + }, + "node_modules/eslint-plugin-node/node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true, + "engines": { + "node": ">= 4" } }, - "eslint-plugin-promise": { + "node_modules/eslint-plugin-promise": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz", "integrity": "sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "eslint-plugin-react": { + "node_modules/eslint-plugin-react": { "version": "7.14.3", "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz", "integrity": "sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA==", "dev": true, - "requires": { + "dependencies": { "array-includes": "^3.0.3", "doctrine": "^2.1.0", "has": "^1.0.3", @@ -1217,489 +1778,859 @@ "prop-types": "^15.7.2", "resolve": "^1.10.1" }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0" + } + }, + "node_modules/eslint-plugin-react/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, "dependencies": { - "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "requires": { - "esutils": "^2.0.2" - } - } + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" } }, - "eslint-plugin-standard": { + "node_modules/eslint-plugin-standard": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/eslint-plugin-standard/-/eslint-plugin-standard-4.0.2.tgz", "integrity": "sha512-nKptN8l7jksXkwFk++PhJB3cCDTcXOEyhISIN86Ue2feJ1LFyY3PrY3/xT2keXlJSY5bpmbiTG0f885/YKAvTA==", - "dev": true + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "peerDependencies": { + "eslint": ">=5.0.0" + } }, - "eslint-scope": { + "node_modules/eslint-scope": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", "dev": true, - "requires": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "1.4.3", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", + "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint/node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/eslint/node_modules/cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "dependencies": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + }, + "engines": { + "node": ">=4.8" + } + }, + "node_modules/eslint/node_modules/cross-spawn/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "12.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-12.4.0.tgz", + "integrity": "sha512-BWICuzzDvDoH54NHKCseDanAhE3CeDorgDL5MT6LMXXj2WCnd9UC2szdk4AWLfjdgNBCXLUanXYcpBBKOSWGwg==", + "dev": true, + "dependencies": { + "type-fest": "^0.8.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha512-fEHGKCSmUSDPv4uoj8AlD+joPlq3peND+HRYyxFz4KPw4z926S/b8rIuFs2FYJg3BwsxJf6A9/3eIdLaYC+9Dw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint/node_modules/shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha512-EV3L1+UQWGor21OmnvojK36mhg+TyIKDh3iFBKBohr5xeXIhNBcx8oWdgkTEEQ+BEFFYdLRuqMfd5L84N1V5Vg==", + "dev": true, + "dependencies": { + "shebang-regex": "^1.0.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint/node_modules/shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha512-wpoSFAxys6b2a2wHZ1XpDSgD7N9iVjg29Ph9uV/uaP9Ex/KXlkTZTeddxDPSYQpgvzKLGJke2UU0AzoGCjNIvQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" } }, - "eslint-utils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.4.3.tgz", - "integrity": "sha512-fbBN5W2xdY45KulGXmLHZ3c3FHfVYmKg0IrAKGOkT/464PQsx2UeIzfz1RmEci+KLm1bBaAzZAh8+/E+XAeZ8Q==", + "node_modules/eslint/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, - "requires": { - "eslint-visitor-keys": "^1.1.0" + "dependencies": { + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" } }, - "eslint-visitor-keys": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", - "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", - "dev": true + "node_modules/eslint/node_modules/which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "which": "bin/which" + } }, - "espree": { + "node_modules/espree": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/espree/-/espree-6.2.1.tgz", "integrity": "sha512-ysCxRQY3WaXJz9tdbWOwuWr5Y/XrPTGX9Kiz3yoUXwW0VZ4w30HTkQLaGx/+ttFjF8i+ACbArnB4ce68a9m5hw==", "dev": true, - "requires": { + "dependencies": { "acorn": "^7.1.1", "acorn-jsx": "^5.2.0", "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6.0.0" } }, - "esprima": { + "node_modules/esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } }, - "esquery": { + "node_modules/esquery": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", "dev": true, - "requires": { + "dependencies": { "estraverse": "^5.1.0" }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - } + "engines": { + "node": ">=0.10" } }, - "esrecurse": { + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, - "requires": { + "dependencies": { "estraverse": "^5.2.0" }, - "dependencies": { - "estraverse": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", - "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", - "dev": true - } + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" } }, - "estraverse": { + "node_modules/estraverse": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true + "dev": true, + "engines": { + "node": ">=4.0" + } }, - "esutils": { + "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "external-editor": { + "node_modules/external-editor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", "dev": true, - "requires": { + "dependencies": { "chardet": "^0.7.0", "iconv-lite": "^0.4.24", "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" } }, - "fast-deep-equal": { + "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, - "fast-json-stable-stringify": { + "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true }, - "fast-levenshtein": { + "node_modules/fast-levenshtein": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, - "figures": { + "node_modules/figures": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", "dev": true, - "requires": { + "dependencies": { "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "file-entry-cache": { + "node_modules/file-entry-cache": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-5.0.1.tgz", "integrity": "sha512-bCg29ictuBaKUwwArK4ouCaqDgLZcysCFLmM/Yn/FDoqndh/9vNuQfXRDvTuXKLxfD/JtZQGKFT8MGcJBK644g==", "dev": true, - "requires": { + "dependencies": { "flat-cache": "^2.0.1" + }, + "engines": { + "node": ">=4" } }, - "find-cache-dir": { + "node_modules/file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==" + }, + "node_modules/find-cache-dir": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.2.tgz", "integrity": "sha512-wXZV5emFEjrridIgED11OoUKLxiYjAcqot/NJdAkOhlJ+vGzwhOAfcG5OX1jP+S0PcjEn8bdMJv+g2jwQ3Onig==", "dev": true, - "requires": { + "dependencies": { "commondir": "^1.0.1", "make-dir": "^3.0.2", "pkg-dir": "^4.1.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/avajs/find-cache-dir?sponsor=1" } }, - "find-root": { + "node_modules/find-root": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", "dev": true }, - "find-up": { + "node_modules/find-up": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, - "requires": { + "dependencies": { "locate-path": "^5.0.0", "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "flat-cache": { + "node_modules/flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", "integrity": "sha512-LoQe6yDuUMDzQAEH8sgmh4Md6oZnc/7PjtwjNFSzveXqSHt6ka9fPBuso7IGf9Rz4uqnSnWiFH2B/zj24a5ReA==", "dev": true, - "requires": { + "dependencies": { "flatted": "^2.0.0", "rimraf": "2.6.3", "write": "1.0.3" }, + "engines": { + "node": ">=4" + } + }, + "node_modules/flat-cache/node_modules/rimraf": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", + "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", + "dev": true, "dependencies": { - "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "requires": { - "glob": "^7.1.3" - } - } + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" } }, - "flatted": { + "node_modules/flatted": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/flatted/-/flatted-2.0.2.tgz", "integrity": "sha512-r5wGx7YeOwNWNlCA0wQ86zKyDLMQr+/RB8xy74M4hTphfmjlijTSSXGuH8rnvKZnfT9i+75zmd8jcKdMR4O6jA==", "dev": true }, - "for-each": { + "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", "dev": true, - "requires": { + "dependencies": { "is-callable": "^1.1.3" } }, - "foreground-child": { + "node_modules/foreground-child": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", "dev": true, - "requires": { + "dependencies": { "cross-spawn": "^7.0.0", "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8.0.0" } }, - "fromentries": { + "node_modules/fromentries": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", "integrity": "sha512-cHEpEQHUg0f8XdtZCc2ZAhrHzKzT0MrFUTcvx+hfxYu7rGMDc5SKoXFh+n4YigxsHXRzc6OrCshdR1bWH6HHyg==", - "dev": true + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, - "fs.realpath": { + "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, - "function-bind": { + "node_modules/function-bind": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", "dev": true }, - "function.prototype.name": { + "node_modules/function.prototype.name": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.5.tgz", "integrity": "sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", "es-abstract": "^1.19.0", "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "functional-red-black-tree": { + "node_modules/functional-red-black-tree": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", "dev": true }, - "functions-have-names": { + "node_modules/functions-have-names": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", - "dev": true + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "gensync": { + "node_modules/gensync": { "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true + "dev": true, + "engines": { + "node": ">=6.9.0" + } }, - "get-caller-file": { + "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } }, - "get-intrinsic": { + "node_modules/get-intrinsic": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.2.tgz", "integrity": "sha512-Jfm3OyCxHh9DJyc28qGk+JmfkpO41A4XkneDSujN9MDXrm4oDKdHvndhZ2dN94+ERNfkYJWDclW6k2L/ZGHjXA==", "dev": true, - "requires": { + "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", "has-symbols": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "get-package-type": { + "node_modules/get-package-type": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", - "dev": true + "dev": true, + "engines": { + "node": ">=8.0.0" + } }, - "get-stdin": { + "node_modules/get-stdin": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", "integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "get-symbol-description": { + "node_modules/get-symbol-description": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "glob": { + "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, - "requires": { + "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, - "glob-parent": { + "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, - "requires": { + "dependencies": { "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" } }, - "globals": { + "node_modules/globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true + "dev": true, + "engines": { + "node": ">=4" + } }, - "graceful-fs": { + "node_modules/graceful-fs": { "version": "4.2.10", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==", "dev": true }, - "has": { + "node_modules/has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", "dev": true, - "requires": { + "dependencies": { "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" } }, - "has-bigints": { + "node_modules/has-bigints": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", "integrity": "sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==", - "dev": true + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "has-flag": { + "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true + "dev": true, + "engines": { + "node": ">=4" + } }, - "has-property-descriptors": { + "node_modules/has-property-descriptors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", "dev": true, - "requires": { + "dependencies": { "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "has-symbols": { + "node_modules/has-symbols": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dev": true + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "has-tostringtag": { + "node_modules/has-tostringtag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", "dev": true, - "requires": { + "dependencies": { "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hash-base": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", + "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", + "dependencies": { + "inherits": "^2.0.4", + "readable-stream": "^3.6.0", + "safe-buffer": "^5.2.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/hash-base/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" } }, - "hasha": { + "node_modules/hasha": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/hasha/-/hasha-5.2.2.tgz", "integrity": "sha512-Hrp5vIK/xr5SkeN2onO32H0MgNZ0f17HRNH39WfL0SYUNOTZ5Lz1TJ8Pajo/87dYGEFlLMm7mIc/k/s6Bvz9HQ==", "dev": true, - "requires": { + "dependencies": { "is-stream": "^2.0.0", "type-fest": "^0.8.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" } }, - "hosted-git-info": { + "node_modules/hosted-git-info": { "version": "2.8.9", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", "integrity": "sha512-mxIDAb9Lsm6DoOJ7xH+5+X4y1LU/4Hi50L9C5sIswK3JzULS4bwk1FvjdBgvYR4bzT4tuUQiC15FE2f5HbLvYw==", "dev": true }, - "html-escaper": { + "node_modules/html-escaper": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "iconv-lite": { + "node_modules/iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "dev": true, - "requires": { + "dependencies": { "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" } }, - "ignore": { + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/ignore": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", - "dev": true + "dev": true, + "engines": { + "node": ">= 4" + } }, - "import-fresh": { + "node_modules/import-fresh": { "version": "3.3.0", "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", "dev": true, - "requires": { + "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" }, - "dependencies": { - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true - } + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" } }, - "imurmurhash": { + "node_modules/imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.8.19" + } }, - "indent-string": { + "node_modules/indent-string": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz", "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "inflight": { + "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", "dev": true, - "requires": { + "dependencies": { "once": "^1.3.0", "wrappy": "1" } }, - "inherits": { + "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, - "inquirer": { + "node_modules/inquirer": { "version": "7.3.3", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", "dev": true, - "requires": { + "dependencies": { "ansi-escapes": "^4.2.1", "chalk": "^4.1.0", "cli-cursor": "^3.1.0", @@ -1714,550 +2645,782 @@ "strip-ansi": "^6.0.0", "through": "^2.3.6" }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/inquirer/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "requires": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/inquirer/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/inquirer/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/inquirer/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/inquirer/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/inquirer/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/int64-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/int64-buffer/-/int64-buffer-1.0.1.tgz", + "integrity": "sha512-+3azY4pXrjAupJHU1V9uGERWlhoqNswJNji6aD/02xac7oxol508AsMC5lxKhEqyZeDFy3enq5OGWXF4u75hiw==", + "engines": { + "node": ">= 4.5.0" } }, - "internal-slot": { + "node_modules/internal-slot": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", "dev": true, - "requires": { + "dependencies": { "get-intrinsic": "^1.1.0", "has": "^1.0.3", "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" } }, - "is-arguments": { + "node_modules/is-arguments": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "is-arrayish": { + "node_modules/is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", "dev": true }, - "is-bigint": { + "node_modules/is-bigint": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", "dev": true, - "requires": { + "dependencies": { "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "is-boolean-object": { + "node_modules/is-boolean-object": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "is-callable": { + "node_modules/is-callable": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", - "dev": true + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "is-core-module": { + "node_modules/is-core-module": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", "dev": true, - "requires": { + "dependencies": { "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "is-date-object": { + "node_modules/is-date-object": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", "dev": true, - "requires": { + "dependencies": { "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "is-extglob": { + "node_modules/is-extglob": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "is-fullwidth-code-point": { + "node_modules/is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "is-glob": { + "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, - "requires": { + "dependencies": { "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" } }, - "is-negative-zero": { + "node_modules/is-negative-zero": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", - "dev": true + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "is-number-object": { + "node_modules/is-number-object": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.7.tgz", "integrity": "sha512-k1U0IRzLMo7ZlYIfzRu23Oh6MiIFasgpb9X76eqfFZAqwH44UI4KTBvBYIZ1dSL9ZzChTB9ShHfLkR4pdW5krQ==", "dev": true, - "requires": { + "dependencies": { "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "is-regex": { + "node_modules/is-regex": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "is-shared-array-buffer": { + "node_modules/is-shared-array-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", "integrity": "sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "is-stream": { + "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "is-string": { + "node_modules/is-string": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", "dev": true, - "requires": { + "dependencies": { "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "is-symbol": { + "node_modules/is-symbol": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", "dev": true, - "requires": { + "dependencies": { "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "is-typedarray": { + "node_modules/is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==", "dev": true }, - "is-weakref": { + "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "is-windows": { + "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "isarray": { + "node_modules/isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", "dev": true }, - "isexe": { + "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, - "istanbul-lib-coverage": { + "node_modules/istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "istanbul-lib-hook": { + "node_modules/istanbul-lib-hook": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/istanbul-lib-hook/-/istanbul-lib-hook-3.0.0.tgz", "integrity": "sha512-Pt/uge1Q9s+5VAZ+pCo16TYMWPBIl+oaNIjgLQxcX0itS6ueeaA+pEfThZpH8WxhFgCiEb8sAJY6MdUKgiIWaQ==", "dev": true, - "requires": { + "dependencies": { "append-transform": "^2.0.0" + }, + "engines": { + "node": ">=8" } }, - "istanbul-lib-instrument": { + "node_modules/istanbul-lib-instrument": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-4.0.3.tgz", "integrity": "sha512-BXgQl9kf4WTCPCCpmFGoJkz/+uhvm7h7PFKUYxh7qarQd3ER33vHG//qaE8eN25l07YqZPpHXU9I09l/RD5aGQ==", "dev": true, - "requires": { + "dependencies": { "@babel/core": "^7.7.5", "@istanbuljs/schema": "^0.1.2", "istanbul-lib-coverage": "^3.0.0", "semver": "^6.3.0" + }, + "engines": { + "node": ">=8" } }, - "istanbul-lib-processinfo": { + "node_modules/istanbul-lib-processinfo": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/istanbul-lib-processinfo/-/istanbul-lib-processinfo-2.0.3.tgz", "integrity": "sha512-NkwHbo3E00oybX6NGJi6ar0B29vxyvNwoC7eJ4G4Yq28UfY758Hgn/heV8VRFhevPED4LXfFz0DQ8z/0kw9zMg==", "dev": true, - "requires": { + "dependencies": { "archy": "^1.0.0", "cross-spawn": "^7.0.3", "istanbul-lib-coverage": "^3.2.0", "p-map": "^3.0.0", "rimraf": "^3.0.0", "uuid": "^8.3.2" + }, + "engines": { + "node": ">=8" } }, - "istanbul-lib-report": { + "node_modules/istanbul-lib-report": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", "dev": true, - "requires": { + "dependencies": { "istanbul-lib-coverage": "^3.0.0", "make-dir": "^3.0.0", "supports-color": "^7.1.0" }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, "dependencies": { - "has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true - }, - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "istanbul-lib-source-maps": { + "node_modules/istanbul-lib-source-maps": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", "dev": true, - "requires": { + "dependencies": { "debug": "^4.1.1", "istanbul-lib-coverage": "^3.0.0", "source-map": "^0.6.1" + }, + "engines": { + "node": ">=10" } }, - "istanbul-reports": { + "node_modules/istanbul-reports": { "version": "3.1.4", "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.4.tgz", "integrity": "sha512-r1/DshN4KSE7xWEknZLLLLDn5CJybV3nw01VTkp6D5jzLuELlcbudfj/eSQFvrKsJuTVCGnePO7ho82Nw9zzfw==", "dev": true, - "requires": { + "dependencies": { "html-escaper": "^2.0.0", "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" } }, - "js-tokens": { + "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, - "js-yaml": { + "node_modules/js-yaml": { "version": "3.14.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, - "requires": { + "dependencies": { "argparse": "^1.0.7", "esprima": "^4.0.0" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" } }, - "jsesc": { + "node_modules/jsesc": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } }, - "json-parse-better-errors": { + "node_modules/json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, - "json-schema-traverse": { + "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true }, - "json-stable-stringify-without-jsonify": { + "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true }, - "json5": { + "node_modules/json5": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", - "dev": true + "dev": true, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } }, - "jsx-ast-utils": { + "node_modules/jsx-ast-utils": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.4.1.tgz", "integrity": "sha512-z1xSldJ6imESSzOjd3NNkieVJKRlKYSOtMG8SFyCj2FIrvSaSuli/WjpBkEzCBoR9bYYYFgqJw61Xhu7Lcgk+w==", "dev": true, - "requires": { + "dependencies": { "array-includes": "^3.1.1", "object.assign": "^4.1.0" + }, + "engines": { + "node": ">=4.0" } }, - "levn": { + "node_modules/levn": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", "integrity": "sha512-0OO4y2iOHix2W6ujICbKIaEQXvFQHue65vUG3pb5EUomzPI90z9hsA1VsO/dbIIpC53J8gxM9Q4Oho0jrCM/yA==", "dev": true, - "requires": { + "dependencies": { "prelude-ls": "~1.1.2", "type-check": "~0.3.2" + }, + "engines": { + "node": ">= 0.8.0" } }, - "load-json-file": { + "node_modules/load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", "integrity": "sha512-3p6ZOGNbiX4CdvEd1VcE6yi78UrGNpjHO33noGwHCnT/o2fyllJDepsm8+mFFv/DvtwFHht5HIHSyOy5a+ChVQ==", "dev": true, - "requires": { + "dependencies": { "graceful-fs": "^4.1.2", "parse-json": "^2.2.0", "pify": "^2.0.0", "strip-bom": "^3.0.0" }, - "dependencies": { - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true - } + "engines": { + "node": ">=4" + } + }, + "node_modules/load-json-file/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" } }, - "locate-path": { + "node_modules/locate-path": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, - "requires": { + "dependencies": { "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" } }, - "lodash": { + "node_modules/lodash": { "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, - "lodash.flattendeep": { + "node_modules/lodash.flattendeep": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.flattendeep/-/lodash.flattendeep-4.4.0.tgz", "integrity": "sha512-uHaJFihxmJcEX3kT4I23ABqKKalJ/zDrDg0lsFtc1h+3uw49SIJ5beyhx5ExVRti3AvKoOJngIj7xz3oylPdWQ==", "dev": true }, - "loose-envify": { + "node_modules/loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", "dev": true, - "requires": { + "dependencies": { "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" } }, - "make-dir": { + "node_modules/make-dir": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", "dev": true, - "requires": { + "dependencies": { "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/md5.js": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", + "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" } }, - "mimic-fn": { + "node_modules/mimic-fn": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" + }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" }, - "minimatch": { + "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, - "requires": { + "dependencies": { "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" } }, - "minimist": { + "node_modules/minimist": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.6.tgz", "integrity": "sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==", "dev": true }, - "mkdirp": { + "node_modules/mkdirp": { "version": "0.5.6", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, - "requires": { + "dependencies": { "minimist": "^1.2.6" + }, + "bin": { + "mkdirp": "bin/cmd.js" } }, - "ms": { + "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "mute-stream": { + "node_modules/mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", "dev": true }, - "natural-compare": { + "node_modules/nan": { + "version": "2.22.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.22.0.tgz", + "integrity": "sha512-nbajikzWTMwsW+eSsNm3QwlOs7het9gGJU5dDZzRTQGk03vyBOauxgI4VakDzE0PtsGTmXPsXTbbjVhRwR5mpw==" + }, + "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "nice-try": { + "node_modules/nice-try": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", "dev": true }, - "node-preload": { + "node_modules/node-addon-api": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-3.2.1.tgz", + "integrity": "sha512-mmcei9JghVNDYydghQmeDX8KoAm0FAiYyIcUt/N4nhyAipB17pllZQDOJD2fotxABnt4Mdz+dKTO7eftLg4d0A==" + }, + "node_modules/node-gyp-build": { + "version": "4.8.4", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.8.4.tgz", + "integrity": "sha512-LA4ZjwlnUblHVgq0oBF3Jl/6h/Nvs5fzBLwdEF4nuxnFdsfajde4WfxtJr3CaiH+F6ewcIB/q4jQ4UzPyid+CQ==", + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, + "node_modules/node-preload": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/node-preload/-/node-preload-0.2.1.tgz", "integrity": "sha512-RM5oyBy45cLEoHqCeh+MNuFAxO0vTFBLskvQbOKnEE7YTTSN4tbN8QWDIPQ6L+WvKsB/qLEGpYe2ZZ9d4W9OIQ==", "dev": true, - "requires": { + "dependencies": { "process-on-spawn": "^1.0.0" + }, + "engines": { + "node": ">=8" } }, - "node-releases": { + "node_modules/node-releases": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.5.tgz", "integrity": "sha512-U9h1NLROZTq9uE1SNffn6WuPDg8icmi3ns4rEl/oTfIle4iLjTliCzgTsbaIFMq/Xn078/lfY/BL0GWZ+psK4Q==", "dev": true }, - "normalize-package-data": { + "node_modules/normalize-package-data": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz", "integrity": "sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA==", "dev": true, - "requires": { + "dependencies": { "hosted-git-info": "^2.1.4", "resolve": "^1.10.0", "semver": "2 || 3 || 4 || 5", "validate-npm-package-license": "^3.0.1" - }, - "dependencies": { - "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true - } } }, - "nyc": { + "node_modules/normalize-package-data/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/nyc": { "version": "15.1.0", "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.1.0.tgz", "integrity": "sha512-jMW04n9SxKdKi1ZMGhvUTHBN0EICCRkHemEoE5jm6mTYcqcdas0ATzgUgejlQUHMvpnOZqGB5Xxsv9KxJW1j8A==", "dev": true, - "requires": { + "dependencies": { "@istanbuljs/load-nyc-config": "^1.0.0", "@istanbuljs/schema": "^0.1.2", "caching-transform": "^4.0.0", @@ -2285,702 +3448,1000 @@ "spawn-wrap": "^2.0.0", "test-exclude": "^6.0.0", "yargs": "^15.0.2" + }, + "bin": { + "nyc": "bin/nyc.js" + }, + "engines": { + "node": ">=8.9" } }, - "object-assign": { + "node_modules/object-assign": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "object-inspect": { + "node_modules/object-inspect": { "version": "1.12.2", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.2.tgz", "integrity": "sha512-z+cPxW0QGUp0mcqcsgQyLVRDoXFQbXOwBaqyF7VIgI4TWNQsDHrBpUQslRmIfAoYWdYzs6UlKJtB2XJpTaNSpQ==", - "dev": true + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "object-is": { + "node_modules/object-is": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "object-keys": { + "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true + "dev": true, + "engines": { + "node": ">= 0.4" + } }, - "object.assign": { + "node_modules/object.assign": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.0", "define-properties": "^1.1.3", "has-symbols": "^1.0.1", "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "object.entries": { + "node_modules/object.entries": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.5.tgz", "integrity": "sha512-TyxmjUoZggd4OrrU1W66FMDG6CuqJxsFvymeyXI51+vQLN67zYfZseptRge703kKQdo4uccgAKebXFcRCzk4+g==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", "es-abstract": "^1.19.1" + }, + "engines": { + "node": ">= 0.4" } }, - "object.fromentries": { + "node_modules/object.fromentries": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.5.tgz", "integrity": "sha512-CAyG5mWQRRiBU57Re4FKoTBjXfDoNwdFVH2Y1tS9PqCsfUTymAohOkEMSG3aRNKmv4lV3O7p1et7c187q6bynw==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", "es-abstract": "^1.19.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "object.values": { + "node_modules/object.values": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", "es-abstract": "^1.19.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "once": { + "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, - "requires": { + "dependencies": { "wrappy": "1" } }, - "onetime": { + "node_modules/onetime": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", "dev": true, - "requires": { + "dependencies": { "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "optionator": { + "node_modules/optionator": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz", "integrity": "sha512-+IW9pACdk3XWmmTXG8m3upGUJst5XRGzxMRjXzAuJ1XnIFNvfhjjIuYkDvysnPQ7qzqVzLt78BCruntqRhWQbA==", "dev": true, - "requires": { + "dependencies": { "deep-is": "~0.1.3", "fast-levenshtein": "~2.0.6", "levn": "~0.3.0", "prelude-ls": "~1.1.2", "type-check": "~0.3.2", "word-wrap": "~1.2.3" + }, + "engines": { + "node": ">= 0.8.0" } }, - "os-tmpdir": { + "node_modules/os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "p-limit": { + "node_modules/p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", "dev": true, - "requires": { + "dependencies": { "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "p-locate": { + "node_modules/p-locate": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", "dev": true, - "requires": { + "dependencies": { "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" } }, - "p-map": { + "node_modules/p-map": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-3.0.0.tgz", "integrity": "sha512-d3qXVTF/s+W+CdJ5A29wywV2n8CQQYahlgz2bFiA+4eVNJbHJodPZ+/gXwPGh0bOqA+j8S+6+ckmvLGPk1QpxQ==", "dev": true, - "requires": { + "dependencies": { "aggregate-error": "^3.0.0" + }, + "engines": { + "node": ">=8" } }, - "p-try": { + "node_modules/p-try": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } }, - "package-hash": { + "node_modules/package-hash": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/package-hash/-/package-hash-4.0.0.tgz", "integrity": "sha512-whdkPIooSu/bASggZ96BWVvZTRMOFxnyUG5PnTSGKoJE2gd5mbVNmR2Nj20QFzxYYgAXpoqC+AiXzl+UMRh7zQ==", "dev": true, - "requires": { + "dependencies": { "graceful-fs": "^4.1.15", "hasha": "^5.0.0", "lodash.flattendeep": "^4.4.0", "release-zalgo": "^1.0.0" + }, + "engines": { + "node": ">=8" } }, - "parent-module": { + "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", "dev": true, - "requires": { + "dependencies": { "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" } }, - "parse-json": { + "node_modules/parse-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", "dev": true, - "requires": { + "dependencies": { "error-ex": "^1.2.0" + }, + "engines": { + "node": ">=0.10.0" } }, - "path-exists": { + "node_modules/path-exists": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "path-is-absolute": { + "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "path-key": { + "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "path-parse": { + "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, - "path-type": { + "node_modules/path-type": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", "integrity": "sha512-dUnb5dXUf+kzhC/W/F4e5/SkluXIFf5VUHolW1Eg1irn1hGWjPGdsRcvYJ1nD6lhk8Ir7VM0bHJKsYTx8Jx9OQ==", "dev": true, - "requires": { + "dependencies": { "pify": "^2.0.0" + }, + "engines": { + "node": ">=4" } }, - "picocolors": { + "node_modules/picocolors": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", "dev": true }, - "pify": { + "node_modules/pify": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "pkg-conf": { + "node_modules/pkg-conf": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-3.1.0.tgz", "integrity": "sha512-m0OTbR/5VPNPqO1ph6Fqbj7Hv6QU7gR/tQW40ZqrL1rjgCU85W6C1bJn0BItuJqnR98PWzw7Z8hHeChD1WrgdQ==", "dev": true, - "requires": { + "dependencies": { "find-up": "^3.0.0", "load-json-file": "^5.2.0" }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-conf/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, "dependencies": { - "find-up": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", - "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", - "dev": true, - "requires": { - "locate-path": "^3.0.0" - } - }, - "load-json-file": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", - "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.15", - "parse-json": "^4.0.0", - "pify": "^4.0.1", - "strip-bom": "^3.0.0", - "type-fest": "^0.3.0" - } - }, - "locate-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", - "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", - "dev": true, - "requires": { - "p-locate": "^3.0.0", - "path-exists": "^3.0.0" - } - }, - "p-locate": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", - "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", - "dev": true, - "requires": { - "p-limit": "^2.0.0" - } - }, - "parse-json": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", - "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", - "dev": true, - "requires": { - "error-ex": "^1.3.1", - "json-parse-better-errors": "^1.0.1" - } - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true - }, - "pify": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", - "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", - "dev": true - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true - }, - "type-fest": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", - "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", - "dev": true - } + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-conf/node_modules/load-json-file": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", + "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.1.15", + "parse-json": "^4.0.0", + "pify": "^4.0.1", + "strip-bom": "^3.0.0", + "type-fest": "^0.3.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-conf/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-conf/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-conf/node_modules/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-aOIos8bujGN93/8Ox/jPLh7RwVnPEysynVFE+fQZyg6jKELEHwzgKdLRFHUgXJL6kylijVSBC4BvN9OmsB48Rw==", + "dev": true, + "dependencies": { + "error-ex": "^1.3.1", + "json-parse-better-errors": "^1.0.1" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pkg-conf/node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-conf/node_modules/type-fest": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", + "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", + "dev": true, + "engines": { + "node": ">=6" } }, - "pkg-config": { + "node_modules/pkg-config": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pkg-config/-/pkg-config-1.1.1.tgz", "integrity": "sha512-ft/WI9YK6FuTuw4Ql+QUaNXtm/ASQNqDUUsZEgFZKyFpW6amyP8Gx01xrRs8KdiNbbqXfYxkOXplpq1euWbOjw==", "dev": true, - "requires": { + "dependencies": { "debug-log": "^1.0.0", "find-root": "^1.0.0", "xtend": "^4.0.1" + }, + "engines": { + "node": ">=0.10" } }, - "pkg-dir": { + "node_modules/pkg-dir": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", "dev": true, - "requires": { + "dependencies": { "find-up": "^4.0.0" + }, + "engines": { + "node": ">=8" } }, - "prelude-ls": { + "node_modules/prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", "integrity": "sha512-ESF23V4SKG6lVSGZgYNpbsiaAkdab6ZgOxe52p7+Kid3W3u3bxR4Vfd/o21dmN7jSt0IwgZ4v5MUd26FEtXE9w==", - "dev": true + "dev": true, + "engines": { + "node": ">= 0.8.0" + } }, - "process-on-spawn": { + "node_modules/process-on-spawn": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/process-on-spawn/-/process-on-spawn-1.0.0.tgz", "integrity": "sha512-1WsPDsUSMmZH5LeMLegqkPDrsGgsWwk1Exipy2hvB0o/F0ASzbpIctSCcZIK1ykJvtTJULEH+20WOFjMvGnCTg==", "dev": true, - "requires": { + "dependencies": { "fromentries": "^1.2.0" + }, + "engines": { + "node": ">=8" } }, - "progress": { + "node_modules/progress": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.4.0" + } }, - "prop-types": { + "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", "integrity": "sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==", "dev": true, - "requires": { + "dependencies": { "loose-envify": "^1.4.0", "object-assign": "^4.1.1", "react-is": "^16.13.1" } }, - "punycode": { + "node_modules/punycode": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pushdata-bitcoin": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/pushdata-bitcoin/-/pushdata-bitcoin-1.0.1.tgz", + "integrity": "sha512-hw7rcYTJRAl4olM8Owe8x0fBuJJ+WGbMhQuLWOXEMN3PxPCKQHRkhfL+XG0+iXUmSHjkMmb3Ba55Mt21cZc9kQ==", + "dependencies": { + "bitcoin-ops": "^1.3.0" + } }, - "queue-microtask": { + "node_modules/queue-microtask": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", - "dev": true + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, - "react-is": { + "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", "integrity": "sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==", "dev": true }, - "read-pkg": { + "node_modules/read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha512-eFIBOPW7FGjzBuk3hdXEuNSiTZS/xEMlH49HxMyzb0hyPfu4EhVjT2DH32K1hSSmVq4sebAWnZuuY5auISUTGA==", + "dev": true, + "dependencies": { + "load-json-file": "^2.0.0", + "normalize-package-data": "^2.3.2", + "path-type": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha512-1orxQfbWGUiTn9XsPlChs6rLie/AV9jwZTGmu2NZw/CUDJQchXJFYE0Fq5j7+n558T1JhDWLdhyd1Zj+wLY//w==", + "dev": true, + "dependencies": { + "find-up": "^2.0.0", + "read-pkg": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/locate-path": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha512-eFIBOPW7FGjzBuk3hdXEuNSiTZS/xEMlH49HxMyzb0hyPfu4EhVjT2DH32K1hSSmVq4sebAWnZuuY5auISUTGA==", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", "dev": true, - "requires": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" } }, - "read-pkg-up": { + "node_modules/read-pkg-up/node_modules/p-locate": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha512-1orxQfbWGUiTn9XsPlChs6rLie/AV9jwZTGmu2NZw/CUDJQchXJFYE0Fq5j7+n558T1JhDWLdhyd1Zj+wLY//w==", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" + "dependencies": { + "p-limit": "^1.1.0" }, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/read-pkg-up/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dependencies": { - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ==", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha512-nQja7m7gSKuewoVRen45CtVfODR3crN3goVQ0DDZ9N3yHxgpkuBhZqsaiotSQRrADUrne346peY7kT3TSACykg==", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha512-U1etNYuMJoIz3ZXSrrySFjsXQTWOx2/jdi86L+2pRvph/qMKL6sbcCYdH23fqsbm8TH2Gn0OybpT4eSFlCVHww==", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==", - "dev": true - } + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" } }, - "regexp.prototype.flags": { + "node_modules/regexp.prototype.flags": { "version": "1.4.3", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.3", "functions-have-names": "^1.2.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "regexpp": { + "node_modules/regexpp": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", "integrity": "sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw==", - "dev": true + "dev": true, + "engines": { + "node": ">=6.5.0" + } }, - "release-zalgo": { + "node_modules/release-zalgo": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/release-zalgo/-/release-zalgo-1.0.0.tgz", "integrity": "sha512-gUAyHVHPPC5wdqX/LG4LWtRYtgjxyX78oanFNTMMyFEfOqdC54s3eE82imuWKbOeqYht2CrNf64Qb8vgmmtZGA==", "dev": true, - "requires": { + "dependencies": { "es6-error": "^4.0.1" + }, + "engines": { + "node": ">=4" } }, - "require-directory": { + "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "require-main-filename": { + "node_modules/require-main-filename": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", "dev": true }, - "resolve": { + "node_modules/resolve": { "version": "1.22.0", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", "dev": true, - "requires": { + "dependencies": { "is-core-module": "^2.8.1", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "resolve-from": { + "node_modules/resolve-from": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "restore-cursor": { + "node_modules/restore-cursor": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", "dev": true, - "requires": { + "dependencies": { "onetime": "^5.1.0", "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" } }, - "resumer": { + "node_modules/resumer": { "version": "0.0.0", "resolved": "https://registry.npmjs.org/resumer/-/resumer-0.0.0.tgz", "integrity": "sha512-Fn9X8rX8yYF4m81rZCK/5VmrmsSbqS/i3rDLl6ZZHAXgC2nTAx3dhwG8q8odP/RmdLa2YrybDJaAMg+X1ajY3w==", "dev": true, - "requires": { + "dependencies": { "through": "~2.3.4" } }, - "rimraf": { + "node_modules/rimraf": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, - "requires": { + "dependencies": { "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dependencies": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" } }, - "run-async": { + "node_modules/run-async": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.12.0" + } }, - "run-parallel": { + "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", "dev": true, - "requires": { + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { "queue-microtask": "^1.2.2" } }, - "rxjs": { + "node_modules/rxjs": { "version": "6.6.7", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", "dev": true, - "requires": { + "dependencies": { "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" } }, - "safe-buffer": { + "node_modules/rxjs/node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/safe-buffer": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" }, - "safer-buffer": { + "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", "dev": true }, - "semver": { + "node_modules/semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true + "dev": true, + "bin": { + "semver": "bin/semver.js" + } }, - "set-blocking": { + "node_modules/set-blocking": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==", "dev": true }, - "shebang-command": { + "node_modules/sha.js": { + "version": "2.4.11", + "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dependencies": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + }, + "bin": { + "sha.js": "bin.js" + } + }, + "node_modules/shebang-command": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, - "requires": { + "dependencies": { "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" } }, - "shebang-regex": { + "node_modules/shebang-regex": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "side-channel": { + "node_modules/side-channel": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "signal-exit": { + "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true }, - "slice-ansi": { + "node_modules/slice-ansi": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-2.1.0.tgz", "integrity": "sha512-Qu+VC3EwYLldKa1fCxuuvULvSJOKEgk9pi8dZeCVK7TqBfUNTH4sFkk4joj8afVSfAYgJoSOetjx9QWOJ5mYoQ==", "dev": true, - "requires": { + "dependencies": { "ansi-styles": "^3.2.0", "astral-regex": "^1.0.0", "is-fullwidth-code-point": "^2.0.0" }, - "dependencies": { - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", - "dev": true - } + "engines": { + "node": ">=6" + } + }, + "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "dev": true, + "engines": { + "node": ">=4" } }, - "source-map": { + "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "spawn-wrap": { + "node_modules/spawn-wrap": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/spawn-wrap/-/spawn-wrap-2.0.0.tgz", "integrity": "sha512-EeajNjfN9zMnULLwhZZQU3GWBoFNkbngTUPfaawT4RkMiviTxcX0qfhVbGey39mfctfDHkWtuecgQ8NJcyQWHg==", "dev": true, - "requires": { + "dependencies": { "foreground-child": "^2.0.0", "is-windows": "^1.0.2", "make-dir": "^3.0.0", "rimraf": "^3.0.0", "signal-exit": "^3.0.2", "which": "^2.0.1" + }, + "engines": { + "node": ">=8" } }, - "spdx-correct": { + "node_modules/spdx-correct": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz", "integrity": "sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==", "dev": true, - "requires": { + "dependencies": { "spdx-expression-parse": "^3.0.0", "spdx-license-ids": "^3.0.0" } }, - "spdx-exceptions": { + "node_modules/spdx-exceptions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.3.0.tgz", "integrity": "sha512-/tTrYOC7PPI1nUAgx34hUpqXuyJG+DTHJTnIULG4rDygi4xu/tfgmq1e1cIRwRzwZgo4NLySi+ricLkZkw4i5A==", "dev": true }, - "spdx-expression-parse": { + "node_modules/spdx-expression-parse": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.1.tgz", "integrity": "sha512-cbqHunsQWnJNE6KhVSMsMeH5H/L9EpymbzqTQ3uLwNCLZ1Q481oWaofqH7nO6V07xlXwY6PhQdQ2IedWx/ZK4Q==", "dev": true, - "requires": { + "dependencies": { "spdx-exceptions": "^2.1.0", "spdx-license-ids": "^3.0.0" } }, - "spdx-license-ids": { + "node_modules/spdx-license-ids": { "version": "3.0.11", "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.11.tgz", "integrity": "sha512-Ctl2BrFiM0X3MANYgj3CkygxhRmr9mi6xhejbdO960nF6EDJApTYpn0BQnDKlnNBULKiCN1n3w9EBkHK8ZWg+g==", "dev": true }, - "sprintf-js": { + "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, - "standard": { + "node_modules/standard": { "version": "14.3.4", "resolved": "https://registry.npmjs.org/standard/-/standard-14.3.4.tgz", "integrity": "sha512-+lpOkFssMkljJ6eaILmqxHQ2n4csuEABmcubLTb9almFi1ElDzXb1819fjf/5ygSyePCq4kU2wMdb2fBfb9P9Q==", "dev": true, - "requires": { + "dependencies": { "eslint": "~6.8.0", "eslint-config-standard": "14.1.1", "eslint-config-standard-jsx": "8.1.0", @@ -2990,158 +4451,252 @@ "eslint-plugin-react": "~7.14.2", "eslint-plugin-standard": "~4.0.0", "standard-engine": "^12.0.0" + }, + "bin": { + "standard": "bin/cmd.js" + }, + "engines": { + "node": ">=8.10.0" } }, - "standard-engine": { + "node_modules/standard-engine": { "version": "12.1.0", "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-12.1.0.tgz", "integrity": "sha512-DVJnWM1CGkag4ucFLGdiYWa5/kJURPONmMmk17p8FT5NE4UnPZB1vxWnXnRo2sPSL78pWJG8xEM+1Tu19z0deg==", "dev": true, - "requires": { + "dependencies": { "deglob": "^4.0.1", "get-stdin": "^7.0.0", "minimist": "^1.2.5", "pkg-conf": "^3.1.0" + }, + "engines": { + "node": ">=8.10" + } + }, + "node_modules/stream-browserify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", + "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", + "dependencies": { + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" + } + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" } }, - "string-width": { + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", "dev": true, - "requires": { + "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" } }, - "string.prototype.trim": { + "node_modules/string.prototype.trim": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-1.2.6.tgz", "integrity": "sha512-8lMR2m+U0VJTPp6JjvJTtGyc4FIGq9CdRt7O9p6T0e6K4vjU+OP+SQJpbe/SBmRcCUIvNUnjsbmY6lnMp8MhsQ==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", "es-abstract": "^1.19.5" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "string.prototype.trimend": { + "node_modules/string.prototype.trimend": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz", "integrity": "sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", "es-abstract": "^1.19.5" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "string.prototype.trimstart": { + "node_modules/string.prototype.trimstart": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz", "integrity": "sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", "es-abstract": "^1.19.5" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "strip-ansi": { + "node_modules/strip-ansi": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", "dev": true, - "requires": { + "dependencies": { "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" } }, - "strip-bom": { + "node_modules/strip-bom": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "strip-json-comments": { + "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "supports-color": { + "node_modules/supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, - "requires": { + "dependencies": { "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" } }, - "supports-preserve-symlinks-flag": { + "node_modules/supports-preserve-symlinks-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "table": { + "node_modules/table": { "version": "5.4.6", "resolved": "https://registry.npmjs.org/table/-/table-5.4.6.tgz", "integrity": "sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==", "dev": true, - "requires": { + "dependencies": { "ajv": "^6.10.2", "lodash": "^4.17.14", "slice-ansi": "^2.1.0", "string-width": "^3.0.0" }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/table/node_modules/ansi-regex": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", + "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/table/node_modules/emoji-regex": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", + "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", + "dev": true + }, + "node_modules/table/node_modules/is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/table/node_modules/string-width": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", + "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", + "dev": true, + "dependencies": { + "emoji-regex": "^7.0.1", + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^5.1.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/table/node_modules/strip-ansi": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", + "dev": true, "dependencies": { - "ansi-regex": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.1.tgz", - "integrity": "sha512-ILlv4k/3f6vfQ4OoP2AGvirOktlQ98ZEL1k9FaQjxa3L1abBgbuTDAdPOpvbGncC0BTVQrl+OM8xZGK6tWXt7g==", - "dev": true - }, - "emoji-regex": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", - "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha512-VHskAKYM8RfSFXwee5t5cbN5PZeq1Wrh6qd5bkyiXIf6UQcN6w/A0eXM9r6t8d+GYOh+o6ZhiEnb88LN/Y8m2w==", - "dev": true - }, - "string-width": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", - "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", - "dev": true, - "requires": { - "emoji-regex": "^7.0.1", - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^5.1.0" - } - }, - "strip-ansi": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", - "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", - "dev": true, - "requires": { - "ansi-regex": "^4.1.0" - } - } + "ansi-regex": "^4.1.0" + }, + "engines": { + "node": ">=6" } }, - "tape": { + "node_modules/tape": { "version": "4.15.1", "resolved": "https://registry.npmjs.org/tape/-/tape-4.15.1.tgz", "integrity": "sha512-k7F5pyr91n9D/yjSJwbLLYDCrTWXxMSXbbmHX2n334lSIc2rxeXyFkaBv4UuUd2gBYMrAOalPutAiCxC6q1qbw==", "dev": true, - "requires": { + "dependencies": { "call-bind": "~1.0.2", "deep-equal": "~1.1.1", "defined": "~1.0.0", @@ -3157,241 +4712,348 @@ "resumer": "~0.0.0", "string.prototype.trim": "~1.2.5", "through": "~2.3.8" + }, + "bin": { + "tape": "bin/tape" } }, - "test-exclude": { + "node_modules/test-exclude": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", "dev": true, - "requires": { + "dependencies": { "@istanbuljs/schema": "^0.1.2", "glob": "^7.1.4", "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" } }, - "text-table": { + "node_modules/text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==", "dev": true }, - "through": { + "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, - "tmp": { + "node_modules/tiny-secp256k1": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/tiny-secp256k1/-/tiny-secp256k1-1.1.7.tgz", + "integrity": "sha512-eb+F6NabSnjbLwNoC+2o5ItbmP1kg7HliWue71JgLegQt6A5mTN8YbvTLCazdlg6e5SV6A+r8OGvZYskdlmhqQ==", + "hasInstallScript": true, + "dependencies": { + "bindings": "^1.3.0", + "bn.js": "^4.11.8", + "create-hmac": "^1.1.7", + "elliptic": "^6.4.0", + "nan": "^2.13.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/tiny-secp256k1/node_modules/bn.js": { + "version": "4.12.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.1.tgz", + "integrity": "sha512-k8TVBiPkPJT9uHLdOKfFpqcfprwBFOAAXXozRubr7R7PfIuKvQlzcI4M0pALeqXN09vdaMbUdUj+pass+uULAg==" + }, + "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", "dev": true, - "requires": { + "dependencies": { "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" } }, - "to-fast-properties": { + "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true + "dev": true, + "engines": { + "node": ">=4" + } }, - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "peer": true }, - "type-check": { + "node_modules/type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "integrity": "sha512-ZCmOJdvOWDBYJlzAoFkC+Q0+bUyEOS1ltgp1MGU03fqHG+dbi9tBFU2Rd9QKiDZFAYrhPh2JUf7rZRIuHRKtOg==", "dev": true, - "requires": { + "dependencies": { "prelude-ls": "~1.1.2" + }, + "engines": { + "node": ">= 0.8.0" } }, - "type-fest": { + "node_modules/type-fest": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.8.1.tgz", "integrity": "sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA==", - "dev": true + "dev": true, + "engines": { + "node": ">=8" + } }, - "typedarray-to-buffer": { + "node_modules/typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", "dev": true, - "requires": { + "dependencies": { "is-typedarray": "^1.0.0" } }, - "unbox-primitive": { + "node_modules/typeforce": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/typeforce/-/typeforce-1.18.0.tgz", + "integrity": "sha512-7uc1O8h1M1g0rArakJdf0uLRSSgFcYexrVoKo+bzJd32gd4gDy2L/Z+8/FjPnU9ydY3pEnVPtr9FyscYY60K1g==" + }, + "node_modules/uint8array-tools": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/uint8array-tools/-/uint8array-tools-0.0.8.tgz", + "integrity": "sha512-xS6+s8e0Xbx++5/0L+yyexukU7pz//Yg6IHg3BKhXotg1JcYtgxVcUctQ0HxLByiJzpAkNFawz1Nz5Xadzo82g==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", "integrity": "sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw==", "dev": true, - "requires": { + "dependencies": { "call-bind": "^1.0.2", "has-bigints": "^1.0.2", "has-symbols": "^1.0.3", "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "uniq": { + "node_modules/uniq": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/uniq/-/uniq-1.0.1.tgz", "integrity": "sha512-Gw+zz50YNKPDKXs+9d+aKAjVwpjNwqzvNpLigIruT4HA9lMZNdMqs9x07kKHB/L9WRzqp4+DlTU5s4wG2esdoA==", "dev": true }, - "uri-js": { + "node_modules/uri-js": { "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, - "requires": { + "dependencies": { "punycode": "^2.1.0" } }, - "uuid": { + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "node_modules/uuid": { "version": "8.3.2", "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true + "dev": true, + "bin": { + "uuid": "dist/bin/uuid" + } }, - "v8-compile-cache": { + "node_modules/v8-compile-cache": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", "dev": true }, - "validate-npm-package-license": { + "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", "integrity": "sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==", "dev": true, - "requires": { + "dependencies": { "spdx-correct": "^3.0.0", "spdx-expression-parse": "^3.0.0" } }, - "which": { + "node_modules/varuint-bitcoin": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/varuint-bitcoin/-/varuint-bitcoin-2.0.0.tgz", + "integrity": "sha512-6QZbU/rHO2ZQYpWFDALCDSRsXbAs1VOEmXAxtbtjLtKuMJ/FQ8YbhfxlaiKv5nklci0M6lZtlZyxo9Q+qNnyog==", + "dependencies": { + "uint8array-tools": "^0.0.8" + } + }, + "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, - "requires": { + "dependencies": { "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" } }, - "which-boxed-primitive": { + "node_modules/which-boxed-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", "dev": true, - "requires": { + "dependencies": { "is-bigint": "^1.0.1", "is-boolean-object": "^1.1.0", "is-number-object": "^1.0.4", "is-string": "^1.0.5", "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "which-module": { + "node_modules/which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", "integrity": "sha512-B+enWhmw6cjfVC7kS8Pj9pCrKSc5txArRyaYGe088shv/FGWH+0Rjx/xPgtsWfsUtS27FkP697E4DDhgrgoc0Q==", "dev": true }, - "word-wrap": { + "node_modules/wif": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/wif/-/wif-5.0.0.tgz", + "integrity": "sha512-iFzrC/9ne740qFbNjTZ2FciSRJlHIXoxqk/Y5EnE08QOXu1WjJyCCswwDTYbohAOEnlCtLaAAQBhyaLRFh2hMA==", + "dependencies": { + "bs58check": "^4.0.0" + } + }, + "node_modules/word-wrap": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.10.0" + } }, - "wrap-ansi": { + "node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", "dev": true, - "requires": { + "dependencies": { "ansi-styles": "^4.0.0", "string-width": "^4.1.0", "strip-ansi": "^6.0.0" }, + "engines": { + "node": ">=8" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "dependencies": { - "ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "requires": { - "color-convert": "^2.0.1" - } - }, - "color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "requires": { - "color-name": "~1.1.4" - } - }, - "color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - } + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" } }, - "wrappy": { + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, - "write": { + "node_modules/write": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/write/-/write-1.0.3.tgz", "integrity": "sha512-/lg70HAjtkUgWPVZhZcm+T4hkL8Zbtp1nFNOn3lRrxnlv50SRBv7cR7RqR+GMsd3hUXy9hWBo4CHTbFTcOYwig==", "dev": true, - "requires": { + "dependencies": { "mkdirp": "^0.5.1" + }, + "engines": { + "node": ">=4" } }, - "write-file-atomic": { + "node_modules/write-file-atomic": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", "dev": true, - "requires": { + "dependencies": { "imurmurhash": "^0.1.4", "is-typedarray": "^1.0.0", "signal-exit": "^3.0.2", "typedarray-to-buffer": "^3.1.5" } }, - "xtend": { + "node_modules/xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", - "dev": true + "dev": true, + "engines": { + "node": ">=0.4" + } }, - "y18n": { + "node_modules/y18n": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", "dev": true }, - "yargs": { + "node_modules/yargs": { "version": "15.4.1", "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", "dev": true, - "requires": { + "dependencies": { "cliui": "^6.0.0", "decamelize": "^1.2.0", "find-up": "^4.1.0", @@ -3403,16 +5065,22 @@ "which-module": "^2.0.0", "y18n": "^4.0.0", "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" } }, - "yargs-parser": { + "node_modules/yargs-parser": { "version": "18.1.3", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", "dev": true, - "requires": { + "dependencies": { "camelcase": "^5.0.0", "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" } } } diff --git a/package.json b/package.json index 337bf4f..cb9399d 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "coinselect", + "name": "@onekeyfe/coinselect", "version": "3.1.13", "description": "A transaction input selection module for bitcoin.", "keywords": [ @@ -28,7 +28,9 @@ "break.js", "index.js", "split.js", - "utils.js" + "utils.js", + "witness.js", + "witness.d.ts" ], "main": "index.js", "types": "index.d.ts", @@ -37,15 +39,43 @@ "url": "https://github.com/bitcoinjs/coinselect.git" }, "scripts": { - "coverage": "nyc --check-coverage --branches 100 --functions 100 tape test/*.js", + "coverage": "nyc --exclude='third-party/**' --check-coverage --branches 90 --functions 95 tape test/*.js", "standard": "standard", + "standard:file": "standard --fix", "test": "npm run standard && npm run unit", - "unit": "tape test/*.js" + "unit": "tape test/*.js", + "test-witness": "tape test/witness.js" }, "devDependencies": { "nyc": "^15.0.0", "standard": "^14.3.4", "tape": "^4.5.1" }, - "dependencies": {} + "dependencies": { + "bchaddrjs": "^0.5.2", + "bech32": "^2.0.0", + "bip66": "^2.0.0", + "bitcoin-ops": "^1.4.1", + "blake-hash": "^2.0.0", + "blakejs": "^1.2.1", + "bn.js": "^5.2.1", + "bs58": "^6.0.0", + "bs58check": "^4.0.0", + "create-hmac": "^1.1.7", + "int64-buffer": "^1.0.1", + "pushdata-bitcoin": "^1.0.1", + "tiny-secp256k1": "^1.1.6", + "typeforce": "^1.18.0", + "varuint-bitcoin": "2.0.0", + "wif": "^5.0.0", + "bignumber.js": "9.1.2" + }, + "peerDependencies": { + "tslib": "^2.6.2" + }, + "standard": { + "ignore": [ + "third-party/**" + ] + } } diff --git a/test/fixtures/witness.js b/test/fixtures/witness.js new file mode 100644 index 0000000..e3aa757 --- /dev/null +++ b/test/fixtures/witness.js @@ -0,0 +1,370 @@ +const testnet = { + messagePrefix: '\x18Bitcoin Signed Message:\n', + bech32: 'tb', + bip32: { + public: 0x043587cf, + private: 0x04358394 + }, + pubKeyHash: 0x6f, + scriptHash: 0xc4, + wif: 0xef +} + +const fixtures = [ + { + description: 'composeTx success', + feeRate: 615, + inputs: [ + { + txId: 'f4668', + vout: 0, + value: 10000, + amount: '10000', + confirmations: 22, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + { + txId: 'a88d1', + vout: 0, + value: 21000, + amount: '21000', + confirmations: 2150, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + { + txId: 'a88d1', + vout: 1, + value: 757928711, + amount: '757928711', + confirmations: 2155300, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + { + txId: 'adb852', + vout: 0, + value: 1000, + amount: '1000', + confirmations: 33, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + { + txId: 'ed57f6', + vout: 0, + value: 10000, + amount: '10000', + confirmations: 3321, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + { + txId: 'cfc54b', + vout: 0, + value: 30000, + amount: '30000', + confirmations: 3320, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + { + txId: '158d17', + vout: 1, + value: 1851600, + amount: '1851600', + confirmations: 3320, + own: true, + coinbase: false, + address: 'tb1qwqfxvxf5a8pf02at7xz55xgt0j5cmcm9ta8r57', + path: "m/84'/1'/0'/1/0" + }, + { + txId: 'd91c6b', + vout: 0, + value: 100000, + amount: '100000', + confirmations: 3320, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + { + txId: '5036d8', + vout: 0, + value: 100000, + amount: '100000', + confirmations: 2120, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + { + txId: '06d3a5', + vout: 18, + value: 3686229, + amount: '3686229', + confirmations: 2150, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + { + txId: 'b07db9', + vout: 1, + value: 7306, + amount: '7306', + confirmations: 2150, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + { + txId: 'f3d23', + vout: 1, + value: 2993713, + amount: '2993713', + confirmations: 2150, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + } + ], + outputs: [ + { + type: 'payment', + address: 'tb1quawu6eyfuechu3qhdeejnrzne9y7shr08u8zzt', + value: 40000000, + amount: '40000000' + } + ], + network: testnet, + changeAddress: { + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + txType: 'p2wpkh', + expected: { + type: 'final', + fee: '86715', + feePerByte: '615', + bytes: 141, + max: undefined, + totalSpent: '40086715', + inputs: [ + { + txId: 'a88d1', + vout: 1, + value: 757928711, + confirmations: 2155300, + own: true, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0", + coinbase: false, + amount: '757928711' + } + ], + outputs: [ + { + address: 'tb1quawu6eyfuechu3qhdeejnrzne9y7shr08u8zzt', + value: 40000000, + amount: '40000000', + type: 'payment' + }, + { + type: 'change', + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0", + amount: '717841996' + } + ], + outputsPermutation: [0, 1] + }, + shouldThrow: false + }, + { + description: 'Missing confirmations', + feeRate: 615, + inputs: [ + { + txId: 'f46689066ac0493cc55920c3918163ccda6c64998d6c078c6254e1c00c36a332', + vout: 0, + value: 10000, + amount: '10000', + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + } + ], + outputs: [ + { + address: 'tb1quawu6eyfuechu3qhdeejnrzne9y7shr08u8zzt', + value: 40000000 + } + ], + network: testnet, + changeAddress: { + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + txType: 'p2wpkh', + expected: 'Missing confirmations', + shouldThrow: true + }, + { + description: 'op_return', + feeRate: 20, + inputs: [ + { + txId: 'f46689066ac0493cc55920c3918163ccda6c64998d6c078c6254e1c00c36a332', + vout: 0, + value: 1000000, + amount: '1000000', + confirmations: 2150, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + } + ], + outputs: [ + { + type: 'payment', + address: 'tb1quawu6eyfuechu3qhdeejnrzne9y7shr08u8zzt', + value: 4000, + amount: '4000' + }, + { + type: 'opreturn', + dataHex: '48656c6c6f576f726c64' + } + ], + network: testnet, + changeAddress: { + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + txType: 'p2wpkh', + expected: { + type: 'final', + fee: '3240', + feePerByte: '20', + bytes: 162, + max: undefined, + totalSpent: '7240', + inputs: [ + { + txId: 'f46689066ac0493cc55920c3918163ccda6c64998d6c078c6254e1c00c36a332', + vout: 0, + value: 1000000, + confirmations: 2150, + own: true, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0", + coinbase: false, + amount: '1000000' + } + ], + outputs: [ + { + type: 'payment', + address: 'tb1quawu6eyfuechu3qhdeejnrzne9y7shr08u8zzt', + value: 4000, + amount: '4000' + }, + { + type: 'opreturn', + dataHex: '48656c6c6f576f726c64' + }, + { + type: 'change', + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0", + amount: '992760' + } + ], + outputsPermutation: [0, 1, 2] + }, + shouldThrow: false + }, + { + description: 'send max', + feeRate: 202, + inputs: [ + { + txId: 'f46689066ac0493cc55920c3918163ccda6c64998d6c078c6254e1c00c36a332', + vout: 0, + value: 1000000, + amount: '1000000', + confirmations: 2150, + own: true, + coinbase: false, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + } + ], + outputs: [ + { + type: 'send-max', + address: 'tb1quawu6eyfuechu3qhdeejnrzne9y7shr08u8zzt' + } + ], + network: testnet, + changeAddress: { + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0" + }, + txType: 'p2wpkh', + expected: { + type: 'final', + fee: '22220', + feePerByte: '202', + bytes: 110, + max: '977780', + totalSpent: '1000000', + inputs: [ + { + txId: 'f46689066ac0493cc55920c3918163ccda6c64998d6c078c6254e1c00c36a332', + vout: 0, + value: 1000000, + confirmations: 2150, + own: true, + address: 'tb1qul5mzh5phe7xqyqek0nl42hflfrn7ugxck59jd', + path: "m/84'/1'/0'/0/0", + coinbase: false, + amount: '1000000' + } + ], + outputs: [ + { + type: 'payment', + address: 'tb1quawu6eyfuechu3qhdeejnrzne9y7shr08u8zzt', + amount: '977780' + } + ], + outputsPermutation: [0] + }, + shouldThrow: false + } +] + +module.exports = fixtures diff --git a/test/witness.js b/test/witness.js new file mode 100644 index 0000000..046f145 --- /dev/null +++ b/test/witness.js @@ -0,0 +1,69 @@ +var coinSelect = require('../witness') +var fixtures = require('./fixtures/witness') +var tape = require('tape') + +fixtures.forEach(function (f) { + tape(f.description, function (t) { + if (f.shouldThrow) { + t.throws(() => { + coinSelect({ + utxos: f.inputs, + outputs: f.outputs, + feeRate: f.feeRate, + network: f.network, + changeAddress: f.changeAddress + }) + }, + new RegExp(f.expected), + f.description + ) + t.end() + } else { + var actual = coinSelect({ + utxos: f.inputs, + outputs: f.outputs, + feeRate: f.feeRate, + network: f.network, + changeAddress: f.changeAddress, + txType: f.txType + }) + + const compareOutputs = (actual, expected) => { + if (actual.length !== expected.length) { + console.log('Length mismatch:', { + actualLength: actual.length, + expectedLength: expected.length + }) + return false + } + + const objectsEqual = (obj1, obj2) => { + const keys1 = Object.keys(obj1).sort() + const keys2 = Object.keys(obj2).sort() + + if (keys1.length !== keys2.length) return false + + return keys1.every((key, index) => { + const val1 = obj1[key] + const val2 = obj2[key] + return JSON.stringify(val1) === JSON.stringify(val2) + }) + } + + return actual.every(actualItem => + expected.some(expectedItem => objectsEqual(actualItem, expectedItem)) + ) + } + + t.same(actual.type, f.expected.type) + t.same(actual.fee, f.expected.fee) + t.same(actual.feePerByte, f.expected.feePerByte) + t.same(actual.bytes, f.expected.bytes) + t.same(actual.max, f.expected.max) + t.same(actual.totalSpent, f.expected.totalSpent) + t.same(actual.inputs, f.expected.inputs) + t.ok(compareOutputs(actual.outputs, f.expected.outputs), 'outputs are the same') + t.end() + } + }) +}) diff --git a/third-party/utils/addDashesToSpaces.d.ts b/third-party/utils/addDashesToSpaces.d.ts new file mode 100644 index 0000000..a5fa9a1 --- /dev/null +++ b/third-party/utils/addDashesToSpaces.d.ts @@ -0,0 +1,2 @@ +export declare const addDashesToSpaces: (inputString: string) => string; +//# sourceMappingURL=addDashesToSpaces.d.ts.map \ No newline at end of file diff --git a/third-party/utils/addDashesToSpaces.js b/third-party/utils/addDashesToSpaces.js new file mode 100644 index 0000000..dd282ed --- /dev/null +++ b/third-party/utils/addDashesToSpaces.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.addDashesToSpaces = void 0; +const addDashesToSpaces = (inputString) => inputString.replace(/\s+/g, '-'); +exports.addDashesToSpaces = addDashesToSpaces; +//# sourceMappingURL=addDashesToSpaces.js.map \ No newline at end of file diff --git a/third-party/utils/arrayDistinct.d.ts b/third-party/utils/arrayDistinct.d.ts new file mode 100644 index 0000000..a67169c --- /dev/null +++ b/third-party/utils/arrayDistinct.d.ts @@ -0,0 +1,2 @@ +export declare const arrayDistinct: (item: T, index: number, self: T[]) => boolean; +//# sourceMappingURL=arrayDistinct.d.ts.map \ No newline at end of file diff --git a/third-party/utils/arrayDistinct.js b/third-party/utils/arrayDistinct.js new file mode 100644 index 0000000..09f97e5 --- /dev/null +++ b/third-party/utils/arrayDistinct.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.arrayDistinct = void 0; +const arrayDistinct = (item, index, self) => self.indexOf(item) === index; +exports.arrayDistinct = arrayDistinct; +//# sourceMappingURL=arrayDistinct.js.map \ No newline at end of file diff --git a/third-party/utils/arrayPartition.d.ts b/third-party/utils/arrayPartition.d.ts new file mode 100644 index 0000000..bd1fe3c --- /dev/null +++ b/third-party/utils/arrayPartition.d.ts @@ -0,0 +1,7 @@ +type ArrayPartition = { + (array: T[], condition: (elem: T) => elem is S): [S[], Exclude[]]; + (array: T[], condition: (elem: T) => boolean): [T[], T[]]; +}; +export declare const arrayPartition: ArrayPartition; +export {}; +//# sourceMappingURL=arrayPartition.d.ts.map \ No newline at end of file diff --git a/third-party/utils/arrayPartition.js b/third-party/utils/arrayPartition.js new file mode 100644 index 0000000..b4ef31b --- /dev/null +++ b/third-party/utils/arrayPartition.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.arrayPartition = void 0; +const arrayPartition = (array, condition) => array.reduce(([pass, fail], elem) => condition(elem) ? [[...pass, elem], fail] : [pass, [...fail, elem]], [[], []]); +exports.arrayPartition = arrayPartition; +//# sourceMappingURL=arrayPartition.js.map \ No newline at end of file diff --git a/third-party/utils/arrayShuffle.d.ts b/third-party/utils/arrayShuffle.d.ts new file mode 100644 index 0000000..fdc769e --- /dev/null +++ b/third-party/utils/arrayShuffle.d.ts @@ -0,0 +1,4 @@ +export declare const arrayShuffle: (array: readonly T[], { randomInt }: { + randomInt: (min: number, max: number) => number; +}) => T[]; +//# sourceMappingURL=arrayShuffle.d.ts.map \ No newline at end of file diff --git a/third-party/utils/arrayShuffle.js b/third-party/utils/arrayShuffle.js new file mode 100644 index 0000000..5d321b6 --- /dev/null +++ b/third-party/utils/arrayShuffle.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.arrayShuffle = void 0; +const arrayShuffle = (array, { randomInt }) => { + const shuffled = array.slice(); + for (let i = shuffled.length - 1; i > 0; i--) { + const j = randomInt(0, i + 1); + [shuffled[i], shuffled[j]] = [shuffled[j], shuffled[i]]; + } + return shuffled; +}; +exports.arrayShuffle = arrayShuffle; +//# sourceMappingURL=arrayShuffle.js.map \ No newline at end of file diff --git a/third-party/utils/arrayToDictionary.d.ts b/third-party/utils/arrayToDictionary.d.ts new file mode 100644 index 0000000..d755875 --- /dev/null +++ b/third-party/utils/arrayToDictionary.d.ts @@ -0,0 +1,10 @@ +type DictionaryKey = string | number; +type GetKey = (item: T) => unknown; +type Key, R = ReturnType> = R extends DictionaryKey ? R : never; +type ArrayToDictionary = { + >(array: T[], getKey: Fn, multiple?: false): Record, T>; + >(array: T[], getKey: Fn, multiple: true): Record, T[]>; +}; +export declare const arrayToDictionary: ArrayToDictionary; +export {}; +//# sourceMappingURL=arrayToDictionary.d.ts.map \ No newline at end of file diff --git a/third-party/utils/arrayToDictionary.js b/third-party/utils/arrayToDictionary.js new file mode 100644 index 0000000..c3adb07 --- /dev/null +++ b/third-party/utils/arrayToDictionary.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.arrayToDictionary = void 0; +const validateKey = (key) => { + if (['string', 'number'].includes(typeof key)) { + return true; + } + return false; +}; +const arrayToDictionary = (array, getKey, multiple) => multiple + ? array.reduce((prev, cur) => { + var _a; + const key = getKey(cur); + if (validateKey(key)) { + return Object.assign(Object.assign({}, prev), { [key]: [...((_a = prev[key]) !== null && _a !== void 0 ? _a : []), cur] }); + } + return prev; + }, {}) + : array.reduce((prev, cur) => { + const key = getKey(cur); + if (validateKey(key)) { + return Object.assign(Object.assign({}, prev), { [key]: cur }); + } + return prev; + }, {}); +exports.arrayToDictionary = arrayToDictionary; +//# sourceMappingURL=arrayToDictionary.js.map \ No newline at end of file diff --git a/third-party/utils/asciiUtils.d.ts b/third-party/utils/asciiUtils.d.ts new file mode 100644 index 0000000..92a1a6f --- /dev/null +++ b/third-party/utils/asciiUtils.d.ts @@ -0,0 +1,3 @@ +export declare function isAscii(value?: string): boolean; +export declare function getNonAsciiChars(value?: string): RegExpMatchArray | null; +//# sourceMappingURL=asciiUtils.d.ts.map \ No newline at end of file diff --git a/third-party/utils/asciiUtils.js b/third-party/utils/asciiUtils.js new file mode 100644 index 0000000..a9a759d --- /dev/null +++ b/third-party/utils/asciiUtils.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isAscii = isAscii; +exports.getNonAsciiChars = getNonAsciiChars; +const nonAsciiPattern = /[^\x20-\x7E]/g; +function isAscii(value) { + if (!value) + return true; + return !nonAsciiPattern.test(value); +} +function getNonAsciiChars(value) { + if (!value) + return null; + return value.match(nonAsciiPattern); +} +//# sourceMappingURL=asciiUtils.js.map \ No newline at end of file diff --git a/third-party/utils/bigNumber.d.ts b/third-party/utils/bigNumber.d.ts new file mode 100644 index 0000000..55af067 --- /dev/null +++ b/third-party/utils/bigNumber.d.ts @@ -0,0 +1,5 @@ +import BN from 'bignumber.js'; +export declare const BigNumber: typeof BN; +export type BigNumber = BN; +export type BigNumberValue = BN.Value; +//# sourceMappingURL=bigNumber.d.ts.map \ No newline at end of file diff --git a/third-party/utils/bigNumber.js b/third-party/utils/bigNumber.js new file mode 100644 index 0000000..77b0d45 --- /dev/null +++ b/third-party/utils/bigNumber.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BigNumber = void 0; +const tslib_1 = require("tslib"); +const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js")); +exports.BigNumber = bignumber_js_1.default.clone({ + EXPONENTIAL_AT: 1e9, +}); +//# sourceMappingURL=bigNumber.js.map \ No newline at end of file diff --git a/third-party/utils/bufferUtils.d.ts b/third-party/utils/bufferUtils.d.ts new file mode 100644 index 0000000..8345322 --- /dev/null +++ b/third-party/utils/bufferUtils.d.ts @@ -0,0 +1,3 @@ +export declare const reverseBuffer: (src: Buffer) => Buffer; +export declare const getChunkSize: (n: number) => Buffer; +//# sourceMappingURL=bufferUtils.d.ts.map \ No newline at end of file diff --git a/third-party/utils/bufferUtils.js b/third-party/utils/bufferUtils.js new file mode 100644 index 0000000..8513363 --- /dev/null +++ b/third-party/utils/bufferUtils.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getChunkSize = exports.reverseBuffer = void 0; +const reverseBuffer = (src) => { + if (src.length < 1) + return src; + const buffer = Buffer.alloc(src.length); + let j = buffer.length - 1; + for (let i = 0; i < buffer.length / 2; i++) { + buffer[i] = src[j]; + buffer[j] = src[i]; + j--; + } + return buffer; +}; +exports.reverseBuffer = reverseBuffer; +const getChunkSize = (n) => { + const buf = Buffer.allocUnsafe(1); + buf.writeUInt8(n); + return buf; +}; +exports.getChunkSize = getChunkSize; +//# sourceMappingURL=bufferUtils.js.map \ No newline at end of file diff --git a/third-party/utils/bytesToHumanReadable.d.ts b/third-party/utils/bytesToHumanReadable.d.ts new file mode 100644 index 0000000..52a2233 --- /dev/null +++ b/third-party/utils/bytesToHumanReadable.d.ts @@ -0,0 +1,2 @@ +export declare const bytesToHumanReadable: (bytes: number) => string; +//# sourceMappingURL=bytesToHumanReadable.d.ts.map \ No newline at end of file diff --git a/third-party/utils/bytesToHumanReadable.js b/third-party/utils/bytesToHumanReadable.js new file mode 100644 index 0000000..a2408d3 --- /dev/null +++ b/third-party/utils/bytesToHumanReadable.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.bytesToHumanReadable = void 0; +const units = ['B', 'KB', 'MB', 'GB', 'TB']; +const bytesToHumanReadable = (bytes) => { + let size = Math.abs(bytes); + let i = 0; + while (size >= 1024 || i >= units.length) { + size /= 1024; + i++; + } + return `${size.toFixed(1)} ${units[i]}`; +}; +exports.bytesToHumanReadable = bytesToHumanReadable; +//# sourceMappingURL=bytesToHumanReadable.js.map \ No newline at end of file diff --git a/third-party/utils/capitalizeFirstLetter.d.ts b/third-party/utils/capitalizeFirstLetter.d.ts new file mode 100644 index 0000000..1b260df --- /dev/null +++ b/third-party/utils/capitalizeFirstLetter.d.ts @@ -0,0 +1,2 @@ +export declare const capitalizeFirstLetter: (str: T) => Capitalize; +//# sourceMappingURL=capitalizeFirstLetter.d.ts.map \ No newline at end of file diff --git a/third-party/utils/capitalizeFirstLetter.js b/third-party/utils/capitalizeFirstLetter.js new file mode 100644 index 0000000..6db6c75 --- /dev/null +++ b/third-party/utils/capitalizeFirstLetter.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.capitalizeFirstLetter = void 0; +const capitalizeFirstLetter = (str) => (str.charAt(0).toUpperCase() + str.slice(1)); +exports.capitalizeFirstLetter = capitalizeFirstLetter; +//# sourceMappingURL=capitalizeFirstLetter.js.map \ No newline at end of file diff --git a/third-party/utils/cloneObject.d.ts b/third-party/utils/cloneObject.d.ts new file mode 100644 index 0000000..49e666e --- /dev/null +++ b/third-party/utils/cloneObject.d.ts @@ -0,0 +1,2 @@ +export declare const cloneObject: (obj: T, seen?: WeakMap) => T; +//# sourceMappingURL=cloneObject.d.ts.map \ No newline at end of file diff --git a/third-party/utils/cloneObject.js b/third-party/utils/cloneObject.js new file mode 100644 index 0000000..d1f50dd --- /dev/null +++ b/third-party/utils/cloneObject.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.cloneObject = void 0; +const cloneObject = (obj, seen = new WeakMap()) => { + if (obj === null || typeof obj !== 'object') { + return obj; + } + if (seen.has(obj)) { + return seen.get(obj); + } + if (obj instanceof ArrayBuffer) { + return obj.slice(0); + } + if (ArrayBuffer.isView(obj)) { + const TypedArrayConstructor = obj.constructor; + return new TypedArrayConstructor(obj); + } + const clone = Array.isArray(obj) ? [] : {}; + seen.set(obj, clone); + for (const key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + const value = obj[key]; + if (typeof value === 'function' || typeof value === 'symbol') { + continue; + } + clone[key] = (0, exports.cloneObject)(value, seen); + } + } + return clone; +}; +exports.cloneObject = cloneObject; +//# sourceMappingURL=cloneObject.js.map \ No newline at end of file diff --git a/third-party/utils/countBytesInString.d.ts b/third-party/utils/countBytesInString.d.ts new file mode 100644 index 0000000..55c692a --- /dev/null +++ b/third-party/utils/countBytesInString.d.ts @@ -0,0 +1,2 @@ +export declare const countBytesInString: (input: string) => number; +//# sourceMappingURL=countBytesInString.d.ts.map \ No newline at end of file diff --git a/third-party/utils/countBytesInString.js b/third-party/utils/countBytesInString.js new file mode 100644 index 0000000..148e7f2 --- /dev/null +++ b/third-party/utils/countBytesInString.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.countBytesInString = void 0; +const countBytesInString = (input) => encodeURI(input).split(/%..|./).length - 1; +exports.countBytesInString = countBytesInString; +//# sourceMappingURL=countBytesInString.js.map \ No newline at end of file diff --git a/third-party/utils/createCooldown.d.ts b/third-party/utils/createCooldown.d.ts new file mode 100644 index 0000000..95cc063 --- /dev/null +++ b/third-party/utils/createCooldown.d.ts @@ -0,0 +1,2 @@ +export declare const createCooldown: (cooldownMs: number) => () => boolean; +//# sourceMappingURL=createCooldown.d.ts.map \ No newline at end of file diff --git a/third-party/utils/createCooldown.js b/third-party/utils/createCooldown.js new file mode 100644 index 0000000..5385aa6 --- /dev/null +++ b/third-party/utils/createCooldown.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createCooldown = void 0; +const createCooldown = (cooldownMs) => { + let last = 0; + return () => { + const now = Date.now(); + if (now - last >= cooldownMs) { + last = now; + return true; + } + return false; + }; +}; +exports.createCooldown = createCooldown; +//# sourceMappingURL=createCooldown.js.map \ No newline at end of file diff --git a/third-party/utils/createDeferred.d.ts b/third-party/utils/createDeferred.d.ts new file mode 100644 index 0000000..ac32847 --- /dev/null +++ b/third-party/utils/createDeferred.d.ts @@ -0,0 +1,14 @@ +export interface Deferred { + id: Arg; + promise: Promise; + resolve: (t: Resolve) => void; + reject: (e: Error) => void; +} +export type DeferredResponse = D extends Deferred ? R : never; +interface CreateDeferred { + (id?: Arg): Deferred; + (id: Arg): Deferred; +} +export declare const createDeferred: CreateDeferred; +export {}; +//# sourceMappingURL=createDeferred.d.ts.map \ No newline at end of file diff --git a/third-party/utils/createDeferred.js b/third-party/utils/createDeferred.js new file mode 100644 index 0000000..22f2157 --- /dev/null +++ b/third-party/utils/createDeferred.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createDeferred = void 0; +const createDeferred = (id) => { + let localResolve = () => { }; + let localReject = () => { }; + const promise = new Promise((resolve, reject) => { + localResolve = resolve; + localReject = reject; + }); + return { + id, + resolve: localResolve, + reject: localReject, + promise, + }; +}; +exports.createDeferred = createDeferred; +//# sourceMappingURL=createDeferred.js.map \ No newline at end of file diff --git a/third-party/utils/createDeferredManager.d.ts b/third-party/utils/createDeferredManager.d.ts new file mode 100644 index 0000000..c29e938 --- /dev/null +++ b/third-party/utils/createDeferredManager.d.ts @@ -0,0 +1,19 @@ +type DeferredManagerOptions = { + timeout?: number; + onTimeout?: (promiseId: number) => void; + initialId?: number; +}; +export type DeferredManager = { + length: () => number; + nextId: () => number; + create: (timeout?: number) => { + promiseId: number; + promise: Promise; + }; + resolve: (promiseId: number, value: T) => boolean; + reject: (promiseId: number, error: Error) => boolean; + rejectAll: (error: Error) => void; +}; +export declare const createDeferredManager: (options?: DeferredManagerOptions) => DeferredManager; +export {}; +//# sourceMappingURL=createDeferredManager.d.ts.map \ No newline at end of file diff --git a/third-party/utils/createDeferredManager.js b/third-party/utils/createDeferredManager.js new file mode 100644 index 0000000..fb50a37 --- /dev/null +++ b/third-party/utils/createDeferredManager.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createDeferredManager = void 0; +const createDeferred_1 = require("./createDeferred"); +const createDeferredManager = (options) => { + const { initialId = 0, timeout: defaultTimeout = 0, onTimeout } = options !== null && options !== void 0 ? options : {}; + const promises = []; + let ID = initialId; + let timeoutHandle; + const length = () => promises.length; + const nextId = () => ID; + const replanTimeout = () => { + const now = Date.now(); + const nearestDeadline = promises.reduce((prev, { deadline }) => (prev && deadline ? Math.min : Math.max)(prev, deadline), 0); + if (timeoutHandle) + clearTimeout(timeoutHandle); + timeoutHandle = nearestDeadline + ? + setTimeout(timeoutCallback, Math.max(nearestDeadline - now, 0)) + : undefined; + }; + const timeoutCallback = () => { + const now = Date.now(); + promises + .filter(promise => promise.deadline && promise.deadline <= now) + .forEach(promise => { + onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout(promise.id); + promise.deadline = 0; + }); + replanTimeout(); + }; + const create = (timeout = defaultTimeout) => { + const promiseId = ID++; + const deferred = (0, createDeferred_1.createDeferred)(promiseId); + const deadline = timeout && Date.now() + timeout; + promises.push(Object.assign(Object.assign({}, deferred), { deadline })); + if (timeout) + replanTimeout(); + return { promiseId, promise: deferred.promise }; + }; + const extract = (promiseId) => { + const index = promises.findIndex(({ id }) => id === promiseId); + const [promise] = index >= 0 ? promises.splice(index, 1) : [undefined]; + if (promise === null || promise === void 0 ? void 0 : promise.deadline) + replanTimeout(); + return promise; + }; + const resolve = (promiseId, value) => { + const promise = extract(promiseId); + promise === null || promise === void 0 ? void 0 : promise.resolve(value); + return !!promise; + }; + const reject = (promiseId, error) => { + const promise = extract(promiseId); + promise === null || promise === void 0 ? void 0 : promise.reject(error); + return !!promise; + }; + const rejectAll = (error) => { + promises.forEach(promise => promise.reject(error)); + const deleted = promises.splice(0, promises.length); + if (deleted.length) + replanTimeout(); + }; + return { length, nextId, create, resolve, reject, rejectAll }; +}; +exports.createDeferredManager = createDeferredManager; +//# sourceMappingURL=createDeferredManager.js.map \ No newline at end of file diff --git a/third-party/utils/createLazy.d.ts b/third-party/utils/createLazy.d.ts new file mode 100644 index 0000000..f7c446f --- /dev/null +++ b/third-party/utils/createLazy.d.ts @@ -0,0 +1,7 @@ +export declare const createLazy: >(initLazy: (...args: TArgs) => Promise, disposeLazy?: (t: T) => void) => { + get: () => T | undefined; + getPending: () => Promise | undefined; + getOrInit: (...args: TArgs) => Promise; + dispose: () => void; +}; +//# sourceMappingURL=createLazy.d.ts.map \ No newline at end of file diff --git a/third-party/utils/createLazy.js b/third-party/utils/createLazy.js new file mode 100644 index 0000000..18fb34a --- /dev/null +++ b/third-party/utils/createLazy.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createLazy = void 0; +const createDeferred_1 = require("./createDeferred"); +const createLazy = (initLazy, disposeLazy) => { + let value; + let valuePromise; + const get = () => value; + const getPending = () => valuePromise === null || valuePromise === void 0 ? void 0 : valuePromise.promise; + const dispose = () => { + if (valuePromise) { + valuePromise.reject(new Error('Disposed during initialization')); + valuePromise = undefined; + } + if (value !== undefined) { + disposeLazy === null || disposeLazy === void 0 ? void 0 : disposeLazy(value); + value = undefined; + } + }; + const getOrInit = (...args) => { + if (value !== undefined) + return Promise.resolve(value); + if (!valuePromise) { + const deferred = (0, createDeferred_1.createDeferred)(); + valuePromise = deferred; + initLazy(...args) + .then(val => { + value = val; + valuePromise = undefined; + deferred.resolve(val); + }) + .catch(err => { + valuePromise = undefined; + deferred.reject(err); + }); + } + return valuePromise.promise; + }; + return { get, getPending, getOrInit, dispose }; +}; +exports.createLazy = createLazy; +//# sourceMappingURL=createLazy.js.map \ No newline at end of file diff --git a/third-party/utils/createTimeoutPromise.d.ts b/third-party/utils/createTimeoutPromise.d.ts new file mode 100644 index 0000000..c56ce87 --- /dev/null +++ b/third-party/utils/createTimeoutPromise.d.ts @@ -0,0 +1,2 @@ +export declare const createTimeoutPromise: (timeout: number) => Promise; +//# sourceMappingURL=createTimeoutPromise.d.ts.map \ No newline at end of file diff --git a/third-party/utils/createTimeoutPromise.js b/third-party/utils/createTimeoutPromise.js new file mode 100644 index 0000000..9a35605 --- /dev/null +++ b/third-party/utils/createTimeoutPromise.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createTimeoutPromise = void 0; +const createTimeoutPromise = (timeout) => new Promise(resolve => setTimeout(resolve, timeout)); +exports.createTimeoutPromise = createTimeoutPromise; +//# sourceMappingURL=createTimeoutPromise.js.map \ No newline at end of file diff --git a/third-party/utils/enumUtils.d.ts b/third-party/utils/enumUtils.d.ts new file mode 100644 index 0000000..7b24828 --- /dev/null +++ b/third-party/utils/enumUtils.d.ts @@ -0,0 +1,6 @@ +type EnumValue = string | number; +type EnumObject = Record; +export declare function getKeyByValue(obj: E, value: E[keyof E]): keyof E | undefined; +export declare function getValueByKey(obj: E, enumKey: keyof E): E[keyof E] | undefined; +export {}; +//# sourceMappingURL=enumUtils.d.ts.map \ No newline at end of file diff --git a/third-party/utils/enumUtils.js b/third-party/utils/enumUtils.js new file mode 100644 index 0000000..7b47cb8 --- /dev/null +++ b/third-party/utils/enumUtils.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getKeyByValue = getKeyByValue; +exports.getValueByKey = getValueByKey; +function getKeyByValue(obj, value) { + return obj && Object.keys(obj).find(x => obj[x] === value); +} +function getValueByKey(obj, enumKey) { + const key = obj && Object.keys(obj).find(x => x === enumKey); + return key && obj[key]; +} +//# sourceMappingURL=enumUtils.js.map \ No newline at end of file diff --git a/third-party/utils/extractUrlsFromText.d.ts b/third-party/utils/extractUrlsFromText.d.ts new file mode 100644 index 0000000..a25a366 --- /dev/null +++ b/third-party/utils/extractUrlsFromText.d.ts @@ -0,0 +1,5 @@ +export declare const extractUrlsFromText: (text: string) => { + textParts: string[]; + urls: string[]; +}; +//# sourceMappingURL=extractUrlsFromText.d.ts.map \ No newline at end of file diff --git a/third-party/utils/extractUrlsFromText.js b/third-party/utils/extractUrlsFromText.js new file mode 100644 index 0000000..a176042 --- /dev/null +++ b/third-party/utils/extractUrlsFromText.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extractUrlsFromText = void 0; +const URL_REGEX = /\b(?:https?:\/\/|www\.)[a-zA-Z0-9-._~:/?#[\]@!$&'()*+,;=%]+\b|(?:[a-zA-Z0-9-]+\.)+[a-zA-Z]{2,}(?=\b|\s|$|\])/gi; +const extractUrlsFromText = (text) => { + const urls = []; + const textParts = []; + let lastIndex = 0; + const matches = [...text.matchAll(URL_REGEX)]; + matches.forEach(match => { + const url = match[0]; + const index = match.index !== undefined ? match.index : -1; + if (lastIndex < index) { + textParts.push(text.slice(lastIndex, index)); + } + urls.push(url); + lastIndex = index + url.length; + }); + if (lastIndex < text.length) { + textParts.push(text.slice(lastIndex)); + } + if (textParts.length === 0 && urls.length > 0) { + textParts.push(''); + } + return { textParts, urls }; +}; +exports.extractUrlsFromText = extractUrlsFromText; +//# sourceMappingURL=extractUrlsFromText.js.map \ No newline at end of file diff --git a/third-party/utils/getLocaleSeparators.d.ts b/third-party/utils/getLocaleSeparators.d.ts new file mode 100644 index 0000000..6c6ba56 --- /dev/null +++ b/third-party/utils/getLocaleSeparators.d.ts @@ -0,0 +1,5 @@ +export declare const getLocaleSeparators: (locale: string) => { + decimalSeparator: string; + thousandsSeparator: string; +}; +//# sourceMappingURL=getLocaleSeparators.d.ts.map \ No newline at end of file diff --git a/third-party/utils/getLocaleSeparators.js b/third-party/utils/getLocaleSeparators.js new file mode 100644 index 0000000..ab9b886 --- /dev/null +++ b/third-party/utils/getLocaleSeparators.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getLocaleSeparators = void 0; +const getLocaleSeparators = (locale) => { + var _a, _b; + const numberFormat = new Intl.NumberFormat(locale); + const parts = numberFormat.formatToParts(10000.1); + const decimalSeparator = (_a = parts.find(({ type }) => type === 'decimal')) === null || _a === void 0 ? void 0 : _a.value; + const thousandsSeparator = (_b = parts.find(({ type }) => type === 'group')) === null || _b === void 0 ? void 0 : _b.value; + return { decimalSeparator, thousandsSeparator }; +}; +exports.getLocaleSeparators = getLocaleSeparators; +//# sourceMappingURL=getLocaleSeparators.js.map \ No newline at end of file diff --git a/third-party/utils/getLocaleSeparators.native.d.ts b/third-party/utils/getLocaleSeparators.native.d.ts new file mode 100644 index 0000000..89262db --- /dev/null +++ b/third-party/utils/getLocaleSeparators.native.d.ts @@ -0,0 +1,5 @@ +export declare function getLocaleSeparators(locale: string): { + decimalSeparator: string; + thousandsSeparator: string; +}; +//# sourceMappingURL=getLocaleSeparators.native.d.ts.map \ No newline at end of file diff --git a/third-party/utils/getLocaleSeparators.native.js b/third-party/utils/getLocaleSeparators.native.js new file mode 100644 index 0000000..161c459 --- /dev/null +++ b/third-party/utils/getLocaleSeparators.native.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getLocaleSeparators = getLocaleSeparators; +function getLocaleSeparators(locale) { + const formattedNumber = new Intl.NumberFormat(locale).format(1234567.89); + let thousandsSeparator = ' '; + let decimalSeparator = '.'; + for (let i = 0; i < formattedNumber.length; i++) { + if (!/\d/.test(formattedNumber[i])) { + thousandsSeparator = formattedNumber[i]; + break; + } + } + decimalSeparator = formattedNumber[formattedNumber.length - 3]; + return { decimalSeparator, thousandsSeparator }; +} +//# sourceMappingURL=getLocaleSeparators.native.js.map \ No newline at end of file diff --git a/third-party/utils/getMutex.d.ts b/third-party/utils/getMutex.d.ts new file mode 100644 index 0000000..3c7a753 --- /dev/null +++ b/third-party/utils/getMutex.d.ts @@ -0,0 +1,2 @@ +export declare const getMutex: () => (lockId?: keyof any) => Promise<() => void>; +//# sourceMappingURL=getMutex.d.ts.map \ No newline at end of file diff --git a/third-party/utils/getMutex.js b/third-party/utils/getMutex.js new file mode 100644 index 0000000..88c5da3 --- /dev/null +++ b/third-party/utils/getMutex.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getMutex = void 0; +const tslib_1 = require("tslib"); +const getMutex = () => { + const DEFAULT_ID = Symbol(); + const locks = {}; + return (...args_1) => tslib_1.__awaiter(void 0, [...args_1], void 0, function* (lockId = DEFAULT_ID) { + while (locks[lockId]) { + yield locks[lockId]; + } + let resolve = () => { }; + locks[lockId] = new Promise(res => { + resolve = res; + }).finally(() => { + delete locks[lockId]; + }); + return resolve; + }); +}; +exports.getMutex = getMutex; +//# sourceMappingURL=getMutex.js.map \ No newline at end of file diff --git a/third-party/utils/getNumberFromPixelString.d.ts b/third-party/utils/getNumberFromPixelString.d.ts new file mode 100644 index 0000000..b80105b --- /dev/null +++ b/third-party/utils/getNumberFromPixelString.d.ts @@ -0,0 +1,2 @@ +export declare const getNumberFromPixelString: (size: string) => number; +//# sourceMappingURL=getNumberFromPixelString.d.ts.map \ No newline at end of file diff --git a/third-party/utils/getNumberFromPixelString.js b/third-party/utils/getNumberFromPixelString.js new file mode 100644 index 0000000..fd190b3 --- /dev/null +++ b/third-party/utils/getNumberFromPixelString.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getNumberFromPixelString = void 0; +const getNumberFromPixelString = (size) => parseInt(size.replace('px', ''), 10); +exports.getNumberFromPixelString = getNumberFromPixelString; +//# sourceMappingURL=getNumberFromPixelString.js.map \ No newline at end of file diff --git a/third-party/utils/getRandomInt.d.ts b/third-party/utils/getRandomInt.d.ts new file mode 100644 index 0000000..9959703 --- /dev/null +++ b/third-party/utils/getRandomInt.d.ts @@ -0,0 +1,2 @@ +export declare const getRandomInt: (min: number, max: number) => number; +//# sourceMappingURL=getRandomInt.d.ts.map \ No newline at end of file diff --git a/third-party/utils/getRandomInt.js b/third-party/utils/getRandomInt.js new file mode 100644 index 0000000..4e4c226 --- /dev/null +++ b/third-party/utils/getRandomInt.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getRandomInt = void 0; +const crypto_1 = require("crypto"); +const getRandomInt = (min, max) => { + if (!Number.isSafeInteger(min)) { + throw new RangeError(`The "min" argument must be a safe integer. Received type ${typeof min} (${min})`); + } + if (!Number.isSafeInteger(max)) { + throw new RangeError(`The "max" argument must be a safe integer. Received type ${typeof max} (${max})`); + } + if (min >= max) { + throw new RangeError(`The value of "max" is out of range. It must be greater than the value of "min" (${min}). Received ${max}`); + } + const MAX_RANGE_32_BITS = 0xffffffff + 1; + const range = max - min; + if (range > MAX_RANGE_32_BITS) { + throw new RangeError(`This function only provide 32 bits of entropy, therefore range cannot be more then 2^32.`); + } + const getRandomValues = typeof window !== 'undefined' + ? (array) => window.crypto.getRandomValues(array) + : (array) => (0, crypto_1.getRandomValues)(array); + const array = new Uint32Array(1); + const maxRange = MAX_RANGE_32_BITS - (MAX_RANGE_32_BITS % range); + let randomValue; + do { + getRandomValues(array); + randomValue = array[0]; + } while (randomValue >= maxRange); + return min + (randomValue % range); +}; +exports.getRandomInt = getRandomInt; +//# sourceMappingURL=getRandomInt.js.map \ No newline at end of file diff --git a/third-party/utils/getSynchronize.d.ts b/third-party/utils/getSynchronize.d.ts new file mode 100644 index 0000000..44a4f9f --- /dev/null +++ b/third-party/utils/getSynchronize.d.ts @@ -0,0 +1,4 @@ +import { getMutex } from './getMutex'; +export declare const getSynchronize: (mutex?: ReturnType) => (action: () => T, lockId?: keyof any) => T extends Promise ? T : Promise; +export type Synchronize = ReturnType; +//# sourceMappingURL=getSynchronize.d.ts.map \ No newline at end of file diff --git a/third-party/utils/getSynchronize.js b/third-party/utils/getSynchronize.js new file mode 100644 index 0000000..bee2e8e --- /dev/null +++ b/third-party/utils/getSynchronize.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getSynchronize = void 0; +const getMutex_1 = require("./getMutex"); +const getSynchronize = (mutex) => { + const lock = mutex !== null && mutex !== void 0 ? mutex : (0, getMutex_1.getMutex)(); + return (action, lockId) => lock(lockId).then(unlock => Promise.resolve().then(action).finally(unlock)); +}; +exports.getSynchronize = getSynchronize; +//# sourceMappingURL=getSynchronize.js.map \ No newline at end of file diff --git a/third-party/utils/getWeakRandomId.d.ts b/third-party/utils/getWeakRandomId.d.ts new file mode 100644 index 0000000..34b6cf5 --- /dev/null +++ b/third-party/utils/getWeakRandomId.d.ts @@ -0,0 +1,2 @@ +export declare const getWeakRandomId: (length: number) => string; +//# sourceMappingURL=getWeakRandomId.d.ts.map \ No newline at end of file diff --git a/third-party/utils/getWeakRandomId.js b/third-party/utils/getWeakRandomId.js new file mode 100644 index 0000000..1272065 --- /dev/null +++ b/third-party/utils/getWeakRandomId.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getWeakRandomId = void 0; +const getWeakRandomId = (length) => { + let id = ''; + const list = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + for (let i = 0; i < length; i++) { + id += list.charAt(Math.floor(Math.random() * list.length)); + } + return id; +}; +exports.getWeakRandomId = getWeakRandomId; +//# sourceMappingURL=getWeakRandomId.js.map \ No newline at end of file diff --git a/third-party/utils/getWeakRandomInt.d.ts b/third-party/utils/getWeakRandomInt.d.ts new file mode 100644 index 0000000..1da58ef --- /dev/null +++ b/third-party/utils/getWeakRandomInt.d.ts @@ -0,0 +1,2 @@ +export declare const getWeakRandomInt: (min: number, max: number) => number; +//# sourceMappingURL=getWeakRandomInt.d.ts.map \ No newline at end of file diff --git a/third-party/utils/getWeakRandomInt.js b/third-party/utils/getWeakRandomInt.js new file mode 100644 index 0000000..d0c911e --- /dev/null +++ b/third-party/utils/getWeakRandomInt.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getWeakRandomInt = void 0; +const getWeakRandomInt = (min, max) => { + if (min >= max) { + throw new RangeError(`The value of "max" is out of range. It must be greater than the value of "min" (${min}). Received ${max}`); + } + return Math.floor(Math.random() * (max - min) + min); +}; +exports.getWeakRandomInt = getWeakRandomInt; +//# sourceMappingURL=getWeakRandomInt.js.map \ No newline at end of file diff --git a/third-party/utils/getWeakRandomNumberInRange.d.ts b/third-party/utils/getWeakRandomNumberInRange.d.ts new file mode 100644 index 0000000..804e774 --- /dev/null +++ b/third-party/utils/getWeakRandomNumberInRange.d.ts @@ -0,0 +1,2 @@ +export declare const getWeakRandomNumberInRange: (min: number, max: number) => number; +//# sourceMappingURL=getWeakRandomNumberInRange.d.ts.map \ No newline at end of file diff --git a/third-party/utils/getWeakRandomNumberInRange.js b/third-party/utils/getWeakRandomNumberInRange.js new file mode 100644 index 0000000..5286237 --- /dev/null +++ b/third-party/utils/getWeakRandomNumberInRange.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getWeakRandomNumberInRange = void 0; +const getWeakRandomNumberInRange = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min; +exports.getWeakRandomNumberInRange = getWeakRandomNumberInRange; +//# sourceMappingURL=getWeakRandomNumberInRange.js.map \ No newline at end of file diff --git a/third-party/utils/hasUppercaseLetter.d.ts b/third-party/utils/hasUppercaseLetter.d.ts new file mode 100644 index 0000000..09541dd --- /dev/null +++ b/third-party/utils/hasUppercaseLetter.d.ts @@ -0,0 +1,2 @@ +export declare const hasUppercaseLetter: (value: string) => boolean; +//# sourceMappingURL=hasUppercaseLetter.d.ts.map \ No newline at end of file diff --git a/third-party/utils/hasUppercaseLetter.js b/third-party/utils/hasUppercaseLetter.js new file mode 100644 index 0000000..965d88f --- /dev/null +++ b/third-party/utils/hasUppercaseLetter.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.hasUppercaseLetter = void 0; +const HAS_UPPERCASE_LATER_REGEXP = new RegExp('^(.*[A-Z].*)$'); +const hasUppercaseLetter = (value) => HAS_UPPERCASE_LATER_REGEXP.test(value); +exports.hasUppercaseLetter = hasUppercaseLetter; +//# sourceMappingURL=hasUppercaseLetter.js.map \ No newline at end of file diff --git a/third-party/utils/index.d.ts b/third-party/utils/index.d.ts new file mode 100644 index 0000000..55489c1 --- /dev/null +++ b/third-party/utils/index.d.ts @@ -0,0 +1,52 @@ +export * as bufferUtils from './bufferUtils'; +export * as enumUtils from './enumUtils'; +export * as versionUtils from './versionUtils'; +export * as xssFilters from './xssFilters'; +export * from './addDashesToSpaces'; +export * from './arrayDistinct'; +export * from './arrayPartition'; +export * from './arrayShuffle'; +export * from './arrayToDictionary'; +export * from './bytesToHumanReadable'; +export * from './capitalizeFirstLetter'; +export * from './cloneObject'; +export * from './countBytesInString'; +export * from './createCooldown'; +export * from './createDeferred'; +export * from './createDeferredManager'; +export * from './createLazy'; +export * from './createTimeoutPromise'; +export * from './getLocaleSeparators'; +export * from './getMutex'; +export * from './getNumberFromPixelString'; +export * from './getWeakRandomNumberInRange'; +export * from './getSynchronize'; +export * from './getRandomInt'; +export * from './getWeakRandomId'; +export * from './getWeakRandomInt'; +export * from './hasUppercaseLetter'; +export * from './isArrayMember'; +export * from './isHex'; +export * from './isNotUndefined'; +export * from './isUrl'; +export * from './mergeDeepObject'; +export * from './objectPartition'; +export * from './parseElectrumUrl'; +export * from './parseHostname'; +export * from './promiseAllSequence'; +export * from './redactUserPath'; +export * from './scheduleAction'; +export * from './splitStringEveryNCharacters'; +export * from './throwError'; +export * from './topologicalSort'; +export * from './truncateMiddle'; +export * from './typedEventEmitter'; +export * from './urlToOnion'; +export * from './logs'; +export * from './logsManager'; +export * from './bigNumber'; +export * from './throttler'; +export * from './extractUrlsFromText'; +export * from './isFullPath'; +export * from './asciiUtils'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/third-party/utils/index.js b/third-party/utils/index.js new file mode 100644 index 0000000..70a3a62 --- /dev/null +++ b/third-party/utils/index.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.xssFilters = exports.versionUtils = exports.enumUtils = exports.bufferUtils = void 0; +const tslib_1 = require("tslib"); +exports.bufferUtils = tslib_1.__importStar(require("./bufferUtils")); +exports.enumUtils = tslib_1.__importStar(require("./enumUtils")); +exports.versionUtils = tslib_1.__importStar(require("./versionUtils")); +exports.xssFilters = tslib_1.__importStar(require("./xssFilters")); +tslib_1.__exportStar(require("./addDashesToSpaces"), exports); +tslib_1.__exportStar(require("./arrayDistinct"), exports); +tslib_1.__exportStar(require("./arrayPartition"), exports); +tslib_1.__exportStar(require("./arrayShuffle"), exports); +tslib_1.__exportStar(require("./arrayToDictionary"), exports); +tslib_1.__exportStar(require("./bytesToHumanReadable"), exports); +tslib_1.__exportStar(require("./capitalizeFirstLetter"), exports); +tslib_1.__exportStar(require("./cloneObject"), exports); +tslib_1.__exportStar(require("./countBytesInString"), exports); +tslib_1.__exportStar(require("./createCooldown"), exports); +tslib_1.__exportStar(require("./createDeferred"), exports); +tslib_1.__exportStar(require("./createDeferredManager"), exports); +tslib_1.__exportStar(require("./createLazy"), exports); +tslib_1.__exportStar(require("./createTimeoutPromise"), exports); +tslib_1.__exportStar(require("./getLocaleSeparators"), exports); +tslib_1.__exportStar(require("./getMutex"), exports); +tslib_1.__exportStar(require("./getNumberFromPixelString"), exports); +tslib_1.__exportStar(require("./getWeakRandomNumberInRange"), exports); +tslib_1.__exportStar(require("./getSynchronize"), exports); +tslib_1.__exportStar(require("./getRandomInt"), exports); +tslib_1.__exportStar(require("./getWeakRandomId"), exports); +tslib_1.__exportStar(require("./getWeakRandomInt"), exports); +tslib_1.__exportStar(require("./hasUppercaseLetter"), exports); +tslib_1.__exportStar(require("./isArrayMember"), exports); +tslib_1.__exportStar(require("./isHex"), exports); +tslib_1.__exportStar(require("./isNotUndefined"), exports); +tslib_1.__exportStar(require("./isUrl"), exports); +tslib_1.__exportStar(require("./mergeDeepObject"), exports); +tslib_1.__exportStar(require("./objectPartition"), exports); +tslib_1.__exportStar(require("./parseElectrumUrl"), exports); +tslib_1.__exportStar(require("./parseHostname"), exports); +tslib_1.__exportStar(require("./promiseAllSequence"), exports); +tslib_1.__exportStar(require("./redactUserPath"), exports); +tslib_1.__exportStar(require("./scheduleAction"), exports); +tslib_1.__exportStar(require("./splitStringEveryNCharacters"), exports); +tslib_1.__exportStar(require("./throwError"), exports); +tslib_1.__exportStar(require("./topologicalSort"), exports); +tslib_1.__exportStar(require("./truncateMiddle"), exports); +tslib_1.__exportStar(require("./typedEventEmitter"), exports); +tslib_1.__exportStar(require("./urlToOnion"), exports); +tslib_1.__exportStar(require("./logs"), exports); +tslib_1.__exportStar(require("./logsManager"), exports); +tslib_1.__exportStar(require("./bigNumber"), exports); +tslib_1.__exportStar(require("./throttler"), exports); +tslib_1.__exportStar(require("./extractUrlsFromText"), exports); +tslib_1.__exportStar(require("./isFullPath"), exports); +tslib_1.__exportStar(require("./asciiUtils"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/third-party/utils/isArrayMember.d.ts b/third-party/utils/isArrayMember.d.ts new file mode 100644 index 0000000..4c4731c --- /dev/null +++ b/third-party/utils/isArrayMember.d.ts @@ -0,0 +1,2 @@ +export declare const isArrayMember: (value: Value, arr: readonly Subset[]) => value is Subset; +//# sourceMappingURL=isArrayMember.d.ts.map \ No newline at end of file diff --git a/third-party/utils/isArrayMember.js b/third-party/utils/isArrayMember.js new file mode 100644 index 0000000..916955a --- /dev/null +++ b/third-party/utils/isArrayMember.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isArrayMember = void 0; +const isArrayMember = (value, arr) => arr.some(v => v === value); +exports.isArrayMember = isArrayMember; +//# sourceMappingURL=isArrayMember.js.map \ No newline at end of file diff --git a/third-party/utils/isFullPath.d.ts b/third-party/utils/isFullPath.d.ts new file mode 100644 index 0000000..3a73a0d --- /dev/null +++ b/third-party/utils/isFullPath.d.ts @@ -0,0 +1,2 @@ +export declare const isFullPath: (path: string) => boolean; +//# sourceMappingURL=isFullPath.d.ts.map \ No newline at end of file diff --git a/third-party/utils/isFullPath.js b/third-party/utils/isFullPath.js new file mode 100644 index 0000000..2ee9057 --- /dev/null +++ b/third-party/utils/isFullPath.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isFullPath = void 0; +const isFullPath = (path) => { + const fullPathPattern = /^(\/|([a-zA-Z]:\\))/; + return fullPathPattern.test(path); +}; +exports.isFullPath = isFullPath; +//# sourceMappingURL=isFullPath.js.map \ No newline at end of file diff --git a/third-party/utils/isHex.d.ts b/third-party/utils/isHex.d.ts new file mode 100644 index 0000000..99d3aec --- /dev/null +++ b/third-party/utils/isHex.d.ts @@ -0,0 +1,2 @@ +export declare const isHex: (str: string) => boolean; +//# sourceMappingURL=isHex.d.ts.map \ No newline at end of file diff --git a/third-party/utils/isHex.js b/third-party/utils/isHex.js new file mode 100644 index 0000000..6a286c8 --- /dev/null +++ b/third-party/utils/isHex.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isHex = void 0; +const isHex = (str) => { + const regExp = /^(0x|0X)?[0-9A-Fa-f]+$/g; + return regExp.test(str); +}; +exports.isHex = isHex; +//# sourceMappingURL=isHex.js.map \ No newline at end of file diff --git a/third-party/utils/isNotUndefined.d.ts b/third-party/utils/isNotUndefined.d.ts new file mode 100644 index 0000000..61826af --- /dev/null +++ b/third-party/utils/isNotUndefined.d.ts @@ -0,0 +1,2 @@ +export declare const isNotUndefined: (item?: T) => item is T; +//# sourceMappingURL=isNotUndefined.d.ts.map \ No newline at end of file diff --git a/third-party/utils/isNotUndefined.js b/third-party/utils/isNotUndefined.js new file mode 100644 index 0000000..c083b6c --- /dev/null +++ b/third-party/utils/isNotUndefined.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isNotUndefined = void 0; +const isNotUndefined = (item) => typeof item !== 'undefined'; +exports.isNotUndefined = isNotUndefined; +//# sourceMappingURL=isNotUndefined.js.map \ No newline at end of file diff --git a/third-party/utils/isUrl.d.ts b/third-party/utils/isUrl.d.ts new file mode 100644 index 0000000..17b77d1 --- /dev/null +++ b/third-party/utils/isUrl.d.ts @@ -0,0 +1,2 @@ +export declare const isUrl: (value: string) => boolean; +//# sourceMappingURL=isUrl.d.ts.map \ No newline at end of file diff --git a/third-party/utils/isUrl.js b/third-party/utils/isUrl.js new file mode 100644 index 0000000..bde7404 --- /dev/null +++ b/third-party/utils/isUrl.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isUrl = void 0; +const URL_REGEXP = /^(http|ws)s?:\/\/[a-z0-9]([a-z0-9.-]+)?(:[0-9]{1,5})?((\/)?(([a-z0-9-_])+(\/)?)+)$/i; +const isUrl = (value) => URL_REGEXP.test(value); +exports.isUrl = isUrl; +//# sourceMappingURL=isUrl.js.map \ No newline at end of file diff --git a/third-party/utils/logs.d.ts b/third-party/utils/logs.d.ts new file mode 100644 index 0000000..3ffcdbc --- /dev/null +++ b/third-party/utils/logs.d.ts @@ -0,0 +1,32 @@ +export type LogMessage = { + level: string; + prefix: string; + message: any[]; + timestamp: number; +}; +export type LogWriter = { + add: (message: LogMessage) => void; +}; +export declare class Log { + prefix: string; + enabled: boolean; + css: string; + messages: LogMessage[]; + logWriter: LogWriter | undefined; + MAX_ENTRIES: number; + constructor(prefix: string, enabled: boolean, logWriter?: LogWriter); + setColors(colors: Record): void; + addMessage({ level, prefix, timestamp }: { + level: string; + prefix: string; + timestamp?: number; + }, ...args: any[]): void; + setWriter(logWriter: any): void; + log(...args: any[]): void; + error(...args: any[]): void; + info(...args: any[]): void; + warn(...args: any[]): void; + debug(...args: any[]): void; + getLog(): LogMessage[]; +} +//# sourceMappingURL=logs.d.ts.map \ No newline at end of file diff --git a/third-party/utils/logs.js b/third-party/utils/logs.js new file mode 100644 index 0000000..30f0935 --- /dev/null +++ b/third-party/utils/logs.js @@ -0,0 +1,82 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Log = void 0; +class Log { + constructor(prefix, enabled, logWriter) { + this.css = ''; + this.MAX_ENTRIES = 100; + this.prefix = prefix; + this.enabled = enabled; + this.messages = []; + if (logWriter) { + this.logWriter = logWriter; + } + } + setColors(colors) { + this.css = typeof window !== 'undefined' && colors[this.prefix] ? colors[this.prefix] : ''; + } + addMessage({ level, prefix, timestamp }, ...args) { + const message = { + level, + prefix, + css: this.css, + message: args, + timestamp: timestamp || Date.now(), + }; + this.messages.push(message); + if (this.logWriter) { + try { + this.logWriter.add(message); + } + catch (err) { + console.error('There was an error adding log message', err, message); + } + } + if (this.messages.length > this.MAX_ENTRIES) { + this.messages.shift(); + } + } + setWriter(logWriter) { + this.logWriter = logWriter; + } + log(...args) { + this.addMessage({ level: 'log', prefix: this.prefix }, ...args); + if (this.enabled) { + console.log(`%c${this.prefix}`, this.css, ...args); + } + } + error(...args) { + this.addMessage({ level: 'error', prefix: this.prefix }, ...args); + if (this.enabled) { + console.error(`%c${this.prefix}`, this.css, ...args); + } + } + info(...args) { + this.addMessage({ level: 'info', prefix: this.prefix }, ...args); + if (this.enabled) { + console.info(`%c${this.prefix}`, this.css, ...args); + } + } + warn(...args) { + this.addMessage({ level: 'warn', prefix: this.prefix }, ...args); + if (this.enabled) { + console.warn(`%c${this.prefix}`, this.css, ...args); + } + } + debug(...args) { + this.addMessage({ level: 'debug', prefix: this.prefix }, ...args); + if (this.enabled) { + if (this.css) { + console.log(`%c${this.prefix}`, this.css, ...args); + } + else { + console.log(this.prefix, ...args); + } + } + } + getLog() { + return this.messages; + } +} +exports.Log = Log; +//# sourceMappingURL=logs.js.map \ No newline at end of file diff --git a/third-party/utils/logsManager.d.ts b/third-party/utils/logsManager.d.ts new file mode 100644 index 0000000..a0b05fa --- /dev/null +++ b/third-party/utils/logsManager.d.ts @@ -0,0 +1,17 @@ +import { LogWriter, Log, LogMessage } from './logs'; +export declare class LogsManager { + logs: { + [k: string]: Log; + }; + writer: LogWriter | undefined; + colors?: Record; + constructor({ colors }: { + colors?: Record; + }); + initLog(prefix: string, enabled?: boolean, logWriter?: LogWriter): Log; + setLogWriter(logWriterFactory: () => LogWriter | undefined): void; + enableLog(enabled?: boolean): void; + enableLogByPrefix(prefix: string, enabled: boolean): void; + getLog(): LogMessage[]; +} +//# sourceMappingURL=logsManager.d.ts.map \ No newline at end of file diff --git a/third-party/utils/logsManager.js b/third-party/utils/logsManager.js new file mode 100644 index 0000000..2a54dfb --- /dev/null +++ b/third-party/utils/logsManager.js @@ -0,0 +1,53 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LogsManager = void 0; +const logs_1 = require("./logs"); +class LogsManager { + constructor({ colors }) { + this.logs = {}; + this.colors = {}; + this.colors = colors; + } + initLog(prefix, enabled, logWriter) { + const instanceWriter = logWriter || this.writer; + const instance = new logs_1.Log(prefix, !!enabled, instanceWriter); + if (this.colors) { + instance.setColors(this.colors); + } + this.logs[prefix] = instance; + return instance; + } + setLogWriter(logWriterFactory) { + Object.keys(this.logs).forEach(key => { + this.writer = logWriterFactory(); + if (this.writer) { + this.logs[key].setWriter(this.writer); + const { messages } = this.logs[key]; + messages.forEach(message => { + var _a; + (_a = this.writer) === null || _a === void 0 ? void 0 : _a.add(message); + }); + } + }); + } + enableLog(enabled) { + Object.keys(this.logs).forEach(key => { + this.logs[key].enabled = !!enabled; + }); + } + enableLogByPrefix(prefix, enabled) { + if (this.logs[prefix]) { + this.logs[prefix].enabled = enabled; + } + } + getLog() { + let logs = []; + Object.keys(this.logs).forEach(key => { + logs = logs.concat(this.logs[key].messages); + }); + logs.sort((a, b) => a.timestamp - b.timestamp); + return logs; + } +} +exports.LogsManager = LogsManager; +//# sourceMappingURL=logsManager.js.map \ No newline at end of file diff --git a/third-party/utils/mergeDeepObject.d.ts b/third-party/utils/mergeDeepObject.d.ts new file mode 100644 index 0000000..dedf087 --- /dev/null +++ b/third-party/utils/mergeDeepObject.d.ts @@ -0,0 +1,26 @@ +type TAllKeys = T extends any ? keyof T : never; +type TIndexValue = T extends any ? K extends keyof T ? T[K] : D : never; +type TPartialKeys = Omit & Partial> extends infer O ? { + [P in keyof O]: O[P]; +} : never; +type TFunction = (...a: any[]) => any; +type TPrimitives = string | number | boolean | bigint | symbol | Date | TFunction; +type TMerged = [T] extends [Array] ? { + [K in keyof T]: TMerged; +} : [T] extends [TPrimitives] ? T : [T] extends [object] ? TPartialKeys<{ + [K in TAllKeys]: TMerged>; +}, never> : T; +interface IObject { + [key: string]: any; +} +export declare const mergeDeepObject: { + (...objects: T): TMerged; + options: IOptions; + withOptions(options: Partial, ...objects: T): TMerged; +}; +interface IOptions { + mergeArrays: boolean; + dotNotation: boolean; +} +export {}; +//# sourceMappingURL=mergeDeepObject.d.ts.map \ No newline at end of file diff --git a/third-party/utils/mergeDeepObject.js b/third-party/utils/mergeDeepObject.js new file mode 100644 index 0000000..ca96d65 --- /dev/null +++ b/third-party/utils/mergeDeepObject.js @@ -0,0 +1,68 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.mergeDeepObject = void 0; +const isObject = (obj) => { + if (typeof obj === 'object' && obj !== null) { + if (typeof Object.getPrototypeOf === 'function') { + const prototype = Object.getPrototypeOf(obj); + return prototype === Object.prototype || prototype === null; + } + return Object.prototype.toString.call(obj) === '[object Object]'; + } + return false; +}; +const mergeValuesWithPath = (target, value, [key, ...rest]) => { + if (key === undefined) { + return mergeValues(target, value); + } + else if (!isObject(target)) { + return { [key]: mergeValuesWithPath({}, value, rest) }; + } + else { + return Object.assign(Object.assign({}, target), { [key]: mergeValuesWithPath(target[key], value, rest) }); + } +}; +const mergeValues = (target, value) => { + if (Array.isArray(target) && Array.isArray(value)) { + return exports.mergeDeepObject.options.mergeArrays + ? Array.from(new Set(target.concat(value))) + : value; + } + else if (isObject(target) && isObject(value)) { + return (0, exports.mergeDeepObject)(target, value); + } + else { + return value; + } +}; +const mergeDeepObject = (...objects) => objects.reduce((result, current) => { + if (Array.isArray(current)) { + throw new TypeError('Arguments provided to ts-deepmerge must be objects, not arrays.'); + } + Object.keys(current).forEach(key => { + if (['__proto__', 'constructor', 'prototype'].includes(key)) { + return; + } + if (exports.mergeDeepObject.options.dotNotation) { + const [first, ...rest] = key.split('.'); + result[first] = mergeValuesWithPath(result[first], current[key], rest); + } + else { + result[key] = mergeValues(result[key], current[key]); + } + }); + return result; +}, {}); +exports.mergeDeepObject = mergeDeepObject; +const defaultOptions = { + mergeArrays: true, + dotNotation: false, +}; +exports.mergeDeepObject.options = defaultOptions; +exports.mergeDeepObject.withOptions = (options, ...objects) => { + exports.mergeDeepObject.options = Object.assign(Object.assign({}, defaultOptions), options); + const result = (0, exports.mergeDeepObject)(...objects); + exports.mergeDeepObject.options = defaultOptions; + return result; +}; +//# sourceMappingURL=mergeDeepObject.js.map \ No newline at end of file diff --git a/third-party/utils/objectPartition.d.ts b/third-party/utils/objectPartition.d.ts new file mode 100644 index 0000000..8fad8f6 --- /dev/null +++ b/third-party/utils/objectPartition.d.ts @@ -0,0 +1,6 @@ +type Obj = { + [key: string]: T; +}; +export declare const objectPartition: (obj: Obj, keys: string[]) => [Obj, Obj]; +export {}; +//# sourceMappingURL=objectPartition.d.ts.map \ No newline at end of file diff --git a/third-party/utils/objectPartition.js b/third-party/utils/objectPartition.js new file mode 100644 index 0000000..6aa7a29 --- /dev/null +++ b/third-party/utils/objectPartition.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.objectPartition = void 0; +const tslib_1 = require("tslib"); +const objectPartition = (obj, keys) => keys.reduce(([included, excluded], key) => { + const _a = excluded, _b = key, value = _a[_b], rest = tslib_1.__rest(_a, [typeof _b === "symbol" ? _b : _b + ""]); + return typeof value !== 'undefined' + ? [Object.assign(Object.assign({}, included), { [key]: value }), rest] + : [included, excluded]; +}, [{}, obj]); +exports.objectPartition = objectPartition; +//# sourceMappingURL=objectPartition.js.map \ No newline at end of file diff --git a/third-party/utils/parseElectrumUrl.d.ts b/third-party/utils/parseElectrumUrl.d.ts new file mode 100644 index 0000000..60cd789 --- /dev/null +++ b/third-party/utils/parseElectrumUrl.d.ts @@ -0,0 +1,6 @@ +export declare const parseElectrumUrl: (url: string) => { + host: string; + port: number; + protocol: "t" | "s"; +} | undefined; +//# sourceMappingURL=parseElectrumUrl.d.ts.map \ No newline at end of file diff --git a/third-party/utils/parseElectrumUrl.js b/third-party/utils/parseElectrumUrl.js new file mode 100644 index 0000000..ef460e8 --- /dev/null +++ b/third-party/utils/parseElectrumUrl.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseElectrumUrl = void 0; +const ELECTRUM_URL_REGEX = /^(?:([a-zA-Z0-9.-]+)|\[([a-f0-9:]+)\]):([0-9]{1,5}):([ts])$/; +const parseElectrumUrl = (url) => { + var _a; + const match = url.match(ELECTRUM_URL_REGEX); + if (!match) + return undefined; + return { + host: (_a = match[1]) !== null && _a !== void 0 ? _a : match[2], + port: Number.parseInt(match[3], 10), + protocol: match[4], + }; +}; +exports.parseElectrumUrl = parseElectrumUrl; +//# sourceMappingURL=parseElectrumUrl.js.map \ No newline at end of file diff --git a/third-party/utils/parseHostname.d.ts b/third-party/utils/parseHostname.d.ts new file mode 100644 index 0000000..d4cee5f --- /dev/null +++ b/third-party/utils/parseHostname.d.ts @@ -0,0 +1,2 @@ +export declare const parseHostname: (url: string) => string | undefined; +//# sourceMappingURL=parseHostname.d.ts.map \ No newline at end of file diff --git a/third-party/utils/parseHostname.js b/third-party/utils/parseHostname.js new file mode 100644 index 0000000..f72a99d --- /dev/null +++ b/third-party/utils/parseHostname.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseHostname = void 0; +const HOSTNAME_REGEX = /^([a-z0-9.+-]+:\/\/)?([a-z0-9.-]+)([:/][^:/]+)*\/?$/i; +const parseHostname = (url) => { var _a, _b; return (_b = (_a = url.match(HOSTNAME_REGEX)) === null || _a === void 0 ? void 0 : _a[2]) === null || _b === void 0 ? void 0 : _b.toLowerCase(); }; +exports.parseHostname = parseHostname; +//# sourceMappingURL=parseHostname.js.map \ No newline at end of file diff --git a/third-party/utils/promiseAllSequence.d.ts b/third-party/utils/promiseAllSequence.d.ts new file mode 100644 index 0000000..f031610 --- /dev/null +++ b/third-party/utils/promiseAllSequence.d.ts @@ -0,0 +1,2 @@ +export declare const promiseAllSequence: PromiseLike, R = Awaited>>(actions: Fn[]) => Promise; +//# sourceMappingURL=promiseAllSequence.d.ts.map \ No newline at end of file diff --git a/third-party/utils/promiseAllSequence.js b/third-party/utils/promiseAllSequence.js new file mode 100644 index 0000000..859ecf8 --- /dev/null +++ b/third-party/utils/promiseAllSequence.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.promiseAllSequence = void 0; +const tslib_1 = require("tslib"); +const promiseAllSequence = (actions) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { + const results = []; + for (let i = 0; i < actions.length; ++i) { + const result = yield actions[i](); + results.push(result); + } + return results; +}); +exports.promiseAllSequence = promiseAllSequence; +//# sourceMappingURL=promiseAllSequence.js.map \ No newline at end of file diff --git a/third-party/utils/redactUserPath.d.ts b/third-party/utils/redactUserPath.d.ts new file mode 100644 index 0000000..83e088b --- /dev/null +++ b/third-party/utils/redactUserPath.d.ts @@ -0,0 +1,3 @@ +export declare const startOfUserPathRegex: RegExp; +export declare const redactUserPathFromString: (text: string) => string; +//# sourceMappingURL=redactUserPath.d.ts.map \ No newline at end of file diff --git a/third-party/utils/redactUserPath.js b/third-party/utils/redactUserPath.js new file mode 100644 index 0000000..ff85c72 --- /dev/null +++ b/third-party/utils/redactUserPath.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.redactUserPathFromString = exports.startOfUserPathRegex = void 0; +exports.startOfUserPathRegex = /([/\\][Uu]sers[/\\]{1,4})([^"^'^[^\]^/^\\]*)/g; +const redactUserPathFromString = (text) => text.replace(exports.startOfUserPathRegex, '$1[*]'); +exports.redactUserPathFromString = redactUserPathFromString; +//# sourceMappingURL=redactUserPath.js.map \ No newline at end of file diff --git a/third-party/utils/scheduleAction.d.ts b/third-party/utils/scheduleAction.d.ts new file mode 100644 index 0000000..5d3f248 --- /dev/null +++ b/third-party/utils/scheduleAction.d.ts @@ -0,0 +1,15 @@ +export type ScheduledAction = (signal?: AbortSignal) => Promise; +type AttemptParams = { + timeout?: number; + gap?: number; +}; +export type ScheduleActionParams = { + delay?: number; + deadline?: number; + attempts?: number | readonly AttemptParams[]; + signal?: AbortSignal; + attemptFailureHandler?: (error: Error) => Error | void; +} & AttemptParams; +export declare const scheduleAction: (action: ScheduledAction, params: ScheduleActionParams) => Promise; +export {}; +//# sourceMappingURL=scheduleAction.d.ts.map \ No newline at end of file diff --git a/third-party/utils/scheduleAction.js b/third-party/utils/scheduleAction.js new file mode 100644 index 0000000..5af5691 --- /dev/null +++ b/third-party/utils/scheduleAction.js @@ -0,0 +1,125 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.scheduleAction = void 0; +const tslib_1 = require("tslib"); +const isArray = (attempts) => Array.isArray(attempts); +const abortedBySignal = () => new Error('Aborted by signal'); +const abortedByDeadline = () => new Error('Aborted by deadline'); +const abortedByTimeout = () => new Error('Aborted by timeout'); +const resolveAfterMs = (ms, clear) => new Promise((resolve, reject) => { + if (clear.aborted) + return reject(); + if (ms === undefined) + return resolve(); + let timeout; + const onClear = () => { + clearTimeout(timeout); + clear.removeEventListener('abort', onClear); + reject(); + }; + timeout = setTimeout(() => { + clear.removeEventListener('abort', onClear); + resolve(); + }, ms); + clear.addEventListener('abort', onClear); +}); +const rejectAfterMs = (ms, reason, clear) => new Promise((_, reject) => { + if (clear.aborted) + return reject(); + let timeout; + const onClear = () => { + clearTimeout(timeout); + clear.removeEventListener('abort', onClear); + reject(); + }; + timeout = setTimeout(() => { + clear.removeEventListener('abort', onClear); + reject(reason()); + }, ms); + clear.addEventListener('abort', onClear); +}); +const maybeRejectAfterMs = (ms, reason, clear) => ms === undefined ? [] : [rejectAfterMs(ms, reason, clear)]; +const rejectWhenAborted = (signal, clear) => new Promise((_, reject) => { + if (clear.aborted) + return reject(); + if (signal === null || signal === void 0 ? void 0 : signal.aborted) + return reject(abortedBySignal()); + const onAbort = () => reject(abortedBySignal()); + signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', onAbort); + const onClear = () => { + signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', onAbort); + clear.removeEventListener('abort', onClear); + reject(); + }; + clear.addEventListener('abort', onClear); +}); +const resolveAction = (action, clear) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { + const aborter = new AbortController(); + if (clear.aborted) + aborter.abort(); + const onClear = () => { + clear.removeEventListener('abort', onClear); + aborter.abort(); + }; + clear.addEventListener('abort', onClear); + try { + return yield new Promise(resolve => resolve(action(aborter.signal))); + } + finally { + if (!clear.aborted) + clear.removeEventListener('abort', onClear); + } +}); +const attemptLoop = (attempts, attempt, failure, clear) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { + for (let a = 0; a < attempts - 1; a++) { + if (clear.aborted) + break; + const aborter = new AbortController(); + const onClear = () => aborter.abort(); + clear.addEventListener('abort', onClear); + try { + return yield attempt(a, aborter.signal); + } + catch (error) { + onClear(); + yield failure(a, error); + } + finally { + clear.removeEventListener('abort', onClear); + } + } + return clear.aborted ? Promise.reject() : attempt(attempts - 1, clear); +}); +const scheduleAction = (action, params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { + const { signal, delay, attempts, timeout, deadline, gap, attemptFailureHandler } = params; + const deadlineMs = deadline && deadline - Date.now(); + const attemptCount = isArray(attempts) + ? attempts.length + : attempts !== null && attempts !== void 0 ? attempts : (deadline ? Infinity : 1); + const clearAborter = new AbortController(); + const clear = clearAborter.signal; + const getParams = isArray(attempts) + ? (attempt) => attempts[attempt] + : () => ({ timeout, gap }); + try { + return yield Promise.race([ + rejectWhenAborted(signal, clear), + ...maybeRejectAfterMs(deadlineMs, abortedByDeadline, clear), + resolveAfterMs(delay, clear).then(() => attemptLoop(attemptCount, (attempt, abort) => Promise.race([ + ...maybeRejectAfterMs(getParams(attempt).timeout, abortedByTimeout, clear), + resolveAction(action, abort), + ]), (attempt, error) => { + var _a; + const errorHandlerResult = attemptFailureHandler === null || attemptFailureHandler === void 0 ? void 0 : attemptFailureHandler(error); + return errorHandlerResult + ? Promise.reject(errorHandlerResult) + : resolveAfterMs((_a = getParams(attempt).gap) !== null && _a !== void 0 ? _a : 0, clear); + }, clear)), + ]); + } + finally { + clearAborter.abort(); + } +}); +exports.scheduleAction = scheduleAction; +//# sourceMappingURL=scheduleAction.js.map \ No newline at end of file diff --git a/third-party/utils/splitStringEveryNCharacters.d.ts b/third-party/utils/splitStringEveryNCharacters.d.ts new file mode 100644 index 0000000..7e440fb --- /dev/null +++ b/third-party/utils/splitStringEveryNCharacters.d.ts @@ -0,0 +1,2 @@ +export declare function splitStringEveryNCharacters(value: string, n: number): string[]; +//# sourceMappingURL=splitStringEveryNCharacters.d.ts.map \ No newline at end of file diff --git a/third-party/utils/splitStringEveryNCharacters.js b/third-party/utils/splitStringEveryNCharacters.js new file mode 100644 index 0000000..5285b1b --- /dev/null +++ b/third-party/utils/splitStringEveryNCharacters.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.splitStringEveryNCharacters = splitStringEveryNCharacters; +function splitStringEveryNCharacters(value, n) { + var _a; + if (n === 0) { + return []; + } + const regex = new RegExp(`.{1,${n}}`, 'g'); + return (_a = value.match(regex)) !== null && _a !== void 0 ? _a : []; +} +//# sourceMappingURL=splitStringEveryNCharacters.js.map \ No newline at end of file diff --git a/third-party/utils/throttler.d.ts b/third-party/utils/throttler.d.ts new file mode 100644 index 0000000..d2546af --- /dev/null +++ b/third-party/utils/throttler.d.ts @@ -0,0 +1,11 @@ +export declare class Throttler { + private readonly delay; + private readonly intervals; + private readonly callbacks; + constructor(delay: number); + throttle(id: string, callback: () => void): void; + private tick; + cancel(id: string): void; + dispose(): void; +} +//# sourceMappingURL=throttler.d.ts.map \ No newline at end of file diff --git a/third-party/utils/throttler.js b/third-party/utils/throttler.js new file mode 100644 index 0000000..894ee1a --- /dev/null +++ b/third-party/utils/throttler.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Throttler = void 0; +class Throttler { + constructor(delay) { + this.delay = delay; + this.intervals = {}; + this.callbacks = {}; + } + throttle(id, callback) { + if (this.intervals[id]) { + this.callbacks[id] = callback; + } + else { + callback(); + this.intervals[id] = setInterval(() => this.tick(id), this.delay); + } + } + tick(id) { + if (this.callbacks[id]) { + this.callbacks[id](); + delete this.callbacks[id]; + } + else { + this.cancel(id); + } + } + cancel(id) { + clearInterval(this.intervals[id]); + delete this.intervals[id]; + delete this.callbacks[id]; + } + dispose() { + Object.keys(this.intervals).forEach(this.cancel, this); + } +} +exports.Throttler = Throttler; +//# sourceMappingURL=throttler.js.map \ No newline at end of file diff --git a/third-party/utils/throwError.d.ts b/third-party/utils/throwError.d.ts new file mode 100644 index 0000000..15b8fff --- /dev/null +++ b/third-party/utils/throwError.d.ts @@ -0,0 +1,2 @@ +export declare const throwError: (reason: string) => never; +//# sourceMappingURL=throwError.d.ts.map \ No newline at end of file diff --git a/third-party/utils/throwError.js b/third-party/utils/throwError.js new file mode 100644 index 0000000..8f2829d --- /dev/null +++ b/third-party/utils/throwError.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.throwError = void 0; +const throwError = (reason) => { + throw new Error(reason); +}; +exports.throwError = throwError; +//# sourceMappingURL=throwError.js.map \ No newline at end of file diff --git a/third-party/utils/topologicalSort.d.ts b/third-party/utils/topologicalSort.d.ts new file mode 100644 index 0000000..08f259f --- /dev/null +++ b/third-party/utils/topologicalSort.d.ts @@ -0,0 +1,2 @@ +export declare const topologicalSort: (elements: T[], precedes: (pred: T, succ: T) => boolean, tie?: (a: T, b: T) => number) => T[]; +//# sourceMappingURL=topologicalSort.d.ts.map \ No newline at end of file diff --git a/third-party/utils/topologicalSort.js b/third-party/utils/topologicalSort.js new file mode 100644 index 0000000..2ce5d46 --- /dev/null +++ b/third-party/utils/topologicalSort.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.topologicalSort = void 0; +const arrayPartition_1 = require("./arrayPartition"); +const topologicalSort = (elements, precedes, tie) => { + const result = []; + const filterRoots = (verts) => (0, arrayPartition_1.arrayPartition)(verts, succ => !verts.some(pred => precedes(pred, succ))); + let elem = elements; + while (elem.length) { + const [roots, rest] = filterRoots(elem); + if (!roots.length) + throw new Error('Cycle detected'); + result.push(...(tie ? roots.sort(tie) : roots)); + elem = rest; + } + return result; +}; +exports.topologicalSort = topologicalSort; +//# sourceMappingURL=topologicalSort.js.map \ No newline at end of file diff --git a/third-party/utils/truncateMiddle.d.ts b/third-party/utils/truncateMiddle.d.ts new file mode 100644 index 0000000..08fc6b7 --- /dev/null +++ b/third-party/utils/truncateMiddle.d.ts @@ -0,0 +1,2 @@ +export declare const truncateMiddle: (text: string, startChars: number, endChars: number) => string; +//# sourceMappingURL=truncateMiddle.d.ts.map \ No newline at end of file diff --git a/third-party/utils/truncateMiddle.js b/third-party/utils/truncateMiddle.js new file mode 100644 index 0000000..ab9be74 --- /dev/null +++ b/third-party/utils/truncateMiddle.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.truncateMiddle = void 0; +const truncateMiddle = (text, startChars, endChars) => { + if (text.length <= startChars + endChars) + return text; + const start = text.substring(0, startChars); + const end = text.substring(text.length - endChars, text.length); + return `${start}…${end}`; +}; +exports.truncateMiddle = truncateMiddle; +//# sourceMappingURL=truncateMiddle.js.map \ No newline at end of file diff --git a/third-party/utils/typedEventEmitter.d.ts b/third-party/utils/typedEventEmitter.d.ts new file mode 100644 index 0000000..9049652 --- /dev/null +++ b/third-party/utils/typedEventEmitter.d.ts @@ -0,0 +1,23 @@ +import { EventEmitter } from 'events'; +type EventMap = Record; +type EventKey = string & keyof T; +type IsUnion = T extends unknown ? ([U] extends [T] ? 0 : 1) : 2; +type EventReceiver = IsUnion extends 1 ? (event: T) => void : T extends (...args: any[]) => any ? T : T extends undefined ? () => void : (event: T) => void; +export interface TypedEmitter { + on>(eventName: K, fn: EventReceiver): this; + once>(eventName: K, fn: EventReceiver): this; + addListener>(eventName: K, fn: EventReceiver): this; + prependListener>(eventName: K, fn: EventReceiver): this; + prependOnceListener>(eventName: K, fn: EventReceiver): this; + off>(eventName: K, fn: EventReceiver): this; + removeListener>(eventName: K, fn: EventReceiver): this; + removeAllListeners>(event?: K): this; + emit>(eventName: K, ...params: Parameters>): boolean; + listeners>(eventName: K): EventReceiver[]; + rawListeners>(eventName: K): EventReceiver[]; +} +export declare class TypedEmitter extends EventEmitter { + listenerCount>(eventName: K): number; +} +export {}; +//# sourceMappingURL=typedEventEmitter.d.ts.map \ No newline at end of file diff --git a/third-party/utils/typedEventEmitter.js b/third-party/utils/typedEventEmitter.js new file mode 100644 index 0000000..71b745f --- /dev/null +++ b/third-party/utils/typedEventEmitter.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TypedEmitter = void 0; +const events_1 = require("events"); +class TypedEmitter extends events_1.EventEmitter { + listenerCount(eventName) { + return super.listenerCount(eventName); + } +} +exports.TypedEmitter = TypedEmitter; +//# sourceMappingURL=typedEventEmitter.js.map \ No newline at end of file diff --git a/third-party/utils/urlToOnion.d.ts b/third-party/utils/urlToOnion.d.ts new file mode 100644 index 0000000..1ef135b --- /dev/null +++ b/third-party/utils/urlToOnion.d.ts @@ -0,0 +1,4 @@ +export declare const urlToOnion: (url: string, onionDomains: { + [domain: string]: string; +}) => string | undefined; +//# sourceMappingURL=urlToOnion.d.ts.map \ No newline at end of file diff --git a/third-party/utils/urlToOnion.js b/third-party/utils/urlToOnion.js new file mode 100644 index 0000000..1db5cdf --- /dev/null +++ b/third-party/utils/urlToOnion.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.urlToOnion = void 0; +const urlToOnion = (url, onionDomains) => { + var _a; + const [, protocol, subdomain, domain, rest] = (_a = url.match(/^(http|ws)s?:\/\/([^:/]+\.)?([^/.]+\.[^/.]+)(\/.*)?$/i)) !== null && _a !== void 0 ? _a : []; + if (!domain || !onionDomains[domain]) + return; + return `${protocol}://${subdomain !== null && subdomain !== void 0 ? subdomain : ''}${onionDomains[domain]}${rest !== null && rest !== void 0 ? rest : ''}`; +}; +exports.urlToOnion = urlToOnion; +//# sourceMappingURL=urlToOnion.js.map \ No newline at end of file diff --git a/third-party/utils/versionUtils.d.ts b/third-party/utils/versionUtils.d.ts new file mode 100644 index 0000000..b49dfbb --- /dev/null +++ b/third-party/utils/versionUtils.d.ts @@ -0,0 +1,9 @@ +type VersionArray = [number, number, number]; +type VersionInput = VersionArray | string; +export declare const isVersionArray: (arr: unknown) => arr is VersionArray; +export declare const isNewer: (versionX: VersionInput, versionY: VersionInput) => boolean; +export declare const isEqual: (versionX: VersionInput, versionY: VersionInput) => boolean; +export declare const isNewerOrEqual: (versionX: VersionInput, versionY: VersionInput) => boolean; +export declare const normalizeVersion: (version: string) => string; +export {}; +//# sourceMappingURL=versionUtils.d.ts.map \ No newline at end of file diff --git a/third-party/utils/versionUtils.js b/third-party/utils/versionUtils.js new file mode 100644 index 0000000..6aa4d77 --- /dev/null +++ b/third-party/utils/versionUtils.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.normalizeVersion = exports.isNewerOrEqual = exports.isEqual = exports.isNewer = exports.isVersionArray = void 0; +const throwError_1 = require("./throwError"); +const isVersionArray = (arr) => Array.isArray(arr) && + arr.length === 3 && + arr.every(number => typeof number === 'number' && number >= 0); +exports.isVersionArray = isVersionArray; +const tryParse = (version) => { + var _a; + return (_a = version + .match(/^(\d+)\.(\d+)\.(\d+)([+-].*)?$/)) === null || _a === void 0 ? void 0 : _a.slice(1, 4).map(n => Number(n)); +}; +const validateArray = (version) => ((0, exports.isVersionArray)(version) ? version : null); +const ensureArray = (version) => { + var _a; + return (_a = (typeof version === 'string' ? tryParse(version) : validateArray(version))) !== null && _a !== void 0 ? _a : (0, throwError_1.throwError)(`version string is in wrong format: ${version}`); +}; +const compare = ([majorX, minorX, patchX], [majorY, minorY, patchY]) => majorX - majorY || minorX - minorY || patchX - patchY; +const isNewer = (versionX, versionY) => compare(ensureArray(versionX), ensureArray(versionY)) > 0; +exports.isNewer = isNewer; +const isEqual = (versionX, versionY) => compare(ensureArray(versionX), ensureArray(versionY)) === 0; +exports.isEqual = isEqual; +const isNewerOrEqual = (versionX, versionY) => compare(ensureArray(versionX), ensureArray(versionY)) >= 0; +exports.isNewerOrEqual = isNewerOrEqual; +const normalizeVersion = (version) => version.replace(/\b0+(\d)/g, '$1'); +exports.normalizeVersion = normalizeVersion; +//# sourceMappingURL=versionUtils.js.map \ No newline at end of file diff --git a/third-party/utils/xssFilters.d.ts b/third-party/utils/xssFilters.d.ts new file mode 100644 index 0000000..709d2e5 --- /dev/null +++ b/third-party/utils/xssFilters.d.ts @@ -0,0 +1,4 @@ +export declare const inHTML: (value: string) => string; +export declare const inSingleQuotes: (value: string) => string; +export declare const inDoubleQuotes: (value: string) => string; +//# sourceMappingURL=xssFilters.d.ts.map \ No newline at end of file diff --git a/third-party/utils/xssFilters.js b/third-party/utils/xssFilters.js new file mode 100644 index 0000000..3dd2976 --- /dev/null +++ b/third-party/utils/xssFilters.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.inDoubleQuotes = exports.inSingleQuotes = exports.inHTML = void 0; +const LT = / value.replace(LT, '<'); +exports.inHTML = inHTML; +const inSingleQuotes = (value) => value.replace(SQUOT, '''); +exports.inSingleQuotes = inSingleQuotes; +const inDoubleQuotes = (value) => value.replace(QUOT, '"'); +exports.inDoubleQuotes = inDoubleQuotes; +//# sourceMappingURL=xssFilters.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/address.d.ts b/third-party/utxo-lib/address.d.ts new file mode 100644 index 0000000..c21888e --- /dev/null +++ b/third-party/utxo-lib/address.d.ts @@ -0,0 +1,17 @@ +import { Network } from './networks'; +export interface Base58CheckResult { + hash: Buffer; + version: number; +} +export interface Bech32Result { + version: number; + prefix: string; + data: Buffer; +} +export declare function fromBase58Check(address: string, network?: Network): Base58CheckResult; +export declare function fromBech32(address: string): Bech32Result; +export declare function toBech32(data: Buffer, version: number, prefix: string): string; +export declare function fromOutputScript(output: Buffer, network?: Network): string; +export declare function getAddressType(address: string, network?: Network): "p2pkh" | "p2sh" | "p2tr" | "p2wpkh" | "p2wsh" | "p2w-unknown" | "unknown"; +export declare function toOutputScript(address: string, network?: Network): Buffer; +//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/address.js b/third-party/utxo-lib/address.js new file mode 100644 index 0000000..0f95b43 --- /dev/null +++ b/third-party/utxo-lib/address.js @@ -0,0 +1,174 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromBase58Check = fromBase58Check; +exports.fromBech32 = fromBech32; +exports.toBech32 = toBech32; +exports.fromOutputScript = fromOutputScript; +exports.getAddressType = getAddressType; +exports.toOutputScript = toOutputScript; +const tslib_1 = require("tslib"); +const bech32_1 = require("bech32"); +const bs58check = tslib_1.__importStar(require("./bs58check")); +const bscript = tslib_1.__importStar(require("./script")); +const payments = tslib_1.__importStar(require("./payments")); +const networks_1 = require("./networks"); +function fromBase58Check(address, network = networks_1.bitcoin) { + return bs58check.decodeAddress(address, network); +} +function fromBech32(address) { + let result; + let version; + try { + result = bech32_1.bech32.decode(address); + } + catch (_a) { + } + if (result) { + [version] = result.words; + if (version !== 0) + throw new TypeError(`${address} uses wrong encoding`); + } + else { + result = bech32_1.bech32m.decode(address); + [version] = result.words; + if (version === 0) + throw new TypeError(`${address} uses wrong encoding`); + } + const data = bech32_1.bech32.fromWords(result.words.slice(1)); + return { + version, + prefix: result.prefix, + data: Buffer.from(data), + }; +} +function toBech32(data, version, prefix) { + const words = bech32_1.bech32.toWords(data); + words.unshift(version); + return version === 0 ? bech32_1.bech32.encode(prefix, words) : bech32_1.bech32m.encode(prefix, words); +} +const FUTURE_SEGWIT_MAX_SIZE = 40; +const FUTURE_SEGWIT_MIN_SIZE = 2; +const FUTURE_SEGWIT_MAX_VERSION = 16; +const FUTURE_SEGWIT_MIN_VERSION = 1; +const FUTURE_SEGWIT_VERSION_DIFF = 0x50; +function toFutureSegwitAddress(output, network = networks_1.bitcoin) { + const data = output.subarray(2); + if (data.length < FUTURE_SEGWIT_MIN_SIZE || data.length > FUTURE_SEGWIT_MAX_SIZE) + throw new TypeError('Invalid program length for segwit address'); + const version = output[0] - FUTURE_SEGWIT_VERSION_DIFF; + if (version < FUTURE_SEGWIT_MIN_VERSION || version > FUTURE_SEGWIT_MAX_VERSION) + throw new TypeError('Invalid version for segwit address'); + if (output[1] !== data.length) + throw new TypeError('Invalid script for segwit address'); + return toBech32(data, version, network.bech32); +} +function fromOutputScript(output, network = networks_1.bitcoin) { + try { + return payments.p2pkh({ output, network }).address; + } + catch (_a) { + } + try { + return payments.p2sh({ output, network }).address; + } + catch (_b) { + } + try { + return payments.p2wpkh({ output, network }).address; + } + catch (_c) { + } + try { + return payments.p2wsh({ output, network }).address; + } + catch (_d) { + } + try { + return payments.p2tr({ output, network }).address; + } + catch (_e) { + } + try { + return toFutureSegwitAddress(output, network); + } + catch (_f) { + } + throw new Error(`${bscript.toASM(output)} has no matching Address`); +} +function decodeAddress(address, network) { + try { + const { hash, version } = fromBase58Check(address, network); + return { success: true, format: 'base58', version, hash }; + } + catch (_a) { + try { + const { data, prefix, version } = fromBech32(address); + if (prefix === network.bech32) { + return { success: true, format: 'bech32', version, hash: data }; + } + return { success: false, error: 'bech32-invalid-prefix' }; + } + catch (_b) { + } + } + return { success: false, error: 'unknown-format' }; +} +function identifyAddressType(format, version, hash, network) { + if (format === 'base58') { + if (version === network.pubKeyHash) + return 'p2pkh'; + if (version === network.scriptHash) + return 'p2sh'; + } + else if (format === 'bech32') { + if (version === 0) { + if (hash.length === 20) + return 'p2wpkh'; + if (hash.length === 32) + return 'p2wsh'; + } + else if (version === 1 && hash.length === 32) { + return 'p2tr'; + } + else if (version >= FUTURE_SEGWIT_MIN_VERSION && + version <= FUTURE_SEGWIT_MAX_VERSION && + hash.length >= FUTURE_SEGWIT_MIN_SIZE && + hash.length <= FUTURE_SEGWIT_MAX_SIZE) { + return 'p2w-unknown'; + } + } + return 'unknown'; +} +function createOutputScript(type, hash, version) { + switch (type) { + case 'p2pkh': + return payments.p2pkh({ hash }).output; + case 'p2sh': + return payments.p2sh({ hash }).output; + case 'p2wpkh': + return payments.p2wpkh({ hash }).output; + case 'p2wsh': + return payments.p2wsh({ hash }).output; + case 'p2tr': + case 'p2w-unknown': + return bscript.compile([version + FUTURE_SEGWIT_VERSION_DIFF, hash]); + } +} +function getAddressType(address, network = networks_1.bitcoin) { + const { success, format, version, hash } = decodeAddress(address, network); + return success ? identifyAddressType(format, version, hash, network) : 'unknown'; +} +function toOutputScript(address, network = networks_1.bitcoin) { + const { success, format, version, hash, error } = decodeAddress(address, network); + if (success) { + const type = identifyAddressType(format, version, hash, network); + if (type !== 'unknown') { + return createOutputScript(type, hash, version); + } + } + else if (error === 'bech32-invalid-prefix') { + throw new Error(`${address} has an invalid prefix`); + } + throw new Error(`${address} has no matching Script`); +} +//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/bip32.d.ts b/third-party/utxo-lib/bip32.d.ts new file mode 100644 index 0000000..4fe394a --- /dev/null +++ b/third-party/utxo-lib/bip32.d.ts @@ -0,0 +1,28 @@ +import type { Network } from './networks'; +export interface BIP32Interface { + chainCode: Buffer; + network: Network; + lowR: boolean; + depth: number; + index: number; + parentFingerprint: number; + publicKey: Buffer; + privateKey?: Buffer; + identifier: Buffer; + fingerprint: Buffer; + compressed: boolean; + isNeutered(): boolean; + neutered(): BIP32Interface; + toBase58(): string; + toWIF(): string; + derive(index: number): BIP32Interface; + deriveHardened(index: number): BIP32Interface; + derivePath(path: string): BIP32Interface; + sign(hash: Buffer, lowR?: boolean): Buffer; + verify(hash: Buffer, signature: Buffer): boolean; +} +export declare function fromBase58(inString: string, network?: Network): BIP32Interface; +export declare function fromPrivateKey(privateKey: Buffer, chainCode: Buffer, network?: Network): BIP32Interface; +export declare function fromPublicKey(publicKey: Buffer, chainCode: Buffer, network?: Network): BIP32Interface; +export declare function fromSeed(seed: Buffer, network?: Network): BIP32Interface; +//# sourceMappingURL=bip32.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/bip32.js b/third-party/utxo-lib/bip32.js new file mode 100644 index 0000000..a531b7f --- /dev/null +++ b/third-party/utxo-lib/bip32.js @@ -0,0 +1,253 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromBase58 = fromBase58; +exports.fromPrivateKey = fromPrivateKey; +exports.fromPublicKey = fromPublicKey; +exports.fromSeed = fromSeed; +const tslib_1 = require("tslib"); +const tiny_secp256k1_1 = tslib_1.__importDefault(require("tiny-secp256k1")); +const wif = tslib_1.__importStar(require("wif")); +const typeforce_1 = require("./types/typeforce"); +const bs58check = tslib_1.__importStar(require("./bs58check")); +const crypto = tslib_1.__importStar(require("./crypto")); +const networks_1 = require("./networks"); +const UINT256_TYPE = typeforce_1.typeforce.BufferN(32); +const NETWORK_TYPE = typeforce_1.typeforce.compile({ + wif: typeforce_1.typeforce.UInt8, + bip32: { + public: typeforce_1.typeforce.UInt32, + private: typeforce_1.typeforce.UInt32, + }, +}); +const HIGHEST_BIT = 0x80000000; +const UINT31_MAX = Math.pow(2, 31) - 1; +function BIP32Path(value) { + return typeforce_1.typeforce.String(value) && value.match(/^(m\/)?(\d+'?\/)*\d+'?$/) !== null; +} +function UInt31(value) { + return typeforce_1.typeforce.UInt32(value) && value <= UINT31_MAX; +} +function fromPrivateKeyLocal(privateKey, chainCode, network, depth, index, parentFingerprint) { + (0, typeforce_1.typeforce)({ + privateKey: UINT256_TYPE, + chainCode: UINT256_TYPE, + }, { privateKey, chainCode }); + network = network || networks_1.bitcoin; + if (!tiny_secp256k1_1.default.isPrivate(privateKey)) + throw new TypeError('Private key not in range [1, n)'); + return new BIP32(privateKey, undefined, chainCode, network, depth, index, parentFingerprint); +} +function fromPublicKeyLocal(publicKey, chainCode, network, depth, index, parentFingerprint) { + (0, typeforce_1.typeforce)({ + publicKey: typeforce_1.typeforce.BufferN(33), + chainCode: UINT256_TYPE, + }, { publicKey, chainCode }); + network = network || networks_1.bitcoin; + if (!tiny_secp256k1_1.default.isPoint(publicKey)) + throw new TypeError('Point is not on the curve'); + return new BIP32(undefined, publicKey, chainCode, network, depth, index, parentFingerprint); +} +class BIP32 { + constructor(__D, __Q, chainCode, network, __DEPTH = 0, __INDEX = 0, __PARENT_FINGERPRINT = 0x00000000) { + this.__D = __D; + this.__Q = __Q; + this.chainCode = chainCode; + this.network = network; + this.__DEPTH = __DEPTH; + this.__INDEX = __INDEX; + this.__PARENT_FINGERPRINT = __PARENT_FINGERPRINT; + (0, typeforce_1.typeforce)(NETWORK_TYPE, network); + this.lowR = false; + } + get depth() { + return this.__DEPTH; + } + get index() { + return this.__INDEX; + } + get parentFingerprint() { + return this.__PARENT_FINGERPRINT; + } + get publicKey() { + if (this.__Q === undefined) + this.__Q = tiny_secp256k1_1.default.pointFromScalar(this.__D, true); + return this.__Q; + } + get privateKey() { + return this.__D; + } + get identifier() { + if ((0, networks_1.isNetworkType)('decred', this.network)) + return crypto.hash160blake256(this.publicKey); + return crypto.hash160(this.publicKey); + } + get fingerprint() { + return this.identifier.subarray(0, 4); + } + get compressed() { + return true; + } + isNeutered() { + return this.__D === undefined; + } + neutered() { + return fromPublicKeyLocal(this.publicKey, this.chainCode, this.network, this.depth, this.index, this.parentFingerprint); + } + toBase58() { + const { network } = this; + const version = !this.isNeutered() ? network.bip32.private : network.bip32.public; + const buffer = Buffer.allocUnsafe(78); + buffer.writeUInt32BE(version, 0); + buffer.writeUInt8(this.depth, 4); + buffer.writeUInt32BE(this.parentFingerprint, 5); + buffer.writeUInt32BE(this.index, 9); + this.chainCode.copy(buffer, 13); + if (!this.isNeutered()) { + buffer.writeUInt8(0, 45); + this.privateKey.copy(buffer, 46); + } + else { + this.publicKey.copy(buffer, 45); + } + return bs58check.encode(buffer, network); + } + toWIF() { + if (!this.privateKey) + throw new TypeError('Missing private key'); + return wif.encode({ + version: this.network.wif, + privateKey: this.privateKey, + compressed: true, + }); + } + derive(index) { + (0, typeforce_1.typeforce)(typeforce_1.typeforce.UInt32, index); + const isHardened = index >= HIGHEST_BIT; + const data = Buffer.allocUnsafe(37); + if (isHardened) { + if (this.isNeutered()) + throw new TypeError('Missing private key for hardened child key'); + data[0] = 0x00; + this.privateKey.copy(data, 1); + data.writeUInt32BE(index, 33); + } + else { + this.publicKey.copy(data, 0); + data.writeUInt32BE(index, 33); + } + const I = crypto.hmacSHA512(this.chainCode, data); + const IL = I.subarray(0, 32); + const IR = I.subarray(32); + if (!tiny_secp256k1_1.default.isPrivate(IL)) + return this.derive(index + 1); + let hd; + if (!this.isNeutered()) { + const ki = tiny_secp256k1_1.default.privateAdd(this.privateKey, IL); + if (ki == null) + return this.derive(index + 1); + hd = fromPrivateKeyLocal(ki, IR, this.network, this.depth + 1, index, this.fingerprint.readUInt32BE(0)); + } + else { + const Ki = tiny_secp256k1_1.default.pointAddScalar(this.publicKey, IL, true); + if (Ki === null) + return this.derive(index + 1); + hd = fromPublicKeyLocal(Ki, IR, this.network, this.depth + 1, index, this.fingerprint.readUInt32BE(0)); + } + return hd; + } + deriveHardened(index) { + (0, typeforce_1.typeforce)(UInt31, index); + return this.derive(index + HIGHEST_BIT); + } + derivePath(path) { + (0, typeforce_1.typeforce)(BIP32Path, path); + let splitPath = path.split('/'); + if (splitPath[0] === 'm') { + if (this.parentFingerprint) + throw new TypeError('Expected master, got child'); + splitPath = splitPath.slice(1); + } + return splitPath.reduce((prevHd, indexStr) => { + let index; + if (indexStr.slice(-1) === `'`) { + index = parseInt(indexStr.slice(0, -1), 10); + return prevHd.deriveHardened(index); + } + index = parseInt(indexStr, 10); + return prevHd.derive(index); + }, this); + } + sign(hash, lowR) { + if (!this.privateKey) + throw new Error('Missing private key'); + if (lowR === undefined) + lowR = this.lowR; + if (lowR === false) { + return tiny_secp256k1_1.default.sign(hash, this.privateKey); + } + let sig = tiny_secp256k1_1.default.sign(hash, this.privateKey); + const extraData = Buffer.alloc(32, 0); + let counter = 0; + while (sig[0] > 0x7f) { + counter++; + extraData.writeUIntLE(counter, 0, 6); + sig = tiny_secp256k1_1.default.signWithEntropy(hash, this.privateKey, extraData); + } + return sig; + } + verify(hash, signature) { + return tiny_secp256k1_1.default.verify(hash, this.publicKey, signature); + } +} +function fromBase58(inString, network) { + const buffer = Buffer.from((0, networks_1.isNetworkType)('decred', network) + ? bs58check.decodeBlake256Key(inString) + : bs58check.decode(inString, network)); + if (buffer.length !== 78) + throw new TypeError('Invalid buffer length'); + network = network || networks_1.bitcoin; + const version = buffer.readUInt32BE(0); + if (version !== network.bip32.private && version !== network.bip32.public) + throw new TypeError('Invalid network version'); + const depth = buffer[4]; + const parentFingerprint = buffer.readUInt32BE(5); + if (depth === 0) { + if (parentFingerprint !== 0x00000000) + throw new TypeError('Invalid parent fingerprint'); + } + const index = buffer.readUInt32BE(9); + if (depth === 0 && index !== 0) + throw new TypeError('Invalid index'); + const chainCode = buffer.subarray(13, 45); + let hd; + if (version === network.bip32.private) { + if (buffer.readUInt8(45) !== 0x00) + throw new TypeError('Invalid private key'); + const k = buffer.subarray(46, 78); + hd = fromPrivateKeyLocal(k, chainCode, network, depth, index, parentFingerprint); + } + else { + const X = buffer.subarray(45, 78); + hd = fromPublicKeyLocal(X, chainCode, network, depth, index, parentFingerprint); + } + return hd; +} +function fromPrivateKey(privateKey, chainCode, network) { + return fromPrivateKeyLocal(privateKey, chainCode, network); +} +function fromPublicKey(publicKey, chainCode, network) { + return fromPublicKeyLocal(publicKey, chainCode, network); +} +function fromSeed(seed, network) { + (0, typeforce_1.typeforce)(typeforce_1.typeforce.Buffer, seed); + if (seed.length < 16) + throw new TypeError('Seed should be at least 128 bits'); + if (seed.length > 64) + throw new TypeError('Seed should be at most 512 bits'); + network = network || networks_1.bitcoin; + const I = crypto.hmacSHA512(Buffer.from('Bitcoin seed', 'utf8'), seed); + const IL = I.subarray(0, 32); + const IR = I.subarray(32); + return fromPrivateKey(IL, IR, network); +} +//# sourceMappingURL=bip32.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/bs58check.d.ts b/third-party/utxo-lib/bs58check.d.ts new file mode 100644 index 0000000..f873642 --- /dev/null +++ b/third-party/utxo-lib/bs58check.d.ts @@ -0,0 +1,12 @@ +export declare function decodeBlake(buffer: Buffer): Buffer; +export declare function decodeBlake256Key(key: string): Buffer; +export declare function decodeBlake256(address: string): Buffer; +export declare function encodeBlake256(payload: Buffer): string; +export declare function encode(payload: Buffer, network?: import("./networks").Network): string; +export declare function decode(payload: string, network?: import("./networks").Network): Buffer | Uint8Array; +export declare function decodeAddress(address: string, network?: import("./networks").Network): { + version: number; + hash: Buffer; +}; +export declare function encodeAddress(hash: Buffer, version: number, network?: import("./networks").Network): string; +//# sourceMappingURL=bs58check.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/bs58check.js b/third-party/utxo-lib/bs58check.js new file mode 100644 index 0000000..10364d2 --- /dev/null +++ b/third-party/utxo-lib/bs58check.js @@ -0,0 +1,92 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeBlake = decodeBlake; +exports.decodeBlake256Key = decodeBlake256Key; +exports.decodeBlake256 = decodeBlake256; +exports.encodeBlake256 = encodeBlake256; +exports.encode = encode; +exports.decode = decode; +exports.decodeAddress = decodeAddress; +exports.encodeAddress = encodeAddress; +const tslib_1 = require("tslib"); +const bchaddrjs_1 = tslib_1.__importDefault(require("bchaddrjs")); +const bs58_1 = tslib_1.__importDefault(require("bs58")); +const bs58check_1 = tslib_1.__importDefault(require("bs58check")); +const networks_1 = require("./networks"); +const crypto_1 = require("./crypto"); +function decodeBlake(buffer) { + const want = buffer.subarray(-4); + const payload = buffer.subarray(0, -4); + const got = (0, crypto_1.blake256)((0, crypto_1.blake256)(payload)).subarray(0, 4); + if ((want[0] ^ got[0]) | (want[1] ^ got[1]) | (want[2] ^ got[2]) | (want[3] ^ got[3])) + throw new Error('invalid checksum'); + return payload; +} +function decodeBlake256Key(key) { + const bytes = bs58_1.default.decode(key); + const buffer = Buffer.from(bytes); + return decodeBlake(buffer); +} +function decodeBlake256(address) { + const bytes = bs58_1.default.decode(address); + const buffer = Buffer.from(bytes); + if (buffer.length !== 26) + throw new Error(`${address} invalid address length`); + let payload; + try { + payload = decodeBlake(buffer); + } + catch (e) { + if (e instanceof Error) { + throw new Error(`${address} ${e.message}`); + } + throw new Error(`${address} ${e}`); + } + return payload; +} +function encodeBlake256(payload) { + const checksum = (0, crypto_1.blake256)((0, crypto_1.blake256)(payload)).subarray(0, 4); + return bs58_1.default.encode(Buffer.concat([payload, checksum])); +} +function encode(payload, network = networks_1.bitcoin) { + return (0, networks_1.isNetworkType)('decred', network) ? encodeBlake256(payload) : bs58check_1.default.encode(payload); +} +function decode(payload, network = networks_1.bitcoin) { + return (0, networks_1.isNetworkType)('decred', network) ? decodeBlake256(payload) : bs58check_1.default.decode(payload); +} +function decodeAddress(address, network = networks_1.bitcoin) { + let payload; + if ((0, networks_1.isNetworkType)('bitcoinCash', network)) { + if (!bchaddrjs_1.default.isCashAddress(address)) + throw Error(`${address} is not a cash address`); + payload = Buffer.from(bs58check_1.default.decode(bchaddrjs_1.default.toLegacyAddress(address))); + } + else { + payload = Buffer.from(decode(address, network)); + } + if (payload.length < 21) + throw new TypeError(`${address} is too short`); + if (payload.length > 22) + throw new TypeError(`${address} is too long`); + const multibyte = payload.length === 22; + const offset = multibyte ? 2 : 1; + const version = multibyte ? payload.readUInt16BE(0) : payload[0]; + const hash = payload.subarray(offset); + return { version, hash }; +} +function encodeAddress(hash, version, network = networks_1.bitcoin) { + const multibyte = version > 0xff; + const size = multibyte ? 22 : 21; + const offset = multibyte ? 2 : 1; + const payload = Buffer.allocUnsafe(size); + if (multibyte) { + payload.writeUInt16BE(version, 0); + } + else { + payload.writeUInt8(version, 0); + } + hash.copy(payload, offset); + const encoded = encode(payload, network); + return (0, networks_1.isNetworkType)('bitcoinCash', network) ? bchaddrjs_1.default.toCashAddress(encoded) : encoded; +} +//# sourceMappingURL=bs58check.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/bufferutils.d.ts b/third-party/utxo-lib/bufferutils.d.ts new file mode 100644 index 0000000..3fc17e5 --- /dev/null +++ b/third-party/utxo-lib/bufferutils.d.ts @@ -0,0 +1,59 @@ +import * as varuint from 'varuint-bitcoin'; +export declare function verifuint(value: number, max: number): void; +export declare function readUInt64LE(buffer: Buffer, offset: number): number; +export declare function readUInt64LEasString(buffer: Buffer, offset: number): string; +export declare function readInt64LE(buffer: Buffer, offset: number): number; +export declare function writeUInt64LE(buffer: Buffer, value: number, offset: number): number; +export declare function writeUInt64LEasString(buffer: Buffer, value: string | number, offset: number): number; +export declare function writeInt64LE(buffer: Buffer, value: number, offset: number): number; +export declare function readVarInt(buffer: Buffer, offset: number): { + number: number; + size: number; +}; +export declare function writeVarInt(buffer: Buffer, number: number, offset: number): number; +export declare function cloneBuffer(buffer: Buffer): Buffer; +type PushDataSize = (len: number) => number; +type ReadPushDataInt = (buffer: Buffer, offset: number) => { + opcode: number; + number: number; + size: number; +}; +type WritePushDataInt = (buffer: Buffer, number: number, offset: number) => number; +export declare const pushDataSize: PushDataSize; +export declare const readPushDataInt: ReadPushDataInt; +export declare const varIntSize: typeof varuint.encodingLength; +export declare const writePushDataInt: WritePushDataInt; +export declare const reverseBuffer: (src: Buffer) => Buffer, getChunkSize: (n: number) => Buffer; +export declare class BufferWriter { + buffer: Buffer; + offset: number; + constructor(buffer: Buffer, offset?: number); + writeUInt8(i: number): void; + writeUInt16(i: number): void; + writeInt32(i: number): void; + writeUInt32(i: number): void; + writeInt64(i: number): void; + writeUInt64(i: number | string): void; + writeVarInt(i: number): void; + writeSlice(slice: Buffer): void; + writeVarSlice(slice: Buffer): void; + writeVector(vector: Buffer[]): void; +} +export declare class BufferReader { + buffer: Buffer; + offset: number; + constructor(buffer: Buffer, offset?: number); + readUInt8(): number; + readUInt16(): number; + readInt32(): number; + readUInt32(): number; + readInt64(): number; + readUInt64(): number; + readUInt64String(): string; + readVarInt(): number; + readSlice(n: number): Buffer; + readVarSlice(): Buffer; + readVector(): Buffer[]; +} +export {}; +//# sourceMappingURL=bufferutils.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/bufferutils.js b/third-party/utxo-lib/bufferutils.js new file mode 100644 index 0000000..8479d9d --- /dev/null +++ b/third-party/utxo-lib/bufferutils.js @@ -0,0 +1,219 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BufferReader = exports.BufferWriter = exports.getChunkSize = exports.reverseBuffer = exports.writePushDataInt = exports.varIntSize = exports.readPushDataInt = exports.pushDataSize = void 0; +exports.verifuint = verifuint; +exports.readUInt64LE = readUInt64LE; +exports.readUInt64LEasString = readUInt64LEasString; +exports.readInt64LE = readInt64LE; +exports.writeUInt64LE = writeUInt64LE; +exports.writeUInt64LEasString = writeUInt64LEasString; +exports.writeInt64LE = writeInt64LE; +exports.readVarInt = readVarInt; +exports.writeVarInt = writeVarInt; +exports.cloneBuffer = cloneBuffer; +const tslib_1 = require("tslib"); +const bn_js_1 = tslib_1.__importDefault(require("bn.js")); +const pushdata_bitcoin_1 = tslib_1.__importDefault(require("pushdata-bitcoin")); +const varuint = tslib_1.__importStar(require("varuint-bitcoin")); +const int64_buffer_1 = require("int64-buffer"); +const utils_1 = require("../utils"); +const types = tslib_1.__importStar(require("./types")); +const OUT_OF_RANGE_ERROR = 'value out of range'; +function verifuint(value, max) { + if (typeof value !== 'number') + throw new Error('cannot write a non-number as a number'); + if (value < 0) + throw new Error('specified a negative value for writing an unsigned value'); + if (value > max) + throw new Error(OUT_OF_RANGE_ERROR); + if (Math.floor(value) !== value) + throw new Error('value has a fractional component'); +} +function readUInt64LE(buffer, offset) { + const a = buffer.readUInt32LE(offset); + let b = buffer.readUInt32LE(offset + 4); + b *= 0x100000000; + verifuint(b + a, 0x001fffffffffffff); + return b + a; +} +function readUInt64LEasString(buffer, offset) { + try { + const result = readUInt64LE(buffer, offset); + return result.toString(); + } + catch (_a) { + const aUint = buffer.readUInt32LE(offset); + const bUint = buffer.readUInt32LE(offset + 4); + const m = new bn_js_1.default(0x100000000); + const a = new bn_js_1.default(aUint); + const b = new bn_js_1.default(bUint).mul(m); + return a.add(b).toString(); + } +} +function readInt64LE(buffer, offset) { + const a = buffer.readUInt32LE(offset); + let b = buffer.readInt32LE(offset + 4); + b *= 0x100000000; + return b + a; +} +function writeUInt64LE(buffer, value, offset) { + verifuint(value, 0x001fffffffffffff); + buffer.writeInt32LE(value & -1, offset); + buffer.writeUInt32LE(Math.floor(value / 0x100000000), offset + 4); + return offset + 8; +} +function writeUInt64LEasString(buffer, value, offset) { + if (typeof value !== 'string') { + return writeUInt64LE(buffer, value, offset); + } + const v = new int64_buffer_1.Int64LE(value); + v.toBuffer().copy(buffer, offset); + return offset + 8; +} +function writeInt64LE(buffer, value, offset) { + const v = new int64_buffer_1.Int64LE(value); + const a = v.toArray(); + for (let i = 0; i < 8; i++) { + buffer.writeUInt8(a[i], offset + i); + } + return offset + 8; +} +function readVarInt(buffer, offset) { + const { numberValue, bytes } = varuint.decode(buffer, offset); + if (numberValue === null) + throw new Error(OUT_OF_RANGE_ERROR); + return { + number: numberValue, + size: bytes, + }; +} +function writeVarInt(buffer, number, offset) { + const { bytes } = varuint.encode(number, buffer, offset); + return bytes; +} +function cloneBuffer(buffer) { + const clone = Buffer.allocUnsafe(buffer.length); + buffer.copy(clone); + return clone; +} +exports.pushDataSize = pushdata_bitcoin_1.default.encodingLength; +exports.readPushDataInt = pushdata_bitcoin_1.default.decode; +exports.varIntSize = varuint.encodingLength; +exports.writePushDataInt = pushdata_bitcoin_1.default.encode; +exports.reverseBuffer = utils_1.bufferUtils.reverseBuffer, exports.getChunkSize = utils_1.bufferUtils.getChunkSize; +class BufferWriter { + constructor(buffer, offset = 0) { + this.buffer = buffer; + this.offset = offset; + types.typeforce(types.tuple(types.Buffer, types.UInt32), [buffer, offset]); + } + writeUInt8(i) { + this.offset = this.buffer.writeUInt8(i, this.offset); + } + writeUInt16(i) { + this.offset = this.buffer.writeUInt16LE(i, this.offset); + } + writeInt32(i) { + this.offset = this.buffer.writeInt32LE(i, this.offset); + } + writeUInt32(i) { + this.offset = this.buffer.writeUInt32LE(i, this.offset); + } + writeInt64(i) { + this.offset = writeInt64LE(this.buffer, i, this.offset); + } + writeUInt64(i) { + this.offset = + typeof i === 'string' + ? writeUInt64LEasString(this.buffer, i, this.offset) + : writeUInt64LE(this.buffer, i, this.offset); + } + writeVarInt(i) { + const { bytes } = varuint.encode(i, this.buffer, this.offset); + this.offset += bytes; + } + writeSlice(slice) { + if (this.buffer.length < this.offset + slice.length) { + throw new Error('Cannot write slice out of bounds'); + } + this.offset += slice.copy(this.buffer, this.offset); + } + writeVarSlice(slice) { + this.writeVarInt(slice.length); + this.writeSlice(slice); + } + writeVector(vector) { + this.writeVarInt(vector.length); + vector.forEach((buf) => this.writeVarSlice(buf)); + } +} +exports.BufferWriter = BufferWriter; +class BufferReader { + constructor(buffer, offset = 0) { + this.buffer = buffer; + this.offset = offset; + types.typeforce(types.tuple(types.Buffer, types.UInt32), [buffer, offset]); + } + readUInt8() { + const result = this.buffer.readUInt8(this.offset); + this.offset++; + return result; + } + readUInt16() { + const result = this.buffer.readUInt16LE(this.offset); + this.offset += 2; + return result; + } + readInt32() { + const result = this.buffer.readInt32LE(this.offset); + this.offset += 4; + return result; + } + readUInt32() { + const result = this.buffer.readUInt32LE(this.offset); + this.offset += 4; + return result; + } + readInt64() { + const result = readInt64LE(this.buffer, this.offset); + this.offset += 8; + return result; + } + readUInt64() { + const result = readUInt64LE(this.buffer, this.offset); + this.offset += 8; + return result; + } + readUInt64String() { + const result = readUInt64LEasString(this.buffer, this.offset); + this.offset += 8; + return result; + } + readVarInt() { + const { numberValue, bytes } = varuint.decode(this.buffer, this.offset); + if (numberValue === null) + throw new Error(OUT_OF_RANGE_ERROR); + this.offset += bytes; + return numberValue; + } + readSlice(n) { + if (this.buffer.length < this.offset + n) { + throw new Error('Cannot read slice out of bounds'); + } + const result = this.buffer.subarray(this.offset, this.offset + n); + this.offset += n; + return result; + } + readVarSlice() { + return this.readSlice(this.readVarInt()); + } + readVector() { + const count = this.readVarInt(); + const vector = []; + for (let i = 0; i < count; i++) + vector.push(this.readVarSlice()); + return vector; + } +} +exports.BufferReader = BufferReader; +//# sourceMappingURL=bufferutils.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/coinselect/coinselectUtils.d.ts b/third-party/utxo-lib/coinselect/coinselectUtils.d.ts new file mode 100644 index 0000000..9cb3080 --- /dev/null +++ b/third-party/utxo-lib/coinselect/coinselectUtils.d.ts @@ -0,0 +1,53 @@ +import BN from 'bn.js'; +import { CoinSelectPaymentType, CoinSelectAlgorithm, CoinSelectOptions, CoinSelectInput, CoinSelectOutput, CoinSelectOutputFinal } from '../types'; +import { Network } from '../networks'; +export declare const ZERO: BN; +export declare const INPUT_SCRIPT_LENGTH: Record; +export declare const OUTPUT_SCRIPT_LENGTH: Record; +type Vin = { + type: CoinSelectInput['type']; + script: { + length: number; + }; + weight?: number; +}; +type VinVout = { + script: { + length: number; + }; + weight?: number; +}; +export declare function getVarIntSize(length: number): 5 | 1 | 3 | 9; +export declare function inputWeight(input: Vin): number; +export declare function inputBytes(input: Vin): number; +export declare function outputWeight(output: VinVout): number; +export declare function outputBytes(output: VinVout): number; +export declare function getFeeForBytes(feeRate: number, bytes: number): number; +export declare function transactionWeight(inputs: Vin[], outputs: VinVout[]): number; +export declare function transactionBytes(inputs: Vin[], outputs: VinVout[]): number; +export declare function getDustAmount(feeRate: number, { txType, longTermFeeRate, dustThreshold, }: Pick): number; +export declare function bignumberOrNaN(v?: BN | string): BN | undefined; +export declare function bignumberOrNaN(v?: BN | string, forgiving?: F): F extends true ? BN : BN | undefined; +export declare function sumOrNaN(range: { + value?: BN; +}[]): BN | undefined; +export declare function sumOrNaN(range: { + value?: BN; +}[], forgiving: F): F extends true ? BN : BN | undefined; +export declare function getFeePolicy(network?: Network): "bitcoin" | "doge" | "zcash"; +export declare function getFee(inputs: CoinSelectInput[], outputs: CoinSelectOutput[], feeRate: number, { feePolicy, ...options }?: Partial): number; +export declare function finalize(inputs: CoinSelectInput[], outputs: CoinSelectOutput[], feeRate: number, options: CoinSelectOptions): { + fee: number; + inputs?: undefined; + outputs?: undefined; +} | { + inputs: CoinSelectInput[]; + outputs: CoinSelectOutputFinal[]; + fee: number; +}; +export declare function anyOf(algorithms: CoinSelectAlgorithm[]): CoinSelectAlgorithm; +export declare function utxoScore(x: CoinSelectInput, feeRate: number): BN; +export declare function sortByScore(feeRate: number): (a: CoinSelectInput, b: CoinSelectInput) => number; +export declare function filterCoinbase(utxos: CoinSelectInput[], minConfCoinbase: number): CoinSelectInput[]; +export {}; +//# sourceMappingURL=coinselectUtils.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/coinselect/coinselectUtils.js b/third-party/utxo-lib/coinselect/coinselectUtils.js new file mode 100644 index 0000000..6bddb43 --- /dev/null +++ b/third-party/utxo-lib/coinselect/coinselectUtils.js @@ -0,0 +1,232 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OUTPUT_SCRIPT_LENGTH = exports.INPUT_SCRIPT_LENGTH = exports.ZERO = void 0; +exports.getVarIntSize = getVarIntSize; +exports.inputWeight = inputWeight; +exports.inputBytes = inputBytes; +exports.outputWeight = outputWeight; +exports.outputBytes = outputBytes; +exports.getFeeForBytes = getFeeForBytes; +exports.transactionWeight = transactionWeight; +exports.transactionBytes = transactionBytes; +exports.getDustAmount = getDustAmount; +exports.bignumberOrNaN = bignumberOrNaN; +exports.sumOrNaN = sumOrNaN; +exports.getFeePolicy = getFeePolicy; +exports.getFee = getFee; +exports.finalize = finalize; +exports.anyOf = anyOf; +exports.utxoScore = utxoScore; +exports.sortByScore = sortByScore; +exports.filterCoinbase = filterCoinbase; +const tslib_1 = require("tslib"); +const bn_js_1 = tslib_1.__importDefault(require("bn.js")); +const networks_1 = require("../networks"); +exports.ZERO = new bn_js_1.default(0); +exports.INPUT_SCRIPT_LENGTH = { + p2pkh: 108, + p2sh: 107, + p2tr: 65, + p2wpkh: 107, + p2wsh: 107, +}; +exports.OUTPUT_SCRIPT_LENGTH = { + p2pkh: 25, + p2sh: 23, + p2tr: 34, + p2wpkh: 22, + p2wsh: 34, +}; +const SEGWIT_INPUT_SCRIPT_TYPES = ['p2sh', 'p2tr', 'p2wpkh', 'p2wsh']; +const TX_BASE = 32; +const INPUT_SIZE = 160; +const DUST_RELAY_FEE_RATE = 3; +function getVarIntSize(length) { + if (length < 253) + return 1; + if (length < 65536) + return 3; + if (length < 4294967296) + return 5; + return 9; +} +function inputWeight(input) { + if (input.weight) + return input.weight; + let weight = INPUT_SIZE; + if (!SEGWIT_INPUT_SCRIPT_TYPES.includes(input.type)) { + weight += 4 * input.script.length; + } + else { + if (input.type === 'p2sh') { + weight += 4 * (2 + 22); + } + else { + weight += 4; + } + weight += 1 + input.script.length; + } + return weight; +} +function inputBytes(input) { + return Math.ceil(inputWeight(input) / 4); +} +function outputWeight(output) { + if (output.weight) + return output.weight; + return 4 * (8 + 1 + output.script.length); +} +function outputBytes(output) { + return Math.ceil(outputWeight(output) / 4); +} +function getFeeForBytes(feeRate, bytes) { + return Math.ceil(feeRate * bytes); +} +function transactionWeight(inputs, outputs) { + const segwitInputs = inputs.filter(i => SEGWIT_INPUT_SCRIPT_TYPES.includes(i.type)).length; + return (TX_BASE + + 4 * getVarIntSize(inputs.length) + + inputs.reduce((x, i) => x + inputWeight(i), 0) + + 4 * getVarIntSize(outputs.length) + + outputs.reduce((x, o) => x + outputWeight(o), 0) + + (segwitInputs ? 2 + (inputs.length - segwitInputs) : 0)); +} +function transactionBytes(inputs, outputs) { + return Math.ceil(transactionWeight(inputs, outputs) / 4); +} +function getDustAmount(feeRate, { txType, longTermFeeRate, dustThreshold, }) { + const inputSize = inputBytes({ + type: txType, + script: { + length: exports.INPUT_SCRIPT_LENGTH[txType], + }, + }); + const longTermFee = longTermFeeRate ? Math.min(feeRate, longTermFeeRate) : 0; + const dustRelayFeeRate = Math.max(longTermFee, DUST_RELAY_FEE_RATE); + return Math.max(dustThreshold || 0, getFeeForBytes(dustRelayFeeRate, inputSize)); +} +function bignumberOrNaN(v, forgiving = false) { + if (bn_js_1.default.isBN(v)) + return v; + const defaultValue = forgiving ? exports.ZERO : undefined; + if (!v || typeof v !== 'string' || !/^\d+$/.test(v)) + return defaultValue; + try { + return new bn_js_1.default(v); + } + catch (_a) { + return defaultValue; + } +} +function sumOrNaN(range, forgiving = false) { + return range.reduce((a, x) => { + if (!a) + return a; + const value = bignumberOrNaN(x.value); + if (!value) + return forgiving ? exports.ZERO.add(a) : undefined; + return value.add(a); + }, exports.ZERO); +} +function getFeePolicy(network) { + if ((0, networks_1.isNetworkType)('doge', network)) + return 'doge'; + if ((0, networks_1.isNetworkType)('zcash', network)) + return 'zcash'; + return 'bitcoin'; +} +function getBitcoinFee(inputs, outputs, feeRate, { baseFee = 0, floorBaseFee }) { + const bytes = transactionBytes(inputs, outputs); + const defaultFee = getFeeForBytes(feeRate, bytes); + return baseFee && floorBaseFee + ? + baseFee * (1 + Math.floor(defaultFee / baseFee)) + : + baseFee + defaultFee; +} +function getDogeFee(inputs, outputs, feeRate, _a) { + var { dustThreshold = 0 } = _a, options = tslib_1.__rest(_a, ["dustThreshold"]); + const fee = getBitcoinFee(inputs, outputs, feeRate, options); + const limit = new bn_js_1.default(dustThreshold); + const dustOutputsCount = outputs.filter(({ value }) => value && value.lt(limit)).length; + return fee + dustOutputsCount * dustThreshold; +} +const MARGINAL_FEE_ZAT_PER_ACTION = 5000; +const GRACE_ACTIONS = 2; +const P2PKH_STANDARD_INPUT_SIZE = 150; +const P2PKH_STANDARD_OUTPUT_SIZE = 34; +function getZcashFee(inputs, outputs, feeRate, options) { + const fee = getBitcoinFee(inputs, outputs, feeRate, options); + const txInTotalBytes = inputs.reduce((sum, i) => sum + inputBytes(i), 0); + const txOutTotalBytes = outputs.reduce((sum, o) => sum + outputBytes(o), 0); + const actions = Math.max(GRACE_ACTIONS, Math.ceil(txInTotalBytes / P2PKH_STANDARD_INPUT_SIZE), Math.ceil(txOutTotalBytes / P2PKH_STANDARD_OUTPUT_SIZE)); + return Math.max(actions * MARGINAL_FEE_ZAT_PER_ACTION, fee); +} +function getFee(inputs, outputs, feeRate, _a = {}) { + var { feePolicy } = _a, options = tslib_1.__rest(_a, ["feePolicy"]); + switch (feePolicy) { + case 'doge': + return getDogeFee(inputs, outputs, feeRate, options); + case 'zcash': + return getZcashFee(inputs, outputs, feeRate, options); + default: + return getBitcoinFee(inputs, outputs, feeRate, options); + } +} +function finalize(inputs, outputs, feeRate, options) { + const changeOutput = options.changeOutput || { + script: { length: exports.OUTPUT_SCRIPT_LENGTH[options.txType] }, + }; + const fee = getFee(inputs, outputs, feeRate, options); + const feeAfterExtraOutput = getFee(inputs, [...outputs, changeOutput], feeRate, options); + const sumInputs = sumOrNaN(inputs); + const sumOutputs = sumOrNaN(outputs); + if (!sumInputs || !sumOutputs || sumInputs.sub(sumOutputs).lt(new bn_js_1.default(fee))) { + return { fee }; + } + const remainderAfterExtraOutput = sumInputs.sub(sumOutputs.add(new bn_js_1.default(feeAfterExtraOutput))); + const dustAmount = getDustAmount(feeRate, options); + const finalOutputs = [...outputs]; + if (remainderAfterExtraOutput.gte(new bn_js_1.default(dustAmount))) { + finalOutputs.push(Object.assign(Object.assign({}, changeOutput), { value: remainderAfterExtraOutput })); + } + return { + inputs, + outputs: finalOutputs, + fee: sumInputs.sub(sumOrNaN(finalOutputs, true)).toNumber(), + }; +} +function anyOf(algorithms) { + return (utxos, outputs, feeRate, options) => { + let result = { fee: 0 }; + for (let i = 0; i < algorithms.length; i++) { + const algorithm = algorithms[i]; + result = algorithm(utxos, outputs, feeRate, options); + if (result.inputs) { + return result; + } + } + return result; + }; +} +function utxoScore(x, feeRate) { + return x.value.sub(new bn_js_1.default(getFeeForBytes(feeRate, inputBytes(x)))); +} +function sortByScore(feeRate) { + return (a, b) => { + const difference = utxoScore(a, feeRate).sub(utxoScore(b, feeRate)); + if (difference.eq(exports.ZERO)) { + return a.i - b.i; + } + return difference.isNeg() ? 1 : -1; + }; +} +function filterCoinbase(utxos, minConfCoinbase) { + return utxos.filter(utxo => { + if (utxo.coinbase && !utxo.required) { + return utxo.confirmations >= minConfCoinbase; + } + return true; + }); +} +//# sourceMappingURL=coinselectUtils.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/coinselect/index.d.ts b/third-party/utxo-lib/coinselect/index.d.ts new file mode 100644 index 0000000..bc93226 --- /dev/null +++ b/third-party/utxo-lib/coinselect/index.d.ts @@ -0,0 +1,3 @@ +import { CoinSelectRequest } from '../types'; +export declare function coinselect({ inputs, outputs, feeRate, ...options }: CoinSelectRequest): import("../types").CoinSelectResult; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/coinselect/index.js b/third-party/utxo-lib/coinselect/index.js new file mode 100644 index 0000000..d84b362 --- /dev/null +++ b/third-party/utxo-lib/coinselect/index.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.coinselect = coinselect; +const tslib_1 = require("tslib"); +const accumulative_1 = require("./inputs/accumulative"); +const branchAndBound_1 = require("./inputs/branchAndBound"); +const split_1 = require("./outputs/split"); +const coinselectUtils_1 = require("./coinselectUtils"); +const tryconfirmed_1 = require("./tryconfirmed"); +function coinselect(_a) { + var { inputs, outputs, feeRate } = _a, options = tslib_1.__rest(_a, ["inputs", "outputs", "feeRate"]); + if (options.sendMaxOutputIndex >= 0) { + return (0, split_1.split)(inputs, outputs, feeRate, options); + } + const sortedInputs = options.sortingStrategy === 'none' ? inputs : inputs.sort((0, coinselectUtils_1.sortByScore)(feeRate)); + const algorithm = (0, tryconfirmed_1.tryConfirmed)((0, coinselectUtils_1.anyOf)([branchAndBound_1.branchAndBound, accumulative_1.accumulative]), options); + return algorithm(sortedInputs, outputs, feeRate, options); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/coinselect/inputs/accumulative.d.ts b/third-party/utxo-lib/coinselect/inputs/accumulative.d.ts new file mode 100644 index 0000000..0a44cb5 --- /dev/null +++ b/third-party/utxo-lib/coinselect/inputs/accumulative.d.ts @@ -0,0 +1,3 @@ +import { CoinSelectAlgorithm } from '../../types'; +export declare const accumulative: CoinSelectAlgorithm; +//# sourceMappingURL=accumulative.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/coinselect/inputs/accumulative.js b/third-party/utxo-lib/coinselect/inputs/accumulative.js new file mode 100644 index 0000000..c21ed02 --- /dev/null +++ b/third-party/utxo-lib/coinselect/inputs/accumulative.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.accumulative = void 0; +const tslib_1 = require("tslib"); +const bn_js_1 = tslib_1.__importDefault(require("bn.js")); +const coinselectUtils_1 = require("../coinselectUtils"); +const accumulative = (utxos0, outputs, feeRate, options) => { + let inAccum = coinselectUtils_1.ZERO; + const inputs = []; + const outAccum = (0, coinselectUtils_1.sumOrNaN)(outputs); + const requiredUtxos = []; + const utxos = []; + utxos0.forEach(u => { + if (u.required) { + requiredUtxos.push(u); + const utxoValue = (0, coinselectUtils_1.bignumberOrNaN)(u.value, true); + inAccum = inAccum.add(utxoValue); + inputs.push(u); + } + else { + utxos.push(u); + } + }); + if (requiredUtxos.length > 0) { + const requiredIsEnough = (0, coinselectUtils_1.finalize)(requiredUtxos, outputs, feeRate, options); + if (requiredIsEnough.inputs) { + return requiredIsEnough; + } + } + for (let i = 0; i < utxos.length; ++i) { + const utxo = utxos[i]; + const utxoBytes = (0, coinselectUtils_1.inputBytes)(utxo); + const utxoFee = (0, coinselectUtils_1.getFeeForBytes)(feeRate, utxoBytes); + const utxoValue = (0, coinselectUtils_1.bignumberOrNaN)(utxo.value); + if (!utxoValue || utxoValue.lt(new bn_js_1.default(utxoFee))) { + if (i === utxos.length - 1) { + const fee = (0, coinselectUtils_1.getFee)([...inputs, utxo], outputs, feeRate, options); + return { fee }; + } + } + else { + inAccum = inAccum.add(utxoValue); + inputs.push(utxo); + const fee = (0, coinselectUtils_1.getFee)(inputs, outputs, feeRate, options); + const outAccumWithFee = outAccum ? outAccum.add(new bn_js_1.default(fee)) : coinselectUtils_1.ZERO; + if (inAccum.gte(outAccumWithFee)) { + return (0, coinselectUtils_1.finalize)(inputs, outputs, feeRate, options); + } + } + } + const fee = (0, coinselectUtils_1.getFee)(inputs, outputs, feeRate, options); + return { fee }; +}; +exports.accumulative = accumulative; +//# sourceMappingURL=accumulative.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/coinselect/inputs/branchAndBound.d.ts b/third-party/utxo-lib/coinselect/inputs/branchAndBound.d.ts new file mode 100644 index 0000000..36084e2 --- /dev/null +++ b/third-party/utxo-lib/coinselect/inputs/branchAndBound.d.ts @@ -0,0 +1,3 @@ +import { CoinSelectAlgorithm } from '../../types'; +export declare const branchAndBound: CoinSelectAlgorithm; +//# sourceMappingURL=branchAndBound.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/coinselect/inputs/branchAndBound.js b/third-party/utxo-lib/coinselect/inputs/branchAndBound.js new file mode 100644 index 0000000..978a129 --- /dev/null +++ b/third-party/utxo-lib/coinselect/inputs/branchAndBound.js @@ -0,0 +1,123 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.branchAndBound = void 0; +const tslib_1 = require("tslib"); +const bn_js_1 = tslib_1.__importDefault(require("bn.js")); +const coinselectUtils_1 = require("../coinselectUtils"); +const MAX_TRIES = 1000000; +function calculateEffectiveValues(utxos, feeRate) { + return utxos.map(utxo => { + const value = (0, coinselectUtils_1.bignumberOrNaN)(utxo.value); + if (!value) { + return { + utxo, + effectiveValue: coinselectUtils_1.ZERO, + }; + } + const effectiveFee = (0, coinselectUtils_1.getFeeForBytes)(feeRate, (0, coinselectUtils_1.inputBytes)(utxo)); + const effectiveValue = value.sub(new bn_js_1.default(effectiveFee)); + return { + utxo, + effectiveValue, + }; + }); +} +function search(effectiveUtxos, target, costRange) { + if (effectiveUtxos.length === 0) { + return null; + } + let tries = MAX_TRIES; + const selected = []; + let selectedAccum = coinselectUtils_1.ZERO; + let done = false; + let backtrack = false; + let remaining = effectiveUtxos.reduce((a, x) => x.effectiveValue.add(a), coinselectUtils_1.ZERO); + let depth = 0; + while (!done) { + if (tries <= 0) { + return null; + } + if (selectedAccum.gt(costRange)) { + backtrack = true; + } + else if (selectedAccum.gte(target)) { + done = true; + } + else if (depth >= effectiveUtxos.length) { + backtrack = true; + } + else if (selectedAccum.add(remaining).lt(target)) { + if (depth === 0) { + return null; + } + backtrack = true; + } + else { + remaining = remaining.sub(effectiveUtxos[depth].effectiveValue); + selected[depth] = true; + selectedAccum = selectedAccum.add(effectiveUtxos[depth].effectiveValue); + depth++; + } + if (backtrack) { + backtrack = false; + depth--; + while (!selected[depth]) { + remaining = remaining.add(effectiveUtxos[depth].effectiveValue); + depth--; + if (depth < 0) { + return null; + } + } + selected[depth] = false; + selectedAccum = selectedAccum.sub(effectiveUtxos[depth].effectiveValue); + depth++; + } + tries--; + } + return selected; +} +const branchAndBound = (utxos, outputs, feeRate, options) => { + if (options.baseFee) + return { fee: 0 }; + if (utxos.find(u => u.required)) + return { fee: 0 }; + const changeOutputFee = (0, coinselectUtils_1.getFeeForBytes)(feeRate, (0, coinselectUtils_1.outputBytes)({ + script: { + length: coinselectUtils_1.OUTPUT_SCRIPT_LENGTH[options.txType], + }, + })); + const costOfChange = changeOutputFee + (0, coinselectUtils_1.getDustAmount)(feeRate, options); + const outputsBytes = (0, coinselectUtils_1.transactionBytes)([], outputs); + const outputsFee = (0, coinselectUtils_1.getFeeForBytes)(feeRate, outputsBytes); + const outputsTotalValue = (0, coinselectUtils_1.sumOrNaN)(outputs); + if (!outputsTotalValue) + return { fee: 0 }; + const target = outputsTotalValue.add(new bn_js_1.default(outputsFee)); + const targetRange = target.add(new bn_js_1.default(costOfChange)); + const effectiveUtxos = calculateEffectiveValues(utxos, feeRate) + .filter(({ effectiveValue }) => effectiveValue.gt(coinselectUtils_1.ZERO) && effectiveValue.lte(targetRange)) + .sort((a, b) => { + const subtract = b.effectiveValue.sub(a.effectiveValue).toNumber(); + if (subtract !== 0) { + return subtract; + } + return a.utxo.i - b.utxo.i; + }); + const utxosTotalEffectiveValue = effectiveUtxos.reduce((total, { effectiveValue }) => total.add(effectiveValue), coinselectUtils_1.ZERO); + if (utxosTotalEffectiveValue.lt(target)) { + return { fee: 0 }; + } + const selected = search(effectiveUtxos, target, targetRange); + if (selected !== null) { + const inputs = []; + for (let i = 0; i < effectiveUtxos.length; i++) { + if (selected[i]) { + inputs.push(effectiveUtxos[i].utxo); + } + } + return (0, coinselectUtils_1.finalize)(inputs, outputs, feeRate, options); + } + return { fee: 0 }; +}; +exports.branchAndBound = branchAndBound; +//# sourceMappingURL=branchAndBound.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/coinselect/outputs/split.d.ts b/third-party/utxo-lib/coinselect/outputs/split.d.ts new file mode 100644 index 0000000..4f5d25f --- /dev/null +++ b/third-party/utxo-lib/coinselect/outputs/split.d.ts @@ -0,0 +1,3 @@ +import { CoinSelectInput, CoinSelectOutput, CoinSelectOptions, CoinSelectResult } from '../../types'; +export declare function split(utxosOrig: CoinSelectInput[], outputs: CoinSelectOutput[], feeRate: number, options: CoinSelectOptions): CoinSelectResult; +//# sourceMappingURL=split.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/coinselect/outputs/split.js b/third-party/utxo-lib/coinselect/outputs/split.js new file mode 100644 index 0000000..73775f7 --- /dev/null +++ b/third-party/utxo-lib/coinselect/outputs/split.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.split = split; +const tslib_1 = require("tslib"); +const bn_js_1 = tslib_1.__importDefault(require("bn.js")); +const coinselectUtils_1 = require("../coinselectUtils"); +function split(utxosOrig, outputs, feeRate, options) { + const coinbase = options.coinbase || 100; + const utxos = (0, coinselectUtils_1.filterCoinbase)(utxosOrig, coinbase); + const fee = (0, coinselectUtils_1.getFee)(utxos, outputs, feeRate, options); + if (outputs.length === 0) + return { fee }; + const inAccum = (0, coinselectUtils_1.sumOrNaN)(utxos); + const outAccum = (0, coinselectUtils_1.sumOrNaN)(outputs, true); + if (!inAccum) + return { fee }; + const remaining = inAccum.sub(outAccum).sub(new bn_js_1.default(fee)); + if (remaining.lt(coinselectUtils_1.ZERO)) + return { fee }; + const unspecified = outputs.reduce((a, x) => a + (!(0, coinselectUtils_1.bignumberOrNaN)(x.value) ? 1 : 0), 0); + if (remaining.isZero() || unspecified === 0) { + return (0, coinselectUtils_1.finalize)(utxos, outputs, feeRate, options); + } + const splitValue = remaining.div(new bn_js_1.default(unspecified)); + const dustAmount = (0, coinselectUtils_1.getDustAmount)(feeRate, options); + if (unspecified && splitValue.lt(new bn_js_1.default(dustAmount))) + return { fee }; + const outputsSplit = outputs.map(output => { + if (output.value) + return output; + return Object.assign(Object.assign({}, output), { value: splitValue }); + }); + return (0, coinselectUtils_1.finalize)(utxos, outputsSplit, feeRate, options); +} +//# sourceMappingURL=split.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/coinselect/tryconfirmed.d.ts b/third-party/utxo-lib/coinselect/tryconfirmed.d.ts new file mode 100644 index 0000000..2c36b4c --- /dev/null +++ b/third-party/utxo-lib/coinselect/tryconfirmed.d.ts @@ -0,0 +1,3 @@ +import { CoinSelectAlgorithm, CoinSelectOptions } from '../types'; +export declare function tryConfirmed(algorithm: CoinSelectAlgorithm, options: CoinSelectOptions): CoinSelectAlgorithm; +//# sourceMappingURL=tryconfirmed.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/coinselect/tryconfirmed.js b/third-party/utxo-lib/coinselect/tryconfirmed.js new file mode 100644 index 0000000..ea7f96b --- /dev/null +++ b/third-party/utxo-lib/coinselect/tryconfirmed.js @@ -0,0 +1,65 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.tryConfirmed = tryConfirmed; +const coinselectUtils_1 = require("./coinselectUtils"); +function filterUtxos(utxos, minConfOwn, minConfOther) { + const usable = []; + const unusable = []; + for (let i = 0; i < utxos.length; i++) { + const utxo = utxos[i]; + const isUsed = utxo.own + ? utxo.confirmations >= minConfOwn + : utxo.confirmations >= minConfOther; + if (isUsed || utxo.required) { + usable.push(utxo); + } + else { + unusable.push(utxo); + } + } + return { + usable, + unusable, + }; +} +function tryConfirmed(algorithm, options) { + const own = options.own || 1; + const other = options.other || 6; + const coinbase = options.coinbase || 100; + return (utxosO, outputs, feeRate, optionsIn) => { + const utxos = (0, coinselectUtils_1.filterCoinbase)(utxosO, coinbase); + if (utxos.length === 0) { + return { fee: 0 }; + } + const trials = []; + let i; + for (i = own; i > 0; i--) { + trials.push({ other, own: i }); + } + for (i = other - 1; i > 0; i--) { + trials.push({ other: i, own: 1 }); + } + trials.push({ other: 1, own: 0 }); + trials.push({ other: 0, own: 0 }); + let unusable = utxos; + let usable = []; + for (i = 0; i < trials.length; i++) { + const trial = trials[i]; + const filterResult = filterUtxos(unusable, trial.own, trial.other); + if (filterResult.usable.length > 0) { + usable = usable.concat(filterResult.usable); + const unusableH = filterResult.unusable; + unusable = unusableH; + const result = algorithm(usable, outputs, feeRate, optionsIn); + if (result.inputs) { + return result; + } + if (unusable.length === 0) { + return result; + } + } + } + throw new Error('Unexpected unreturned result'); + }; +} +//# sourceMappingURL=tryconfirmed.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/index.d.ts b/third-party/utxo-lib/compose/index.d.ts new file mode 100644 index 0000000..acca401 --- /dev/null +++ b/third-party/utxo-lib/compose/index.d.ts @@ -0,0 +1,3 @@ +import { ComposeRequest, ComposeInput, ComposeOutput, ComposeChangeAddress, ComposeResult } from '../types'; +export declare function composeTx(request: ComposeRequest): ComposeResult; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/index.js b/third-party/utxo-lib/compose/index.js new file mode 100644 index 0000000..f2987b7 --- /dev/null +++ b/third-party/utxo-lib/compose/index.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.composeTx = composeTx; +const request_1 = require("./request"); +const result_1 = require("./result"); +const coinselect_1 = require("../coinselect"); +function composeTx(request) { + const coinselectRequest = (0, request_1.validateAndParseRequest)(request); + if ('error' in coinselectRequest) { + return coinselectRequest; + } + try { + const result = (0, coinselect_1.coinselect)(coinselectRequest); + return (0, result_1.getResult)(request, coinselectRequest, result); + } + catch (error) { + return (0, result_1.getErrorResult)(error); + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/request.d.ts b/third-party/utxo-lib/compose/request.d.ts new file mode 100644 index 0000000..f41a028 --- /dev/null +++ b/third-party/utxo-lib/compose/request.d.ts @@ -0,0 +1,5 @@ +import type { ComposeInput, ComposeOutput, ComposeChangeAddress, ComposeRequest, ComposeResultError, CoinSelectRequest } from '../types'; +type Request = ComposeRequest; +export declare function validateAndParseRequest(request: Request): CoinSelectRequest | ComposeResultError; +export {}; +//# sourceMappingURL=request.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/request.js b/third-party/utxo-lib/compose/request.js new file mode 100644 index 0000000..6b3a950 --- /dev/null +++ b/third-party/utxo-lib/compose/request.js @@ -0,0 +1,168 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateAndParseRequest = validateAndParseRequest; +const address_1 = require("../address"); +const embed_1 = require("../payments/embed"); +const coinselectUtils_1 = require("../coinselect/coinselectUtils"); +function validateAndParseFeeRate(rate) { + const feeRate = typeof rate === 'string' ? Number(rate) : rate; + if (typeof feeRate !== 'number' || + Number.isNaN(feeRate) || + !Number.isFinite(feeRate) || + feeRate > Number.MAX_SAFE_INTEGER || + feeRate <= 0) { + return; + } + return feeRate; +} +function transformInput(i, utxo, txType) { + if (typeof utxo.coinbase !== 'boolean') { + throw new Error('Missing coinbase'); + } + if (typeof utxo.own !== 'boolean') { + throw new Error('Missing own'); + } + if (typeof utxo.confirmations !== 'number') { + throw new Error('Missing confirmations'); + } + const value = (0, coinselectUtils_1.bignumberOrNaN)(utxo.amount); + if (!value) { + throw new Error('Invalid amount'); + } + return Object.assign(Object.assign({}, utxo), { type: txType, i, script: { length: coinselectUtils_1.INPUT_SCRIPT_LENGTH[txType] }, value }); +} +function validateAndParseUtxos(txType, { utxos }) { + if (utxos.length === 0) { + return { type: 'error', error: 'MISSING-UTXOS' }; + } + const incorrectUtxoError = (index, message) => ({ + type: 'error', + error: 'INCORRECT-UTXO', + message: `${message} at index ${index}`, + }); + const result = []; + for (let i = 0; i < utxos.length; i++) { + try { + const csInput = transformInput(i, utxos[i], txType); + csInput.weight = (0, coinselectUtils_1.inputWeight)(csInput); + result.push(csInput); + } + catch (error) { + return incorrectUtxoError(i, error.message); + } + } + return result; +} +function transformOutput(output, txType, network) { + const script = { length: coinselectUtils_1.OUTPUT_SCRIPT_LENGTH[txType] }; + if (output.type === 'payment') { + const value = (0, coinselectUtils_1.bignumberOrNaN)(output.amount); + if (!value) + throw new Error('Invalid amount'); + return { + value, + script: (0, address_1.toOutputScript)(output.address, network), + }; + } + if (output.type === 'payment-noaddress') { + const value = (0, coinselectUtils_1.bignumberOrNaN)(output.amount); + if (!value) + throw new Error('Invalid amount'); + return { + value, + script, + }; + } + if (output.type === 'opreturn') { + return { + value: (0, coinselectUtils_1.bignumberOrNaN)('0', true), + script: (0, embed_1.p2data)({ data: [Buffer.from(output.dataHex, 'hex')] }).output, + }; + } + if (output.type === 'send-max') { + return { + script: (0, address_1.toOutputScript)(output.address, network), + }; + } + if (output.type === 'send-max-noaddress') { + return { + script, + }; + } + throw new Error('Unknown output type'); +} +function validateAndParseOutputs(txType, { outputs, network }) { + if (outputs.length === 0) { + return { type: 'error', error: 'MISSING-OUTPUTS' }; + } + const incorrectOutputError = (index, message) => ({ + type: 'error', + error: 'INCORRECT-OUTPUT', + message: `${message} at index ${index}`, + }); + let sendMaxOutputIndex = -1; + const result = []; + for (let i = 0; i < outputs.length; i++) { + const output = outputs[i]; + if (output.type === 'send-max-noaddress' || output.type === 'send-max') { + if (sendMaxOutputIndex >= 0) { + return incorrectOutputError(i, 'Multiple send-max'); + } + sendMaxOutputIndex = i; + } + try { + const csOutput = transformOutput(output, txType, network); + csOutput.weight = (0, coinselectUtils_1.outputWeight)(csOutput); + result.push(csOutput); + } + catch (error) { + return incorrectOutputError(i, error.message); + } + } + return { + outputs: result, + sendMaxOutputIndex, + }; +} +function validateAndParseChangeOutput(txType, { changeAddress, network }) { + try { + return transformOutput(Object.assign({ type: 'send-max' }, changeAddress), txType, network); + } + catch (error) { + return { + type: 'error', + error: 'INCORRECT-OUTPUT', + message: error.message, + }; + } +} +function validateAndParseRequest(request) { + const feeRate = validateAndParseFeeRate(request.feeRate); + if (!feeRate) { + return { type: 'error', error: 'INCORRECT-FEE-RATE' }; + } + const longTermFeeRate = validateAndParseFeeRate(request.longTermFeeRate); + if (request.longTermFeeRate != null && !longTermFeeRate) { + return { type: 'error', error: 'INCORRECT-FEE-RATE' }; + } + const txType = request.txType || 'p2pkh'; + const inputs = validateAndParseUtxos(txType, request); + if ('error' in inputs) { + return inputs; + } + const outputs = validateAndParseOutputs(txType, request); + if ('error' in outputs) { + return outputs; + } + const changeOutput = validateAndParseChangeOutput(txType, request); + if ('error' in changeOutput) { + return changeOutput; + } + const feePolicy = (0, coinselectUtils_1.getFeePolicy)(request.network); + return Object.assign(Object.assign({ txType, + inputs }, outputs), { changeOutput, + feeRate, + feePolicy, + longTermFeeRate, dustThreshold: request.dustThreshold, baseFee: request.baseFee, floorBaseFee: request.floorBaseFee, sortingStrategy: request.sortingStrategy }); +} +//# sourceMappingURL=request.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/result.d.ts b/third-party/utxo-lib/compose/result.d.ts new file mode 100644 index 0000000..bbf70d4 --- /dev/null +++ b/third-party/utxo-lib/compose/result.d.ts @@ -0,0 +1,4 @@ +import { CoinSelectRequest, CoinSelectResult, ComposeRequest, ComposeInput, ComposeOutput, ComposeChangeAddress, ComposeResult, ComposeResultError } from '../types'; +export declare function getErrorResult(error: unknown): ComposeResultError; +export declare function getResult(request: ComposeRequest, { sendMaxOutputIndex }: CoinSelectRequest, result: CoinSelectResult): ComposeResult; +//# sourceMappingURL=result.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/result.js b/third-party/utxo-lib/compose/result.js new file mode 100644 index 0000000..a5547db --- /dev/null +++ b/third-party/utxo-lib/compose/result.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getErrorResult = getErrorResult; +exports.getResult = getResult; +const tslib_1 = require("tslib"); +const bn_js_1 = tslib_1.__importDefault(require("bn.js")); +const coinselectUtils_1 = require("../coinselect/coinselectUtils"); +const transaction_1 = require("./transaction"); +const types_1 = require("../types"); +function getErrorResult(error) { + const message = error instanceof Error ? error.message : `${error}`; + const known = types_1.COMPOSE_ERROR_TYPES.find(e => e === message); + if (known) { + return { type: 'error', error: known }; + } + return { type: 'error', error: 'COINSELECT', message }; +} +function splitByCompleteness(outputs) { + const complete = []; + const incomplete = []; + outputs.forEach(output => { + if (output.type === 'payment' || output.type === 'send-max' || output.type === 'opreturn') { + complete.push(output); + } + else { + incomplete.push(output); + } + }); + return { + complete, + incomplete, + }; +} +function getResult(request, { sendMaxOutputIndex }, result) { + if (!result.inputs || !result.outputs) { + return { type: 'error', error: 'NOT-ENOUGH-FUNDS' }; + } + const totalSpent = result.outputs.reduce((total, output, index) => { + if (request.outputs[index]) { + return total.add(output.value); + } + return total; + }, new bn_js_1.default(result.fee)); + const max = sendMaxOutputIndex >= 0 ? result.outputs[sendMaxOutputIndex].value.toString() : undefined; + const bytes = (0, coinselectUtils_1.transactionBytes)(result.inputs, result.outputs); + const feePerByte = result.fee / bytes; + const { complete, incomplete } = splitByCompleteness(request.outputs); + if (incomplete.length > 0) { + const inputs = result.inputs.map(input => request.utxos[input.i]); + return { + type: 'nonfinal', + fee: result.fee.toString(), + feePerByte: feePerByte.toString(), + bytes, + max, + totalSpent: totalSpent.toString(), + inputs, + }; + } + const transaction = (0, transaction_1.createTransaction)(Object.assign(Object.assign({}, request), { outputs: complete }), result); + return Object.assign({ type: 'final', fee: result.fee.toString(), feePerByte: feePerByte.toString(), bytes, + max, totalSpent: totalSpent.toString() }, transaction); +} +//# sourceMappingURL=result.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/sorting/bip69SortingStrategy.d.ts b/third-party/utxo-lib/compose/sorting/bip69SortingStrategy.d.ts new file mode 100644 index 0000000..8af1b2d --- /dev/null +++ b/third-party/utxo-lib/compose/sorting/bip69SortingStrategy.d.ts @@ -0,0 +1,3 @@ +import { SortingStrategy } from './sortingStrategy'; +export declare const bip69SortingStrategy: SortingStrategy; +//# sourceMappingURL=bip69SortingStrategy.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/sorting/bip69SortingStrategy.js b/third-party/utxo-lib/compose/sorting/bip69SortingStrategy.js new file mode 100644 index 0000000..252f771 --- /dev/null +++ b/third-party/utxo-lib/compose/sorting/bip69SortingStrategy.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.bip69SortingStrategy = void 0; +const convertOutput_1 = require("./convertOutput"); +function inputComparator(a, b) { + return Buffer.from(a.txid, 'hex').compare(Buffer.from(b.txid, 'hex')) || a.vout - b.vout; +} +function outputComparator(a, b) { + return (a.value.cmp(b.value) || + (Buffer.isBuffer(a.script) && Buffer.isBuffer(b.script) + ? a.script.compare(b.script) + : a.script.length - b.script.length)); +} +const bip69SortingStrategy = ({ result, request, convertedInputs }) => { + const defaultPermutation = []; + const convertedOutputs = result.outputs.map((output, index) => { + defaultPermutation.push(index); + if (request.outputs[index]) { + return (0, convertOutput_1.convertOutput)(output, request.outputs[index]); + } + return (0, convertOutput_1.convertOutput)(output, Object.assign({ type: 'change' }, request.changeAddress)); + }); + const permutation = defaultPermutation.sort((a, b) => outputComparator(result.outputs[a], result.outputs[b])); + const sortedOutputs = permutation.map(index => convertedOutputs[index]); + return { + inputs: convertedInputs.sort(inputComparator), + outputs: sortedOutputs, + outputsPermutation: permutation, + }; +}; +exports.bip69SortingStrategy = bip69SortingStrategy; +//# sourceMappingURL=bip69SortingStrategy.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/sorting/convertOutput.d.ts b/third-party/utxo-lib/compose/sorting/convertOutput.d.ts new file mode 100644 index 0000000..28bfbf5 --- /dev/null +++ b/third-party/utxo-lib/compose/sorting/convertOutput.d.ts @@ -0,0 +1,13 @@ +import { CoinSelectOutputFinal, ComposeChangeAddress, ComposeFinalOutput } from '../../types'; +export declare const convertOutput: (selectedOutput: CoinSelectOutputFinal, composeOutput: ComposeFinalOutput | ({ + type: "change"; +} & ComposeChangeAddress)) => import("../../types").ComposeOutputOpreturn | { + amount: string; + type: "change"; + address: string; +} | { + type: "payment"; + amount: string; + address: string; +}; +//# sourceMappingURL=convertOutput.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/sorting/convertOutput.js b/third-party/utxo-lib/compose/sorting/convertOutput.js new file mode 100644 index 0000000..7f036ae --- /dev/null +++ b/third-party/utxo-lib/compose/sorting/convertOutput.js @@ -0,0 +1,14 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.convertOutput = void 0; +const convertOutput = (selectedOutput, composeOutput) => { + if (composeOutput.type === 'change') { + return Object.assign(Object.assign({}, composeOutput), { amount: selectedOutput.value.toString() }); + } + if (composeOutput.type === 'opreturn') { + return composeOutput; + } + return Object.assign(Object.assign({}, composeOutput), { type: 'payment', amount: selectedOutput.value.toString() }); +}; +exports.convertOutput = convertOutput; +//# sourceMappingURL=convertOutput.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/sorting/noneSortingStrategy.d.ts b/third-party/utxo-lib/compose/sorting/noneSortingStrategy.d.ts new file mode 100644 index 0000000..a7a21c5 --- /dev/null +++ b/third-party/utxo-lib/compose/sorting/noneSortingStrategy.d.ts @@ -0,0 +1,3 @@ +import { SortingStrategy } from './sortingStrategy'; +export declare const noneSortingStrategy: SortingStrategy; +//# sourceMappingURL=noneSortingStrategy.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/sorting/noneSortingStrategy.js b/third-party/utxo-lib/compose/sorting/noneSortingStrategy.js new file mode 100644 index 0000000..c2641e9 --- /dev/null +++ b/third-party/utxo-lib/compose/sorting/noneSortingStrategy.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.noneSortingStrategy = void 0; +const convertOutput_1 = require("./convertOutput"); +const noneSortingStrategy = ({ result, request, convertedInputs }) => { + const convertedOutputs = result.outputs.map((output, index) => { + if (request.outputs[index]) { + return (0, convertOutput_1.convertOutput)(output, request.outputs[index]); + } + return (0, convertOutput_1.convertOutput)(output, Object.assign({ type: 'change' }, request.changeAddress)); + }); + return { + inputs: convertedInputs, + outputs: convertedOutputs, + outputsPermutation: Array.from(convertedOutputs.keys()), + }; +}; +exports.noneSortingStrategy = noneSortingStrategy; +//# sourceMappingURL=noneSortingStrategy.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/sorting/randomSortingStrategy.d.ts b/third-party/utxo-lib/compose/sorting/randomSortingStrategy.d.ts new file mode 100644 index 0000000..26e4a4b --- /dev/null +++ b/third-party/utxo-lib/compose/sorting/randomSortingStrategy.d.ts @@ -0,0 +1,3 @@ +import { SortingStrategy } from './sortingStrategy'; +export declare const randomSortingStrategy: SortingStrategy; +//# sourceMappingURL=randomSortingStrategy.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/sorting/randomSortingStrategy.js b/third-party/utxo-lib/compose/sorting/randomSortingStrategy.js new file mode 100644 index 0000000..7cef8cd --- /dev/null +++ b/third-party/utxo-lib/compose/sorting/randomSortingStrategy.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.randomSortingStrategy = void 0; +const utils_1 = require("../../../utils"); +const convertOutput_1 = require("./convertOutput"); +const randomSortingStrategy = ({ result, request, convertedInputs }) => { + const nonChangeOutputPermutation = []; + const changeOutputPermutation = []; + const convertedOutputs = result.outputs.map((output, index) => { + if (request.outputs[index]) { + nonChangeOutputPermutation.push(index); + return (0, convertOutput_1.convertOutput)(output, request.outputs[index]); + } + changeOutputPermutation.push(index); + return (0, convertOutput_1.convertOutput)(output, Object.assign({ type: 'change' }, request.changeAddress)); + }); + const permutation = [...nonChangeOutputPermutation]; + const newPositionOfChange = (0, utils_1.getRandomInt)(0, permutation.length + 1); + permutation.splice(newPositionOfChange, 0, ...changeOutputPermutation); + const sortedOutputs = permutation.map(index => convertedOutputs[index]); + return { + inputs: (0, utils_1.arrayShuffle)(convertedInputs, { randomInt: utils_1.getRandomInt }), + outputs: sortedOutputs, + outputsPermutation: permutation, + }; +}; +exports.randomSortingStrategy = randomSortingStrategy; +//# sourceMappingURL=randomSortingStrategy.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/sorting/sortingStrategy.d.ts b/third-party/utxo-lib/compose/sorting/sortingStrategy.d.ts new file mode 100644 index 0000000..269355f --- /dev/null +++ b/third-party/utxo-lib/compose/sorting/sortingStrategy.d.ts @@ -0,0 +1,9 @@ +import { CoinSelectSuccess, ComposeChangeAddress, ComposedTransaction, ComposeFinalOutput, ComposeInput, ComposeRequest } from '../../types'; +type SortingStrategyParams = { + request: ComposeRequest; + result: CoinSelectSuccess; + convertedInputs: Input[]; +}; +export type SortingStrategy = (params: SortingStrategyParams) => ComposedTransaction; +export {}; +//# sourceMappingURL=sortingStrategy.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/sorting/sortingStrategy.js b/third-party/utxo-lib/compose/sorting/sortingStrategy.js new file mode 100644 index 0000000..e56e3fd --- /dev/null +++ b/third-party/utxo-lib/compose/sorting/sortingStrategy.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=sortingStrategy.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/transaction.d.ts b/third-party/utxo-lib/compose/transaction.d.ts new file mode 100644 index 0000000..010ecc6 --- /dev/null +++ b/third-party/utxo-lib/compose/transaction.d.ts @@ -0,0 +1,3 @@ +import { ComposeRequest, CoinSelectSuccess, ComposeInput, ComposeChangeAddress, ComposeFinalOutput, ComposedTransaction } from '../types'; +export declare function createTransaction(request: ComposeRequest, result: CoinSelectSuccess): ComposedTransaction; +//# sourceMappingURL=transaction.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/compose/transaction.js b/third-party/utxo-lib/compose/transaction.js new file mode 100644 index 0000000..adb5f70 --- /dev/null +++ b/third-party/utxo-lib/compose/transaction.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createTransaction = createTransaction; +const noneSortingStrategy_1 = require("./sorting/noneSortingStrategy"); +const bip69SortingStrategy_1 = require("./sorting/bip69SortingStrategy"); +const randomSortingStrategy_1 = require("./sorting/randomSortingStrategy"); +const strategyMap = { + bip69: bip69SortingStrategy_1.bip69SortingStrategy, + none: noneSortingStrategy_1.noneSortingStrategy, + random: randomSortingStrategy_1.randomSortingStrategy, +}; +function createTransaction(request, result) { + const convertedInputs = result.inputs.map(input => request.utxos[input.i]); + return strategyMap[request.sortingStrategy]({ result, request, convertedInputs }); +} +//# sourceMappingURL=transaction.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/crypto.d.ts b/third-party/utxo-lib/crypto.d.ts new file mode 100644 index 0000000..411db30 --- /dev/null +++ b/third-party/utxo-lib/crypto.d.ts @@ -0,0 +1,9 @@ +export declare function ripemd160(buffer: Buffer): Buffer; +export declare function sha1(buffer: Buffer): Buffer; +export declare function sha256(buffer: Buffer): Buffer; +export declare function blake256(buffer: Buffer): Buffer; +export declare function hash160(buffer: Buffer): Buffer; +export declare function hash160blake256(buffer: Buffer): Buffer; +export declare function hash256(buffer: Buffer): Buffer; +export declare function hmacSHA512(key: Buffer, data: Buffer): Buffer; +//# sourceMappingURL=crypto.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/crypto.js b/third-party/utxo-lib/crypto.js new file mode 100644 index 0000000..ec9fa6e --- /dev/null +++ b/third-party/utxo-lib/crypto.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ripemd160 = ripemd160; +exports.sha1 = sha1; +exports.sha256 = sha256; +exports.blake256 = blake256; +exports.hash160 = hash160; +exports.hash160blake256 = hash160blake256; +exports.hash256 = hash256; +exports.hmacSHA512 = hmacSHA512; +const tslib_1 = require("tslib"); +const blake_hash_1 = tslib_1.__importDefault(require("blake-hash")); +const create_hmac_1 = tslib_1.__importDefault(require("create-hmac")); +const crypto_1 = require("crypto"); +function ripemd160(buffer) { + try { + return (0, crypto_1.createHash)('rmd160').update(buffer).digest(); + } + catch (_a) { + return (0, crypto_1.createHash)('ripemd160').update(buffer).digest(); + } +} +function sha1(buffer) { + return (0, crypto_1.createHash)('sha1').update(buffer).digest(); +} +function sha256(buffer) { + return (0, crypto_1.createHash)('sha256').update(buffer).digest(); +} +function blake256(buffer) { + return (0, blake_hash_1.default)('blake256').update(buffer).digest(); +} +function hash160(buffer) { + return ripemd160(sha256(buffer)); +} +function hash160blake256(buffer) { + return ripemd160(blake256(buffer)); +} +function hash256(buffer) { + return sha256(sha256(buffer)); +} +function hmacSHA512(key, data) { + return (0, create_hmac_1.default)('sha512', key).update(data).digest(); +} +//# sourceMappingURL=crypto.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/derivation.d.ts b/third-party/utxo-lib/derivation.d.ts new file mode 100644 index 0000000..1cdec7b --- /dev/null +++ b/third-party/utxo-lib/derivation.d.ts @@ -0,0 +1,24 @@ +import { Network } from './networks'; +declare const BIP32_PAYMENT_TYPES: { + readonly 76067358: "p2pkh"; + readonly 77429938: "p2sh"; + readonly 78792518: "p2wpkh"; + readonly 70617039: "p2pkh"; + readonly 71979618: "p2sh"; + readonly 73342198: "p2wpkh"; + readonly 27108450: "p2pkh"; + readonly 28471030: "p2sh"; +}; +type VersionBytes = keyof typeof BIP32_PAYMENT_TYPES; +export type PaymentType = (typeof BIP32_PAYMENT_TYPES)[VersionBytes] | 'p2tr'; +export declare const getXpubOrDescriptorInfo: (descriptor: string, network?: Network) => { + levels: string[]; + paymentType: PaymentType; + node: import("./bip32").BIP32Interface; +}; +export declare const deriveAddresses: (descriptor: string, type: "receive" | "change", from: number, count: number, network?: Network) => { + address: string; + path: string; +}[]; +export {}; +//# sourceMappingURL=derivation.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/derivation.js b/third-party/utxo-lib/derivation.js new file mode 100644 index 0000000..7fb02bd --- /dev/null +++ b/third-party/utxo-lib/derivation.js @@ -0,0 +1,121 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.deriveAddresses = exports.getXpubOrDescriptorInfo = void 0; +const tslib_1 = require("tslib"); +const bs58_1 = tslib_1.__importDefault(require("bs58")); +const utils_1 = require("../utils"); +const payments_1 = require("./payments"); +const bip32_1 = require("./bip32"); +const networks_1 = require("./networks"); +const BIP32_PAYMENT_TYPES = { + 0x0488b21e: 'p2pkh', + 0x049d7cb2: 'p2sh', + 0x04b24746: 'p2wpkh', + 0x043587cf: 'p2pkh', + 0x044a5262: 'p2sh', + 0x045f1cf6: 'p2wpkh', + 0x019da462: 'p2pkh', + 0x01b26ef6: 'p2sh', +}; +const BIP32_COIN_TYPES = { + 0x0488b21e: "0'", + 0x049d7cb2: "0'", + 0x04b24746: "0'", + 0x043587cf: "1'", + 0x044a5262: "1'", + 0x045f1cf6: "1'", + 0x019da462: "2'", + 0x01b26ef6: "2'", +}; +const BIP32_PURPOSES = { + p2pkh: "44'", + p2sh: "49'", + p2wpkh: "84'", + p2tr: "86'", +}; +const validateVersion = (version) => !!BIP32_PAYMENT_TYPES[version]; +const getVersion = (xpub) => { + const version = Buffer.from(bs58_1.default.decode(xpub)).readUInt32BE(); + if (!validateVersion(version)) + throw new Error(`Unknown xpub version: ${xpub}`); + return version; +}; +const getPubkeyToPayment = (type, network) => (pubkey) => { + switch (type) { + case 'p2pkh': + return (0, payments_1.p2pkh)({ pubkey, network }); + case 'p2sh': + return (0, payments_1.p2sh)({ + redeem: (0, payments_1.p2wpkh)({ + pubkey, + network, + }), + network, + }); + case 'p2wpkh': + return (0, payments_1.p2wpkh)({ pubkey, network }); + case 'p2tr': + return (0, payments_1.p2tr)({ pubkey, network }); + default: + throw new Error(`Unknown payment type '${type}'`); + } +}; +const getBip32Node = (xpub, version, network) => (0, bip32_1.fromBase58)(xpub, Object.assign(Object.assign({}, network), { bip32: Object.assign(Object.assign({}, network.bip32), { public: version }) })); +const getXpubInfo = (xpub, network) => { + const version = getVersion(xpub); + const paymentType = BIP32_PAYMENT_TYPES[version]; + const coinType = network.wif === 0xb0 + ? "2'" + : BIP32_COIN_TYPES[version]; + const purpose = BIP32_PURPOSES[paymentType]; + const node = getBip32Node(xpub, version, network); + const account = `${(node.index << 1) >>> 1}'`; + const levels = [purpose, coinType, account]; + return { + levels, + paymentType, + node, + }; +}; +const getDescriptorInfo = (paymentType, descriptor, network) => { + const [_match, _script, path, xpub, _checksum] = descriptor.match(/^([a-z]+\()+\[([a-z0-9]{8}(?:\/[0-9]+'?){3,})\]([xyztuv]pub[a-zA-Z0-9]*)\/<0;1>\/\*\)+(#[a-z0-9]{8})?$/) || (0, utils_1.throwError)(`Descriptor cannot be parsed: ${descriptor}`); + const [_fingerprint, ...levels] = path.split('/'); + const version = getVersion(xpub); + const node = getBip32Node(xpub, version, network); + return { + levels, + paymentType, + node, + }; +}; +const getXpubOrDescriptorInfo = (descriptor, network = networks_1.bitcoin) => { + if (descriptor.startsWith('pkh(')) { + return getDescriptorInfo('p2pkh', descriptor, network); + } + if (descriptor.startsWith('sh(wpkh(')) { + return getDescriptorInfo('p2sh', descriptor, network); + } + if (descriptor.startsWith('wpkh(')) { + return getDescriptorInfo('p2wpkh', descriptor, network); + } + if (descriptor.startsWith('tr(')) { + return getDescriptorInfo('p2tr', descriptor, network); + } + return getXpubInfo(descriptor, network); +}; +exports.getXpubOrDescriptorInfo = getXpubOrDescriptorInfo; +const deriveAddresses = (descriptor, type, from, count, network = networks_1.bitcoin) => { + const { levels, node, paymentType } = (0, exports.getXpubOrDescriptorInfo)(descriptor, network); + const getAddress = getPubkeyToPayment(paymentType, network); + const change = type === 'receive' ? 0 : 1; + const changeNode = node.derive(change); + return Array.from(Array(count).keys()) + .map(i => changeNode.derive(from + i).publicKey) + .map(a => getAddress(a).address || (0, utils_1.throwError)('Cannot convert pubkey to address')) + .map((address, i) => ({ + address, + path: `m/${levels.join('/')}/${change}/${from + i}`, + })); +}; +exports.deriveAddresses = deriveAddresses; +//# sourceMappingURL=derivation.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/discovery.d.ts b/third-party/utxo-lib/discovery.d.ts new file mode 100644 index 0000000..953fa5d --- /dev/null +++ b/third-party/utxo-lib/discovery.d.ts @@ -0,0 +1,9 @@ +import { deriveAddresses } from './derivation'; +import type { Network } from './networks'; +export type AddressInfo = ReturnType[number]; +export type AddressResult = T & { + empty: boolean; +}; +export declare const countUnusedFromEnd: (array: T[], isUnused: (t: T) => boolean, lookout: number) => number; +export declare const discovery: (discover: (addr: AddressInfo) => Promise>, xpub: string, type: "receive" | "change", network?: Network, lookout?: number) => Promise[]>; +//# sourceMappingURL=discovery.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/discovery.js b/third-party/utxo-lib/discovery.js new file mode 100644 index 0000000..0959c85 --- /dev/null +++ b/third-party/utxo-lib/discovery.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.discovery = exports.countUnusedFromEnd = void 0; +const tslib_1 = require("tslib"); +const derivation_1 = require("./derivation"); +const DISCOVERY_LOOKOUT = 20; +const countUnusedFromEnd = (array, isUnused, lookout) => { + const boundary = array.length > lookout ? array.length - lookout : 0; + for (let i = array.length; i > boundary; --i) { + if (!isUnused(array[i - 1])) { + return array.length - i; + } + } + return array.length; +}; +exports.countUnusedFromEnd = countUnusedFromEnd; +const discovery = (discover, xpub, type, network, lookout = DISCOVERY_LOOKOUT) => { + const discoverRecursive = (from, prev) => tslib_1.__awaiter(void 0, void 0, void 0, function* () { + const unused = (0, exports.countUnusedFromEnd)(prev, a => a.empty, lookout); + if (unused >= lookout) + return prev; + const moreCount = lookout - unused; + const addresses = (0, derivation_1.deriveAddresses)(xpub, type, from, moreCount, network); + const more = yield Promise.all(addresses.map(discover)); + return discoverRecursive(from + moreCount, prev.concat(more)); + }); + return discoverRecursive(0, []); +}; +exports.discovery = discovery; +//# sourceMappingURL=discovery.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/global.d.ts b/third-party/utxo-lib/global.d.ts new file mode 100644 index 0000000..d771d0d --- /dev/null +++ b/third-party/utxo-lib/global.d.ts @@ -0,0 +1,62 @@ +declare module 'typeforce' { + interface Typeforce { + (type: any, value: any, strict?: any, surrogate?: any): boolean; + Array(value: any): value is any[]; + ArrayN(length: number): (value: any) => value is any[]; + Boolean(value: any): value is boolean; + Buffer(value: any): value is Buffer; + BufferN(length: number): (value: any) => value is Buffer; + Finite(value: any): value is number; + Function(value: any): value is FunctionConstructor; + Hex(value: any): value is string; + HexN(length: number): (value: any) => value is string; + Nil(value: any): boolean; + Number(value: any): value is number; + Object(value: any): value is ObjectConstructor; + Range(a: any, b: any, f: any): boolean; + String(value: any): value is string; + StringN(length: number): (value: any) => value is string; + Int8(value: any): value is number; + Int16(value: any): value is number; + Int32(value: any): value is number; + Int53(value: any): value is number; + UInt8(value: any): value is number; + UInt16(value: any): value is number; + UInt32(value: any): value is number; + UInt53(value: any): value is number; + arrayOf(type: any, options?: any): boolean; + maybe(type: any): boolean; + map(propertyType: any, propertyKeyType: any): boolean; + object(uncompiled: any): boolean; + anyOf(...args: any[]): (value: any) => boolean; + allOf(...args: any[]): boolean; + quacksLike(type: T): type is T; + tuple(...args: any[]): boolean; + value(...expected: any[]): (value: any) => boolean; + compile(type: any): boolean; + } + const tf: Typeforce; + export = tf; +} +declare module 'bip66' { + function check(buffer: Buffer): boolean; + function decode(buffer: Buffer): { + r: Buffer; + s: Buffer; + }; + function encode(r: Buffer, s: Buffer): Buffer; +} +declare module 'bitcoin-ops'; +declare module 'minimaldata'; +declare module 'tiny-secp256k1'; +declare module 'pushdata-bitcoin' { + function encodingLength(len: number): number; + function encode(buffer: Buffer, number: number, offset: number): number; + function decode(buffer: Buffer, offset: number): { + opcode: number; + number: number; + size: number; + }; +} +declare module 'blake-hash'; +//# sourceMappingURL=global.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/global.js b/third-party/utxo-lib/global.js new file mode 100644 index 0000000..dc2ece7 --- /dev/null +++ b/third-party/utxo-lib/global.js @@ -0,0 +1,2 @@ +"use strict"; +//# sourceMappingURL=global.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/index.d.ts b/third-party/utxo-lib/index.d.ts new file mode 100644 index 0000000..4ebff7b --- /dev/null +++ b/third-party/utxo-lib/index.d.ts @@ -0,0 +1,18 @@ +import * as address from './address'; +import * as bip32 from './bip32'; +import * as bufferutils from './bufferutils'; +import * as crypto from './crypto'; +import * as payments from './payments'; +import * as script from './script'; +import * as networks from './networks'; +import { composeTx } from './compose'; +import { deriveAddresses, getXpubOrDescriptorInfo } from './derivation'; +import { discovery } from './discovery'; +export { Transaction } from './transaction'; +export { address, bip32, bufferutils, crypto, payments, script, networks, composeTx, deriveAddresses, getXpubOrDescriptorInfo, discovery, }; +export type { PaymentType } from './derivation'; +export type { ComposeInput, ComposeOutput, ComposeChangeAddress, ComposeRequest, ComposeResult, ComposeResultNonFinal, ComposeResultError, ComposeResultFinal, ComposedTransaction, CoinSelectPaymentType, } from './types'; +export type { Network } from './networks'; +export type { BIP32Interface } from './bip32'; +export type { TransactionInputOutputSortingStrategy } from './types/compose'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/index.js b/third-party/utxo-lib/index.js new file mode 100644 index 0000000..358161c --- /dev/null +++ b/third-party/utxo-lib/index.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.discovery = exports.getXpubOrDescriptorInfo = exports.deriveAddresses = exports.composeTx = exports.networks = exports.script = exports.payments = exports.crypto = exports.bufferutils = exports.bip32 = exports.address = exports.Transaction = void 0; +const tslib_1 = require("tslib"); +const address = tslib_1.__importStar(require("./address")); +exports.address = address; +const bip32 = tslib_1.__importStar(require("./bip32")); +exports.bip32 = bip32; +const bufferutils = tslib_1.__importStar(require("./bufferutils")); +exports.bufferutils = bufferutils; +const crypto = tslib_1.__importStar(require("./crypto")); +exports.crypto = crypto; +const payments = tslib_1.__importStar(require("./payments")); +exports.payments = payments; +const script = tslib_1.__importStar(require("./script")); +exports.script = script; +const networks = tslib_1.__importStar(require("./networks")); +exports.networks = networks; +const compose_1 = require("./compose"); +Object.defineProperty(exports, "composeTx", { enumerable: true, get: function () { return compose_1.composeTx; } }); +const derivation_1 = require("./derivation"); +Object.defineProperty(exports, "deriveAddresses", { enumerable: true, get: function () { return derivation_1.deriveAddresses; } }); +Object.defineProperty(exports, "getXpubOrDescriptorInfo", { enumerable: true, get: function () { return derivation_1.getXpubOrDescriptorInfo; } }); +const discovery_1 = require("./discovery"); +Object.defineProperty(exports, "discovery", { enumerable: true, get: function () { return discovery_1.discovery; } }); +var transaction_1 = require("./transaction"); +Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return transaction_1.Transaction; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/networks.d.ts b/third-party/utxo-lib/networks.d.ts new file mode 100644 index 0000000..891794b --- /dev/null +++ b/third-party/utxo-lib/networks.d.ts @@ -0,0 +1,45 @@ +export interface Bip32 { + public: number; + private: number; +} +export interface Network { + messagePrefix: string; + bech32: string; + bip32: Bip32; + pubKeyHash: number; + scriptHash: number; + wif: number; + forkId?: number; +} +export declare const bitcoin: Network; +export declare const regtest: Network; +export declare const testnet: Network; +export declare const bitcoincash: Network; +export declare const bitcoincashTest: Network; +export declare const bitcoingold: Network; +export declare const litecoin: Network; +export declare const litecoinTest: Network; +export declare const dash: Network; +export declare const dashTest: Network; +export declare const zcash: Network; +export declare const zcashTest: Network; +export declare const peercoin: Network; +export declare const peercoinTest: Network; +export declare const komodo: Network; +export declare const decred: Network; +export declare const decredTest: Network; +export declare const decredSim: Network; +export declare const doge: Network; +declare const NETWORK_TYPES: { + bitcoinCash: Network[]; + dash: Network[]; + decred: Network[]; + peercoin: Network[]; + zcash: Network[]; + litecoin: Network[]; + doge: Network[]; +}; +export type NetworkTypes = keyof typeof NETWORK_TYPES; +export declare function isNetworkType(type: NetworkTypes, network?: Network): boolean; +export {}; +//# sourceMappingURL=networks.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/networks.js b/third-party/utxo-lib/networks.js new file mode 100644 index 0000000..e590f96 --- /dev/null +++ b/third-party/utxo-lib/networks.js @@ -0,0 +1,250 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.doge = exports.decredSim = exports.decredTest = exports.decred = exports.komodo = exports.peercoinTest = exports.peercoin = exports.zcashTest = exports.zcash = exports.dashTest = exports.dash = exports.litecoinTest = exports.litecoin = exports.bitcoingold = exports.bitcoincashTest = exports.bitcoincash = exports.testnet = exports.regtest = exports.bitcoin = void 0; +exports.isNetworkType = isNetworkType; +const typeforce_1 = require("./types/typeforce"); +exports.bitcoin = { + messagePrefix: '\x18Bitcoin Signed Message:\n', + bech32: 'bc', + bip32: { + public: 0x0488b21e, + private: 0x0488ade4, + }, + pubKeyHash: 0x00, + scriptHash: 0x05, + wif: 0x80, +}; +exports.regtest = { + messagePrefix: '\x18Bitcoin Signed Message:\n', + bech32: 'bcrt', + bip32: { + public: 0x043587cf, + private: 0x04358394, + }, + pubKeyHash: 0x6f, + scriptHash: 0xc4, + wif: 0xef, +}; +exports.testnet = { + messagePrefix: '\x18Bitcoin Signed Message:\n', + bech32: 'tb', + bip32: { + public: 0x043587cf, + private: 0x04358394, + }, + pubKeyHash: 0x6f, + scriptHash: 0xc4, + wif: 0xef, +}; +exports.bitcoincash = { + messagePrefix: '\x18Bitcoin Signed Message:\n', + bech32: '', + bip32: { + public: 0x0488b21e, + private: 0x0488ade4, + }, + pubKeyHash: 0x00, + scriptHash: 0x05, + wif: 0x80, + forkId: 0x00, +}; +exports.bitcoincashTest = { + messagePrefix: '\x18Bitcoin Signed Message:\n', + bech32: '', + bip32: { + public: 0x043587cf, + private: 0x04358394, + }, + pubKeyHash: 0x6f, + scriptHash: 0xc4, + wif: 0xef, + forkId: 0x00, +}; +exports.bitcoingold = { + messagePrefix: '\x18Bitcoin Gold Signed Message:\n', + bech32: 'btg', + bip32: { + public: 0x0488b21e, + private: 0x0488ade4, + }, + pubKeyHash: 0x26, + scriptHash: 0x17, + wif: 0x80, + forkId: 0x4f, +}; +exports.litecoin = { + messagePrefix: '\x19Litecoin Signed Message:\n', + bech32: 'ltc', + bip32: { + public: 0x019da462, + private: 0x019d9cfe, + }, + pubKeyHash: 0x30, + scriptHash: 0x32, + wif: 0xb0, +}; +exports.litecoinTest = { + messagePrefix: '\x19Litecoin Signed Message:\n', + bech32: 'tltc', + bip32: { + public: 0x043587cf, + private: 0x04358394, + }, + pubKeyHash: 0x6f, + scriptHash: 0x3a, + wif: 0xb0, +}; +exports.dash = { + messagePrefix: '\x19DarkCoin Signed Message:\n', + bech32: '', + bip32: { + public: 0x02fe52cc, + private: 0x2fe52f8, + }, + pubKeyHash: 0x4c, + scriptHash: 0x10, + wif: 0xcc, +}; +exports.dashTest = { + messagePrefix: '\x19DarkCoin Signed Message:\n', + bech32: '', + bip32: { + public: 0x043587cf, + private: 0x04358394, + }, + pubKeyHash: 0x8c, + scriptHash: 0x13, + wif: 0xef, +}; +exports.zcash = { + messagePrefix: '\x18ZCash Signed Message:\n', + bech32: '', + bip32: { + public: 0x0488b21e, + private: 0x0488ade4, + }, + pubKeyHash: 0x1cb8, + scriptHash: 0x1cbd, + wif: 0x80, +}; +exports.zcashTest = { + messagePrefix: '\x18ZCash Signed Message:\n', + bech32: '', + bip32: { + public: 0x043587cf, + private: 0x04358394, + }, + pubKeyHash: 0x1d25, + scriptHash: 0x1cba, + wif: 0xef, +}; +exports.peercoin = { + messagePrefix: '\x18Peercoin Signed Message:\n', + bech32: 'pc', + bip32: { + public: 0x488b21e, + private: 0x0488ade4, + }, + pubKeyHash: 0x37, + scriptHash: 0x75, + wif: 0, +}; +exports.peercoinTest = { + messagePrefix: '\x18Peercoin Signed Message:\n', + bech32: 'tpc', + bip32: { + public: 0x43587cf, + private: 0x04358394, + }, + pubKeyHash: 0x6f, + scriptHash: 0xc4, + wif: 0, +}; +exports.komodo = { + messagePrefix: '\x18Komodo Signed Message:\n', + bech32: '', + bip32: { + public: 0x0488b21e, + private: 0x0488ade4, + }, + pubKeyHash: 0x3c, + scriptHash: 0x55, + wif: 0xbc, +}; +exports.decred = { + messagePrefix: '\x17Decred Signed Message:\n', + bech32: '', + bip32: { + public: 0x02fda926, + private: 0x02fda4e8, + }, + pubKeyHash: 0x073f, + scriptHash: 0x071a, + wif: 0x22de, +}; +exports.decredTest = { + messagePrefix: '\x17Decred Signed Message:\n', + bech32: '', + bip32: { + public: 0x043587d1, + private: 0x04358397, + }, + pubKeyHash: 0x0f21, + scriptHash: 0x0efc, + wif: 0x230e, +}; +exports.decredSim = { + messagePrefix: '\x17Decred Signed Message:\n', + bech32: '', + bip32: { + public: 0x0420bd3d, + private: 0x0420b903, + }, + pubKeyHash: 0x0e91, + scriptHash: 0x0e6c, + wif: 0x2307, +}; +exports.doge = { + messagePrefix: '\x19Dogecoin Signed Message:\n', + bech32: '', + bip32: { + public: 0x02facafd, + private: 0x02fac398, + }, + pubKeyHash: 0x1e, + scriptHash: 0x16, + wif: 0x9e, +}; +const NETWORK_TYPES = { + bitcoinCash: [exports.bitcoincash, exports.bitcoincashTest], + dash: [exports.dash, exports.dashTest], + decred: [exports.decred, exports.decredTest, exports.decredSim], + peercoin: [exports.peercoin, exports.peercoinTest], + zcash: [exports.zcash, exports.zcashTest, exports.komodo], + litecoin: [exports.litecoin, exports.litecoinTest], + doge: [exports.doge], +}; +function isNetworkType(type, network) { + if (typeof type !== 'string' || !network || !NETWORK_TYPES[type]) + return false; + try { + (0, typeforce_1.typeforce)({ + bip32: { + public: typeforce_1.typeforce.UInt32, + private: typeforce_1.typeforce.UInt32, + }, + pubKeyHash: typeforce_1.typeforce.anyOf(typeforce_1.typeforce.UInt8, typeforce_1.typeforce.UInt16), + scriptHash: typeforce_1.typeforce.anyOf(typeforce_1.typeforce.UInt8, typeforce_1.typeforce.UInt16), + }, network); + } + catch (_a) { + return false; + } + return !!NETWORK_TYPES[type].find(n => n.bip32.public === network.bip32.public && + n.bip32.private === network.bip32.private && + ((!n.bech32 && !network.bech32) || n.bech32 === network.bech32) && + ((!n.forkId && !network.forkId) || n.forkId === network.forkId) && + n.pubKeyHash === network.pubKeyHash && + n.scriptHash === network.scriptHash); +} +//# sourceMappingURL=networks.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/embed.d.ts b/third-party/utxo-lib/payments/embed.d.ts new file mode 100644 index 0000000..7f7ccb9 --- /dev/null +++ b/third-party/utxo-lib/payments/embed.d.ts @@ -0,0 +1,3 @@ +import { Payment, PaymentOpts } from '../types'; +export declare function p2data(a: Payment, opts?: PaymentOpts): Payment; +//# sourceMappingURL=embed.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/embed.js b/third-party/utxo-lib/payments/embed.js new file mode 100644 index 0000000..1ef504e --- /dev/null +++ b/third-party/utxo-lib/payments/embed.js @@ -0,0 +1,49 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.p2data = p2data; +const tslib_1 = require("tslib"); +const networks_1 = require("../networks"); +const bscript = tslib_1.__importStar(require("../script")); +const lazy = tslib_1.__importStar(require("./lazy")); +const types_1 = require("../types"); +const { OPS } = bscript; +function stacksEqual(a, b) { + if (a.length !== b.length) + return false; + return a.every((x, i) => x.equals(b[i])); +} +function p2data(a, opts) { + if (!a.data && !a.output) + throw new TypeError('Not enough data'); + opts = Object.assign({ validate: true }, opts || {}); + (0, types_1.typeforce)({ + network: types_1.typeforce.maybe(types_1.typeforce.Object), + output: types_1.typeforce.maybe(types_1.typeforce.Buffer), + data: types_1.typeforce.maybe(types_1.typeforce.arrayOf(types_1.typeforce.Buffer)), + }, a); + const network = a.network || networks_1.bitcoin; + const o = { name: 'embed', network }; + lazy.prop(o, 'output', () => { + if (!a.data) + return; + return bscript.compile([OPS.OP_RETURN].concat(a.data)); + }); + lazy.prop(o, 'data', () => { + if (!a.output) + return; + return bscript.decompile(a.output).slice(1); + }); + if (opts.validate) { + if (a.output) { + const chunks = bscript.decompile(a.output); + if (chunks[0] !== OPS.OP_RETURN) + throw new TypeError('Output is invalid'); + if (!chunks.slice(1).every(types_1.typeforce.Buffer)) + throw new TypeError('Output is invalid'); + if (a.data && !stacksEqual(a.data, o.data)) + throw new TypeError('Data mismatch'); + } + } + return Object.assign(o, a); +} +//# sourceMappingURL=embed.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/index.d.ts b/third-party/utxo-lib/payments/index.d.ts new file mode 100644 index 0000000..566ad17 --- /dev/null +++ b/third-party/utxo-lib/payments/index.d.ts @@ -0,0 +1,13 @@ +export { p2data as embed } from './embed'; +export { p2ms } from './p2ms'; +export { p2pk } from './p2pk'; +export { p2pkh } from './p2pkh'; +export { p2sh } from './p2sh'; +export { p2tr } from './p2tr'; +export { p2wpkh } from './p2wpkh'; +export { p2wsh } from './p2wsh'; +export { sstxchange } from './sstxchange'; +export { sstxcommitment } from './sstxcommitment'; +export { sstxpkh } from './sstxpkh'; +export { sstxsh } from './sstxsh'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/index.js b/third-party/utxo-lib/payments/index.js new file mode 100644 index 0000000..1ddcc63 --- /dev/null +++ b/third-party/utxo-lib/payments/index.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sstxsh = exports.sstxpkh = exports.sstxcommitment = exports.sstxchange = exports.p2wsh = exports.p2wpkh = exports.p2tr = exports.p2sh = exports.p2pkh = exports.p2pk = exports.p2ms = exports.embed = void 0; +var embed_1 = require("./embed"); +Object.defineProperty(exports, "embed", { enumerable: true, get: function () { return embed_1.p2data; } }); +var p2ms_1 = require("./p2ms"); +Object.defineProperty(exports, "p2ms", { enumerable: true, get: function () { return p2ms_1.p2ms; } }); +var p2pk_1 = require("./p2pk"); +Object.defineProperty(exports, "p2pk", { enumerable: true, get: function () { return p2pk_1.p2pk; } }); +var p2pkh_1 = require("./p2pkh"); +Object.defineProperty(exports, "p2pkh", { enumerable: true, get: function () { return p2pkh_1.p2pkh; } }); +var p2sh_1 = require("./p2sh"); +Object.defineProperty(exports, "p2sh", { enumerable: true, get: function () { return p2sh_1.p2sh; } }); +var p2tr_1 = require("./p2tr"); +Object.defineProperty(exports, "p2tr", { enumerable: true, get: function () { return p2tr_1.p2tr; } }); +var p2wpkh_1 = require("./p2wpkh"); +Object.defineProperty(exports, "p2wpkh", { enumerable: true, get: function () { return p2wpkh_1.p2wpkh; } }); +var p2wsh_1 = require("./p2wsh"); +Object.defineProperty(exports, "p2wsh", { enumerable: true, get: function () { return p2wsh_1.p2wsh; } }); +var sstxchange_1 = require("./sstxchange"); +Object.defineProperty(exports, "sstxchange", { enumerable: true, get: function () { return sstxchange_1.sstxchange; } }); +var sstxcommitment_1 = require("./sstxcommitment"); +Object.defineProperty(exports, "sstxcommitment", { enumerable: true, get: function () { return sstxcommitment_1.sstxcommitment; } }); +var sstxpkh_1 = require("./sstxpkh"); +Object.defineProperty(exports, "sstxpkh", { enumerable: true, get: function () { return sstxpkh_1.sstxpkh; } }); +var sstxsh_1 = require("./sstxsh"); +Object.defineProperty(exports, "sstxsh", { enumerable: true, get: function () { return sstxsh_1.sstxsh; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/lazy.d.ts b/third-party/utxo-lib/payments/lazy.d.ts new file mode 100644 index 0000000..5191252 --- /dev/null +++ b/third-party/utxo-lib/payments/lazy.d.ts @@ -0,0 +1,3 @@ +export declare function prop(object: Record, name: string, f: () => any): void; +export declare function value(f: () => T): () => T; +//# sourceMappingURL=lazy.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/lazy.js b/third-party/utxo-lib/payments/lazy.js new file mode 100644 index 0000000..207e8a1 --- /dev/null +++ b/third-party/utxo-lib/payments/lazy.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.prop = prop; +exports.value = value; +function prop(object, name, f) { + Object.defineProperty(object, name, { + configurable: true, + enumerable: true, + get() { + const value = f.call(this); + this[name] = value; + return value; + }, + set(value) { + Object.defineProperty(this, name, { + configurable: true, + enumerable: true, + value, + writable: true, + }); + }, + }); +} +function value(f) { + let value; + return () => { + if (value !== undefined) + return value; + value = f(); + return value; + }; +} +//# sourceMappingURL=lazy.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2ms.d.ts b/third-party/utxo-lib/payments/p2ms.d.ts new file mode 100644 index 0000000..24d5c3e --- /dev/null +++ b/third-party/utxo-lib/payments/p2ms.d.ts @@ -0,0 +1,3 @@ +import { Payment, PaymentOpts } from '../types'; +export declare function p2ms(a: Payment, opts?: PaymentOpts): Payment; +//# sourceMappingURL=p2ms.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2ms.js b/third-party/utxo-lib/payments/p2ms.js new file mode 100644 index 0000000..d4a16ee --- /dev/null +++ b/third-party/utxo-lib/payments/p2ms.js @@ -0,0 +1,139 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.p2ms = p2ms; +const tslib_1 = require("tslib"); +const tiny_secp256k1_1 = tslib_1.__importDefault(require("tiny-secp256k1")); +const networks_1 = require("../networks"); +const bscript = tslib_1.__importStar(require("../script")); +const lazy = tslib_1.__importStar(require("./lazy")); +const types_1 = require("../types"); +const { OPS } = bscript; +const OP_INT_BASE = OPS.OP_RESERVED; +function stacksEqual(a, b) { + if (a.length !== b.length) + return false; + return a.every((x, i) => x.equals(b[i])); +} +function p2ms(a, opts) { + if (!a.input && !a.output && !(a.pubkeys && a.m !== undefined) && !a.signatures) + throw new TypeError('Not enough data'); + opts = Object.assign({ validate: true }, opts || {}); + function isAcceptableSignature(x) { + return (bscript.isCanonicalScriptSignature(x) || + (opts.allowIncomplete && x === OPS.OP_0) !== undefined); + } + (0, types_1.typeforce)({ + network: types_1.typeforce.maybe(types_1.typeforce.Object), + m: types_1.typeforce.maybe(types_1.typeforce.Number), + n: types_1.typeforce.maybe(types_1.typeforce.Number), + output: types_1.typeforce.maybe(types_1.typeforce.Buffer), + pubkeys: types_1.typeforce.maybe(types_1.typeforce.arrayOf(tiny_secp256k1_1.default.isPoint)), + signatures: types_1.typeforce.maybe(types_1.typeforce.arrayOf(isAcceptableSignature)), + input: types_1.typeforce.maybe(types_1.typeforce.Buffer), + }, a); + const network = a.network || networks_1.bitcoin; + const o = { name: 'p2ms', network }; + let chunks = []; + let decoded = false; + function decode(output) { + if (decoded) + return; + decoded = true; + chunks = bscript.decompile(output); + o.m = chunks[0] - OP_INT_BASE; + o.n = chunks[chunks.length - 2] - OP_INT_BASE; + o.pubkeys = chunks.slice(1, -2); + } + lazy.prop(o, 'output', () => { + if (!a.m) + return; + if (!o.n) + return; + if (!a.pubkeys) + return; + return bscript.compile([].concat(OP_INT_BASE + a.m, a.pubkeys, OP_INT_BASE + o.n, OPS.OP_CHECKMULTISIG)); + }); + lazy.prop(o, 'm', () => { + if (!o.output) + return; + decode(o.output); + return o.m; + }); + lazy.prop(o, 'n', () => { + if (!o.pubkeys) + return; + return o.pubkeys.length; + }); + lazy.prop(o, 'pubkeys', () => { + if (!a.output) + return; + decode(a.output); + return o.pubkeys; + }); + lazy.prop(o, 'signatures', () => { + if (!a.input) + return; + return bscript.decompile(a.input).slice(1); + }); + lazy.prop(o, 'input', () => { + if (!a.signatures) + return; + return bscript.compile([OPS.OP_0].concat(a.signatures)); + }); + lazy.prop(o, 'witness', () => { + if (!o.input) + return; + return []; + }); + lazy.prop(o, 'name', () => { + if (!o.m || !o.n) + return; + return `p2ms(${o.m} of ${o.n})`; + }); + if (opts.validate) { + if (a.output) { + decode(a.output); + if (!types_1.typeforce.Number(chunks[0])) + throw new TypeError('Output is invalid'); + if (!types_1.typeforce.Number(chunks[chunks.length - 2])) + throw new TypeError('Output is invalid'); + if (chunks[chunks.length - 1] !== OPS.OP_CHECKMULTISIG) + throw new TypeError('Output is invalid'); + if (o.m <= 0 || o.n > 16 || o.m > o.n || o.n !== chunks.length - 3) + throw new TypeError('Output is invalid'); + if (!o.pubkeys.every(x => tiny_secp256k1_1.default.isPoint(x))) + throw new TypeError('Output is invalid'); + if (a.m !== undefined && a.m !== o.m) + throw new TypeError('m mismatch'); + if (a.n !== undefined && a.n !== o.n) + throw new TypeError('n mismatch'); + if (a.pubkeys && !stacksEqual(a.pubkeys, o.pubkeys)) + throw new TypeError('Pubkeys mismatch'); + } + if (a.pubkeys) { + if (a.n !== undefined && a.n !== a.pubkeys.length) + throw new TypeError('Pubkey count mismatch'); + o.n = a.pubkeys.length; + if (o.n < o.m) + throw new TypeError('Pubkey count cannot be less than m'); + } + if (a.signatures) { + if (a.signatures.length < o.m) + throw new TypeError('Not enough signatures provided'); + if (a.signatures.length > o.m) + throw new TypeError('Too many signatures provided'); + } + if (a.input) { + if (a.input[0] !== OPS.OP_0) + throw new TypeError('Input is invalid'); + if (o.signatures.length === 0 || !o.signatures.every(isAcceptableSignature)) + throw new TypeError('Input has invalid signature(s)'); + if (a.signatures && !stacksEqual(a.signatures, o.signatures)) + throw new TypeError('Signature mismatch'); + if (a.m !== undefined && a.m !== a.signatures.length) + throw new TypeError('Signature count mismatch'); + } + } + return Object.assign(o, a); +} +//# sourceMappingURL=p2ms.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2pk.d.ts b/third-party/utxo-lib/payments/p2pk.d.ts new file mode 100644 index 0000000..862d8ab --- /dev/null +++ b/third-party/utxo-lib/payments/p2pk.d.ts @@ -0,0 +1,3 @@ +import { Payment, PaymentOpts } from '../types'; +export declare function p2pk(a: Payment, opts?: PaymentOpts): Payment; +//# sourceMappingURL=p2pk.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2pk.js b/third-party/utxo-lib/payments/p2pk.js new file mode 100644 index 0000000..e6b3f80 --- /dev/null +++ b/third-party/utxo-lib/payments/p2pk.js @@ -0,0 +1,72 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.p2pk = p2pk; +const tslib_1 = require("tslib"); +const tiny_secp256k1_1 = tslib_1.__importDefault(require("tiny-secp256k1")); +const networks_1 = require("../networks"); +const bscript = tslib_1.__importStar(require("../script")); +const lazy = tslib_1.__importStar(require("./lazy")); +const types_1 = require("../types"); +const { OPS } = bscript; +function p2pk(a, opts) { + if (!a.input && !a.output && !a.pubkey && !a.input && !a.signature) + throw new TypeError('Not enough data'); + opts = Object.assign({ validate: true }, opts || {}); + (0, types_1.typeforce)({ + network: types_1.typeforce.maybe(types_1.typeforce.Object), + output: types_1.typeforce.maybe(types_1.typeforce.Buffer), + pubkey: types_1.typeforce.maybe(tiny_secp256k1_1.default.isPoint), + signature: types_1.typeforce.maybe(bscript.isCanonicalScriptSignature), + input: types_1.typeforce.maybe(types_1.typeforce.Buffer), + }, a); + const _chunks = lazy.value(() => bscript.decompile(a.input)); + const network = a.network || networks_1.bitcoin; + const o = { name: 'p2pk', network }; + lazy.prop(o, 'output', () => { + if (!a.pubkey) + return; + return bscript.compile([a.pubkey, OPS.OP_CHECKSIG]); + }); + lazy.prop(o, 'pubkey', () => { + if (!a.output) + return; + return a.output.subarray(1, -1); + }); + lazy.prop(o, 'signature', () => { + if (!a.input) + return; + return _chunks()[0]; + }); + lazy.prop(o, 'input', () => { + if (!a.signature) + return; + return bscript.compile([a.signature]); + }); + lazy.prop(o, 'witness', () => { + if (!o.input) + return; + return []; + }); + if (opts.validate) { + if (a.output) { + if (a.output[a.output.length - 1] !== OPS.OP_CHECKSIG) + throw new TypeError('Output is invalid'); + if (!tiny_secp256k1_1.default.isPoint(o.pubkey)) + throw new TypeError('Output pubkey is invalid'); + if (a.pubkey && !a.pubkey.equals(o.pubkey)) + throw new TypeError('Pubkey mismatch'); + } + if (a.signature) { + if (a.input && !a.input.equals(o.input)) + throw new TypeError('Signature mismatch'); + } + if (a.input) { + if (_chunks().length !== 1) + throw new TypeError('Input is invalid'); + if (!bscript.isCanonicalScriptSignature(o.signature)) + throw new TypeError('Input has invalid signature'); + } + } + return Object.assign(o, a); +} +//# sourceMappingURL=p2pk.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2pkh.d.ts b/third-party/utxo-lib/payments/p2pkh.d.ts new file mode 100644 index 0000000..9430e87 --- /dev/null +++ b/third-party/utxo-lib/payments/p2pkh.d.ts @@ -0,0 +1,3 @@ +import { Payment, PaymentOpts } from '../types'; +export declare function p2pkh(a: Payment, opts?: PaymentOpts): Payment; +//# sourceMappingURL=p2pkh.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2pkh.js b/third-party/utxo-lib/payments/p2pkh.js new file mode 100644 index 0000000..f60eed9 --- /dev/null +++ b/third-party/utxo-lib/payments/p2pkh.js @@ -0,0 +1,132 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.p2pkh = p2pkh; +const tslib_1 = require("tslib"); +const tiny_secp256k1_1 = tslib_1.__importDefault(require("tiny-secp256k1")); +const bs58check = tslib_1.__importStar(require("../bs58check")); +const bcrypto = tslib_1.__importStar(require("../crypto")); +const networks_1 = require("../networks"); +const bscript = tslib_1.__importStar(require("../script")); +const lazy = tslib_1.__importStar(require("./lazy")); +const types_1 = require("../types"); +const { OPS } = bscript; +function p2pkh(a, opts) { + if (!a.address && !a.hash && !a.output && !a.pubkey && !a.input) + throw new TypeError('Not enough data'); + opts = Object.assign({ validate: true }, opts || {}); + (0, types_1.typeforce)({ + network: types_1.typeforce.maybe(types_1.typeforce.Object), + address: types_1.typeforce.maybe(types_1.typeforce.String), + hash: types_1.typeforce.maybe(types_1.typeforce.BufferN(20)), + output: types_1.typeforce.maybe(types_1.typeforce.BufferN(25)), + pubkey: types_1.typeforce.maybe(tiny_secp256k1_1.default.isPoint), + signature: types_1.typeforce.maybe(bscript.isCanonicalScriptSignature), + input: types_1.typeforce.maybe(types_1.typeforce.Buffer), + }, a); + const _address = lazy.value(() => bs58check.decodeAddress(a.address, a.network)); + const _chunks = lazy.value(() => bscript.decompile(a.input)); + const network = a.network || networks_1.bitcoin; + const o = { name: 'p2pkh', network }; + lazy.prop(o, 'address', () => { + if (!o.hash) + return; + return bs58check.encodeAddress(o.hash, network.pubKeyHash, network); + }); + lazy.prop(o, 'hash', () => { + if (a.output) + return a.output.subarray(3, 23); + if (a.address) + return _address().hash; + if (a.pubkey || o.pubkey) + return bcrypto.hash160(a.pubkey || o.pubkey); + }); + lazy.prop(o, 'output', () => { + if (!o.hash) + return; + return bscript.compile([ + OPS.OP_DUP, + OPS.OP_HASH160, + o.hash, + OPS.OP_EQUALVERIFY, + OPS.OP_CHECKSIG, + ]); + }); + lazy.prop(o, 'pubkey', () => { + if (!a.input) + return; + return _chunks()[1]; + }); + lazy.prop(o, 'signature', () => { + if (!a.input) + return; + return _chunks()[0]; + }); + lazy.prop(o, 'input', () => { + if (!a.pubkey) + return; + if (!a.signature) + return; + return bscript.compile([a.signature, a.pubkey]); + }); + lazy.prop(o, 'witness', () => { + if (!o.input) + return; + return []; + }); + if (opts.validate) { + let hash = Buffer.from([]); + if (a.address) { + const { version, hash: aHash } = _address(); + if (version !== network.pubKeyHash) + throw new TypeError('Invalid version or Network mismatch'); + if (aHash.length !== 20) + throw new TypeError('Invalid address'); + hash = aHash; + } + if (a.hash) { + if (hash.length > 0 && !hash.equals(a.hash)) + throw new TypeError('Hash mismatch'); + else + hash = a.hash; + } + if (a.output) { + if (a.output.length !== 25 || + a.output[0] !== OPS.OP_DUP || + a.output[1] !== OPS.OP_HASH160 || + a.output[2] !== 0x14 || + a.output[23] !== OPS.OP_EQUALVERIFY || + a.output[24] !== OPS.OP_CHECKSIG) + throw new TypeError('Output is invalid'); + const hash2 = a.output.subarray(3, 23); + if (hash.length > 0 && !hash.equals(hash2)) + throw new TypeError('Hash mismatch'); + else + hash = hash2; + } + if (a.pubkey) { + const pkh = bcrypto.hash160(a.pubkey); + if (hash.length > 0 && !hash.equals(pkh)) + throw new TypeError('Hash mismatch'); + else + hash = pkh; + } + if (a.input) { + const chunks = _chunks(); + if (chunks.length !== 2) + throw new TypeError('Input is invalid'); + if (!bscript.isCanonicalScriptSignature(chunks[0])) + throw new TypeError('Input has invalid signature'); + if (!tiny_secp256k1_1.default.isPoint(chunks[1])) + throw new TypeError('Input has invalid pubkey'); + if (a.signature && !a.signature.equals(chunks[0])) + throw new TypeError('Signature mismatch'); + if (a.pubkey && !a.pubkey.equals(chunks[1])) + throw new TypeError('Pubkey mismatch'); + const pkh = bcrypto.hash160(chunks[1]); + if (hash.length > 0 && !hash.equals(pkh)) + throw new TypeError('Hash mismatch'); + } + } + return Object.assign(o, a); +} +//# sourceMappingURL=p2pkh.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2sh.d.ts b/third-party/utxo-lib/payments/p2sh.d.ts new file mode 100644 index 0000000..09783fb --- /dev/null +++ b/third-party/utxo-lib/payments/p2sh.d.ts @@ -0,0 +1,3 @@ +import { Payment, PaymentOpts } from '../types'; +export declare function p2sh(a: Payment, opts?: PaymentOpts): Payment; +//# sourceMappingURL=p2sh.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2sh.js b/third-party/utxo-lib/payments/p2sh.js new file mode 100644 index 0000000..daa2431 --- /dev/null +++ b/third-party/utxo-lib/payments/p2sh.js @@ -0,0 +1,171 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.p2sh = p2sh; +const tslib_1 = require("tslib"); +const bs58check = tslib_1.__importStar(require("../bs58check")); +const bcrypto = tslib_1.__importStar(require("../crypto")); +const networks_1 = require("../networks"); +const bscript = tslib_1.__importStar(require("../script")); +const lazy = tslib_1.__importStar(require("./lazy")); +const types_1 = require("../types"); +const { OPS } = bscript; +function stacksEqual(a, b) { + if (a.length !== b.length) + return false; + return a.every((x, i) => x.equals(b[i])); +} +function p2sh(a, opts) { + if (!a.address && !a.hash && !a.output && !a.redeem && !a.input) + throw new TypeError('Not enough data'); + opts = Object.assign({ validate: true }, opts || {}); + (0, types_1.typeforce)({ + network: types_1.typeforce.maybe(types_1.typeforce.Object), + address: types_1.typeforce.maybe(types_1.typeforce.String), + hash: types_1.typeforce.maybe(types_1.typeforce.BufferN(20)), + output: types_1.typeforce.maybe(types_1.typeforce.BufferN(23)), + redeem: types_1.typeforce.maybe({ + network: types_1.typeforce.maybe(types_1.typeforce.Object), + output: types_1.typeforce.maybe(types_1.typeforce.Buffer), + input: types_1.typeforce.maybe(types_1.typeforce.Buffer), + witness: types_1.typeforce.maybe(types_1.typeforce.arrayOf(types_1.typeforce.Buffer)), + }), + input: types_1.typeforce.maybe(types_1.typeforce.Buffer), + witness: types_1.typeforce.maybe(types_1.typeforce.arrayOf(types_1.typeforce.Buffer)), + }, a); + let { network } = a; + if (!network) { + network = (a.redeem && a.redeem.network) || networks_1.bitcoin; + } + const o = { name: 'p2sh', network }; + const _address = lazy.value(() => bs58check.decodeAddress(a.address, a.network)); + const _chunks = lazy.value(() => bscript.decompile(a.input)); + const _redeem = lazy.value(() => { + const chunks = _chunks(); + return { + network, + output: chunks[chunks.length - 1], + input: bscript.compile(chunks.slice(0, -1)), + witness: a.witness || [], + }; + }); + lazy.prop(o, 'address', () => { + if (!o.hash) + return; + return bs58check.encodeAddress(o.hash, network.scriptHash, network); + }); + lazy.prop(o, 'hash', () => { + if (a.output) + return a.output.subarray(2, 22); + if (a.address) + return _address().hash; + if (o.redeem && o.redeem.output) + return bcrypto.hash160(o.redeem.output); + }); + lazy.prop(o, 'output', () => { + if (!o.hash) + return; + return bscript.compile([OPS.OP_HASH160, o.hash, OPS.OP_EQUAL]); + }); + lazy.prop(o, 'redeem', () => { + if (!a.input) + return; + return _redeem(); + }); + lazy.prop(o, 'input', () => { + if (!a.redeem || !a.redeem.input || !a.redeem.output) + return; + return bscript.compile([].concat(bscript.decompile(a.redeem.input), a.redeem.output)); + }); + lazy.prop(o, 'witness', () => { + if (o.redeem && o.redeem.witness) + return o.redeem.witness; + if (o.input) + return []; + }); + lazy.prop(o, 'name', () => { + const nameParts = ['p2sh']; + if (o.redeem !== undefined && o.redeem.name !== undefined) + nameParts.push(o.redeem.name); + return nameParts.join('-'); + }); + if (opts.validate) { + let hash = Buffer.from([]); + if (a.address) { + const { version, hash: aHash } = _address(); + if (version !== network.scriptHash) + throw new TypeError('Invalid version or Network mismatch'); + if (aHash.length !== 20) + throw new TypeError('Invalid address'); + hash = aHash; + } + if (a.hash) { + if (hash.length > 0 && !hash.equals(a.hash)) + throw new TypeError('Hash mismatch'); + else + hash = a.hash; + } + if (a.output) { + if (a.output.length !== 23 || + a.output[0] !== OPS.OP_HASH160 || + a.output[1] !== 0x14 || + a.output[22] !== OPS.OP_EQUAL) + throw new TypeError('Output is invalid'); + const hash2 = a.output.subarray(2, 22); + if (hash.length > 0 && !hash.equals(hash2)) + throw new TypeError('Hash mismatch'); + else + hash = hash2; + } + const checkRedeem = (redeem) => { + if (redeem.output) { + const decompile = bscript.decompile(redeem.output); + if (!decompile || decompile.length < 1) + throw new TypeError('Redeem.output too short'); + const hash2 = bcrypto.hash160(redeem.output); + if (hash.length > 0 && !hash.equals(hash2)) + throw new TypeError('Hash mismatch'); + else + hash = hash2; + } + if (redeem.input) { + const hasInput = redeem.input.length > 0; + const hasWitness = redeem.witness && redeem.witness.length > 0; + if (!hasInput && !hasWitness) + throw new TypeError('Empty input'); + if (hasInput && hasWitness) + throw new TypeError('Input and witness provided'); + if (hasInput) { + const richunks = bscript.decompile(redeem.input); + if (!bscript.isPushOnly(richunks)) + throw new TypeError('Non push-only scriptSig'); + } + } + }; + if (a.input) { + const chunks = _chunks(); + if (!chunks || chunks.length < 1) + throw new TypeError('Input too short'); + if (!Buffer.isBuffer(_redeem().output)) + throw new TypeError('Input is invalid'); + checkRedeem(_redeem()); + } + if (a.redeem) { + if (a.redeem.network && a.redeem.network !== network) + throw new TypeError('Network mismatch'); + if (a.input) { + const redeem = _redeem(); + if (a.redeem.output && !a.redeem.output.equals(redeem.output)) + throw new TypeError('Redeem.output mismatch'); + if (a.redeem.input && !a.redeem.input.equals(redeem.input)) + throw new TypeError('Redeem.input mismatch'); + } + checkRedeem(a.redeem); + } + if (a.witness) { + if (a.redeem && a.redeem.witness && !stacksEqual(a.redeem.witness, a.witness)) + throw new TypeError('Witness and redeem.witness mismatch'); + } + } + return Object.assign(o, a); +} +//# sourceMappingURL=p2sh.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2tr.d.ts b/third-party/utxo-lib/payments/p2tr.d.ts new file mode 100644 index 0000000..9294f19 --- /dev/null +++ b/third-party/utxo-lib/payments/p2tr.d.ts @@ -0,0 +1,3 @@ +import { Payment, PaymentOpts } from '../types'; +export declare function p2tr(a: Payment, opts?: PaymentOpts): Payment; +//# sourceMappingURL=p2tr.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2tr.js b/third-party/utxo-lib/payments/p2tr.js new file mode 100644 index 0000000..465821a --- /dev/null +++ b/third-party/utxo-lib/payments/p2tr.js @@ -0,0 +1,123 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.p2tr = p2tr; +const tslib_1 = require("tslib"); +const tiny_secp256k1_1 = tslib_1.__importDefault(require("tiny-secp256k1")); +const bech32_1 = require("bech32"); +const networks_1 = require("../networks"); +const bcrypto = tslib_1.__importStar(require("../crypto")); +const bscript = tslib_1.__importStar(require("../script")); +const lazy = tslib_1.__importStar(require("./lazy")); +const types_1 = require("../types"); +const { OPS } = bscript; +const TAGS = ['TapLeaf', 'TapBranch', 'TapTweak', 'KeyAgg list', 'KeyAgg coefficient']; +const TAGGED_HASH_PREFIXES = TAGS.reduce((obj, tag) => { + const tagHash = bcrypto.sha256(Buffer.from(tag)); + obj[tag] = Buffer.concat([tagHash, tagHash]); + return obj; +}, {}); +const EVEN_Y_COORD_PREFIX = new Uint8Array([0x02]); +function taggedHash(prefix, data) { + return bcrypto.sha256(Buffer.concat([TAGGED_HASH_PREFIXES[prefix], data])); +} +function tapTweakPubkey(pubkey, tapTreeRoot) { + let tapTweak; + if (tapTreeRoot) { + tapTweak = taggedHash('TapTweak', Buffer.concat([pubkey, tapTreeRoot])); + } + else { + tapTweak = taggedHash('TapTweak', pubkey); + } + const tweakedPubkey = tiny_secp256k1_1.default.pointAddScalar(Buffer.concat([EVEN_Y_COORD_PREFIX, pubkey]), tapTweak); + return { + parity: tweakedPubkey[0] === EVEN_Y_COORD_PREFIX[0] ? 0 : 1, + pubkey: tweakedPubkey.slice(1), + }; +} +const liftX = (pubkey) => { + const offset = pubkey.length === 33 ? 1 : 0; + return pubkey.subarray(offset); +}; +function p2tr(a, opts) { + if (!a.address && !a.pubkey && !a.output) + throw new TypeError('Not enough data'); + opts = Object.assign({ validate: true }, opts || {}); + const network = a.network || networks_1.bitcoin; + const o = { name: 'p2tr', network }; + (0, types_1.typeforce)({ + network: types_1.typeforce.maybe(types_1.typeforce.Object), + address: types_1.typeforce.maybe(types_1.typeforce.String), + output: types_1.typeforce.maybe(types_1.typeforce.BufferN(34)), + pubkey: types_1.typeforce.maybe(types_1.typeforce.anyOf(types_1.typeforce.BufferN(32), types_1.typeforce.BufferN(33))), + }, a); + const _address = lazy.value(() => { + const result = bech32_1.bech32m.decode(a.address); + const version = result.words.shift(); + const data = bech32_1.bech32m.fromWords(result.words); + return { + version, + prefix: result.prefix, + data: Buffer.from(data), + }; + }); + lazy.prop(o, 'address', () => { + if (!o.hash) + return; + const words = bech32_1.bech32m.toWords(o.hash); + words.unshift(0x01); + return bech32_1.bech32m.encode(network.bech32, words); + }); + lazy.prop(o, 'hash', () => { + if (a.output) + return a.output.subarray(2); + if (a.address) + return _address().data; + if (a.pubkey) { + return tapTweakPubkey(liftX(a.pubkey)).pubkey; + } + }); + lazy.prop(o, 'output', () => { + if (!o.hash) + return; + return bscript.compile([OPS.OP_1, o.hash]); + }); + if (opts.validate) { + let hash = Buffer.from([]); + if (a.address) { + const { prefix, version, data } = _address(); + if (prefix !== network.bech32) + throw new TypeError('Invalid prefix or Network mismatch'); + if (version !== 0x01) + throw new TypeError('Invalid address version'); + if (data.length !== 32) + throw new TypeError('Invalid address data'); + hash = data; + } + if (a.hash) { + if (hash.length > 0 && !hash.equals(a.hash)) + throw new TypeError('Hash mismatch'); + else + hash = a.hash; + } + if (a.output) { + if (a.output[0] !== OPS.OP_1 || a.output[1] !== 0x20) + throw new TypeError('p2tr output is invalid'); + const hash2 = a.output.subarray(2); + if (hash.length > 0 && !hash.equals(hash2)) + throw new TypeError('Hash mismatch'); + else + hash = hash2; + } + if (a.pubkey) { + const pkh = tapTweakPubkey(liftX(a.pubkey)).pubkey; + if (hash.length > 0 && !hash.equals(pkh)) + throw new TypeError('Hash mismatch'); + else + hash = pkh; + if (!tiny_secp256k1_1.default.isPoint(Buffer.concat([EVEN_Y_COORD_PREFIX, liftX(a.pubkey)]))) + throw new TypeError('Invalid pubkey for p2tr'); + } + } + return Object.assign(o, a); +} +//# sourceMappingURL=p2tr.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2wpkh.d.ts b/third-party/utxo-lib/payments/p2wpkh.d.ts new file mode 100644 index 0000000..34f918d --- /dev/null +++ b/third-party/utxo-lib/payments/p2wpkh.d.ts @@ -0,0 +1,3 @@ +import { Payment, PaymentOpts } from '../types'; +export declare function p2wpkh(a: Payment, opts?: PaymentOpts): Payment; +//# sourceMappingURL=p2wpkh.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2wpkh.js b/third-party/utxo-lib/payments/p2wpkh.js new file mode 100644 index 0000000..4c0202e --- /dev/null +++ b/third-party/utxo-lib/payments/p2wpkh.js @@ -0,0 +1,137 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.p2wpkh = p2wpkh; +const tslib_1 = require("tslib"); +const tiny_secp256k1_1 = tslib_1.__importDefault(require("tiny-secp256k1")); +const bech32_1 = require("bech32"); +const bcrypto = tslib_1.__importStar(require("../crypto")); +const networks_1 = require("../networks"); +const bscript = tslib_1.__importStar(require("../script")); +const types_1 = require("../types"); +const lazy = tslib_1.__importStar(require("./lazy")); +const { OPS } = bscript; +const EMPTY_BUFFER = Buffer.alloc(0); +function p2wpkh(a, opts) { + if (!a.address && !a.hash && !a.output && !a.pubkey && !a.witness) + throw new TypeError('Not enough data'); + opts = Object.assign({ validate: true }, opts || {}); + (0, types_1.typeforce)({ + address: types_1.typeforce.maybe(types_1.typeforce.String), + hash: types_1.typeforce.maybe(types_1.typeforce.BufferN(20)), + input: types_1.typeforce.maybe(types_1.typeforce.BufferN(0)), + network: types_1.typeforce.maybe(types_1.typeforce.Object), + output: types_1.typeforce.maybe(types_1.typeforce.BufferN(22)), + pubkey: types_1.typeforce.maybe(tiny_secp256k1_1.default.isPoint), + signature: types_1.typeforce.maybe(bscript.isCanonicalScriptSignature), + witness: types_1.typeforce.maybe(types_1.typeforce.arrayOf(types_1.typeforce.Buffer)), + }, a); + const _address = lazy.value(() => { + const result = bech32_1.bech32.decode(a.address); + const version = result.words.shift(); + const data = bech32_1.bech32.fromWords(result.words); + return { + version, + prefix: result.prefix, + data: Buffer.from(data), + }; + }); + const network = a.network || networks_1.bitcoin; + const o = { name: 'p2wpkh', network }; + lazy.prop(o, 'address', () => { + if (!o.hash) + return; + const words = bech32_1.bech32.toWords(o.hash); + words.unshift(0x00); + return bech32_1.bech32.encode(network.bech32, words); + }); + lazy.prop(o, 'hash', () => { + if (a.output) + return a.output.subarray(2, 22); + if (a.address) + return _address().data; + if (a.pubkey || o.pubkey) + return bcrypto.hash160(a.pubkey || o.pubkey); + }); + lazy.prop(o, 'output', () => { + if (!o.hash) + return; + return bscript.compile([OPS.OP_0, o.hash]); + }); + lazy.prop(o, 'pubkey', () => { + if (a.pubkey) + return a.pubkey; + if (!a.witness) + return; + return a.witness[1]; + }); + lazy.prop(o, 'signature', () => { + if (!a.witness) + return; + return a.witness[0]; + }); + lazy.prop(o, 'input', () => { + if (!o.witness) + return; + return EMPTY_BUFFER; + }); + lazy.prop(o, 'witness', () => { + if (!a.pubkey) + return; + if (!a.signature) + return; + return [a.signature, a.pubkey]; + }); + if (opts.validate) { + let hash = Buffer.from([]); + if (a.address) { + const { prefix, version, data } = _address(); + if (network && network.bech32 !== prefix) + throw new TypeError('Invalid prefix or Network mismatch'); + if (version !== 0x00) + throw new TypeError('Invalid address version'); + if (data.length !== 20) + throw new TypeError('Invalid address data'); + hash = data; + } + if (a.hash) { + if (hash.length > 0 && !hash.equals(a.hash)) + throw new TypeError('Hash mismatch'); + else + hash = a.hash; + } + if (a.output) { + if (a.output.length !== 22 || a.output[0] !== OPS.OP_0 || a.output[1] !== 0x14) + throw new TypeError('Output is invalid'); + if (hash.length > 0 && !hash.equals(a.output.subarray(2))) + throw new TypeError('Hash mismatch'); + else + hash = a.output.subarray(2); + } + if (a.pubkey) { + const pkh = bcrypto.hash160(a.pubkey); + if (hash.length > 0 && !hash.equals(pkh)) + throw new TypeError('Hash mismatch'); + else + hash = pkh; + if (!tiny_secp256k1_1.default.isPoint(a.pubkey) || a.pubkey.length !== 33) + throw new TypeError('Invalid pubkey for p2wpkh'); + } + if (a.witness) { + if (a.witness.length !== 2) + throw new TypeError('Witness is invalid'); + if (!bscript.isCanonicalScriptSignature(a.witness[0])) + throw new TypeError('Witness has invalid signature'); + if (!tiny_secp256k1_1.default.isPoint(a.witness[1]) || a.witness[1].length !== 33) + throw new TypeError('Witness has invalid pubkey'); + if (a.signature && !a.signature.equals(a.witness[0])) + throw new TypeError('Signature mismatch'); + if (a.pubkey && !a.pubkey.equals(a.witness[1])) + throw new TypeError('Pubkey mismatch'); + const pkh = bcrypto.hash160(a.witness[1]); + if (hash.length > 0 && !hash.equals(pkh)) + throw new TypeError('Hash mismatch'); + } + } + return Object.assign(o, a); +} +//# sourceMappingURL=p2wpkh.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2wsh.d.ts b/third-party/utxo-lib/payments/p2wsh.d.ts new file mode 100644 index 0000000..b07094c --- /dev/null +++ b/third-party/utxo-lib/payments/p2wsh.d.ts @@ -0,0 +1,3 @@ +import { Payment, PaymentOpts } from '../types'; +export declare function p2wsh(a: Payment, opts?: PaymentOpts): Payment; +//# sourceMappingURL=p2wsh.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/p2wsh.js b/third-party/utxo-lib/payments/p2wsh.js new file mode 100644 index 0000000..d9a1ce5 --- /dev/null +++ b/third-party/utxo-lib/payments/p2wsh.js @@ -0,0 +1,183 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.p2wsh = p2wsh; +const tslib_1 = require("tslib"); +const tiny_secp256k1_1 = tslib_1.__importDefault(require("tiny-secp256k1")); +const bech32_1 = require("bech32"); +const bcrypto = tslib_1.__importStar(require("../crypto")); +const networks_1 = require("../networks"); +const bscript = tslib_1.__importStar(require("../script")); +const lazy = tslib_1.__importStar(require("./lazy")); +const types_1 = require("../types"); +const { OPS } = bscript; +const EMPTY_BUFFER = Buffer.alloc(0); +function stacksEqual(a, b) { + if (a.length !== b.length) + return false; + return a.every((x, i) => x.equals(b[i])); +} +function chunkHasUncompressedPubkey(chunk) { + if (Buffer.isBuffer(chunk) && chunk.length === 65 && chunk[0] === 0x04 && tiny_secp256k1_1.default.isPoint(chunk)) { + return true; + } + return false; +} +function p2wsh(a, opts) { + if (!a.address && !a.hash && !a.output && !a.redeem && !a.witness) + throw new TypeError('Not enough data'); + opts = Object.assign({ validate: true }, opts || {}); + (0, types_1.typeforce)({ + network: types_1.typeforce.maybe(types_1.typeforce.Object), + address: types_1.typeforce.maybe(types_1.typeforce.String), + hash: types_1.typeforce.maybe(types_1.typeforce.BufferN(32)), + output: types_1.typeforce.maybe(types_1.typeforce.BufferN(34)), + redeem: types_1.typeforce.maybe({ + input: types_1.typeforce.maybe(types_1.typeforce.Buffer), + network: types_1.typeforce.maybe(types_1.typeforce.Object), + output: types_1.typeforce.maybe(types_1.typeforce.Buffer), + witness: types_1.typeforce.maybe(types_1.typeforce.arrayOf(types_1.typeforce.Buffer)), + }), + input: types_1.typeforce.maybe(types_1.typeforce.BufferN(0)), + witness: types_1.typeforce.maybe(types_1.typeforce.arrayOf(types_1.typeforce.Buffer)), + }, a); + const _address = lazy.value(() => { + const result = bech32_1.bech32.decode(a.address); + const version = result.words.shift(); + const data = bech32_1.bech32.fromWords(result.words); + return { + version, + prefix: result.prefix, + data: Buffer.from(data), + }; + }); + const _rchunks = lazy.value(() => bscript.decompile(a.redeem.input)); + let { network } = a; + if (!network) { + network = (a.redeem && a.redeem.network) || networks_1.bitcoin; + } + const o = { name: 'p2wsh', network }; + lazy.prop(o, 'address', () => { + if (!o.hash) + return; + const words = bech32_1.bech32.toWords(o.hash); + words.unshift(0x00); + return bech32_1.bech32.encode(network.bech32, words); + }); + lazy.prop(o, 'hash', () => { + if (a.output) + return a.output.subarray(2); + if (a.address) + return _address().data; + if (o.redeem && o.redeem.output) + return bcrypto.sha256(o.redeem.output); + }); + lazy.prop(o, 'output', () => { + if (!o.hash) + return; + return bscript.compile([OPS.OP_0, o.hash]); + }); + lazy.prop(o, 'redeem', () => { + if (!a.witness) + return; + return { + output: a.witness[a.witness.length - 1], + input: EMPTY_BUFFER, + witness: a.witness.slice(0, -1), + }; + }); + lazy.prop(o, 'input', () => { + if (!o.witness) + return; + return EMPTY_BUFFER; + }); + lazy.prop(o, 'witness', () => { + if (a.redeem && + a.redeem.input && + a.redeem.input.length > 0 && + a.redeem.output && + a.redeem.output.length > 0) { + const stack = bscript.toStack(_rchunks()); + o.redeem = Object.assign({ witness: stack }, a.redeem); + o.redeem.input = EMPTY_BUFFER; + return [].concat(stack, a.redeem.output); + } + if (!a.redeem) + return; + if (!a.redeem.output) + return; + if (!a.redeem.witness) + return; + return [].concat(a.redeem.witness, a.redeem.output); + }); + lazy.prop(o, 'name', () => { + const nameParts = ['p2wsh']; + if (o.redeem !== undefined && o.redeem.name !== undefined) + nameParts.push(o.redeem.name); + return nameParts.join('-'); + }); + if (opts.validate) { + let hash = Buffer.from([]); + if (a.address) { + const { prefix, version, data } = _address(); + if (prefix !== network.bech32) + throw new TypeError('Invalid prefix or Network mismatch'); + if (version !== 0x00) + throw new TypeError('Invalid address version'); + if (data.length !== 32) + throw new TypeError('Invalid address data'); + hash = data; + } + if (a.hash) { + if (hash.length > 0 && !hash.equals(a.hash)) + throw new TypeError('Hash mismatch'); + else + hash = a.hash; + } + if (a.output) { + if (a.output.length !== 34 || a.output[0] !== OPS.OP_0 || a.output[1] !== 0x20) + throw new TypeError('Output is invalid'); + const hash2 = a.output.subarray(2); + if (hash.length > 0 && !hash.equals(hash2)) + throw new TypeError('Hash mismatch'); + else + hash = hash2; + } + if (a.redeem) { + if (a.redeem.network && a.redeem.network !== network) + throw new TypeError('Network mismatch'); + if (a.redeem.input && + a.redeem.input.length > 0 && + a.redeem.witness && + a.redeem.witness.length > 0) + throw new TypeError('Ambiguous witness source'); + if (a.redeem.output) { + if (bscript.decompile(a.redeem.output).length === 0) + throw new TypeError('Redeem.output is invalid'); + const hash2 = bcrypto.sha256(a.redeem.output); + if (hash.length > 0 && !hash.equals(hash2)) + throw new TypeError('Hash mismatch'); + else + hash = hash2; + } + if (a.redeem.input && !bscript.isPushOnly(_rchunks())) + throw new TypeError('Non push-only scriptSig'); + if (a.witness && a.redeem.witness && !stacksEqual(a.witness, a.redeem.witness)) + throw new TypeError('Witness and redeem.witness mismatch'); + if ((a.redeem.input && _rchunks().some(chunkHasUncompressedPubkey)) || + (a.redeem.output && + (bscript.decompile(a.redeem.output) || []).some(chunkHasUncompressedPubkey))) { + throw new TypeError('redeem.input or redeem.output contains uncompressed pubkey'); + } + } + if (a.witness && a.witness.length > 0) { + const wScript = a.witness[a.witness.length - 1]; + if (a.redeem && a.redeem.output && !a.redeem.output.equals(wScript)) + throw new TypeError('Witness and redeem.output mismatch'); + if (a.witness.some(chunkHasUncompressedPubkey) || + (bscript.decompile(wScript) || []).some(chunkHasUncompressedPubkey)) + throw new TypeError('Witness contains uncompressed pubkey'); + } + } + return Object.assign(o, a); +} +//# sourceMappingURL=p2wsh.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/sstxchange.d.ts b/third-party/utxo-lib/payments/sstxchange.d.ts new file mode 100644 index 0000000..d4bd537 --- /dev/null +++ b/third-party/utxo-lib/payments/sstxchange.d.ts @@ -0,0 +1,3 @@ +import { Payment, PaymentOpts } from '../types'; +export declare function sstxchange(a: Payment, opts?: PaymentOpts): Payment; +//# sourceMappingURL=sstxchange.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/sstxchange.js b/third-party/utxo-lib/payments/sstxchange.js new file mode 100644 index 0000000..ea815fc --- /dev/null +++ b/third-party/utxo-lib/payments/sstxchange.js @@ -0,0 +1,79 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sstxchange = sstxchange; +const tslib_1 = require("tslib"); +const bs58check = tslib_1.__importStar(require("../bs58check")); +const networks_1 = require("../networks"); +const bscript = tslib_1.__importStar(require("../script")); +const lazy = tslib_1.__importStar(require("./lazy")); +const types_1 = require("../types"); +const { OPS } = bscript; +function sstxchange(a, opts) { + if (!a.address && !a.hash && !a.output) + throw new TypeError('Not enough data'); + opts = Object.assign({ validate: true }, opts || {}); + (0, types_1.typeforce)({ + network: types_1.typeforce.maybe(types_1.typeforce.Object), + address: types_1.typeforce.maybe(types_1.typeforce.String), + hash: types_1.typeforce.maybe(types_1.typeforce.BufferN(20)), + output: types_1.typeforce.maybe(types_1.typeforce.Buffer), + }, a); + const _address = lazy.value(() => bs58check.decodeAddress(a.address, a.network)); + const network = a.network || networks_1.decred; + const o = { name: 'sstxchange', network }; + lazy.prop(o, 'address', () => { + if (!o.hash) + return; + return bs58check.encodeAddress(o.hash, network.pubKeyHash, network); + }); + lazy.prop(o, 'hash', () => { + if (a.output) + return a.output.subarray(4, 24); + if (a.address) + return _address().hash; + }); + lazy.prop(o, 'output', () => { + if (!o.hash) + return; + return bscript.compile([ + OPS.OP_SSTXCHANGE, + OPS.OP_DUP, + OPS.OP_HASH160, + o.hash, + OPS.OP_EQUALVERIFY, + OPS.OP_CHECKSIG, + ]); + }); + if (opts.validate) { + let hash = Buffer.from([]); + if (a.address) { + const { version, hash: aHash } = _address(); + if (version !== network.pubKeyHash) + throw new TypeError('Invalid version or Network mismatch'); + if (aHash.length !== 20) + throw new TypeError('Invalid address'); + hash = aHash; + } + if (a.hash) { + if (hash.length > 0 && !hash.equals(a.hash)) + throw new TypeError('Hash mismatch'); + else + hash = a.hash; + } + if (a.output) { + if (a.output.length !== 26 || + a.output[0] !== OPS.OP_SSTXCHANGE || + a.output[1] !== OPS.OP_DUP || + a.output[2] !== OPS.OP_HASH160 || + a.output[3] !== 0x14 || + a.output[24] !== OPS.OP_EQUALVERIFY || + a.output[25] !== OPS.OP_CHECKSIG) + throw new TypeError('sstxchange output is invalid'); + const hash2 = a.output.subarray(4, 24); + if (hash.length > 0 && !hash.equals(hash2)) + throw new TypeError('Hash mismatch'); + } + } + return Object.assign(o, a); +} +//# sourceMappingURL=sstxchange.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/sstxcommitment.d.ts b/third-party/utxo-lib/payments/sstxcommitment.d.ts new file mode 100644 index 0000000..2993efc --- /dev/null +++ b/third-party/utxo-lib/payments/sstxcommitment.d.ts @@ -0,0 +1,3 @@ +import { Payment, PaymentOpts } from '../types'; +export declare function sstxcommitment(a: Payment, opts?: PaymentOpts): Payment; +//# sourceMappingURL=sstxcommitment.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/sstxcommitment.js b/third-party/utxo-lib/payments/sstxcommitment.js new file mode 100644 index 0000000..6c0aea5 --- /dev/null +++ b/third-party/utxo-lib/payments/sstxcommitment.js @@ -0,0 +1,74 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sstxcommitment = sstxcommitment; +const tslib_1 = require("tslib"); +const bufferutils_1 = require("../bufferutils"); +const bs58check = tslib_1.__importStar(require("../bs58check")); +const networks_1 = require("../networks"); +const bscript = tslib_1.__importStar(require("../script")); +const lazy = tslib_1.__importStar(require("./lazy")); +const types_1 = require("../types"); +const { OPS } = bscript; +function sstxcommitment(a, opts) { + if (!a.address && !a.amount && !a.hash && !a.output) + throw new TypeError('Not enough data'); + opts = Object.assign({ validate: true }, opts || {}); + (0, types_1.typeforce)({ + network: types_1.typeforce.maybe(types_1.typeforce.Object), + address: types_1.typeforce.maybe(types_1.typeforce.String), + amount: types_1.typeforce.maybe(types_1.typeforce.String), + hash: types_1.typeforce.maybe(types_1.typeforce.BufferN(20)), + output: types_1.typeforce.maybe(types_1.typeforce.Buffer), + }, a); + const _address = lazy.value(() => bs58check.decodeAddress(a.address, a.network)); + const network = a.network || networks_1.decred; + const o = { name: 'sstxcommitment', network }; + lazy.prop(o, 'address', () => { + if (!o.hash) + return; + return bs58check.encodeAddress(o.hash, network.pubKeyHash, network); + }); + lazy.prop(o, 'hash', () => { + if (a.output) + return a.output.subarray(2, 22); + if (a.address) + return _address().hash; + }); + lazy.prop(o, 'output', () => { + if (!o.hash || !a.amount) + return; + const buf = Buffer.allocUnsafe(o.hash.length + 10); + const writer = new bufferutils_1.BufferWriter(buf); + writer.writeSlice(o.hash); + writer.writeUInt64(a.amount); + writer.writeUInt8(0); + writer.writeUInt8(88); + return bscript.compile([OPS.OP_RETURN, buf]); + }); + if (opts.validate) { + let hash = Buffer.from([]); + if (a.address) { + const { version, hash: aHash } = _address(); + if (version !== network.pubKeyHash) + throw new TypeError('Invalid version or Network mismatch'); + if (aHash.length !== 20) + throw new TypeError('Invalid address'); + hash = aHash; + } + if (a.hash) { + if (hash.length > 0 && !hash.equals(a.hash)) + throw new TypeError('Hash mismatch'); + else + hash = a.hash; + } + if (a.output) { + if (a.output.length !== 32 || a.output[0] !== OPS.OP_RETURN) + throw new TypeError('sstxcommitment output is invalid'); + const hash2 = a.output.subarray(2, 22); + if (hash.length > 0 && !hash.equals(hash2)) + throw new TypeError('Hash mismatch'); + } + } + return Object.assign(o, a); +} +//# sourceMappingURL=sstxcommitment.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/sstxpkh.d.ts b/third-party/utxo-lib/payments/sstxpkh.d.ts new file mode 100644 index 0000000..ad47ae6 --- /dev/null +++ b/third-party/utxo-lib/payments/sstxpkh.d.ts @@ -0,0 +1,3 @@ +import { Payment, PaymentOpts } from '../types'; +export declare function sstxpkh(a: Payment, opts?: PaymentOpts): Payment; +//# sourceMappingURL=sstxpkh.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/sstxpkh.js b/third-party/utxo-lib/payments/sstxpkh.js new file mode 100644 index 0000000..d4e1ac1 --- /dev/null +++ b/third-party/utxo-lib/payments/sstxpkh.js @@ -0,0 +1,79 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sstxpkh = sstxpkh; +const tslib_1 = require("tslib"); +const bs58check = tslib_1.__importStar(require("../bs58check")); +const networks_1 = require("../networks"); +const bscript = tslib_1.__importStar(require("../script")); +const lazy = tslib_1.__importStar(require("./lazy")); +const types_1 = require("../types"); +const { OPS } = bscript; +function sstxpkh(a, opts) { + if (!a.address && !a.hash && !a.output) + throw new TypeError('Not enough data'); + opts = Object.assign({ validate: true }, opts || {}); + (0, types_1.typeforce)({ + network: types_1.typeforce.maybe(types_1.typeforce.Object), + address: types_1.typeforce.maybe(types_1.typeforce.String), + hash: types_1.typeforce.maybe(types_1.typeforce.BufferN(20)), + output: types_1.typeforce.maybe(types_1.typeforce.Buffer), + }, a); + const _address = lazy.value(() => bs58check.decodeAddress(a.address, a.network)); + const network = a.network || networks_1.decred; + const o = { name: 'sstxpkh', network }; + lazy.prop(o, 'address', () => { + if (!o.hash) + return; + return bs58check.encodeAddress(o.hash, network.pubKeyHash, network); + }); + lazy.prop(o, 'hash', () => { + if (a.output) + return a.output.subarray(4, 24); + if (a.address) + return _address().hash; + }); + lazy.prop(o, 'output', () => { + if (!o.hash) + return; + return bscript.compile([ + OPS.OP_SSTX, + OPS.OP_DUP, + OPS.OP_HASH160, + o.hash, + OPS.OP_EQUALVERIFY, + OPS.OP_CHECKSIG, + ]); + }); + if (opts.validate) { + let hash = Buffer.from([]); + if (a.address) { + const { version, hash: aHash } = _address(); + if (version !== network.pubKeyHash) + throw new TypeError('Invalid version or Network mismatch'); + if (aHash.length !== 20) + throw new TypeError('Invalid address'); + hash = aHash; + } + if (a.hash) { + if (hash.length > 0 && !hash.equals(a.hash)) + throw new TypeError('Hash mismatch'); + else + hash = a.hash; + } + if (a.output) { + if (a.output.length !== 26 || + a.output[0] !== OPS.OP_SSTX || + a.output[1] !== OPS.OP_DUP || + a.output[2] !== OPS.OP_HASH160 || + a.output[3] !== 0x14 || + a.output[24] !== OPS.OP_EQUALVERIFY || + a.output[25] !== OPS.OP_CHECKSIG) + throw new TypeError('sstxpkh output is invalid'); + const hash2 = a.output.subarray(4, 24); + if (hash.length > 0 && !hash.equals(hash2)) + throw new TypeError('Hash mismatch'); + } + } + return Object.assign(o, a); +} +//# sourceMappingURL=sstxpkh.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/sstxsh.d.ts b/third-party/utxo-lib/payments/sstxsh.d.ts new file mode 100644 index 0000000..48fe35c --- /dev/null +++ b/third-party/utxo-lib/payments/sstxsh.d.ts @@ -0,0 +1,3 @@ +import { Payment, PaymentOpts } from '../types'; +export declare function sstxsh(a: Payment, opts?: PaymentOpts): Payment; +//# sourceMappingURL=sstxsh.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/payments/sstxsh.js b/third-party/utxo-lib/payments/sstxsh.js new file mode 100644 index 0000000..d19ef00 --- /dev/null +++ b/third-party/utxo-lib/payments/sstxsh.js @@ -0,0 +1,70 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sstxsh = sstxsh; +const tslib_1 = require("tslib"); +const bs58check = tslib_1.__importStar(require("../bs58check")); +const networks_1 = require("../networks"); +const bscript = tslib_1.__importStar(require("../script")); +const lazy = tslib_1.__importStar(require("./lazy")); +const types_1 = require("../types"); +const { OPS } = bscript; +function sstxsh(a, opts) { + if (!a.address && !a.hash && !a.output) + throw new TypeError('Not enough data'); + opts = Object.assign({ validate: true }, opts || {}); + (0, types_1.typeforce)({ + network: types_1.typeforce.maybe(types_1.typeforce.Object), + address: types_1.typeforce.maybe(types_1.typeforce.String), + hash: types_1.typeforce.maybe(types_1.typeforce.BufferN(20)), + output: types_1.typeforce.maybe(types_1.typeforce.Buffer), + }, a); + const network = a.network || networks_1.decred; + const o = { name: 'sstxsh', network }; + const _address = lazy.value(() => bs58check.decodeAddress(a.address, network)); + lazy.prop(o, 'address', () => { + if (!o.hash) + return; + return bs58check.encodeAddress(o.hash, network.scriptHash, network); + }); + lazy.prop(o, 'hash', () => { + if (a.output) + return a.output.subarray(3, 23); + if (a.address) + return _address().hash; + }); + lazy.prop(o, 'output', () => { + if (!o.hash) + return; + return bscript.compile([OPS.OP_SSTX, OPS.OP_HASH160, o.hash, OPS.OP_EQUAL]); + }); + if (opts.validate) { + let hash = Buffer.from([]); + if (a.address) { + const { version, hash: aHash } = _address(); + if (version !== network.scriptHash) + throw new TypeError('Invalid version or Network mismatch'); + if (aHash.length !== 20) + throw new TypeError('Invalid address'); + hash = aHash; + } + if (a.hash) { + if (hash.length > 0 && !hash.equals(a.hash)) + throw new TypeError('Hash mismatch'); + else + hash = a.hash; + } + if (a.output) { + if (a.output.length !== 24 || + a.output[0] !== OPS.OP_SSTX || + a.output[1] !== OPS.OP_HASH160 || + a.output[2] !== 0x14 || + a.output[23] !== OPS.OP_EQUAL) + throw new TypeError('sstxsh output is invalid'); + const hash2 = a.output.subarray(3, 23); + if (hash.length > 0 && !hash.equals(hash2)) + throw new TypeError('Hash mismatch'); + } + } + return Object.assign(o, a); +} +//# sourceMappingURL=sstxsh.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/script/index.d.ts b/third-party/utxo-lib/script/index.d.ts new file mode 100644 index 0000000..cd651be --- /dev/null +++ b/third-party/utxo-lib/script/index.d.ts @@ -0,0 +1,17 @@ +import * as scriptNumber from './scriptNumber'; +import * as scriptSignature from './scriptSignature'; +import * as types from '../types'; +import { Stack } from '../types'; +export declare function isPushOnly(value: Stack): boolean; +export declare function compile(chunks: Buffer | Stack): Buffer; +export declare function decompile(buffer: Buffer | Stack): types.Stack; +export declare function toASM(chunks: Buffer | Stack): string; +export declare function fromASM(asm: string): Buffer; +export declare function toStack(chunks0: Buffer | Stack): Buffer[]; +export declare function isCanonicalPubKey(buffer: Buffer): any; +export declare function isDefinedHashType(hashType: number): boolean; +export declare function isCanonicalScriptSignature(buffer: Buffer): boolean; +export declare const number: typeof scriptNumber; +export declare const signature: typeof scriptSignature; +export { OPS } from './ops'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/script/index.js b/third-party/utxo-lib/script/index.js new file mode 100644 index 0000000..62d9809 --- /dev/null +++ b/third-party/utxo-lib/script/index.js @@ -0,0 +1,167 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.OPS = exports.signature = exports.number = void 0; +exports.isPushOnly = isPushOnly; +exports.compile = compile; +exports.decompile = decompile; +exports.toASM = toASM; +exports.fromASM = fromASM; +exports.toStack = toStack; +exports.isCanonicalPubKey = isCanonicalPubKey; +exports.isDefinedHashType = isDefinedHashType; +exports.isCanonicalScriptSignature = isCanonicalScriptSignature; +const tslib_1 = require("tslib"); +const bip66 = tslib_1.__importStar(require("bip66")); +const pushdata_bitcoin_1 = tslib_1.__importDefault(require("pushdata-bitcoin")); +const tiny_secp256k1_1 = tslib_1.__importDefault(require("tiny-secp256k1")); +const scriptNumber = tslib_1.__importStar(require("./scriptNumber")); +const scriptSignature = tslib_1.__importStar(require("./scriptSignature")); +const ops_1 = require("./ops"); +const types = tslib_1.__importStar(require("../types")); +const types_1 = require("../types"); +const OP_INT_BASE = ops_1.OPS.OP_RESERVED; +function isOPInt(value) { + return (types.Number(value) && + (value === ops_1.OPS.OP_0 || + (value >= ops_1.OPS.OP_1 && value <= ops_1.OPS.OP_16) || + value === ops_1.OPS.OP_1NEGATE)); +} +function isPushOnlyChunk(value) { + return types.Buffer(value) || isOPInt(value); +} +function isPushOnly(value) { + return types.Array(value) && value.every(isPushOnlyChunk); +} +function asMinimalOP(buffer) { + if (buffer.length === 0) + return ops_1.OPS.OP_0; + if (buffer.length !== 1) + return; + if (buffer[0] >= 1 && buffer[0] <= 16) + return OP_INT_BASE + buffer[0]; + if (buffer[0] === 0x81) + return ops_1.OPS.OP_1NEGATE; +} +function compile(chunks) { + if (types.Buffer(chunks)) + return chunks; + (0, types_1.typeforce)(types.Array, chunks); + const bufferSize = chunks.reduce((accum, chunk) => { + if (types.Buffer(chunk)) { + if (chunk.length === 1 && asMinimalOP(chunk) !== undefined) { + return accum + 1; + } + return accum + pushdata_bitcoin_1.default.encodingLength(chunk.length) + chunk.length; + } + return accum + 1; + }, 0.0); + const buffer = Buffer.allocUnsafe(bufferSize); + let offset = 0; + chunks.forEach(chunk => { + if (types.Buffer(chunk)) { + const opcode = asMinimalOP(chunk); + if (opcode !== undefined) { + buffer.writeUInt8(opcode, offset); + offset += 1; + return; + } + offset += pushdata_bitcoin_1.default.encode(buffer, chunk.length, offset); + chunk.copy(buffer, offset); + offset += chunk.length; + } + else { + buffer.writeUInt8(chunk, offset); + offset += 1; + } + }); + if (offset !== buffer.length) + throw new Error('Could not decode chunks'); + return buffer; +} +function decompile(buffer) { + if (types.Array(buffer)) + return buffer; + (0, types_1.typeforce)(types.Buffer, buffer); + const chunks = []; + let i = 0; + while (i < buffer.length) { + const opcode = buffer[i]; + if (opcode > ops_1.OPS.OP_0 && opcode <= ops_1.OPS.OP_PUSHDATA4) { + const d = pushdata_bitcoin_1.default.decode(buffer, i); + if (d === null) + return []; + i += d.size; + if (i + d.number > buffer.length) + return []; + const data = buffer.subarray(i, i + d.number); + i += d.number; + const op = asMinimalOP(data); + if (op !== undefined) { + chunks.push(op); + } + else { + chunks.push(data); + } + } + else { + chunks.push(opcode); + i += 1; + } + } + return chunks; +} +function toASM(chunks) { + if (types.Buffer(chunks)) { + chunks = decompile(chunks); + } + return chunks + .map(chunk => { + if (types.Buffer(chunk)) { + const op = asMinimalOP(chunk); + if (op === undefined) + return chunk.toString('hex'); + chunk = op; + } + return ops_1.REVERSE_OPS[chunk]; + }) + .join(' '); +} +function fromASM(asm) { + (0, types_1.typeforce)(types.String, asm); + return compile(asm.split(' ').map(chunkStr => { + if (ops_1.OPS[chunkStr] !== undefined) + return ops_1.OPS[chunkStr]; + (0, types_1.typeforce)(types.Hex, chunkStr); + return Buffer.from(chunkStr, 'hex'); + })); +} +function toStack(chunks0) { + const chunks = decompile(chunks0); + (0, types_1.typeforce)(isPushOnly, chunks); + return chunks === null || chunks === void 0 ? void 0 : chunks.map(op => { + if (types.Buffer(op)) + return op; + if (op === ops_1.OPS.OP_0) + return Buffer.allocUnsafe(0); + return scriptNumber.encode(op - OP_INT_BASE); + }); +} +function isCanonicalPubKey(buffer) { + return tiny_secp256k1_1.default.isPoint(buffer); +} +function isDefinedHashType(hashType) { + const hashTypeMod = hashType & ~0x80; + return hashTypeMod > 0x00 && hashTypeMod < 0x04; +} +function isCanonicalScriptSignature(buffer) { + if (!types.Buffer(buffer)) + return false; + if (!isDefinedHashType(buffer[buffer.length - 1])) + return false; + return bip66.check(buffer.subarray(0, -1)); +} +exports.number = scriptNumber; +exports.signature = scriptSignature; +var ops_2 = require("./ops"); +Object.defineProperty(exports, "OPS", { enumerable: true, get: function () { return ops_2.OPS; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/script/ops.d.ts b/third-party/utxo-lib/script/ops.d.ts new file mode 100644 index 0000000..8d1e612 --- /dev/null +++ b/third-party/utxo-lib/script/ops.d.ts @@ -0,0 +1,4 @@ +declare const OPS: Record; +declare const REVERSE_OPS: string[]; +export { OPS, REVERSE_OPS }; +//# sourceMappingURL=ops.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/script/ops.js b/third-party/utxo-lib/script/ops.js new file mode 100644 index 0000000..3ee2ea0 --- /dev/null +++ b/third-party/utxo-lib/script/ops.js @@ -0,0 +1,13 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.REVERSE_OPS = exports.OPS = void 0; +const tslib_1 = require("tslib"); +const ops = tslib_1.__importStar(require("bitcoin-ops")); +const OPS = Object.assign(Object.assign({}, ops), { OP_SSTX: 0xba, OP_SSTXCHANGE: 0xbd, OP_SSGEN: 0xbb, OP_SSRTX: 0xbc }); +exports.OPS = OPS; +const REVERSE_OPS = []; +exports.REVERSE_OPS = REVERSE_OPS; +Object.keys(OPS).forEach(code => { + REVERSE_OPS[OPS[code]] = code; +}); +//# sourceMappingURL=ops.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/script/scriptNumber.d.ts b/third-party/utxo-lib/script/scriptNumber.d.ts new file mode 100644 index 0000000..defd4bc --- /dev/null +++ b/third-party/utxo-lib/script/scriptNumber.d.ts @@ -0,0 +1,3 @@ +export declare function decode(buffer: Buffer, maxLength?: number, minimal?: boolean): number; +export declare function encode(number: number): Buffer; +//# sourceMappingURL=scriptNumber.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/script/scriptNumber.js b/third-party/utxo-lib/script/scriptNumber.js new file mode 100644 index 0000000..2e4d527 --- /dev/null +++ b/third-party/utxo-lib/script/scriptNumber.js @@ -0,0 +1,62 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decode = decode; +exports.encode = encode; +function decode(buffer, maxLength = 4, minimal = true) { + const { length } = buffer; + if (length === 0) + return 0; + if (length > maxLength) + throw new TypeError('Script number overflow'); + if (minimal) { + if ((buffer[length - 1] & 0x7f) === 0) { + if (length <= 1 || (buffer[length - 2] & 0x80) === 0) + throw new Error('Non-minimally encoded script number'); + } + } + if (length === 5) { + const a = buffer.readUInt32LE(0); + const b = buffer.readUInt8(4); + if (b & 0x80) + return -((b & ~0x80) * 0x100000000 + a); + return b * 0x100000000 + a; + } + let result = 0; + for (let i = 0; i < length; ++i) { + result |= buffer[i] << (8 * i); + } + if (buffer[length - 1] & 0x80) + return -(result & ~(0x80 << (8 * (length - 1)))); + return result; +} +function scriptNumSize(i) { + if (i > 0x7fffffff) + return 5; + if (i > 0x7fffff) + return 4; + if (i > 0x7fff) + return 3; + if (i > 0x7f) + return 2; + if (i > 0x00) + return 1; + return 0; +} +function encode(number) { + let value = Math.abs(number); + const size = scriptNumSize(value); + const buffer = Buffer.allocUnsafe(size); + const negative = number < 0; + for (let i = 0; i < size; ++i) { + buffer.writeUInt8(value & 0xff, i); + value >>= 8; + } + if (buffer[size - 1] & 0x80) { + buffer.writeUInt8(negative ? 0x80 : 0x00, size - 1); + } + else if (negative) { + buffer[size - 1] |= 0x80; + } + return buffer; +} +//# sourceMappingURL=scriptNumber.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/script/scriptSignature.d.ts b/third-party/utxo-lib/script/scriptSignature.d.ts new file mode 100644 index 0000000..8a0a992 --- /dev/null +++ b/third-party/utxo-lib/script/scriptSignature.d.ts @@ -0,0 +1,8 @@ +export declare function toDER(x: Buffer): Buffer; +export declare function fromDER(x: Buffer): Buffer; +export declare function decode(buffer: Buffer): { + signature: Buffer; + hashType: number; +}; +export declare function encode(signature: Buffer, hashType: number): Buffer; +//# sourceMappingURL=scriptSignature.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/script/scriptSignature.js b/third-party/utxo-lib/script/scriptSignature.js new file mode 100644 index 0000000..e3d1d2a --- /dev/null +++ b/third-party/utxo-lib/script/scriptSignature.js @@ -0,0 +1,55 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toDER = toDER; +exports.fromDER = fromDER; +exports.decode = decode; +exports.encode = encode; +const tslib_1 = require("tslib"); +const bip66 = tslib_1.__importStar(require("bip66")); +const types = tslib_1.__importStar(require("../types")); +const ZERO = Buffer.alloc(1, 0); +function toDER(x) { + let i = 0; + while (x[i] === 0) + ++i; + if (i === x.length) + return ZERO; + x = x.subarray(i); + if (x[0] & 0x80) + return Buffer.concat([ZERO, x], 1 + x.length); + return x; +} +function fromDER(x) { + if (x[0] === 0x00) + x = x.subarray(1); + const buffer = Buffer.alloc(32, 0); + const bstart = Math.max(0, 32 - x.length); + x.copy(buffer, bstart); + return buffer; +} +function decode(buffer) { + const hashType = buffer.readUInt8(buffer.length - 1); + const hashTypeMod = hashType & ~0x80; + if (hashTypeMod <= 0 || hashTypeMod >= 4) + throw new Error(`Invalid hashType ${hashType}`); + const decoded = bip66.decode(buffer.subarray(0, -1)); + const r = fromDER(decoded.r); + const s = fromDER(decoded.s); + const signature = Buffer.concat([r, s], 64); + return { signature, hashType }; +} +function encode(signature, hashType) { + types.typeforce({ + signature: types.BufferN(64), + hashType: types.UInt8, + }, { signature, hashType }); + const hashTypeMod = hashType & ~0x80; + if (hashTypeMod <= 0 || hashTypeMod >= 4) + throw new Error(`Invalid hashType ${hashType}`); + const hashTypeBuffer = Buffer.allocUnsafe(1); + hashTypeBuffer.writeUInt8(hashType, 0); + const r = toDER(signature.subarray(0, 32)); + const s = toDER(signature.subarray(32, 64)); + return Buffer.concat([bip66.encode(r, s), hashTypeBuffer]); +} +//# sourceMappingURL=scriptSignature.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/base.d.ts b/third-party/utxo-lib/transaction/base.d.ts new file mode 100644 index 0000000..698764f --- /dev/null +++ b/third-party/utxo-lib/transaction/base.d.ts @@ -0,0 +1,56 @@ +import { Network } from '../networks'; +export declare function varSliceSize(someScript: Buffer): number; +export declare function vectorSize(someVector: Buffer[]): number; +export declare function isCoinbaseHash(buffer: Buffer): boolean; +export declare const EMPTY_SCRIPT: Buffer; +export interface TxOutput { + script: Buffer; + value: string; + decredVersion?: number; +} +export interface TxInput { + hash: Buffer; + index: number; + script: Buffer; + sequence: number; + witness: Buffer[]; + decredTree?: number; + decredWitness?: { + value: string; + height: number; + blockIndex: number; + script: Buffer; + }; +} +export type TransactionOptions = { + nostrict?: boolean; + network?: Network; +}; +export declare class TransactionBase { + version: number; + locktime: number; + ins: TxInput[]; + outs: TxOutput[]; + specific: S | undefined; + network: Network; + type: number | undefined; + timestamp: number | undefined; + expiry: number | undefined; + constructor(options: TransactionOptions & { + txSpecific?: S; + }); + isCoinbase(): boolean; + hasWitnesses(): boolean; + isMwebPegOutTx(): boolean; + weight(): number; + virtualSize(): number; + byteLength(_ALLOW_WITNESS?: boolean, _ALLOW_MWEB?: boolean): number; + getHash(forWitness?: boolean, forMweb?: boolean): Buffer; + getId(): string; + getWitness(index: number): Buffer | undefined; + getExtraData(): Buffer | void; + getSpecificData(): S | void; + toBuffer(_buffer?: Buffer, _initialOffset?: number, _ALLOW_WITNESS?: boolean, _ALLOW_MWEB?: boolean): Buffer; + toHex(): string; +} +//# sourceMappingURL=base.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/base.js b/third-party/utxo-lib/transaction/base.js new file mode 100644 index 0000000..2140555 --- /dev/null +++ b/third-party/utxo-lib/transaction/base.js @@ -0,0 +1,108 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TransactionBase = exports.EMPTY_SCRIPT = void 0; +exports.varSliceSize = varSliceSize; +exports.vectorSize = vectorSize; +exports.isCoinbaseHash = isCoinbaseHash; +const tslib_1 = require("tslib"); +const varuint = tslib_1.__importStar(require("varuint-bitcoin")); +const bufferutils_1 = require("../bufferutils"); +const bcrypto = tslib_1.__importStar(require("../crypto")); +const types = tslib_1.__importStar(require("../types")); +const bscript = tslib_1.__importStar(require("../script")); +const networks_1 = require("../networks"); +function varSliceSize(someScript) { + const { length } = someScript; + return varuint.encodingLength(length) + length; +} +function vectorSize(someVector) { + return (varuint.encodingLength(someVector.length) + + someVector.reduce((sum, witness) => sum + varSliceSize(witness), 0)); +} +function isCoinbaseHash(buffer) { + types.typeforce(types.Hash256bit, buffer); + for (let i = 0; i < 32; ++i) { + if (buffer[i] !== 0) + return false; + } + return true; +} +exports.EMPTY_SCRIPT = Buffer.allocUnsafe(0); +class TransactionBase { + constructor(options) { + this.version = 1; + this.locktime = 0; + this.ins = []; + this.outs = []; + this.network = options.network || networks_1.bitcoin; + this.specific = options.txSpecific; + } + isCoinbase() { + return this.ins.length === 1 && isCoinbaseHash(this.ins[0].hash); + } + hasWitnesses() { + return this.ins.some(x => x.witness.length !== 0); + } + isMwebPegOutTx() { + if (!(0, networks_1.isNetworkType)('litecoin', this.network)) { + return false; + } + return (this.outs.some(output => { + const asm = bscript.toASM(output.script); + return asm.startsWith('OP_8'); + }) && + this.ins.some(input => !input.script.length)); + } + weight() { + const base = this.byteLength(false, false); + const total = this.byteLength(true, false); + return base * 3 + total; + } + virtualSize() { + return Math.ceil(this.weight() / 4); + } + byteLength(_ALLOW_WITNESS = true, _ALLOW_MWEB = true) { + const hasWitnesses = _ALLOW_WITNESS && this.hasWitnesses(); + return ((hasWitnesses ? 10 : 8) + + (this.timestamp ? 4 : 0) + + varuint.encodingLength(this.ins.length) + + varuint.encodingLength(this.outs.length) + + this.ins.reduce((sum, input) => sum + 40 + varSliceSize(input.script), 0) + + this.outs.reduce((sum, output) => sum + 8 + varSliceSize(output.script), 0) + + (hasWitnesses + ? this.ins.reduce((sum, input) => sum + vectorSize(input.witness), 0) + : 0) + + (_ALLOW_MWEB && this.isMwebPegOutTx() ? 3 : 0)); + } + getHash(forWitness = false, forMweb = false) { + if (forWitness && this.isCoinbase()) + return Buffer.alloc(32, 0); + return bcrypto.hash256(this.toBuffer(undefined, undefined, forWitness, forMweb)); + } + getId() { + return (0, bufferutils_1.reverseBuffer)(this.getHash(false)).toString('hex'); + } + getWitness(index) { + if (!this.hasWitnesses() || + !this.ins[index] || + !Array.isArray(this.ins[index].witness) || + this.ins[index].witness.length < 1) + return; + const { witness } = this.ins[index]; + const chunks = witness.reduce((arr, chunk) => arr.concat([(0, bufferutils_1.getChunkSize)(chunk.length), chunk]), [(0, bufferutils_1.getChunkSize)(witness.length)]); + return Buffer.concat(chunks); + } + getExtraData() { + } + getSpecificData() { + return this.specific; + } + toBuffer(_buffer, _initialOffset, _ALLOW_WITNESS = true, _ALLOW_MWEB = true) { + return exports.EMPTY_SCRIPT; + } + toHex() { + return this.toBuffer().toString('hex'); + } +} +exports.TransactionBase = TransactionBase; +//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/bitcoin.d.ts b/third-party/utxo-lib/transaction/bitcoin.d.ts new file mode 100644 index 0000000..c8960e9 --- /dev/null +++ b/third-party/utxo-lib/transaction/bitcoin.d.ts @@ -0,0 +1,4 @@ +import { TransactionBase, TransactionOptions } from './base'; +export declare function fromConstructor(options: TransactionOptions): TransactionBase; +export declare function fromBuffer(buffer: Buffer, options: TransactionOptions): TransactionBase; +//# sourceMappingURL=bitcoin.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/bitcoin.js b/third-party/utxo-lib/transaction/bitcoin.js new file mode 100644 index 0000000..f184001 --- /dev/null +++ b/third-party/utxo-lib/transaction/bitcoin.js @@ -0,0 +1,109 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromConstructor = fromConstructor; +exports.fromBuffer = fromBuffer; +const bufferutils_1 = require("../bufferutils"); +const networks_1 = require("../networks"); +const base_1 = require("./base"); +const ADVANCED_TRANSACTION_MARKER = 0x00; +const ADVANCED_TRANSACTION_FLAG = 0x01; +const MWEB_PEGOUT_TX_FLAG = 0x08; +function toBuffer(tx, buffer, initialOffset, _ALLOW_WITNESS = true, _ALLOW_MWEB = true) { + if (!buffer) + buffer = Buffer.allocUnsafe(tx.byteLength(_ALLOW_WITNESS, _ALLOW_MWEB)); + const bufferWriter = new bufferutils_1.BufferWriter(buffer, initialOffset || 0); + bufferWriter.writeInt32(tx.version); + const hasWitnesses = _ALLOW_WITNESS && tx.hasWitnesses(); + const hasMweb = _ALLOW_MWEB && tx.isMwebPegOutTx(); + if (hasWitnesses) { + bufferWriter.writeUInt8(ADVANCED_TRANSACTION_MARKER); + bufferWriter.writeUInt8(ADVANCED_TRANSACTION_FLAG); + } + else if (hasMweb) { + bufferWriter.writeUInt8(ADVANCED_TRANSACTION_MARKER); + bufferWriter.writeUInt8(MWEB_PEGOUT_TX_FLAG); + } + bufferWriter.writeVarInt(tx.ins.length); + tx.ins.forEach(txIn => { + bufferWriter.writeSlice(txIn.hash); + bufferWriter.writeUInt32(txIn.index); + bufferWriter.writeVarSlice(txIn.script); + bufferWriter.writeUInt32(txIn.sequence); + }); + bufferWriter.writeVarInt(tx.outs.length); + tx.outs.forEach(txOut => { + bufferWriter.writeUInt64(txOut.value); + bufferWriter.writeVarSlice(txOut.script); + }); + if (hasWitnesses) { + tx.ins.forEach(input => { + bufferWriter.writeVector(input.witness); + }); + } + if (hasMweb) { + bufferWriter.writeUInt8(0); + } + bufferWriter.writeUInt32(tx.locktime); + if (initialOffset !== undefined) + return buffer.subarray(initialOffset, bufferWriter.offset); + return buffer; +} +function fromConstructor(options) { + const tx = new base_1.TransactionBase(options); + tx.toBuffer = toBuffer.bind(null, tx); + return tx; +} +function fromBuffer(buffer, options) { + const bufferReader = new bufferutils_1.BufferReader(buffer); + const tx = fromConstructor(options); + tx.version = bufferReader.readInt32(); + const marker = bufferReader.readUInt8(); + const flag = bufferReader.readUInt8(); + let hasWitnesses = false; + let hasMweb = false; + if ((0, networks_1.isNetworkType)('litecoin', tx.network)) { + if (marker === ADVANCED_TRANSACTION_MARKER && flag === MWEB_PEGOUT_TX_FLAG) { + hasMweb = true; + } + } + if (marker === ADVANCED_TRANSACTION_MARKER && flag === ADVANCED_TRANSACTION_FLAG) { + hasWitnesses = true; + } + else if (!hasMweb) { + bufferReader.offset -= 2; + } + const vinLen = bufferReader.readVarInt(); + for (let i = 0; i < vinLen; ++i) { + tx.ins.push({ + hash: bufferReader.readSlice(32), + index: bufferReader.readUInt32(), + script: bufferReader.readVarSlice(), + sequence: bufferReader.readUInt32(), + witness: [], + }); + } + const voutLen = bufferReader.readVarInt(); + for (let i = 0; i < voutLen; ++i) { + tx.outs.push({ + value: bufferReader.readUInt64String(), + script: bufferReader.readVarSlice(), + }); + } + if (hasWitnesses) { + for (let i = 0; i < vinLen; ++i) { + tx.ins[i].witness = bufferReader.readVector(); + } + if (!tx.hasWitnesses()) + throw new Error('Transaction has superfluous witness data'); + } + if (hasMweb) { + bufferReader.readUInt8(); + } + tx.locktime = bufferReader.readUInt32(); + if (options.nostrict) + return tx; + if (bufferReader.offset !== buffer.length) + throw new Error('Transaction has unexpected data'); + return tx; +} +//# sourceMappingURL=bitcoin.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/dash.d.ts b/third-party/utxo-lib/transaction/dash.d.ts new file mode 100644 index 0000000..6a12d14 --- /dev/null +++ b/third-party/utxo-lib/transaction/dash.d.ts @@ -0,0 +1,8 @@ +import { TransactionBase, TransactionOptions } from './base'; +export interface DashSpecific { + type: 'dash'; + extraPayload?: Buffer; +} +export declare function fromConstructor(options: TransactionOptions): TransactionBase; +export declare function fromBuffer(buffer: Buffer, options: TransactionOptions): TransactionBase; +//# sourceMappingURL=dash.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/dash.js b/third-party/utxo-lib/transaction/dash.js new file mode 100644 index 0000000..e4d8aa7 --- /dev/null +++ b/third-party/utxo-lib/transaction/dash.js @@ -0,0 +1,105 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromConstructor = fromConstructor; +exports.fromBuffer = fromBuffer; +const tslib_1 = require("tslib"); +const varuint = tslib_1.__importStar(require("varuint-bitcoin")); +const bufferutils_1 = require("../bufferutils"); +const base_1 = require("./base"); +const DASH_NORMAL = 0; +const DASH_QUORUM_COMMITMENT = 6; +function byteLength(tx, _ALLOW_WITNESS = true) { + var _a; + const hasWitnesses = _ALLOW_WITNESS && tx.hasWitnesses(); + return ((hasWitnesses ? 10 : 8) + + (tx.timestamp ? 4 : 0) + + varuint.encodingLength(tx.ins.length) + + varuint.encodingLength(tx.outs.length) + + tx.ins.reduce((sum, input) => sum + 40 + (0, base_1.varSliceSize)(input.script), 0) + + tx.outs.reduce((sum, output) => sum + 8 + (0, base_1.varSliceSize)(output.script), 0) + + (((_a = tx.specific) === null || _a === void 0 ? void 0 : _a.extraPayload) ? (0, base_1.varSliceSize)(tx.specific.extraPayload) : 0) + + (hasWitnesses ? tx.ins.reduce((sum, input) => sum + (0, base_1.vectorSize)(input.witness), 0) : 0)); +} +function toBuffer(tx, buffer, initialOffset, _ALLOW_WITNESS = true) { + var _a; + if (!buffer) + buffer = Buffer.allocUnsafe(tx.byteLength(_ALLOW_WITNESS)); + const bufferWriter = new bufferutils_1.BufferWriter(buffer, initialOffset || 0); + if (tx.version >= 3 && tx.type !== DASH_NORMAL) { + bufferWriter.writeUInt16(tx.version); + bufferWriter.writeUInt16(tx.type); + } + else { + bufferWriter.writeInt32(tx.version); + } + bufferWriter.writeVarInt(tx.ins.length); + tx.ins.forEach(txIn => { + bufferWriter.writeSlice(txIn.hash); + bufferWriter.writeUInt32(txIn.index); + bufferWriter.writeVarSlice(txIn.script); + bufferWriter.writeUInt32(txIn.sequence); + }); + bufferWriter.writeVarInt(tx.outs.length); + tx.outs.forEach(txOut => { + bufferWriter.writeUInt64(txOut.value); + bufferWriter.writeVarSlice(txOut.script); + }); + bufferWriter.writeUInt32(tx.locktime); + if ((_a = tx.specific) === null || _a === void 0 ? void 0 : _a.extraPayload) + bufferWriter.writeVarSlice(tx.specific.extraPayload); + if (initialOffset !== undefined) + return buffer.subarray(initialOffset, bufferWriter.offset); + return buffer; +} +function getExtraData(tx) { + var _a; + if (!((_a = tx.specific) === null || _a === void 0 ? void 0 : _a.extraPayload)) + return; + const { buffer: extraDataLength } = varuint.encode(tx.specific.extraPayload.length); + return Buffer.concat([extraDataLength, tx.specific.extraPayload]); +} +function fromConstructor(options) { + const tx = new base_1.TransactionBase(options); + tx.specific = tx.specific || { type: 'dash' }; + tx.byteLength = byteLength.bind(null, tx); + tx.toBuffer = toBuffer.bind(null, tx); + tx.getExtraData = getExtraData.bind(null, tx); + return tx; +} +function fromBuffer(buffer, options) { + const bufferReader = new bufferutils_1.BufferReader(buffer); + const tx = fromConstructor(options); + tx.version = bufferReader.readInt32(); + tx.type = tx.version >> 16; + tx.version &= 0xffff; + if (tx.version === 3 && (tx.type < DASH_NORMAL || tx.type > DASH_QUORUM_COMMITMENT)) { + throw new Error('Unsupported Dash transaction type'); + } + const vinLen = bufferReader.readVarInt(); + for (let i = 0; i < vinLen; ++i) { + tx.ins.push({ + hash: bufferReader.readSlice(32), + index: bufferReader.readUInt32(), + script: bufferReader.readVarSlice(), + sequence: bufferReader.readUInt32(), + witness: [], + }); + } + const voutLen = bufferReader.readVarInt(); + for (let i = 0; i < voutLen; ++i) { + tx.outs.push({ + value: bufferReader.readUInt64String(), + script: bufferReader.readVarSlice(), + }); + } + tx.locktime = bufferReader.readUInt32(); + if (tx.version >= 3 && tx.type !== DASH_NORMAL) { + tx.specific.extraPayload = bufferReader.readVarSlice(); + } + if (options.nostrict) + return tx; + if (bufferReader.offset !== buffer.length) + throw new Error('Transaction has unexpected data'); + return tx; +} +//# sourceMappingURL=dash.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/decred.d.ts b/third-party/utxo-lib/transaction/decred.d.ts new file mode 100644 index 0000000..2220f90 --- /dev/null +++ b/third-party/utxo-lib/transaction/decred.d.ts @@ -0,0 +1,4 @@ +import { TransactionBase, TransactionOptions } from './base'; +export declare function fromConstructor(options: TransactionOptions): TransactionBase; +export declare function fromBuffer(buffer: Buffer, options: TransactionOptions): TransactionBase; +//# sourceMappingURL=decred.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/decred.js b/third-party/utxo-lib/transaction/decred.js new file mode 100644 index 0000000..e5787a0 --- /dev/null +++ b/third-party/utxo-lib/transaction/decred.js @@ -0,0 +1,149 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromConstructor = fromConstructor; +exports.fromBuffer = fromBuffer; +const tslib_1 = require("tslib"); +const varuint = tslib_1.__importStar(require("varuint-bitcoin")); +const bufferutils_1 = require("../bufferutils"); +const bcrypto = tslib_1.__importStar(require("../crypto")); +const base_1 = require("./base"); +const DECRED_TX_VERSION = 1; +const DECRED_TX_SERIALIZE_FULL = 0; +const DECRED_TX_SERIALIZE_NO_WITNESS = 1; +const DECRED_SCRIPT_VERSION = 0; +function hasWitnesses(tx) { + return tx.type === DECRED_TX_SERIALIZE_FULL; +} +function byteLength(tx, _ALLOW_WITNESS = true) { + let byteLength = 4 + varuint.encodingLength(tx.ins.length); + let nWitness = 0; + const hasWitnesses = _ALLOW_WITNESS && tx.hasWitnesses(); + byteLength += tx.ins.reduce((sum, input) => { + sum += 32 + 4 + 1 + 4; + if (hasWitnesses) { + nWitness += 1; + sum += 8 + 4 + 4; + sum += (0, base_1.varSliceSize)(input.decredWitness.script); + } + return sum; + }, 0); + if (hasWitnesses) { + byteLength += varuint.encodingLength(nWitness); + } + byteLength += varuint.encodingLength(tx.outs.length); + byteLength += tx.outs.reduce((sum, output) => { + sum += 8 + 2; + sum += (0, base_1.varSliceSize)(output.script); + return sum; + }, 0); + byteLength += 4 + 4; + return byteLength; +} +function toBuffer(tx, buffer, initialOffset, _ALLOW_WITNESS = true) { + if (!buffer) + buffer = Buffer.allocUnsafe(byteLength(tx, _ALLOW_WITNESS)); + const bufferWriter = new bufferutils_1.BufferWriter(buffer, initialOffset || 0); + bufferWriter.writeUInt16(tx.version); + bufferWriter.writeUInt16(_ALLOW_WITNESS ? tx.type : DECRED_TX_SERIALIZE_NO_WITNESS); + bufferWriter.writeVarInt(tx.ins.length); + tx.ins.forEach(txIn => { + bufferWriter.writeSlice(txIn.hash); + bufferWriter.writeUInt32(txIn.index); + bufferWriter.writeUInt8(txIn.decredTree); + bufferWriter.writeUInt32(txIn.sequence); + }); + bufferWriter.writeVarInt(tx.outs.length); + tx.outs.forEach(txOut => { + bufferWriter.writeUInt64(txOut.value); + bufferWriter.writeUInt16(txOut.decredVersion); + bufferWriter.writeVarSlice(txOut.script); + }); + bufferWriter.writeUInt32(tx.locktime); + bufferWriter.writeUInt32(tx.expiry); + if (_ALLOW_WITNESS && tx.hasWitnesses()) { + bufferWriter.writeVarInt(tx.ins.length); + tx.ins.forEach(input => { + bufferWriter.writeUInt64(input.decredWitness.value); + bufferWriter.writeUInt32(input.decredWitness.height); + bufferWriter.writeUInt32(input.decredWitness.blockIndex); + bufferWriter.writeVarSlice(input.decredWitness.script); + }); + } + if (initialOffset !== undefined) + return buffer.subarray(initialOffset, bufferWriter.offset); + return buffer; +} +function getHash(tx, forWitness = false) { + if (forWitness && tx.isCoinbase()) + return Buffer.alloc(32, 0); + return bcrypto.blake256(toBuffer(tx, undefined, undefined, forWitness)); +} +function weight(tx) { + return tx.byteLength(true); +} +function fromConstructor(options) { + const tx = new base_1.TransactionBase(options); + tx.byteLength = byteLength.bind(null, tx); + tx.toBuffer = toBuffer.bind(null, tx); + tx.hasWitnesses = hasWitnesses.bind(null, tx); + tx.getHash = getHash.bind(null, tx); + tx.weight = weight.bind(null, tx); + return tx; +} +function fromBuffer(buffer, options) { + const bufferReader = new bufferutils_1.BufferReader(buffer); + const tx = fromConstructor(options); + tx.version = bufferReader.readInt32(); + tx.type = tx.version >> 16; + tx.version &= 0xffff; + if (tx.version !== DECRED_TX_VERSION) { + throw new Error('Unsupported Decred transaction version'); + } + if (tx.type !== DECRED_TX_SERIALIZE_FULL && tx.type !== DECRED_TX_SERIALIZE_NO_WITNESS) { + throw new Error('Unsupported Decred transaction type'); + } + const vinLen = bufferReader.readVarInt(); + for (let i = 0; i < vinLen; ++i) { + tx.ins.push({ + hash: bufferReader.readSlice(32), + index: bufferReader.readUInt32(), + decredTree: bufferReader.readUInt8(), + sequence: bufferReader.readUInt32(), + script: base_1.EMPTY_SCRIPT, + witness: [], + }); + } + const voutLen = bufferReader.readVarInt(); + for (let i = 0; i < voutLen; i++) { + const value = bufferReader.readUInt64String(); + const version = bufferReader.readUInt16(); + if (version !== DECRED_SCRIPT_VERSION) + throw new Error('Unsupported Decred script version'); + tx.outs.push({ + value, + decredVersion: version, + script: bufferReader.readVarSlice(), + }); + } + tx.locktime = bufferReader.readUInt32(); + tx.expiry = bufferReader.readUInt32(); + if (tx.type === DECRED_TX_SERIALIZE_FULL) { + const count = bufferReader.readVarInt(); + if (count !== vinLen) + throw new Error('Non equal number of ins and witnesses'); + tx.ins.forEach(vin => { + vin.decredWitness = { + value: bufferReader.readUInt64String(), + height: bufferReader.readUInt32(), + blockIndex: bufferReader.readUInt32(), + script: bufferReader.readVarSlice(), + }; + }); + } + if (options.nostrict) + return tx; + if (bufferReader.offset !== buffer.length) + throw new Error('Transaction has unexpected data'); + return tx; +} +//# sourceMappingURL=decred.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/index.d.ts b/third-party/utxo-lib/transaction/index.d.ts new file mode 100644 index 0000000..ceead14 --- /dev/null +++ b/third-party/utxo-lib/transaction/index.d.ts @@ -0,0 +1,15 @@ +import { TransactionBase, TransactionOptions } from './base'; +import * as dash from './dash'; +import * as zcash from './zcash'; +export type TxOptions = TransactionOptions & { + txSpecific?: dash.DashSpecific | zcash.ZcashSpecific; +}; +declare class Transaction extends TransactionBase { + constructor(options?: TxOptions); + static isCoinbaseHash(buffer: Buffer): boolean; + static fromBuffer(buffer: Buffer, options?: TransactionOptions): TransactionBase | TransactionBase | TransactionBase; + static fromHex(hex: string, options?: TransactionOptions): TransactionBase | TransactionBase | TransactionBase; +} +export type { TransactionOptions } from './base'; +export { Transaction }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/index.js b/third-party/utxo-lib/transaction/index.js new file mode 100644 index 0000000..4eb8df4 --- /dev/null +++ b/third-party/utxo-lib/transaction/index.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Transaction = void 0; +const tslib_1 = require("tslib"); +const networks_1 = require("../networks"); +const base_1 = require("./base"); +const bitcoin = tslib_1.__importStar(require("./bitcoin")); +const dash = tslib_1.__importStar(require("./dash")); +const decred = tslib_1.__importStar(require("./decred")); +const peercoin = tslib_1.__importStar(require("./peercoin")); +const zcash = tslib_1.__importStar(require("./zcash")); +class Transaction extends base_1.TransactionBase { + constructor(options = {}) { + super(options); + if ((0, networks_1.isNetworkType)('dash', this.network)) + return dash.fromConstructor(options); + if ((0, networks_1.isNetworkType)('decred', this.network)) + return decred.fromConstructor(options); + if ((0, networks_1.isNetworkType)('peercoin', this.network)) + return peercoin.fromConstructor(options); + if ((0, networks_1.isNetworkType)('zcash', this.network)) + return zcash.fromConstructor(options); + return bitcoin.fromConstructor(options); + } + static isCoinbaseHash(buffer) { + return (0, base_1.isCoinbaseHash)(buffer); + } + static fromBuffer(buffer, options = {}) { + if ((0, networks_1.isNetworkType)('dash', options.network)) + return dash.fromBuffer(buffer, options); + if ((0, networks_1.isNetworkType)('decred', options.network)) + return decred.fromBuffer(buffer, options); + if ((0, networks_1.isNetworkType)('peercoin', options.network)) + return peercoin.fromBuffer(buffer, options); + if ((0, networks_1.isNetworkType)('zcash', options.network)) + return zcash.fromBuffer(buffer, options); + return bitcoin.fromBuffer(buffer, options); + } + static fromHex(hex, options = {}) { + return this.fromBuffer(Buffer.from(hex, 'hex'), Object.assign(Object.assign({}, options), { nostrict: false })); + } +} +exports.Transaction = Transaction; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/peercoin.d.ts b/third-party/utxo-lib/transaction/peercoin.d.ts new file mode 100644 index 0000000..3aa9648 --- /dev/null +++ b/third-party/utxo-lib/transaction/peercoin.d.ts @@ -0,0 +1,4 @@ +import { TransactionBase, TransactionOptions } from './base'; +export declare function fromConstructor(options: TransactionOptions): TransactionBase; +export declare function fromBuffer(buffer: Buffer, options: TransactionOptions): TransactionBase; +//# sourceMappingURL=peercoin.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/peercoin.js b/third-party/utxo-lib/transaction/peercoin.js new file mode 100644 index 0000000..3eef4c9 --- /dev/null +++ b/third-party/utxo-lib/transaction/peercoin.js @@ -0,0 +1,64 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromConstructor = fromConstructor; +exports.fromBuffer = fromBuffer; +const bufferutils_1 = require("../bufferutils"); +const base_1 = require("./base"); +function toBuffer(tx, buffer, initialOffset) { + if (!buffer) + buffer = Buffer.allocUnsafe(tx.byteLength(false)); + const bufferWriter = new bufferutils_1.BufferWriter(buffer, initialOffset || 0); + bufferWriter.writeInt32(tx.version); + bufferWriter.writeUInt32(tx.timestamp); + bufferWriter.writeVarInt(tx.ins.length); + tx.ins.forEach(txIn => { + bufferWriter.writeSlice(txIn.hash); + bufferWriter.writeUInt32(txIn.index); + bufferWriter.writeVarSlice(txIn.script); + bufferWriter.writeUInt32(txIn.sequence); + }); + bufferWriter.writeVarInt(tx.outs.length); + tx.outs.forEach(txOut => { + bufferWriter.writeUInt64(txOut.value); + bufferWriter.writeVarSlice(txOut.script); + }); + bufferWriter.writeUInt32(tx.locktime); + if (initialOffset !== undefined) + return buffer.subarray(initialOffset, bufferWriter.offset); + return buffer; +} +function fromConstructor(options) { + const tx = new base_1.TransactionBase(options); + tx.toBuffer = toBuffer.bind(null, tx); + return tx; +} +function fromBuffer(buffer, options) { + const bufferReader = new bufferutils_1.BufferReader(buffer); + const tx = fromConstructor(options); + tx.version = bufferReader.readInt32(); + tx.timestamp = bufferReader.readUInt32(); + const vinLen = bufferReader.readVarInt(); + for (let i = 0; i < vinLen; ++i) { + tx.ins.push({ + hash: bufferReader.readSlice(32), + index: bufferReader.readUInt32(), + script: bufferReader.readVarSlice(), + sequence: bufferReader.readUInt32(), + witness: [], + }); + } + const voutLen = bufferReader.readVarInt(); + for (let i = 0; i < voutLen; ++i) { + tx.outs.push({ + value: bufferReader.readUInt64String(), + script: bufferReader.readVarSlice(), + }); + } + tx.locktime = bufferReader.readUInt32(); + if (options.nostrict) + return tx; + if (bufferReader.offset !== buffer.length) + throw new Error('Transaction has unexpected data'); + return tx; +} +//# sourceMappingURL=peercoin.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/zcash.d.ts b/third-party/utxo-lib/transaction/zcash.d.ts new file mode 100644 index 0000000..2955bee --- /dev/null +++ b/third-party/utxo-lib/transaction/zcash.d.ts @@ -0,0 +1,66 @@ +import { TransactionBase, TransactionOptions } from './base'; +export interface ZcashCompressedG { + x: Buffer; + yLsb: number; +} +export interface ZcashSaplingZKProof { + type: 'sapling'; + sA: Buffer; + sB: Buffer; + sC: Buffer; +} +export interface ZcashJoinSplitZKProof { + type: 'joinsplit'; + gA: ZcashCompressedG; + gAPrime: ZcashCompressedG; + gB: ZcashCompressedG; + gBPrime: ZcashCompressedG; + gC: ZcashCompressedG; + gCPrime: ZcashCompressedG; + gK: ZcashCompressedG; + gH: ZcashCompressedG; +} +export interface ZcashJoinSplits { + vpubOld: number; + vpubNew: number; + anchor: Buffer; + nullifiers: Buffer[]; + commitments: Buffer[]; + ephemeralKey: Buffer; + randomSeed: Buffer; + macs: Buffer[]; + zkproof: ZcashSaplingZKProof | ZcashJoinSplitZKProof; + ciphertexts: Buffer[]; +} +export interface ZcashVShieldedSpend { + cv: Buffer; + anchor: Buffer; + nullifier: Buffer; + rk: Buffer; + zkproof: ZcashSaplingZKProof; + spendAuthSig: Buffer; +} +export interface ZcashVShieldedOutput { + cv: Buffer; + cmu: Buffer; + ephemeralKey: Buffer; + encCiphertext: Buffer; + outCiphertext: Buffer; + zkproof: ZcashSaplingZKProof; +} +export interface ZcashSpecific { + type: 'zcash'; + joinsplits: ZcashJoinSplits[]; + joinsplitPubkey: Buffer; + joinsplitSig: Buffer; + overwintered: number; + versionGroupId: number; + valueBalance: number; + vShieldedSpend: ZcashVShieldedSpend[]; + vShieldedOutput: ZcashVShieldedOutput[]; + bindingSig: Buffer; + consensusBranchId: number; +} +export declare function fromConstructor(options: TransactionOptions): TransactionBase; +export declare function fromBuffer(buffer: Buffer, options: TransactionOptions): TransactionBase; +//# sourceMappingURL=zcash.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/transaction/zcash.js b/third-party/utxo-lib/transaction/zcash.js new file mode 100644 index 0000000..2a6b69d --- /dev/null +++ b/third-party/utxo-lib/transaction/zcash.js @@ -0,0 +1,451 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromConstructor = fromConstructor; +exports.fromBuffer = fromBuffer; +const tslib_1 = require("tslib"); +const varuint = tslib_1.__importStar(require("varuint-bitcoin")); +const blakejs_1 = require("blakejs"); +const bufferutils_1 = require("../bufferutils"); +const base_1 = require("./base"); +const crypto_1 = require("../crypto"); +const ZCASH_JOINSPLITS_SUPPORT_VERSION = 2; +const ZCASH_OVERWINTER_VERSION = 3; +const ZCASH_SAPLING_VERSION = 4; +const ZCASH_NU5_VERSION = 5; +const ZCASH_NUM_JOINSPLITS_INPUTS = 2; +const ZCASH_NUM_JOINSPLITS_OUTPUTS = 2; +const ZCASH_NOTECIPHERTEXT_SIZE = 1 + 8 + 32 + 32 + 512 + 16; +const ZCASH_G1_PREFIX_MASK = 0x02; +const ZCASH_G2_PREFIX_MASK = 0x0a; +function byteLength(tx) { + const overwinterSize = tx.version >= ZCASH_OVERWINTER_VERSION + ? 4 + + 4 + : 0; + const txSpecific = tx.specific; + const getJoinSplitsSize = () => { + if (tx.version < ZCASH_JOINSPLITS_SUPPORT_VERSION || tx.version >= ZCASH_NU5_VERSION) + return 0; + const joinSplitsLen = txSpecific.joinsplits.length; + if (joinSplitsLen < 1) + return (0, bufferutils_1.varIntSize)(joinSplitsLen); + return ((0, bufferutils_1.varIntSize)(joinSplitsLen) + + (tx.version >= ZCASH_SAPLING_VERSION ? 1698 * joinSplitsLen : 1802 * joinSplitsLen) + + 32 + + 64); + }; + const saplingSize = tx.version === ZCASH_SAPLING_VERSION + ? 8 + + varuint.encodingLength(txSpecific.vShieldedSpend.length) + + 384 * txSpecific.vShieldedSpend.length + + varuint.encodingLength(txSpecific.vShieldedOutput.length) + + 948 * txSpecific.vShieldedOutput.length + + (txSpecific.vShieldedSpend.length + txSpecific.vShieldedOutput.length > 0 ? 64 : 0) + : 0; + const NU5size = tx.version >= ZCASH_NU5_VERSION + ? 4 + + 1 + + 1 + + 1 + : 0; + return (4 + + varuint.encodingLength(tx.ins.length) + + varuint.encodingLength(tx.outs.length) + + tx.ins.reduce((sum, input) => sum + 40 + (0, base_1.varSliceSize)(input.script), 0) + + tx.outs.reduce((sum, output) => sum + 8 + (0, base_1.varSliceSize)(output.script), 0) + + 4 + + overwinterSize + + getJoinSplitsSize() + + saplingSize + + NU5size); +} +function toBuffer(tx, buffer, initialOffset) { + if (!buffer) + buffer = Buffer.allocUnsafe(byteLength(tx)); + const bufferWriter = new bufferutils_1.BufferWriter(buffer, initialOffset || 0); + const txSpecific = tx.specific; + if (tx.version >= ZCASH_OVERWINTER_VERSION) { + const mask = txSpecific.overwintered ? 1 : 0; + bufferWriter.writeInt32(tx.version | (mask << 31)); + bufferWriter.writeUInt32(txSpecific.versionGroupId); + } + else { + bufferWriter.writeInt32(tx.version); + } + if (tx.version >= ZCASH_NU5_VERSION) { + bufferWriter.writeUInt32(txSpecific.consensusBranchId); + bufferWriter.writeUInt32(tx.locktime); + bufferWriter.writeUInt32(tx.expiry); + } + bufferWriter.writeVarInt(tx.ins.length); + tx.ins.forEach(txIn => { + bufferWriter.writeSlice(txIn.hash); + bufferWriter.writeUInt32(txIn.index); + bufferWriter.writeVarSlice(txIn.script); + bufferWriter.writeUInt32(txIn.sequence); + }); + bufferWriter.writeVarInt(tx.outs.length); + tx.outs.forEach(txOut => { + bufferWriter.writeUInt64(txOut.value); + bufferWriter.writeVarSlice(txOut.script); + }); + if (tx.version < ZCASH_NU5_VERSION) { + bufferWriter.writeUInt32(tx.locktime); + if (tx.version >= ZCASH_OVERWINTER_VERSION) { + bufferWriter.writeUInt32(tx.expiry); + } + } + if (tx.version === ZCASH_SAPLING_VERSION) { + bufferWriter.writeInt64(txSpecific.valueBalance); + bufferWriter.writeVarInt(txSpecific.vShieldedSpend.length); + txSpecific.vShieldedSpend.forEach(shieldedSpend => { + bufferWriter.writeSlice(shieldedSpend.cv); + bufferWriter.writeSlice(shieldedSpend.anchor); + bufferWriter.writeSlice(shieldedSpend.nullifier); + bufferWriter.writeSlice(shieldedSpend.rk); + bufferWriter.writeSlice(shieldedSpend.zkproof.sA); + bufferWriter.writeSlice(shieldedSpend.zkproof.sB); + bufferWriter.writeSlice(shieldedSpend.zkproof.sC); + bufferWriter.writeSlice(shieldedSpend.spendAuthSig); + }); + bufferWriter.writeVarInt(txSpecific.vShieldedOutput.length); + txSpecific.vShieldedOutput.forEach(shieldedOutput => { + bufferWriter.writeSlice(shieldedOutput.cv); + bufferWriter.writeSlice(shieldedOutput.cmu); + bufferWriter.writeSlice(shieldedOutput.ephemeralKey); + bufferWriter.writeSlice(shieldedOutput.encCiphertext); + bufferWriter.writeSlice(shieldedOutput.outCiphertext); + bufferWriter.writeSlice(shieldedOutput.zkproof.sA); + bufferWriter.writeSlice(shieldedOutput.zkproof.sB); + bufferWriter.writeSlice(shieldedOutput.zkproof.sC); + }); + } + function writeCompressedG1(i) { + bufferWriter.writeUInt8(ZCASH_G1_PREFIX_MASK | i.yLsb); + bufferWriter.writeSlice(i.x); + } + function writeCompressedG2(i) { + bufferWriter.writeUInt8(ZCASH_G2_PREFIX_MASK | i.yLsb); + bufferWriter.writeSlice(i.x); + } + if (tx.version >= ZCASH_JOINSPLITS_SUPPORT_VERSION && tx.version < ZCASH_NU5_VERSION) { + bufferWriter.writeVarInt(txSpecific.joinsplits.length); + txSpecific.joinsplits.forEach(joinsplit => { + bufferWriter.writeUInt64(joinsplit.vpubOld); + bufferWriter.writeUInt64(joinsplit.vpubNew); + bufferWriter.writeSlice(joinsplit.anchor); + joinsplit.nullifiers.forEach(nullifier => { + bufferWriter.writeSlice(nullifier); + }); + joinsplit.commitments.forEach(nullifier => { + bufferWriter.writeSlice(nullifier); + }); + bufferWriter.writeSlice(joinsplit.ephemeralKey); + bufferWriter.writeSlice(joinsplit.randomSeed); + joinsplit.macs.forEach(nullifier => { + bufferWriter.writeSlice(nullifier); + }); + if (joinsplit.zkproof.type === 'sapling') { + bufferWriter.writeSlice(joinsplit.zkproof.sA); + bufferWriter.writeSlice(joinsplit.zkproof.sB); + bufferWriter.writeSlice(joinsplit.zkproof.sC); + } + else { + writeCompressedG1(joinsplit.zkproof.gA); + writeCompressedG1(joinsplit.zkproof.gAPrime); + writeCompressedG2(joinsplit.zkproof.gB); + writeCompressedG1(joinsplit.zkproof.gBPrime); + writeCompressedG1(joinsplit.zkproof.gC); + writeCompressedG1(joinsplit.zkproof.gCPrime); + writeCompressedG1(joinsplit.zkproof.gK); + writeCompressedG1(joinsplit.zkproof.gH); + } + joinsplit.ciphertexts.forEach(ciphertext => { + bufferWriter.writeSlice(ciphertext); + }); + }); + if (txSpecific.joinsplits.length > 0) { + bufferWriter.writeSlice(txSpecific.joinsplitPubkey); + bufferWriter.writeSlice(txSpecific.joinsplitSig); + } + } + if (tx.version >= ZCASH_SAPLING_VERSION && + txSpecific.vShieldedSpend.length + txSpecific.vShieldedOutput.length > 0) { + bufferWriter.writeSlice(txSpecific.bindingSig); + } + if (tx.version === ZCASH_NU5_VERSION) { + bufferWriter.writeVarInt(0); + bufferWriter.writeVarInt(0); + bufferWriter.writeUInt8(0x00); + } + if (initialOffset !== undefined) + return buffer.subarray(initialOffset, bufferWriter.offset); + return buffer; +} +function getExtraData(tx) { + if (tx.version < ZCASH_JOINSPLITS_SUPPORT_VERSION || tx.version >= ZCASH_NU5_VERSION) + return; + const offset = 4 + + (tx.version >= ZCASH_OVERWINTER_VERSION ? 8 : 0) + + varuint.encodingLength(tx.ins.length) + + varuint.encodingLength(tx.outs.length) + + tx.ins.reduce((sum, input) => sum + 40 + (0, base_1.varSliceSize)(input.script), 0) + + tx.outs.reduce((sum, output) => sum + 8 + (0, base_1.varSliceSize)(output.script), 0) + + 4; + return tx.toBuffer().subarray(offset); +} +function getBlake2bDigestHash(buffer, personalization) { + const hash = (0, blakejs_1.blake2b)(buffer, undefined, 32, undefined, Buffer.from(personalization)); + return Buffer.from(hash); +} +function getHeaderDigest(tx) { + const mask = tx.specific.overwintered ? 1 : 0; + const writer = new bufferutils_1.BufferWriter(Buffer.alloc(4 * 5)); + writer.writeInt32(tx.version | (mask << 31)); + writer.writeUInt32(tx.specific.versionGroupId); + writer.writeUInt32(tx.specific.consensusBranchId); + writer.writeUInt32(tx.locktime); + writer.writeUInt32(tx.expiry); + return getBlake2bDigestHash(writer.buffer, 'ZTxIdHeadersHash'); +} +function getPrevoutsDigest(ins) { + const bufferWriter = new bufferutils_1.BufferWriter(Buffer.allocUnsafe(36 * ins.length)); + ins.forEach(txIn => { + bufferWriter.writeSlice(txIn.hash); + bufferWriter.writeUInt32(txIn.index); + }); + return getBlake2bDigestHash(bufferWriter.buffer, 'ZTxIdPrevoutHash'); +} +function getSequenceDigest(ins) { + const bufferWriter = new bufferutils_1.BufferWriter(Buffer.allocUnsafe(4 * ins.length)); + ins.forEach(txIn => { + bufferWriter.writeUInt32(txIn.sequence); + }); + return getBlake2bDigestHash(bufferWriter.buffer, 'ZTxIdSequencHash'); +} +function getOutputsDigest(outs) { + const txOutsSize = outs.reduce((sum, output) => sum + 8 + (0, base_1.varSliceSize)(output.script), 0); + const bufferWriter = new bufferutils_1.BufferWriter(Buffer.allocUnsafe(txOutsSize)); + outs.forEach(out => { + bufferWriter.writeUInt64(out.value); + bufferWriter.writeVarSlice(out.script); + }); + return getBlake2bDigestHash(bufferWriter.buffer, 'ZTxIdOutputsHash'); +} +function getTransparentDigest(tx) { + let buffer; + if (tx.ins.length || tx.outs.length) { + const writer = new bufferutils_1.BufferWriter(Buffer.alloc(32 * 3)); + writer.writeSlice(getPrevoutsDigest(tx.ins)); + writer.writeSlice(getSequenceDigest(tx.ins)); + writer.writeSlice(getOutputsDigest(tx.outs)); + buffer = writer.buffer; + } + else { + buffer = Buffer.of(); + } + return getBlake2bDigestHash(buffer, 'ZTxIdTranspaHash'); +} +function getHash(tx, _forWitness = false) { + if (tx.version < ZCASH_NU5_VERSION) { + return (0, crypto_1.hash256)(toBuffer(tx)); + } + const writer = new bufferutils_1.BufferWriter(Buffer.alloc(32 * 4)); + writer.writeSlice(getHeaderDigest(tx)); + writer.writeSlice(getTransparentDigest(tx)); + writer.writeSlice(getBlake2bDigestHash(Buffer.of(), 'ZTxIdSaplingHash')); + writer.writeSlice(getBlake2bDigestHash(Buffer.of(), 'ZTxIdOrchardHash')); + const personalizationTag = 'ZcashTxHash_'; + const personalization = new bufferutils_1.BufferWriter(Buffer.alloc(personalizationTag.length + 4)); + personalization.writeSlice(Buffer.from(personalizationTag)); + personalization.writeUInt32(tx.specific.consensusBranchId); + return getBlake2bDigestHash(writer.buffer, personalization.buffer); +} +function fromConstructor(options) { + const tx = new base_1.TransactionBase(options); + tx.specific = tx.specific || { + type: 'zcash', + joinsplits: [], + joinsplitPubkey: base_1.EMPTY_SCRIPT, + joinsplitSig: base_1.EMPTY_SCRIPT, + overwintered: 0, + versionGroupId: 0, + valueBalance: 0, + vShieldedSpend: [], + vShieldedOutput: [], + bindingSig: base_1.EMPTY_SCRIPT, + consensusBranchId: 0, + }; + tx.byteLength = byteLength.bind(null, tx); + tx.toBuffer = toBuffer.bind(null, tx); + tx.getExtraData = getExtraData.bind(null, tx); + tx.getHash = getHash.bind(null, tx); + return tx; +} +function fromBuffer(buffer, options) { + const bufferReader = new bufferutils_1.BufferReader(buffer); + const tx = fromConstructor(options); + const txSpecific = tx.specific; + tx.version = bufferReader.readInt32(); + txSpecific.overwintered = tx.version >>> 31; + tx.version &= 0x07fffffff; + if (tx.version >= ZCASH_OVERWINTER_VERSION) { + txSpecific.versionGroupId = bufferReader.readUInt32(); + } + if (tx.version >= ZCASH_NU5_VERSION) { + txSpecific.consensusBranchId = bufferReader.readUInt32(); + tx.locktime = bufferReader.readUInt32(); + tx.expiry = bufferReader.readUInt32(); + } + const vinLen = bufferReader.readVarInt(); + for (let i = 0; i < vinLen; ++i) { + tx.ins.push({ + hash: bufferReader.readSlice(32), + index: bufferReader.readUInt32(), + script: bufferReader.readVarSlice(), + sequence: bufferReader.readUInt32(), + witness: [], + }); + } + const voutLen = bufferReader.readVarInt(); + for (let i = 0; i < voutLen; ++i) { + tx.outs.push({ + value: bufferReader.readUInt64String(), + script: bufferReader.readVarSlice(), + }); + } + if (tx.version < ZCASH_NU5_VERSION) { + tx.locktime = bufferReader.readUInt32(); + tx.expiry = tx.version >= ZCASH_OVERWINTER_VERSION ? bufferReader.readUInt32() : 0; + } + function readCompressedG1() { + const yLsb = bufferReader.readUInt8() & 1; + const x = bufferReader.readSlice(32); + return { + x, + yLsb, + }; + } + function readCompressedG2() { + const yLsb = bufferReader.readUInt8() & 1; + const x = bufferReader.readSlice(64); + return { + x, + yLsb, + }; + } + function readSaplingZKProof() { + return { + type: 'sapling', + sA: bufferReader.readSlice(48), + sB: bufferReader.readSlice(96), + sC: bufferReader.readSlice(48), + }; + } + function readZKProof() { + if (tx.version >= ZCASH_SAPLING_VERSION) { + return readSaplingZKProof(); + } + return { + type: 'joinsplit', + gA: readCompressedG1(), + gAPrime: readCompressedG1(), + gB: readCompressedG2(), + gBPrime: readCompressedG1(), + gC: readCompressedG1(), + gCPrime: readCompressedG1(), + gK: readCompressedG1(), + gH: readCompressedG1(), + }; + } + if (tx.version === ZCASH_SAPLING_VERSION) { + txSpecific.valueBalance = bufferReader.readInt64(); + const nShieldedSpend = bufferReader.readVarInt(); + for (let i = 0; i < nShieldedSpend; ++i) { + txSpecific.vShieldedSpend.push({ + cv: bufferReader.readSlice(32), + anchor: bufferReader.readSlice(32), + nullifier: bufferReader.readSlice(32), + rk: bufferReader.readSlice(32), + zkproof: readSaplingZKProof(), + spendAuthSig: bufferReader.readSlice(64), + }); + } + const nShieldedOutput = bufferReader.readVarInt(); + for (let i = 0; i < nShieldedOutput; ++i) { + txSpecific.vShieldedOutput.push({ + cv: bufferReader.readSlice(32), + cmu: bufferReader.readSlice(32), + ephemeralKey: bufferReader.readSlice(32), + encCiphertext: bufferReader.readSlice(580), + outCiphertext: bufferReader.readSlice(80), + zkproof: readSaplingZKProof(), + }); + } + } + if (tx.version >= ZCASH_JOINSPLITS_SUPPORT_VERSION && tx.version < ZCASH_NU5_VERSION) { + const joinSplitsLen = bufferReader.readVarInt(); + for (let i = 0; i < joinSplitsLen; ++i) { + let j; + const vpubOld = bufferReader.readUInt64(); + const vpubNew = bufferReader.readUInt64(); + const anchor = bufferReader.readSlice(32); + const nullifiers = []; + for (j = 0; j < ZCASH_NUM_JOINSPLITS_INPUTS; j++) { + nullifiers.push(bufferReader.readSlice(32)); + } + const commitments = []; + for (j = 0; j < ZCASH_NUM_JOINSPLITS_OUTPUTS; j++) { + commitments.push(bufferReader.readSlice(32)); + } + const ephemeralKey = bufferReader.readSlice(32); + const randomSeed = bufferReader.readSlice(32); + const macs = []; + for (j = 0; j < ZCASH_NUM_JOINSPLITS_INPUTS; j++) { + macs.push(bufferReader.readSlice(32)); + } + const zkproof = readZKProof(); + const ciphertexts = []; + for (j = 0; j < ZCASH_NUM_JOINSPLITS_OUTPUTS; j++) { + ciphertexts.push(bufferReader.readSlice(ZCASH_NOTECIPHERTEXT_SIZE)); + } + txSpecific.joinsplits.push({ + vpubOld, + vpubNew, + anchor, + nullifiers, + commitments, + ephemeralKey, + randomSeed, + macs, + zkproof, + ciphertexts, + }); + } + if (joinSplitsLen > 0) { + txSpecific.joinsplitPubkey = bufferReader.readSlice(32); + txSpecific.joinsplitSig = bufferReader.readSlice(64); + } + } + if (tx.version >= ZCASH_SAPLING_VERSION && + txSpecific.vShieldedSpend.length + txSpecific.vShieldedOutput.length > 0) { + txSpecific.bindingSig = bufferReader.readSlice(64); + } + if (tx.version === ZCASH_NU5_VERSION) { + if (bufferReader.readVarInt() !== 0) { + throw Error('Unexpected vSpendsSapling vector'); + } + if (bufferReader.readVarInt() !== 0) { + throw Error('Unexpected vOutputsSapling vector'); + } + if (bufferReader.readUInt8() !== 0x00) { + throw Error('Unexpected orchard byte'); + } + } + if (options.nostrict) + return tx; + if (bufferReader.offset !== buffer.length) + throw new Error('Transaction has unexpected data'); + return tx; +} +//# sourceMappingURL=zcash.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/types/coinselect.d.ts b/third-party/utxo-lib/types/coinselect.d.ts new file mode 100644 index 0000000..39289db --- /dev/null +++ b/third-party/utxo-lib/types/coinselect.d.ts @@ -0,0 +1,61 @@ +import BN from 'bn.js'; +import { TransactionInputOutputSortingStrategy } from './compose'; +export type CoinSelectPaymentType = 'p2pkh' | 'p2sh' | 'p2tr' | 'p2wpkh' | 'p2wsh'; +export interface CoinSelectOptions { + txType: CoinSelectPaymentType; + changeOutput?: CoinSelectOutput; + dustThreshold?: number; + longTermFeeRate?: number; + own?: number; + other?: number; + coinbase?: number; + baseFee?: number; + floorBaseFee?: boolean; + sortingStrategy: TransactionInputOutputSortingStrategy; + feePolicy?: 'bitcoin' | 'doge' | 'zcash'; +} +export interface CoinSelectInput { + type: CoinSelectPaymentType; + i: number; + script: { + length: number; + }; + value: BN; + confirmations: number; + coinbase?: boolean; + required?: boolean; + own?: boolean; + weight?: number; +} +export interface CoinSelectOutput { + script: { + length: number; + }; + value?: BN; + weight?: number; +} +export interface CoinSelectOutputFinal { + script: { + length: number; + }; + value: BN; +} +export interface CoinSelectRequest extends CoinSelectOptions { + inputs: CoinSelectInput[]; + outputs: CoinSelectOutput[]; + sendMaxOutputIndex: number; + feeRate: number; +} +export type CoinSelectAlgorithm = (inputs: CoinSelectInput[], outputs: CoinSelectOutput[], feeRate: number, options: CoinSelectOptions) => CoinSelectResult; +export interface CoinSelectSuccess { + fee: number; + inputs: CoinSelectInput[]; + outputs: CoinSelectOutputFinal[]; +} +export interface CoinSelectFailure { + fee: number; + inputs?: typeof undefined; + outputs?: typeof undefined; +} +export type CoinSelectResult = CoinSelectSuccess | CoinSelectFailure; +//# sourceMappingURL=coinselect.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/types/coinselect.js b/third-party/utxo-lib/types/coinselect.js new file mode 100644 index 0000000..82c6206 --- /dev/null +++ b/third-party/utxo-lib/types/coinselect.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=coinselect.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/types/compose.d.ts b/third-party/utxo-lib/types/compose.d.ts new file mode 100644 index 0000000..5c9a32f --- /dev/null +++ b/third-party/utxo-lib/types/compose.d.ts @@ -0,0 +1,98 @@ +import type { Network } from '../networks'; +import type { CoinSelectPaymentType } from './coinselect'; +export interface ComposeInput { + vout: number; + txid: string; + amount: string; + coinbase: boolean; + own: boolean; + confirmations: number; + required?: boolean; +} +export interface ComposeOutputPayment { + type: 'payment'; + address: string; + amount: string; +} +export interface ComposeOutputPaymentNoAddress { + type: 'payment-noaddress'; + amount: string; +} +export interface ComposeOutputSendMax { + type: 'send-max'; + address: string; + amount?: typeof undefined; +} +export interface ComposeOutputSendMaxNoAddress { + type: 'send-max-noaddress'; + amount?: typeof undefined; +} +export interface ComposeOutputOpreturn { + type: 'opreturn'; + dataHex: string; + amount?: typeof undefined; + address?: typeof undefined; +} +export interface ComposeOutputChange { + type: 'change'; + amount: string; +} +export type ComposeFinalOutput = ComposeOutputPayment | ComposeOutputSendMax | ComposeOutputOpreturn; +export type ComposeNotFinalOutput = ComposeOutputPaymentNoAddress | ComposeOutputSendMaxNoAddress; +export type ComposeOutput = ComposeFinalOutput | ComposeNotFinalOutput; +export interface ComposeChangeAddress { + address: string; +} +export type TransactionInputOutputSortingStrategy = 'bip69' | 'random' | 'none'; +export type ComposeRequest = { + txType?: CoinSelectPaymentType; + utxos: Input[]; + outputs: Output[]; + feeRate: string | number; + longTermFeeRate?: string | number; + network: Network; + changeAddress: Change; + dustThreshold: number; + baseFee?: number; + floorBaseFee?: boolean; + skipUtxoSelection?: boolean; + sortingStrategy: TransactionInputOutputSortingStrategy; +}; +type ComposedTransactionOutputs = T extends ComposeOutputSendMax ? Omit & ComposeOutputPayment : T extends ComposeFinalOutput ? T : never; +export interface ComposedTransaction { + inputs: Input[]; + outputs: (ComposedTransactionOutputs | (Change & ComposeOutputChange))[]; + outputsPermutation: number[]; +} +export declare const COMPOSE_ERROR_TYPES: readonly ["MISSING-UTXOS", "MISSING-OUTPUTS", "INCORRECT-FEE-RATE", "NOT-ENOUGH-FUNDS"]; +export type ComposeResultError = { + type: 'error'; + error: (typeof COMPOSE_ERROR_TYPES)[number]; +} | { + type: 'error'; + error: 'INCORRECT-UTXO' | 'INCORRECT-OUTPUT' | 'COINSELECT'; + message: string; +}; +export interface ComposeResultNonFinal { + type: 'nonfinal'; + max?: string; + totalSpent: string; + fee: string; + feePerByte: string; + bytes: number; + inputs: Input[]; +} +export interface ComposeResultFinal extends ComposedTransaction { + type: 'final'; + max?: string; + totalSpent: string; + fee: string; + feePerByte: string; + bytes: number; + inputs: Input[]; + outputs: (ComposedTransactionOutputs | (Change & ComposeOutputChange))[]; + outputsPermutation: number[]; +} +export type ComposeResult = ComposeResultError | ComposeResultNonFinal | ComposeResultFinal; +export {}; +//# sourceMappingURL=compose.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/types/compose.js b/third-party/utxo-lib/types/compose.js new file mode 100644 index 0000000..c2973af --- /dev/null +++ b/third-party/utxo-lib/types/compose.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.COMPOSE_ERROR_TYPES = void 0; +exports.COMPOSE_ERROR_TYPES = [ + 'MISSING-UTXOS', + 'MISSING-OUTPUTS', + 'INCORRECT-FEE-RATE', + 'NOT-ENOUGH-FUNDS', +]; +//# sourceMappingURL=compose.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/types/index.d.ts b/third-party/utxo-lib/types/index.d.ts new file mode 100644 index 0000000..a41f99f --- /dev/null +++ b/third-party/utxo-lib/types/index.d.ts @@ -0,0 +1,5 @@ +export * from './coinselect'; +export * from './compose'; +export * from './payments'; +export * from './typeforce'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/types/index.js b/third-party/utxo-lib/types/index.js new file mode 100644 index 0000000..ca05024 --- /dev/null +++ b/third-party/utxo-lib/types/index.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = require("tslib"); +tslib_1.__exportStar(require("./coinselect"), exports); +tslib_1.__exportStar(require("./compose"), exports); +tslib_1.__exportStar(require("./payments"), exports); +tslib_1.__exportStar(require("./typeforce"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/types/payments.d.ts b/third-party/utxo-lib/types/payments.d.ts new file mode 100644 index 0000000..7fe6dd7 --- /dev/null +++ b/third-party/utxo-lib/types/payments.d.ts @@ -0,0 +1,30 @@ +import type { Network } from '../networks'; +export type PaymentName = 'p2pk' | 'p2pkh' | 'p2sh' | 'p2tr' | 'p2wpkh' | 'p2wsh' | 'p2ms' | 'embed' | 'sstxchange' | 'sstxcommitment' | 'sstxpkh' | 'sstxsh'; +export interface Payment { + name?: PaymentName; + network?: Network; + output?: Buffer; + data?: Buffer[]; + m?: number; + n?: number; + pubkeys?: Buffer[]; + input?: Buffer; + signatures?: Buffer[]; + pubkey?: Buffer; + signature?: Buffer; + address?: string; + hash?: Buffer; + redeem?: Payment; + witness?: Buffer[]; + amount?: string; +} +export declare type PaymentCreator = (a: Payment, opts?: PaymentOpts) => Payment; +export declare type PaymentFunction = () => Payment; +export interface PaymentOpts { + validate?: boolean; + allowIncomplete?: boolean; +} +export type StackElement = Buffer | number; +export type Stack = StackElement[]; +export type StackFunction = () => Stack; +//# sourceMappingURL=payments.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/types/payments.js b/third-party/utxo-lib/types/payments.js new file mode 100644 index 0000000..6d6931c --- /dev/null +++ b/third-party/utxo-lib/types/payments.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=payments.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/types/typeforce.d.ts b/third-party/utxo-lib/types/typeforce.d.ts new file mode 100644 index 0000000..f9ae051 --- /dev/null +++ b/third-party/utxo-lib/types/typeforce.d.ts @@ -0,0 +1,8 @@ +import typeforce from 'typeforce'; +export declare function Satoshi(value: number): boolean; +export declare const Buffer256bit: (value: any) => value is Buffer; +export declare const Hash160bit: (value: any) => value is Buffer; +export declare const Hash256bit: (value: any) => value is Buffer; +export declare const Number: (value: any) => value is number, Array: (value: any) => value is any[], Boolean: (value: any) => value is boolean, String: (value: any) => value is string, Buffer: (value: any) => value is Buffer, Hex: (value: any) => value is string, maybe: (type: any) => boolean, tuple: (...args: any[]) => boolean, UInt8: (value: any) => value is number, UInt16: (value: any) => value is number, UInt32: (value: any) => value is number, Function: (value: any) => value is FunctionConstructor, BufferN: (length: number) => (value: any) => value is Buffer, Nil: (value: any) => boolean, anyOf: (...args: any[]) => (value: any) => boolean; +export { typeforce }; +//# sourceMappingURL=typeforce.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/types/typeforce.js b/third-party/utxo-lib/types/typeforce.js new file mode 100644 index 0000000..9d5e884 --- /dev/null +++ b/third-party/utxo-lib/types/typeforce.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.typeforce = exports.anyOf = exports.Nil = exports.BufferN = exports.Function = exports.UInt32 = exports.UInt16 = exports.UInt8 = exports.tuple = exports.maybe = exports.Hex = exports.Buffer = exports.String = exports.Boolean = exports.Array = exports.Number = exports.Hash256bit = exports.Hash160bit = exports.Buffer256bit = void 0; +exports.Satoshi = Satoshi; +const tslib_1 = require("tslib"); +const typeforce_1 = tslib_1.__importDefault(require("typeforce")); +exports.typeforce = typeforce_1.default; +const SATOSHI_MAX = 21 * 1e14; +function Satoshi(value) { + return typeforce_1.default.UInt53(value) && value <= SATOSHI_MAX; +} +exports.Buffer256bit = typeforce_1.default.BufferN(32); +exports.Hash160bit = typeforce_1.default.BufferN(20); +exports.Hash256bit = typeforce_1.default.BufferN(32); +exports.Number = typeforce_1.default.Number, exports.Array = typeforce_1.default.Array, exports.Boolean = typeforce_1.default.Boolean, exports.String = typeforce_1.default.String, exports.Buffer = typeforce_1.default.Buffer, exports.Hex = typeforce_1.default.Hex, exports.maybe = typeforce_1.default.maybe, exports.tuple = typeforce_1.default.tuple, exports.UInt8 = typeforce_1.default.UInt8, exports.UInt16 = typeforce_1.default.UInt16, exports.UInt32 = typeforce_1.default.UInt32, exports.Function = typeforce_1.default.Function, exports.BufferN = typeforce_1.default.BufferN, exports.Nil = typeforce_1.default.Nil, exports.anyOf = typeforce_1.default.anyOf; +//# sourceMappingURL=typeforce.js.map \ No newline at end of file diff --git a/third-party/utxo-lib/vsize.d.ts b/third-party/utxo-lib/vsize.d.ts new file mode 100644 index 0000000..ca1f06b --- /dev/null +++ b/third-party/utxo-lib/vsize.d.ts @@ -0,0 +1,13 @@ +import type { Network } from './networks'; +export declare const getTransactionVbytesFromAddresses: (inputs: string[], outputs: string[], network: Network) => number; +type GetTransactionVbytesParam = { + vin: { + addresses?: string[]; + }[]; + vout: { + addresses?: string[]; + }[]; +}; +export declare const getTransactionVbytes: ({ vin, vout }: GetTransactionVbytesParam, network: Network) => number; +export {}; +//# sourceMappingURL=vsize.d.ts.map \ No newline at end of file diff --git a/third-party/utxo-lib/vsize.js b/third-party/utxo-lib/vsize.js new file mode 100644 index 0000000..c592d05 --- /dev/null +++ b/third-party/utxo-lib/vsize.js @@ -0,0 +1,50 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getTransactionVbytes = exports.getTransactionVbytesFromAddresses = void 0; +const tslib_1 = require("tslib"); +const BitcoinJsAddress = tslib_1.__importStar(require("./address")); +const coinselectUtils_1 = require("./coinselect/coinselectUtils"); +const address_1 = require("./address"); +const isKnownInputAddress = (type) => type in coinselectUtils_1.INPUT_SCRIPT_LENGTH; +const toVin = (network) => (address) => { + const type = (0, address_1.getAddressType)(address, network); + if (isKnownInputAddress(type)) { + return { + type, + script: { length: coinselectUtils_1.INPUT_SCRIPT_LENGTH[type] }, + }; + } + throw new Error(`Unknown input address '${address}'`); +}; +const toVout = (network) => (address) => { + var _a; + let length; + try { + length = BitcoinJsAddress.toOutputScript(address, network).length; + } + catch (_b) { + const msg = (_a = address.match(/^OP_RETURN (.*)$/)) === null || _a === void 0 ? void 0 : _a.pop(); + if (msg) { + length = msg.match(/^\(.*\)$/) + ? msg.length + : 2 + msg.length / 2; + } + else { + length = 0; + } + } + return { script: { length } }; +}; +const getTransactionVbytesFromAddresses = (inputs, outputs, network) => { + const ins = inputs.map(toVin(network)); + const outs = outputs.map(toVout(network)); + return (0, coinselectUtils_1.transactionBytes)(ins, outs); +}; +exports.getTransactionVbytesFromAddresses = getTransactionVbytesFromAddresses; +const getTransactionVbytes = ({ vin, vout }, network) => { + const ins = vin.map(({ addresses = [] }) => { var _a; return (_a = addresses[0]) !== null && _a !== void 0 ? _a : ''; }); + const outs = vout.map(({ addresses = [] }) => { var _a; return (_a = addresses[0]) !== null && _a !== void 0 ? _a : ''; }); + return (0, exports.getTransactionVbytesFromAddresses)(ins, outs, network); +}; +exports.getTransactionVbytes = getTransactionVbytes; +//# sourceMappingURL=vsize.js.map \ No newline at end of file diff --git a/utils.js b/utils.js index a396520..7fabd4e 100644 --- a/utils.js +++ b/utils.js @@ -12,7 +12,7 @@ function inputBytes (input) { function outputBytes (output) { if (output.script) { - return OP_RETURN_OVERHEAD + output.script.length + (output.script.length >= 74 ? 2 : 1); + return OP_RETURN_OVERHEAD + output.script.length + (output.script.length >= 74 ? 2 : 1) } return TX_OUTPUT_BASE + (output.script ? output.script.length : TX_OUTPUT_PUBKEYHASH) } diff --git a/witness.d.ts b/witness.d.ts new file mode 100644 index 0000000..841ed10 --- /dev/null +++ b/witness.d.ts @@ -0,0 +1,69 @@ +export type IPaymentType = 'p2pkh' | 'p2sh' | 'p2tr' | 'p2wpkh' | 'p2wsh'; +export interface IUtxo { + vout: number; + txid: string; + amount: string; + coinbase: boolean; + own: boolean; + confirmations: number; +} + +export interface IOutputPayment { + type: 'payment'; + address: string; + amount: string; +} + +export interface IOutputSendMax { + type: 'send-max'; // only one in TX request + address: string; + amount?: typeof undefined; +} + +export interface IOutputOpreturn { + type: 'opreturn'; + dataHex: string; + amount?: typeof undefined; + address?: typeof undefined; +} +export interface IOutputChange { + type: 'change'; + amount: string; +} + +export type IFinalOutput = + | ComposeOutputPayment + | ComposeOutputSendMax + | ComposeOutputOpreturn; + +export interface IChangeAddress { + address: string; + path: string; +} + +export interface ICoinSelectParams { + utxos: IUtxo[]; + outputs: IFinalOutput[]; + feeRate: string | number; + changeAddress: IChangeAddress; + network: any; + txType: IPaymentType + baseFee?: number; + dustThreshold?: number; +} + +export interface ICoinSelectResult { + type: 'final'; + max?: string; + totalSpent: string; + fee: string; + feePerByte: string; + bytes: number; + inputs: IUtxo[]; + outputs: (IFinalOutput | IOutputChange)[]; + outputsPermutation: number[]; +} + +declare function coinSelect(params: ICoinSelectParams): ICoinSelectResult; + +export = coinSelect; \ No newline at end of file diff --git a/witness.js b/witness.js new file mode 100644 index 0000000..52d622d --- /dev/null +++ b/witness.js @@ -0,0 +1,30 @@ +const { composeTx } = require('./third-party/utxo-lib') + +module.exports = function coinSelect ({ + utxos, + outputs, + feeRate, + changeAddress, + network, + txType, + baseFee = 0, + dustThreshold = 546 +}) { + const result = composeTx({ + utxos, + outputs, + feeRate, + sortingStrategy: 'random', + txType, + dustThreshold, + changeAddress, + network, + baseFee + }) + + if (result.type === 'error') { + throw new Error(result.message || result.error) + } + + return result +}