diff --git a/.eslintrc b/.eslintrc index 35a7a90d..5d3358e3 100644 --- a/.eslintrc +++ b/.eslintrc @@ -11,6 +11,8 @@ "prettier" ], "rules": { + "@typescript-eslint/no-unused-vars": "off", + "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/ban-ts-comment": "off", "@typescript-eslint/ban-types": "off", "@typescript-eslint/indent": "off", diff --git a/CHANGELOG.md b/CHANGELOG.md index 71b76caa..ede00542 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ > Description -Feature release including multi-hook support, improved UX for off chain token holders and general improvements. +Performance and code quality improvements. ### Upgrade Steps @@ -12,26 +12,19 @@ Feature release including multi-hook support, improved UX for off chain token ho ### New Features -- Extended the configuration options for 'active' mode ui text -- Off Chain Token Issuer UX improvements to notify the end user when the page will re-direct -- Re-direct view state UX improvements for 'active' mode -- Re-direct accept / deny options given to end user (to cancel the loading of tokens) -- Multi-Hook support added -- Added selected token issuer keys to 'tokens-selected' event hook -- Explicitly include ethers library availabilty via Token Negotiator library interface `client.externalUtils.evm.ethers` -- Aligned on chain authentication with off chain user interface (for single token authentication on the client side). Multi token on chain authentication is not yet supported (via the current library features). +[none] ### Bug Fixes -- TS interface custom view -- Single token off chain authentication incompatibility interface fix -- EAS authentication fixed via attestation.id updated dependency @tokenscript/attestation to version "0.7.0-rc.2" +[none] ### Performance / Quality Improvements -- Reduced the duplication of variable definitions (moved to a common constants file). -- Increased unit test coverage +- Reduced cognitive complexity of functions +- Removed deprecated TODO's or those logged for future changes in product roadmap +- Upgraded package dependencies +- Additional Code splitting added to reduce the package size **Full Change log**: -https://github.com/TokenScript/token-negotiator/compare/v3.1.1....v3.2.0 +https://github.com/TokenScript/token-negotiator/compare/v3.2.0....v3.2.1 diff --git a/package-lock.json b/package-lock.json index 4b96b2a5..c5a83258 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@tokenscript/token-negotiator", - "version": "3.2.0", + "version": "3.2.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@tokenscript/token-negotiator", - "version": "3.2.0", + "version": "3.2.1", "license": "MIT", "dependencies": { "@onflow/fcl": "^1.3.2", @@ -33,8 +33,8 @@ "@types/jest": "^28.1.5", "@types/keccak": "^3.0.1", "@types/readable-stream": "^2.3.13", - "@typescript-eslint/eslint-plugin": "^5.30.0", - "@typescript-eslint/parser": "^5.20.0", + "@typescript-eslint/eslint-plugin": "6.9.0", + "@typescript-eslint/parser": "^6.0.0", "assert": "^2.0.0", "babel-jest": "^28.1.2", "buffer": "^6.0.3", @@ -5040,9 +5040,9 @@ } }, "node_modules/@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.14", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", + "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", "dev": true }, "node_modules/@types/keccak": { @@ -5100,9 +5100,9 @@ } }, "node_modules/@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", "dev": true }, "node_modules/@types/stack-utils": { @@ -5133,32 +5133,33 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.54.0.tgz", - "integrity": "sha512-+hSN9BdSr629RF02d7mMtXhAJvDTyCbprNYJKrXETlul/Aml6YZwd90XioVbjejQeHbb3R8Dg0CkRgoJDxo8aw==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.0.tgz", + "integrity": "sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.54.0", - "@typescript-eslint/type-utils": "5.54.0", - "@typescript-eslint/utils": "5.54.0", + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.9.0", + "@typescript-eslint/type-utils": "6.9.0", + "@typescript-eslint/utils": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0", "debug": "^4.3.4", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", - "natural-compare-lite": "^1.4.0", - "regexpp": "^3.2.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^5.0.0", - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -5166,53 +5167,6 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.0.tgz", - "integrity": "sha512-VTPYNZ7vaWtYna9M4oD42zENOBrb+ZYyCNdFs949GcN8Miwn37b8b7eMj+EZaq7VK9fx0Jd+JhmkhjFhvnovhg==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.54.0", - "@typescript-eslint/visitor-keys": "5.54.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.0.tgz", - "integrity": "sha512-nExy+fDCBEgqblasfeE3aQ3NuafBUxZxgxXcYfzYRZFHdVvk5q60KhCSkG0noHgHRo/xQ/BOzURLZAafFpTkmQ==", - "dev": true, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.0.tgz", - "integrity": "sha512-xu4wT7aRCakGINTLGeyGqDn+78BwFlggwBjnHa1ar/KaGagnmwLYmlrXIrgAaQ3AE1Vd6nLfKASm7LrFHNbKGA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.54.0", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/eslint-plugin/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -5247,25 +5201,26 @@ "dev": true }, "node_modules/@typescript-eslint/parser": { - "version": "5.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.56.0.tgz", - "integrity": "sha512-sn1OZmBxUsgxMmR8a8U5QM/Wl+tyqlH//jTqCg8daTAmhAk26L2PFhcqPLlYBhYUJMZJK276qLXlHN3a83o2cg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.0.0.tgz", + "integrity": "sha512-TNaufYSPrr1U8n+3xN+Yp9g31vQDJqhXzzPSHfQDLcaO4tU+mCfODPxCwf4H530zo7aUBE3QIdxCXamEnG04Tg==", "dev": true, "dependencies": { - "@typescript-eslint/scope-manager": "5.56.0", - "@typescript-eslint/types": "5.56.0", - "@typescript-eslint/typescript-estree": "5.56.0", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/typescript-estree": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", "debug": "^4.3.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -5273,17 +5228,64 @@ } } }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.0.0.tgz", + "integrity": "sha512-o4q0KHlgCZTqjuaZ25nw5W57NeykZT9LiMEG4do/ovwvOcPnDO1BI5BQdCsUkjxFyrCL0cSzLjvIMfR9uo7cWg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.0.0.tgz", + "integrity": "sha512-cvJ63l8c0yXdeT5POHpL0Q1cZoRcmRKFCtSjNGJxPkcP571EfZMcNbzWAc7oK3D1dRzm/V5EwtkANTZxqvuuUA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.0.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/scope-manager": { - "version": "5.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.56.0.tgz", - "integrity": "sha512-jGYKyt+iBakD0SA5Ww8vFqGpoV2asSjwt60Gl6YcO8ksQ8s2HlUEyHBMSa38bdLopYqGf7EYQMUIGdT/Luw+sw==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.0.tgz", + "integrity": "sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.56.0", - "@typescript-eslint/visitor-keys": "5.56.0" + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/scope-manager/node_modules/@typescript-eslint/types": { + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", + "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -5291,25 +5293,25 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.54.0.tgz", - "integrity": "sha512-WI+WMJ8+oS+LyflqsD4nlXMsVdzTMYTxl16myXPaCXnSgc7LWwMsjxQFZCK/rVmTZ3FN71Ct78ehO9bRC7erYQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.0.tgz", + "integrity": "sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ==", "dev": true, "dependencies": { - "@typescript-eslint/typescript-estree": "5.54.0", - "@typescript-eslint/utils": "5.54.0", + "@typescript-eslint/typescript-estree": "6.9.0", + "@typescript-eslint/utils": "6.9.0", "debug": "^4.3.4", - "tsutils": "^3.21.0" + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "*" + "eslint": "^7.0.0 || ^8.0.0" }, "peerDependenciesMeta": { "typescript": { @@ -5318,12 +5320,12 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.0.tgz", - "integrity": "sha512-nExy+fDCBEgqblasfeE3aQ3NuafBUxZxgxXcYfzYRZFHdVvk5q60KhCSkG0noHgHRo/xQ/BOzURLZAafFpTkmQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", + "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", "dev": true, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -5331,21 +5333,21 @@ } }, "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.0.tgz", - "integrity": "sha512-X2rJG97Wj/VRo5YxJ8Qx26Zqf0RRKsVHd4sav8NElhbZzhpBI8jU54i6hfo9eheumj4oO4dcRN1B/zIVEqR/MQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz", + "integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.54.0", - "@typescript-eslint/visitor-keys": "5.54.0", + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -5357,23 +5359,6 @@ } } }, - "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.0.tgz", - "integrity": "sha512-xu4wT7aRCakGINTLGeyGqDn+78BwFlggwBjnHa1ar/KaGagnmwLYmlrXIrgAaQ3AE1Vd6nLfKASm7LrFHNbKGA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.54.0", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/type-utils/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -5408,12 +5393,12 @@ "dev": true }, "node_modules/@typescript-eslint/types": { - "version": "5.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.56.0.tgz", - "integrity": "sha512-JyAzbTJcIyhuUhogmiu+t79AkdnqgPUEsxMTMc/dCZczGMJQh1MK2wgrju++yMN6AWroVAy2jxyPcPr3SWCq5w==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.0.0.tgz", + "integrity": "sha512-Zk9KDggyZM6tj0AJWYYKgF0yQyrcnievdhG0g5FqyU3Y2DRxJn4yWY21sJC0QKBckbsdKKjYDV2yVrrEvuTgxg==", "dev": true, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -5421,21 +5406,21 @@ } }, "node_modules/@typescript-eslint/typescript-estree": { - "version": "5.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.56.0.tgz", - "integrity": "sha512-41CH/GncsLXOJi0jb74SnC7jVPWeVJ0pxQj8bOjH1h2O26jXN3YHKDT1ejkVz5YeTEQPeLCCRY0U2r68tfNOcg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.0.0.tgz", + "integrity": "sha512-2zq4O7P6YCQADfmJ5OTDQTP3ktajnXIRrYAtHM9ofto/CJZV3QfJ89GEaM2BNGeSr1KgmBuLhEkz5FBkS2RQhQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.56.0", - "@typescript-eslint/visitor-keys": "5.56.0", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.0", + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -5447,6 +5432,23 @@ } } }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/@typescript-eslint/visitor-keys": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.0.0.tgz", + "integrity": "sha512-cvJ63l8c0yXdeT5POHpL0Q1cZoRcmRKFCtSjNGJxPkcP571EfZMcNbzWAc7oK3D1dRzm/V5EwtkANTZxqvuuUA==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.0.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@typescript-eslint/typescript-estree/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -5481,55 +5483,37 @@ "dev": true }, "node_modules/@typescript-eslint/utils": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.54.0.tgz", - "integrity": "sha512-cuwm8D/Z/7AuyAeJ+T0r4WZmlnlxQ8wt7C7fLpFlKMR+dY6QO79Cq1WpJhvZbMA4ZeZGHiRWnht7ZJ8qkdAunw==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.0.tgz", + "integrity": "sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ==", "dev": true, "dependencies": { - "@types/json-schema": "^7.0.9", - "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.54.0", - "@typescript-eslint/types": "5.54.0", - "@typescript-eslint/typescript-estree": "5.54.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0", - "semver": "^7.3.7" + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.9.0", + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/typescript-estree": "6.9.0", + "semver": "^7.5.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" - } - }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/scope-manager": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.0.tgz", - "integrity": "sha512-VTPYNZ7vaWtYna9M4oD42zENOBrb+ZYyCNdFs949GcN8Miwn37b8b7eMj+EZaq7VK9fx0Jd+JhmkhjFhvnovhg==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.54.0", - "@typescript-eslint/visitor-keys": "5.54.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" + "eslint": "^7.0.0 || ^8.0.0" } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/types": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.0.tgz", - "integrity": "sha512-nExy+fDCBEgqblasfeE3aQ3NuafBUxZxgxXcYfzYRZFHdVvk5q60KhCSkG0noHgHRo/xQ/BOzURLZAafFpTkmQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", + "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", "dev": true, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -5537,21 +5521,21 @@ } }, "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/typescript-estree": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.0.tgz", - "integrity": "sha512-X2rJG97Wj/VRo5YxJ8Qx26Zqf0RRKsVHd4sav8NElhbZzhpBI8jU54i6hfo9eheumj4oO4dcRN1B/zIVEqR/MQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz", + "integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.54.0", - "@typescript-eslint/visitor-keys": "5.54.0", + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -5563,23 +5547,6 @@ } } }, - "node_modules/@typescript-eslint/utils/node_modules/@typescript-eslint/visitor-keys": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.0.tgz", - "integrity": "sha512-xu4wT7aRCakGINTLGeyGqDn+78BwFlggwBjnHa1ar/KaGagnmwLYmlrXIrgAaQ3AE1Vd6nLfKASm7LrFHNbKGA==", - "dev": true, - "dependencies": { - "@typescript-eslint/types": "5.54.0", - "eslint-visitor-keys": "^3.3.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - } - }, "node_modules/@typescript-eslint/utils/node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -5614,16 +5581,29 @@ "dev": true }, "node_modules/@typescript-eslint/visitor-keys": { - "version": "5.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.56.0.tgz", - "integrity": "sha512-1mFdED7u5bZpX6Xxf5N9U2c18sb+8EvU3tyOIj6LQZ5OOvnmj8BVeNNP603OFPm5KkS1a7IvCIcwrdHXaEMG/Q==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.0.tgz", + "integrity": "sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==", "dev": true, "dependencies": { - "@typescript-eslint/types": "5.56.0", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "6.9.0", + "eslint-visitor-keys": "^3.4.1" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/visitor-keys/node_modules/@typescript-eslint/types": { + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", + "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" }, "funding": { "type": "opencollective", @@ -9058,33 +9038,6 @@ "node": ">=8.0.0" } }, - "node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^2.0.0" - }, - "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" - } - }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/eslint-visitor-keys": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", @@ -10047,9 +10000,9 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "node_modules/fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", @@ -10532,12 +10485,6 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, - "node_modules/grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", - "dev": true - }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -15176,12 +15123,6 @@ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" }, - "node_modules/natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true - }, "node_modules/neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -16605,18 +16546,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "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/regexpu-core": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.2.2.tgz", @@ -18325,6 +18254,18 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, + "node_modules/ts-api-utils": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", + "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", + "dev": true, + "engines": { + "node": ">=16.13.0" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, "node_modules/ts-command-line-args": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/ts-command-line-args/-/ts-command-line-args-2.5.1.tgz", @@ -18673,27 +18614,6 @@ "resolved": "https://registry.npmjs.org/tsort/-/tsort-0.0.1.tgz", "integrity": "sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw==" }, - "node_modules/tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "engines": { - "node": ">= 6" - }, - "peerDependencies": { - "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" - } - }, - "node_modules/tsutils/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/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -23670,9 +23590,9 @@ } }, "@types/json-schema": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", - "integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==", + "version": "7.0.14", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.14.tgz", + "integrity": "sha512-U3PUjAudAdJBeC2pgN8uTIKgxrb4nlDF3SF0++EldXQvQBGkpFZMSnwQiIoDU77tv45VgNkl/L4ouD+rEomujw==", "dev": true }, "@types/keccak": { @@ -23730,9 +23650,9 @@ } }, "@types/semver": { - "version": "7.3.13", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", - "integrity": "sha512-21cFJr9z3g5dW8B0CVI9g2O9beqaThGQ6ZFBqHfwhzLDKUxaqTIy3vnfah/UPkfOiF2pLq+tGz+W8RyCskuslw==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-MMzuxN3GdFwskAnb6fz0orFvhfqi752yjaXylr0Rp4oDg5H0Zn1IuyRhDVvYOwAXoJirx2xuS16I3WjxnAIHiQ==", "dev": true }, "@types/stack-utils": { @@ -23763,49 +23683,24 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.54.0.tgz", - "integrity": "sha512-+hSN9BdSr629RF02d7mMtXhAJvDTyCbprNYJKrXETlul/Aml6YZwd90XioVbjejQeHbb3R8Dg0CkRgoJDxo8aw==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.0.tgz", + "integrity": "sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.54.0", - "@typescript-eslint/type-utils": "5.54.0", - "@typescript-eslint/utils": "5.54.0", + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.9.0", + "@typescript-eslint/type-utils": "6.9.0", + "@typescript-eslint/utils": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0", "debug": "^4.3.4", - "grapheme-splitter": "^1.0.4", - "ignore": "^5.2.0", - "natural-compare-lite": "^1.4.0", - "regexpp": "^3.2.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" }, "dependencies": { - "@typescript-eslint/scope-manager": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.0.tgz", - "integrity": "sha512-VTPYNZ7vaWtYna9M4oD42zENOBrb+ZYyCNdFs949GcN8Miwn37b8b7eMj+EZaq7VK9fx0Jd+JhmkhjFhvnovhg==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.54.0", - "@typescript-eslint/visitor-keys": "5.54.0" - } - }, - "@typescript-eslint/types": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.0.tgz", - "integrity": "sha512-nExy+fDCBEgqblasfeE3aQ3NuafBUxZxgxXcYfzYRZFHdVvk5q60KhCSkG0noHgHRo/xQ/BOzURLZAafFpTkmQ==", - "dev": true - }, - "@typescript-eslint/visitor-keys": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.0.tgz", - "integrity": "sha512-xu4wT7aRCakGINTLGeyGqDn+78BwFlggwBjnHa1ar/KaGagnmwLYmlrXIrgAaQ3AE1Vd6nLfKASm7LrFHNbKGA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.54.0", - "eslint-visitor-keys": "^3.3.0" - } - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -23833,68 +23728,89 @@ } }, "@typescript-eslint/parser": { - "version": "5.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.56.0.tgz", - "integrity": "sha512-sn1OZmBxUsgxMmR8a8U5QM/Wl+tyqlH//jTqCg8daTAmhAk26L2PFhcqPLlYBhYUJMZJK276qLXlHN3a83o2cg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.0.0.tgz", + "integrity": "sha512-TNaufYSPrr1U8n+3xN+Yp9g31vQDJqhXzzPSHfQDLcaO4tU+mCfODPxCwf4H530zo7aUBE3QIdxCXamEnG04Tg==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "5.56.0", - "@typescript-eslint/types": "5.56.0", - "@typescript-eslint/typescript-estree": "5.56.0", + "@typescript-eslint/scope-manager": "6.0.0", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/typescript-estree": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", "debug": "^4.3.4" + }, + "dependencies": { + "@typescript-eslint/scope-manager": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.0.0.tgz", + "integrity": "sha512-o4q0KHlgCZTqjuaZ25nw5W57NeykZT9LiMEG4do/ovwvOcPnDO1BI5BQdCsUkjxFyrCL0cSzLjvIMfR9uo7cWg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.0.0.tgz", + "integrity": "sha512-cvJ63l8c0yXdeT5POHpL0Q1cZoRcmRKFCtSjNGJxPkcP571EfZMcNbzWAc7oK3D1dRzm/V5EwtkANTZxqvuuUA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.0.0", + "eslint-visitor-keys": "^3.4.1" + } + } } }, "@typescript-eslint/scope-manager": { - "version": "5.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.56.0.tgz", - "integrity": "sha512-jGYKyt+iBakD0SA5Ww8vFqGpoV2asSjwt60Gl6YcO8ksQ8s2HlUEyHBMSa38bdLopYqGf7EYQMUIGdT/Luw+sw==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.0.tgz", + "integrity": "sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==", "dev": true, "requires": { - "@typescript-eslint/types": "5.56.0", - "@typescript-eslint/visitor-keys": "5.56.0" + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0" + }, + "dependencies": { + "@typescript-eslint/types": { + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", + "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", + "dev": true + } } }, "@typescript-eslint/type-utils": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.54.0.tgz", - "integrity": "sha512-WI+WMJ8+oS+LyflqsD4nlXMsVdzTMYTxl16myXPaCXnSgc7LWwMsjxQFZCK/rVmTZ3FN71Ct78ehO9bRC7erYQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.0.tgz", + "integrity": "sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ==", "dev": true, "requires": { - "@typescript-eslint/typescript-estree": "5.54.0", - "@typescript-eslint/utils": "5.54.0", + "@typescript-eslint/typescript-estree": "6.9.0", + "@typescript-eslint/utils": "6.9.0", "debug": "^4.3.4", - "tsutils": "^3.21.0" + "ts-api-utils": "^1.0.1" }, "dependencies": { "@typescript-eslint/types": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.0.tgz", - "integrity": "sha512-nExy+fDCBEgqblasfeE3aQ3NuafBUxZxgxXcYfzYRZFHdVvk5q60KhCSkG0noHgHRo/xQ/BOzURLZAafFpTkmQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", + "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.0.tgz", - "integrity": "sha512-X2rJG97Wj/VRo5YxJ8Qx26Zqf0RRKsVHd4sav8NElhbZzhpBI8jU54i6hfo9eheumj4oO4dcRN1B/zIVEqR/MQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz", + "integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.54.0", - "@typescript-eslint/visitor-keys": "5.54.0", + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.0.tgz", - "integrity": "sha512-xu4wT7aRCakGINTLGeyGqDn+78BwFlggwBjnHa1ar/KaGagnmwLYmlrXIrgAaQ3AE1Vd6nLfKASm7LrFHNbKGA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.54.0", - "eslint-visitor-keys": "^3.3.0" + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" } }, "lru-cache": { @@ -23924,26 +23840,36 @@ } }, "@typescript-eslint/types": { - "version": "5.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.56.0.tgz", - "integrity": "sha512-JyAzbTJcIyhuUhogmiu+t79AkdnqgPUEsxMTMc/dCZczGMJQh1MK2wgrju++yMN6AWroVAy2jxyPcPr3SWCq5w==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.0.0.tgz", + "integrity": "sha512-Zk9KDggyZM6tj0AJWYYKgF0yQyrcnievdhG0g5FqyU3Y2DRxJn4yWY21sJC0QKBckbsdKKjYDV2yVrrEvuTgxg==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.56.0.tgz", - "integrity": "sha512-41CH/GncsLXOJi0jb74SnC7jVPWeVJ0pxQj8bOjH1h2O26jXN3YHKDT1ejkVz5YeTEQPeLCCRY0U2r68tfNOcg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.0.0.tgz", + "integrity": "sha512-2zq4O7P6YCQADfmJ5OTDQTP3ktajnXIRrYAtHM9ofto/CJZV3QfJ89GEaM2BNGeSr1KgmBuLhEkz5FBkS2RQhQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.56.0", - "@typescript-eslint/visitor-keys": "5.56.0", + "@typescript-eslint/types": "6.0.0", + "@typescript-eslint/visitor-keys": "6.0.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "semver": "^7.5.0", + "ts-api-utils": "^1.0.1" }, "dependencies": { + "@typescript-eslint/visitor-keys": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.0.0.tgz", + "integrity": "sha512-cvJ63l8c0yXdeT5POHpL0Q1cZoRcmRKFCtSjNGJxPkcP571EfZMcNbzWAc7oK3D1dRzm/V5EwtkANTZxqvuuUA==", + "dev": true, + "requires": { + "@typescript-eslint/types": "6.0.0", + "eslint-visitor-keys": "^3.4.1" + } + }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -23971,60 +23897,39 @@ } }, "@typescript-eslint/utils": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-5.54.0.tgz", - "integrity": "sha512-cuwm8D/Z/7AuyAeJ+T0r4WZmlnlxQ8wt7C7fLpFlKMR+dY6QO79Cq1WpJhvZbMA4ZeZGHiRWnht7ZJ8qkdAunw==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.0.tgz", + "integrity": "sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ==", "dev": true, "requires": { - "@types/json-schema": "^7.0.9", - "@types/semver": "^7.3.12", - "@typescript-eslint/scope-manager": "5.54.0", - "@typescript-eslint/types": "5.54.0", - "@typescript-eslint/typescript-estree": "5.54.0", - "eslint-scope": "^5.1.1", - "eslint-utils": "^3.0.0", - "semver": "^7.3.7" + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.9.0", + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/typescript-estree": "6.9.0", + "semver": "^7.5.4" }, "dependencies": { - "@typescript-eslint/scope-manager": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.54.0.tgz", - "integrity": "sha512-VTPYNZ7vaWtYna9M4oD42zENOBrb+ZYyCNdFs949GcN8Miwn37b8b7eMj+EZaq7VK9fx0Jd+JhmkhjFhvnovhg==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.54.0", - "@typescript-eslint/visitor-keys": "5.54.0" - } - }, "@typescript-eslint/types": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.54.0.tgz", - "integrity": "sha512-nExy+fDCBEgqblasfeE3aQ3NuafBUxZxgxXcYfzYRZFHdVvk5q60KhCSkG0noHgHRo/xQ/BOzURLZAafFpTkmQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", + "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.54.0.tgz", - "integrity": "sha512-X2rJG97Wj/VRo5YxJ8Qx26Zqf0RRKsVHd4sav8NElhbZzhpBI8jU54i6hfo9eheumj4oO4dcRN1B/zIVEqR/MQ==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz", + "integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==", "dev": true, "requires": { - "@typescript-eslint/types": "5.54.0", - "@typescript-eslint/visitor-keys": "5.54.0", + "@typescript-eslint/types": "6.9.0", + "@typescript-eslint/visitor-keys": "6.9.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", - "semver": "^7.3.7", - "tsutils": "^3.21.0" - } - }, - "@typescript-eslint/visitor-keys": { - "version": "5.54.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.54.0.tgz", - "integrity": "sha512-xu4wT7aRCakGINTLGeyGqDn+78BwFlggwBjnHa1ar/KaGagnmwLYmlrXIrgAaQ3AE1Vd6nLfKASm7LrFHNbKGA==", - "dev": true, - "requires": { - "@typescript-eslint/types": "5.54.0", - "eslint-visitor-keys": "^3.3.0" + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" } }, "lru-cache": { @@ -24054,13 +23959,21 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "5.56.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.56.0.tgz", - "integrity": "sha512-1mFdED7u5bZpX6Xxf5N9U2c18sb+8EvU3tyOIj6LQZ5OOvnmj8BVeNNP603OFPm5KkS1a7IvCIcwrdHXaEMG/Q==", + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.0.tgz", + "integrity": "sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==", "dev": true, "requires": { - "@typescript-eslint/types": "5.56.0", - "eslint-visitor-keys": "^3.3.0" + "@typescript-eslint/types": "6.9.0", + "eslint-visitor-keys": "^3.4.1" + }, + "dependencies": { + "@typescript-eslint/types": { + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz", + "integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==", + "dev": true + } } }, "@walletconnect/browser-utils": { @@ -27052,23 +26965,6 @@ "estraverse": "^4.1.1" } }, - "eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "requires": { - "eslint-visitor-keys": "^2.0.0" - }, - "dependencies": { - "eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true - } - } - }, "eslint-visitor-keys": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", @@ -27787,9 +27683,9 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "fast-glob": { - "version": "3.2.12", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.12.tgz", - "integrity": "sha512-DVj4CQIYYow0BlaelwK1pHl5n5cRSJfM60UA0zK891sVInoPri2Ekj7+e1CT3/3qxXenpI+nBBmQAcJPJgaj4w==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", "dev": true, "requires": { "@nodelib/fs.stat": "^2.0.2", @@ -28147,12 +28043,6 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, - "grapheme-splitter": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/grapheme-splitter/-/grapheme-splitter-1.0.4.tgz", - "integrity": "sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==", - "dev": true - }, "graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -31621,12 +31511,6 @@ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" }, - "natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true - }, "neo-async": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz", @@ -32682,12 +32566,6 @@ "functions-have-names": "^1.2.2" } }, - "regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true - }, "regexpu-core": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-5.2.2.tgz", @@ -33982,6 +33860,13 @@ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" }, + "ts-api-utils": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", + "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", + "dev": true, + "requires": {} + }, "ts-command-line-args": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/ts-command-line-args/-/ts-command-line-args-2.5.1.tgz", @@ -34214,23 +34099,6 @@ "resolved": "https://registry.npmjs.org/tsort/-/tsort-0.0.1.tgz", "integrity": "sha512-Tyrf5mxF8Ofs1tNoxA13lFeZ2Zrbd6cKbuH3V+MQ5sb6DtBj5FjrXVsRWT8YvNAQTqNoz66dz1WsbigI22aEnw==" }, - "tsutils": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", - "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - }, - "dependencies": { - "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - } - } - }, "tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", diff --git a/package.json b/package.json index f27d853d..b6c9b503 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@tokenscript/token-negotiator", - "version": "3.2.0", + "version": "3.2.12", "description": "Token Negotiator is an open source technology that enables you build web experiences for users around the tokens, collectibles, coins and attestations they hold. Enabled across EVM, Solana, Flow, Chiliz and EOS (Ultra). Create logic flows to enable personalized web experiences.", "module": "dist/index.js", "types": "dist/index.d.ts", @@ -70,8 +70,8 @@ "@types/jest": "^28.1.5", "@types/keccak": "^3.0.1", "@types/readable-stream": "^2.3.13", - "@typescript-eslint/eslint-plugin": "^5.30.0", - "@typescript-eslint/parser": "^5.20.0", + "@typescript-eslint/eslint-plugin": "6.9.0", + "@typescript-eslint/parser": "^6.0.0", "assert": "^2.0.0", "babel-jest": "^28.1.2", "buffer": "^6.0.3", diff --git a/src/client/__tests__/client.spec.ts b/src/client/__tests__/client.spec.ts index 1ecae022..2fb4c082 100644 --- a/src/client/__tests__/client.spec.ts +++ b/src/client/__tests__/client.spec.ts @@ -4,6 +4,7 @@ import { Client } from '../index' import { TicketZKProof } from '../auth/ticketZKProof' import { OffChainTokenConfig } from '../interface' import { TextEncoder, TextDecoder } from 'util'; +import { hasIssuerForBlockchain } from './../views/utils/issuers' Object.assign(global, { TextDecoder, TextEncoder }); @@ -21,12 +22,6 @@ let tokenIssuer: OffChainTokenConfig = { base64attestorPubKey: '', } -const config = { - type: 'passive', - enableOffChainRedirectMode: true, - issuers: [tokenIssuer], -} - function getOffChainConfigClient() { return new Client({ type: 'active', @@ -235,19 +230,19 @@ describe('client spec', () => { test('tokenNegotiatorClient method solanaAvailable will return false with no window.solana instance', () => { const tokenNegotiatorClient = getOnChainSolanaConfigClient() - expect(tokenNegotiatorClient.hasIssuerForBlockchain('solana')).toBe(false) + expect(hasIssuerForBlockchain(tokenNegotiatorClient.config, 'solana')).toBe(false) }) test('tokenNegotiatorClient method solanaAvailable should show Solana', () => { const tokenNegotiatorClient = getOnChainSolanaConfigClient() window.solana = jest.fn({ instance: true }) - expect(tokenNegotiatorClient.hasIssuerForBlockchain('solana')).toBe(true) + expect(hasIssuerForBlockchain(tokenNegotiatorClient.config, 'solana')).toBe(true) }) test('tokenNegotiatorClient method solanaAvailable should not show Solana with no required issuer tokens', () => { const tokenNegotiatorClient = getOnChainConfigClient() window.solana = jest.fn({ instance: true }) // - expect(tokenNegotiatorClient.hasIssuerForBlockchain('solana')).toBe(false) + expect(hasIssuerForBlockchain(tokenNegotiatorClient.config, 'solana')).toBe(false) }) test('tokenNegotiatorClient method getWalletProvider', async () => { diff --git a/src/client/__tests__/selectIssuers.spec.ts b/src/client/__tests__/selectIssuers.spec.ts index 4647c950..ef765a45 100644 --- a/src/client/__tests__/selectIssuers.spec.ts +++ b/src/client/__tests__/selectIssuers.spec.ts @@ -38,40 +38,6 @@ describe('select issuers spec', () => { }) } - function getOnChainSolanaConfigClient() { - return new Client({ - type: 'active', - issuers: [ - { - collectionID: 'penthouse-panther-club', - collectionAddress: 'ff846ef2eed57e5367cf8826e63f4d53fe28d28aa67417accb6e4b48cbd19136', - onChain: true, - symbol: 'PPC', - chain: 'mainnet', - blockchain: 'solana', - }, - ], - options: {}, - }) - } - - // TODO - // test('selectIssuers render list issuers', async () => { - // document.body.innerHTML = ` - //
- //
- // ` - // const client = getOnChainConfigClient() - // await client.negotiate(); - - // const selectIssuers = new SelectIssuers(client, client.getUi(), client.getUi().viewContainer, {options: {issuerHeading: "issuerHeading"}}) - - // selectIssuers.render(); - - // expect(selectIssuers.viewContainer.innerHTML).not.toEqual("") - - // }); - test('selectIssuers generating token list markup', async () => { const client = getOnChainConfigClient() await client.negotiate() @@ -88,6 +54,27 @@ describe('select issuers spec', () => { await client.negotiate() expect(client.getUi().getUIContainer()).toContain('overlay-content-tn') }) + test('get ui container', async () => { + function getOnChainSolanaConfigClient() { + return new Client({ + type: 'active', + issuers: [ + { + collectionID: 'penthouse-panther-club', + collectionAddress: 'ff846ef2eed57e5367cf8826e63f4d53fe28d28aa67417accb6e4b48cbd19136', + onChain: true, + symbol: 'PPC', + chain: 'mainnet', + blockchain: 'solana', + }, + ], + options: {}, + }) + } + const client = getOnChainSolanaConfigClient() + await client.negotiate() + expect(client.getUi().getUIContainer()).toContain('overlay-content-tn') + }) test('get ui fab button', async () => { const client = getOnChainConfigClient() diff --git a/src/client/auth/signedUNChallenge.ts b/src/client/auth/signedUNChallenge.ts index 0e476ce7..b5762d4a 100644 --- a/src/client/auth/signedUNChallenge.ts +++ b/src/client/auth/signedUNChallenge.ts @@ -1,5 +1,5 @@ -import { AbstractAuthentication, AuthenticationMethod, AuthenticationResult, AuthenticationMethodUN } from './abstractAuthentication' -import { AuthenticateInterface, OffChainTokenConfig, OnChainTokenConfig } from '../interface' +import { AbstractAuthentication, AuthenticationResult, AuthenticationMethodUN } from './abstractAuthentication' +import { AuthenticateInterface } from '../interface' import { SafeConnectProvider } from '../../wallet/SafeConnectProvider' import { UN, UNInterface } from './util/UN' import { logger } from '../../utils' diff --git a/src/client/auth/ticketZKProof.ts b/src/client/auth/ticketZKProof.ts index 7fadedb3..ad74cb2e 100644 --- a/src/client/auth/ticketZKProof.ts +++ b/src/client/auth/ticketZKProof.ts @@ -1,15 +1,11 @@ import { AbstractAuthentication, AuthenticationMethod, AuthenticationResult } from './abstractAuthentication' import { AuthenticateInterface, EthRPCMap, OffChainTokenConfig, OnChainTokenConfig } from '../interface' import { OutletAction, Messaging } from '../messaging' -import { Authenticator } from '@tokenscript/attestation' -import { SignedUNChallenge } from './signedUNChallenge' import { UNInterface } from './util/UN' -import { LocalOutlet } from '../../outlet/localOutlet' import { createIssuerHashArray, logger } from '../../utils' import { shouldUseRedirectMode } from '../../utils/support/getBrowserData' -import { EasZkProof } from '@tokenscript/attestation/dist/eas/EasZkProof' -import { DEFAULT_EAS_SCHEMA, TokenType } from '../../outlet/ticketStorage' import { OutletIssuerInterface } from '../../outlet/interfaces' +import { DEFAULT_EAS_SCHEMA, TokenType } from '../../outlet/ticketStorage' import { DEFAULT_RPC_MAP } from '../../constants' export class TicketZKProof extends AbstractAuthentication implements AuthenticationMethod { @@ -34,6 +30,7 @@ export class TicketZKProof extends AbstractAuthentication implements Authenticat let useEthKey: UNInterface | null = null if (issuerConfig.unEndPoint) { + const SignedUNChallenge = (await import('./signedUNChallenge')).SignedUNChallenge; let unChallenge = new SignedUNChallenge(this.client) request.options = { ...request.options, @@ -50,7 +47,7 @@ export class TicketZKProof extends AbstractAuthentication implements Authenticat let data if (new URL(issuerConfig.tokenOrigin).origin === window.location.origin) { - const localOutlet = new LocalOutlet({ + const localOutlet = new (await import('../../outlet/localOutlet')).LocalOutlet({ issuers: Object.values(this.client.getTokenStore().getCurrentIssuers(false)) as unknown as OutletIssuerInterface[], ethRpcMap: this.client.config.ethRpcMap, skipEasRevokeCheck: this.client.config.skipEasRevokeCheck, @@ -122,6 +119,7 @@ export class TicketZKProof extends AbstractAuthentication implements Authenticat ) { if (type === 'eas') { const schema = issuerConfig.eas ? { fields: issuerConfig.eas.fields } : DEFAULT_EAS_SCHEMA + const EasZkProof = (await import('@tokenscript/attestation/dist/eas/EasZkProof')).EasZkProof; const easZkProof = new EasZkProof(schema, { ...DEFAULT_RPC_MAP, ...ethRPCMap }) await easZkProof.validateUseTicket( proof, @@ -132,6 +130,7 @@ export class TicketZKProof extends AbstractAuthentication implements Authenticat 'asn', ) } else { + const Authenticator = (await import('@tokenscript/attestation')).Authenticator; Authenticator.validateUseTicket(proof, issuerConfig.base64attestorPubKey, issuerConfig.base64senderPublicKeys, ethAddress) } } diff --git a/src/client/auth/ticketZKProofMulti.ts b/src/client/auth/ticketZKProofMulti.ts index 6660cacf..55af7101 100644 --- a/src/client/auth/ticketZKProofMulti.ts +++ b/src/client/auth/ticketZKProofMulti.ts @@ -52,7 +52,7 @@ export class TicketZKProofMulti extends AbstractAuthentication implements Authen let output if (new URL(tokenOrigin).origin === window.location.origin) { - output = await this.authenticateLocally(authRequest, address, wallet, redirectMode, request) + output = await this.authenticateLocally(authRequest, address, wallet, redirectMode) } else { output = await this.authenticateCrossOrigin(tokenOrigin, authRequest, address, wallet, redirectMode, request) } @@ -137,8 +137,7 @@ export class TicketZKProofMulti extends AbstractAuthentication implements Authen authRequest: MultiTokenAuthRequest, address: string, wallet: string, - redirectMode: false | string, - _request?: any, + redirectMode: false | string ) { const localOutlet = new LocalOutlet({ issuers: Object.values(this.client.getTokenStore().getCurrentIssuers(false)) as unknown as OutletIssuerInterface[], diff --git a/src/client/index.ts b/src/client/index.ts index 3e1aa689..8afc0407 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -22,23 +22,17 @@ import { MultiTokenInterface, TokenNegotiatorEventsArgs, } from './interface' -import { SignedUNChallenge } from './auth/signedUNChallenge' import { TicketZKProof } from './auth/ticketZKProof' -import { TicketZKProofMulti } from './auth/ticketZKProofMulti' import { AuthenticationMethod, AuthenticationMethodMulti } from './auth/abstractAuthentication' import { isUserAgentSupported, validateBlockchain } from '../utils/support/isSupported' -import Web3WalletProvider from '../wallet/Web3WalletProvider' -import { LocalOutlet } from '../outlet/localOutlet' import { shouldUseRedirectMode } from '../utils/support/getBrowserData' -import { VERSION } from '../version' import { getFungibleTokenBalances, getFungibleTokensMeta } from '../utils/token/fungibleTokenProvider' import { URLNS } from '../core/messaging' import { TokenType } from '../outlet/ticketStorage' import { MultiTokenAuthRequest, MultiTokenAuthResult, OutletIssuerInterface, ProofResult } from '../outlet/interfaces' -import { AttestationIdClient } from '../outlet/attestationIdClient' import { EventHookHandler } from './eventHookHandler' import { ethers } from 'ethers' -import { TokenListItemInterface } from './views/token-list' +import { VERSION } from '../version' if (typeof window !== 'undefined') window.tn = { VERSION } @@ -106,7 +100,7 @@ export enum ClientErrorMessage { export class Client { public issuersLoaded: boolean public config: NegotiationInterface - private web3WalletProvider: Web3WalletProvider + private web3WalletProvider: any private messaging: Messaging private eventHookHandler: EventHookHandler protected ui: UiInterface @@ -125,10 +119,6 @@ export class Client { private urlParams: URLSearchParams - /* static getKey(file: string) { - return Authenticator.decodePublicKey(file) - }*/ - constructor(config: NegotiationInterface) { this.eventHookHandler = new EventHookHandler() @@ -143,15 +133,13 @@ export class Client { this.config = this.mergeConfig(defaultConfig, config) - // TODO investigate if this works correctly. this.config.autoLoadTokens = localStorage.getItem('tn-autoload-tokens') === 'false' ? false : this.config.autoLoadTokens this.tokenStore = new TokenStore(this.config.autoEnableTokens, this.config.tokenPersistenceTTL) - // @ts-ignore + if (this.config.issuers?.length > 0) this.tokenStore.updateIssuers(this.config.issuers) this.messaging = new Messaging() - // this.registerOutletProofEventListener() } handleRecievedRedirectMessages() { @@ -225,15 +213,7 @@ export class Client { window.location.hash = '#' + params.toString() } - /* private registerOutletProofEventListener() { - window.addEventListener('auth-callback', (e: CustomEvent) => { - this.emitRedirectProofEvent(e.detail.issuer, e.detail.proof, e.detail.error) - }) - }*/ - - // TODO: Merge these proof events private emitRedirectProofEvent(issuer: string, proof?: ProofResult, error?: string) { - // Wait to ensure UI is initialized setTimeout(() => { if (error) { this.handleProofError(new Error(error), issuer) @@ -248,7 +228,6 @@ export class Client { } private emitMultiRedirectProofEvent(proofs?: MultiTokenAuthResult, error?: string) { - // Wait to ensure UI is initialized setTimeout(() => { if (error) { this.handleProofError(new Error(error), 'multi token authentication error') @@ -268,9 +247,6 @@ export class Client { defaultConfig[key] = config[key] } } - - // Check if blockchain is supported one - // TODO: Put in separate method - issuers can also be specified via negotiate() if (defaultConfig.issuers?.length) { for (const issuer of defaultConfig.issuers) { if (issuer.onChain === true) { @@ -305,27 +281,8 @@ export class Client { return this.config.safeConnectOptions !== undefined } - // TODO: Move to token store OR select-wallet view - this method is very similar to getCurrentBlockchains() - public hasIssuerForBlockchain(blockchain: 'evm' | 'solana' | 'flow' | 'ultra', useOauth = false) { - const _blockchain = blockchain.toLocaleLowerCase() - return ( - this.config.issuers.filter((issuer: OnChainTokenConfig) => { - const issuerBlockChain = issuer.blockchain?.toLocaleLowerCase() - const blockChainUsed = issuerBlockChain === blockchain - const solanaEnabled = blockChainUsed && _blockchain === 'solana' && typeof window.solana !== 'undefined' - const ultraEnabled = blockChainUsed && _blockchain === 'ultra' && typeof window.ultra !== 'undefined' - const flowEnabled = blockChainUsed && _blockchain === 'flow' - const evmEnabled = blockChainUsed && _blockchain === 'evm' && !issuer.oAuth2options && !useOauth - const sociosEnabled = blockChainUsed && _blockchain === 'evm' && issuer.oAuth2options && useOauth - const fallBackToEVM = _blockchain === 'evm' && !issuerBlockChain && !useOauth - return solanaEnabled || ultraEnabled || evmEnabled || sociosEnabled || flowEnabled || fallBackToEVM - }).length > 0 - ) - } - public async getWalletProvider() { if (!this.web3WalletProvider) { - // TODO - this is already installed in the file header. const { Web3WalletProvider } = await import('./../wallet/Web3WalletProvider') this.web3WalletProvider = new Web3WalletProvider(this, this.config.walletOptions, this.config.safeConnectOptions) } @@ -376,14 +333,9 @@ export class Client { } else { lookupData = await getNftCollection(tokenData) } - if (lookupData) { - // TODO: this might be redundant lookupData.onChain = true - if (!lookupData.title) lookupData.title = tokenData.collectionID - - // enrich the tokenLookup store with contract meta data this.tokenStore.updateTokenLookupStore(issuer, lookupData) } } catch (e) { @@ -397,9 +349,7 @@ export class Client { public async checkUserAgentSupport(type: string) { if (!isUserAgentSupported(this.config.unSupportedUserAgent?.[type]?.config)) { - // TODO do we check browser support in passive mode? looks like we just save "errorMessage" let err = this.config.unSupportedUserAgent[type].errorMessage - if (this.activeNegotiateRequired()) { this.createUiInstance() await this.ui.initialize() @@ -407,8 +357,6 @@ export class Client { this.ui.showError(err, false) this.ui.viewContainer.style.display = 'none' } - - // TODO what the sense of this handler? errorHandler(err, 'error', null, null, true, true) } } @@ -428,7 +376,7 @@ export class Client { if (currentIssuer) { logger(2, 'Sync Outlet fired in Client to read MagicLink before negotiate().') - let outlet = new LocalOutlet({ + let outlet = new (await import('../outlet/localOutlet')).LocalOutlet({ issuers: Object.values(this.tokenStore.getCurrentIssuers(false)) as unknown as OutletIssuerInterface[], ethRpcMap: this.config.ethRpcMap, skipEasRevokeCheck: this.config.skipEasRevokeCheck, @@ -803,7 +751,7 @@ export class Client { } private async loadLocalOutletTokens(issuer: OffChainTokenConfig) { - const localOutlet = new LocalOutlet({ + let localOutlet = new (await import('../outlet/localOutlet')).LocalOutlet({ issuers: Object.values(this.tokenStore.getCurrentIssuers(false)) as unknown as OutletIssuerInterface[], ethRpcMap: this.config.ethRpcMap, skipEasRevokeCheck: this.config.skipEasRevokeCheck, @@ -884,7 +832,7 @@ export class Client { // Off Chain: // ['https://devcon.com']['issuer'][list of tokenIds] for (const tokenOrigin in authRequestBatch.offChain) { - let AuthType = TicketZKProofMulti + let AuthType = (await import('./auth/ticketZKProofMulti')).TicketZKProofMulti let authenticator: AuthenticationMethodMulti = new AuthType(this) const authRequest = { options: { @@ -938,8 +886,6 @@ export class Client { if (!config) errorHandler('Provided issuer was not found.', 'error', null, null, true, true) - // TODO: How to handle error display in passive negotiation? Use optional UI or emit errors to listener? - if (this.ui) { this.ui.showLoaderDelayed( [ @@ -960,7 +906,9 @@ export class Client { if (authRequest.type) { AuthType = authRequest.type } else { - AuthType = config.onChain ? SignedUNChallenge : TicketZKProof + AuthType = config.onChain + ? (await import('./auth/signedUNChallenge')).SignedUNChallenge + : (await import('./auth/ticketZKProof')).TicketZKProof } let authenticator: AuthenticationMethod = new AuthType(this) @@ -1124,7 +1072,7 @@ export class Client { ) if (!res) - return new Promise((_resolve) => { + return new Promise(() => { return }) // Site is redirecting if (res.evt === OutletResponseAction.ISSUER_TOKENS) { @@ -1174,11 +1122,10 @@ export class Client { private async processAttestationIdCallback() { try { - const attestIdClient = new AttestationIdClient() + const attestIdClient = new (await import('../outlet/attestationIdClient')).AttestationIdClient() attestIdClient.captureAttestationIdCallback(this.urlParams) const originalAction = this.getDataFromQuery('orig-action') - - const localOutlet = new LocalOutlet({ + const localOutlet = new (await import('../outlet/localOutlet')).LocalOutlet({ issuers: Object.values(this.tokenStore.getCurrentIssuers(false)) as unknown as OutletIssuerInterface[], ethRpcMap: this.config.ethRpcMap, skipEasRevokeCheck: this.config.skipEasRevokeCheck, @@ -1206,13 +1153,11 @@ export class Client { } case OutletAction.GET_MUTLI_PROOF: { const authRequest = JSON.parse(this.getDataFromQuery('tokens')) ?? ({} as MultiTokenAuthRequest) - const result = await localOutlet.authenticateMany(authRequest) - await TicketZKProofMulti.validateProofResult( - result, - this.getTokenStore().getCurrentIssuers(false) as unknown as OffChainTokenConfig[], - ) + let AuthType = (await import('./auth/ticketZKProofMulti')).TicketZKProofMulti + + await AuthType.validateProofResult(result, this.getTokenStore().getCurrentIssuers(false) as unknown as OffChainTokenConfig[]) this.eventSender('token-proof', { issuers: result, diff --git a/src/client/tokenStore.ts b/src/client/tokenStore.ts index 0adbcef5..7fb1e113 100644 --- a/src/client/tokenStore.ts +++ b/src/client/tokenStore.ts @@ -206,7 +206,7 @@ export class TokenStore { private prePopulateTokenLookupStore(issuers: TokenConfig[]) { let collectionIds: { [issuer: string]: boolean } = {} - issuers.forEach((issuer: TokenConfig, i) => { + issuers.forEach((issuer: TokenConfig) => { if (!issuer.collectionID) return if (issuer.onChain === undefined) issuer.onChain = true diff --git a/src/client/ui.ts b/src/client/ui.ts index c4215a04..136be1ed 100644 --- a/src/client/ui.ts +++ b/src/client/ui.ts @@ -2,11 +2,11 @@ import { Start } from './views/start' import { logger, requiredParams } from '../utils' import { Client, ClientError } from './index' -import { ViewInterface, ViewComponent, ViewFactory, ViewConstructor, AbstractView } from './views/view-interface' +import { ViewInterface, ViewComponent, ViewFactory, ViewConstructor } from './views/view-interface' import { SelectIssuers } from './views/select-issuers' import { SelectWallet } from './views/select-wallet' import { LOCAL_STORAGE_TOKEN_STORE_KEY } from '../constants' -export type UIType = 'popup' | 'inline' // TODO: implement modal too +export type UIType = 'popup' | 'inline' export type PopupPosition = 'bottom-right' | 'bottom-left' | 'top-left' | 'top-right' export type UItheme = 'light' | 'dark' export type ViewType = 'start' | 'main' | 'wallet' | string @@ -348,7 +348,7 @@ export class Ui implements UiInterface { if (error === ClientError.USER_ABORT) return this.dismissLoader() } - const loader = this.loadContainer.querySelector('.loader-tn') as HTMLDivElement + const loader: HTMLElement = this.loadContainer.querySelector('.loader-tn') loader.style.display = 'none' this.retryButton.style.display = 'block' @@ -360,7 +360,7 @@ export class Ui implements UiInterface { this.loadContainer.style.display = 'flex' if (!canDismiss) { - const dismissBtn = this.loadContainer.querySelector('.dismiss-error-tn') as HTMLDivElement + const dismissBtn: HTMLElement = this.loadContainer.querySelector('.dismiss-error-tn') dismissBtn.style.display = 'none' } diff --git a/src/client/views/icon-view.ts b/src/client/views/icon-view.ts index 4ccd9e7d..88ef916e 100644 --- a/src/client/views/icon-view.ts +++ b/src/client/views/icon-view.ts @@ -14,11 +14,11 @@ export class IconView { if (src && src !== 'undefined') { image = document.createElement('img') image.loading = 'lazy' - image.addEventListener('load', (e: Event) => { - this.onLoad(e) + image.addEventListener('load', () => { + this.onLoad() }) - image.addEventListener('error', (e: Event) => { - this.onError(e) + image.addEventListener('error', () => { + this.onError() }) image.src = src } else { @@ -29,11 +29,11 @@ export class IconView { this.viewContainer.appendChild(image) } - onLoad(_e: Event) { + onLoad() { this.viewContainer.classList.remove('shimmer-tn') } - onError(_e: Event) { + onError() { this.viewContainer.innerHTML = '' this.viewContainer.appendChild(this.createAvatar()) this.viewContainer.classList.remove('shimmer-tn') diff --git a/src/client/views/manage-wallets.ts b/src/client/views/manage-wallets.ts deleted file mode 100644 index 0ac71a2a..00000000 --- a/src/client/views/manage-wallets.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { AbstractView } from './view-interface' - -class ManageWallets extends AbstractView { - render() { - this.viewContainer.innerHTML = ` -

Wallet Connections Here!

- ` - } -} diff --git a/src/client/views/select-issuers.ts b/src/client/views/select-issuers.ts index f7772e49..ff05796d 100644 --- a/src/client/views/select-issuers.ts +++ b/src/client/views/select-issuers.ts @@ -191,11 +191,10 @@ export class SelectIssuers extends AbstractView { data-issuer="${issuer}" ${this.client.issuersLoaded === true ? '' : 'disabled'} > - ${ - this.client.issuersLoaded === true - ? issuerButtonText - : '
' - } + ${this.client.issuersLoaded === true + ? issuerButtonText + : '
' + } ` - : '' - } + : '' + }

