diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..6a8af5e9 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "tabWidth": 2, + "semi": true, + "singleQuote": true +} diff --git a/CHANGELOG.md b/CHANGELOG.md index f0752970..f5fa421d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,44 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [3.1.1](https://github.com/lukso-network/tools-lsp-factory/compare/v3.1.0...v3.1.1) (2023-09-12) + + +### Bug Fixes + +* use default SC version ([ed4a1a2](https://github.com/lukso-network/tools-lsp-factory/commit/ed4a1a2b85a0e1283ceb2142af64a1d74080d940)) + +## [3.1.0](https://github.com/lukso-network/tools-lsp-factory/compare/v3.0.0...v3.1.0) (2023-09-08) + + +### ⚠ BREAKING CHANGES + +* upgrade lsp to v0.11.1 + +### Features + +* upgrade lsp to v0.11.1 ([ccc61f8](https://github.com/lukso-network/tools-lsp-factory/commit/ccc61f855028c617767f726e317298ee65ee358a)) + + +### Bug Fixes + +* enable source map ([e3c60b3](https://github.com/lukso-network/tools-lsp-factory/commit/e3c60b331c213ce5ce6dec8479b577471345d76e)) + + +### Miscellaneous Chores + +* release 3.1.0 ([6955282](https://github.com/lukso-network/tools-lsp-factory/commit/6955282cd707d10493dda0acd3d02d91dc607bcc)) + +## [3.0.0](https://github.com/lukso-network/tools-lsp-factory/compare/v2.5.1...v3.0.0) (2023-08-17) + +### ⚠ BREAKING CHANGES + +- upgrade smart contracts to v0.10.3 ([#204](https://github.com/lukso-network/tools-lsp-factory/issues/204)) + +### Features + +- upgrade smart contracts to v0.10.3 ([#204](https://github.com/lukso-network/tools-lsp-factory/issues/204)) ([db9d147](https://github.com/lukso-network/tools-lsp-factory/commit/db9d147df5b11dcb95c7a8249c683db49db2cce0)) + ### [2.5.1](https://github.com/lukso-network/tools-lsp-factory/compare/v2.5.0...v2.5.1) (2023-03-30) ### Bug Fixes diff --git a/package-lock.json b/package-lock.json index d5b1b7b4..0bc9066e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,18 +1,18 @@ { "name": "@lukso/lsp-factory.js", - "version": "2.5.1", + "version": "3.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@lukso/lsp-factory.js", - "version": "2.5.1", + "version": "3.1.1", "license": "MIT", "dependencies": { "@erc725/erc725.js": "^0.21.0", "@ethersproject/abi": "^5.7.0", "@ethersproject/experimental": "^5.7.0", - "@lukso/lsp-smart-contracts": "^0.11.1", + "@lukso/lsp-smart-contracts": "^0.12.0", "axios": "^0.23.0", "browser-image-compression": "^2.0.0", "ethers": "^5.7.0", @@ -54,6 +54,11 @@ "node": ">=10" } }, + "node_modules/@account-abstraction/contracts": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@account-abstraction/contracts/-/contracts-0.6.0.tgz", + "integrity": "sha512-8ooRJuR7XzohMDM4MV34I12Ci2bmxfE9+cixakRL7lA4BAwJKQ3ahvd8FbJa9kiwkUPCUNtj+/zxDQWYYalLMQ==" + }, "node_modules/@babel/code-frame": { "version": "7.16.0", "license": "MIT", @@ -159,9 +164,9 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" }, "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.2.tgz", - "integrity": "sha512-k0qnnOqHn5dK9pZpfD5XXZ9SojAITdCKRn2Lp6rnDGzIbaP0rHyMPk/4wsSxVBVz4RfN0q6VpXWP2pDGIoQ7hw==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.3.tgz", + "integrity": "sha512-WBrLmuPP47n7PNwsZ57pqam6G/RGo1vw/87b0Blc53tZNGZ4x7YvZ6HgQe2vo1W/FR20OgjeZuGXzudPiXHFug==", "dependencies": { "@babel/helper-compilation-targets": "^7.22.6", "@babel/helper-plugin-utils": "^7.22.5", @@ -519,15 +524,15 @@ } }, "node_modules/@babel/plugin-transform-runtime": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.22.15.tgz", - "integrity": "sha512-tEVLhk8NRZSmwQ0DJtxxhTrCht1HVo8VaMzYT4w6lwyKBuHsgoioAUA7/6eT2fRfc5/23fuGdlwIxXhRVgWr4g==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.23.2.tgz", + "integrity": "sha512-XOntj6icgzMS58jPVtQpiuF6ZFWxQiJavISGx5KGjRj+3gqZr8+N6Kx+N9BApWzgS+DOjIZfXXj0ZesenOWDyA==", "dependencies": { "@babel/helper-module-imports": "^7.22.15", "@babel/helper-plugin-utils": "^7.22.5", - "babel-plugin-polyfill-corejs2": "^0.4.5", - "babel-plugin-polyfill-corejs3": "^0.8.3", - "babel-plugin-polyfill-regenerator": "^0.5.2", + "babel-plugin-polyfill-corejs2": "^0.4.6", + "babel-plugin-polyfill-corejs3": "^0.8.5", + "babel-plugin-polyfill-regenerator": "^0.5.3", "semver": "^6.3.1" }, "engines": { @@ -546,9 +551,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.15.tgz", - "integrity": "sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz", + "integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==", "dependencies": { "regenerator-runtime": "^0.14.0" }, @@ -1302,9 +1307,9 @@ } }, "node_modules/@erc725/smart-contracts": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@erc725/smart-contracts/-/smart-contracts-5.2.0.tgz", - "integrity": "sha512-ML7eXO2l6GO847CKGTbSO7MxpfVpmZvVPA/4KutYwVkaZmPxB05WC2flPxUilUz7ws0S7xgyt50sPHLA1ffojA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@erc725/smart-contracts/-/smart-contracts-6.0.0.tgz", + "integrity": "sha512-6okutGGL9xbg/MSgAof2FU1UcSNE/z3p9TORlROVGaM3gi1A6FQQ7fDqtBYkPtvHureX8yS9gP7xPt3PRbP43Q==", "dependencies": { "@openzeppelin/contracts": "^4.9.3", "@openzeppelin/contracts-upgradeable": "^4.9.3", @@ -3805,11 +3810,12 @@ } }, "node_modules/@lukso/lsp-smart-contracts": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/@lukso/lsp-smart-contracts/-/lsp-smart-contracts-0.11.1.tgz", - "integrity": "sha512-qGmTVjGR6tA+h7o4AAJBuGphcJTfXcVdCpx7yeHvLWW3+3a+KYsCORKKnutAfMwdbIL0W944PVhzq7xx+vVLPg==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@lukso/lsp-smart-contracts/-/lsp-smart-contracts-0.12.0.tgz", + "integrity": "sha512-isF4Ts5VScJqZJkTxNc4T9U60jbVGj6OCxfXijXUGP+ZsOFHuWf9EOFRljA+m5yeVa47XC7vZPuMptMUQS/FNA==", "dependencies": { - "@erc725/smart-contracts": "^5.2.0", + "@account-abstraction/contracts": "^0.6.0", + "@erc725/smart-contracts": "^6.0.0", "@openzeppelin/contracts": "^4.9.2", "@openzeppelin/contracts-upgradeable": "^4.9.2", "solidity-bytes-utils": "0.8.0" @@ -4801,9 +4807,9 @@ } }, "node_modules/@types/ethereum-protocol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/ethereum-protocol/-/ethereum-protocol-1.0.2.tgz", - "integrity": "sha512-Ri/hwt4UckZlF7eqhhAQcXsNvcgQmSJOKZteLco1/5NsRcneW/cJuQcrQNILN2Ohs9WUQjeGW3ZRRNqkEVMzuQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/ethereum-protocol/-/ethereum-protocol-1.0.4.tgz", + "integrity": "sha512-qzqIdFigCLH4ZoTjDAAz3kv6+dGXx8UVP9a5RHrJzbnaqSKEMSI/zAMgMH2HPRJrMKKYBOydYgblzS+WZG27+Q==", "dependencies": { "bignumber.js": "7.2.1" } @@ -4825,9 +4831,9 @@ } }, "node_modules/@types/http-cache-semantics": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", - "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz", + "integrity": "sha512-V46MYLFp08Wf2mmaBhvgjStM3tPa+2GAdy/iqoX+noX1//zje2x4XmrIU0cAwyClATsTmahbtoQ2EwP7I5WSiA==" }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.3", @@ -5072,9 +5078,9 @@ "license": "MIT" }, "node_modules/@types/responselike": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", - "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha512-/4YQT5Kp6HxUDb4yhRkm0bJ7TbjvTddqX7PZ5hz6qV3pxSo72f/6YPRo+Mu2DU307tm9IioO69l7uAwn5XNcFA==", "dependencies": { "@types/node": "*" } @@ -5098,9 +5104,9 @@ "license": "MIT" }, "node_modules/@types/underscore": { - "version": "1.11.9", - "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.9.tgz", - "integrity": "sha512-M63wKUdsjDFUfyFt1TCUZHGFk9KDAa5JP0adNUErbm0U45Lr06HtANdYRP+GyleEopEoZ4UyBcdAC5TnW4Uz2w==" + "version": "1.11.12", + "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.12.tgz", + "integrity": "sha512-beX81q12OQo809WJ/UYCvUDvJR3YQ4wtehYYQ6eNw5VLyd+KUNBRV4FgzZCHBmACbdPulH9F9ifhxzFFU9TWvQ==" }, "node_modules/@types/web3": { "version": "1.0.20", @@ -5112,9 +5118,9 @@ } }, "node_modules/@types/web3-provider-engine": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/@types/web3-provider-engine/-/web3-provider-engine-14.0.1.tgz", - "integrity": "sha512-SaAfLJY/40wKFDsNFwaNfwqFSL6kVhTx9JD18qM+Gaw1qdAXLYF/6E7TIqWEdoG4so6fki/zxURP5NsoCePYJw==", + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/@types/web3-provider-engine/-/web3-provider-engine-14.0.2.tgz", + "integrity": "sha512-i+vgIh873kDu6MnYZkIqrho4JCan1c8TcPnYY6te2lq1ODD4SPA8JxFCyQjK+vwbLMr5F3N/I37AfK/wxiyuEA==", "dependencies": { "@types/ethereum-protocol": "*" } @@ -6060,12 +6066,12 @@ } }, "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.5.tgz", - "integrity": "sha512-19hwUH5FKl49JEsvyTcoHakh6BE0wgXLLptIyKZ3PijHc/Ci521wygORCUCCred+E/twuqRyAkE02BAWPmsHOg==", + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.6.tgz", + "integrity": "sha512-jhHiWVZIlnPbEUKSSNb9YoWcQGdlTLq7z1GHL4AjFxaoOUMuuEVJ+Y4pAaQUGOGk93YsVCKPbqbfw3m0SM6H8Q==", "dependencies": { "@babel/compat-data": "^7.22.6", - "@babel/helper-define-polyfill-provider": "^0.4.2", + "@babel/helper-define-polyfill-provider": "^0.4.3", "semver": "^6.3.1" }, "peerDependencies": { @@ -6081,23 +6087,23 @@ } }, "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.3.tgz", - "integrity": "sha512-z41XaniZL26WLrvjy7soabMXrfPWARN25PZoriDEiLMxAp50AUW3t35BGQUMg5xK3UrpVTtagIDklxYa+MhiNA==", + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.5.tgz", + "integrity": "sha512-Q6CdATeAvbScWPNLB8lzSO7fgUVBkQt6zLgNlfyeCr/EQaEQR+bWiBYYPYAFyE528BMjRhL+1QBMOI4jc/c5TA==", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.4.2", - "core-js-compat": "^3.31.0" + "@babel/helper-define-polyfill-provider": "^0.4.3", + "core-js-compat": "^3.32.2" }, "peerDependencies": { "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, "node_modules/babel-plugin-polyfill-regenerator": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.2.tgz", - "integrity": "sha512-tAlOptU0Xj34V1Y2PNTL4Y0FOJMDB6bZmoW39FeCQIhigGLkqu3Fj6uiXpxIf6Ij274ENdYx64y6Au+ZKlb1IA==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.3.tgz", + "integrity": "sha512-8sHeDOmXC8csczMrYEOf0UTNa4yE2SxV5JGeT/LP1n0OYVDUUFPxG9vdk2AlDlIit4t+Kf0xCtpgXPBwnn/9pw==", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.4.2" + "@babel/helper-define-polyfill-provider": "^0.4.3" }, "peerDependencies": { "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" @@ -6505,9 +6511,9 @@ "optional": true }, "node_modules/browserslist": { - "version": "4.21.10", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.10.tgz", - "integrity": "sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ==", + "version": "4.22.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz", + "integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==", "funding": [ { "type": "opencollective", @@ -6523,10 +6529,10 @@ } ], "dependencies": { - "caniuse-lite": "^1.0.30001517", - "electron-to-chromium": "^1.4.477", + "caniuse-lite": "^1.0.30001541", + "electron-to-chromium": "^1.4.535", "node-releases": "^2.0.13", - "update-browserslist-db": "^1.0.11" + "update-browserslist-db": "^1.0.13" }, "bin": { "browserslist": "cli.js" @@ -6796,9 +6802,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001517", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001517.tgz", - "integrity": "sha512-Vdhm5S11DaFVLlyiKu4hiUTkpZu+y1KA/rZZqVQfOD5YdDT/eQKlkt7NaE0WGOFgX32diqt9MiP9CAiFeRklaA==", + "version": "1.0.30001550", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001550.tgz", + "integrity": "sha512-p82WjBYIypO0ukTsd/FG3Xxs+4tFeaY9pfT4amQL8KWtYH7H9nYwReGAbMTJ0hsmRO8IfDtsS6p3ZWj8+1c2RQ==", "funding": [ { "type": "opencollective", @@ -8810,11 +8816,11 @@ } }, "node_modules/core-js-compat": { - "version": "3.32.2", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.32.2.tgz", - "integrity": "sha512-+GjlguTDINOijtVRUxrQOv3kfu9rl+qPNdX2LTbJ/ZyVTuxK+ksVSAGX1nHstu4hrv1En/uPTtWgq2gI5wt4AQ==", + "version": "3.33.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.33.0.tgz", + "integrity": "sha512-0w4LcLXsVEuNkIqwjjf9rjCoPhK8uqA4tMRh4Ge26vfLtUutshn+aRJU21I9LCJlh2QQHfisNToLjw1XEJLTWw==", "dependencies": { - "browserslist": "^4.21.10" + "browserslist": "^4.22.1" }, "funding": { "type": "opencollective", @@ -9986,9 +9992,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.4.512", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.512.tgz", - "integrity": "sha512-1W8wRbYlQE4ph7eoj3TJ+uqwO6+xvAE/L+KGU7WTQQvX3tnSIGZAb90MTsMoJqzntamiwJhBAj4WZmygXhsOUg==" + "version": "1.4.557", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.557.tgz", + "integrity": "sha512-6x0zsxyMXpnMJnHrondrD3SuAeKcwij9S+83j2qHAQPXbGTDDfgImzzwgGlzrIcXbHQ42tkG4qA6U860cImNhw==" }, "node_modules/elliptic": { "version": "6.5.4", @@ -11316,6 +11322,7 @@ "version": "5.1.0", "resolved": "https://registry.npmjs.org/eth-json-rpc-infura/-/eth-json-rpc-infura-5.1.0.tgz", "integrity": "sha512-THzLye3PHUSGn1EXMhg6WTLW9uim7LQZKeKaeYsS9+wOBcamRiCQVGHa6D2/4P0oS0vSaxsBnU/J6qvn0MPdow==", + "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.", "dependencies": { "eth-json-rpc-middleware": "^6.0.0", "eth-rpc-errors": "^3.0.0", @@ -29370,9 +29377,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", "funding": [ { "type": "opencollective", @@ -29828,9 +29835,9 @@ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" }, "node_modules/web3-bzz/node_modules/keyv": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", - "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "dependencies": { "json-buffer": "3.0.1" } @@ -30065,9 +30072,13 @@ } }, "node_modules/web3-eth-accounts/node_modules/uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], "bin": { "uuid": "dist/bin/uuid" } @@ -30715,6 +30726,11 @@ } }, "dependencies": { + "@account-abstraction/contracts": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@account-abstraction/contracts/-/contracts-0.6.0.tgz", + "integrity": "sha512-8ooRJuR7XzohMDM4MV34I12Ci2bmxfE9+cixakRL7lA4BAwJKQ3ahvd8FbJa9kiwkUPCUNtj+/zxDQWYYalLMQ==" + }, "@babel/code-frame": { "version": "7.16.0", "requires": { @@ -30792,9 +30808,9 @@ } }, "@babel/helper-define-polyfill-provider": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.2.tgz", - "integrity": "sha512-k0qnnOqHn5dK9pZpfD5XXZ9SojAITdCKRn2Lp6rnDGzIbaP0rHyMPk/4wsSxVBVz4RfN0q6VpXWP2pDGIoQ7hw==", + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.4.3.tgz", + "integrity": "sha512-WBrLmuPP47n7PNwsZ57pqam6G/RGo1vw/87b0Blc53tZNGZ4x7YvZ6HgQe2vo1W/FR20OgjeZuGXzudPiXHFug==", "requires": { "@babel/helper-compilation-targets": "^7.22.6", "@babel/helper-plugin-utils": "^7.22.5", @@ -31018,15 +31034,15 @@ } }, "@babel/plugin-transform-runtime": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.22.15.tgz", - "integrity": "sha512-tEVLhk8NRZSmwQ0DJtxxhTrCht1HVo8VaMzYT4w6lwyKBuHsgoioAUA7/6eT2fRfc5/23fuGdlwIxXhRVgWr4g==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.23.2.tgz", + "integrity": "sha512-XOntj6icgzMS58jPVtQpiuF6ZFWxQiJavISGx5KGjRj+3gqZr8+N6Kx+N9BApWzgS+DOjIZfXXj0ZesenOWDyA==", "requires": { "@babel/helper-module-imports": "^7.22.15", "@babel/helper-plugin-utils": "^7.22.5", - "babel-plugin-polyfill-corejs2": "^0.4.5", - "babel-plugin-polyfill-corejs3": "^0.8.3", - "babel-plugin-polyfill-regenerator": "^0.5.2", + "babel-plugin-polyfill-corejs2": "^0.4.6", + "babel-plugin-polyfill-corejs3": "^0.8.5", + "babel-plugin-polyfill-regenerator": "^0.5.3", "semver": "^6.3.1" }, "dependencies": { @@ -31038,9 +31054,9 @@ } }, "@babel/runtime": { - "version": "7.22.15", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.15.tgz", - "integrity": "sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz", + "integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==", "requires": { "regenerator-runtime": "^0.14.0" } @@ -31687,9 +31703,9 @@ } }, "@erc725/smart-contracts": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@erc725/smart-contracts/-/smart-contracts-5.2.0.tgz", - "integrity": "sha512-ML7eXO2l6GO847CKGTbSO7MxpfVpmZvVPA/4KutYwVkaZmPxB05WC2flPxUilUz7ws0S7xgyt50sPHLA1ffojA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@erc725/smart-contracts/-/smart-contracts-6.0.0.tgz", + "integrity": "sha512-6okutGGL9xbg/MSgAof2FU1UcSNE/z3p9TORlROVGaM3gi1A6FQQ7fDqtBYkPtvHureX8yS9gP7xPt3PRbP43Q==", "requires": { "@openzeppelin/contracts": "^4.9.3", "@openzeppelin/contracts-upgradeable": "^4.9.3", @@ -33238,11 +33254,12 @@ } }, "@lukso/lsp-smart-contracts": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/@lukso/lsp-smart-contracts/-/lsp-smart-contracts-0.11.1.tgz", - "integrity": "sha512-qGmTVjGR6tA+h7o4AAJBuGphcJTfXcVdCpx7yeHvLWW3+3a+KYsCORKKnutAfMwdbIL0W944PVhzq7xx+vVLPg==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/@lukso/lsp-smart-contracts/-/lsp-smart-contracts-0.12.0.tgz", + "integrity": "sha512-isF4Ts5VScJqZJkTxNc4T9U60jbVGj6OCxfXijXUGP+ZsOFHuWf9EOFRljA+m5yeVa47XC7vZPuMptMUQS/FNA==", "requires": { - "@erc725/smart-contracts": "^5.2.0", + "@account-abstraction/contracts": "^0.6.0", + "@erc725/smart-contracts": "^6.0.0", "@openzeppelin/contracts": "^4.9.2", "@openzeppelin/contracts-upgradeable": "^4.9.2", "solidity-bytes-utils": "0.8.0" @@ -34002,9 +34019,9 @@ } }, "@types/ethereum-protocol": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@types/ethereum-protocol/-/ethereum-protocol-1.0.2.tgz", - "integrity": "sha512-Ri/hwt4UckZlF7eqhhAQcXsNvcgQmSJOKZteLco1/5NsRcneW/cJuQcrQNILN2Ohs9WUQjeGW3ZRRNqkEVMzuQ==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@types/ethereum-protocol/-/ethereum-protocol-1.0.4.tgz", + "integrity": "sha512-qzqIdFigCLH4ZoTjDAAz3kv6+dGXx8UVP9a5RHrJzbnaqSKEMSI/zAMgMH2HPRJrMKKYBOydYgblzS+WZG27+Q==", "requires": { "bignumber.js": "7.2.1" }, @@ -34024,9 +34041,9 @@ } }, "@types/http-cache-semantics": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz", - "integrity": "sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==" + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/@types/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz", + "integrity": "sha512-V46MYLFp08Wf2mmaBhvgjStM3tPa+2GAdy/iqoX+noX1//zje2x4XmrIU0cAwyClATsTmahbtoQ2EwP7I5WSiA==" }, "@types/istanbul-lib-coverage": { "version": "2.0.3", @@ -34207,9 +34224,9 @@ "dev": true }, "@types/responselike": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", - "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.2.tgz", + "integrity": "sha512-/4YQT5Kp6HxUDb4yhRkm0bJ7TbjvTddqX7PZ5hz6qV3pxSo72f/6YPRo+Mu2DU307tm9IioO69l7uAwn5XNcFA==", "requires": { "@types/node": "*" } @@ -34231,9 +34248,9 @@ "dev": true }, "@types/underscore": { - "version": "1.11.9", - "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.9.tgz", - "integrity": "sha512-M63wKUdsjDFUfyFt1TCUZHGFk9KDAa5JP0adNUErbm0U45Lr06HtANdYRP+GyleEopEoZ4UyBcdAC5TnW4Uz2w==" + "version": "1.11.12", + "resolved": "https://registry.npmjs.org/@types/underscore/-/underscore-1.11.12.tgz", + "integrity": "sha512-beX81q12OQo809WJ/UYCvUDvJR3YQ4wtehYYQ6eNw5VLyd+KUNBRV4FgzZCHBmACbdPulH9F9ifhxzFFU9TWvQ==" }, "@types/web3": { "version": "1.0.20", @@ -34245,9 +34262,9 @@ } }, "@types/web3-provider-engine": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/@types/web3-provider-engine/-/web3-provider-engine-14.0.1.tgz", - "integrity": "sha512-SaAfLJY/40wKFDsNFwaNfwqFSL6kVhTx9JD18qM+Gaw1qdAXLYF/6E7TIqWEdoG4so6fki/zxURP5NsoCePYJw==", + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/@types/web3-provider-engine/-/web3-provider-engine-14.0.2.tgz", + "integrity": "sha512-i+vgIh873kDu6MnYZkIqrho4JCan1c8TcPnYY6te2lq1ODD4SPA8JxFCyQjK+vwbLMr5F3N/I37AfK/wxiyuEA==", "requires": { "@types/ethereum-protocol": "*" } @@ -34876,12 +34893,12 @@ } }, "babel-plugin-polyfill-corejs2": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.5.tgz", - "integrity": "sha512-19hwUH5FKl49JEsvyTcoHakh6BE0wgXLLptIyKZ3PijHc/Ci521wygORCUCCred+E/twuqRyAkE02BAWPmsHOg==", + "version": "0.4.6", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.6.tgz", + "integrity": "sha512-jhHiWVZIlnPbEUKSSNb9YoWcQGdlTLq7z1GHL4AjFxaoOUMuuEVJ+Y4pAaQUGOGk93YsVCKPbqbfw3m0SM6H8Q==", "requires": { "@babel/compat-data": "^7.22.6", - "@babel/helper-define-polyfill-provider": "^0.4.2", + "@babel/helper-define-polyfill-provider": "^0.4.3", "semver": "^6.3.1" }, "dependencies": { @@ -34893,20 +34910,20 @@ } }, "babel-plugin-polyfill-corejs3": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.3.tgz", - "integrity": "sha512-z41XaniZL26WLrvjy7soabMXrfPWARN25PZoriDEiLMxAp50AUW3t35BGQUMg5xK3UrpVTtagIDklxYa+MhiNA==", + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.8.5.tgz", + "integrity": "sha512-Q6CdATeAvbScWPNLB8lzSO7fgUVBkQt6zLgNlfyeCr/EQaEQR+bWiBYYPYAFyE528BMjRhL+1QBMOI4jc/c5TA==", "requires": { - "@babel/helper-define-polyfill-provider": "^0.4.2", - "core-js-compat": "^3.31.0" + "@babel/helper-define-polyfill-provider": "^0.4.3", + "core-js-compat": "^3.32.2" } }, "babel-plugin-polyfill-regenerator": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.2.tgz", - "integrity": "sha512-tAlOptU0Xj34V1Y2PNTL4Y0FOJMDB6bZmoW39FeCQIhigGLkqu3Fj6uiXpxIf6Ij274ENdYx64y6Au+ZKlb1IA==", + "version": "0.5.3", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.5.3.tgz", + "integrity": "sha512-8sHeDOmXC8csczMrYEOf0UTNa4yE2SxV5JGeT/LP1n0OYVDUUFPxG9vdk2AlDlIit4t+Kf0xCtpgXPBwnn/9pw==", "requires": { - "@babel/helper-define-polyfill-provider": "^0.4.2" + "@babel/helper-define-polyfill-provider": "^0.4.3" } }, "babel-preset-current-node-syntax": { @@ -35222,14 +35239,14 @@ } }, "browserslist": { - "version": "4.21.10", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.21.10.tgz", - "integrity": "sha512-bipEBdZfVH5/pwrvqc+Ub0kUPVfGUhlKxbvfD+z1BDnPEO/X98ruXGA1WP5ASpAFKan7Qr6j736IacbZQuAlKQ==", + "version": "4.22.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.1.tgz", + "integrity": "sha512-FEVc202+2iuClEhZhrWy6ZiAcRLvNMyYcxZ8raemul1DYVOVdFsbqckWLdsixQZCpJlwe77Z3UTalE7jsjnKfQ==", "requires": { - "caniuse-lite": "^1.0.30001517", - "electron-to-chromium": "^1.4.477", + "caniuse-lite": "^1.0.30001541", + "electron-to-chromium": "^1.4.535", "node-releases": "^2.0.13", - "update-browserslist-db": "^1.0.11" + "update-browserslist-db": "^1.0.13" } }, "bs-logger": { @@ -35401,9 +35418,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001517", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001517.tgz", - "integrity": "sha512-Vdhm5S11DaFVLlyiKu4hiUTkpZu+y1KA/rZZqVQfOD5YdDT/eQKlkt7NaE0WGOFgX32diqt9MiP9CAiFeRklaA==" + "version": "1.0.30001550", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001550.tgz", + "integrity": "sha512-p82WjBYIypO0ukTsd/FG3Xxs+4tFeaY9pfT4amQL8KWtYH7H9nYwReGAbMTJ0hsmRO8IfDtsS6p3ZWj8+1c2RQ==" }, "capture-exit": { "version": "2.0.0", @@ -36828,11 +36845,11 @@ "dev": true }, "core-js-compat": { - "version": "3.32.2", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.32.2.tgz", - "integrity": "sha512-+GjlguTDINOijtVRUxrQOv3kfu9rl+qPNdX2LTbJ/ZyVTuxK+ksVSAGX1nHstu4hrv1En/uPTtWgq2gI5wt4AQ==", + "version": "3.33.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.33.0.tgz", + "integrity": "sha512-0w4LcLXsVEuNkIqwjjf9rjCoPhK8uqA4tMRh4Ge26vfLtUutshn+aRJU21I9LCJlh2QQHfisNToLjw1XEJLTWw==", "requires": { - "browserslist": "^4.21.10" + "browserslist": "^4.22.1" } }, "core-js-pure": { @@ -37646,9 +37663,9 @@ } }, "electron-to-chromium": { - "version": "1.4.512", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.512.tgz", - "integrity": "sha512-1W8wRbYlQE4ph7eoj3TJ+uqwO6+xvAE/L+KGU7WTQQvX3tnSIGZAb90MTsMoJqzntamiwJhBAj4WZmygXhsOUg==" + "version": "1.4.557", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.557.tgz", + "integrity": "sha512-6x0zsxyMXpnMJnHrondrD3SuAeKcwij9S+83j2qHAQPXbGTDDfgImzzwgGlzrIcXbHQ42tkG4qA6U860cImNhw==" }, "elliptic": { "version": "6.5.4", @@ -51810,9 +51827,9 @@ } }, "update-browserslist-db": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.11.tgz", - "integrity": "sha512-dCwEFf0/oT85M1fHBg4F0jtLwJrutGoHSQXCh7u4o2t1drG+c0a9Flnqww6XUKSfQMPpJBRjU8d4RXB09qtvaA==", + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", "requires": { "escalade": "^3.1.1", "picocolors": "^1.0.0" @@ -52139,9 +52156,9 @@ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" }, "keyv": { - "version": "4.5.3", - "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", - "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", "requires": { "json-buffer": "3.0.1" } @@ -52328,9 +52345,9 @@ } }, "uuid": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.0.tgz", - "integrity": "sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==" + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==" } } }, diff --git a/package.json b/package.json index ef669e64..5163a194 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lukso/lsp-factory.js", - "version": "2.5.1", + "version": "3.1.1", "description": "Helper Library to allow simple deployments of UniversalProfiles and LSP7 and LSP8 Digital Assets.", "main": "build/main/src/index.js", "typings": "build/main/src/index.d.ts", @@ -33,7 +33,7 @@ "@erc725/erc725.js": "^0.21.0", "@ethersproject/abi": "^5.7.0", "@ethersproject/experimental": "^5.7.0", - "@lukso/lsp-smart-contracts": "^0.11.1", + "@lukso/lsp-smart-contracts": "^0.12.0", "axios": "^0.23.0", "browser-image-compression": "^2.0.0", "ethers": "^5.7.0", diff --git a/src/lib/classes/lsp7-digtal-asset.spec.ts b/src/lib/classes/lsp7-digital-asset.spec.ts similarity index 94% rename from src/lib/classes/lsp7-digtal-asset.spec.ts rename to src/lib/classes/lsp7-digital-asset.spec.ts index 2ab45014..bd1b3e88 100644 --- a/src/lib/classes/lsp7-digtal-asset.spec.ts +++ b/src/lib/classes/lsp7-digital-asset.spec.ts @@ -1,3 +1,5 @@ +import { SUPPORTED_VERIFICATION_FUNCTION_HASHES } from '@erc725/erc725.js/build/main/src/constants/constants'; +import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import { providers } from 'ethers'; import { ethers } from 'hardhat'; @@ -9,8 +11,8 @@ import { LSPFactory, } from '../../../build/main/src/index'; import { testDeployWithSpecifiedCreators } from '../../../test/digital-asset.utils'; +import { lsp4DigitalAsset } from '../../../test/lsp4-digital-asset.mock'; -import { lsp4DigitalAsset } from './../../../test/lsp4-digital-asset.mock'; import { ProxyDeployer } from './proxy-deployer'; jest.setTimeout(30000); @@ -228,12 +230,12 @@ describe('LSP7DigitalAsset', () => { const ownerAddress = await digitalAsset.owner(); expect(ownerAddress).toEqual(controllerAddress); - const data = await digitalAsset.getDataBatch([ - '0x9afb95cacc9f95858ec44aa8c3b685511002e30ae54415823f406128b85b238e', - ]); + const data = await digitalAsset.getData(ERC725YDataKeys.LSP4.LSP4Metadata); - expect(data[0].startsWith('0x6f357c6a')).toBe(true); - expect(data[0]).toEqual(expectedLSP4Value); + expect(data.startsWith(SUPPORTED_VERIFICATION_FUNCTION_HASHES.HASH_KECCAK256_UTF8)).toBe( + true + ); + expect(data).toEqual(expectedLSP4Value); }); it('should have correct name and symbol set', async () => { const [retrievedName, retrievedSymbol] = await digitalAsset.getDataBatch([ diff --git a/src/lib/classes/lsp8-identifiable-digital-asset.spec.ts b/src/lib/classes/lsp8-identifiable-digital-asset.spec.ts index fd1ba793..75c32bc4 100644 --- a/src/lib/classes/lsp8-identifiable-digital-asset.spec.ts +++ b/src/lib/classes/lsp8-identifiable-digital-asset.spec.ts @@ -1,3 +1,5 @@ +import { SUPPORTED_VERIFICATION_FUNCTION_HASHES } from '@erc725/erc725.js/build/main/src/constants/constants'; +import { ERC725YDataKeys, LSP8_TOKEN_ID_TYPES } from '@lukso/lsp-smart-contracts'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import { providers } from 'ethers'; import { ethers } from 'hardhat'; @@ -37,6 +39,7 @@ describe('LSP8IdentifiableDigitalAsset', () => { controllerAddress: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', name: 'TOKEN', symbol: 'TKN', + tokenIdType: LSP8_TOKEN_ID_TYPES.UNIQUE_ID, }); expect(lsp8IdentifiableDigitalAsset.LSP8IdentifiableDigitalAsset.address).toBeDefined(); @@ -59,6 +62,7 @@ describe('LSP8IdentifiableDigitalAsset', () => { controllerAddress: signer.address, name: 'TOKEN', symbol: 'TKN', + tokenIdType: LSP8_TOKEN_ID_TYPES.UNIQUE_ID, }, { LSP8IdentifiableDigitalAsset: { @@ -88,6 +92,7 @@ describe('LSP8IdentifiableDigitalAsset', () => { controllerAddress: signer.address, name: 'TOKEN', symbol: 'TKN', + tokenIdType: LSP8_TOKEN_ID_TYPES.UNIQUE_ID, }, { LSP8IdentifiableDigitalAsset: { version: baseContract.address }, @@ -115,6 +120,7 @@ describe('LSP8IdentifiableDigitalAsset', () => { } ); }); + it('Should be compatible with RxJS', (done) => { const myLSPFactory = new LSPFactory(provider, signer); let lsp8Address: string; @@ -157,6 +163,7 @@ describe('LSP8IdentifiableDigitalAsset', () => { controllerAddress: signer.address, name: 'TOKEN', symbol: 'TKN', + tokenIdType: LSP8_TOKEN_ID_TYPES.UNIQUE_ID, }, { LSP8IdentifiableDigitalAsset: { version: baseContract.address }, @@ -176,6 +183,7 @@ describe('LSP8IdentifiableDigitalAsset', () => { controllerAddress: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', name: 'TOKEN', symbol: 'TKN', + tokenIdType: LSP8_TOKEN_ID_TYPES.UNIQUE_ID, }, { LSP8IdentifiableDigitalAsset: { @@ -206,6 +214,7 @@ describe('LSP8IdentifiableDigitalAsset', () => { controllerAddress: signer.address, name: 'TOKEN', symbol: 'TKN', + tokenIdType: LSP8_TOKEN_ID_TYPES.UNIQUE_ID, }, { LSP8IdentifiableDigitalAsset: { @@ -249,6 +258,8 @@ describe('LSP8IdentifiableDigitalAsset', () => { const controllerAddress = '0xaDa25A4424b08F5337DacD619D4bCb21536a9B95'; const name = 'TOKEN'; const symbol = 'TKN'; + const tokenIdType = LSP8_TOKEN_ID_TYPES.UNIQUE_ID; + const expectedLSP4Value = '0x6f357c6a4d81f92a409b60c056e13102169c07e03f7de2dbcb79775a8b1f66a55b6278a0697066733a2f2f516d61543479786a45464e6d7163595965547832706e5a46426d71395055737763424c446b394b716f7148504b67'; @@ -266,6 +277,7 @@ describe('LSP8IdentifiableDigitalAsset', () => { name, symbol, digitalAssetMetadata: lsp4Metadata, + tokenIdType, }); expect(lsp8DigitalAsset.LSP8IdentifiableDigitalAsset.address).toBeDefined(); @@ -276,25 +288,32 @@ describe('LSP8IdentifiableDigitalAsset', () => { signer ); }); + it('should deploy and set LSP4DigitalAsset data', async () => { const ownerAddress = await digitalAsset.owner(); expect(ownerAddress).toEqual(controllerAddress); - const data = await digitalAsset.getDataBatch([ - '0x9afb95cacc9f95858ec44aa8c3b685511002e30ae54415823f406128b85b238e', - ]); + const data = await digitalAsset.getData(ERC725YDataKeys.LSP4.LSP4Metadata); - expect(data[0].startsWith('0x6f357c6a')).toBe(true); - expect(data[0]).toEqual(expectedLSP4Value); + expect(data.startsWith(SUPPORTED_VERIFICATION_FUNCTION_HASHES.HASH_KECCAK256_UTF8)).toBe( + true + ); + expect(data).toEqual(expectedLSP4Value); }); - it('should have correct name and symbol set', async () => { - const [retrievedName, retrievedSymbol] = await digitalAsset.getDataBatch([ - '0xdeba1e292f8ba88238e10ab3c7f88bd4be4fac56cad5194b6ecceaf653468af1', - '0x2f0a68ab07768e01943a599e73362a0e17a63a72e94dd2e384d2c1d4db932756', - ]); + + it('should have correct name, symbol and token ID type set', async () => { + const [retrievedName, retrievedSymbol, retrievedTokenIdType] = + await digitalAsset.getDataBatch([ + ERC725YDataKeys.LSP4.LSP4TokenName, + ERC725YDataKeys.LSP4.LSP4TokenSymbol, + ERC725YDataKeys.LSP8.LSP8TokenIdType, + ]); + + const tokenIdTypeDecoded = ethers.BigNumber.from(retrievedTokenIdType).toNumber(); expect(ethers.utils.toUtf8String(retrievedName)).toEqual(name); expect(ethers.utils.toUtf8String(retrievedSymbol)).toEqual(symbol); + expect(tokenIdTypeDecoded).toEqual(tokenIdType); }); }); @@ -307,6 +326,7 @@ describe('LSP8IdentifiableDigitalAsset', () => { '0xFCA72D5763b8cFc686C2285099D5F35a2F094E9f', '0x591c236982b089Ad4B60758C075fA50Ec53CD674', ]; + const tokenIdType = LSP8_TOKEN_ID_TYPES.UNIQUE_ID; let lspFactory: LSPFactory; @@ -326,6 +346,7 @@ describe('LSP8IdentifiableDigitalAsset', () => { name, symbol, creators, + tokenIdType, }); digitalAsset = LSP8Mintable__factory.connect( diff --git a/src/lib/classes/lsp8-identifiable-digital-asset.ts b/src/lib/classes/lsp8-identifiable-digital-asset.ts index 3733114f..62f83614 100644 --- a/src/lib/classes/lsp8-identifiable-digital-asset.ts +++ b/src/lib/classes/lsp8-identifiable-digital-asset.ts @@ -8,8 +8,8 @@ import { LSPFactoryOptions } from '../interfaces'; import { ContractNames, DeployedLSP8IdentifiableDigitalAsset, - DigitalAssetDeploymentOptions, LSP8ContractDeploymentOptions, + LSP8IdentifiableDigitalAssetDeploymentOptions, } from '../interfaces/digital-asset-deployment'; import { lsp8BaseContractDeployment$, @@ -59,7 +59,7 @@ export class LSP8IdentifiableDigitalAsset { *``` */ async deploy( - digitalAssetDeploymentOptions: DigitalAssetDeploymentOptions, + digitalAssetDeploymentOptions: LSP8IdentifiableDigitalAssetDeploymentOptions, contractDeploymentOptions?: LSP8ContractDeploymentOptions ): Promise { const digitalAssetConfiguration = contractDeploymentOptions diff --git a/src/lib/classes/proxy-deployer.spec.ts b/src/lib/classes/proxy-deployer.spec.ts index abf21deb..196a70cb 100644 --- a/src/lib/classes/proxy-deployer.spec.ts +++ b/src/lib/classes/proxy-deployer.spec.ts @@ -1,3 +1,4 @@ +import { hexlify, randomBytes } from 'ethers/lib/utils'; import { ethers, SignerWithAddress } from 'hardhat'; import { ProxyDeployer } from './proxy-deployer'; @@ -16,24 +17,19 @@ describe('UniversalProfile', () => { baseContracts = await proxyDeployer.deployUniversalProfileBaseContracts(); }); - it('should deploy the ERC725Account proxy and setData', async () => { + it('should deploy the ERC725Account proxy and be able to set any data key/value pair', async () => { // LSPAccount const erc725AccountProxy = await proxyDeployer.deployProxyContract( baseContracts.universalProfile ); await erc725AccountProxy.initialize(await signer.getAddress()); - await erc725AccountProxy.setData( - '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', - '0xbeefbeef', - { - from: await signer.getAddress(), - } - ); - const data = await erc725AccountProxy.getData( - '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5' - ); + const randomDataKey = hexlify(randomBytes(32)); + const randomDataValueExpected = hexlify(randomBytes(4)); - expect(data).toEqual('0xbeefbeef'); + await erc725AccountProxy.setData(randomDataKey, randomDataValueExpected, { + from: await signer.getAddress(), + }); + expect(await erc725AccountProxy.getData(randomDataKey)).toEqual(randomDataValueExpected); }); }); diff --git a/src/lib/classes/universal-profile.spec.ts b/src/lib/classes/universal-profile.spec.ts index 8f1137ba..86f8d168 100644 --- a/src/lib/classes/universal-profile.spec.ts +++ b/src/lib/classes/universal-profile.spec.ts @@ -1,4 +1,6 @@ import { ERC725 } from '@erc725/erc725.js'; +import { SUPPORTED_VERIFICATION_FUNCTION_HASHES } from '@erc725/erc725.js/build/main/src/constants/constants'; +import { ALL_PERMISSIONS, ERC725YDataKeys } from '@lukso/lsp-smart-contracts'; import KeyManagerContract from '@lukso/lsp-smart-contracts/artifacts/LSP6KeyManager.json'; import UniversalProfileContract from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; @@ -18,12 +20,6 @@ import { testUPDeployment, } from '../../../test/test.utils'; import { UniversalProfile } from '../../../types/ethers-v5'; -import { - ADDRESS_PERMISSIONS_ARRAY_KEY, - DEFAULT_PERMISSIONS, - LSP3_UP_KEYS, - PREFIX_PERMISSIONS, -} from '../helpers/config.helper'; import { getDeployedByteCode } from '../helpers/deployment.helper'; import { ContractNames, DeployedUniversalProfileContracts, DeploymentEvent } from '../interfaces'; @@ -69,12 +65,12 @@ describe('UniversalProfile', () => { universalProfile = UniversalProfile__factory.connect(LSP0ERC725Account.address, signer); - const lsp3Data = await universalProfile.getDataBatch([ - '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', - ]); + const lsp3Data = await universalProfile.getData(ERC725YDataKeys.LSP3.LSP3Profile); - expect(lsp3Data[0].startsWith('0x6f357c6a')).toBe(true); - expect(lsp3Data[0]).toEqual(expectedLSP3Value); + expect( + lsp3Data.startsWith(SUPPORTED_VERIFICATION_FUNCTION_HASHES.HASH_KECCAK256_UTF8) + ).toBe(true); + expect(lsp3Data).toEqual(expectedLSP3Value); }); }); }); @@ -99,21 +95,22 @@ describe('UniversalProfile', () => { ); }); - it('controller address should have DEFAULT_PERMISSIONS set', async () => { - const [signerPermissions] = await universalProfile.getDataBatch([ - PREFIX_PERMISSIONS + uniqueController.address.substring(2), - ]); + it('controller address should have ALL_PERMISSIONS set', async () => { + const signerPermissions = await universalProfile.getData( + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + + uniqueController.address.substring(2) + ); - expect(signerPermissions).toEqual(ERC725.encodePermissions(DEFAULT_PERMISSIONS)); + expect(signerPermissions).toEqual(ALL_PERMISSIONS); }); it('controller address should be registered in AddressPermissions[0] array', async () => { const hexIndex = ethers.utils.hexlify([0]); const key = - ADDRESS_PERMISSIONS_ARRAY_KEY.slice(0, 34) + + ERC725YDataKeys.LSP6['AddressPermissions[]'].index + ethers.utils.hexZeroPad(hexIndex, 16).substring(2); - const [result] = await universalProfile.getDataBatch([key]); + const result = await universalProfile.getData(key); const checkedsumResult = ethers.utils.getAddress(result); expect(checkedsumResult).toEqual(uniqueController.address); }); @@ -135,18 +132,18 @@ describe('UniversalProfile', () => { universalProfile = UniversalProfile__factory.connect(LSP0ERC725Account.address, controller); }); - it('controller address should have DEFAULT_PERMISSIONS set', async () => { - const [signerPermissions] = await universalProfile.getDataBatch([ - PREFIX_PERMISSIONS + controller.address.substring(2), - ]); + it('controller address should have ALL_PERMISSIONS set', async () => { + const signerPermissions = await universalProfile.getData( + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + controller.address.substring(2) + ); - expect(signerPermissions).toEqual(ERC725.encodePermissions(DEFAULT_PERMISSIONS)); + expect(signerPermissions).toEqual(ALL_PERMISSIONS); }); - it('signer address should have no permissions set', async () => { - const [signerPermissions] = await universalProfile.getDataBatch([ - PREFIX_PERMISSIONS + signers[0].address.substring(2), - ]); + it('random signer address should have no permissions set', async () => { + const signerPermissions = await universalProfile.getData( + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + signers[0].address.substring(2) + ); expect(signerPermissions).toEqual(ERC725.encodePermissions({})); }); @@ -172,9 +169,9 @@ describe('UniversalProfile', () => { }); it('controller address should have custom permissions set', async () => { - const [signerPermissions] = await universalProfile.getDataBatch([ - PREFIX_PERMISSIONS + controller.address.substring(2), - ]); + const signerPermissions = await universalProfile.getData( + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + controller.address.substring(2) + ); expect(signerPermissions).toEqual(customPermissions); }); @@ -185,6 +182,7 @@ describe('UniversalProfile', () => { let keyManager; let firstControllerAddress: string; let secondControllerAddress: string; + const customPermissions = ERC725.encodePermissions({ DELEGATECALL: true, CALL: true, @@ -214,29 +212,32 @@ describe('UniversalProfile', () => { keyManager = new ethers.Contract(LSP6KeyManager.address, KeyManagerContract.abi, provider); }); - it('1st address should have DEFAULT_PERMISSIONS set', async () => { - const [signerPermissions] = await universalProfile - .connect(signers[0]) - .callStatic.getDataBatch([PREFIX_PERMISSIONS + firstControllerAddress.substring(2)]); + it('1st address should have ALL_PERMISSIONS set', async () => { + const signerPermissions = await universalProfile.getData( + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + firstControllerAddress.substring(2) + ); - expect(signerPermissions).toEqual(ERC725.encodePermissions(DEFAULT_PERMISSIONS)); + expect(signerPermissions).toEqual(ALL_PERMISSIONS); }); it('1st address should be registered in AddressPermissions[0] array', async () => { const hexIndex = ethers.utils.hexlify([0]); const key = - ADDRESS_PERMISSIONS_ARRAY_KEY.slice(0, 34) + + ERC725YDataKeys.LSP6['AddressPermissions[]'].index + ethers.utils.hexZeroPad(hexIndex, 16).substring(2); - const [result] = await universalProfile.connect(signers[0]).callStatic.getDataBatch([key]); + const result = await universalProfile.getData(key); const checkedsumResult = ethers.utils.getAddress(result); expect(checkedsumResult).toEqual(firstControllerAddress); }); - it('2nd address should have DEFAULT_PERMISSIONS set', async () => { - const [signerPermissions] = await universalProfile + it('2nd address should have ALL_PERMISSIONS set', async () => { + const signerPermissions = await universalProfile .connect(signers[1]) - .callStatic.getDataBatch([PREFIX_PERMISSIONS + secondControllerAddress.substring(2)]); + .getData( + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + + secondControllerAddress.substring(2) + ); expect(signerPermissions).toEqual(customPermissions); }); @@ -244,10 +245,10 @@ describe('UniversalProfile', () => { it('2nd address should be registered in AddressPermissions[1] array', async () => { const hexIndex = ethers.utils.hexlify([1]); const key = - ADDRESS_PERMISSIONS_ARRAY_KEY.slice(0, 34) + + ERC725YDataKeys.LSP6['AddressPermissions[]'].index + ethers.utils.hexZeroPad(hexIndex, 16).substring(2); - const [result] = await universalProfile.connect(signers[0]).callStatic.getDataBatch([key]); + const result = await universalProfile.getData(key); const checkedsumResult = ethers.utils.getAddress(result); expect(checkedsumResult).toEqual(secondControllerAddress); }); @@ -325,6 +326,7 @@ describe('UniversalProfile', () => { describe('Deployment with only ERC725 baseContract set to true', () => { let deployedContracts: DeployedUniversalProfileContracts; + it('Should deploy only ERC725 Base contract', async () => { deployedContracts = await testUPDeployment( { @@ -337,6 +339,7 @@ describe('UniversalProfile', () => { [signers[0].address] ); }); + it('UP contract bytecode should contain base contract address', async () => { if (!deployedContracts.LSP0ERC725Account) fail(); if (!deployedContracts.LSP0ERC725AccountBaseContract) fail(); @@ -619,11 +622,11 @@ describe('UniversalProfile', () => { signers[0] ); - const data = await universalProfile.getDataBatch([ - LSP3_UP_KEYS.UNIVERSAL_RECEIVER_DELEGATE_KEY, - ]); + const universalReceiverDelegateAddress = await universalProfile.getData( + ERC725YDataKeys.LSP1.LSP1UniversalReceiverDelegate + ); - const checkedsumResult = ethers.utils.getAddress(data[0]); + const checkedsumResult = ethers.utils.getAddress(universalReceiverDelegateAddress); expect(checkedsumResult).toEqual(baseContracts.universalReceiverDelegate.address); }); @@ -649,11 +652,11 @@ describe('UniversalProfile', () => { signers[0] ); - const univeralReceiverDelegate = await universalProfile.getDataBatch([ - LSP3_UP_KEYS.UNIVERSAL_RECEIVER_DELEGATE_KEY, - ]); + const universalReceiverDelegateAddress = await universalProfile.getData( + ERC725YDataKeys.LSP1.LSP1UniversalReceiverDelegate + ); - const checkedsumResult = ethers.utils.getAddress(univeralReceiverDelegate[0]); + const checkedsumResult = ethers.utils.getAddress(universalReceiverDelegateAddress); expect(checkedsumResult).toEqual(deployedContracts.LSP1UniversalReceiverDelegate.address); }); diff --git a/src/lib/helpers/config.helper.spec.ts b/src/lib/helpers/config.helper.spec.ts deleted file mode 100644 index ea1f9d3a..00000000 --- a/src/lib/helpers/config.helper.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { LSP3_UP_KEYS, LSP4_KEYS } from './config.helper'; - -describe('Config Helpper', () => { - it('should use the correct keys', () => { - expect(LSP3_UP_KEYS.LSP3_PROFILE).toEqual( - '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5' - ); - expect(LSP3_UP_KEYS.UNIVERSAL_RECEIVER_DELEGATE_KEY).toEqual( - '0x0cfc51aec37c55a4d0b1a65c6255c4bf2fbdf6277f3cc0730c45b828b6db8b47' - ); - expect(LSP4_KEYS.LSP4_CREATORS_ARRAY).toEqual( - '0x114bd03b3a46d48759680d81ebb2b414fda7d030a7105a851867accf1c2352e7' - ); - expect(LSP4_KEYS.LSP4_METADATA).toEqual( - '0x9afb95cacc9f95858ec44aa8c3b685511002e30ae54415823f406128b85b238e' - ); - }); -}); diff --git a/src/lib/helpers/config.helper.ts b/src/lib/helpers/config.helper.ts index 55f852dd..8eb90b54 100644 --- a/src/lib/helpers/config.helper.ts +++ b/src/lib/helpers/config.helper.ts @@ -1,6 +1,3 @@ -import { Permissions } from '@erc725/erc725.js/build/main/src/types/Method'; -import { keccak256 } from '@ethersproject/keccak256'; -import { toUtf8Bytes } from '@ethersproject/strings'; import { version as lspSmartContractsVersion } from '@lukso/lsp-smart-contracts/package.json'; import { Options } from 'ipfs-http-client'; @@ -16,50 +13,6 @@ export const defaultUploadOptions: UploadOptions = { ipfsGateway: defaultIpfsGateway, }; -export const LSP3_UP_KEYS = { - UNIVERSAL_RECEIVER_DELEGATE_KEY: keccak256(toUtf8Bytes('LSP1UniversalReceiverDelegate')), - LSP3_PROFILE: keccak256(toUtf8Bytes('LSP3Profile')), -}; - -export const LSP4_KEYS = { - LSP4_METADATA: keccak256(toUtf8Bytes('LSP4Metadata')), - LSP4_CREATORS_ARRAY: keccak256(toUtf8Bytes('LSP4Creators[]')), - LSP4_CREATORS_MAP_PREFIX: '0x6de85eaf5d982b4e5da00000', -}; - -export const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'; - -export const ADDRESS_PERMISSIONS_ARRAY_KEY = - '0xdf30dba06db6a30e65354d9a64c609861f089545ca58c6b4dbe31a5f338cb0e3'; - -export const PREFIX_PERMISSIONS = '0x4b80742de2bf82acb3630000'; - -// exclude DELEGATECALL for safety -export const DEFAULT_PERMISSIONS: Permissions = { - CHANGEOWNER: true, - EDITPERMISSIONS: true, - ADDCONTROLLER: true, - SETDATA: true, - CALL: true, - STATICCALL: true, - DELEGATECALL: false, - DEPLOY: true, - TRANSFERVALUE: true, - SIGN: true, - SUPER_CALL: true, - SUPER_DELEGATECALL: false, - SUPER_SETDATA: true, - SUPER_STATICCALL: true, - SUPER_TRANSFERVALUE: true, - ENCRYPT: true, - ADDEXTENSIONS: true, - ADDUNIVERSALRECEIVERDELEGATE: true, - CHANGEEXTENSIONS: true, - CHANGEUNIVERSALRECEIVERDELEGATE: true, - DECRYPT: true, - REENTRANCY: true, -}; - export const DEFAULT_CONTRACT_VERSION = lspSmartContractsVersion; export const GAS_PRICE = 10_000_000_000; diff --git a/src/lib/helpers/erc725.helper.ts b/src/lib/helpers/erc725.helper.ts index 3a9e87d0..36b13036 100644 --- a/src/lib/helpers/erc725.helper.ts +++ b/src/lib/helpers/erc725.helper.ts @@ -1,4 +1,5 @@ import { ERC725, ERC725JSONSchema } from '@erc725/erc725.js'; +import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts'; import { providers } from 'ethers'; import { LSP3ProfileDataForEncoding } from '../interfaces/lsp3-profile'; @@ -7,14 +8,14 @@ import { LSP4MetadataForEncoding } from '../interfaces/lsp4-digital-asset'; export const schema: ERC725JSONSchema[] = [ { name: 'LSP3Profile', - key: '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5', + key: ERC725YDataKeys.LSP3.LSP3Profile, keyType: 'Singleton', - valueContent: 'JSONURL', valueType: 'bytes', + valueContent: 'JSONURL', }, { name: 'LSP4Metadata', - key: '0x9afb95cacc9f95858ec44aa8c3b685511002e30ae54415823f406128b85b238e', + key: ERC725YDataKeys.LSP4.LSP4Metadata, keyType: 'Singleton', valueType: 'bytes', valueContent: 'JSONURL', diff --git a/src/lib/interfaces/digital-asset-deployment.ts b/src/lib/interfaces/digital-asset-deployment.ts index 1de31008..d41c6b25 100644 --- a/src/lib/interfaces/digital-asset-deployment.ts +++ b/src/lib/interfaces/digital-asset-deployment.ts @@ -28,6 +28,11 @@ export interface LSP7DigitalAssetDeploymentOptions extends DigitalAssetDeploymen isNFT: boolean; } +export interface LSP8IdentifiableDigitalAssetDeploymentOptions + extends DigitalAssetDeploymentOptions { + tokenIdType: number | string; +} + export interface DeployedLSP8IdentifiableDigitalAsset { LSP8IdentifiableDigitalAsset: DeployedContract; } diff --git a/src/lib/services/base-contract.service.ts b/src/lib/services/base-contract.service.ts index c824bfaf..5140656a 100644 --- a/src/lib/services/base-contract.service.ts +++ b/src/lib/services/base-contract.service.ts @@ -1,5 +1,5 @@ import { Signer } from '@ethersproject/abstract-signer'; -import { providers } from 'ethers'; +import { constants as ethersConstants, providers } from 'ethers'; import { defer, EMPTY, forkJoin, from, merge, Observable, of } from 'rxjs'; import { defaultIfEmpty, last, shareReplay, switchMap, tap } from 'rxjs/operators'; @@ -15,7 +15,7 @@ import { UniversalProfileInit__factory, } from '../..'; import contractVersions from '../../versions.json'; -import { GAS_PRICE, NULL_ADDRESS } from '../helpers/config.helper'; +import { GAS_PRICE } from '../helpers/config.helper'; import { deployBaseContract, getDeployedByteCode, @@ -23,6 +23,8 @@ import { } from '../helpers/deployment.helper'; import { ContractNames as DigitalAssetContractNames } from '../interfaces/digital-asset-deployment'; +const { AddressZero } = ethersConstants; + export function universalProfileBaseContractsDeployment$( signer: Signer, baseContractsToDeploy$: Observable<[boolean, boolean, boolean]> @@ -124,7 +126,7 @@ export function shouldDeployBaseContract$( providedByteCode?: string ) { const defaultBaseContractBytecode$ = from( - getDeployedByteCode(defaultBaseContractAddress ?? NULL_ADDRESS, provider) + getDeployedByteCode(defaultBaseContractAddress ?? AddressZero, provider) ); const deployProxy = diff --git a/src/lib/services/digital-asset.service.ts b/src/lib/services/digital-asset.service.ts index 87b5c80e..a479dff8 100644 --- a/src/lib/services/digital-asset.service.ts +++ b/src/lib/services/digital-asset.service.ts @@ -1,5 +1,5 @@ import { Signer } from '@ethersproject/abstract-signer'; -import { INTERFACE_IDS } from '@lukso/lsp-smart-contracts'; +import { ERC725YDataKeys, INTERFACE_IDS } from '@lukso/lsp-smart-contracts'; import axios from 'axios'; import { ContractFactory, ethers } from 'ethers'; import { @@ -23,7 +23,7 @@ import { LSP8MintableInit__factory, } from '../../'; import { LSP4DigitalAssetMetadata } from '../classes/lsp4-digital-asset-metadata'; -import { GAS_BUFFER, GAS_PRICE, LSP4_KEYS } from '../helpers/config.helper'; +import { GAS_BUFFER, GAS_PRICE } from '../helpers/config.helper'; import { convertContractDeploymentOptionsVersion, deployContract, @@ -47,6 +47,7 @@ import { DigitalAssetContractDeploymentOptions, DigitalAssetDeploymentOptions, LSP7DigitalAssetDeploymentOptions, + LSP8IdentifiableDigitalAssetDeploymentOptions, } from '../interfaces/digital-asset-deployment'; import { LSP4DigitalAssetJSON, @@ -167,23 +168,17 @@ function initializeLSP7Proxy( const controllerAddress = await signer.getAddress(); - const gasEstimate = await contract.estimateGas[`initialize(string,string,address,bool)`]( + const gasEstimate = await contract.estimateGas.initialize( name, symbol, controllerAddress, isNFT ); - const transaction = await contract[`initialize(string,string,address,bool)`]( - name, - symbol, - controllerAddress, - isNFT, - { - gasLimit: gasEstimate.add(GAS_BUFFER), - gasPrice: GAS_PRICE, - } - ); + const transaction = await contract.initialize(name, symbol, controllerAddress, isNFT, { + gasLimit: gasEstimate.add(GAS_BUFFER), + gasPrice: GAS_PRICE, + }); return { type: DeploymentType.TRANSACTION, @@ -203,7 +198,7 @@ function initializeLSP7Proxy( export function lsp8IdentifiableDigitalAssetDeployment$( signer: Signer, - digitalAssetDeploymentOptions: DigitalAssetDeploymentOptions, + digitalAssetDeploymentOptions: LSP8IdentifiableDigitalAssetDeploymentOptions, baseContractAddress$: Observable, byteCode?: string ) { @@ -222,7 +217,7 @@ export function lsp8IdentifiableDigitalAssetDeployment$( export function lsp8IdentifiableDigitalAssetDeploymentWithBaseContractAddress$( signer: Signer, - digitalAssetDeploymentOptions: DigitalAssetDeploymentOptions, + digitalAssetDeploymentOptions: LSP8IdentifiableDigitalAssetDeploymentOptions, baseContractAddress: string, byteCode?: string ) { @@ -254,7 +249,7 @@ export function lsp8IdentifiableDigitalAssetDeploymentWithBaseContractAddress$( async function deployLSP8IdentifiableDigitalAsset( signer: Signer, - digitalAssetDeploymentOptions: DigitalAssetDeploymentOptions, + digitalAssetDeploymentOptions: LSP8IdentifiableDigitalAssetDeploymentOptions, baseContractAddress: string, byteCode?: string ) { @@ -269,14 +264,16 @@ async function deployLSP8IdentifiableDigitalAsset( return new ContractFactory(LSP8Mintable__factory.abi, byteCode, signer).deploy( digitalAssetDeploymentOptions.name, digitalAssetDeploymentOptions.symbol, - controllerAddress + controllerAddress, + digitalAssetDeploymentOptions.tokenIdType ); } return new LSP8Mintable__factory(signer).deploy( digitalAssetDeploymentOptions.name, digitalAssetDeploymentOptions.symbol, - controllerAddress + controllerAddress, + digitalAssetDeploymentOptions.tokenIdType ); }; @@ -293,9 +290,9 @@ async function deployLSP8IdentifiableDigitalAsset( function initializeLSP8Proxy( signer: Signer, digitalAssetDeploymentReceipt$: Observable, - digitalAssetDeploymentOptions: DigitalAssetDeploymentOptions + digitalAssetDeploymentOptions: LSP8IdentifiableDigitalAssetDeploymentOptions ) { - const { name, symbol } = digitalAssetDeploymentOptions; + const { name, symbol, tokenIdType } = digitalAssetDeploymentOptions; const initialize$ = digitalAssetDeploymentReceipt$.pipe( takeLast(1), @@ -306,25 +303,22 @@ function initializeLSP8Proxy( const controllerAddress = await signer.getAddress(); - const gasEstimate = await contract.estimateGas[`initialize(string,string,address)`]( - name, - symbol, - controllerAddress - ); - - const transaction = await contract[`initialize(string,string,address)`]( + const gasEstimate = await contract.estimateGas.initialize( name, symbol, controllerAddress, - { - gasLimit: gasEstimate.add(GAS_BUFFER), - gasPrice: GAS_PRICE, - } + tokenIdType ); + + const transaction = await contract.initialize(name, symbol, controllerAddress, tokenIdType, { + gasLimit: gasEstimate.add(GAS_BUFFER), + gasPrice: GAS_PRICE, + }); + return { type: DeploymentType.TRANSACTION, contractName: result.contractName, - functionName: 'initialize(string,string,address)', + functionName: 'initialize(string,string,address,uint256)', status: DeploymentStatus.PENDING, transaction, }; @@ -590,7 +584,7 @@ async function prepareSetDataTransaction( for (let i = 0; i < creators.length; i++) { creatorArrayIndexKeys.push( - LSP4_KEYS.LSP4_CREATORS_ARRAY.slice(0, 34) + + ERC725YDataKeys.LSP4['LSP4Creators[]'].index + ethers.utils.hexZeroPad(ethers.utils.hexlify([i]), 16).substring(2) ); @@ -599,7 +593,7 @@ async function prepareSetDataTransaction( const isUniversalProfile = await addressIsUniversalProfile(creators[i], signer); const creatorInterface = isUniversalProfile ? INTERFACE_IDS.LSP0ERC725Account : '0xffffffff'; - creatorsMapKeys.push(LSP4_KEYS.LSP4_CREATORS_MAP_PREFIX + creators[i].slice(2)); + creatorsMapKeys.push(ERC725YDataKeys.LSP4.LSP4CreatorsMap + creators[i].slice(2)); creatorsMapValues.push( creatorInterface.slice(0, 10) + ethers.utils.hexZeroPad(ethers.utils.hexlify([i]), 8).slice(2) ); @@ -608,17 +602,17 @@ async function prepareSetDataTransaction( const valuesToSet: string[] = []; if (creators.length) { - keysToSet.push(LSP4_KEYS.LSP4_CREATORS_ARRAY); + keysToSet.push(ERC725YDataKeys.LSP4['LSP4Creators[]'].length); keysToSet.push(...creatorArrayIndexKeys); keysToSet.push(...creatorsMapKeys); - valuesToSet.push(ethers.utils.hexZeroPad(ethers.utils.hexlify([creators.length]), 32)); + valuesToSet.push(ethers.utils.hexZeroPad(ethers.utils.hexlify(creators.length), 16)); valuesToSet.push(...creatorArrayIndexValues); valuesToSet.push(...creatorsMapValues); } if (lsp4Metadata) { - keysToSet.push(LSP4_KEYS.LSP4_METADATA); + keysToSet.push(ERC725YDataKeys.LSP4.LSP4Metadata); valuesToSet.push(lsp4Metadata); } diff --git a/src/lib/services/universal-profile.service.spec.ts b/src/lib/services/universal-profile.service.spec.ts index 1dd06f33..7cdebdc0 100644 --- a/src/lib/services/universal-profile.service.spec.ts +++ b/src/lib/services/universal-profile.service.spec.ts @@ -1,13 +1,9 @@ import ERC725 from '@erc725/erc725.js'; +import { ALL_PERMISSIONS, ERC725YDataKeys } from '@lukso/lsp-smart-contracts'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import { ethers } from 'hardhat'; import { deployUniversalProfileContracts } from '../../../test/test.utils'; -import { - ADDRESS_PERMISSIONS_ARRAY_KEY, - DEFAULT_PERMISSIONS, - PREFIX_PERMISSIONS, -} from '../helpers/config.helper'; import { prepareSetDataParameters } from './universal-profile.service'; @@ -21,7 +17,6 @@ describe('LSP3Account Service', () => { }); describe('prepareSetDataParameters', () => { - let abiCoder; let universalProfile, universalReceiverDelegate; beforeAll(async () => { @@ -44,12 +39,14 @@ describe('LSP3Account Service', () => { expect(universalProfile.address).toEqual(erc725AccountAddress); // AddressPermissions[] array length should be 1 - const totalPermissionsSet = valuesToSet[keysToSet.indexOf(ADDRESS_PERMISSIONS_ARRAY_KEY)]; - const expectedLength = abiCoder.encode(['uint256'], [2]); + const totalPermissionsSet = + valuesToSet[keysToSet.indexOf(ERC725YDataKeys.LSP6['AddressPermissions[]'].length)]; + const expectedLength = ethers.utils.hexZeroPad(2, 16); expect(totalPermissionsSet).toEqual(expectedLength); // controller address should have default permissions set - const controllerPermissionsKey = PREFIX_PERMISSIONS + signers[0].address.substring(2); + const controllerPermissionsKey = + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + signers[0].address.substring(2); const controllerPermissionsValue = valuesToSet[keysToSet.indexOf(controllerPermissionsKey)]; const expectedPermissions = ERC725.encodePermissions({ CHANGEOWNER: true, @@ -61,7 +58,7 @@ describe('LSP3Account Service', () => { const hexIndex = ethers.utils.hexlify([0]); const addressPermissionArrayIndexKey = - ADDRESS_PERMISSIONS_ARRAY_KEY.slice(0, 34) + + ERC725YDataKeys.LSP6['AddressPermissions[]'].index + ethers.utils.hexZeroPad(hexIndex, 16).substring(2); const result = valuesToSet[keysToSet.indexOf(addressPermissionArrayIndexKey)]; @@ -80,15 +77,17 @@ describe('LSP3Account Service', () => { ); // AddressPermissions[] array length should be 2 - const totalPermissionsSet = valuesToSet[keysToSet.indexOf(ADDRESS_PERMISSIONS_ARRAY_KEY)]; - const expectedLength = abiCoder.encode(['uint256'], [controllerAddresses.length + 1]); + const totalPermissionsSet = + valuesToSet[keysToSet.indexOf(ERC725YDataKeys.LSP6['AddressPermissions[]'].length)]; + const expectedLength = ethers.utils.hexZeroPad(controllerAddresses.length + 1, 16); expect(totalPermissionsSet).toEqual(expectedLength); for (let index = 0; index < controllerAddresses.length; index++) { const controllerAddress = controllerAddresses[index]; // controller address should have default permissions set - const controllerPermissionsKey = PREFIX_PERMISSIONS + controllerAddress.substring(2); + const controllerPermissionsKey = + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + controllerAddress.substring(2); const controllerPermissionsValue = valuesToSet[keysToSet.indexOf(controllerPermissionsKey)]; const expectedPermissions = ERC725.encodePermissions({ @@ -99,7 +98,7 @@ describe('LSP3Account Service', () => { // controller address in the array at AddressPermissions[index] const hexIndex = ethers.utils.hexlify([index]); - const leftSideKey = ADDRESS_PERMISSIONS_ARRAY_KEY.slice(0, 34); + const leftSideKey = ERC725YDataKeys.LSP6['AddressPermissions[]'].index; const rightSideKey = ethers.utils.hexZeroPad(hexIndex, 16); const addressPermissionArrayIndexKey = leftSideKey + rightSideKey.substring(2); @@ -119,15 +118,17 @@ describe('LSP3Account Service', () => { ); // AddressPermissions[] array length should be 11 (including Universal Receiver Delegate address) - const totalPermissionsSet = valuesToSet[keysToSet.indexOf(ADDRESS_PERMISSIONS_ARRAY_KEY)]; - const expectedLength = abiCoder.encode(['uint256'], [controllerAddresses.length + 1]); + const totalPermissionsSet = + valuesToSet[keysToSet.indexOf(ERC725YDataKeys.LSP6['AddressPermissions[]'].length)]; + const expectedLength = ethers.utils.hexZeroPad(controllerAddresses.length + 1, 16); expect(totalPermissionsSet).toEqual(expectedLength); for (let index = 0; index < controllerAddresses.length; index++) { const controllerAddress = controllerAddresses[index]; // controller address should have default permissions set - const controllerPermissionsKey = PREFIX_PERMISSIONS + controllerAddress.substring(2); + const controllerPermissionsKey = + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + controllerAddress.substring(2); const controllerPermissionsValue = valuesToSet[keysToSet.indexOf(controllerPermissionsKey)]; const expectedPermissions = @@ -136,13 +137,13 @@ describe('LSP3Account Service', () => { CHANGEOWNER: true, EDITPERMISSIONS: true, }) - : ERC725.encodePermissions(DEFAULT_PERMISSIONS); + : ALL_PERMISSIONS; expect(controllerPermissionsValue).toEqual(expectedPermissions); // controller address in the array at AddressPermissions[index] const hexIndex = ethers.utils.hexlify([index]); - const leftSideKey = ADDRESS_PERMISSIONS_ARRAY_KEY.slice(0, 34); + const leftSideKey = ERC725YDataKeys.LSP6['AddressPermissions[]'].index; const rightSideKey = ethers.utils.hexZeroPad(hexIndex, 16); const addressPermissionArrayIndexKey = leftSideKey + rightSideKey.substring(2); diff --git a/src/lib/services/universal-profile.service.ts b/src/lib/services/universal-profile.service.ts index 493c5e46..6160084f 100644 --- a/src/lib/services/universal-profile.service.ts +++ b/src/lib/services/universal-profile.service.ts @@ -1,5 +1,5 @@ import { ERC725 } from '@erc725/erc725.js'; -import { INTERFACE_IDS } from '@lukso/lsp-smart-contracts'; +import { ALL_PERMISSIONS, ERC725YDataKeys, INTERFACE_IDS } from '@lukso/lsp-smart-contracts'; import axios from 'axios'; import { BytesLike, Contract, ContractFactory, ethers, Signer } from 'ethers'; import { concat, defer, EMPTY, forkJoin, from, Observable, of } from 'rxjs'; @@ -11,14 +11,7 @@ import { UniversalProfile__factory, UniversalProfileInit__factory, } from '../..'; -import { - ADDRESS_PERMISSIONS_ARRAY_KEY, - DEFAULT_PERMISSIONS, - GAS_BUFFER, - GAS_PRICE, - LSP3_UP_KEYS, - PREFIX_PERMISSIONS, -} from '../helpers/config.helper'; +import { GAS_BUFFER, GAS_PRICE } from '../helpers/config.helper'; import { convertContractDeploymentOptionsVersion, deployContract, @@ -407,7 +400,7 @@ export async function prepareSetDataParameters( controllers.map((controller, index) => { if (typeof controller === 'string') { controllerAddresses[index] = controller; - controllerPermissions[index] = ERC725.encodePermissions(DEFAULT_PERMISSIONS); + controllerPermissions[index] = ALL_PERMISSIONS; } else { controllerAddresses[index] = controller.address; controllerPermissions[index] = controller.permissions; @@ -416,7 +409,7 @@ export async function prepareSetDataParameters( // see: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#addresspermissionspermissionsaddress const addressPermissionsKeys = controllerAddresses.map( - (address) => PREFIX_PERMISSIONS + address.substring(2) + (address) => ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + address.substring(2) ); // see: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#addresspermissions @@ -424,7 +417,7 @@ export async function prepareSetDataParameters( const hexIndex = ethers.utils.hexlify([index]); return ( - ADDRESS_PERMISSIONS_ARRAY_KEY.slice(0, 34) + + ERC725YDataKeys.LSP6['AddressPermissions[]'].index + ethers.utils.hexZeroPad(hexIndex, 16).substring(2) ); }); @@ -432,12 +425,14 @@ export async function prepareSetDataParameters( const hexIndex = ethers.utils.hexlify([controllerAddresses.length]); const universalReceiverPermissionIndex = - ADDRESS_PERMISSIONS_ARRAY_KEY.slice(0, 34) + ethers.utils.hexZeroPad(hexIndex, 16).substring(2); + ERC725YDataKeys.LSP6['AddressPermissions[]'].index + + ethers.utils.hexZeroPad(hexIndex, 16).substring(2); const keysToSet = [ - LSP3_UP_KEYS.UNIVERSAL_RECEIVER_DELEGATE_KEY, - PREFIX_PERMISSIONS + universalReceiverDelegateAddress.substring(2), - ADDRESS_PERMISSIONS_ARRAY_KEY, + ERC725YDataKeys.LSP1.LSP1UniversalReceiverDelegate, + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + + universalReceiverDelegateAddress.substring(2), + ERC725YDataKeys.LSP6['AddressPermissions[]'].length, ...addressPermissionsArrayElements, // AddressPermission[index] = controllerAddress ...addressPermissionsKeys, // AddressPermissions:Permissions:
= controllerPermission, universalReceiverPermissionIndex, @@ -446,7 +441,7 @@ export async function prepareSetDataParameters( const valuesToSet = [ universalReceiverDelegateAddress, ERC725.encodePermissions({ SUPER_SETDATA: true, REENTRANCY: true }), - ethers.utils.defaultAbiCoder.encode(['uint256'], [controllerPermissions.length + 1]), + ethers.utils.hexZeroPad(ethers.utils.hexlify(controllerAddresses.length + 1), 16), ...controllerAddresses, ...controllerPermissions, universalReceiverDelegateAddress, @@ -456,15 +451,20 @@ export async function prepareSetDataParameters( const signerAddress = await signer.getAddress(); if (!controllerAddresses.includes(signerAddress)) { - keysToSet.push(PREFIX_PERMISSIONS + signerAddress.substring(2)); + keysToSet.push( + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + signerAddress.substring(2) + ); valuesToSet.push(ERC725.encodePermissions({ CHANGEOWNER: true, EDITPERMISSIONS: true })); } else { - valuesToSet[keysToSet.indexOf(PREFIX_PERMISSIONS + signerAddress.substring(2))] = - ERC725.encodePermissions({ CHANGEOWNER: true, EDITPERMISSIONS: true }); + valuesToSet[ + keysToSet.indexOf( + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + signerAddress.substring(2) + ) + ] = ERC725.encodePermissions({ CHANGEOWNER: true, EDITPERMISSIONS: true }); } if (encodedLSP3Profile) { - keysToSet.push(LSP3_UP_KEYS.LSP3_PROFILE); + keysToSet.push(ERC725YDataKeys.LSP3.LSP3Profile); valuesToSet.push(encodedLSP3Profile); } @@ -580,15 +580,13 @@ export async function revokeSignerPermissions( if (controllerAddress.includes(signerAddress)) { const controller = controllers[controllerAddress.indexOf(signerAddress)]; signerPermission = - typeof controller === 'string' - ? ERC725.encodePermissions(DEFAULT_PERMISSIONS) - : controller.permissions ?? ERC725.encodePermissions(DEFAULT_PERMISSIONS); + typeof controller === 'string' ? ALL_PERMISSIONS : controller.permissions ?? ALL_PERMISSIONS; } else { signerPermission = ERC725.encodePermissions({}); } const revokeSignerPermissionsPayload = erc725Account.interface.encodeFunctionData('setData', [ - PREFIX_PERMISSIONS + signerAddress.substring(2), + ERC725YDataKeys.LSP6['AddressPermissions:Permissions'] + signerAddress.substring(2), signerPermission, ]); diff --git a/src/lib/services/universal-receiver.service.ts b/src/lib/services/universal-receiver.service.ts index 027bac86..eff94fa7 100644 --- a/src/lib/services/universal-receiver.service.ts +++ b/src/lib/services/universal-receiver.service.ts @@ -1,4 +1,4 @@ -import { ContractFactory, providers, Signer } from 'ethers'; +import { ContractFactory, constants as ethersConstants, providers, Signer } from 'ethers'; import { concat, EMPTY, forkJoin, from, Observable } from 'rxjs'; import { shareReplay, switchMap } from 'rxjs/operators'; @@ -7,7 +7,6 @@ import { DeploymentEventProxyContract, LSP1UniversalReceiverDelegateUP__factory, } from '../..'; -import { NULL_ADDRESS } from '../helpers/config.helper'; import { deployContract, deployProxyContract, @@ -16,6 +15,8 @@ import { } from '../helpers/deployment.helper'; import { BaseContractAddresses, ContractNames } from '../interfaces'; +const { AddressZero } = ethersConstants; + export type UniversalReceiverDeploymentEvent = | DeploymentEventContract | DeploymentEventProxyContract; @@ -29,7 +30,7 @@ export function universalReceiverDelegateDeployment$( byteCode?: string ) { const defaultURDBytecode$ = from( - getDeployedByteCode(defaultUniversalReceiverAddress ?? NULL_ADDRESS, provider) + getDeployedByteCode(defaultUniversalReceiverAddress ?? AddressZero, provider) ); return forkJoin([defaultURDBytecode$, baseContractAddresses$]).pipe( diff --git a/src/versions.json b/src/versions.json index a27b71f7..5643ce58 100644 --- a/src/versions.json +++ b/src/versions.json @@ -7,35 +7,45 @@ "ERC725Account": { "versions": { "0.10.3": "0x40114F4f71C3551f79CBfdaa63F41741fA7eC86D", - "0.11.1": "0xc1716883d30069f26743acc63722de2a52a258b4" + "0.11.1": "0xc1716883d30069f26743acc63722de2a52a258b4", + "0.12.0-rc.0": "0x6ce5A2a09a12e1782BF7E0183f727f7d02508ED3", + "0.12.0": "0xF95ae7ABD05D5aB39fBf8Cc128c1b5C6C8171e7f" }, "baseContract": true }, "KeyManager": { "versions": { "0.10.3": "0xDDF7D4650007Bb117c9e3ec29C7263e7D8344211", - "0.11.1": "0x8ed15cca37cff8d3bf80d0fb96cfba5608b8610a" + "0.11.1": "0x8ed15cca37cff8d3bf80d0fb96cfba5608b8610a", + "0.12.0-rc.0": "0xC386092DC6727C2A440F53F9A05Ace85FC5F64D4", + "0.12.0": "0xb228510D275b86ffF65829dD5be51bAD96b536D0" }, "baseContract": true }, "UniversalReceiverDelegate": { "versions": { "0.10.3": "0x3a181401d642ff76eacc13db4fecf4761de135d2", - "0.11.1": "0x9b1eF52DdEc3b8414FbE359ed7826334729ab97E" + "0.11.1": "0x9b1eF52DdEc3b8414FbE359ed7826334729ab97E", + "0.12.0-rc.0": "0xA20454137b47440C71fE4DD203D25D69F0b34535", + "0.12.0": "0x4555ed733f58Da8Cc6A2Fd6A050874192Ac97985" }, "baseContract": false }, "LSP7Mintable": { "versions": { "0.10.3": "0xaf45071fcf03564108f0cf82ba34932fe257565e", - "0.11.1": "0xd684F8642268484e22E64d86fDc8F6D8D9e930d5" + "0.11.1": "0xd684F8642268484e22E64d86fDc8F6D8D9e930d5", + "0.12.0-rc.0": "0x5Db67F2dCa10ac8DF1c7FB6EA7ed4DCdBCEdb853", + "0.12.0": "0x75d56CE25DdFa3760f7cC216B939519Bc9Da079B" }, "baseContract": true }, "LSP8Mintable": { "versions": { "0.10.3": "0xB8e8a2Db3Dcbc8384B62F28165998BB78Db209F3", - "0.11.1": "0x5453551C4256F0ccE92DF7D3dcaeCd90E80b0a2f" + "0.11.1": "0x5453551C4256F0ccE92DF7D3dcaeCd90E80b0a2f", + "0.12.0-rc.0": "0xB7d1d9d8C388D1F5A77A204823A0fb22aeaC22e3", + "0.12.0": "0x1B7799CB9bEDF8CcB6e8C3F992F35d35c9AC9823" }, "baseContract": true } diff --git a/test/digital-asset.utils.ts b/test/digital-asset.utils.ts index 0b9096dc..dc094366 100644 --- a/test/digital-asset.utils.ts +++ b/test/digital-asset.utils.ts @@ -1,24 +1,23 @@ import { ethers } from 'ethers'; import { LSP7Mintable, LSP8Mintable } from '../build/main/src'; -import { LSP4_KEYS } from '../src/lib/helpers/config.helper'; -import { INTERFACE_IDS } from '@lukso/lsp-smart-contracts'; +import { ERC725YDataKeys, INTERFACE_IDS } from '@lukso/lsp-smart-contracts'; export async function testDeployWithSpecifiedCreators( digitalAsset: LSP7Mintable | LSP8Mintable, creators: string[] ) { - const [creatorArrayLength] = await digitalAsset.getDataBatch([LSP4_KEYS.LSP4_CREATORS_ARRAY]); - - expect(creatorArrayLength).toEqual( - '0x0000000000000000000000000000000000000000000000000000000000000003' + const creatorArrayLength = await digitalAsset.getData( + ERC725YDataKeys.LSP4['LSP4Creators[]'].length ); + expect(creatorArrayLength).toEqual('0x00000000000000000000000000000003'); + const [creator1, creator2, creator3] = await digitalAsset.getDataBatch([ - LSP4_KEYS.LSP4_CREATORS_ARRAY.slice(0, 34) + + ERC725YDataKeys.LSP4['LSP4Creators[]'].index + ethers.utils.hexZeroPad(ethers.utils.hexlify([0]), 16).substring(2), - LSP4_KEYS.LSP4_CREATORS_ARRAY.slice(0, 34) + + ERC725YDataKeys.LSP4['LSP4Creators[]'].index + ethers.utils.hexZeroPad(ethers.utils.hexlify([1]), 16).substring(2), - LSP4_KEYS.LSP4_CREATORS_ARRAY.slice(0, 34) + + ERC725YDataKeys.LSP4['LSP4Creators[]'].index + ethers.utils.hexZeroPad(ethers.utils.hexlify([2]), 16).substring(2), ]); @@ -27,7 +26,7 @@ export async function testDeployWithSpecifiedCreators( expect(ethers.utils.getAddress(creator3)).toEqual(creators[2]); const creatorKeys = creators.map((creatorAddress) => { - return LSP4_KEYS.LSP4_CREATORS_MAP_PREFIX + creatorAddress.slice(2); + return ERC725YDataKeys.LSP4.LSP4CreatorsMap + creatorAddress.slice(2); }); const creatorValues = await digitalAsset.getDataBatch(creatorKeys); diff --git a/test/test.utils.ts b/test/test.utils.ts index 76f9b346..617a4747 100644 --- a/test/test.utils.ts +++ b/test/test.utils.ts @@ -2,6 +2,7 @@ import crypto from 'crypto'; import { Signer } from '@ethersproject/abstract-signer'; import { NonceManager } from '@ethersproject/experimental'; +import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts'; import { UniversalProfile__factory } from '../types/ethers-v5/factories/UniversalProfile__factory'; import { LSP6KeyManager__factory } from '../types/ethers-v5/factories/LSP6KeyManager__factory'; @@ -79,7 +80,7 @@ function isAddress(address: string) { } export async function testSetData(upAddress: string, keyManagerAddress: string, signer: Signer) { - const key = '0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5'; + const key = ERC725YDataKeys.LSP3.LSP3Profile; const value = '0x' + crypto.randomBytes(32).toString('hex'); const universalProfile = UniversalProfile__factory.connect(upAddress, signer); @@ -92,8 +93,8 @@ export async function testSetData(upAddress: string, keyManagerAddress: string, expect(result).toBeTruthy(); - const data = await universalProfile.getDataBatch([key]); - expect(data).toEqual([value]); + const data = await universalProfile.getData(key); + expect(data).toEqual(value); } export async function testProxyBytecodeContainsAddress(