Select Wallet

diff --git a/src/client/views/utils/issuers.ts b/src/client/views/utils/issuers.ts new file mode 100644 index 00000000..b9de67c9 --- /dev/null +++ b/src/client/views/utils/issuers.ts @@ -0,0 +1,16 @@ +export const hasIssuerForBlockchain = (config, blockchain: 'evm' | 'solana' | 'flow' | 'ultra', useOauth = false) => { + const _blockchain = blockchain.toLocaleLowerCase() + return ( + config.issuers.filter((issuer: any) => { + const issuerBlockChain = issuer.blockchain?.toLocaleLowerCase() + const blockChainUsed = issuerBlockChain === blockchain + const solanaEnabled = blockChainUsed && _blockchain === 'solana' && typeof window.solana !== 'undefined' + const ultraEnabled = blockChainUsed && _blockchain === 'ultra' && typeof window.ultra !== 'undefined' + const flowEnabled = blockChainUsed && _blockchain === 'flow' + const evmEnabled = blockChainUsed && _blockchain === 'evm' && !issuer.oAuth2options && !useOauth + const sociosEnabled = blockChainUsed && _blockchain === 'evm' && issuer.oAuth2options && useOauth + const fallBackToEVM = _blockchain === 'evm' && !issuerBlockChain && !useOauth + return solanaEnabled || ultraEnabled || evmEnabled || sociosEnabled || flowEnabled || fallBackToEVM + }).length > 0 + ) +} \ No newline at end of file diff --git a/src/client/views/utils/wallet-info.ts b/src/client/views/utils/wallet-info.ts index 00c3127b..e358498b 100644 --- a/src/client/views/utils/wallet-info.ts +++ b/src/client/views/utils/wallet-info.ts @@ -228,13 +228,13 @@ function getEvmInjectedProviderInfo() { function getSolanaInjectedProviderInfo() { return window.solana?.isBraveWallet ? { - name: SupportedWalletProviders.Phantom_Brave, - label: 'Phantom (Brave)', - imgBig: braveWallet.imgBig, - } + name: SupportedWalletProviders.Phantom_Brave, + label: 'Phantom (Brave)', + imgBig: braveWallet.imgBig, + } : { - name: SupportedWalletProviders.Phantom, - label: 'Phantom', - imgBig: phantomSVG, - } + name: SupportedWalletProviders.Phantom, + label: 'Phantom', + imgBig: phantomSVG, + } } diff --git a/src/core/messaging.ts b/src/core/messaging.ts index afa3bf6c..0ca175c8 100644 --- a/src/core/messaging.ts +++ b/src/core/messaging.ts @@ -1,9 +1,6 @@ import { attachPostMessageListener, logger, removePostMessageListener } from '../utils' import { ClientError } from '../client' import { browserBlocksIframeStorage } from '../utils/support/getBrowserData' -import { VERSION } from '../version' - -// TODO move Message related interfaces/enum in to shared location /core export interface RequestInterfaceBase { action: string @@ -55,10 +52,6 @@ export class Messaging { } if (!forceTab && this.iframeStorageSupport === null) { - // TODO: temp to test safari top level context access. - // TODO do we need this verificaton? - // if (window.location.hash !== "#safari-iframe-test") - this.iframeStorageSupport = !browserBlocksIframeStorage() } @@ -155,19 +148,6 @@ export class Messaging { received = true - // TODO: revert to tab when requestStorageAccess error is encountered in outlet - but only for browsers that support new tabs (no wallet dapp browsers) - /* if (response.evt === ResponseActionBase.COOKIE_CHECK){ - if (!this.iframe || this.iframeStorageSupport === true) - return; - - this.iframeStorageSupport = !!response?.data?.thirdPartyCookies; - if (!this.iframeStorageSupport){ - afterResolveOrError(); - reject("IFRAME_STORAGE"); - } - return; - }*/ - if (response.evt === ResponseActionBase.ERROR) { if (response.errors[0] === 'IFRAME_STORAGE') { this.iframeStorageSupport = false diff --git a/src/outlet/__tests__/outlet.spec.ts b/src/outlet/__tests__/outlet.spec.ts index 06ccfa21..98ff89ee 100644 --- a/src/outlet/__tests__/outlet.spec.ts +++ b/src/outlet/__tests__/outlet.spec.ts @@ -1,11 +1,7 @@ import { Outlet } from '../index' import { TicketStorage } from '../ticketStorage' -import { base64toBase64Url, hexStringToBase64Url } from '@tokenscript/attestation/dist/libs/utils' -import { Ticket } from '@tokenscript/attestation/dist/Ticket' -import { KeyPair } from '@tokenscript/attestation/dist/libs/KeyPair' -import { ethers } from 'ethers' -import { EasTicketAttestation } from '@tokenscript/attestation/dist/eas/EasTicketAttestation' import { TextEncoder, TextDecoder } from 'util' +import { createIssuerHashArray } from './../../utils/index' Object.assign(global, { TextDecoder, TextEncoder }) const _issuers = [ @@ -66,105 +62,67 @@ const outlet = new Outlet({ }, }) -const EASContractAddress = '0xC2679fBD37d54388Ce493F1DB75320D236e1815e' // Sepolia v0.26 -const SEPOLIA_RPC = 'https://rpc.sepolia.org/' - -export const EAS_CONFIG = { - address: EASContractAddress, - version: '0.26', - chainId: 11155111, -} - -const EAS_TICKET_SCHEMA = { - fields: [ - { name: 'devconId', type: 'string' }, - { name: 'ticketId', type: 'string' }, - { name: 'ticketClass', type: 'uint8' }, - { name: 'commitment', type: 'bytes', isCommitment: true }, - ], -} - -// Commented for now to enable the build. Uncomment when needed. -// async function createTestMagicLink(ticketType, ticketId, ticketClass) { -// let ticketInUrl, secret - -// const email = 'test@test.com' -// const issuerPrivKey = -// 'MIICSwIBADCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////////////////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFBAgEBBIIBVTCCAVECAQEEIM/T+SzcXcdtcNIqo6ck0nJTYzKL5ywYBFNSpI7R8AuBoIHjMIHgAgEBMCwGByqGSM49AQECIQD////////////////////////////////////+///8LzBEBCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcEQQR5vmZ++dy7rFWgYpXOhwsHApv82y3OKNlZ8oFbFvgXmEg62ncmo8RlXaT7/A4RCKj9F7RIpoVUGZxH0I/7ENS4AiEA/////////////////////rqu3OavSKA7v9JejNA2QUECAQGhRANCAARjMR62qoIK9pHk17MyHHIU42Ix+Vl6Q2gTmIF72vNpinBpyoBkTkV0pnI1jdrLlAjJC0I91DZWQhVhddMCK65c' - -// if (ticketType === 'eas') { -// const provider = new ethers.providers.JsonRpcProvider(SEPOLIA_RPC) -// const wallet = new ethers.Wallet(KeyPair.privateFromPEM(issuerPrivKey).getPrivateAsHexString(), provider) - -// const attestationManager = new EasTicketAttestation(EAS_TICKET_SCHEMA, { -// EASconfig: EAS_CONFIG, -// signer: wallet, -// }) - -// await attestationManager.createEasAttestation({ -// devconId: '6', -// ticketIdString: ticketId, -// ticketClass: ticketClass, -// commitment: email, -// }) - -// ticketInUrl = base64toBase64Url(attestationManager.getEncoded()) -// secret = attestationManager.getEasJson().secret -// } else { -// secret = BigInt(45845870684) - -// let ticket = Ticket.createWithMail(email, '6', ticketId, ticketClass, { '6': KeyPair.privateFromPEM(issuerPrivKey) }, secret) - -// if (!ticket.checkValidity()) { -// throw new Error('Ticket validity check failed') -// } - -// if (!ticket.verify()) { -// throw new Error('Ticket verify failed') -// } +describe('Issuer Client to Outlet check', () => { + test('can create an issuer hash implementation of config', async () => { + expect(outlet.getHashToConfigMap()).toEqual({ "0x0915bb6dcd508278764d9bfff6ba113c87c761ed78e84ed238811f2264a83a05": { "attestationOrigin": "https://test.attestation.id/", "base64attestorPubKey": "MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////////////////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABL+y43T1OJFScEep69/yTqpqnV/jzONz9Sp4TEHyAJ7IPN9+GHweCX1hT4OFxt152sBN3jJc1s0Ymzd8pNGZNoQ=", "base64senderPublicKeys": { "6": "MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////////////////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABGMxHraqggr2keTXszIcchTjYjH5WXpDaBOYgXva82mKcGnKgGRORXSmcjWN2suUCMkLQj3UNlZCFWF10wIrrlw=" }, "collectionID": "devcon", "title": "Devcon", "tokenOrigin": "http://localhost:3002/", "whitelist": [] }, "0x55592fab10cace25a4b34b07aa8741dc3ae50100f73e2997619a5ccc82f62810": { "attestationOrigin": "https://test.attestation.id/", "base64attestorPubKey": "MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////////////////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABL+y43T1OJFScEep69/yTqpqnV/jzONz9Sp4TEHyAJ7IPN9+GHweCX1hT4OFxt152sBN3jJc1s0Ymzd8pNGZNoQ=", "base64senderPublicKeys": { "7": "MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////////////////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABAjUvEi8UYyC+0rSFu+IwRBos/DEC6YMJV+eCnoYOC4nZU7uayKDJmBxVnmTOSwaM4+gufLbeqqxuovyF5gI3TQ=" }, "collectionID": "test-3", "title": "Test Event 3", "tokenOrigin": "http://localhost:3002/" }, "0x595e334142dd2a9ac6ce2195e560ac1efd926b9632ef10cc7dcf31fe1cb68863": { "attestationOrigin": "https://test.attestation.id/", "base64attestorPubKey": "MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////////////////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABL+y43T1OJFScEep69/yTqpqnV/jzONz9Sp4TEHyAJ7IPN9+GHweCX1hT4OFxt152sBN3jJc1s0Ymzd8pNGZNoQ=", "base64senderPublicKeys": { "6": "MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////////////////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABAjUvEi8UYyC+0rSFu+IwRBos/DEC6YMJV+eCnoYOC4nZU7uayKDJmBxVnmTOSwaM4+gufLbeqqxuovyF5gI3TQ=" }, "collectionID": "test-2", "title": "Test Event 2", "tokenOrigin": "http://localhost:3002/", "whitelist": [] } }); + }) -// ticketInUrl = hexStringToBase64Url(ticket.getDerEncoding()) -// } + test('can build an issuer list', async () => { + const hashToConfigMap = outlet.getHashToConfigMap(); + const requestHashes = { + attestationDao: [ + '0x0915bb6dcd508278764d9bfff6ba113c87c761ed78e84ed238811f2264a83a05', + '0x76d49eaf820fc5313a752214192a223511244124e188557fe84d88d8ff8c3a2f', + ], + devcon: [ + '0x0915bb6dcd508278764d9bfff6ba113c87c761ed78e84ed238811f2264a83a05', + '0x76d49eaf820fc5313a752214192a223511244124e188557fe84d88d8ff8c3a2f', + ], + } + expect(outlet.getRequestIssuerList(requestHashes, hashToConfigMap)).toEqual([{ "attestationOrigin": "https://test.attestation.id/", "base64attestorPubKey": "MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////////////////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABL+y43T1OJFScEep69/yTqpqnV/jzONz9Sp4TEHyAJ7IPN9+GHweCX1hT4OFxt152sBN3jJc1s0Ymzd8pNGZNoQ=", "base64senderPublicKeys": { "6": "MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////////////////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABGMxHraqggr2keTXszIcchTjYjH5WXpDaBOYgXva82mKcGnKgGRORXSmcjWN2suUCMkLQj3UNlZCFWF10wIrrlw=" }, "collectionID": "devcon", "title": "Devcon", "tokenOrigin": "http://localhost:3002/", "whitelist": [] }]); + }) + test('can build a filtered issuer list', async () => { + const hashToConfigMap = outlet.getHashToConfigMap(); + const requestHashes = { + attestationDao: [ + '0x0915bb6dcd508278764d9bfff6ba113c87c761ed78e84ed238811f2264a83a05', + '0x76d49eaf820fc5313a752214192a223511244124e188557fe84d88d8ff8c3a2f', + ], + devcon: [ + '0x0915bb6dcd508278764d9bfff6ba113c87c761ed78e84ed238811f2264a83a05', + '0x76d49eaf820fc5313a752214192a223511244124e188557fe84d88d8ff8c3a2f', + ], + } + expect(outlet.getFilteredRequestHashes(requestHashes, hashToConfigMap, ['devcon', 'attestationDao'])).toEqual({ "attestationDao": ["0x0915bb6dcd508278764d9bfff6ba113c87c761ed78e84ed238811f2264a83a05"], "devcon": ["0x0915bb6dcd508278764d9bfff6ba113c87c761ed78e84ed238811f2264a83a05"] }); + }) + test('can build an empty filtered issuer list', async () => { + const hashToConfigMap = outlet.getHashToConfigMap(); + const requestHashes = { + attestationDao: [ + '0x0915bb6dcd508278764d9bfff6ba113c87c761ed78e84ed238811f2264a83a05', + '0x76d49eaf820fc5313a752214192a223511244124e188557fe84d88d8ff8c3a2f', + ], + devcon: [ + '0x0915bb6dcd508278764d9bfff6ba113c87c761ed78e84ed238811f2264a83a05', + '0x76d49eaf820fc5313a752214192a223511244124e188557fe84d88d8ff8c3a2f', + ], + } + expect(outlet.getFilteredRequestHashes(requestHashes, hashToConfigMap, [])).toEqual( + { + "attestationDao": [], + "devcon": [], + } + ) + }) +}) -// return new URLSearchParams(new URL(`http://127.0.0.1?type=${ticketType}&ticket=${ticketInUrl}&secret=${secret}&mail=${email}`).search) -// } describe('Test TicketStorage', () => { // @ts-ignore - const storage = new TicketStorage(outlet.tokenConfig.issuers) - + new TicketStorage(outlet.tokenConfig.issuers) test('storage has the correct data from given input', async () => { // @ts-ignore expect(outlet.tokenConfig.issuers).toEqual(_issuers) }) - - // test('Store ASN ticket', async () => { - // await storage.importTicketFromMagicLink(await createTestMagicLink('asn', '1', 2)) - // const request = { - // 'devcon': ['0x0915bb6dcd508278764d9bfff6ba113c87c761ed78e84ed238811f2264a83a05'], - // 'test-2': ['0x595e334142dd2a9ac6ce2195e560ac1efd926b9632ef10cc7dcf31fe1cb68863'], - // 'test-3': ['0x55592fab10cace25a4b34b07aa8741dc3ae50100f73e2997619a5ccc82f62810'], - // } - // expect((await storage.getDecodedTokens(request)).length).toBe(1) - // }) - // test('Store EAS ticket', async () => { - // await storage.importTicketFromMagicLink(await createTestMagicLink('eas', '2', 2)) - // const request = { - // 'devcon': ['0x0915bb6dcd508278764d9bfff6ba113c87c761ed78e84ed238811f2264a83a05'], - // 'test-2': ['0x595e334142dd2a9ac6ce2195e560ac1efd926b9632ef10cc7dcf31fe1cb68863'], - // 'test-3': ['0x55592fab10cace25a4b34b07aa8741dc3ae50100f73e2997619a5ccc82f62810'], - // } - // expect((await storage.getDecodedTokens(request)).length).toBe(2) - // }) - // test('Ensure already added tickets are overwritten', async () => { - // await storage.importTicketFromMagicLink(await createTestMagicLink('eas', '1', 2)) - // await storage.importTicketFromMagicLink(await createTestMagicLink('asn', '2', 2)) - // expect((await storage.getDecodedTokens()).length).toBe(2) - // }) - // test('Locate token via decoded data', async () => { - // const decToken = (await storage.getDecodedTokens())[0] - // const token = await storage.getStoredTicketFromDecodedToken(decToken) - // expect(token.tokenId).toBe(`${decToken.devconId}-${decToken.ticketId}`) - // }) }) diff --git a/src/outlet/index.ts b/src/outlet/index.ts index d0a6a66a..191450db 100644 --- a/src/outlet/index.ts +++ b/src/outlet/index.ts @@ -93,7 +93,7 @@ export class Outlet extends LocalOutlet { if (this.getDataFromQuery('localClient') === 'true') { return } - await this.processAttestationIdCallback(evtid) + this.processAttestationIdCallback(evtid) break } case OutletAction.GET_PROOF: { @@ -274,47 +274,60 @@ export class Outlet extends LocalOutlet { } } - // TODO: Consolidate redirect callback for tokens, proof & errors into the sendMessageResponse function to remove duplication - private async sendTokens(evtid: any) { - const requestHashes = JSON.parse(this.getDataFromQuery('request')) as IssuerHashMap - - if (!requestHashes) return - - // Create a map of outlet hashes to issuer config - const hashToConfigMap = {} + getRequestHashes() { + return JSON.parse(this.getDataFromQuery('request')) as IssuerHashMap + } + getHashToConfigMap() { + let hashToConfigMap = {} for (const issuer of this.tokenConfig.issuers) { const hashes = createIssuerHashArray(issuer) for (const hash of hashes) { hashToConfigMap[hash] = issuer } } + return hashToConfigMap + } + getRequestIssuerList(requestHashes, hashToConfigMap) { const reqIssuers: OutletIssuerInterface[] = [] - - // Loop through client request hashes & create an array of issuers for whitelist processing for (const issuer in requestHashes) { for (const hash of requestHashes[issuer]) { - if (hashToConfigMap[hash]) { - if (reqIssuers.indexOf(hashToConfigMap[hash]) === -1) reqIssuers.push(hashToConfigMap[hash]) + if (hashToConfigMap[hash] && reqIssuers.indexOf(hashToConfigMap[hash]) === -1) { + reqIssuers.push(hashToConfigMap[hash]) } } } + return reqIssuers + } - const whitelistedIssuers = await this.whitelist.whitelistCheck(reqIssuers, false) - - // Remove hashes that don't exist in outlets own config and non-whitelisted issuers + getFilteredRequestHashes(requestHashes, hashToConfigMap, whitelistedIssuers) { for (const issuer in requestHashes) { - const filteredHashes = [] + const configAndWhiteListHashes = [] for (const hash of requestHashes[issuer]) { if (hashToConfigMap[hash] && whitelistedIssuers.indexOf(hashToConfigMap[hash].collectionID) > -1) { - filteredHashes.push(hash) + configAndWhiteListHashes.push(hash) } } - requestHashes[issuer] = filteredHashes + requestHashes[issuer] = configAndWhiteListHashes } + return requestHashes + } + + private async sendTokens(evtid: any) { + const requestHashes = this.getRequestHashes() + + if (!requestHashes) return + + const hashToConfigMap = this.getHashToConfigMap() + + const reqIssuers = this.getRequestIssuerList(requestHashes, hashToConfigMap) + + const whitelistedIssuers = await this.whitelist.whitelistCheck(reqIssuers, false) + + const filteredRequestHashes = this.getFilteredRequestHashes(requestHashes, hashToConfigMap, whitelistedIssuers) - let issuerTokens = await this.ticketStorage.getDecodedTokens(requestHashes) + let issuerTokens = await this.ticketStorage.getDecodedTokens(filteredRequestHashes) logger(2, 'issuerTokens: (Outlet.sendTokens)', issuerTokens) @@ -324,7 +337,6 @@ export class Outlet extends LocalOutlet { const params = new URLSearchParams(url.hash.substring(1)) params.set(this.getCallbackUrlKey('action'), OutletAction.GET_ISSUER_TOKENS + '-response') - // params.set(this.getCallbackUrlKey('issuer'), this.tokenConfig.collectionID) params.set(this.getCallbackUrlKey('tokens'), JSON.stringify(issuerTokens)) url.hash = '#' + params.toString() @@ -345,7 +357,6 @@ export class Outlet extends LocalOutlet { evtid: evtid, evt: OutletResponseAction.ISSUER_TOKENS, data: { - // issuer: this.tokenConfig.collectionID, tokens: issuerTokens, }, }) diff --git a/src/utils/__tests__/util.spec.ts b/src/utils/__tests__/util.spec.ts index 78c4b9f3..100edbc8 100644 --- a/src/utils/__tests__/util.spec.ts +++ b/src/utils/__tests__/util.spec.ts @@ -2,9 +2,6 @@ window.DISPLAY_DEBUG_LEVEL = 1 import { TextEncoder, TextDecoder } from 'util' -Object.assign(global, { TextDecoder, TextEncoder }) - -import { hasUncaughtExceptionCaptureCallback } from 'process' import { createIssuerHashMap, createIssuerHashArray, @@ -17,10 +14,8 @@ import { removeUrlSearchParams, } from './../index' import { errorHandler } from '../index' -import { toExpression } from '@babel/types' -// TODO: add unit tests for the following functions: -// logger, requiredParams, asyncHandle, attachPostMessageListener. +Object.assign(global, { TextDecoder, TextEncoder }) describe('util Spec object comparison', () => { test('expect a to be b shallow comparison', () => { diff --git a/src/utils/index.ts b/src/utils/index.ts index 9b1e33d3..1d210fe0 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -4,8 +4,6 @@ import { sha256 } from 'ethers/lib/utils' import { OffChainTokenConfig } from '../client/interface' import { OutletIssuerInterface } from '../outlet/interfaces' import { DEFAULT_SCHEMA_UIDS } from '../outlet/ticketStorage' -import { DecodedToken } from '../outlet/ticketStorage' -import { TokenData } from '../client/tokenStore' export interface IssuerHashMap { [collectionId: string]: string[] diff --git a/src/utils/token/__tests__/onchaintoken.spec.ts b/src/utils/token/__tests__/onchaintoken.spec.ts index 6e6cad75..38ef429b 100644 --- a/src/utils/token/__tests__/onchaintoken.spec.ts +++ b/src/utils/token/__tests__/onchaintoken.spec.ts @@ -266,36 +266,6 @@ it('get evm Nft Collection Url', async () => { ) }) -/* it('get evm fungible tokens', async () => { - global.fetch = jest.fn(() => - Promise.resolve({ status: 200, json: () => Promise.resolve(mockFungibleTokensResponse) }), - ) - const evmtokens = await getEvmFungibleTokensBalance({ - contract: '0xe0ad1806fd3e7edf6ff52fdb822432e847411033', - chain: 'eth', - erc: 200, - }, "0x52459834ca561cb55411699e9c2143683bcf865f") - expect(evmtokens).toEqual( - 'https://api.token-discovery.tokenscript.org/get-owner-fungible-tokens?addresses=0x52459834ca561cb55411699e9c2143683bcf865f&chain=eth&blockchain=evm', - ) -}) - -it('get solana fungible tokens', async () => { - global.fetch = jest.fn(() => - Promise.resolve({ status: 200, json: () => Promise.resolve(mockFungibleTokensResponse) }), - ) - const solanatokens = await getSolanaFungibleTokensBalance({ - collectionAddress: '0x52459834ca561cb55411699e9c2143683bcf865f', - chain: 'eth', - blockchain: 'solana', - erc: 200, - }) - expect(solanatokens).toEqual( - 'https://api.token-discovery.tokenscript.org/get-owner-fungible-tokens?addresses=0x52459834ca561cb55411699e9c2143683bcf865f&chain=eth&blockchain=solana', - ) -})*/ - -// TODO: This test doesn't test anything since fetch is hardcoded to return the exact result the test expects it('get fungible tokens', async () => { global.fetch = jest.fn(() => Promise.resolve({ status: 200, json: () => Promise.resolve(mockFungibleTokensResponse) })) const tokens = await getFungibleTokenBalances( diff --git a/src/version.ts b/src/version.ts index 124b6660..cbae52a8 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1,2 +1,2 @@ // modified by build process. -export const VERSION = '3.2.0' +export const VERSION = '3.2.1' diff --git a/src/wallet/Web3WalletProvider.ts b/src/wallet/Web3WalletProvider.ts index e56dc4ef..61eff045 100644 --- a/src/wallet/Web3WalletProvider.ts +++ b/src/wallet/Web3WalletProvider.ts @@ -417,7 +417,7 @@ export class Web3WalletProvider { }) }) - universalWalletConnect.on('session_delete', ({ id, topic }: { id: number; topic: string }) => { + universalWalletConnect.on('session_delete', () => { // TODO: There is currently a bug in the universal provider that prevents this handler from being called. // After this is fixed, this should handle the event correctly // https://github.com/WalletConnect/walletconnect-monorepo/issues/1772 diff --git a/src/wallet/__test__/wallet.spec.ts b/src/wallet/__test__/wallet.spec.ts index 0f6af4be..d5635b95 100644 --- a/src/wallet/__test__/wallet.spec.ts +++ b/src/wallet/__test__/wallet.spec.ts @@ -1,12 +1,12 @@ /* eslint-disable no-mixed-spaces-and-tabs */ -import { ethers } from 'ethers' import { TextDecoder, TextEncoder } from 'text-encoding' -global.TextEncoder = TextEncoder -global.TextDecoder = TextDecoder import { Client } from '../../client/index' -import { SafeConnectOptions, SafeConnectProvider } from '../SafeConnectProvider' +import { SafeConnectProvider } from '../SafeConnectProvider' import { Web3WalletProvider } from '../Web3WalletProvider' +global.TextEncoder = TextEncoder +global.TextDecoder = TextDecoder + let tokenNegotiatorClient = new Client({ type: 'active', issuers: [ @@ -98,14 +98,7 @@ describe('Provider tests', () => { test('web3WalletProvider connect with void method for ETH connnection register wallet address', async () => { web3WalletProvider = new Web3WalletProvider(tokenNegotiatorClient, null, null) window.ethereum = { - enable: () => ['0x1263b90F4e1DFe89A8f9E623FF57adb252851fC3'], - // provider: { - // events: { - // accountsChanged: () => {}, - // chainChanged: () => {}, - // disconnect: () => {}, - // }, - // }, + enable: () => ['0x1263b90F4e1DFe89A8f9E623FF57adb252851fC3'] } web3WalletProvider.registerNewWalletAddress( '0x1263b90F4e1DFe89A8f9E623FF57adb252851fC3'.toLocaleLowerCase(), diff --git a/webpack.config.js b/webpack.config.js index ab49251c..e37b003a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -79,4 +79,4 @@ module.exports = { minimize: true, minimizer: [new TerserPlugin()], }, -}; +}; \ No newline at end of file